Present conversation picker when DB is ready

// FREEBIE
pull/1/head
Michael Kirk 7 years ago
parent 3f6f881d3f
commit 4aba6e0c9f

@ -9,7 +9,6 @@ import PureLayout
// All Observer methods will be invoked from the main thread.
protocol SAELoadViewDelegate: class {
func shareExtensionWasCancelled()
func shareExtensionIsReady()
}
class SAELoadViewController: UIViewController {
@ -66,14 +65,6 @@ class SAELoadViewController: UIViewController {
activityIndicator.startAnimating()
}
override func viewDidAppear(_ animated: Bool) {
// FIXME not until ready, and ideally before view appears to avoid any "loading flicker"
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 1) {
Logger.error("Simulating readiness...")
self.delegate?.shareExtensionIsReady()
}
}
override func viewDidDisappear(_ animated: Bool) {
super.viewDidDisappear(animated)

@ -227,6 +227,8 @@ public class ShareViewController: UINavigationController, SAELoadViewDelegate, S
// SignalsNavigationController *navigationController =
// [[SignalsNavigationController alloc] initWithRootViewController:homeView];
// self.window.rootViewController = navigationController;
presentConversationPicker()
} else {
showNotRegisteredView()
}
@ -349,18 +351,14 @@ public class ShareViewController: UINavigationController, SAELoadViewDelegate, S
self.extensionContext!.completeRequest(returningItems: [], completionHandler: nil)
}
public func shareExtensionIsReady() {
self.presentConversationPicker()
}
// MARK: Helpers
private func presentConversationPicker() {
let conversationPicker = SendExternalFileViewController()
buildAttachment().then { attachment -> Void in
conversationPicker.attachment = attachment
self.pushViewController(conversationPicker, animated: false)
Logger.info("presented conversation picker with attachment")
self.pushViewController(conversationPicker, animated: true)
Logger.info("presented conversation picker with attachment: \(attachment)")
}.catch { error in
OWSAlerts.showAlert(withTitle: NSLocalizedString("SHARE_EXTENSION_UNABLE_TO_BUILD_ATTACHMENT_ALERT_TITLE", comment: "Shown when trying to share content to a Signal user for the share extension. Followed by failure details."),
message: error.localizedDescription,

Loading…
Cancel
Save