diff --git a/Signal.xcodeproj/project.pbxproj b/Signal.xcodeproj/project.pbxproj index 4bb7eecf8..fd8c954d2 100644 --- a/Signal.xcodeproj/project.pbxproj +++ b/Signal.xcodeproj/project.pbxproj @@ -357,7 +357,7 @@ B68B0E8A1A54284100DE8A02 /* TSInvalidIdentityKeyErrorMessage.m in Sources */ = {isa = PBXBuildFile; fileRef = B68B0E891A54284100DE8A02 /* TSInvalidIdentityKeyErrorMessage.m */; }; B69CD25119773E79005CE69A /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B69CD25019773E79005CE69A /* XCTest.framework */; }; B6A3EB4B1A423B3800B2236B /* TSAttachmentAdapter.m in Sources */ = {isa = PBXBuildFile; fileRef = B6A3EB4A1A423B3800B2236B /* TSAttachmentAdapter.m */; }; - B6AE33BD1A1EB121003DF39D /* GroupModel.m in Sources */ = {isa = PBXBuildFile; fileRef = B6AE33BC1A1EB121003DF39D /* GroupModel.m */; }; + B6AE33BD1A1EB121003DF39D /* TSGroupModel.m in Sources */ = {isa = PBXBuildFile; fileRef = B6AE33BC1A1EB121003DF39D /* TSGroupModel.m */; }; B6B095E41A1D25C5008BFAA6 /* CryptographyTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = B6B095DE1A1D25C5008BFAA6 /* CryptographyTests.mm */; }; B6B095E51A1D25C5008BFAA6 /* TextSecureKitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = B6B095DF1A1D25C5008BFAA6 /* TextSecureKitTests.m */; }; B6B095E61A1D25C5008BFAA6 /* TSMessageStorageTests.m in Sources */ = {isa = PBXBuildFile; fileRef = B6B095E01A1D25C5008BFAA6 /* TSMessageStorageTests.m */; }; @@ -486,10 +486,6 @@ E1CD329618BCFF9900B1A496 /* SoundInstance.m in Sources */ = {isa = PBXBuildFile; fileRef = E1CD329518BCFF9900B1A496 /* SoundInstance.m */; }; F995AC2FFD6D4442B012604A /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8313AE91B4954215858A5662 /* libPods.a */; }; FC15B7BF1A1F80F200F59801 /* defaultConctact_light@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = FC15B7BE1A1F80F200F59801 /* defaultConctact_light@2x.png */; }; - FC1615181A37935600F1761D /* NotificationPreviewViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FC1615171A37935600F1761D /* NotificationPreviewViewController.m */; }; - FC16151C1A37945D00F1761D /* notification_no_preview_with_name@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = FC1615191A37945D00F1761D /* notification_no_preview_with_name@2x.png */; }; - FC16151D1A37945D00F1761D /* notification_no_preview_no_name@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = FC16151A1A37945D00F1761D /* notification_no_preview_no_name@2x.png */; }; - FC16151E1A37945D00F1761D /* notification_with_preview@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = FC16151B1A37945D00F1761D /* notification_with_preview@2x.png */; }; FC18803C1A31D94D0044CE86 /* SignalTabBarController.m in Sources */ = {isa = PBXBuildFile; fileRef = FC18803B1A31D94D0044CE86 /* SignalTabBarController.m */; }; FC1F90C01A22342B004F8253 /* group_photo@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = FC1F90BF1A22342B004F8253 /* group_photo@2x.png */; }; FC1F90C61A223991004F8253 /* settings_tab@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = FC1F90C41A223991004F8253 /* settings_tab@2x.png */; }; @@ -533,6 +529,10 @@ FCB626B61A3B067900FDB504 /* ArrowBottom@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = FCB626B21A3B067900FDB504 /* ArrowBottom@3x.png */; }; FCB626B71A3B067900FDB504 /* ArrowTop@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = FCB626B31A3B067900FDB504 /* ArrowTop@3x.png */; }; FCC81A981A44558300DFEC7D /* UIDevice+TSHardwareVersion.m in Sources */ = {isa = PBXBuildFile; fileRef = FCC81A971A44558300DFEC7D /* UIDevice+TSHardwareVersion.m */; }; + FCD274E21A5AFD8000202277 /* PrivacySettingsTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FCD274E11A5AFD8000202277 /* PrivacySettingsTableViewController.m */; }; + FCD274E51A5AFDB800202277 /* MediaSettingsTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FCD274E41A5AFDB800202277 /* MediaSettingsTableViewController.m */; }; + FCD274E81A5AFDC900202277 /* AdvancedSettingsTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FCD274E71A5AFDC900202277 /* AdvancedSettingsTableViewController.m */; }; + FCD274EB1A5AFDDB00202277 /* AboutTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FCD274EA1A5AFDDB00202277 /* AboutTableViewController.m */; }; FCF72A081A01A765006BC849 /* ContactsTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FCF72A071A01A765006BC849 /* ContactsTableViewController.m */; }; FCF72A131A02D27F006BC849 /* ContactDetailTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FCF72A111A02D27F006BC849 /* ContactDetailTableViewController.m */; }; FCFA64B41A24F3880007FB87 /* UIColor+OWS.m in Sources */ = {isa = PBXBuildFile; fileRef = FCFA64B31A24F3880007FB87 /* UIColor+OWS.m */; }; @@ -996,8 +996,8 @@ B69CD25019773E79005CE69A /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; B6A3EB491A423B3800B2236B /* TSAttachmentAdapter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TSAttachmentAdapter.h; sourceTree = ""; }; B6A3EB4A1A423B3800B2236B /* TSAttachmentAdapter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TSAttachmentAdapter.m; sourceTree = ""; }; - B6AE33BB1A1EB121003DF39D /* GroupModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GroupModel.h; sourceTree = ""; }; - B6AE33BC1A1EB121003DF39D /* GroupModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GroupModel.m; sourceTree = ""; }; + B6AE33BB1A1EB121003DF39D /* TSGroupModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TSGroupModel.h; path = "../../view controllers/TSGroupModel.h"; sourceTree = ""; }; + B6AE33BC1A1EB121003DF39D /* TSGroupModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TSGroupModel.m; path = "../../view controllers/TSGroupModel.m"; sourceTree = ""; }; B6B095DE1A1D25C5008BFAA6 /* CryptographyTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CryptographyTests.mm; sourceTree = ""; }; B6B095DF1A1D25C5008BFAA6 /* TextSecureKitTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TextSecureKitTests.m; sourceTree = ""; }; B6B095E01A1D25C5008BFAA6 /* TSMessageStorageTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TSMessageStorageTests.m; sourceTree = ""; }; @@ -1187,11 +1187,6 @@ E1CD329418BCFF9900B1A496 /* SoundInstance.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SoundInstance.h; sourceTree = ""; }; E1CD329518BCFF9900B1A496 /* SoundInstance.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SoundInstance.m; sourceTree = ""; }; FC15B7BE1A1F80F200F59801 /* defaultConctact_light@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "defaultConctact_light@2x.png"; sourceTree = ""; }; - FC1615161A37935600F1761D /* NotificationPreviewViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NotificationPreviewViewController.h; sourceTree = ""; }; - FC1615171A37935600F1761D /* NotificationPreviewViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NotificationPreviewViewController.m; sourceTree = ""; }; - FC1615191A37945D00F1761D /* notification_no_preview_with_name@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "notification_no_preview_with_name@2x.png"; sourceTree = ""; }; - FC16151A1A37945D00F1761D /* notification_no_preview_no_name@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "notification_no_preview_no_name@2x.png"; sourceTree = ""; }; - FC16151B1A37945D00F1761D /* notification_with_preview@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "notification_with_preview@2x.png"; sourceTree = ""; }; FC18803A1A31D94D0044CE86 /* SignalTabBarController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SignalTabBarController.h; sourceTree = ""; }; FC18803B1A31D94D0044CE86 /* SignalTabBarController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SignalTabBarController.m; sourceTree = ""; }; FC1F90BF1A22342B004F8253 /* group_photo@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "group_photo@2x.png"; sourceTree = ""; }; @@ -1249,6 +1244,14 @@ FCB626B31A3B067900FDB504 /* ArrowTop@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "ArrowTop@3x.png"; sourceTree = ""; }; FCC81A961A44558300DFEC7D /* UIDevice+TSHardwareVersion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIDevice+TSHardwareVersion.h"; sourceTree = ""; }; FCC81A971A44558300DFEC7D /* UIDevice+TSHardwareVersion.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIDevice+TSHardwareVersion.m"; sourceTree = ""; }; + FCD274E01A5AFD8000202277 /* PrivacySettingsTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PrivacySettingsTableViewController.h; sourceTree = ""; }; + FCD274E11A5AFD8000202277 /* PrivacySettingsTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PrivacySettingsTableViewController.m; sourceTree = ""; }; + FCD274E31A5AFDB800202277 /* MediaSettingsTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaSettingsTableViewController.h; sourceTree = ""; }; + FCD274E41A5AFDB800202277 /* MediaSettingsTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MediaSettingsTableViewController.m; sourceTree = ""; }; + FCD274E61A5AFDC900202277 /* AdvancedSettingsTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AdvancedSettingsTableViewController.h; sourceTree = ""; }; + FCD274E71A5AFDC900202277 /* AdvancedSettingsTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AdvancedSettingsTableViewController.m; sourceTree = ""; }; + FCD274E91A5AFDDB00202277 /* AboutTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AboutTableViewController.h; sourceTree = ""; }; + FCD274EA1A5AFDDB00202277 /* AboutTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AboutTableViewController.m; sourceTree = ""; }; FCF72A061A01A765006BC849 /* ContactsTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContactsTableViewController.h; sourceTree = ""; }; FCF72A071A01A765006BC849 /* ContactsTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ContactsTableViewController.m; sourceTree = ""; }; FCF72A111A02D27F006BC849 /* ContactDetailTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ContactDetailTableViewController.m; sourceTree = ""; }; @@ -2204,9 +2207,6 @@ FCA52AE41A2B676C00CCADFA /* message_error@2x.png */, B633C5411A1D190B0059AC12 /* mute_off@2x.png */, B633C5421A1D190B0059AC12 /* mute_on@2x.png */, - FC16151A1A37945D00F1761D /* notification_no_preview_no_name@2x.png */, - FC1615191A37945D00F1761D /* notification_no_preview_with_name@2x.png */, - FC16151B1A37945D00F1761D /* notification_with_preview@2x.png */, B633C54B1A1D190B0059AC12 /* photo@2x.png */, FC9120421A39F9E00074545C /* qr_scan_fingerprint@2x.png */, FC91203F1A39EFB70074545C /* qr@2x.png */, @@ -2306,8 +2306,6 @@ B6AE33B41A1EB0A0003DF39D /* temp */ = { isa = PBXGroup; children = ( - B6AE33BB1A1EB121003DF39D /* GroupModel.h */, - B6AE33BC1A1EB121003DF39D /* GroupModel.m */, ); name = temp; sourceTree = ""; @@ -2395,6 +2393,8 @@ B6B0960E1A1D25ED008BFAA6 /* TSInfoMessage.m */, B6B0960F1A1D25ED008BFAA6 /* TSInteraction.h */, B6B096101A1D25ED008BFAA6 /* TSInteraction.m */, + B6AE33BB1A1EB121003DF39D /* TSGroupModel.h */, + B6AE33BC1A1EB121003DF39D /* TSGroupModel.m */, B6B096111A1D25ED008BFAA6 /* TSMessage.h */, B6B096121A1D25ED008BFAA6 /* TSMessage.m */, B6B50AA91A4192C500F8F607 /* TSMessagesManager+attachments.h */, @@ -2686,8 +2686,14 @@ children = ( FC31962E1A0814130094C78E /* SettingsTableViewController.h */, FC31962F1A0814130094C78E /* SettingsTableViewController.m */, - FC1615161A37935600F1761D /* NotificationPreviewViewController.h */, - FC1615171A37935600F1761D /* NotificationPreviewViewController.m */, + FCD274E01A5AFD8000202277 /* PrivacySettingsTableViewController.h */, + FCD274E11A5AFD8000202277 /* PrivacySettingsTableViewController.m */, + FCD274E31A5AFDB800202277 /* MediaSettingsTableViewController.h */, + FCD274E41A5AFDB800202277 /* MediaSettingsTableViewController.m */, + FCD274E61A5AFDC900202277 /* AdvancedSettingsTableViewController.h */, + FCD274E71A5AFDC900202277 /* AdvancedSettingsTableViewController.m */, + FCD274E91A5AFDDB00202277 /* AboutTableViewController.h */, + FCD274EA1A5AFDDB00202277 /* AboutTableViewController.m */, ); name = Settings; sourceTree = ""; @@ -2951,9 +2957,7 @@ B633C5CE1A1D190B0059AC12 /* quit@2x.png in Resources */, E148750A18A06966002CC4F3 /* InCallViewController.xib in Resources */, FCA52AEB1A2B676C00CCADFA /* checkmark_light@2x.png in Resources */, - FC16151C1A37945D00F1761D /* notification_no_preview_with_name@2x.png in Resources */, B633C5D01A1D190B0059AC12 /* red-delete@2x.png in Resources */, - FC16151E1A37945D00F1761D /* notification_with_preview@2x.png in Resources */, B633C59D1A1D190B0059AC12 /* endcall@2x.png in Resources */, B633C5B41A1D190B0059AC12 /* keypad@2x.png in Resources */, B633C5DA1A1D190B0059AC12 /* settings_dark@2x.png in Resources */, @@ -2976,7 +2980,6 @@ B66DBF4A19D5BBC8006EA940 /* Images.xcassets in Resources */, FCA52AE71A2B676C00CCADFA /* call_failed@2x.png in Resources */, 70B8FEE21909FE360042E3F0 /* 171756__nenadsimic__picked-coin-echo-2.wav in Resources */, - FC16151D1A37945D00F1761D /* notification_no_preview_no_name@2x.png in Resources */, B633C5801A1D190B0059AC12 /* archive@2x.png in Resources */, FC1F90C71A223991004F8253 /* signals_tab@2x.png in Resources */, FCB626B51A3B067900FDB504 /* ArrowBottom@2x.png in Resources */, @@ -3170,6 +3173,7 @@ B63AF5C91A1F757900D01AAD /* TSRecipientPrekeyRequest.m in Sources */, 7095B7B018F46D35002C66E2 /* PhoneNumberUtil.m in Sources */, B63AF5D81A1F889500D01AAD /* SubProtocol.pb.m in Sources */, + FCD274EB1A5AFDDB00202277 /* AboutTableViewController.m in Sources */, E197B61618BBEC1A00F073E5 /* StretchFactorController.m in Sources */, FCFD257F1A154B2C00F4C644 /* RegistrationViewController.m in Sources */, 76EB065018170B34006006FC /* DialerViewController.m in Sources */, @@ -3201,7 +3205,7 @@ 76EB065A18170B34006006FC /* NextResponderScrollView.m in Sources */, 76EB062618170B33006006FC /* Queue.m in Sources */, D221A09A169C9E5E00537ABF /* main.m in Sources */, - B6AE33BD1A1EB121003DF39D /* GroupModel.m in Sources */, + B6AE33BD1A1EB121003DF39D /* TSGroupModel.m in Sources */, 76EB061618170B33006006FC /* AnonymousOccurrenceLogger.m in Sources */, 76EB063018170B33006006FC /* Conversions.m in Sources */, FCAFC33F1A0F948F00AE5136 /* ActionContactDetailCell.m in Sources */, @@ -3225,7 +3229,6 @@ 76EB058218170B33006006FC /* Environment.m in Sources */, 76EB064418170B33006006FC /* ThreadManager.m in Sources */, E197B61E18BBEC6D00F073E5 /* AudioRouter.m in Sources */, - FC1615181A37935600F1761D /* NotificationPreviewViewController.m in Sources */, E197B60D18BBEC1A00F073E5 /* AudioSocket.m in Sources */, FCF72A081A01A765006BC849 /* ContactsTableViewController.m in Sources */, A5D0699B1A50E9CB004CB540 /* ShowGroupMembersViewController.m in Sources */, @@ -3260,6 +3263,7 @@ 76EB063218170B33006006FC /* Crc32.m in Sources */, E197B62418BBF5BB00F073E5 /* SoundPlayer.m in Sources */, E197B61018BBEC1A00F073E5 /* EncodedAudioPacket.m in Sources */, + FCD274E51A5AFDB800202277 /* MediaSettingsTableViewController.m in Sources */, 76EB063618170B33006006FC /* DataUtil.m in Sources */, E197B60C18BBEC1A00F073E5 /* AudioPacker.m in Sources */, E197B61218BBEC1A00F073E5 /* AudioStretcher.m in Sources */, @@ -3275,6 +3279,7 @@ 76EB057418170B33006006FC /* RecentCallManager.m in Sources */, B60FB9A71A46F099006A5A66 /* TSAllocAttachmentRequest.m in Sources */, 76EB061C18170B33006006FC /* ArrayUtil.m in Sources */, + FCD274E81A5AFDC900202277 /* AdvancedSettingsTableViewController.m in Sources */, 76EB05C418170B33006006FC /* HandshakePacket.m in Sources */, 76EB05AA18170B33006006FC /* SequenceCounter.m in Sources */, 7038632718F70C0700D4A43F /* CryptoTools.m in Sources */, @@ -3327,6 +3332,7 @@ FCB11D8A1A1284BB002F93FB /* SettingsTableViewCell.m in Sources */, 76EB05C818170B33006006FC /* HelloPacket.m in Sources */, BFB074C719A5611000F2947C /* FutureUtil.m in Sources */, + FCD274E21A5AFD8000202277 /* PrivacySettingsTableViewController.m in Sources */, 76EB057218170B33006006FC /* RecentCall.m in Sources */, 76EB060418170B33006006FC /* PhoneNumberDirectoryFilter.m in Sources */, B97CBFA818860EA3008E0DE9 /* CountryCodeViewController.m in Sources */, diff --git a/Signal/Images/notification_no_preview_no_name@2x.png b/Signal/Images/notification_no_preview_no_name@2x.png deleted file mode 100644 index 4ba66759a..000000000 Binary files a/Signal/Images/notification_no_preview_no_name@2x.png and /dev/null differ diff --git a/Signal/Images/notification_no_preview_with_name@2x.png b/Signal/Images/notification_no_preview_with_name@2x.png deleted file mode 100644 index bd00e898f..000000000 Binary files a/Signal/Images/notification_no_preview_with_name@2x.png and /dev/null differ diff --git a/Signal/Images/notification_with_preview@2x.png b/Signal/Images/notification_with_preview@2x.png deleted file mode 100644 index 515c9a99f..000000000 Binary files a/Signal/Images/notification_with_preview@2x.png and /dev/null differ diff --git a/Signal/src/AppDelegate.m b/Signal/src/AppDelegate.m index d1f7f0012..dee506ba3 100644 --- a/Signal/src/AppDelegate.m +++ b/Signal/src/AppDelegate.m @@ -212,6 +212,7 @@ } else { [TSSocketManager becomeActive]; } + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 20 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{ completionHandler(UIBackgroundFetchResultNewData); @@ -261,13 +262,9 @@ dispatch_get_main_queue(), ^{ completionHandler(); }); - } else if ([identifier isEqualToString:Signal_Message_MarkAsRead_Identifier]){ - //TODO - } else if ([identifier isEqualToString:Signal_Message_View_Identifier]){ - //TODO + } else{ + completionHandler(); } - - completionHandler(); } - (void)applicationDidEnterBackground:(UIApplication *)application{ diff --git a/Signal/src/Storyboard/Storyboard.storyboard b/Signal/src/Storyboard/Storyboard.storyboard index f2a23abd8..646bf7344 100755 --- a/Signal/src/Storyboard/Storyboard.storyboard +++ b/Signal/src/Storyboard/Storyboard.storyboard @@ -21,8 +21,6 @@ - - @@ -2632,70 +2630,18 @@ A0 09 9A FF A8 8A 09 99 - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -2775,88 +2721,18 @@ Licensed under the GPLv3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + + - - - - + + + + + + + - + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -3365,216 +3159,14 @@ Licensed under the GPLv3 - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -3866,9 +3458,6 @@ Licensed under the GPLv3 - - - @@ -3876,10 +3465,9 @@ Licensed under the GPLv3 - + - diff --git a/Signal/src/environment/Environment.h b/Signal/src/environment/Environment.h index 1e2ab63c5..6e7283a3b 100644 --- a/Signal/src/environment/Environment.h +++ b/Signal/src/environment/Environment.h @@ -3,7 +3,7 @@ #import "PropertyListPreferences.h" #import "PacketHandler.h" #import "SecureEndPoint.h" -#import "GroupModel.h" +#import "TSGroupModel.h" /** * * Environment is a data and data accessor class. @@ -84,6 +84,6 @@ andCurrentRegionCodeForPhoneNumbers:(NSString*)currentRegionCodeForPhoneNumbers - (void)setSignUpFlowNavigationController:(UINavigationController *)signUpFlowNavigationController; + (void)messageIdentifier:(NSString*)identifier; -+ (void)groupModel:(GroupModel*)model; ++ (void)groupModel:(TSGroupModel*)model; @end diff --git a/Signal/src/environment/Environment.m b/Signal/src/environment/Environment.m index e626e28e7..e057a91b2 100644 --- a/Signal/src/environment/Environment.m +++ b/Signal/src/environment/Environment.m @@ -187,7 +187,7 @@ phoneDirectoryManager; } } -+ (void)groupModel:(GroupModel*)model { ++ (void)groupModel:(TSGroupModel*)model { Environment *env = [self getCurrent]; SignalsViewController *vc = env.signalsViewController; diff --git a/Signal/src/textsecure/Contacts/Threads/TSGroupThread.h b/Signal/src/textsecure/Contacts/Threads/TSGroupThread.h index 957908b5d..5d52d5460 100644 --- a/Signal/src/textsecure/Contacts/Threads/TSGroupThread.h +++ b/Signal/src/textsecure/Contacts/Threads/TSGroupThread.h @@ -7,13 +7,13 @@ // #import "TSThread.h" -#import "GroupModel.h" +#import "TSGroupModel.h" @interface TSGroupThread : TSThread -@property (nonatomic,strong) GroupModel* groupModel; -+ (instancetype)getOrCreateThreadWithGroupModel:(GroupModel *)groupModel transaction:(YapDatabaseReadWriteTransaction*)transaction; +@property (nonatomic,strong) TSGroupModel* groupModel; ++ (instancetype)getOrCreateThreadWithGroupModel:(TSGroupModel *)groupModel transaction:(YapDatabaseReadWriteTransaction*)transaction; -+ (instancetype)threadWithGroupModel:(GroupModel *)groupModel transaction:(YapDatabaseReadTransaction*)transaction; ++ (instancetype)threadWithGroupModel:(TSGroupModel *)groupModel transaction:(YapDatabaseReadTransaction*)transaction; - (NSData*)groupId; - (NSArray *)recipientsWithTransaction:(YapDatabaseReadTransaction*)transaction; diff --git a/Signal/src/textsecure/Contacts/Threads/TSGroupThread.m b/Signal/src/textsecure/Contacts/Threads/TSGroupThread.m index fb3a2dc4f..c2f7ee269 100644 --- a/Signal/src/textsecure/Contacts/Threads/TSGroupThread.m +++ b/Signal/src/textsecure/Contacts/Threads/TSGroupThread.m @@ -14,7 +14,7 @@ #define TSGroupThreadPrefix @"g" -- (instancetype)initWithGroupModel:(GroupModel *)groupModel{ +- (instancetype)initWithGroupModel:(TSGroupModel *)groupModel{ NSString *uniqueIdentifier = [[self class] threadIdFromGroupId:groupModel.groupId]; @@ -24,11 +24,11 @@ } -+ (instancetype)threadWithGroupModel:(GroupModel *)groupModel transaction:(YapDatabaseReadTransaction*)transaction { ++ (instancetype)threadWithGroupModel:(TSGroupModel *)groupModel transaction:(YapDatabaseReadTransaction*)transaction { return [self fetchObjectWithUniqueID:[self threadIdFromGroupId:groupModel.groupId] transaction:transaction]; } -+ (instancetype)getOrCreateThreadWithGroupModel:(GroupModel *)groupModel transaction:(YapDatabaseReadWriteTransaction*)transaction{ ++ (instancetype)getOrCreateThreadWithGroupModel:(TSGroupModel *)groupModel transaction:(YapDatabaseReadWriteTransaction*)transaction{ TSGroupThread *thread = [self fetchObjectWithUniqueID:[self threadIdFromGroupId:groupModel.groupId] transaction:transaction]; if (!thread) { diff --git a/Signal/src/textsecure/Messages/TSMessagesManager+attachments.m b/Signal/src/textsecure/Messages/TSMessagesManager+attachments.m index c17f70fe1..8160fbe58 100644 --- a/Signal/src/textsecure/Messages/TSMessagesManager+attachments.m +++ b/Signal/src/textsecure/Messages/TSMessagesManager+attachments.m @@ -147,7 +147,7 @@ dispatch_queue_t attachmentsQueue() { [stream saveWithTransaction:transaction]; if([attachment.avatarOfGroupId length]!=0) { - GroupModel *emptyModelToFillOutId = [[GroupModel alloc] initWithTitle:nil memberIds:nil image:nil groupId:attachment.avatarOfGroupId]; // TODO refactor the TSGroupThread to just take in an ID (as it is all that it uses). Should not take in more than it uses + TSGroupModel *emptyModelToFillOutId = [[TSGroupModel alloc] initWithTitle:nil memberIds:nil image:nil groupId:attachment.avatarOfGroupId]; // TODO refactor the TSGroupThread to just take in an ID (as it is all that it uses). Should not take in more than it uses TSGroupThread* gThread = [TSGroupThread getOrCreateThreadWithGroupModel:emptyModelToFillOutId transaction:transaction]; gThread.groupModel.groupImage=[stream image]; [gThread saveWithTransaction:transaction]; diff --git a/Signal/src/textsecure/Messages/TSMessagesManager.m b/Signal/src/textsecure/Messages/TSMessagesManager.m index a2d8deae3..f46fc0952 100644 --- a/Signal/src/textsecure/Messages/TSMessagesManager.m +++ b/Signal/src/textsecure/Messages/TSMessagesManager.m @@ -186,7 +186,7 @@ if(content.hasGroup) { __block BOOL ignoreMessage = NO; [self.dbConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) { - GroupModel *emptyModelToFillOutId = [[GroupModel alloc] initWithTitle:nil memberIds:nil image:nil groupId:content.group.id]; // TODO refactor the TSGroupThread to just take in an ID (as it is all that it uses). Should not take in more than it uses + TSGroupModel *emptyModelToFillOutId = [[TSGroupModel alloc] initWithTitle:nil memberIds:nil image:nil groupId:content.group.id]; // TODO refactor the TSGroupThread to just take in an ID (as it is all that it uses). Should not take in more than it uses TSGroupThread *gThread = [TSGroupThread threadWithGroupModel:emptyModelToFillOutId transaction:transaction]; if(gThread==nil && content.group.type != PushMessageContentGroupContextTypeUpdate) { ignoreMessage = YES; @@ -247,7 +247,7 @@ TSIncomingMessage *incomingMessage; TSThread *thread; if (groupId) { - GroupModel *model = [[GroupModel alloc] initWithTitle:content.group.name memberIds:[[NSMutableArray alloc ] initWithArray:content.group.members] image:nil groupId:content.group.id]; + TSGroupModel *model = [[TSGroupModel alloc] initWithTitle:content.group.name memberIds:[[NSMutableArray alloc ] initWithArray:content.group.members] image:nil groupId:content.group.id]; TSGroupThread *gThread = [TSGroupThread getOrCreateThreadWithGroupModel:model transaction:transaction]; [gThread saveWithTransaction:transaction]; if(content.group.type==PushMessageContentGroupContextTypeUpdate) { @@ -324,7 +324,6 @@ [errorMessage saveWithTransaction:transaction]; }]; - } - (void)processException:(NSException*)exception outgoingMessage:(TSOutgoingMessage*)message{ @@ -339,32 +338,7 @@ } - (void)notifyUserForIncomingMessage:(TSIncomingMessage*)message from:(NSString*)name{ - UILocalNotification *notification = [[UILocalNotification alloc] init]; - - notification.alertBody = [self alertBodyForNotificationSetting:[Environment.preferences notificationPreviewType] withMessage:message from:name]; - notification.soundName = @"default"; - notification.category = Signal_Message_Category; - - [[UIApplication sharedApplication] presentLocalNotificationNow:notification]; -} - --(NSString*)alertBodyForNotificationSetting:(NotificationType)setting withMessage:(TSIncomingMessage*)message from:(NSString*)name -{ - switch (setting) { - case NotificationNoNameNoPreview: - return @"New message"; - break; - case NotificationNamePreview: - if (message.body) { - return [NSString stringWithFormat:@"%@ : %@", name, message.body]; - } - case NotificationNameNoPreview: - return [NSString stringWithFormat:@"New message from %@", name]; - - default: - DDLogWarn(@"Unexpected notification type %lu", setting); - break; - } + //TODO: Warn user when message is received? } @end diff --git a/Signal/src/view controllers/AboutTableViewController.h b/Signal/src/view controllers/AboutTableViewController.h new file mode 100644 index 000000000..226aa9030 --- /dev/null +++ b/Signal/src/view controllers/AboutTableViewController.h @@ -0,0 +1,13 @@ +// +// AboutTableViewController.h +// Signal +// +// Created by Dylan Bourgeois on 05/01/15. +// Copyright (c) 2015 Open Whisper Systems. All rights reserved. +// + +#import + +@interface AboutTableViewController : UITableViewController + +@end diff --git a/Signal/src/view controllers/AboutTableViewController.m b/Signal/src/view controllers/AboutTableViewController.m new file mode 100644 index 000000000..b852b0cd3 --- /dev/null +++ b/Signal/src/view controllers/AboutTableViewController.m @@ -0,0 +1,159 @@ +// +// AboutTableViewController.m +// Signal +// +// Created by Dylan Bourgeois on 05/01/15. +// Copyright (c) 2015 Open Whisper Systems. All rights reserved. +// + +#import "AboutTableViewController.h" +#import +#import "UIUtil.h" + +@interface AboutTableViewController () + +@property (strong, nonatomic) UITableViewCell *versionCell; +@property (strong, nonatomic) UITableViewCell *supportCell; +@property (strong, nonatomic) UITableViewCell *twitterInviteCell; + +@property (strong, nonatomic) UILabel *versionLabel; + +@property (strong, nonatomic) UILabel *footerView; + +@end + +@implementation AboutTableViewController + +-(instancetype)init { + return [super initWithStyle:UITableViewStyleGrouped]; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + self.tableView.tableFooterView = [[UIView alloc]initWithFrame:CGRectZero]; +} + +-(void)loadView +{ + [super loadView]; + + self.title = @"About"; + + //Version + self.versionCell = [[UITableViewCell alloc]init]; + self.versionCell.textLabel.text = @"Version"; + + self.versionLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 75, 30)]; + self.versionLabel.text = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]; + self.versionLabel.textColor = [UIColor lightGrayColor]; + self.versionLabel.font = [UIFont ows_lightFontWithSize:16.0f]; + self.versionLabel.textAlignment = NSTextAlignmentRight; + + self.versionCell.accessoryView = self.versionLabel; + self.versionCell.userInteractionEnabled = NO; + + //Support + self.supportCell = [[UITableViewCell alloc]init]; + self.supportCell.textLabel.text = @"Support"; + self.supportCell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; + + //Footer + self.footerView = [[UILabel alloc]init]; + self.footerView.text = @"Copyright Open Whisper Systems \n Licensed under the GPLv3"; + self.footerView.textColor = [UIColor darkGrayColor]; + self.footerView.font = [UIFont ows_lightFontWithSize:15.0f]; + self.footerView.numberOfLines = 2; + self.footerView.textAlignment = NSTextAlignmentCenter; + + + //Twitter Invite + self.twitterInviteCell = [[UITableViewCell alloc]init]; + self.twitterInviteCell.textLabel.text = @"Share install link"; + + UIImageView* twitterImageView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"twitter"]]; + [twitterImageView setFrame:CGRectMake(0, 0, 34, 34)]; + twitterImageView.contentMode = UIViewContentModeScaleAspectFit; + + self.twitterInviteCell.accessoryView = twitterImageView; +} + +#pragma mark - Table view data source + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { + return 3; +} + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + switch (section) { + case 0: return 1; + case 1: return 1; + case 2: return 1; + default: return 0; + } +} + +- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section +{ + switch (section) { + case 0: return @"Information"; + case 1: return @"Invite"; + case 2: return @"Help"; + + default: return nil; + } +} + +-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath +{ + switch (indexPath.section) { + case 0: return self.versionCell; + case 1: return self.twitterInviteCell; + case 2: return self.supportCell; + } + + return nil; +} + +-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + [tableView deselectRowAtIndexPath:indexPath animated:YES]; + + switch (indexPath.section) { + case 1: + [self tappedInviteTwitter]; + break; + case 2: + [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://support.whispersystems.org"]]; + break; + + default: + break; + } +} + +- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { + return section == 2 ? self.footerView : nil; +} + +- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section { + return section == 2 ? 60.0f : 0; +} + +- (void)tappedInviteTwitter { + + if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter]) + { + SLComposeViewController *tweetSheet = [SLComposeViewController + composeViewControllerForServiceType:SLServiceTypeTwitter]; + + NSString *tweetString = [NSString stringWithFormat:@"You can reach me on @whispersystems Signal, get it now."]; + [tweetSheet setInitialText:tweetString]; + [tweetSheet addURL:[NSURL URLWithString:@"https://whispersystems.org/signal/install/"]]; + tweetSheet.completionHandler = ^(SLComposeViewControllerResult result) { + }; + [self presentViewController:tweetSheet animated:YES completion:nil]; + } + +} + +@end diff --git a/Signal/src/view controllers/AdvancedSettingsTableViewController.h b/Signal/src/view controllers/AdvancedSettingsTableViewController.h new file mode 100644 index 000000000..c27e58a46 --- /dev/null +++ b/Signal/src/view controllers/AdvancedSettingsTableViewController.h @@ -0,0 +1,13 @@ +// +// AdvancedSettingsTableViewController.h +// Signal +// +// Created by Dylan Bourgeois on 05/01/15. +// Copyright (c) 2015 Open Whisper Systems. All rights reserved. +// + +#import + +@interface AdvancedSettingsTableViewController : UITableViewController + +@end diff --git a/Signal/src/view controllers/AdvancedSettingsTableViewController.m b/Signal/src/view controllers/AdvancedSettingsTableViewController.m new file mode 100644 index 000000000..1bcc90ef3 --- /dev/null +++ b/Signal/src/view controllers/AdvancedSettingsTableViewController.m @@ -0,0 +1,116 @@ +// +// AdvancedSettingsTableViewController.m +// Signal +// +// Created by Dylan Bourgeois on 05/01/15. +// Copyright (c) 2015 Open Whisper Systems. All rights reserved. +// + +#import "AdvancedSettingsTableViewController.h" + +#import +#import "Environment.h" +#import "PreferencesUtil.h" +#import "DebugLogger.h" + + +@interface AdvancedSettingsTableViewController () + +@property (strong, nonatomic) UITableViewCell * enableLogCell; +@property (strong, nonatomic) UITableViewCell * submitLogCell; + +@property (strong, nonatomic) UISwitch * enableLogSwitch; +@end + +@implementation AdvancedSettingsTableViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + + self.tableView.tableFooterView = [[UIView alloc]initWithFrame:CGRectZero]; +} + +-(instancetype)init { + return [super initWithStyle:UITableViewStyleGrouped]; +} + +- (void)didReceiveMemoryWarning { + [super didReceiveMemoryWarning]; +} + +-(void)loadView +{ + [super loadView]; + + self.title = @"Advanced"; + + //Enable Log + self.enableLogCell = [[UITableViewCell alloc]init]; + self.enableLogCell.textLabel.text = @"Enable Debug Log"; + self.enableLogCell.userInteractionEnabled = YES; + + self.enableLogSwitch = [[UISwitch alloc]initWithFrame:CGRectZero]; + [self.enableLogSwitch setOn:[Environment.preferences loggingIsEnabled]]; + [self.enableLogSwitch addTarget:self action:@selector(didToggleSwitch:) forControlEvents:UIControlEventTouchUpInside]; + + self.enableLogCell.accessoryView = self.enableLogSwitch; + + + //Send Log + self.submitLogCell = [[UITableViewCell alloc]init]; + self.submitLogCell.textLabel.text = @"Submit Debug Log"; +} + +#pragma mark - Table view data source + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { + return 1; +} + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + return self.enableLogSwitch.isOn ? 2 : 1; +} + +- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section +{ + return @"Logging"; +} + +-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath +{ + switch (indexPath.row) { + case 0: return self.enableLogCell; + case 1: return self.submitLogCell; + } + + NSAssert(false, @"No Cell configured"); + + return nil; +} + +-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + [tableView deselectRowAtIndexPath:indexPath animated:YES]; + + if (indexPath.row == 1) + { + [Pastelog submitLogs]; + } +} + +#pragma mark - Actions + +-(void)didToggleSwitch:(UISwitch*)sender +{ + if (!sender.isOn) { + [DebugLogger.sharedInstance disableFileLogging]; + [DebugLogger.sharedInstance wipeLogs]; + } else { + [DebugLogger.sharedInstance enableFileLogging]; + } + + [Environment.preferences setLoggingEnabled:sender.isOn]; + [self.tableView reloadData]; +} + +@end diff --git a/Signal/src/view controllers/MediaSettingsTableViewController.h b/Signal/src/view controllers/MediaSettingsTableViewController.h new file mode 100644 index 000000000..4e8e8f300 --- /dev/null +++ b/Signal/src/view controllers/MediaSettingsTableViewController.h @@ -0,0 +1,13 @@ +// +// MediaSettingsTableViewController.h +// Signal +// +// Created by Dylan Bourgeois on 05/01/15. +// Copyright (c) 2015 Open Whisper Systems. All rights reserved. +// + +#import + +@interface MediaSettingsTableViewController : UITableViewController + +@end diff --git a/Signal/src/view controllers/MediaSettingsTableViewController.m b/Signal/src/view controllers/MediaSettingsTableViewController.m new file mode 100644 index 000000000..29c526870 --- /dev/null +++ b/Signal/src/view controllers/MediaSettingsTableViewController.m @@ -0,0 +1,144 @@ +// +// MediaSettingsTableViewController.m +// Signal +// +// Created by Dylan Bourgeois on 05/01/15. +// Copyright (c) 2015 Open Whisper Systems. All rights reserved. +// + +#import "MediaSettingsTableViewController.h" + +#import "Environment.h" +#import "PreferencesUtil.h" + +@interface MediaSettingsTableViewController () + +@property (strong, nonatomic) UITableViewCell * uncroppedQualityCell; +@property (strong, nonatomic) UITableViewCell * highQualityCell; +@property (strong, nonatomic) UITableViewCell * averageQualityCell; +@property (strong, nonatomic) UITableViewCell * lowQualityCell; + +@property (strong, nonatomic) NSIndexPath * lastIndexPath; + +@end + +@implementation MediaSettingsTableViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + self.tableView.tableFooterView = [[UIView alloc]initWithFrame:CGRectZero]; + [self showCheckmarkOnDefaultSetting:YES]; +} + +- (void)didReceiveMemoryWarning { + [super didReceiveMemoryWarning]; +} + +-(instancetype)init +{ + return [super initWithStyle:UITableViewStyleGrouped]; +} + +-(void)loadView { + [super loadView]; + + self.title = @"Media"; + + //Uncropped + self.uncroppedQualityCell = [[UITableViewCell alloc]init]; + self.uncroppedQualityCell.textLabel.text = @"Uncropped"; + self.uncroppedQualityCell.selectionStyle = UITableViewCellSelectionStyleNone; + + //High + self.highQualityCell = [[UITableViewCell alloc]init]; + self.highQualityCell.textLabel.text = @"High"; + self.highQualityCell.selectionStyle = UITableViewCellSelectionStyleNone; + + //Average + self.averageQualityCell = [[UITableViewCell alloc]init]; + self.averageQualityCell.textLabel.text = @"Average"; + self.averageQualityCell.selectionStyle = UITableViewCellSelectionStyleNone; + + //Low + self.lowQualityCell = [[UITableViewCell alloc]init]; + self.lowQualityCell.textLabel.text = @"Low"; + self.lowQualityCell.selectionStyle = UITableViewCellSelectionStyleNone; + +} +#pragma mark - Table view data source + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { + return 1; +} + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + return 4; +} + +-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath +{ + switch (indexPath.row) { + case 0: return self.uncroppedQualityCell; + case 1: return self.highQualityCell; + case 2: return self.averageQualityCell; + case 3: return self.lowQualityCell; + default: return nil; + } +} + +- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section +{ + return @"Image upload quality"; +} + +-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + [self showCheckmarkOnDefaultSetting:NO]; + [tableView cellForRowAtIndexPath:indexPath].accessoryType = UITableViewCellAccessoryCheckmark; + [self updateSettingWithSelectedIndexPath:indexPath]; +} + +-(void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath +{ + [tableView cellForRowAtIndexPath:indexPath].accessoryType = UITableViewCellAccessoryNone; +} + +#pragma mark - Setting + +-(void)updateSettingWithSelectedIndexPath:(NSIndexPath*)indexPath +{ + switch (indexPath.row) { + case 0: + [Environment.preferences setImageUploadQuality:TSImageQualityUncropped]; + break; + case 1: + [Environment.preferences setImageUploadQuality:TSImageQualityHigh]; + break; + case 2: + [Environment.preferences setImageUploadQuality:TSImageQualityMedium]; + break; + case 3: + [Environment.preferences setImageUploadQuality:TSImageQualityLow]; + break; + default: + break; + } +} + +-(NSIndexPath*)indexPathForSetting:(TSImageQuality)setting +{ + switch (setting) { + case TSImageQualityUncropped: return [NSIndexPath indexPathForRow:0 inSection:0]; + case TSImageQualityHigh: return [NSIndexPath indexPathForRow:1 inSection:0]; + case TSImageQualityMedium: return [NSIndexPath indexPathForRow:2 inSection:0]; + case TSImageQualityLow: return [NSIndexPath indexPathForRow:3 inSection:0]; + } +} + +-(void)showCheckmarkOnDefaultSetting:(BOOL)show +{ + NSIndexPath * defaultIndexPath = [self indexPathForSetting:[Environment.preferences imageUploadQuality]]; + [self.tableView cellForRowAtIndexPath:defaultIndexPath].accessoryType = show ? UITableViewCellAccessoryCheckmark : UITableViewCellAccessoryNone; +} + +@end diff --git a/Signal/src/view controllers/MessagesViewController.h b/Signal/src/view controllers/MessagesViewController.h index adbfa6431..3772d923d 100644 --- a/Signal/src/view controllers/MessagesViewController.h +++ b/Signal/src/view controllers/MessagesViewController.h @@ -8,7 +8,7 @@ #import "JSQMessagesViewController.h" #import "JSQMessages.h" -#import "GroupModel.h" +#import "TSGroupModel.h" @class TSThread; @interface MessagesViewController : JSQMessagesViewController #import "TSGroupThread.h" -#import "GroupModel.h" +#import "TSGroupModel.h" @interface NewGroupViewController : UIViewController @@ -17,6 +17,6 @@ @property(nonatomic, strong) IBOutlet UITextField* nameGroupTextField; @property(nonatomic, strong) IBOutlet UIButton* groupImageButton; @property(nonatomic, strong) IBOutlet UIView* tapToDismissView; -@property(nonatomic, strong) GroupModel* groupModel; +@property(nonatomic, strong) TSGroupModel* groupModel; @end diff --git a/Signal/src/view controllers/NewGroupViewController.m b/Signal/src/view controllers/NewGroupViewController.m index 45b06eac9..472670c69 100644 --- a/Signal/src/view controllers/NewGroupViewController.m +++ b/Signal/src/view controllers/NewGroupViewController.m @@ -15,7 +15,7 @@ #import "Contact.h" -#import "GroupModel.h" +#import "TSGroupModel.h" #import "SecurityUtils.h" #import "SignalKeyingStorage.h" @@ -121,7 +121,7 @@ static NSString* const kUnwindToMessagesViewSegue = @"UnwindToMessagesViewSegue" #pragma mark - Actions -(void)createGroup { - GroupModel* model = [self makeGroup]; + TSGroupModel* model = [self makeGroup]; [Environment groupModel:model]; } @@ -132,13 +132,13 @@ static NSString* const kUnwindToMessagesViewSegue = @"UnwindToMessagesViewSegue" [mut addObjectsFromArray:[[contacts objectAtIndex:(NSUInteger)idx.row-1] textSecureIdentifiers]]; } [mut addObject:[SignalKeyingStorage.localNumber toE164]]; // Also add the originator - _groupModel = [[GroupModel alloc] initWithTitle:_nameGroupTextField.text memberIds:[NSMutableArray arrayWithArray:[[NSSet setWithArray:mut] allObjects]] image:_thread.groupModel.groupImage groupId:_thread.groupModel.groupId]; + _groupModel = [[TSGroupModel alloc] initWithTitle:_nameGroupTextField.text memberIds:[NSMutableArray arrayWithArray:[[NSSet setWithArray:mut] allObjects]] image:_thread.groupModel.groupImage groupId:_thread.groupModel.groupId]; [self performSegueWithIdentifier:kUnwindToMessagesViewSegue sender:self]; } --(GroupModel*)makeGroup { +-(TSGroupModel*)makeGroup { NSString* title = _nameGroupTextField.text; UIImage* img = _thread.groupModel.groupImage; NSMutableArray* mut = [[NSMutableArray alloc]init]; @@ -150,7 +150,7 @@ static NSString* const kUnwindToMessagesViewSegue = @"UnwindToMessagesViewSegue" [mut addObject:[SignalKeyingStorage.localNumber toE164]]; NSData* groupId = [SecurityUtils generateRandomBytes:16]; - return [[GroupModel alloc] initWithTitle:title memberIds:mut image:img groupId:groupId]; + return [[TSGroupModel alloc] initWithTitle:title memberIds:mut image:img groupId:groupId]; } -(IBAction)addGroupPhoto:(id)sender diff --git a/Signal/src/view controllers/NotificationPreviewViewController.h b/Signal/src/view controllers/NotificationPreviewViewController.h deleted file mode 100644 index d9e435316..000000000 --- a/Signal/src/view controllers/NotificationPreviewViewController.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// NotificationPreviewViewController.h -// Signal -// -// Created by Dylan Bourgeois on 09/12/14. -// Copyright (c) 2014 Open Whisper Systems. All rights reserved. -// - -#import - -@interface NotificationPreviewViewController : UITableViewController - -@end diff --git a/Signal/src/view controllers/NotificationPreviewViewController.m b/Signal/src/view controllers/NotificationPreviewViewController.m deleted file mode 100644 index 3e7e40967..000000000 --- a/Signal/src/view controllers/NotificationPreviewViewController.m +++ /dev/null @@ -1,118 +0,0 @@ -// -// NotificationPreviewViewController.m -// Signal -// -// Created by Dylan Bourgeois on 09/12/14. -// Copyright (c) 2014 Open Whisper Systems. All rights reserved. -// - -#import "NotificationPreviewViewController.h" -#import "UIUtil.h" - -#import "PreferencesUtil.h" -#import "Environment.h" - -@interface NotificationPreviewViewController () -@property (nonatomic) NSIndexPath *defaultSelectedIndexPath; -@end - -@implementation NotificationPreviewViewController - -- (void)viewDidLoad -{ - [super viewDidLoad]; - self.navigationItem.title = @"Notification Style"; - self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero]; - self.clearsSelectionOnViewWillAppear = NO; -} - -- (void)didReceiveMemoryWarning -{ - [super didReceiveMemoryWarning]; -} - -- (void)viewWillAppear:(BOOL)animated -{ - [super viewWillAppear:animated]; - NSInteger currentSetting = (NSInteger)[Environment.preferences notificationPreviewType]; - _defaultSelectedIndexPath = [NSIndexPath indexPathForRow:0 inSection:currentSetting + 1]; - [self selectRowAtIndexPath:_defaultSelectedIndexPath]; -} - -#pragma mark - Table view data source - -- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView -{ - return 4; -} - -- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section -{ - return 1; -} - -- (void)tableView:(UITableView *)tableView willDisplayHeaderView:(UIView *)view forSection:(NSInteger)section -{ - UITableViewHeaderFooterView *header = (UITableViewHeaderFooterView *)view; - [header.textLabel setTextColor:[UIColor blackColor]]; - if (SYSTEM_VERSION_GREATER_THAN(_iOS_8_0_2)) { - [header.textLabel setFont:[UIFont ows_thinFontWithSize:14.0f]]; - } -} - -- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath -{ - if (_defaultSelectedIndexPath != nil && ![_defaultSelectedIndexPath isEqual:indexPath]) { - [self deselectRowAtIndexPath:_defaultSelectedIndexPath]; - _defaultSelectedIndexPath = nil; - } - - UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath]; - cell.accessoryType = UITableViewCellAccessoryCheckmark; - - switch (indexPath.section) { - case 1: - [Environment.preferences setNotificationPreviewType:NotificationNoNameNoPreview]; - break; - - case 2: - [Environment.preferences setNotificationPreviewType:NotificationNameNoPreview]; - break; - - case 3: - [Environment.preferences setNotificationPreviewType:NotificationNamePreview]; - break; - - default: - break; - } -} - -- (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath -{ - UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath]; - cell.accessoryType = UITableViewCellAccessoryNone; -} - -- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath -{ - if (indexPath.section == 0) { - return 120.0f; - } else { - return 80.0f; - } -} - -#pragma mark - Cell selection proxy - -- (void)selectRowAtIndexPath:(NSIndexPath *)indexPath -{ - [self.tableView.delegate tableView:self.tableView didSelectRowAtIndexPath:indexPath]; -} - -- (void)deselectRowAtIndexPath:(NSIndexPath *)indexPath -{ - [self.tableView.delegate tableView:self.tableView didDeselectRowAtIndexPath:indexPath]; -} - -@end diff --git a/Signal/src/view controllers/PrivacySettingsTableViewController.h b/Signal/src/view controllers/PrivacySettingsTableViewController.h new file mode 100644 index 000000000..7cd519e33 --- /dev/null +++ b/Signal/src/view controllers/PrivacySettingsTableViewController.h @@ -0,0 +1,13 @@ +// +// PrivacySettingsTableViewController.h +// Signal +// +// Created by Dylan Bourgeois on 05/01/15. +// Copyright (c) 2015 Open Whisper Systems. All rights reserved. +// + +#import + +@interface PrivacySettingsTableViewController : UITableViewController + +@end diff --git a/Signal/src/view controllers/PrivacySettingsTableViewController.m b/Signal/src/view controllers/PrivacySettingsTableViewController.m new file mode 100644 index 000000000..9471b77a4 --- /dev/null +++ b/Signal/src/view controllers/PrivacySettingsTableViewController.m @@ -0,0 +1,202 @@ +// +// PrivacySettingsTableViewController.m +// Signal +// +// Created by Dylan Bourgeois on 05/01/15. +// Copyright (c) 2015 Open Whisper Systems. All rights reserved. +// + +#import "PrivacySettingsTableViewController.h" + +#import <25519/Curve25519.h> +#import "DJWActionSheet.h" +#import "Environment.h" +#import "PreferencesUtil.h" +#import "TSFingerprintGenerator.h" +#import "TSStorageManager+IdentityKeyStore.h" +#import "UIUtil.h" + +@interface PrivacySettingsTableViewController () + +@property (nonatomic, strong) UITableViewCell * enableScreenSecurityCell; +@property (nonatomic, strong) UITableViewCell * clearHistoryLogCell; +@property (nonatomic, strong) UITableViewCell * fingerprintCell; +@property (nonatomic, strong) UITableViewCell * shareFingerprintCell; + +@property (nonatomic, strong) UISwitch * enableScreenSecuritySwitch; + +@property (nonatomic, strong) UILabel * fingerprintLabel; + +@property (nonatomic, strong) NSTimer * copiedTimer; + +@end + +@implementation PrivacySettingsTableViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + self.tableView.tableFooterView = [[UIView alloc]initWithFrame:CGRectZero]; +} + +-(instancetype)init +{ + return [super initWithStyle:UITableViewStyleGrouped]; +} + +-(void)loadView +{ + [super loadView]; + + self.title = @"Privacy"; + + //Enable Screen Security Cell + self.enableScreenSecurityCell = [[UITableViewCell alloc]init]; + self.enableScreenSecurityCell.textLabel.text = @"Enable Screen Security"; + + self.enableScreenSecuritySwitch = [[UISwitch alloc]initWithFrame:CGRectZero]; + + self.enableScreenSecurityCell.accessoryView = self.enableScreenSecuritySwitch; + self.enableScreenSecurityCell.userInteractionEnabled = YES; + + //Clear History Log Cell + self.clearHistoryLogCell = [[UITableViewCell alloc]init]; + self.clearHistoryLogCell.textLabel.text = @"Clear History Logs"; + self.clearHistoryLogCell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; + + //Fingerprint Cell + self.fingerprintCell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"Identifier"]; + self.fingerprintCell.textLabel.text = @"Fingerprint"; + self.fingerprintCell.detailTextLabel.text = @"Tap to copy"; + self.fingerprintCell.detailTextLabel.textColor = [UIColor lightGrayColor]; + + self.fingerprintLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 150, 25)]; + self.fingerprintLabel.textColor = [UIColor lightGrayColor]; + self.fingerprintLabel.font = [UIFont ows_lightFontWithSize:16.0f]; + self.fingerprintLabel.lineBreakMode = NSLineBreakByTruncatingMiddle; + + self.fingerprintCell.accessoryView = self.fingerprintLabel; + + [self setValues]; + [self subsribeToEvents]; + +} + +-(void)subsribeToEvents +{ + [self.enableScreenSecuritySwitch addTarget:self action:@selector(didToggleSwitch:) forControlEvents:UIControlEventTouchUpInside]; +} + +-(void)setValues +{ + [self.enableScreenSecuritySwitch setOn:[Environment.preferences screenSecurityIsEnabled]]; + self.fingerprintLabel.text = [TSFingerprintGenerator getFingerprintForDisplay:[[TSStorageManager sharedManager]identityKeyPair].publicKey]; +} + +#pragma mark - Table view data source + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { + return 3; +} + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + switch (section) { + case 0: return 1; + case 1: return 1; + case 2: return 1; + default: return 0; + } +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + + switch (indexPath.section) { + case 0: return self.enableScreenSecurityCell; + case 1: return self.clearHistoryLogCell; + case 2: + switch (indexPath.row) { + case 0: return self.fingerprintCell; + case 1: return self.shareFingerprintCell; + } + } + + return nil; +} + +- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section +{ + switch (section) { + case 0: return @"Screen Security"; + case 1: return @"History Log"; + case 2: return @"Fingerprint"; + default: return nil; + } +} + +-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + [tableView deselectRowAtIndexPath:indexPath animated:YES]; + + switch (indexPath.section) { + case 1: + { + [DJWActionSheet showInView:self.tabBarController.view + withTitle:@"Are you sure you want to delete all your history (messages, attachments, call history ...) ? This action cannot be reverted." + cancelButtonTitle:@"Cancel" + destructiveButtonTitle:@"I'm sure." + otherButtonTitles:@[] + tapBlock:^(DJWActionSheet *actionSheet, NSInteger tappedButtonIndex) { + [self.tableView deselectRowAtIndexPath:indexPath animated:YES]; + if (tappedButtonIndex == actionSheet.cancelButtonIndex) { + NSLog(@"User Cancelled"); + + } else if (tappedButtonIndex == actionSheet.destructiveButtonIndex){ + [[TSStorageManager sharedManager] deleteThreadsAndMessages]; + } else { + NSLog(@"The user tapped button at index: %li", (long)tappedButtonIndex); + } + }]; + + break; + } + + case 2: + switch (indexPath.row) { + case 0: + { + //Timer to change label to copied (NSTextAttachment checkmark) + if (self.copiedTimer == nil) { + self.copiedTimer = [NSTimer scheduledTimerWithTimeInterval:2.0f target:self selector:@selector(endTimer:) userInfo:nil repeats:NO]; + self.fingerprintCell.detailTextLabel.text = @"Copied !"; + } else { + self.fingerprintCell.detailTextLabel.text = @"Tap to copy"; + } + [[UIPasteboard generalPasteboard] setString:self.fingerprintLabel.text]; + break; + } + + default: + break; + } + break; + default: + break; + } +} + +#pragma mark - Toggle + +-(void)didToggleSwitch:(UISwitch*)sender +{ + [Environment.preferences setScreenSecurity:self.enableScreenSecuritySwitch.isOn]; +} + +#pragma mark - Timer + +-(void)endTimer:(id)sender +{ + self.fingerprintCell.detailTextLabel.text = @"Tap to copy"; + [self.copiedTimer invalidate]; + self.copiedTimer = nil; +} + +@end diff --git a/Signal/src/view controllers/SettingsTableViewController.h b/Signal/src/view controllers/SettingsTableViewController.h index cd0d277fd..a41cbcc24 100644 --- a/Signal/src/view controllers/SettingsTableViewController.h +++ b/Signal/src/view controllers/SettingsTableViewController.h @@ -11,5 +11,6 @@ @interface SettingsTableViewController : UITableViewController @property IBOutlet UILabel *registeredNumber; +@property IBOutlet UILabel *networkStatusLabel; @end diff --git a/Signal/src/view controllers/SettingsTableViewController.m b/Signal/src/view controllers/SettingsTableViewController.m index cc537a758..11bfe657a 100644 --- a/Signal/src/view controllers/SettingsTableViewController.m +++ b/Signal/src/view controllers/SettingsTableViewController.m @@ -14,10 +14,13 @@ #import "TSStorageManager.h" #import "Environment.h" #import "PreferencesUtil.h" +#import "UIUtil.h" #import #import "RPServerRequestsManager.h" +#import "TSSocketManager.h" + #import #import "Cryptography.h" @@ -27,29 +30,39 @@ #import "TSStorageManager.h" #import "TSStorageManager+IdentityKeyStore.h" +#import "PrivacySettingsTableViewController.h" +#import "MediaSettingsTableViewController.h" +#import "AdvancedSettingsTableViewController.h" +#import "AboutTableViewController.h" + #define kProfileCellHeight 87.0f -#define kStandardCellHeight 60.0f +#define kStandardCellHeight 44.0f -#define kNumberOfSections 2 +#define kNumberOfSections 4 -#define kMessageDisplayCellRow 1 -#define kImageQualitySettingRow 2 -#define kClearHistoryLogCellRow 3 -#define kShareFingerpintCellRow 4 -#define kSendDebugLogCellRow 6 -#define kUnregisterCell 7 +#define kRegisteredNumberRow 0 +#define kPrivacyRow 0 +#define kMediaRow 1 +#define kAdvancedRow 2 +#define kAboutRow 3 +#define kNetworkRow 0 +#define kUnregisterRow 0 typedef enum { - kProfileRows = 1, - kSecurityRows = 8, + kRegisteredRows = 1, + kGeneralRows = 4, + kNetworkStatusRows = 1, + kUnregisterRows = 1, } kRowsForSection; typedef enum { - kProfileSection, - kSecuritySection, + kRegisteredNumberSection, + kGeneralSection, + kNetworkStatusSection, + kUnregisterSection, } kSection; -@interface SettingsTableViewController () +@interface SettingsTableViewController () @end @@ -59,13 +72,16 @@ typedef enum { [super viewDidLoad]; self.tableView.tableFooterView = [[UIView alloc]initWithFrame:CGRectZero]; self.registeredNumber.text = [TSAccountManager registeredNumber]; + [self initializeObserver]; + [TSSocketManager sendNotification]; } -- (void)didReceiveMemoryWarning { - [super didReceiveMemoryWarning]; +-(void)dealloc { + [[NSNotificationCenter defaultCenter] removeObserver:self name:SocketOpenedNotification object:nil]; + [[NSNotificationCenter defaultCenter] removeObserver:self name:SocketClosedNotification object:nil]; + [[NSNotificationCenter defaultCenter] removeObserver:self name:SocketConnectingNotification object:nil]; } - #pragma mark - Table view data source - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { @@ -75,131 +91,101 @@ typedef enum { - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { switch (section) { - case kProfileSection: - return kProfileRows; - break; - case kSecuritySection: - return kSecurityRows; - break; + case kRegisteredNumberSection: + return kRegisteredRows; + case kGeneralSection: + return kGeneralRows; + case kNetworkStatusSection: + return kNetworkStatusRows; + case kUnregisterSection: + return kUnregisterRows; default: return 0; - break; } } -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { switch (indexPath.section) { - case kProfileSection: + case kRegisteredNumberSection: return kProfileCellHeight; - break; - default: return kStandardCellHeight; - break; } } -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - if (indexPath.section==kSecuritySection) - { - switch (indexPath.row) { - case kClearHistoryLogCellRow: - { - //Present more info - [DJWActionSheet showInView:self.tabBarController.view - withTitle:@"Are you sure you want to delete all your history (messages, attachments, call history ...)? This action cannot be reverted." - cancelButtonTitle:@"Cancel" - destructiveButtonTitle:@"I'm sure." - otherButtonTitles:@[] - tapBlock:^(DJWActionSheet *actionSheet, NSInteger tappedButtonIndex) { - [self.tableView deselectRowAtIndexPath:indexPath animated:YES]; - if (tappedButtonIndex == actionSheet.cancelButtonIndex) { - NSLog(@"User Cancelled"); - - } else if (tappedButtonIndex == actionSheet.destructiveButtonIndex){ - [[TSStorageManager sharedManager] deleteThreadsAndMessages]; - } else { - NSLog(@"The user tapped button at index: %li", (long)tappedButtonIndex); - } - }]; - - break; + [tableView deselectRowAtIndexPath:indexPath animated:YES]; + + switch (indexPath.section) { + case kGeneralSection: + { + switch (indexPath.row) { + case kPrivacyRow: + { + PrivacySettingsTableViewController * vc = [[PrivacySettingsTableViewController alloc]init]; + NSAssert(self.navigationController != nil, @"Navigation controller must not be nil"); + NSAssert(vc != nil, @"Privacy Settings View Controller must not be nil"); + [self.navigationController pushViewController:vc animated:YES]; + break; + } + case kMediaRow: + { + MediaSettingsTableViewController * vc = [[MediaSettingsTableViewController alloc]init]; + NSAssert(self.navigationController != nil, @"Navigation controller must not be nil"); + NSAssert(vc != nil, @"Media Settings View Controller must not be nil"); + [self.navigationController pushViewController:vc animated:YES]; + break; + } + case kAdvancedRow: + { + AdvancedSettingsTableViewController * vc = [[AdvancedSettingsTableViewController alloc]init]; + NSAssert(self.navigationController != nil, @"Navigation controller must not be nil"); + NSAssert(vc != nil, @"Advanced Settings View Controller must not be nil"); + [self.navigationController pushViewController:vc animated:YES]; + break; + } + case kAboutRow: + { + AboutTableViewController * vc = [[AboutTableViewController alloc]init]; + NSAssert(self.navigationController != nil, @"Navigation controller must not be nil"); + NSAssert(vc != nil, @"About View Controller must not be nil"); + [self.navigationController pushViewController:vc animated:YES]; + break; + } + default: + break; } - case kImageQualitySettingRow: - { - [DJWActionSheet showInView:self.tabBarController.view - withTitle:nil - cancelButtonTitle:@"Cancel" - destructiveButtonTitle:nil - otherButtonTitles:@[@"Uncompressed", @"High", @"Medium", @"Low"] - tapBlock:^(DJWActionSheet *actionSheet, NSInteger tappedButtonIndex) { - [self.tableView deselectRowAtIndexPath:indexPath animated:YES]; - if (tappedButtonIndex == actionSheet.cancelButtonIndex) { - DDLogVerbose(@"User Cancelled <%s>", __PRETTY_FUNCTION__); - - } else if (tappedButtonIndex == actionSheet.destructiveButtonIndex) { - DDLogVerbose(@"Destructive button tapped <%s>", __PRETTY_FUNCTION__); - }else { - switch (tappedButtonIndex) { - case 0: - [Environment.preferences setImageUploadQuality:TSImageQualityUncropped]; - break; - case 1: - [Environment.preferences setImageUploadQuality:TSImageQualityHigh]; - break; - case 2: - [Environment.preferences setImageUploadQuality:TSImageQualityMedium]; - break; - case 3: - [Environment.preferences setImageUploadQuality:TSImageQualityLow]; - break; - default: - DDLogWarn(@"Illegal Image Quality Tapped in <%s>", __PRETTY_FUNCTION__); - break; - } - - SettingsTableViewCell * cell = (SettingsTableViewCell*)[tableView cellForRowAtIndexPath:indexPath]; - [cell updateImageQualityLabel]; - } - }]; - break; - } - case kShareFingerpintCellRow: { - if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter]) - { - SLComposeViewController *tweetSheet = [SLComposeViewController - composeViewControllerForServiceType:SLServiceTypeTwitter]; - NSData *myPublicKey = [[TSStorageManager sharedManager] identityKeyPair].publicKey; - NSString * tweetString = [NSString stringWithFormat:@"Verifying myself on Signal : %@", [self getFingerprintForTweet:myPublicKey]]; - [tweetSheet setInitialText:tweetString]; - [tweetSheet addURL:[NSURL URLWithString:@"https://whispersystems.org/signal/install/"]]; - tweetSheet.completionHandler = ^(SLComposeViewControllerResult result) { - if (result == SLComposeViewControllerResultCancelled) { - [self.tableView deselectRowAtIndexPath:indexPath animated:YES]; - } - }; - [self presentViewController:tweetSheet animated:YES completion:nil]; - } - break; - } - case kSendDebugLogCellRow: - [Pastelog submitLogs]; - break; - - case kUnregisterCell: - [TSAccountManager unregisterTextSecureWithSuccess:^{ - [[TSStorageManager sharedManager] wipe]; - exit(0); - } failure:^(NSError *error) { - SignalAlertView(@"Failed to unregister", @""); - }]; - break; - - default: - break; + break; } + + case kNetworkStatusSection: + { + break; + } + + case kUnregisterSection: + { + [TSAccountManager unregisterTextSecureWithSuccess:^{ + [[TSStorageManager sharedManager] wipe]; + exit(0); + } failure:^(NSError *error) { + SignalAlertView(@"Failed to unregister", @""); + }]; + break; + } + + default: + break; + } +} + +-(void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath +{ + if (indexPath.section == kNetworkStatusSection) { + UIAlertView * info = [[UIAlertView alloc]initWithTitle:@"Network Status" message:@"You can check your network status by looking at the colored bar above your inbox." delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil]; + [info show]; } } @@ -224,5 +210,29 @@ typedef enum { return formattedFingerprint; } +#pragma mark - Socket Status Notifications + +-(void)initializeObserver +{ + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(socketDidOpen) name:SocketOpenedNotification object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(socketDidClose) name:SocketClosedNotification object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(socketIsConnecting) name:SocketConnectingNotification object:nil]; +} + +-(void)socketDidOpen { + self.networkStatusLabel.text = @"Connected"; + self.networkStatusLabel.textColor = [UIColor ows_greenColor]; +} + +-(void)socketDidClose { + self.networkStatusLabel.text = @"Offline"; + self.networkStatusLabel.textColor = [UIColor ows_redColor]; +} + +-(void)socketIsConnecting { + self.networkStatusLabel.text = @"Connecting"; + self.networkStatusLabel.textColor = [UIColor ows_yellowColor]; +} + @end diff --git a/Signal/src/view controllers/ShowGroupMembersViewController.h b/Signal/src/view controllers/ShowGroupMembersViewController.h index 6fc3213ab..12737d4ba 100644 --- a/Signal/src/view controllers/ShowGroupMembersViewController.h +++ b/Signal/src/view controllers/ShowGroupMembersViewController.h @@ -8,7 +8,7 @@ #import #import "TSGroupThread.h" -#import "GroupModel.h" +#import "TSGroupModel.h" @interface ShowGroupMembersViewController : UITableViewController diff --git a/Signal/src/view controllers/ShowGroupMembersViewController.m b/Signal/src/view controllers/ShowGroupMembersViewController.m index f44f3b827..4cd5cb71d 100644 --- a/Signal/src/view controllers/ShowGroupMembersViewController.m +++ b/Signal/src/view controllers/ShowGroupMembersViewController.m @@ -16,7 +16,7 @@ #import "Contact.h" -#import "GroupModel.h" +#import "TSGroupModel.h" #import "SecurityUtils.h" #import "SignalKeyingStorage.h" diff --git a/Signal/src/view controllers/GroupModel.h b/Signal/src/view controllers/TSGroupModel.h similarity index 56% rename from Signal/src/view controllers/GroupModel.h rename to Signal/src/view controllers/TSGroupModel.h index 9d85e57ee..5d98f2539 100644 --- a/Signal/src/view controllers/GroupModel.h +++ b/Signal/src/view controllers/TSGroupModel.h @@ -2,7 +2,7 @@ // GroupModel.h // Signal // -// Created by Dylan Bourgeois on 13/11/14. +// Created by Frederic Jacobs. // Copyright (c) 2014 Open Whisper Systems. All rights reserved. // @@ -11,17 +11,17 @@ -@interface GroupModel : TSYapDatabaseObject +@interface TSGroupModel : TSYapDatabaseObject @property (nonatomic, strong) NSMutableArray *groupMemberIds; @property (nonatomic, strong) UIImage *groupImage; @property (nonatomic, strong) NSString *groupName; @property (nonatomic, strong) NSData* groupId; --(instancetype)initWithTitle:(NSString*)title memberIds:(NSMutableArray*)members image:(UIImage*)image groupId:(NSData*)groupId; +- (instancetype)initWithTitle:(NSString*)title memberIds:(NSMutableArray*)members image:(UIImage*)image groupId:(NSData*)groupId; - (BOOL)isEqual:(id)other; -- (BOOL)isEqualToGroupModel:(GroupModel *)model; -- (NSString*) getInfoStringAboutUpdateTo:(GroupModel*)model; +- (BOOL)isEqualToGroupModel:(TSGroupModel *)model; +- (NSString*) getInfoStringAboutUpdateTo:(TSGroupModel*)model; @end diff --git a/Signal/src/view controllers/GroupModel.m b/Signal/src/view controllers/TSGroupModel.m similarity index 89% rename from Signal/src/view controllers/GroupModel.m rename to Signal/src/view controllers/TSGroupModel.m index 442e88c39..0b0a306a9 100644 --- a/Signal/src/view controllers/GroupModel.m +++ b/Signal/src/view controllers/TSGroupModel.m @@ -2,20 +2,20 @@ // GroupModel.m // Signal // -// Created by Dylan Bourgeois on 13/11/14. +// Created by Frederic Jacobs on 13/11/14. // Copyright (c) 2014 Open Whisper Systems. All rights reserved. // -#import "GroupModel.h" +#import "TSGroupModel.h" -@implementation GroupModel +@implementation TSGroupModel -(instancetype)initWithTitle:(NSString*)title memberIds:(NSMutableArray*)memberIds image:(UIImage*)image groupId:(NSData *)groupId{ - _groupName=title; + _groupName = title; _groupMemberIds = [memberIds copy]; - _groupImage = image; - _groupId = groupId; - + _groupImage = image; + _groupId = groupId; + return self; } @@ -29,7 +29,7 @@ return [self isEqualToGroupModel:other]; } -- (BOOL)isEqualToGroupModel:(GroupModel *)other { +- (BOOL)isEqualToGroupModel:(TSGroupModel *)other { if (self == other) return YES; if(![_groupId isEqualToData:other.groupId] ) { @@ -49,7 +49,7 @@ return YES; } -- (NSString*) getInfoStringAboutUpdateTo:(GroupModel*)newModel { +- (NSString*) getInfoStringAboutUpdateTo:(TSGroupModel*)newModel { NSString* updatedGroupInfoString = @"Group updated. "; if (self == newModel) { return updatedGroupInfoString; @@ -81,6 +81,4 @@ return updatedGroupInfoString; } - - @end diff --git a/Signal/src/view controllers/UITests/SignalsViewController.h b/Signal/src/view controllers/UITests/SignalsViewController.h index 1e46d29b2..6f2cf19ca 100644 --- a/Signal/src/view controllers/UITests/SignalsViewController.h +++ b/Signal/src/view controllers/UITests/SignalsViewController.h @@ -10,12 +10,12 @@ #import #import "Contact.h" -#import "GroupModel.h" +#import "TSGroupModel.h" @interface SignalsViewController : UIViewController @property (nonatomic) NSString *contactIdentifierFromCompose; -@property (nonatomic) GroupModel *groupFromCompose; +@property (nonatomic) TSGroupModel *groupFromCompose; @property (nonatomic, retain) IBOutlet UITableView *tableView; @property (nonatomic, retain) IBOutlet UISegmentedControl *inboxArchiveSwitch;