|
@@ -521,11 +521,7 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
|
|
|
alert.messageText = NSLocalizedString("Error Information", comment: "")
|
|
|
alert.informativeText = NSLocalizedString("Please make sure your internet connection is available.", comment: "")
|
|
|
alert.addButton(withTitle: NSLocalizedString("OK", comment: ""))
|
|
|
- if alert.responds(to: #selector(alert.beginSheetModal(for:completionHandler:))) {
|
|
|
- alert.beginSheetModal(for: self.window!, completionHandler: nil)
|
|
|
- } else {
|
|
|
- alert.runModal()
|
|
|
- }
|
|
|
+ alert.runModal()
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -940,11 +936,7 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
|
|
|
alert.messageText = NSLocalizedString("Error Information", comment: "")
|
|
|
alert.informativeText = NSLocalizedString("Please enter a coupon code.", comment: "")
|
|
|
alert.addButton(withTitle: NSLocalizedString("OK", comment: ""))
|
|
|
- if alert.responds(to: #selector(alert.beginSheetModal(for:completionHandler:))) {
|
|
|
- alert.beginSheetModal(for: self.window!, completionHandler: nil)
|
|
|
- } else {
|
|
|
- alert.runModal()
|
|
|
- }
|
|
|
+ alert.runModal()
|
|
|
return
|
|
|
}
|
|
|
self.refreshCouponError(isReveal: false)
|
|
@@ -1068,16 +1060,6 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
|
|
|
|
|
|
@IBAction func buyAction(_ sender: NSButton) {
|
|
|
if emailTextField.stringValue == "" {
|
|
|
-// let alert = NSAlert()
|
|
|
-// alert.alertStyle = .critical
|
|
|
-// alert.messageText = NSLocalizedString("Connection Error", comment: "")
|
|
|
-// alert.informativeText = NSLocalizedString("The email address is empty.", comment: "")
|
|
|
-// alert.addButton(withTitle: NSLocalizedString("OK", comment: ""))
|
|
|
-// if alert.responds(to: #selector(alert.beginSheetModal(for:completionHandler:))) {
|
|
|
-// alert.beginSheetModal(for: self.window!, completionHandler: nil)
|
|
|
-// } else {
|
|
|
-// alert.runModal()
|
|
|
-// }
|
|
|
emailErrorLabel(isReveal: true)
|
|
|
return
|
|
|
}
|
|
@@ -1088,11 +1070,8 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
|
|
|
alert.messageText = NSLocalizedString("Error Information", comment: "")
|
|
|
alert.informativeText = NSLocalizedString("Please enter the correct postcode.", comment: "")
|
|
|
alert.addButton(withTitle: NSLocalizedString("OK", comment: ""))
|
|
|
- if alert.responds(to: #selector(alert.beginSheetModal(for:completionHandler:))) {
|
|
|
- alert.beginSheetModal(for: self.window!, completionHandler: nil)
|
|
|
- } else {
|
|
|
- alert.runModal()
|
|
|
- }
|
|
|
+ alert.runModal()
|
|
|
+
|
|
|
return
|
|
|
}
|
|
|
}
|
|
@@ -1108,16 +1087,16 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
|
|
|
weChatBox.fillColor = NSColor(named: "KMPurchaseBoxColor1") ?? NSColor.blue
|
|
|
}
|
|
|
DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) { [weak self] in
|
|
|
- guard let self = self else { return }
|
|
|
- if self.paymentMethod == .paypal {
|
|
|
- self.paypalBox.fillColor = NSColor(named: "KMPurchaseBoxColor") ?? NSColor.blue
|
|
|
- } else if self._paymentMethod == .paddle {
|
|
|
- self.paddleView.wantsLayer = true
|
|
|
- self.paddleView.layer?.backgroundColor = NSColor(named: "KMPurchaseBoxColor")?.cgColor ?? NSColor.blue.cgColor
|
|
|
- } else if self._paymentMethod == .wxpay {
|
|
|
- self.weChatBox.fillColor = NSColor(named: "KMPurchaseBoxColor") ?? NSColor.blue
|
|
|
- } else if self._paymentMethod == .alipay {
|
|
|
- self.weChatBox.fillColor = NSColor(named: "KMPurchaseBoxColor") ?? NSColor.blue
|
|
|
+ guard let strongSelf = self else { return }
|
|
|
+ if strongSelf.paymentMethod == .paypal {
|
|
|
+ strongSelf.paypalBox.fillColor = NSColor(named: "KMPurchaseBoxColor") ?? NSColor.blue
|
|
|
+ } else if strongSelf.paymentMethod == .paddle {
|
|
|
+ strongSelf.paddleView.wantsLayer = true
|
|
|
+ strongSelf.paddleView.layer?.backgroundColor = NSColor(named: "KMPurchaseBoxColor")?.cgColor ?? NSColor.blue.cgColor
|
|
|
+ } else if strongSelf.paymentMethod == .wxpay {
|
|
|
+ strongSelf.weChatBox.fillColor = NSColor(named: "KMPurchaseBoxColor") ?? NSColor.blue
|
|
|
+ } else if strongSelf.paymentMethod == .alipay {
|
|
|
+ strongSelf.weChatBox.fillColor = NSColor(named: "KMPurchaseBoxColor") ?? NSColor.blue
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1131,11 +1110,8 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
|
|
|
alert.messageText = NSLocalizedString("Error Information", comment: "")
|
|
|
alert.informativeText = NSLocalizedString("Input license code previously activated the app", comment: "")
|
|
|
alert.addButton(withTitle: NSLocalizedString("OK", comment: ""))
|
|
|
- if alert.responds(to: #selector(alert.beginSheetModal(for:completionHandler:))) {
|
|
|
- alert.beginSheetModal(for: self.window!, completionHandler: nil)
|
|
|
- } else {
|
|
|
- alert.runModal()
|
|
|
- }
|
|
|
+ alert.runModal()
|
|
|
+
|
|
|
return
|
|
|
}
|
|
|
if let license = VerificationManager.default().originLicenseCode, license.count > 0 {
|
|
@@ -1149,12 +1125,13 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
|
|
|
self._buyProduct(productID, count: pdfCount, discountId: couponCode, payment: paymentMethod, license: licenseCode, email: emailTextField.stringValue) { [weak self] info, err in
|
|
|
guard let self = self else { return }
|
|
|
if err != nil {
|
|
|
- let alert = NSAlert()
|
|
|
- alert.alertStyle = .critical
|
|
|
- alert.messageText = NSLocalizedString("Please check if the information is wrong or the network is error.", comment: "")
|
|
|
- alert.addButton(withTitle: NSLocalizedString("Yes", comment: ""))
|
|
|
- alert.runModal()
|
|
|
-
|
|
|
+ DispatchQueue.main.async {
|
|
|
+ let alert = NSAlert()
|
|
|
+ alert.alertStyle = .critical
|
|
|
+ alert.messageText = NSLocalizedString("Please check if the information is wrong or the network is error.", comment: "")
|
|
|
+ alert.addButton(withTitle: NSLocalizedString("Yes", comment: ""))
|
|
|
+ alert.runModal()
|
|
|
+ }
|
|
|
return
|
|
|
}
|
|
|
if let dataInfo = info {
|
|
@@ -1171,11 +1148,13 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
|
|
|
}
|
|
|
} else {
|
|
|
// 数据错误
|
|
|
- let alert = NSAlert()
|
|
|
- alert.alertStyle = .critical
|
|
|
- alert.messageText = NSLocalizedString("Please check if the information is wrong or the network is error.", comment: "")
|
|
|
- alert.addButton(withTitle: NSLocalizedString("Yes", comment: ""))
|
|
|
- alert.runModal()
|
|
|
+ DispatchQueue.main.async {
|
|
|
+ let alert = NSAlert()
|
|
|
+ alert.alertStyle = .critical
|
|
|
+ alert.messageText = NSLocalizedString("Please check if the information is wrong or the network is error.", comment: "")
|
|
|
+ alert.addButton(withTitle: NSLocalizedString("Yes", comment: ""))
|
|
|
+ alert.runModal()
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1752,13 +1731,11 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
|
|
|
let infoDic = ["cdkey": license]
|
|
|
VerificationManager.default().activateDevice(withInfo: infoDic) { status, info, error in
|
|
|
if error != nil {
|
|
|
- let alert = NSAlert()
|
|
|
- alert.alertStyle = .critical
|
|
|
- alert.messageText = NSLocalizedString("Activation Error", comment: "")
|
|
|
- alert.addButton(withTitle: NSLocalizedString("OK", comment: ""))
|
|
|
- if alert.responds(to: #selector(alert.beginSheetModal(for:completionHandler:))) {
|
|
|
- alert.beginSheetModal(for: self.window!, completionHandler: nil)
|
|
|
- } else {
|
|
|
+ DispatchQueue.main.async {
|
|
|
+ let alert = NSAlert()
|
|
|
+ alert.alertStyle = .critical
|
|
|
+ alert.messageText = NSLocalizedString("Activation Error", comment: "")
|
|
|
+ alert.addButton(withTitle: NSLocalizedString("OK", comment: ""))
|
|
|
alert.runModal()
|
|
|
}
|
|
|
return
|