Add boot detection in the NSE and use this to inform the user that there may be more notifications. (#5054)

* Add an initial implementation of the receivedWhileOfflineNotification.

* Only deliver a single receivedWhileOffline notification per boot and clarify the API.

* Add a 15-minute threshold for the receiveWhileOfflineNotification.
This commit is contained in:
Doug
2026-02-06 15:18:09 +00:00
committed by GitHub
parent 77496934ce
commit 9b6324b295
11 changed files with 157 additions and 21 deletions

View File

@@ -14,7 +14,9 @@ import Foundation
import SwiftUI
/// Common settings between app and NSE
protocol CommonSettingsProtocol {
protocol CommonSettingsProtocol: AnyObject {
var lastNotificationBootTime: TimeInterval? { get set }
var logLevel: LogLevel { get }
var traceLogPacks: Set<TraceLogPack> { get }
var bugReportRageshakeURL: RemotePreference<RageshakeConfiguration> { get }
@@ -51,6 +53,7 @@ final class AppSettings {
case enableNotifications
case enableInAppNotifications
case pusherProfileTag
case lastNotificationBootTime
case logLevel
case traceLogPacks
case viewSourceEnabled
@@ -291,6 +294,10 @@ final class AppSettings {
@UserPreference(key: UserDefaultsKeys.pusherProfileTag, storageType: .userDefaults(store))
var pusherProfileTag: String?
/// The device's last boot time as recorded by the NSE.
@UserPreference(key: UserDefaultsKeys.lastNotificationBootTime, storageType: .userDefaults(store))
var lastNotificationBootTime: TimeInterval?
// MARK: - Logging
@UserPreference(key: UserDefaultsKeys.logLevel, defaultValue: LogLevel.info, storageType: .userDefaults(store))