diff --git a/Signal.xcodeproj/project.pbxproj b/Signal.xcodeproj/project.pbxproj index f47822bd0..4ffde7411 100644 --- a/Signal.xcodeproj/project.pbxproj +++ b/Signal.xcodeproj/project.pbxproj @@ -12,7 +12,6 @@ 70377AAB1918450100CAF501 /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 70377AAA1918450100CAF501 /* MobileCoreServices.framework */; }; 7038632718F70C0700D4A43F /* CryptoTools.m in Sources */ = {isa = PBXBuildFile; fileRef = 7038632418F70C0700D4A43F /* CryptoTools.m */; }; 7038632818F70C0700D4A43F /* EvpSymetricUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 7038632618F70C0700D4A43F /* EvpSymetricUtil.m */; }; - 707E549218FF26E800C8649D /* SmsInvite.m in Sources */ = {isa = PBXBuildFile; fileRef = 707E549118FF26E800C8649D /* SmsInvite.m */; }; 7095B7B018F46D35002C66E2 /* PhoneNumberUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 7095B7AF18F46D35002C66E2 /* PhoneNumberUtil.m */; }; 70B800A6190C53180042E3F0 /* libspandsp.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 70B800A3190C529C0042E3F0 /* libspandsp.a */; }; 70B800AF190C548D0042E3F0 /* libspeex.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 70B800AC190C54790042E3F0 /* libspeex.a */; }; @@ -593,8 +592,6 @@ 7038632418F70C0700D4A43F /* CryptoTools.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CryptoTools.m; sourceTree = ""; }; 7038632518F70C0700D4A43F /* EvpSymetricUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EvpSymetricUtil.h; sourceTree = ""; }; 7038632618F70C0700D4A43F /* EvpSymetricUtil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EvpSymetricUtil.m; sourceTree = ""; }; - 707E549018FF26E800C8649D /* SmsInvite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SmsInvite.h; sourceTree = ""; }; - 707E549118FF26E800C8649D /* SmsInvite.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SmsInvite.m; sourceTree = ""; }; 7095B7AE18F46D35002C66E2 /* PhoneNumberUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PhoneNumberUtil.h; sourceTree = ""; }; 7095B7AF18F46D35002C66E2 /* PhoneNumberUtil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PhoneNumberUtil.m; sourceTree = ""; }; 70B8009E190C529C0042E3F0 /* spandsp.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = spandsp.xcodeproj; path = Libraries/spandsp/spandsp/spandsp.xcodeproj; sourceTree = ""; }; @@ -1841,8 +1838,6 @@ 7095B7AE18F46D35002C66E2 /* PhoneNumberUtil.h */, 7095B7AF18F46D35002C66E2 /* PhoneNumberUtil.m */, 76EB04F018170B33006006FC /* protocols */, - 707E549018FF26E800C8649D /* SmsInvite.h */, - 707E549118FF26E800C8649D /* SmsInvite.m */, 76EB04F518170B33006006FC /* StringUtil.h */, 76EB04F618170B33006006FC /* StringUtil.m */, 76EB04F718170B33006006FC /* ThreadManager.h */, @@ -3226,7 +3221,6 @@ E197B61418BBEC1A00F073E5 /* DropoutTracker.m in Sources */, 76EB062C18170B33006006FC /* OperationFailed.m in Sources */, FCAC963C19FEF9280046DFC5 /* SignalsViewController.m in Sources */, - 707E549218FF26E800C8649D /* SmsInvite.m in Sources */, 76EB05DA18170B33006006FC /* LowLatencyConnector.m in Sources */, 76EB05EE18170B33006006FC /* CallTermination.m in Sources */, E1CD329618BCFF9900B1A496 /* SoundInstance.m in Sources */, diff --git a/Signal/src/util/SmsInvite.h b/Signal/src/util/SmsInvite.h deleted file mode 100644 index 4a77b4089..000000000 --- a/Signal/src/util/SmsInvite.h +++ /dev/null @@ -1,13 +0,0 @@ -#import -#import -#import "PhoneNumber.h" - -@interface SmsInvite : NSObject { - UIViewController* parent; -} - -+(SmsInvite*) smsInviteWithParent:(UIViewController*) parent; - --(void)sendSMSInviteToNumber:(PhoneNumber *)number; - -@end diff --git a/Signal/src/util/SmsInvite.m b/Signal/src/util/SmsInvite.m deleted file mode 100644 index 795dd5518..000000000 --- a/Signal/src/util/SmsInvite.m +++ /dev/null @@ -1,35 +0,0 @@ -#import "SmsInvite.h" - -#import "LocalizableText.h" - -@implementation SmsInvite - -+ (SmsInvite*) smsInviteWithParent:(UIViewController *)parent { - SmsInvite* invite = [SmsInvite new]; - invite->parent = parent; - return invite; -} - -- (void)sendSMSInviteToNumber:(PhoneNumber *)number{ - if (MFMessageComposeViewController.canSendText && [UIDevice.currentDevice.model isEqualToString:@"iPhone"]){ - MFMessageComposeViewController *messageController = [MFMessageComposeViewController new]; - - NSString *inviteMessage = INVITE_USERS_MESSAGE; - - messageController.body = [inviteMessage stringByAppendingString:@" https://itunes.apple.com/app/id874139669"]; - messageController.recipients = @[number.toE164]; - messageController.messageComposeDelegate = self; - - [parent presentViewController:messageController - animated:YES - completion:nil]; - } -} - -- (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result { - [controller dismissViewControllerAnimated:YES - completion:nil]; -} - - -@end diff --git a/Signal/src/util/UIUtil.h b/Signal/src/util/UIUtil.h index 178de3f3a..4ae47d2b1 100644 --- a/Signal/src/util/UIUtil.h +++ b/Signal/src/util/UIUtil.h @@ -6,6 +6,8 @@ #import "UIImage+contentTypes.h" #import "MIMETypeUtil.h" +typedef void (^completionBlock)(void); + /** * * UIUtil contains various class methods that centralize common app UI functionality that would otherwise be hardcoded. @@ -17,4 +19,6 @@ + (void)applyRoundedBorderToImageView:(UIImageView *__strong*)imageView; + (void)removeRoundedBorderToImageView:(UIImageView *__strong*)imageView; ++ (completionBlock)modalCompletionBlock; + @end diff --git a/Signal/src/util/UIUtil.m b/Signal/src/util/UIUtil.m index 57e3c06ee..6f00337c5 100644 --- a/Signal/src/util/UIUtil.m +++ b/Signal/src/util/UIUtil.m @@ -16,4 +16,12 @@ [[*imageView layer] setCornerRadius:0]; } ++ (completionBlock)modalCompletionBlock { + completionBlock block = ^void() { + [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent]; + }; + + return block; +} + @end diff --git a/Signal/src/view controllers/AboutTableViewController.m b/Signal/src/view controllers/AboutTableViewController.m index 8d28870e7..782249121 100644 --- a/Signal/src/view controllers/AboutTableViewController.m +++ b/Signal/src/view controllers/AboutTableViewController.m @@ -152,7 +152,7 @@ [tweetSheet addURL:[NSURL URLWithString:@"https://whispersystems.org/signal/install/"]]; tweetSheet.completionHandler = ^(SLComposeViewControllerResult result) { }; - [self presentViewController:tweetSheet animated:YES completion:nil]; + [self presentViewController:tweetSheet animated:YES completion:[UIUtil modalCompletionBlock]]; } } diff --git a/Signal/src/view controllers/FullImageViewController.m b/Signal/src/view controllers/FullImageViewController.m index c4d1b6bf3..a8633a999 100644 --- a/Signal/src/view controllers/FullImageViewController.m +++ b/Signal/src/view controllers/FullImageViewController.m @@ -9,6 +9,7 @@ #import "FullImageViewController.h" #import "DJWActionSheet+OWS.h" #import "TSAttachmentStream.h" +#import "UIUtil.h" #define kImageViewCornerRadius 5.0f @@ -210,7 +211,7 @@ self.view.userInteractionEnabled = YES; _isPresenting = NO; }]; - [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent]; + [UIUtil modalCompletionBlock](); }]; } diff --git a/Signal/src/view controllers/MessageComposeTableViewController.m b/Signal/src/view controllers/MessageComposeTableViewController.m index 14200de58..06dbbf1c6 100644 --- a/Signal/src/view controllers/MessageComposeTableViewController.m +++ b/Signal/src/view controllers/MessageComposeTableViewController.m @@ -20,6 +20,7 @@ #import "ContactTableViewCell.h" #import "UIColor+OWS.h" +#import "UIUtil.h" @interface MessageComposeTableViewController () { @@ -198,10 +199,8 @@ picker.recipients = [NSArray arrayWithObject:currentSearchTerm]; picker.body = @"I'm inviting you to install Signal! Here is the link: https://itunes.apple.com/us/app/signal-private-messenger/id874139669?mt=8"; - [self presentViewController:picker animated:YES completion:^{ - [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent]; - }]; - } else { + [self presentViewController:picker animated:YES completion:[UIUtil modalCompletionBlock]]; + } else { // TODO: better backup for iPods (just don't support on) UIAlertView *notPermitted=[[UIAlertView alloc] initWithTitle:@"Alert" message:@"Your device doesn't support this feature." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; @@ -214,7 +213,7 @@ sendTextButton.hidden = YES; self.searchController.searchBar.text = @""; [self.navigationController dismissViewControllerAnimated:YES completion:nil]; - [self presentViewController:alertController animated:YES completion:nil]; + [self presentViewController:alertController animated:YES completion:[UIUtil modalCompletionBlock]]; } #pragma mark - SMS Composer Delegate diff --git a/Signal/src/view controllers/MessagesViewController.m b/Signal/src/view controllers/MessagesViewController.m index 4fe561309..1f6002867 100644 --- a/Signal/src/view controllers/MessagesViewController.m +++ b/Signal/src/view controllers/MessagesViewController.m @@ -1019,7 +1019,7 @@ typedef enum : NSUInteger { if ([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera]) { picker.mediaTypes = @[(NSString*)kUTTypeImage,(NSString*)kUTTypeMovie]; - [self presentViewController:picker animated:YES completion:NULL]; + [self presentViewController:picker animated:YES completion:[UIUtil modalCompletionBlock]]; } } @@ -1038,7 +1038,7 @@ typedef enum : NSUInteger { picker.mediaTypes = (mediaType == kMediaTypePicture) ? pictureTypeArray : videoTypeArray; - [self presentViewController:picker animated:YES completion:nil]; + [self presentViewController:picker animated:YES completion:[UIUtil modalCompletionBlock]]; } } diff --git a/Signal/src/view controllers/NewGroupViewController.m b/Signal/src/view controllers/NewGroupViewController.m index d99b8d72f..098f76b8a 100644 --- a/Signal/src/view controllers/NewGroupViewController.m +++ b/Signal/src/view controllers/NewGroupViewController.m @@ -197,7 +197,7 @@ static NSString* const kUnwindToMessagesViewSegue = @"UnwindToMessagesViewSegue" UIImagePickerControllerSourceTypeCamera]) { picker.mediaTypes = [[NSArray alloc] initWithObjects: (NSString *)kUTTypeImage, nil]; - [self presentViewController:picker animated:YES completion:NULL]; + [self presentViewController:picker animated:YES completion:[UIUtil modalCompletionBlock]]; } } @@ -210,7 +210,7 @@ static NSString* const kUnwindToMessagesViewSegue = @"UnwindToMessagesViewSegue" if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeSavedPhotosAlbum]) { picker.mediaTypes = [[NSArray alloc] initWithObjects:(NSString *)kUTTypeImage, nil]; - [self presentViewController:picker animated:YES completion:nil]; + [self presentViewController:picker animated:YES completion:[UIUtil modalCompletionBlock]]; } } diff --git a/Signal/src/view controllers/RegistrationViewController.m b/Signal/src/view controllers/RegistrationViewController.m index d6253b6e9..edb088397 100644 --- a/Signal/src/view controllers/RegistrationViewController.m +++ b/Signal/src/view controllers/RegistrationViewController.m @@ -112,7 +112,7 @@ static NSString *const kCodeSentSegue = @"codeSent"; - (IBAction)changeCountryCodeTapped { CountryCodeViewController *countryCodeController = [CountryCodeViewController new]; - [self presentViewController:countryCodeController animated:YES completion:nil]; + [self presentViewController:countryCodeController animated:YES completion:[UIUtil modalCompletionBlock]]; } - (void)presentInvalidCountryCodeError {