@ -361,12 +361,11 @@ extension ConversationVC:
let modal = SendSeedModal ( )
modal . modalPresentationStyle = . overFullScreen
modal . modalTransitionStyle = . crossDissolve
modal . proceed = { self . sendMessage ( hasPermissionToSendSeed : true ) }
modal . proceed = { [ weak self ] in self ? . sendMessage ( hasPermissionToSendSeed : true ) }
return present ( modal , animated : true , completion : nil )
}
// C l e a r i n g t h i s o u t i m m e d i a t e l y ( e v e n t h o u g h i t a l r e a d y h a p p e n s i n ' m e s s a g e S e n t ' ) t o p r e v e n t
// " d o u b l e s e n d i n g " i f t h e u s e r r a p i d l y t a p s t h e s e n d b u t t o n
// C l e a r i n g t h i s o u t i m m e d i a t e l y t o m a k e t h i s a p p e a r m o r e s n a p p y
DispatchQueue . main . async { [ weak self ] in
self ? . snInputView . text = " "
self ? . snInputView . quoteDraftInfo = nil
@ -462,7 +461,7 @@ extension ConversationVC:
)
}
func sendAttachments ( _ attachments : [ SignalAttachment ] , with text : String , onComplete: ( ( ) -> ( ) ) ? = nil ) {
func sendAttachments ( _ attachments : [ SignalAttachment ] , with text : String , hasPermissionToSendSeed: Bool = false , onComplete: ( ( ) -> ( ) ) ? = nil ) {
guard ! showBlockedModalIfNeeded ( ) else { return }
for attachment in attachments {
@ -472,6 +471,25 @@ extension ConversationVC:
}
let text = replaceMentions ( in : snInputView . text . trimmingCharacters ( in : . whitespacesAndNewlines ) )
if text . contains ( mnemonic ) && ! viewModel . threadData . threadIsNoteToSelf && ! hasPermissionToSendSeed {
// W a r n t h e u s e r i f t h e y ' r e a b o u t t o s e n d t h e i r s e e d t o s o m e o n e
let modal = SendSeedModal ( )
modal . modalPresentationStyle = . overFullScreen
modal . modalTransitionStyle = . crossDissolve
modal . proceed = { [ weak self ] in
self ? . sendAttachments ( attachments , with : text , hasPermissionToSendSeed : true , onComplete : onComplete )
}
return present ( modal , animated : true , completion : nil )
}
// C l e a r i n g t h i s o u t i m m e d i a t e l y t o m a k e t h i s a p p e a r m o r e s n a p p y
DispatchQueue . main . async { [ weak self ] in
self ? . snInputView . text = " "
self ? . snInputView . quoteDraftInfo = nil
self ? . resetMentions ( )
}
// N o t e : ' s h o u l d B e V i s i b l e ' i s s e t t o t r u e t h e f i r s t t i m e a t h r e a d i s s a v e d s o w e c a n
// u s e i t t o d e t e r m i n e i f t h e u s e r i s c r e a t i n g a n e w t h r e a d a n d u p d a t e t h e ' i s A p p r o v e d '
@ -538,13 +556,6 @@ extension ConversationVC:
}
func handleMessageSent ( ) {
DispatchQueue . main . async { [ weak self ] in
self ? . snInputView . text = " "
self ? . snInputView . quoteDraftInfo = nil
self ? . resetMentions ( )
}
if Storage . shared [ . playNotificationSoundInForeground ] {
let soundID = Preferences . Sound . systemSoundId ( for : . messageSent , quiet : true )
AudioServicesPlaySystemSound ( soundID )