From 3960b8162e05322c1890b4c0e44a728af63e1b55 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Wed, 6 Dec 2017 21:47:03 -0500 Subject: [PATCH] Respond to CR. --- SignalShareExtension/SAEFailedViewController.swift | 5 ++--- SignalShareExtension/SAELoadViewController.swift | 3 ++- SignalShareExtension/ShareViewController.swift | 8 ++++++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/SignalShareExtension/SAEFailedViewController.swift b/SignalShareExtension/SAEFailedViewController.swift index 45a6c2ba6..8841fe755 100644 --- a/SignalShareExtension/SAEFailedViewController.swift +++ b/SignalShareExtension/SAEFailedViewController.swift @@ -27,10 +27,9 @@ class SAEFailedViewController: UIViewController { super.init(nibName: nil, bundle: nil) } + @available(*, unavailable, message:"use other constructor instead.") required init?(coder aDecoder: NSCoder) { - self.failureTitle = "" - self.failureMessage = "" - super.init(coder: aDecoder) + fatalError("\(#function) is unimplemented.") } override func loadView() { diff --git a/SignalShareExtension/SAELoadViewController.swift b/SignalShareExtension/SAELoadViewController.swift index 2206821b2..07d9e0f7d 100644 --- a/SignalShareExtension/SAELoadViewController.swift +++ b/SignalShareExtension/SAELoadViewController.swift @@ -24,8 +24,9 @@ class SAELoadViewController: UIViewController { super.init(nibName: nil, bundle: nil) } + @available(*, unavailable, message:"use other constructor instead.") required init?(coder aDecoder: NSCoder) { - super.init(coder: aDecoder) + fatalError("\(#function) is unimplemented.") } override func loadView() { diff --git a/SignalShareExtension/ShareViewController.swift b/SignalShareExtension/ShareViewController.swift index 007415b25..75a4c894d 100644 --- a/SignalShareExtension/ShareViewController.swift +++ b/SignalShareExtension/ShareViewController.swift @@ -49,8 +49,16 @@ public class ShareViewController: UINavigationController, SAELoadViewDelegate, S return } + // If we haven't migrated the database file to the shared data + // directory we can't load it, and therefore can't init TSSStorageManager, + // and therefore don't want to setup most of our machinery (Environment, + // most of the singletons, etc.). We just want to show an error view and + // abort. isReadyForAppExtensions = OWSPreferences.isReadyForAppExtensions() if !isReadyForAppExtensions { + // If we don't have TSSStorageManager, we can't consult TSAccountManager + // for isRegistered, so we use OWSPreferences which is usually-accurate + // copy of that state. if (OWSPreferences.isRegistered()) { showNotReadyView() } else {