Don't process multiple local notifications.

pull/1/head
Matthew Chen 7 years ago
parent b751a32536
commit 940161e62f

@ -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

Loading…
Cancel
Save