[AltServer] Presents info notification on first launch

This commit is contained in:
Riley Testut
2019-09-25 01:23:23 -07:00
parent 046b36f4c4
commit 7b3f78082e
2 changed files with 21 additions and 0 deletions

View File

@@ -46,6 +46,18 @@ class AppDelegate: NSObject, NSApplicationDelegate {
self.statusItem = item
self.connectedDevicesMenu.delegate = self
if !UserDefaults.standard.didPresentInitialNotification
{
let content = UNMutableNotificationContent()
content.title = NSLocalizedString("AltServer Running", comment: "")
content.body = NSLocalizedString("AltServer runs in the background as a menu bar app listening for AltStore.", comment: "")
let request = UNNotificationRequest(identifier: UUID().uuidString, content: content, trigger: nil)
UNUserNotificationCenter.current().add(request)
UserDefaults.standard.didPresentInitialNotification = true
}
}
func applicationWillTerminate(_ aNotification: Notification)

View File

@@ -19,6 +19,15 @@ extension UserDefaults
}
}
var didPresentInitialNotification: Bool {
get {
return self.bool(forKey: "didPresentInitialNotification")
}
set {
self.set(newValue, forKey: "didPresentInitialNotification")
}
}
func registerDefaults()
{
if self.serverID == nil