Respond to CR.

pull/1/head
Matthew Chen 7 years ago
parent 9a4889c4fb
commit 9936003637

@ -531,24 +531,11 @@ static NSTimeInterval launchStartedAt;
// When opening the app from a notification, // When opening the app from a notification,
// AppDelegate.didReceiveLocalNotification will always // AppDelegate.didReceiveLocalNotification will always
// be called _before_ we become active. // be called _before_ we become active.
[self cancelAllNotifications]; [SignalApp clearAllNotifications];
DDLogInfo(@"%@ applicationDidBecomeActive completed.", self.logTag); DDLogInfo(@"%@ applicationDidBecomeActive completed.", self.logTag);
} }
- (void)cancelAllNotifications
{
DDLogInfo(@"%@ cancelAllNotifications.", self.logTag);
// This will cancel all "scheduled" local notifications that haven't
// been presented yet.
[UIApplication.sharedApplication cancelAllLocalNotifications];
// To clear all already presented local notifications, we need to
// set the app badge number to zero after setting it to a non-zero value.
[UIApplication sharedApplication].applicationIconBadgeNumber = 1;
[UIApplication sharedApplication].applicationIconBadgeNumber = 0;
}
- (void)enableBackgroundRefreshIfNecessary - (void)enableBackgroundRefreshIfNecessary
{ {
[AppReadiness runNowOrWhenAppIsReady:^{ [AppReadiness runNowOrWhenAppIsReady:^{
@ -602,7 +589,7 @@ static NSTimeInterval launchStartedAt;
DDLogInfo(@"%@ running post launch block for unregistered user.", self.logTag); DDLogInfo(@"%@ running post launch block for unregistered user.", self.logTag);
// Unregistered user should have no unread messages. e.g. if you delete your account. // Unregistered user should have no unread messages. e.g. if you delete your account.
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:0]; [SignalApp clearAllNotifications];
[TSSocketManager requestSocketOpen]; [TSSocketManager requestSocketOpen];
@ -664,7 +651,7 @@ static NSTimeInterval launchStartedAt;
DDLogWarn(@"%@ applicationWillResignActive.", self.logTag); DDLogWarn(@"%@ applicationWillResignActive.", self.logTag);
// Clear all notifications whenever we become inactive. // Clear all notifications whenever we become inactive.
[self cancelAllNotifications]; [SignalApp clearAllNotifications];
[DDLog flushLog]; [DDLog flushLog];
} }

@ -44,4 +44,6 @@
+ (void)resetAppData; + (void)resetAppData;
+ (void)clearAllNotifications;
@end @end

@ -227,14 +227,24 @@
[OWSStorage resetAllStorage]; [OWSStorage resetAllStorage];
[[OWSProfileManager sharedManager] resetProfileStorage]; [[OWSProfileManager sharedManager] resetProfileStorage];
[Environment.preferences clear]; [Environment.preferences clear];
// Setting the app badge number from non-zero to zero has the
// side effect of clearing all scheduled and presented local [self clearAllNotifications];
// notifications.
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:1];
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];
[DebugLogger.sharedLogger wipeLogs]; [DebugLogger.sharedLogger wipeLogs];
exit(0); exit(0);
} }
+ (void)clearAllNotifications
{
DDLogInfo(@"%@ clearAllNotifications.", self.logTag);
// This will cancel all "scheduled" local notifications that haven't
// been presented yet.
[UIApplication.sharedApplication cancelAllLocalNotifications];
// To clear all already presented local notifications, we need to
// set the app badge number to zero after setting it to a non-zero value.
[UIApplication sharedApplication].applicationIconBadgeNumber = 1;
[UIApplication sharedApplication].applicationIconBadgeNumber = 0;
}
@end @end

Loading…
Cancel
Save