From fd4f00fa4d7aba1244b263c7c8baef6f19f69b9a Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Wed, 6 Sep 2017 13:55:01 -0400 Subject: [PATCH] Rename new contact thread view. // FREEBIE --- Signal.xcodeproj/project.pbxproj | 12 +-- ...ler.h => NewContactThreadViewController.h} | 2 +- ...ler.m => NewContactThreadViewController.m} | 74 ++++++++++--------- .../ViewControllers/SignalsViewController.m | 4 +- 4 files changed, 48 insertions(+), 44 deletions(-) rename Signal/src/ViewControllers/{MessageComposeTableViewController.h => NewContactThreadViewController.h} (70%) rename Signal/src/ViewControllers/{MessageComposeTableViewController.m => NewContactThreadViewController.m} (94%) diff --git a/Signal.xcodeproj/project.pbxproj b/Signal.xcodeproj/project.pbxproj index cf1c71618..949dbaca9 100644 --- a/Signal.xcodeproj/project.pbxproj +++ b/Signal.xcodeproj/project.pbxproj @@ -54,7 +54,7 @@ 34B3F87E1E8DF1700035BE1A /* InboxTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 34B3F84A1E8DF1700035BE1A /* InboxTableViewCell.m */; }; 34B3F8801E8DF1700035BE1A /* InviteFlow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34B3F84C1E8DF1700035BE1A /* InviteFlow.swift */; }; 34B3F8811E8DF1700035BE1A /* LockInteractionController.m in Sources */ = {isa = PBXBuildFile; fileRef = 34B3F84E1E8DF1700035BE1A /* LockInteractionController.m */; }; - 34B3F8821E8DF1700035BE1A /* MessageComposeTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 34B3F8501E8DF1700035BE1A /* MessageComposeTableViewController.m */; }; + 34B3F8821E8DF1700035BE1A /* NewContactThreadViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 34B3F8501E8DF1700035BE1A /* NewContactThreadViewController.m */; }; 34B3F8851E8DF1700035BE1A /* NewGroupViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 34B3F8551E8DF1700035BE1A /* NewGroupViewController.m */; }; 34B3F8861E8DF1700035BE1A /* NotificationSettingsOptionsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 34B3F8571E8DF1700035BE1A /* NotificationSettingsOptionsViewController.m */; }; 34B3F8871E8DF1700035BE1A /* NotificationSettingsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 34B3F8591E8DF1700035BE1A /* NotificationSettingsViewController.m */; }; @@ -481,8 +481,8 @@ 34B3F84C1E8DF1700035BE1A /* InviteFlow.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InviteFlow.swift; sourceTree = ""; }; 34B3F84D1E8DF1700035BE1A /* LockInteractionController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LockInteractionController.h; sourceTree = ""; }; 34B3F84E1E8DF1700035BE1A /* LockInteractionController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LockInteractionController.m; sourceTree = ""; }; - 34B3F84F1E8DF1700035BE1A /* MessageComposeTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MessageComposeTableViewController.h; sourceTree = ""; }; - 34B3F8501E8DF1700035BE1A /* MessageComposeTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MessageComposeTableViewController.m; sourceTree = ""; }; + 34B3F84F1E8DF1700035BE1A /* NewContactThreadViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NewContactThreadViewController.h; sourceTree = ""; }; + 34B3F8501E8DF1700035BE1A /* NewContactThreadViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NewContactThreadViewController.m; sourceTree = ""; }; 34B3F8541E8DF1700035BE1A /* NewGroupViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NewGroupViewController.h; sourceTree = ""; }; 34B3F8551E8DF1700035BE1A /* NewGroupViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NewGroupViewController.m; sourceTree = ""; }; 34B3F8561E8DF1700035BE1A /* NotificationSettingsOptionsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NotificationSettingsOptionsViewController.h; sourceTree = ""; }; @@ -1027,8 +1027,8 @@ 34B3F84C1E8DF1700035BE1A /* InviteFlow.swift */, 34B3F84D1E8DF1700035BE1A /* LockInteractionController.h */, 34B3F84E1E8DF1700035BE1A /* LockInteractionController.m */, - 34B3F84F1E8DF1700035BE1A /* MessageComposeTableViewController.h */, - 34B3F8501E8DF1700035BE1A /* MessageComposeTableViewController.m */, + 34B3F84F1E8DF1700035BE1A /* NewContactThreadViewController.h */, + 34B3F8501E8DF1700035BE1A /* NewContactThreadViewController.m */, 34B3F8541E8DF1700035BE1A /* NewGroupViewController.h */, 34B3F8551E8DF1700035BE1A /* NewGroupViewController.m */, 3471B1D81EB7C63600F6AEC8 /* NewNonContactConversationViewController.h */, @@ -2329,7 +2329,7 @@ 34B3F8851E8DF1700035BE1A /* NewGroupViewController.m in Sources */, B6C93C4E199567AD00EDF894 /* DebugLogger.m in Sources */, 34D8C0271ED3673300188D7C /* DebugUIMessages.m in Sources */, - 34B3F8821E8DF1700035BE1A /* MessageComposeTableViewController.m in Sources */, + 34B3F8821E8DF1700035BE1A /* NewContactThreadViewController.m in Sources */, 3453D8EA1EC0D4ED003F9E6F /* OWSAlerts.swift in Sources */, 45F659821E1BE77000444429 /* NonCallKitCallUIAdaptee.swift in Sources */, 45AE48511E0732D6004D96C2 /* TurnServerInfo.swift in Sources */, diff --git a/Signal/src/ViewControllers/MessageComposeTableViewController.h b/Signal/src/ViewControllers/NewContactThreadViewController.h similarity index 70% rename from Signal/src/ViewControllers/MessageComposeTableViewController.h rename to Signal/src/ViewControllers/NewContactThreadViewController.h index b6a9c877c..a1f93b34b 100644 --- a/Signal/src/ViewControllers/MessageComposeTableViewController.h +++ b/Signal/src/ViewControllers/NewContactThreadViewController.h @@ -6,7 +6,7 @@ NS_ASSUME_NONNULL_BEGIN -@interface MessageComposeTableViewController : OWSViewController +@interface NewContactThreadViewController : OWSViewController @end diff --git a/Signal/src/ViewControllers/MessageComposeTableViewController.m b/Signal/src/ViewControllers/NewContactThreadViewController.m similarity index 94% rename from Signal/src/ViewControllers/MessageComposeTableViewController.m rename to Signal/src/ViewControllers/NewContactThreadViewController.m index 0b28d7094..f0e480581 100644 --- a/Signal/src/ViewControllers/MessageComposeTableViewController.m +++ b/Signal/src/ViewControllers/NewContactThreadViewController.m @@ -2,7 +2,7 @@ // Copyright (c) 2017 Open Whisper Systems. All rights reserved. // -#import "MessageComposeTableViewController.h" +#import "NewContactThreadViewController.h" #import "ContactTableViewCell.h" #import "ContactsViewHelper.h" #import "Environment.h" @@ -22,7 +22,7 @@ NS_ASSUME_NONNULL_BEGIN -@interface MessageComposeTableViewController () 0); NSString *lastNagAppVersion = [Environment.preferences iOSUpgradeNagVersion]; - if (lastNagAppVersion && - ![lastNagAppVersion isEqualToString:currentAppVersion]) { - + if (lastNagAppVersion && ![lastNagAppVersion isEqualToString:currentAppVersion]) { + [Environment.preferences setIOSUpgradeNagVersion:currentAppVersion]; - - [OWSAlerts showAlertWithTitle: - NSLocalizedString(@"UPGRADE_IOS_ALERT_TITLE", - @"Title for the alert indicating that user should upgrade iOS.") + + [OWSAlerts showAlertWithTitle:NSLocalizedString(@"UPGRADE_IOS_ALERT_TITLE", + @"Title for the alert indicating that user should upgrade iOS.") message:NSLocalizedString(@"UPGRADE_IOS_ALERT_MESSAGE", - @"Message for the alert indicating that user should upgrade iOS.")]; + @"Message for the alert indicating that user should upgrade iOS.")]; } } @@ -277,7 +278,7 @@ NS_ASSUME_NONNULL_BEGIN return; } - __weak MessageComposeTableViewController *weakSelf = self; + __weak NewContactThreadViewController *weakSelf = self; ContactsViewHelper *helper = self.contactsViewHelper; OWSTableSection *section = [OWSTableSection new]; @@ -461,8 +462,7 @@ NS_ASSUME_NONNULL_BEGIN - (void)showContactAppropriateViews { if (self.contactsViewHelper.contactsManager.isSystemContactsAuthorized) { - if (self.contactsViewHelper.hasUpdatedContactsAtLeastOnce - && self.contactsViewHelper.signalAccounts.count < 1 + if (self.contactsViewHelper.hasUpdatedContactsAtLeastOnce && self.contactsViewHelper.signalAccounts.count < 1 && ![[Environment preferences] hasDeclinedNoContactsView]) { self.isNoContactsModeActive = YES; } else { @@ -502,13 +502,13 @@ NS_ASSUME_NONNULL_BEGIN #pragma mark - Send Invite By SMS -- (void)sendTextToPhoneNumber:(NSString *)phoneNumber { +- (void)sendTextToPhoneNumber:(NSString *)phoneNumber +{ OWSAssert([phoneNumber length] > 0); NSString *confirmMessage = NSLocalizedString(@"SEND_SMS_CONFIRM_TITLE", @""); if ([phoneNumber length] > 0) { - confirmMessage = [[NSLocalizedString(@"SEND_SMS_INVITE_TITLE", @"") - stringByAppendingString:phoneNumber] - stringByAppendingString:NSLocalizedString(@"QUESTIONMARK_PUNCTUATION", @"")]; + confirmMessage = [[NSLocalizedString(@"SEND_SMS_INVITE_TITLE", @"") stringByAppendingString:phoneNumber] + stringByAppendingString:NSLocalizedString(@"QUESTIONMARK_PUNCTUATION", @"")]; } UIAlertController *alertController = @@ -543,11 +543,14 @@ NS_ASSUME_NONNULL_BEGIN [alertController addAction:okAction]; self.searchBar.text = @""; - //must dismiss search controller before presenting alert. + // must dismiss search controller before presenting alert. if ([self presentedViewController]) { - [self dismissViewControllerAnimated:YES completion:^{ - [self presentViewController:alertController animated:YES completion:[UIUtil modalCompletionBlock]]; - }]; + [self dismissViewControllerAnimated:YES + completion:^{ + [self presentViewController:alertController + animated:YES + completion:[UIUtil modalCompletionBlock]]; + }]; } else { [self presentViewController:alertController animated:YES completion:[UIUtil modalCompletionBlock]]; } @@ -557,7 +560,8 @@ NS_ASSUME_NONNULL_BEGIN // called on completion of message screen - (void)messageComposeViewController:(MFMessageComposeViewController *)controller - didFinishWithResult:(MessageComposeResult)result { + didFinishWithResult:(MessageComposeResult)result +{ switch (result) { case MessageComposeResultCancelled: break; @@ -574,14 +578,14 @@ NS_ASSUME_NONNULL_BEGIN case MessageComposeResultSent: { [self dismissViewControllerAnimated:NO completion:^{ - DDLogDebug(@"view controller dismissed"); + DDLogDebug(@"view controller dismissed"); }]; - UIAlertView *successAlert = - [[UIAlertView alloc] initWithTitle:@"" - message:NSLocalizedString(@"SEND_INVITE_SUCCESS", @"Alert body after invite succeeded") - delegate:nil - cancelButtonTitle:NSLocalizedString(@"OK", @"") - otherButtonTitles:nil]; + UIAlertView *successAlert = [[UIAlertView alloc] + initWithTitle:@"" + message:NSLocalizedString(@"SEND_INVITE_SUCCESS", @"Alert body after invite succeeded") + delegate:nil + cancelButtonTitle:NSLocalizedString(@"OK", @"") + otherButtonTitles:nil]; [successAlert show]; break; } @@ -760,7 +764,7 @@ NS_ASSUME_NONNULL_BEGIN return; } - __weak MessageComposeTableViewController *weakSelf = self; + __weak NewContactThreadViewController *weakSelf = self; [[ContactsUpdater sharedUpdater] lookupIdentifiers:unknownPhoneNumbers success:^(NSArray *recipients) { [weakSelf updateNonContactAccountSet:recipients]; diff --git a/Signal/src/ViewControllers/SignalsViewController.m b/Signal/src/ViewControllers/SignalsViewController.m index 7433a0b53..e14ecb93d 100644 --- a/Signal/src/ViewControllers/SignalsViewController.m +++ b/Signal/src/ViewControllers/SignalsViewController.m @@ -6,9 +6,9 @@ #import "AppDelegate.h" #import "AppSettingsViewController.h" #import "InboxTableViewCell.h" -#import "MessageComposeTableViewController.h" #import "MessagesViewController.h" #import "NSDate+millisecondTimeStamp.h" +#import "NewContactThreadViewController.h" #import "OWSContactsManager.h" #import "OWSNavigationController.h" #import "ProfileViewController.h" @@ -344,7 +344,7 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState }; - (void)composeNew { - MessageComposeTableViewController *viewController = [MessageComposeTableViewController new]; + NewContactThreadViewController *viewController = [NewContactThreadViewController new]; [self.contactsManager requestSystemContactsOnceWithCompletion:^(NSError *_Nullable error) { if (error) {