From 2dac6c888a61d6c1c835f88f2155a9e0dee9d64f Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Tue, 3 Jan 2017 17:09:50 -0500 Subject: [PATCH 1/3] Update SignalServiceKit pod. * Fetch messages when app becomes active. --- Podfile | 2 +- Podfile.lock | 12 ++++++------ Signal/src/AppDelegate.m | 6 +++++- Signal/src/Models/OWSMessagesBubblesSizeCalculator.h | 1 + Signal/src/network/PushManager.h | 1 + Signal/src/network/PushManager.m | 4 ++++ 6 files changed, 18 insertions(+), 8 deletions(-) diff --git a/Podfile b/Podfile index b18fb76f4..69ef648f8 100644 --- a/Podfile +++ b/Podfile @@ -4,7 +4,7 @@ source 'https://github.com/CocoaPods/Specs.git' target 'Signal' do pod 'SocketRocket', :git => 'https://github.com/facebook/SocketRocket.git' pod 'AxolotlKit', git: 'https://github.com/WhisperSystems/SignalProtocolKit.git' - pod 'SignalServiceKit', git: 'https://github.com/WhisperSystems/SignalServiceKit.git', branch: 'mkirk/censorship-circumvention' + pod 'SignalServiceKit', git: 'https://github.com/WhisperSystems/SignalServiceKit.git', branch: 'master' #pod 'SignalServiceKit', path: '../SignalServiceKit' pod 'OpenSSL' pod 'PastelogKit', '~> 1.3' diff --git a/Podfile.lock b/Podfile.lock index c6594101c..d626ffc17 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -32,7 +32,7 @@ PODS: - JSQMessagesViewController (7.3.4): - JSQSystemSoundPlayer (~> 2.0.1) - JSQSystemSoundPlayer (2.0.1) - - libPhoneNumber-iOS (0.9.1) + - libPhoneNumber-iOS (0.9.2) - Mantle (2.1.0): - Mantle/extobjc (= 2.1.0) - Mantle/extobjc (2.1.0) @@ -121,7 +121,7 @@ DEPENDENCIES: - OpenSSL - PastelogKit (~> 1.3) - SCWaveformView (~> 1.0) - - SignalServiceKit (from `https://github.com/WhisperSystems/SignalServiceKit.git`, branch `mkirk/censorship-circumvention`) + - SignalServiceKit (from `https://github.com/WhisperSystems/SignalServiceKit.git`, branch `master`) - SocketRocket (from `https://github.com/facebook/SocketRocket.git`) - ZXingObjC @@ -129,7 +129,7 @@ EXTERNAL SOURCES: AxolotlKit: :git: https://github.com/WhisperSystems/SignalProtocolKit.git SignalServiceKit: - :branch: mkirk/censorship-circumvention + :branch: master :git: https://github.com/WhisperSystems/SignalServiceKit.git SocketRocket: :git: https://github.com/facebook/SocketRocket.git @@ -139,7 +139,7 @@ CHECKOUT OPTIONS: :commit: 714f5ebe199ecc999b33c6f97a4bb57e2db90e75 :git: https://github.com/WhisperSystems/SignalProtocolKit.git SignalServiceKit: - :commit: 78515377b14f1055c4a87548a7899650b753ce52 + :commit: a9340b06fd6549766ab537b2d7d603bf96f82504 :git: https://github.com/WhisperSystems/SignalServiceKit.git SocketRocket: :commit: 41b57bb2fc292a814f758441a05243eb38457027 @@ -154,7 +154,7 @@ SPEC CHECKSUMS: HKDFKit: c058305d6f64b84f28c50bd7aa89574625bcb62a JSQMessagesViewController: 39fed975e3c9f8eba7292071e29eeb541d105e66 JSQSystemSoundPlayer: c5850e77a4363ffd374cd851154b9af93264ed8d - libPhoneNumber-iOS: 81ad1e6bfcf46e668636333269afbfe60399a55b + libPhoneNumber-iOS: a8bffdec18c37728360f6771fe021302f1e0b497 Mantle: 2fa750afa478cd625a94230fbf1c13462f29395b OpenSSL: 246ffb948e9d56466727fd318134af35f5aa764e PastelogKit: 7b475be4cf577713506a943dd940bcc0499c8bca @@ -170,6 +170,6 @@ SPEC CHECKSUMS: YapDatabase: b1e43555a34a5298e23a045be96817a5ef0da58f ZXingObjC: bf15b3814f7a105b6d99f47da2333c93a063650a -PODFILE CHECKSUM: e09325f010ba0ef1fd0bfa07f665e7be73c43ee0 +PODFILE CHECKSUM: cb24c78080551874a45d1a20de4a1bef7427b41f COCOAPODS: 1.0.1 diff --git a/Signal/src/AppDelegate.m b/Signal/src/AppDelegate.m index bf9e9904a..f6d0869fa 100644 --- a/Signal/src/AppDelegate.m +++ b/Signal/src/AppDelegate.m @@ -239,7 +239,11 @@ static NSString *const kURLHostVerifyPrefix = @"verify"; [TSSocketManager becomeActiveFromForeground]; [[Environment getCurrent].contactsManager verifyABPermission]; }]; - + + if ([TSAccountManager isRegistered]) { + [[PushManager sharedManager] applicationDidBecomeActive]; + } + [self removeScreenProtection]; } diff --git a/Signal/src/Models/OWSMessagesBubblesSizeCalculator.h b/Signal/src/Models/OWSMessagesBubblesSizeCalculator.h index bbce01dd6..897fefcb5 100644 --- a/Signal/src/Models/OWSMessagesBubblesSizeCalculator.h +++ b/Signal/src/Models/OWSMessagesBubblesSizeCalculator.h @@ -3,6 +3,7 @@ #import NS_SWIFT_NAME(MessagesBubblesSizeCalculator) + @interface OWSMessagesBubblesSizeCalculator : JSQMessagesBubblesSizeCalculator - (CGSize)messageBubbleSizeForMessageData:(id)messageData diff --git a/Signal/src/network/PushManager.h b/Signal/src/network/PushManager.h index 38d8a97db..020fe0d09 100644 --- a/Signal/src/network/PushManager.h +++ b/Signal/src/network/PushManager.h @@ -85,6 +85,7 @@ typedef void (^pushTokensSuccessBlock)(NSString *pushToken, NSString *voipToken) forLocalNotification:(UILocalNotification *)notification withResponseInfo:(NSDictionary *)responseInfo completionHandler:(void (^)())completionHandler; +- (void)applicationDidBecomeActive; @end diff --git a/Signal/src/network/PushManager.m b/Signal/src/network/PushManager.m index de3b45e4e..41dfabe3a 100644 --- a/Signal/src/network/PushManager.m +++ b/Signal/src/network/PushManager.m @@ -162,6 +162,10 @@ } } +- (void)applicationDidBecomeActive { + [self.messageFetcherJob runAsync]; +} + - (UILocalNotification *)closeVOIPBackgroundTask { [[UIApplication sharedApplication] endBackgroundTask:_callBackgroundTask]; _callBackgroundTask = UIBackgroundTaskInvalid; From d28b73cfa33ecab49c2b88daf189620e934159ce Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Wed, 4 Jan 2017 17:46:26 -0500 Subject: [PATCH 2/3] Add asserts to Signal iOS .pch. --- Signal/Signal-Prefix.pch | 1 + 1 file changed, 1 insertion(+) diff --git a/Signal/Signal-Prefix.pch b/Signal/Signal-Prefix.pch index c8ddcdfe5..e3578a1d4 100644 --- a/Signal/Signal-Prefix.pch +++ b/Signal/Signal-Prefix.pch @@ -16,6 +16,7 @@ #endif #import "iOSVersions.h" + #import "Asserts.h" #define SignalAlertView(title,msg) [[[UIAlertView alloc] initWithTitle:title message:msg delegate:nil cancelButtonTitle:NSLocalizedString(@"OK", @"") otherButtonTitles:nil, nil] show] #define SignalReportError [Pastelog reportErrorAndSubmitLogsWithAlertTitle:NSLocalizedString(@"ERROR_WAS_DETECTED_TITLE", @"") alertBody:NSLocalizedString(@"ERROR_WAS_DETECTED_SUBMIT", @"")]; From 2ce4d39f9e99bcc6ee0063e3fa901dadc73aee66 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Fri, 6 Jan 2017 09:01:20 -0500 Subject: [PATCH 3/3] Respond to CR. // FREEBIE --- Podfile.lock | 4 ++-- Signal/Signal-Prefix.pch | 2 +- Signal/src/AppDelegate.m | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Podfile.lock b/Podfile.lock index d626ffc17..8a70a1a8d 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -32,7 +32,7 @@ PODS: - JSQMessagesViewController (7.3.4): - JSQSystemSoundPlayer (~> 2.0.1) - JSQSystemSoundPlayer (2.0.1) - - libPhoneNumber-iOS (0.9.2) + - libPhoneNumber-iOS (0.9.1) - Mantle (2.1.0): - Mantle/extobjc (= 2.1.0) - Mantle/extobjc (2.1.0) @@ -154,7 +154,7 @@ SPEC CHECKSUMS: HKDFKit: c058305d6f64b84f28c50bd7aa89574625bcb62a JSQMessagesViewController: 39fed975e3c9f8eba7292071e29eeb541d105e66 JSQSystemSoundPlayer: c5850e77a4363ffd374cd851154b9af93264ed8d - libPhoneNumber-iOS: a8bffdec18c37728360f6771fe021302f1e0b497 + libPhoneNumber-iOS: 81ad1e6bfcf46e668636333269afbfe60399a55b Mantle: 2fa750afa478cd625a94230fbf1c13462f29395b OpenSSL: 246ffb948e9d56466727fd318134af35f5aa764e PastelogKit: 7b475be4cf577713506a943dd940bcc0499c8bca diff --git a/Signal/Signal-Prefix.pch b/Signal/Signal-Prefix.pch index e3578a1d4..30e5aba65 100644 --- a/Signal/Signal-Prefix.pch +++ b/Signal/Signal-Prefix.pch @@ -16,7 +16,7 @@ #endif #import "iOSVersions.h" - #import "Asserts.h" + #import #define SignalAlertView(title,msg) [[[UIAlertView alloc] initWithTitle:title message:msg delegate:nil cancelButtonTitle:NSLocalizedString(@"OK", @"") otherButtonTitles:nil, nil] show] #define SignalReportError [Pastelog reportErrorAndSubmitLogsWithAlertTitle:NSLocalizedString(@"ERROR_WAS_DETECTED_TITLE", @"") alertBody:NSLocalizedString(@"ERROR_WAS_DETECTED_SUBMIT", @"")]; diff --git a/Signal/src/AppDelegate.m b/Signal/src/AppDelegate.m index f6d0869fa..13a1aecb6 100644 --- a/Signal/src/AppDelegate.m +++ b/Signal/src/AppDelegate.m @@ -238,12 +238,12 @@ static NSString *const kURLHostVerifyPrefix = @"verify"; // signing. [TSSocketManager becomeActiveFromForeground]; [[Environment getCurrent].contactsManager verifyABPermission]; + + // This will fetch new messages, if we're using domain + // fronting. + [[PushManager sharedManager] applicationDidBecomeActive]; }]; - if ([TSAccountManager isRegistered]) { - [[PushManager sharedManager] applicationDidBecomeActive]; - } - [self removeScreenProtection]; }