mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Merge branch 'mkirk/conversation-picker-presentation'
This commit is contained in:
commit
2cd3ce62f9
|
@ -20,6 +20,14 @@ public class ShareViewController: UINavigationController, SAELoadViewDelegate, S
|
||||||
|
|
||||||
Logger.debug("\(self.logTag) \(#function)")
|
Logger.debug("\(self.logTag) \(#function)")
|
||||||
|
|
||||||
|
// We can't show the conversation picker until the DB is set up.
|
||||||
|
// Normally this will only take a moment, so rather than flickering and then hiding the loading screen
|
||||||
|
// We start as invisible, and only fade it in if it's going to take a while
|
||||||
|
self.view.alpha = 0
|
||||||
|
UIView.animate(withDuration: 0.1, delay: 0.5, options: [.curveEaseInOut], animations: {
|
||||||
|
self.view.alpha = 1
|
||||||
|
}, completion: nil)
|
||||||
|
|
||||||
// This should be the first thing we do.
|
// This should be the first thing we do.
|
||||||
let appContext = ShareAppExtensionContext(rootViewController:self)
|
let appContext = ShareAppExtensionContext(rootViewController:self)
|
||||||
SetCurrentAppContext(appContext)
|
SetCurrentAppContext(appContext)
|
||||||
|
@ -78,7 +86,7 @@ public class ShareViewController: UINavigationController, SAELoadViewDelegate, S
|
||||||
|
|
||||||
let loadViewController = SAELoadViewController(delegate:self)
|
let loadViewController = SAELoadViewController(delegate:self)
|
||||||
self.pushViewController(loadViewController, animated: false)
|
self.pushViewController(loadViewController, animated: false)
|
||||||
self.isNavigationBarHidden = false
|
self.isNavigationBarHidden = true
|
||||||
|
|
||||||
// We don't need to use "screen protection" in the SAE.
|
// We don't need to use "screen protection" in the SAE.
|
||||||
|
|
||||||
|
@ -225,7 +233,7 @@ public class ShareViewController: UINavigationController, SAELoadViewDelegate, S
|
||||||
Logger.info("Presenting initial root view controller")
|
Logger.info("Presenting initial root view controller")
|
||||||
|
|
||||||
if TSAccountManager.isRegistered() {
|
if TSAccountManager.isRegistered() {
|
||||||
showConversationPicker()
|
presentConversationPicker()
|
||||||
} else {
|
} else {
|
||||||
showNotRegisteredView()
|
showNotRegisteredView()
|
||||||
}
|
}
|
||||||
|
@ -276,9 +284,15 @@ public class ShareViewController: UINavigationController, SAELoadViewDelegate, S
|
||||||
}
|
}
|
||||||
|
|
||||||
private func showErrorView(title: String, message: String) {
|
private func showErrorView(title: String, message: String) {
|
||||||
|
// ensure view is visible.
|
||||||
|
self.view.layer.removeAllAnimations()
|
||||||
|
UIView.animate(withDuration: 0.1, delay: 0, options: [.curveEaseInOut], animations: {
|
||||||
|
|
||||||
|
self.view.alpha = 1
|
||||||
|
}, completion: nil)
|
||||||
|
|
||||||
let viewController = SAEFailedViewController(delegate:self, title:title, message:message)
|
let viewController = SAEFailedViewController(delegate:self, title:title, message:message)
|
||||||
self.setViewControllers([viewController], animated: false)
|
self.setViewControllers([viewController], animated: false)
|
||||||
self.isNavigationBarHidden = false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: View Lifecycle
|
// MARK: View Lifecycle
|
||||||
|
@ -329,11 +343,15 @@ public class ShareViewController: UINavigationController, SAELoadViewDelegate, S
|
||||||
|
|
||||||
// MARK: Helpers
|
// MARK: Helpers
|
||||||
|
|
||||||
private func showConversationPicker() {
|
private func presentConversationPicker() {
|
||||||
let conversationPicker = SendExternalFileViewController()
|
// pause any animation revealing the "loading" screen
|
||||||
buildAttachment().then { attachment -> Void in
|
self.view.layer.removeAllAnimations()
|
||||||
|
self.buildAttachment().then { attachment -> Void in
|
||||||
|
let conversationPicker = SendExternalFileViewController()
|
||||||
|
let navigationController = UINavigationController(rootViewController: conversationPicker)
|
||||||
|
navigationController.isNavigationBarHidden = true
|
||||||
conversationPicker.attachment = attachment
|
conversationPicker.attachment = attachment
|
||||||
self.setViewControllers([conversationPicker], animated: true)
|
self.present(navigationController, animated: true, completion: nil)
|
||||||
Logger.info("showing picker with attachment: \(attachment)")
|
Logger.info("showing picker with attachment: \(attachment)")
|
||||||
}.catch { error in
|
}.catch { error in
|
||||||
let alertTitle = 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.")
|
let alertTitle = 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.")
|
||||||
|
|
Loading…
Reference in a new issue