Platform specific notification clearing
This commit is contained in:
parent
cd13be64fe
commit
cb3a36ba3d
|
@ -732,7 +732,7 @@ static NSTimeInterval launchStartedAt;
|
|||
OWSLogInfo(@"running post launch block for unregistered user.");
|
||||
|
||||
// Unregistered user should have no unread messages. e.g. if you delete your account.
|
||||
[SignalApp clearAllNotifications];
|
||||
[AppEnvironment.shared.notificationPresenter clearAllNotifications];
|
||||
|
||||
[self.socketManager requestSocketOpen];
|
||||
|
||||
|
@ -791,6 +791,7 @@ static NSTimeInterval launchStartedAt;
|
|||
OWSLogWarn(@"applicationWillResignActive.");
|
||||
|
||||
[self updateShouldEnableLandscape];
|
||||
[self clearAllNotificationsAndRestoreBadgeCount];
|
||||
|
||||
[DDLog flushLog];
|
||||
}
|
||||
|
@ -799,8 +800,8 @@ static NSTimeInterval launchStartedAt;
|
|||
{
|
||||
OWSAssertIsOnMainThread();
|
||||
|
||||
[SignalApp clearAllNotifications];
|
||||
[AppReadiness runNowOrWhenAppDidBecomeReady:^{
|
||||
[AppEnvironment.shared.notificationPresenter clearAllNotifications];
|
||||
[OWSMessageUtils.sharedManager updateApplicationBadgeCount];
|
||||
}];
|
||||
}
|
||||
|
|
|
@ -222,6 +222,13 @@ extension LegacyNotificationPresenterAdaptee: NotificationPresenterAdaptee {
|
|||
for (_, notification) in notifications {
|
||||
cancelNotification(notification)
|
||||
}
|
||||
// This will cancel all "scheduled" local notifications that haven't
|
||||
// been presented yet.
|
||||
UIApplication.shared.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.shared.applicationIconBadgeNumber = 1
|
||||
UIApplication.shared.applicationIconBadgeNumber = 0
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,6 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
|
||||
+ (void)resetAppData;
|
||||
|
||||
+ (void)clearAllNotifications;
|
||||
|
||||
- (void)showHomeView;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||
// Copyright (c) 2019 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import "SignalApp.h"
|
||||
|
@ -138,26 +138,12 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
[OWSStorage resetAllStorage];
|
||||
[OWSUserProfile resetProfileStorage];
|
||||
[Environment.shared.preferences clear];
|
||||
|
||||
[self clearAllNotifications];
|
||||
[AppEnvironment.shared.notificationPresenter clearAllNotifications];
|
||||
|
||||
[DebugLogger.sharedLogger wipeLogs];
|
||||
exit(0);
|
||||
}
|
||||
|
||||
+ (void)clearAllNotifications
|
||||
{
|
||||
OWSLogInfo(@"clearAllNotifications.");
|
||||
|
||||
// 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)showHomeView
|
||||
{
|
||||
HomeViewController *homeView = [HomeViewController new];
|
||||
|
|
Loading…
Reference in New Issue