@ -20,6 +20,12 @@ public class ShareViewController: UINavigationController, SAELoadViewDelegate, S
Logger . debug ( " \( self . logTag ) \( #function ) " )
// W e c a n ' t s h o w t h e c o n v e r s a t i o n p i c k e r u n t i l t h e D B i s s e t u p .
// N o r m a l l y t h i s w i l l o n l y t a k e a m o m e n t , s o r a t h e r t h a n f l i c k e r i n g a n d t h e n h i d i n g t h e l o a d i n g s c r e e n
// W e s t a r t w i t h a s i n v i s i b l e , a n d o n l y f a d e i t i n i f i t ' s g o i n g t o t a k e a w h i l e
self . view . isHidden = true
self . view . alpha = 0
// T h i s s h o u l d b e t h e f i r s t t h i n g w e d o .
let appContext = ShareAppExtensionContext ( rootViewController : self )
SetCurrentAppContext ( appContext )
@ -78,7 +84,7 @@ public class ShareViewController: UINavigationController, SAELoadViewDelegate, S
let loadViewController = SAELoadViewController ( delegate : self )
self . pushViewController ( loadViewController , animated : false )
self . isNavigationBarHidden = fals e
self . isNavigationBarHidden = tru e
// W e d o n ' t n e e d t o u s e " s c r e e n p r o t e c t i o n " i n t h e S A E .
@ -225,7 +231,7 @@ public class ShareViewController: UINavigationController, SAELoadViewDelegate, S
Logger . info ( " Presenting initial root view controller " )
if TSAccountManager . isRegistered ( ) {
show ConversationPicker( )
present ConversationPicker( )
} else {
showNotRegisteredView ( )
}
@ -278,7 +284,6 @@ public class ShareViewController: UINavigationController, SAELoadViewDelegate, S
private func showErrorView ( title : String , message : String ) {
let viewController = SAEFailedViewController ( delegate : self , title : title , message : message )
self . setViewControllers ( [ viewController ] , animated : false )
self . isNavigationBarHidden = false
}
// MARK: V i e w L i f e c y c l e
@ -303,6 +308,14 @@ public class ShareViewController: UINavigationController, SAELoadViewDelegate, S
Logger . debug ( " \( self . logTag ) \( #function ) " )
super . viewDidAppear ( animated )
// W e c a n ' t s h o w t h e c o n v e r s a t i o n p i c k e r u n t i l t h e D B i s s e t u p .
// N o r m a l l y t h i s w i l l o n l y t a k e a m o m e n t , s o r a t h e r t h a n f l i c k e r i n g a n d t h e n h i d i n g t h e l o a d i n g s c r e e n
// W e s t a r t w i t h a s i n v i s i b l e , a n d o n l y f a d e i t i n i f i t ' s g o i n g t o t a k e a w h i l e
self . view . isHidden = false
UIView . animate ( withDuration : 0.1 , delay : 0.5 , options : [ . curveEaseInOut ] , animations : {
self . view . alpha = 1
} , completion : nil )
}
override open func viewWillDisappear ( _ animated : Bool ) {
@ -329,11 +342,13 @@ public class ShareViewController: UINavigationController, SAELoadViewDelegate, S
// MARK: H e l p e r s
private func showConversationPicker ( ) {
let conversationPicker = SendExternalFileViewController ( )
buildAttachment ( ) . then { attachment -> Void in
private func presentConversationPicker ( ) {
self . buildAttachment ( ) . then { attachment -> Void in
let conversationPicker = SendExternalFileViewController ( )
let navigationController = UINavigationController ( rootViewController : conversationPicker )
navigationController . isNavigationBarHidden = true
conversationPicker . attachment = attachment
self . setViewControllers ( [ conversationPicker ] , animated : true )
self . present( navigationController , animated : true , completion : nil )
Logger . info ( " showing picker with attachment: \( attachment ) " )
} . 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. " )