|
@@ -227,7 +227,7 @@ class KMComparativeTableViewController: NSWindowController {
|
|
|
comparativeMainWindow = nil
|
|
|
controller.close()
|
|
|
} else {
|
|
|
- controller.purchasefailed()
|
|
|
+ KMComparativeTableViewController.purchasefailed()
|
|
|
}
|
|
|
controller.comparativeView.endLoading()
|
|
|
}
|
|
@@ -246,7 +246,7 @@ class KMComparativeTableViewController: NSWindowController {
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
- controller.purchasefailed()
|
|
|
+ KMComparativeTableViewController.purchasefailed()
|
|
|
}
|
|
|
//loading
|
|
|
controller.comparativeView.endLoading()
|
|
@@ -267,8 +267,7 @@ class KMComparativeTableViewController: NSWindowController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- func purchasefailed() {
|
|
|
-
|
|
|
+ static func purchasefailed() {
|
|
|
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.1, execute: {
|
|
|
let alert = NSAlert()
|
|
|
alert.messageText = NSLocalizedString("restore failed", comment: "")
|
|
@@ -290,4 +289,27 @@ class KMComparativeTableViewController: NSWindowController {
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
+
|
|
|
+ static func purchaseSuccess() {
|
|
|
+ DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.1, execute: {
|
|
|
+ let alert = NSAlert()
|
|
|
+ alert.messageText = NSLocalizedString("restore success", comment: "")
|
|
|
+ alert.informativeText = NSLocalizedString("", comment: "")
|
|
|
+// alert.addButton(withTitle: NSLocalizedString("OK", comment: ""))
|
|
|
+ alert.addButton(withTitle: NSLocalizedString("OK", comment: ""))
|
|
|
+ var window = NSApp.mainWindow
|
|
|
+ if NSApp.mainWindow?.sheets.first != nil {
|
|
|
+ window = NSApp.mainWindow?.sheets.first
|
|
|
+ }
|
|
|
+ if window != nil {
|
|
|
+ alert.beginSheetModal(for: window!) { result in
|
|
|
+ if (result == .alertFirstButtonReturn) {
|
|
|
+
|
|
|
+ } else if result == .alertSecondButtonReturn {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|