From 11b7879d787f355cdd22816c19240150d11afd8f Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Fri, 21 Jun 2019 16:00:43 -0400 Subject: [PATCH] Add onlyModernNotificationClearance feature flag. --- .../Notifications/UserNotificationsAdaptee.swift | 6 +++++- SignalServiceKit/src/Util/FeatureFlags.swift | 8 +++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Signal/src/UserInterface/Notifications/UserNotificationsAdaptee.swift b/Signal/src/UserInterface/Notifications/UserNotificationsAdaptee.swift index 50aab570fb..9bccb2ace0 100644 --- a/Signal/src/UserInterface/Notifications/UserNotificationsAdaptee.swift +++ b/Signal/src/UserInterface/Notifications/UserNotificationsAdaptee.swift @@ -180,9 +180,13 @@ extension UserNotificationPresenterAdaptee: NotificationPresenterAdaptee { func clearAllNotifications() { AssertIsOnMainThread() + notificationCenter.removeAllPendingNotificationRequests() notificationCenter.removeAllDeliveredNotifications() - LegacyNotificationPresenterAdaptee.clearExistingNotifications() + + if !FeatureFlags.onlyModernNotificationClearance { + LegacyNotificationPresenterAdaptee.clearExistingNotifications() + } } func shouldPresentNotification(category: AppNotificationCategory, userInfo: [AnyHashable: Any]) -> Bool { diff --git a/SignalServiceKit/src/Util/FeatureFlags.swift b/SignalServiceKit/src/Util/FeatureFlags.swift index 724d5e19bb..d985560dd6 100644 --- a/SignalServiceKit/src/Util/FeatureFlags.swift +++ b/SignalServiceKit/src/Util/FeatureFlags.swift @@ -72,7 +72,13 @@ public class FeatureFlags: NSObject { @objc public static let strictSyncTranscriptTimestamps = false + private static let isPrivateBeta = false + // Don't enable this flag in production. @objc - public static let strictYDBExtensions = false + public static let strictYDBExtensions = isPrivateBeta + + // Don't enable this flag in production. + @objc + public static let onlyModernNotificationClearance = isPrivateBeta }