diff --git a/Signal.xcodeproj/project.pbxproj b/Signal.xcodeproj/project.pbxproj index cf1c71618..6f6bbc118 100644 --- a/Signal.xcodeproj/project.pbxproj +++ b/Signal.xcodeproj/project.pbxproj @@ -25,8 +25,8 @@ 3448BFCC1EDF0EA7005B2D69 /* OWSMessagesToolbarContentView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3448BFC21EDF0EA7005B2D69 /* OWSMessagesToolbarContentView.m */; }; 3448BFCD1EDF0EA7005B2D69 /* OWSMessagesInputToolbar.m in Sources */ = {isa = PBXBuildFile; fileRef = 3448BFC41EDF0EA7005B2D69 /* OWSMessagesInputToolbar.m */; }; 3448BFCF1EDF0EA7005B2D69 /* OWSMessagesComposerTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3448BFC81EDF0EA7005B2D69 /* OWSMessagesComposerTextView.m */; }; - 3448BFD01EDF0EA7005B2D69 /* MessagesViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3448BFCA1EDF0EA7005B2D69 /* MessagesViewController.m */; }; - 3448BFD11EDF0EA7005B2D69 /* MessagesViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3448BFCB1EDF0EA7005B2D69 /* MessagesViewController.xib */; }; + 3448BFD01EDF0EA7005B2D69 /* ConversationViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3448BFCA1EDF0EA7005B2D69 /* ConversationViewController.m */; }; + 3448BFD11EDF0EA7005B2D69 /* ConversationViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3448BFCB1EDF0EA7005B2D69 /* ConversationViewController.xib */; }; 344F2F671E57A932000D9322 /* UIViewController+OWS.m in Sources */ = {isa = PBXBuildFile; fileRef = 344F2F661E57A932000D9322 /* UIViewController+OWS.m */; }; 34533F181EA8D2070006114F /* OWSAudioAttachmentPlayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 34533F171EA8D2070006114F /* OWSAudioAttachmentPlayer.m */; }; 34535D821E256BE9008A4747 /* UIView+OWS.m in Sources */ = {isa = PBXBuildFile; fileRef = 34535D811E256BE9008A4747 /* UIView+OWS.m */; }; @@ -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 */; }; @@ -70,7 +70,7 @@ 34B3F8911E8DF1710035BE1A /* ShowGroupMembersViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 34B3F86B1E8DF1700035BE1A /* ShowGroupMembersViewController.m */; }; 34B3F8921E8DF1710035BE1A /* SignalAttachment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34B3F86C1E8DF1700035BE1A /* SignalAttachment.swift */; }; 34B3F8931E8DF1710035BE1A /* SignalsNavigationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 34B3F86E1E8DF1700035BE1A /* SignalsNavigationController.m */; }; - 34B3F8941E8DF1710035BE1A /* SignalsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 34B3F8701E8DF1700035BE1A /* SignalsViewController.m */; }; + 34B3F8941E8DF1710035BE1A /* HomeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 34B3F8701E8DF1700035BE1A /* HomeViewController.m */; }; 34B3F8991E8DF1B90035BE1A /* TSMessageAdapterTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 34B3F8981E8DF1B90035BE1A /* TSMessageAdapterTest.m */; }; 34B3F89C1E8DF3270035BE1A /* BlockListViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 34B3F89B1E8DF3270035BE1A /* BlockListViewController.m */; }; 34B3F89F1E8DF5490035BE1A /* OWSTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 34B3F89E1E8DF5490035BE1A /* OWSTableViewController.m */; }; @@ -432,9 +432,9 @@ 3448BFC41EDF0EA7005B2D69 /* OWSMessagesInputToolbar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWSMessagesInputToolbar.m; sourceTree = ""; }; 3448BFC71EDF0EA7005B2D69 /* OWSMessagesComposerTextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSMessagesComposerTextView.h; sourceTree = ""; }; 3448BFC81EDF0EA7005B2D69 /* OWSMessagesComposerTextView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWSMessagesComposerTextView.m; sourceTree = ""; }; - 3448BFC91EDF0EA7005B2D69 /* MessagesViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MessagesViewController.h; sourceTree = ""; }; - 3448BFCA1EDF0EA7005B2D69 /* MessagesViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MessagesViewController.m; sourceTree = ""; }; - 3448BFCB1EDF0EA7005B2D69 /* MessagesViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MessagesViewController.xib; sourceTree = ""; }; + 3448BFC91EDF0EA7005B2D69 /* ConversationViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ConversationViewController.h; sourceTree = ""; }; + 3448BFCA1EDF0EA7005B2D69 /* ConversationViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ConversationViewController.m; sourceTree = ""; }; + 3448BFCB1EDF0EA7005B2D69 /* ConversationViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ConversationViewController.xib; sourceTree = ""; }; 344F2F651E57A932000D9322 /* UIViewController+OWS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UIViewController+OWS.h"; path = "util/UIViewController+OWS.h"; sourceTree = ""; }; 344F2F661E57A932000D9322 /* UIViewController+OWS.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UIViewController+OWS.m"; path = "util/UIViewController+OWS.m"; sourceTree = ""; }; 34533F161EA8D2070006114F /* OWSAudioAttachmentPlayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSAudioAttachmentPlayer.h; sourceTree = ""; }; @@ -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 = ""; }; @@ -510,8 +510,8 @@ 34B3F86C1E8DF1700035BE1A /* SignalAttachment.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SignalAttachment.swift; sourceTree = ""; }; 34B3F86D1E8DF1700035BE1A /* SignalsNavigationController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SignalsNavigationController.h; sourceTree = ""; }; 34B3F86E1E8DF1700035BE1A /* SignalsNavigationController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SignalsNavigationController.m; sourceTree = ""; }; - 34B3F86F1E8DF1700035BE1A /* SignalsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SignalsViewController.h; sourceTree = ""; }; - 34B3F8701E8DF1700035BE1A /* SignalsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SignalsViewController.m; sourceTree = ""; }; + 34B3F86F1E8DF1700035BE1A /* HomeViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HomeViewController.h; sourceTree = ""; }; + 34B3F8701E8DF1700035BE1A /* HomeViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HomeViewController.m; sourceTree = ""; }; 34B3F8981E8DF1B90035BE1A /* TSMessageAdapterTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TSMessageAdapterTest.m; sourceTree = ""; }; 34B3F89A1E8DF3270035BE1A /* BlockListViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BlockListViewController.h; sourceTree = ""; }; 34B3F89B1E8DF3270035BE1A /* BlockListViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BlockListViewController.m; sourceTree = ""; }; @@ -966,9 +966,9 @@ 3448BFC01EDF0EA7005B2D69 /* ConversationView */ = { isa = PBXGroup; children = ( - 3448BFC91EDF0EA7005B2D69 /* MessagesViewController.h */, - 3448BFCA1EDF0EA7005B2D69 /* MessagesViewController.m */, - 3448BFCB1EDF0EA7005B2D69 /* MessagesViewController.xib */, + 3448BFC91EDF0EA7005B2D69 /* ConversationViewController.h */, + 3448BFCA1EDF0EA7005B2D69 /* ConversationViewController.m */, + 3448BFCB1EDF0EA7005B2D69 /* ConversationViewController.xib */, 3448BFC71EDF0EA7005B2D69 /* OWSMessagesComposerTextView.h */, 3448BFC81EDF0EA7005B2D69 /* OWSMessagesComposerTextView.m */, 3448BFC31EDF0EA7005B2D69 /* OWSMessagesInputToolbar.h */, @@ -1022,13 +1022,15 @@ 34E8BF371EE9E2FD00F5F4CA /* FingerprintViewScanController.m */, 34B3F8471E8DF1700035BE1A /* FullImageViewController.h */, 34B3F8481E8DF1700035BE1A /* FullImageViewController.m */, + 34B3F86F1E8DF1700035BE1A /* HomeViewController.h */, + 34B3F8701E8DF1700035BE1A /* HomeViewController.m */, 34B3F8491E8DF1700035BE1A /* InboxTableViewCell.h */, 34B3F84A1E8DF1700035BE1A /* InboxTableViewCell.m */, 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 */, @@ -1078,8 +1080,6 @@ 34B3F86C1E8DF1700035BE1A /* SignalAttachment.swift */, 34B3F86D1E8DF1700035BE1A /* SignalsNavigationController.h */, 34B3F86E1E8DF1700035BE1A /* SignalsNavigationController.m */, - 34B3F86F1E8DF1700035BE1A /* SignalsViewController.h */, - 34B3F8701E8DF1700035BE1A /* SignalsViewController.m */, 3400C7971EAFB772008A8584 /* ThreadViewHelper.h */, 3400C7981EAFB772008A8584 /* ThreadViewHelper.m */, 340CB2251EAC25820001CAA1 /* UpdateGroupViewController.h */, @@ -1995,7 +1995,7 @@ B633C59D1A1D190B0059AC12 /* endcall@2x.png in Resources */, FC5CDF391A3393DD00B47253 /* error_white@2x.png in Resources */, B633C5D21A1D190B0059AC12 /* savephoto@2x.png in Resources */, - 3448BFD11EDF0EA7005B2D69 /* MessagesViewController.xib in Resources */, + 3448BFD11EDF0EA7005B2D69 /* ConversationViewController.xib in Resources */, B10C9B611A7049EC00ECA2BF /* play_icon.png in Resources */, AD83FF401A73426500B5C81A /* audio_pause_button_blue@2x.png in Resources */, B66DBF4A19D5BBC8006EA940 /* Images.xcassets in Resources */, @@ -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 */, @@ -2348,7 +2348,7 @@ 34B3F88D1E8DF1700035BE1A /* OWSQRCodeScanningViewController.m in Sources */, 34B3F8811E8DF1700035BE1A /* LockInteractionController.m in Sources */, 3448BFCC1EDF0EA7005B2D69 /* OWSMessagesToolbarContentView.m in Sources */, - 3448BFD01EDF0EA7005B2D69 /* MessagesViewController.m in Sources */, + 3448BFD01EDF0EA7005B2D69 /* ConversationViewController.m in Sources */, 34CCAF3B1F0C2748004084F4 /* OWSAddToContactViewController.m in Sources */, 45F659731E1BD99C00444429 /* CallKitCallUIAdaptee.swift in Sources */, 45BB93381E688E14001E3939 /* UIDevice+featureSupport.swift in Sources */, @@ -2388,7 +2388,7 @@ 4579431E1E7C8CE9008ED0C0 /* Pastelog.m in Sources */, 34D99C941F2937CC00D284D6 /* OWSSwiftUtils.swift in Sources */, 34C42D661F4734ED0072EC04 /* OWSContactOffersInteraction.m in Sources */, - 34B3F8941E8DF1710035BE1A /* SignalsViewController.m in Sources */, + 34B3F8941E8DF1710035BE1A /* HomeViewController.m in Sources */, 34E8BF381EE9E2FD00F5F4CA /* FingerprintViewScanController.m in Sources */, 346B66311F4E29B200E5122F /* CropScaleImageViewController.swift in Sources */, 76EB058818170B33006006FC /* PropertyListPreferences.m in Sources */, diff --git a/Signal/src/AppDelegate.h b/Signal/src/AppDelegate.h index 915a72dc9..07264aa0a 100644 --- a/Signal/src/AppDelegate.h +++ b/Signal/src/AppDelegate.h @@ -4,7 +4,7 @@ #import -#import "SignalsViewController.h" +#import "HomeViewController.h" extern NSString *const AppDelegateStoryboardMain; diff --git a/Signal/src/AppDelegate.m b/Signal/src/AppDelegate.m index e43f4fb77..e96bfeed5 100644 --- a/Signal/src/AppDelegate.m +++ b/Signal/src/AppDelegate.m @@ -801,7 +801,7 @@ static NSString *const kURLHostVerifyPrefix = @"verify"; DDLogInfo(@"Presenting initial root view controller"); if ([TSAccountManager isRegistered]) { - SignalsViewController *homeView = [SignalsViewController new]; + HomeViewController *homeView = [HomeViewController new]; SignalsNavigationController *navigationController = [[SignalsNavigationController alloc] initWithRootViewController:homeView]; self.window.rootViewController = navigationController; diff --git a/Signal/src/Signal-Bridging-Header.h b/Signal/src/Signal-Bridging-Header.h index 73fe8057a..a4a6e4293 100644 --- a/Signal/src/Signal-Bridging-Header.h +++ b/Signal/src/Signal-Bridging-Header.h @@ -10,6 +10,7 @@ #import "Environment.h" #import "FLAnimatedImage.h" #import "FingerprintViewController.h" +#import "HomeViewController.h" #import "NotificationsManager.h" #import "OWSAnyTouchGestureRecognizer.h" #import "OWSAudioAttachmentPlayer.h" @@ -29,7 +30,6 @@ #import "PropertyListPreferences.h" #import "PushManager.h" #import "Release.h" -#import "SignalsViewController.h" #import "TSMessageAdapter.h" #import "UIColor+OWS.h" #import "UIFont+OWS.h" diff --git a/Signal/src/Storyboard/Main.storyboard b/Signal/src/Storyboard/Main.storyboard index b69a00d4e..ca04385c5 100644 --- a/Signal/src/Storyboard/Main.storyboard +++ b/Signal/src/Storyboard/Main.storyboard @@ -1,65 +1,17 @@ - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -262,7 +214,6 @@ - diff --git a/Signal/src/ViewControllers/ConversationView/MessagesViewController.h b/Signal/src/ViewControllers/ConversationView/ConversationViewController.h similarity index 76% rename from Signal/src/ViewControllers/ConversationView/MessagesViewController.h rename to Signal/src/ViewControllers/ConversationView/ConversationViewController.h index da36fb9a0..4ca34e2df 100644 --- a/Signal/src/ViewControllers/ConversationView/MessagesViewController.h +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewController.h @@ -6,9 +6,9 @@ @class TSThread; -extern NSString *const OWSMessagesViewControllerDidAppearNotification; +extern NSString *const ConversationViewControllerDidAppearNotification; -@interface MessagesViewController : JSQMessagesViewController +@interface ConversationViewController : JSQMessagesViewController @property (nonatomic, readonly) TSThread *thread; diff --git a/Signal/src/ViewControllers/ConversationView/MessagesViewController.m b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m similarity index 98% rename from Signal/src/ViewControllers/ConversationView/MessagesViewController.m rename to Signal/src/ViewControllers/ConversationView/ConversationViewController.m index 71851ed6a..0621f35a4 100644 --- a/Signal/src/ViewControllers/ConversationView/MessagesViewController.m +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m @@ -2,7 +2,7 @@ // Copyright (c) 2017 Open Whisper Systems. All rights reserved. // -#import "MessagesViewController.h" +#import "ConversationViewController.h" #import "AppDelegate.h" #import "AttachmentSharing.h" #import "BlockListUIUtils.h" @@ -106,7 +106,7 @@ static const int JSQ_IMAGE_INSET = 5; static NSTimeInterval const kTSMessageSentDateShowTimeInterval = 5 * kMinuteInterval; -NSString *const OWSMessagesViewControllerDidAppearNotification = @"OWSMessagesViewControllerDidAppear"; +NSString *const ConversationViewControllerDidAppearNotification = @"ConversationViewControllerDidAppear"; typedef enum : NSUInteger { kMediaTypePicture, @@ -154,7 +154,7 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) { #pragma mark - -@interface MessagesViewController () > *interactions = [NSMutableArray new]; - + [[TSDatabaseView unseenDatabaseViewExtension:transaction] enumerateRowsInGroup:thread.uniqueId usingBlock:^( @@ -4130,7 +4128,7 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) { // Max out the unread count at 99+. const NSUInteger kMaxUnreadCount = 99; - _backButtonUnreadCountLabel.text = [ViewControllerUtils formatInt:(int) MIN(kMaxUnreadCount, unreadCount)]; + _backButtonUnreadCountLabel.text = [ViewControllerUtils formatInt:(int)MIN(kMaxUnreadCount, unreadCount)]; } #pragma mark 3D Touch Preview Actions @@ -4185,7 +4183,7 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) { DDLogError(@"%@ %s", self.tag, __PRETTY_FUNCTION__); DispatchMainThreadSafe(^{ - __weak MessagesViewController *weakSelf = self; + __weak ConversationViewController *weakSelf = self; if ([self isBlockedContactConversation]) { [self showUnblockContactUI:^(BOOL isBlocked) { if (!isBlocked) { @@ -4540,14 +4538,14 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) { + (UINib *)nib { - return [UINib nibWithNibName:NSStringFromClass([MessagesViewController class]) - bundle:[NSBundle bundleForClass:[MessagesViewController class]]]; + return [UINib nibWithNibName:NSStringFromClass([ConversationViewController class]) + bundle:[NSBundle bundleForClass:[ConversationViewController class]]]; } + (instancetype)messagesViewController { - return [[[self class] alloc] initWithNibName:NSStringFromClass([MessagesViewController class]) - bundle:[NSBundle bundleForClass:[MessagesViewController class]]]; + return [[[self class] alloc] initWithNibName:NSStringFromClass([ConversationViewController class]) + bundle:[NSBundle bundleForClass:[ConversationViewController class]]]; } #pragma mark - Logging diff --git a/Signal/src/ViewControllers/ConversationView/MessagesViewController.xib b/Signal/src/ViewControllers/ConversationView/ConversationViewController.xib similarity index 94% rename from Signal/src/ViewControllers/ConversationView/MessagesViewController.xib rename to Signal/src/ViewControllers/ConversationView/ConversationViewController.xib index d4b3087a1..994ba729a 100644 --- a/Signal/src/ViewControllers/ConversationView/MessagesViewController.xib +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewController.xib @@ -1,11 +1,11 @@ - - + + - + diff --git a/Signal/src/ViewControllers/ExperienceUpgradesPageViewController.swift b/Signal/src/ViewControllers/ExperienceUpgradesPageViewController.swift index f0763ff41..7867fc1ff 100644 --- a/Signal/src/ViewControllers/ExperienceUpgradesPageViewController.swift +++ b/Signal/src/ViewControllers/ExperienceUpgradesPageViewController.swift @@ -83,7 +83,7 @@ private class IntroductingProfilesExperienceUpgradeViewController: ExperienceUpg // dismiss the modally presented view controller, then proceed. experienceUpgradesPageViewController.dismiss(animated: true) { - guard let fromViewController = UIApplication.shared.frontmostViewController as? SignalsViewController else { + guard let fromViewController = UIApplication.shared.frontmostViewController as? HomeViewController else { owsFail("unexpected frontmostViewController: \(String(describing: UIApplication.shared.frontmostViewController))") return } diff --git a/Signal/src/ViewControllers/SignalsViewController.h b/Signal/src/ViewControllers/HomeViewController.h similarity index 94% rename from Signal/src/ViewControllers/SignalsViewController.h rename to Signal/src/ViewControllers/HomeViewController.h index 4ccddd75d..78e2b8fa4 100644 --- a/Signal/src/ViewControllers/SignalsViewController.h +++ b/Signal/src/ViewControllers/HomeViewController.h @@ -7,7 +7,7 @@ @class TSThread; -@interface SignalsViewController : OWSViewController +@interface HomeViewController : OWSViewController // TODO: Remove this property. @property (nonatomic) BOOL newlyRegisteredUser; diff --git a/Signal/src/ViewControllers/SignalsViewController.m b/Signal/src/ViewControllers/HomeViewController.m similarity index 89% rename from Signal/src/ViewControllers/SignalsViewController.m rename to Signal/src/ViewControllers/HomeViewController.m index 7433a0b53..bf500a090 100644 --- a/Signal/src/ViewControllers/SignalsViewController.m +++ b/Signal/src/ViewControllers/HomeViewController.m @@ -2,13 +2,13 @@ // Copyright (c) 2017 Open Whisper Systems. All rights reserved. // -#import "SignalsViewController.h" +#import "HomeViewController.h" #import "AppDelegate.h" #import "AppSettingsViewController.h" +#import "ConversationViewController.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" @@ -34,7 +34,7 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState }; -@interface SignalsViewController () +@interface HomeViewController () @property (nonatomic) UITableView *tableView; @property (nonatomic) UILabel *emptyBoxLabel; @@ -74,7 +74,7 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState }; #pragma mark - -@implementation SignalsViewController +@implementation HomeViewController #pragma mark - Init @@ -169,7 +169,7 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState }; self.view.backgroundColor = [UIColor whiteColor]; // TODO: Remove this. - [[Environment getCurrent] setSignalsViewController:self]; + [[Environment getCurrent] setHomeViewController:self]; self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCompose @@ -179,7 +179,7 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState }; ReminderView *archiveReminderView = [ReminderView new]; archiveReminderView.text = NSLocalizedString( @"INBOX_VIEW_ARCHIVE_MODE_REMINDER", @"Label reminding the user that they are in archive mode."); - __weak SignalsViewController *weakSelf = self; + __weak HomeViewController *weakSelf = self; archiveReminderView.tapAction = ^{ [weakSelf showInboxGrouping]; }; @@ -236,7 +236,8 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState }; [self.view layoutSubviews]; } -- (void)viewDidLoad { +- (void)viewDidLoad +{ [super viewDidLoad]; [self.navigationController.navigationBar setTranslucent:NO]; @@ -263,18 +264,19 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState }; UINavigationItem *navigationItem = self.navigationItem; navigationItem.titleView = self.segmentedControl; [self.segmentedControl setSelectedSegmentIndex:0]; - navigationItem.leftBarButtonItem.accessibilityLabel = NSLocalizedString( - @"SETTINGS_BUTTON_ACCESSIBILITY", @"Accessibility hint for the settings button"); + navigationItem.leftBarButtonItem.accessibilityLabel + = NSLocalizedString(@"SETTINGS_BUTTON_ACCESSIBILITY", @"Accessibility hint for the settings button"); - if ([self.traitCollection respondsToSelector:@selector(forceTouchCapability)] && - (self.traitCollection.forceTouchCapability == UIForceTouchCapabilityAvailable)) { + if ([self.traitCollection respondsToSelector:@selector(forceTouchCapability)] + && (self.traitCollection.forceTouchCapability == UIForceTouchCapabilityAvailable)) { [self registerForPreviewingWithDelegate:self sourceView:self.tableView]; } [self updateBarButtonItems]; } -- (void)updateBarButtonItems { +- (void)updateBarButtonItems +{ const CGFloat kBarButtonSize = 44; // We use UIButtons with [UIBarButtonItem initWithCustomView:...] instead of // UIBarButtonItem in order to ensure that these buttons are spaced tightly. @@ -309,21 +311,23 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState }; self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:button]; } -- (void)settingsButtonPressed:(id)sender { +- (void)settingsButtonPressed:(id)sender +{ AppSettingsViewController *vc = [AppSettingsViewController new]; OWSNavigationController *navigationController = [[OWSNavigationController alloc] initWithRootViewController:vc]; [self presentViewController:navigationController animated:YES completion:nil]; } - (UIViewController *)previewingContext:(id)previewingContext - viewControllerForLocation:(CGPoint)location { + viewControllerForLocation:(CGPoint)location +{ NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint:location]; if (indexPath) { [previewingContext setSourceRect:[self.tableView rectForRowAtIndexPath:indexPath]]; - MessagesViewController *vc = [MessagesViewController new]; - TSThread *thread = [self threadForIndexPath:indexPath]; + ConversationViewController *vc = [ConversationViewController new]; + TSThread *thread = [self threadForIndexPath:indexPath]; self.lastThread = thread; [vc configureForThread:thread keyboardOnViewAppearing:NO callOnViewAppearing:NO]; [vc peekSetup]; @@ -335,8 +339,9 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState }; } - (void)previewingContext:(id)previewingContext - commitViewController:(UIViewController *)viewControllerToCommit { - MessagesViewController *vc = (MessagesViewController *)viewControllerToCommit; + commitViewController:(UIViewController *)viewControllerToCommit +{ + ConversationViewController *vc = (ConversationViewController *)viewControllerToCommit; [vc popped]; [self.navigationController pushViewController:vc animated:NO]; @@ -344,7 +349,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) { @@ -361,7 +366,8 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState }; }]; } -- (void)swappedSegmentedControl { +- (void)swappedSegmentedControl +{ if (self.segmentedControl.selectedSegmentIndex == 0) { [self showInboxGrouping]; } else { @@ -369,7 +375,8 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState }; } } -- (void)viewWillAppear:(BOOL)animated { +- (void)viewWillAppear:(BOOL)animated +{ [super viewWillAppear:animated]; if ([TSThread numberOfKeysInCollection] > 0) { [self.contactsManager requestSystemContactsOnceWithCompletion:^(NSError *_Nullable error) { @@ -482,11 +489,12 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState }; self.isAppInBackground = YES; } -- (void)viewDidAppear:(BOOL)animated { +- (void)viewDidAppear:(BOOL)animated +{ [super viewDidAppear:animated]; if (self.newlyRegisteredUser) { - [self.editingDbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction * _Nonnull transaction) { + [self.editingDbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *_Nonnull transaction) { [self.experienceUpgradeFinder markAllAsSeenWithTransaction:transaction]; }]; // Start running the disappearing messages job in case the newly registered user @@ -528,7 +536,8 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState }; NSArray *unseenUpgrades = [self unseenUpgradeExperiences]; if (unseenUpgrades.count > 0) { - ExperienceUpgradesPageViewController *experienceUpgradeViewController = [[ExperienceUpgradesPageViewController alloc] initWithExperienceUpgrades:unseenUpgrades]; + ExperienceUpgradesPageViewController *experienceUpgradeViewController = + [[ExperienceUpgradesPageViewController alloc] initWithExperienceUpgrades:unseenUpgrades]; [self presentViewController:experienceUpgradeViewController animated:YES completion:^{ @@ -541,7 +550,8 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState }; self.hasBeenPresented = YES; } -- (void)tableViewSetUp { +- (void)tableViewSetUp +{ self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero]; } @@ -561,7 +571,8 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState }; return (NSInteger)[self.threadMappings numberOfSections]; } -- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ return (NSInteger)[self.threadMappings numberOfItemsInSection:(NSUInteger)section]; } @@ -582,17 +593,19 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState }; return cell; } -- (TSThread *)threadForIndexPath:(NSIndexPath *)indexPath { +- (TSThread *)threadForIndexPath:(NSIndexPath *)indexPath +{ __block TSThread *thread = nil; [self.uiDatabaseConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) { - thread = [[transaction extension:TSThreadDatabaseViewExtensionName] objectAtIndexPath:indexPath - withMappings:self.threadMappings]; + thread = [[transaction extension:TSThreadDatabaseViewExtensionName] objectAtIndexPath:indexPath + withMappings:self.threadMappings]; }]; return thread; } -- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath +{ return InboxTableViewCell.rowHeight; } @@ -600,35 +613,39 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState }; - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle - forRowAtIndexPath:(NSIndexPath *)indexPath { + forRowAtIndexPath:(NSIndexPath *)indexPath +{ return; } -- (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath { +- (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath +{ UITableViewRowAction *deleteAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:NSLocalizedString(@"TXT_DELETE_TITLE", nil) handler:^(UITableViewRowAction *action, NSIndexPath *swipedIndexPath) { - [self tableViewCellTappedDelete:swipedIndexPath]; + [self tableViewCellTappedDelete:swipedIndexPath]; }]; UITableViewRowAction *archiveAction; if (self.viewingThreadsIn == kInboxState) { archiveAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleNormal - title:NSLocalizedString(@"ARCHIVE_ACTION", @"Pressing this button moves a thread from the inbox to the archive") + title:NSLocalizedString(@"ARCHIVE_ACTION", + @"Pressing this button moves a thread from the inbox to the archive") handler:^(UITableViewRowAction *_Nonnull action, NSIndexPath *_Nonnull tappedIndexPath) { - [self archiveIndexPath:tappedIndexPath]; - [Environment.preferences setHasArchivedAMessage:YES]; + [self archiveIndexPath:tappedIndexPath]; + [Environment.preferences setHasArchivedAMessage:YES]; }]; } else { archiveAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleNormal - title:NSLocalizedString(@"UNARCHIVE_ACTION", @"Pressing this button moves an archived thread from the archive back to the inbox") + title:NSLocalizedString(@"UNARCHIVE_ACTION", + @"Pressing this button moves an archived thread from the archive back to the inbox") handler:^(UITableViewRowAction *_Nonnull action, NSIndexPath *_Nonnull tappedIndexPath) { - [self archiveIndexPath:tappedIndexPath]; + [self archiveIndexPath:tappedIndexPath]; }]; } @@ -636,23 +653,25 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState }; return @[ deleteAction, archiveAction ]; } -- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { +- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath +{ return YES; } #pragma mark - HomeFeedTableViewCellDelegate -- (void)tableViewCellTappedDelete:(NSIndexPath *)indexPath { +- (void)tableViewCellTappedDelete:(NSIndexPath *)indexPath +{ TSThread *thread = [self threadForIndexPath:indexPath]; if ([thread isKindOfClass:[TSGroupThread class]]) { TSGroupThread *gThread = (TSGroupThread *)thread; if ([gThread.groupModel.groupMemberIds containsObject:[TSAccountManager localNumber]]) { UIAlertController *removingFromGroup = [UIAlertController - alertControllerWithTitle:[NSString - stringWithFormat:NSLocalizedString(@"GROUP_REMOVING", nil), [thread name]] - message:nil - preferredStyle:UIAlertControllerStyleAlert]; + alertControllerWithTitle:[NSString + stringWithFormat:NSLocalizedString(@"GROUP_REMOVING", nil), [thread name]] + message:nil + preferredStyle:UIAlertControllerStyleAlert]; [self presentViewController:removingFromGroup animated:YES completion:nil]; TSOutgoingMessage *message = [[TSOutgoingMessage alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp] @@ -683,22 +702,24 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState }; } } -- (void)deleteThread:(TSThread *)thread { +- (void)deleteThread:(TSThread *)thread +{ [self.editingDbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) { - [thread removeWithTransaction:transaction]; + [thread removeWithTransaction:transaction]; }]; _inboxCount -= (self.viewingThreadsIn == kArchiveState) ? 1 : 0; [self checkIfEmptyView]; } -- (void)archiveIndexPath:(NSIndexPath *)indexPath { +- (void)archiveIndexPath:(NSIndexPath *)indexPath +{ TSThread *thread = [self threadForIndexPath:indexPath]; BOOL viewingThreadsIn = self.viewingThreadsIn; [self.editingDbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) { - viewingThreadsIn == kInboxState ? [thread archiveThreadWithTransaction:transaction] - : [thread unarchiveThreadWithTransaction:transaction]; + viewingThreadsIn == kInboxState ? [thread archiveThreadWithTransaction:transaction] + : [thread unarchiveThreadWithTransaction:transaction]; }]; [self checkIfEmptyView]; @@ -707,7 +728,7 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState }; - (void)updateInboxCountLabel { NSUInteger numberOfItems = [self.messagesManager unreadMessagesCount]; - NSString *unreadString = NSLocalizedString(@"WHISPER_NAV_BAR_TITLE", nil); + NSString *unreadString = NSLocalizedString(@"WHISPER_NAV_BAR_TITLE", nil); if (numberOfItems > 0) { unreadString = @@ -719,7 +740,8 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState }; [_segmentedControl reloadInputViews]; } -- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ TSThread *thread = [self threadForIndexPath:indexPath]; [self presentThread:thread keyboardOnViewAppearing:NO callOnViewAppearing:NO]; [tableView deselectRowAtIndexPath:indexPath animated:YES]; @@ -736,8 +758,8 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState }; // We do this synchronously if we're already on the main thread. DispatchMainThreadSafe(^{ - MessagesViewController *mvc = [[MessagesViewController alloc] initWithNibName:@"MessagesViewController" - bundle:nil]; + ConversationViewController *mvc = + [[ConversationViewController alloc] initWithNibName:@"ConversationViewController" bundle:nil]; [mvc configureForThread:thread keyboardOnViewAppearing:keyboardOnViewAppearing callOnViewAppearing:callOnViewAppearing]; @@ -865,7 +887,8 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState }; #pragma mark Database delegates -- (YapDatabaseConnection *)uiDatabaseConnection { +- (YapDatabaseConnection *)uiDatabaseConnection +{ NSAssert([NSThread isMainThread], @"Must access uiDatabaseConnection on main thread!"); if (!_uiDatabaseConnection) { YapDatabase *database = TSStorageManager.sharedManager.database; @@ -875,12 +898,13 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState }; return _uiDatabaseConnection; } -- (void)yapDatabaseModified:(NSNotification *)notification { +- (void)yapDatabaseModified:(NSNotification *)notification +{ if (!self.shouldObserveDBModifications) { return; } - NSArray *notifications = [self.uiDatabaseConnection beginLongLivedReadTransaction]; + NSArray *notifications = [self.uiDatabaseConnection beginLongLivedReadTransaction]; if (![[self.uiDatabaseConnection ext:TSThreadDatabaseViewExtensionName] hasChangesForGroup:self.currentGrouping inNotifications:notifications]) { @@ -964,14 +988,15 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState }; [self.tableView endUpdates]; } -- (void)checkIfEmptyView { +- (void)checkIfEmptyView +{ [_tableView setHidden:NO]; [_emptyBoxLabel setHidden:NO]; if (self.viewingThreadsIn == kInboxState && [self.threadMappings numberOfItemsInGroup:TSInboxGroup] == 0) { [self setEmptyBoxText]; [_tableView setHidden:YES]; } else if (self.viewingThreadsIn == kArchiveState && - [self.threadMappings numberOfItemsInGroup:TSArchiveGroup] == 0) { + [self.threadMappings numberOfItemsInGroup:TSArchiveGroup] == 0) { [self setEmptyBoxText]; [_tableView setHidden:YES]; } else { @@ -979,31 +1004,32 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState }; } } -- (void)setEmptyBoxText { - _emptyBoxLabel.textColor = [UIColor grayColor]; - _emptyBoxLabel.font = [UIFont ows_regularFontWithSize:18.f]; +- (void)setEmptyBoxText +{ + _emptyBoxLabel.textColor = [UIColor grayColor]; + _emptyBoxLabel.font = [UIFont ows_regularFontWithSize:18.f]; _emptyBoxLabel.textAlignment = NSTextAlignmentCenter; _emptyBoxLabel.numberOfLines = 4; - NSString *firstLine = @""; + NSString *firstLine = @""; NSString *secondLine = @""; if (self.viewingThreadsIn == kInboxState) { if ([Environment.preferences getHasSentAMessage]) { - firstLine = NSLocalizedString(@"EMPTY_INBOX_FIRST_TITLE", @""); + firstLine = NSLocalizedString(@"EMPTY_INBOX_FIRST_TITLE", @""); secondLine = NSLocalizedString(@"EMPTY_INBOX_FIRST_TEXT", @""); } else { // FIXME This looks wrong. Shouldn't we be showing inbox_title/text here? - firstLine = NSLocalizedString(@"EMPTY_ARCHIVE_FIRST_TITLE", @""); + firstLine = NSLocalizedString(@"EMPTY_ARCHIVE_FIRST_TITLE", @""); secondLine = NSLocalizedString(@"EMPTY_ARCHIVE_FIRST_TEXT", @""); } } else { if ([Environment.preferences getHasArchivedAMessage]) { // FIXME This looks wrong. Shouldn't we be showing first_archive_title/text here? - firstLine = NSLocalizedString(@"EMPTY_INBOX_TITLE", @""); + firstLine = NSLocalizedString(@"EMPTY_INBOX_TITLE", @""); secondLine = NSLocalizedString(@"EMPTY_INBOX_TEXT", @""); } else { - firstLine = NSLocalizedString(@"EMPTY_ARCHIVE_TITLE", @""); + firstLine = NSLocalizedString(@"EMPTY_ARCHIVE_TITLE", @""); secondLine = NSLocalizedString(@"EMPTY_ARCHIVE_TEXT", @""); } } 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/ProfileViewController.h b/Signal/src/ViewControllers/ProfileViewController.h index ca6f3b462..506f654db 100644 --- a/Signal/src/ViewControllers/ProfileViewController.h +++ b/Signal/src/ViewControllers/ProfileViewController.h @@ -4,7 +4,7 @@ NS_ASSUME_NONNULL_BEGIN -@class SignalsViewController; +@class HomeViewController; @interface ProfileViewController : UIViewController @@ -14,8 +14,7 @@ NS_ASSUME_NONNULL_BEGIN + (void)presentForAppSettings:(UINavigationController *)navigationController; + (void)presentForRegistration:(UINavigationController *)navigationController; -+ (void)presentForUpgradeOrNag:(SignalsViewController *)presentingController - NS_SWIFT_NAME(presentForUpgradeOrNag(from:)); ++ (void)presentForUpgradeOrNag:(HomeViewController *)presentingController NS_SWIFT_NAME(presentForUpgradeOrNag(from:)); @end diff --git a/Signal/src/ViewControllers/ProfileViewController.m b/Signal/src/ViewControllers/ProfileViewController.m index 0b6a8b71a..185c8d2ca 100644 --- a/Signal/src/ViewControllers/ProfileViewController.m +++ b/Signal/src/ViewControllers/ProfileViewController.m @@ -5,11 +5,11 @@ #import "ProfileViewController.h" #import "AppDelegate.h" #import "AvatarViewHelper.h" +#import "HomeViewController.h" #import "OWSNavigationController.h" #import "OWSProfileManager.h" #import "Signal-Swift.h" #import "SignalsNavigationController.h" -#import "SignalsViewController.h" #import "UIColor+OWS.h" #import "UIFont+OWS.h" #import "UIView+OWS.h" @@ -434,13 +434,13 @@ NSString *const kProfileView_LastPresentedDate = @"kProfileView_LastPresentedDat - (void)showHomeView { - SignalsViewController *homeView = [SignalsViewController new]; + HomeViewController *homeView = [HomeViewController new]; homeView.newlyRegisteredUser = YES; SignalsNavigationController *navigationController = [[SignalsNavigationController alloc] initWithRootViewController:homeView]; AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate; appDelegate.window.rootViewController = navigationController; - OWSAssert([navigationController.topViewController isKindOfClass:[SignalsViewController class]]); + OWSAssert([navigationController.topViewController isKindOfClass:[HomeViewController class]]); } #pragma mark - UITextFieldDelegate @@ -554,7 +554,7 @@ NSString *const kProfileView_LastPresentedDate = @"kProfileView_LastPresentedDat [navigationController pushViewController:vc animated:YES]; } -+ (void)presentForUpgradeOrNag:(SignalsViewController *)presentingController ++ (void)presentForUpgradeOrNag:(HomeViewController *)presentingController { OWSAssert(presentingController); diff --git a/Signal/src/ViewControllers/ShowGroupMembersViewController.m b/Signal/src/ViewControllers/ShowGroupMembersViewController.m index 98548b061..bedaf1fca 100644 --- a/Signal/src/ViewControllers/ShowGroupMembersViewController.m +++ b/Signal/src/ViewControllers/ShowGroupMembersViewController.m @@ -7,8 +7,8 @@ #import "ContactTableViewCell.h" #import "ContactsViewHelper.h" #import "Environment.h" +#import "HomeViewController.h" #import "OWSContactsManager.h" -#import "SignalsViewController.h" #import "Signal-Swift.h" #import "UIUtil.h" #import "ViewControllerUtils.h" diff --git a/Signal/src/ViewControllers/ViewControllerUtils.m b/Signal/src/ViewControllers/ViewControllerUtils.m index 0ae9a32f0..7d15a11ee 100644 --- a/Signal/src/ViewControllers/ViewControllerUtils.m +++ b/Signal/src/ViewControllers/ViewControllerUtils.m @@ -4,9 +4,9 @@ #import "ViewControllerUtils.h" #import "Environment.h" +#import "HomeViewController.h" #import "PhoneNumber.h" #import "Signal-Swift.h" -#import "SignalsViewController.h" #import "StringUtil.h" #import #import diff --git a/Signal/src/environment/Environment.h b/Signal/src/environment/Environment.h index 6a5e7b25c..fd9f51318 100644 --- a/Signal/src/environment/Environment.h +++ b/Signal/src/environment/Environment.h @@ -18,7 +18,7 @@ @class UINavigationController; @class OWSContactsManager; @class OutboundCallInitiator; -@class SignalsViewController; +@class HomeViewController; @class TSGroupThread; @class ContactsUpdater; @class TSNetworkManager; @@ -49,7 +49,7 @@ @property (nonatomic, readonly) PropertyListPreferences *preferences; -@property (nonatomic, readonly) SignalsViewController *signalsViewController; +@property (nonatomic, readonly) HomeViewController *signalsViewController; @property (nonatomic, readonly, weak) UINavigationController *signUpFlowNavigationController; + (Environment *)getCurrent; @@ -59,7 +59,7 @@ + (void)resetAppData; -- (void)setSignalsViewController:(SignalsViewController *)signalsViewController; +- (void)setHomeViewController:(HomeViewController *)signalsViewController; - (void)setSignUpFlowNavigationController:(UINavigationController *)signUpFlowNavigationController; + (void)messageThreadId:(NSString *)threadId; diff --git a/Signal/src/environment/Environment.m b/Signal/src/environment/Environment.m index c76c874b5..aca076d1c 100644 --- a/Signal/src/environment/Environment.m +++ b/Signal/src/environment/Environment.m @@ -3,12 +3,12 @@ // #import "Environment.h" +#import "ConversationViewController.h" #import "DebugLogger.h" #import "FunctionalUtil.h" -#import "MessagesViewController.h" +#import "HomeViewController.h" #import "Signal-Swift.h" #import "SignalKeyingStorage.h" -#import "SignalsViewController.h" #import "TSContactThread.h" #import "TSGroupThread.h" #import @@ -171,7 +171,8 @@ static Environment *environment = nil; return _preferences; } -- (void)setSignalsViewController:(SignalsViewController *)signalsViewController { +- (void)setHomeViewController:(HomeViewController *)signalsViewController +{ _signalsViewController = signalsViewController; } @@ -191,11 +192,11 @@ static Environment *environment = nil; [self messageGroup:(TSGroupThread *)thread]; } else { Environment *env = [self getCurrent]; - SignalsViewController *vc = env.signalsViewController; + HomeViewController *vc = env.signalsViewController; UIViewController *topvc = vc.navigationController.topViewController; - if ([topvc isKindOfClass:[MessagesViewController class]]) { - MessagesViewController *mvc = (MessagesViewController *)topvc; + if ([topvc isKindOfClass:[ConversationViewController class]]) { + ConversationViewController *mvc = (ConversationViewController *)topvc; if ([mvc.thread.uniqueId isEqualToString:threadId]) { [mvc popKeyBoard]; return; @@ -207,7 +208,7 @@ static Environment *environment = nil; + (void)messageIdentifier:(NSString *)identifier withCompose:(BOOL)compose { Environment *env = [self getCurrent]; - SignalsViewController *vc = env.signalsViewController; + HomeViewController *vc = env.signalsViewController; [[TSStorageManager sharedManager].dbReadWriteConnection asyncReadWriteWithBlock:^(YapDatabaseReadWriteTransaction *_Nonnull transaction) { @@ -219,7 +220,7 @@ static Environment *environment = nil; + (void)callUserWithIdentifier:(NSString *)identifier { Environment *env = [self getCurrent]; - SignalsViewController *vc = env.signalsViewController; + HomeViewController *vc = env.signalsViewController; [[TSStorageManager sharedManager].dbReadWriteConnection asyncReadWriteWithBlock:^(YapDatabaseReadWriteTransaction *_Nonnull transaction) { @@ -230,7 +231,7 @@ static Environment *environment = nil; + (void)messageGroup:(TSGroupThread *)groupThread { Environment *env = [self getCurrent]; - SignalsViewController *vc = env.signalsViewController; + HomeViewController *vc = env.signalsViewController; [vc presentThread:groupThread keyboardOnViewAppearing:YES callOnViewAppearing:NO]; } diff --git a/Signal/src/util/AppUpdateNag.m b/Signal/src/util/AppUpdateNag.m index d6150a641..620c3e95f 100644 --- a/Signal/src/util/AppUpdateNag.m +++ b/Signal/src/util/AppUpdateNag.m @@ -63,8 +63,8 @@ NSString *const TSStorageManagerAppUpgradeNagDate = @"TSStorageManagerAppUpgrade UIViewController *frontmostViewController = [UIApplication sharedApplication].frontmostViewController; OWSAssert(frontmostViewController); - BOOL canPresent = ([frontmostViewController isKindOfClass:[SignalsViewController class]] || - [frontmostViewController isKindOfClass:[RegistrationViewController class]]); + BOOL canPresent = ([frontmostViewController isKindOfClass:[HomeViewController class]] || + [frontmostViewController isKindOfClass:[RegistrationViewController class]]); if (!canPresent) { return; } diff --git a/Signal/src/util/OWSContactsSyncing.h b/Signal/src/util/OWSContactsSyncing.h index 0203a1f89..e4b5c78b0 100644 --- a/Signal/src/util/OWSContactsSyncing.h +++ b/Signal/src/util/OWSContactsSyncing.h @@ -2,7 +2,7 @@ // Copyright (c) 2017 Open Whisper Systems. All rights reserved. // -#import "SignalsViewController.h" +#import "HomeViewController.h" NS_ASSUME_NONNULL_BEGIN diff --git a/Signal/src/views/OWSExpirationTimerView.m b/Signal/src/views/OWSExpirationTimerView.m index 4c2987ecc..5d91357f6 100644 --- a/Signal/src/views/OWSExpirationTimerView.m +++ b/Signal/src/views/OWSExpirationTimerView.m @@ -3,7 +3,7 @@ // #import "OWSExpirationTimerView.h" -#import "MessagesViewController.h" +#import "ConversationViewController.h" #import "UIColor+OWS.h" #import @@ -110,7 +110,7 @@ double const OWSExpirationTimerViewBlinkingSeconds = 2; self.initialDurationSeconds = initialDurationSeconds; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleReappearNotification:) - name:OWSMessagesViewControllerDidAppearNotification + name:ConversationViewControllerDidAppearNotification object:nil]; [self startAnimation]; } @@ -176,7 +176,7 @@ double const OWSExpirationTimerViewBlinkingSeconds = 2; - (void)stopTimer { [[NSNotificationCenter defaultCenter] removeObserver:self - name:OWSMessagesViewControllerDidAppearNotification + name:ConversationViewControllerDidAppearNotification object:nil]; [self.layer removeAnimationForKey:@"alphaBlink"];