Просмотр исходного кода

【轻会员】注销后 登录警告框弹出

lizhe 2 лет назад
Родитель
Сommit
a718082f03

+ 28 - 5
PDF Office/PDF Office/Class/KMLightMember/Controller/Login&Register/KMLoginWindowController.swift

@@ -70,13 +70,13 @@ class KMLoginWindowController: NSWindowController {
     
     func setup() {
 
-        KMRequestServer.requestServer.reachabilityStatusChange { [unowned self] status in
+        KMRequestServer.requestServer.reachabilityStatusChange { [weak self] status in
             if status == .notReachable {
                 print("无网络")
-                self.noNetworkView.isHidden = false
+                self?.noNetworkView.isHidden = false
             } else {
                 print("有网络")
-                self.noNetworkView.isHidden = true
+                self?.noNetworkView.isHidden = true
             }
         }
         
@@ -100,7 +100,30 @@ class KMLoginWindowController: NSWindowController {
                     self.model.email = data.email
                     self.logType = .loginInputPassword
                 } else {
-                    self.loginView.showAlert(result: result)
+                    if result?.code == 318 {
+                        let alert = NSAlert()
+                        alert.messageText = NSLocalizedString("Unable to log", comment: "")
+                        alert.informativeText = NSLocalizedString("Your account is currently being logged out and cannot be logged in.If you  have questions, you can contact customer service", comment: "")
+                        alert.addButton(withTitle: NSLocalizedString("Contact Customer", comment: ""))
+                        alert.addButton(withTitle: NSLocalizedString("Cancel", comment: ""))
+                        alert.beginSheetModal(for: view.window!) { result in
+                            if (result == .alertFirstButtonReturn) {
+            //                    KMMailHelper.newEmail(withContacts: "support@pdfreaderpro.com", andSubjects: "")
+            //                    NSWorkspace.shared.launchApplication("Mailto:support@pdfreaderpro.com")
+                                NSWorkspace.shared.open(URL(string: "mailto:support@pdfreaderpro.com")!)
+                                
+            //                    let service = NSSharingService(named: NSSharingService.Name.composeEmail)
+            //                    service?.recipients = ["support@pdfreaderpro.com"]
+            //                    service?.subject = "Test Mail"
+            //                    service?.perform(withItems: ["Test Mail body"])
+                            } else if result == .alertSecondButtonReturn {
+                                return
+                            }
+                        }
+                        return
+                    } else {
+                        self.loginView.showAlert(result: result)
+                    }
                 }
             }
         }
@@ -202,7 +225,7 @@ class KMLoginWindowController: NSWindowController {
                     alert.informativeText = NSLocalizedString("Your account is currently being logged out and cannot be logged in.If you  have questions, you can contact customer service", comment: "")
                     alert.addButton(withTitle: NSLocalizedString("Contact Customer", comment: ""))
                     alert.addButton(withTitle: NSLocalizedString("Cancel", comment: ""))
-                    alert.beginSheetModal(for: NSApp.mainWindow!) { result in
+                    alert.beginSheetModal(for: view.window!) { result in
                         if (result == .alertFirstButtonReturn) {
         //                    KMMailHelper.newEmail(withContacts: "support@pdfreaderpro.com", andSubjects: "")
         //                    NSWorkspace.shared.launchApplication("Mailto:support@pdfreaderpro.com")

+ 1 - 0
PDF Office/PDF Office/Class/KMLightMember/Manager/KMRequestServerManager.swift

@@ -426,6 +426,7 @@ class KMRequestServerManager: NSObject {
                 if result.code == 200 {
                     complete(true, result)
                 } else {
+                    
                     complete(false, result)
                 }
             } else {