From 940161e62fd76f6968abbb774866e6bbc2f204ed Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Thu, 26 Apr 2018 14:43:21 -0400 Subject: [PATCH 1/3] Don't process multiple local notifications. --- Signal/src/AppDelegate.m | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Signal/src/AppDelegate.m b/Signal/src/AppDelegate.m index 31433bb35..c9c45a53b 100644 --- a/Signal/src/AppDelegate.m +++ b/Signal/src/AppDelegate.m @@ -69,6 +69,7 @@ static NSTimeInterval launchStartedAt; @property (nonatomic) BOOL hasInitialRootViewController; @property (nonatomic) BOOL areVersionMigrationsComplete; @property (nonatomic) BOOL didAppLaunchFail; +@property (nonatomic) BOOL hasReceivedLocalNotification; @end @@ -525,6 +526,9 @@ static NSTimeInterval launchStartedAt; [self handleActivation]; }]; + // We want to process up to one local notification per activation, so clear the flag. + self.hasReceivedLocalNotification = NO; + DDLogInfo(@"%@ applicationDidBecomeActive completed.", self.logTag); } @@ -876,6 +880,13 @@ static NSTimeInterval launchStartedAt; return; } + // Don't process more than one local notification per activation. + if (self.hasReceivedLocalNotification) { + OWSFail(@"%@ %s ignoring redundant local notification.", self.logTag, __PRETTY_FUNCTION__); + return; + } + self.hasReceivedLocalNotification = YES; + DDLogInfo(@"%@ %s %@", self.logTag, __PRETTY_FUNCTION__, notification); [AppStoreRating preventPromptAtNextTest]; @@ -923,6 +934,13 @@ static NSTimeInterval launchStartedAt; return; } + // Don't process more than one local notification per activation. + if (self.hasReceivedLocalNotification) { + OWSFail(@"%@ %s ignoring redundant local notification.", self.logTag, __PRETTY_FUNCTION__); + return; + } + self.hasReceivedLocalNotification = YES; + // The docs for handleActionWithIdentifier:... state: // "You must call [completionHandler] at the end of your method.". // Nonetheless, it is presumably safe to call the completion handler From f95151ac8deb483f18f4ca42fbf30dee00b83957 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Thu, 26 Apr 2018 14:47:32 -0400 Subject: [PATCH 2/3] Don't present multiple converastion views ever. --- Signal/src/ViewControllers/HomeView/HomeViewController.m | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Signal/src/ViewControllers/HomeView/HomeViewController.m b/Signal/src/ViewControllers/HomeView/HomeViewController.m index 8974bd59a..17332bce7 100644 --- a/Signal/src/ViewControllers/HomeView/HomeViewController.m +++ b/Signal/src/ViewControllers/HomeView/HomeViewController.m @@ -928,6 +928,9 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations [mvc configureForThread:thread action:action]; self.lastThread = thread; + // Never push more than one conversation view controller at a time. + [self.navigationController popToViewController:self animated:NO]; + [self pushTopLevelViewController:mvc animateDismissal:YES animatePresentation:YES]; }); } From a3c853066afe862def54cea0b1c4bfeb166c0c42 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Thu, 10 May 2018 16:36:37 -0400 Subject: [PATCH 3/3] Respond to CR. --- Signal/src/ViewControllers/HomeView/HomeViewController.m | 3 --- 1 file changed, 3 deletions(-) diff --git a/Signal/src/ViewControllers/HomeView/HomeViewController.m b/Signal/src/ViewControllers/HomeView/HomeViewController.m index 17332bce7..8974bd59a 100644 --- a/Signal/src/ViewControllers/HomeView/HomeViewController.m +++ b/Signal/src/ViewControllers/HomeView/HomeViewController.m @@ -928,9 +928,6 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations [mvc configureForThread:thread action:action]; self.lastThread = thread; - // Never push more than one conversation view controller at a time. - [self.navigationController popToViewController:self animated:NO]; - [self pushTopLevelViewController:mvc animateDismissal:YES animatePresentation:YES]; }); }