diff --git a/AltStore/AppDelegate.swift b/AltStore/AppDelegate.swift index ba3d8944..61f22f03 100644 --- a/AltStore/AppDelegate.swift +++ b/AltStore/AppDelegate.swift @@ -161,6 +161,21 @@ extension AppDelegate if UserDefaults.standard.isBackgroundRefreshEnabled { ServerManager.shared.startDiscovering() + + if !UserDefaults.standard.presentedLaunchReminderNotification + { + let threeHours: TimeInterval = 3 * 60 * 60 + let trigger = UNTimeIntervalNotificationTrigger(timeInterval: threeHours, repeats: false) + + let content = UNMutableNotificationContent() + content.title = NSLocalizedString("App Refresh Tip", comment: "") + content.body = NSLocalizedString("The more you open AltStore, the more chances it's given to refresh apps in the background.", comment: "") + + let request = UNNotificationRequest(identifier: "background-refresh-reminder5", content: content, trigger: trigger) + UNUserNotificationCenter.current().add(request) + + UserDefaults.standard.presentedLaunchReminderNotification = true + } } let refreshIdentifier = UUID().uuidString diff --git a/AltStore/Extensions/UserDefaults+AltStore.swift b/AltStore/Extensions/UserDefaults+AltStore.swift index 3f940679..ba49046a 100644 --- a/AltStore/Extensions/UserDefaults+AltStore.swift +++ b/AltStore/Extensions/UserDefaults+AltStore.swift @@ -18,6 +18,7 @@ extension UserDefaults @NSManaged var isBackgroundRefreshEnabled: Bool @NSManaged var isDebugModeEnabled: Bool + @NSManaged var presentedLaunchReminderNotification: Bool func registerDefaults() {