|
@@ -236,16 +236,19 @@ class KMSignUpViewModel: ObservableObject {
|
|
|
code = password
|
|
|
}
|
|
|
if !privacyState {
|
|
|
- let alert = NSAlert()
|
|
|
- alert.messageText = NSLocalizedString("Please agree and check the above agreement first.", tableName: "MemberCenterLocalizable", comment: "")
|
|
|
- alert.addButton(withTitle: NSLocalizedString("OK", comment: ""))
|
|
|
-// alert.beginSheetModal(for: NSApp.mainWindow!)
|
|
|
- let result = alert.runModal()
|
|
|
- if (result == .alertFirstButtonReturn) {
|
|
|
- privacyState = true
|
|
|
+ DispatchQueue.main.async {
|
|
|
+
|
|
|
+ let alert = NSAlert()
|
|
|
+ alert.messageText = NSLocalizedString("Please agree and check the above agreement first.", tableName: "MemberCenterLocalizable", comment: "")
|
|
|
+ alert.addButton(withTitle: NSLocalizedString("OK", comment: ""))
|
|
|
+ // alert.beginSheetModal(for: NSApp.mainWindow!)
|
|
|
+ let result = alert.runModal()
|
|
|
+ if (result == .alertFirstButtonReturn) {
|
|
|
+ privacyState = true
|
|
|
+ }
|
|
|
+
|
|
|
+ callback?(nil)
|
|
|
}
|
|
|
-
|
|
|
- callback?(nil)
|
|
|
return
|
|
|
}
|
|
|
KMMemberCenterManager.manager.emailLogin(email: email, code: code, type: signUpState) { [weak self] success, wrapper in
|
|
@@ -279,14 +282,16 @@ class KMSignUpViewModel: ObservableObject {
|
|
|
} else {
|
|
|
if(resultDict.code == 305) {
|
|
|
if KMMemberCenterManager.manager.isConnectionAvailable() == false {
|
|
|
- let alert = NSAlert()
|
|
|
- alert.alertStyle = .critical
|
|
|
- alert.messageText = NSLocalizedString("Error Information", comment: "")
|
|
|
- alert.informativeText = NSLocalizedString("Please make sure your internet connection is available.", comment: "")
|
|
|
- alert.addButton(withTitle: NSLocalizedString("OK", comment: ""))
|
|
|
- alert.runModal()
|
|
|
-
|
|
|
- callback?(false)
|
|
|
+ DispatchQueue.main.async {
|
|
|
+ let alert = NSAlert()
|
|
|
+ alert.alertStyle = .critical
|
|
|
+ alert.messageText = NSLocalizedString("Error Information", comment: "")
|
|
|
+ alert.informativeText = NSLocalizedString("Please make sure your internet connection is available.", comment: "")
|
|
|
+ alert.addButton(withTitle: NSLocalizedString("OK", comment: ""))
|
|
|
+ alert.runModal()
|
|
|
+
|
|
|
+ callback?(false)
|
|
|
+ }
|
|
|
return
|
|
|
}
|
|
|
KMMemberCenterManager.manager.getUserDeviceList(email: self.email) { [weak self] success, result in
|
|
@@ -303,16 +308,18 @@ class KMSignUpViewModel: ObservableObject {
|
|
|
callback?(false)
|
|
|
|
|
|
print("错误信息:%@", msg as Any)
|
|
|
- let alert = NSAlert()
|
|
|
- alert.messageText = NSLocalizedString(msg!, comment: "")
|
|
|
- alert.addButton(withTitle: NSLocalizedString("OK", comment: ""))
|
|
|
- let response = alert.runModal()
|
|
|
- if response == .alertFirstButtonReturn {
|
|
|
- if(resultDict.code == 317) {
|
|
|
- self.signUpState = .verificationCode
|
|
|
- self.countDown(type: .login, callback: nil)
|
|
|
- } else {
|
|
|
-
|
|
|
+ DispatchQueue.main.async {
|
|
|
+ let alert = NSAlert()
|
|
|
+ alert.messageText = NSLocalizedString(msg!, comment: "")
|
|
|
+ alert.addButton(withTitle: NSLocalizedString("OK", comment: ""))
|
|
|
+ let response = alert.runModal()
|
|
|
+ if response == .alertFirstButtonReturn {
|
|
|
+ if(resultDict.code == 317) {
|
|
|
+ self.signUpState = .verificationCode
|
|
|
+ self.countDown(type: .login, callback: nil)
|
|
|
+ } else {
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|