[AltServer] Uses NSAlerts for installation errors

This commit is contained in:
Riley Testut
2019-09-04 12:08:27 -07:00
parent a37d02d5d1
commit 66c9f547c1

View File

@@ -127,21 +127,25 @@ private extension AppDelegate
let device = self.connectedDevices[index] let device = self.connectedDevices[index]
ALTDeviceManager.shared.installAltStore(to: device, appleID: username, password: password) { (result) in ALTDeviceManager.shared.installAltStore(to: device, appleID: username, password: password) { (result) in
let content = UNMutableNotificationContent()
switch result switch result
{ {
case .success: case .success:
let content = UNMutableNotificationContent()
content.title = NSLocalizedString("Installation Succeeded", comment: "") content.title = NSLocalizedString("Installation Succeeded", comment: "")
content.body = String(format: NSLocalizedString("AltStore was successfully installed on %@.", comment: ""), device.name) content.body = String(format: NSLocalizedString("AltStore was successfully installed on %@.", comment: ""), device.name)
let request = UNNotificationRequest(identifier: UUID().uuidString, content: content, trigger: nil)
UNUserNotificationCenter.current().add(request)
case .failure(let error): case .failure(let error):
content.title = NSLocalizedString("Installation Failed", comment: "") let alert = NSAlert()
content.body = error.localizedDescription alert.messageText = NSLocalizedString("Installation Failed", comment: "")
} alert.informativeText = error.localizedDescription
let request = UNNotificationRequest(identifier: UUID().uuidString, content: content, trigger: nil) NSRunningApplication.current.activate(options: .activateIgnoringOtherApps)
UNUserNotificationCenter.current().add(request)
alert.runModal()
}
} }
} }