Explorar el Código

Merge branch 'develop_PDFReaderProNew' of git.kdan.cc:Mac_PDF/PDF_Office into develop_PDFReaderProNew

tangchao hace 6 días
padre
commit
6f6692e17a

+ 1 - 9
PDF Office/PDF Master/Class/AIInfo/AIConfigWindowController/Views/AIHeaderView/AIHeaderView.swift

@@ -55,15 +55,7 @@ class AIHeaderView: NSView, NibLoadable {
         AIInfoManager.default().fetchAIInfo { dict, error in
             
         }
-        if(KMMemberInfo.shared.isLogin == true) {
-            KMUserInfoViewController.refreshTokenUserInfo {[weak self] success, resDic in
-                if(success == true) {
-                    self?.enterAIInfo(sender)
-                }
-            }
-        } else  {
-            enterAIInfo(sender)
-        }
+        enterAIInfo(sender)
     }
     
     func enterAIInfo(_ sender: NSButton) {

+ 29 - 3
PDF Office/PDF Master/Class/AIInfo/AIUserInfoController/AIUserInfoController.swift

@@ -55,7 +55,7 @@ import Cocoa
         } else {
             self.view.layer?.backgroundColor = NSColor.white.cgColor
         }
-
+        
         self.titleLabel.font = NSFont.SFProTextSemiboldFont(18)
         self.whatNewlabel.font = NSFont.SFProTextSemiboldFont(12)
         self.titleLabel.textColor = KMAppearance.KMColor_Layout_H0()
@@ -77,7 +77,7 @@ import Cocoa
             
         } else {
             self.emptyContendBox.isHidden = false
- 
+            
             var viewRect = self.view.frame
             viewRect.size.height = 386
             self.view.frame = viewRect
@@ -95,7 +95,7 @@ import Cocoa
         self.emptyTipButton.mouseMoveCallback = {[unowned self] mouseEntered in
             if mouseEntered {
                 let tipString = NSLocalizedString("Each use of the AI tools costs 1 or more credits.", comment: "")
-          
+                
                 let popViewController = KMToolbarItemPopViewController.init()
                 if self.popOver == nil {
                     self.popOver = NSPopover.init()
@@ -111,8 +111,34 @@ import Cocoa
             }
         }
         
+        if(KMMemberInfo.shared.isLogin == true) {
+            addWaitingView(to: self.view)
+            KMUserInfoViewController.refreshTokenUserInfo {[weak self] success, resDic in
+                DispatchQueue.main.async {
+                    self?.removeWaitingView(from: self?.view ?? NSView())
+                    if(success == true) {
+                    }
+                }
+            }
+        }
     }
     
+    func addWaitingView(to view: NSView) {
+        removeWaitingView(from: view)
+        let waitingView = WaitingView(frame: view.bounds)
+        waitingView.autoresizingMask = [.width, .height]
+        view.addSubview(waitingView)
+        waitingView.startAnimation()
+    }
+
+    func removeWaitingView(from view: NSView) {
+        for subview in view.subviews {
+            if subview is WaitingView {
+                subview.removeFromSuperview()
+                break
+            }
+        }
+    }
     
     
     func updateEmptyCreditViewUI() -> Void {

+ 1 - 1
PDF Office/PDF Master/Class/PDFWindowController/Toolbar/View/KMToolbarPreviousNextItemView.swift

@@ -8,7 +8,7 @@
 import Cocoa
 
 private func _KMPreviousNextString() -> String {
-    return "\(NSLocalizedString("Previous", comment: ""))/\(NSLocalizedString("Next", comment: ""))"
+    return NSLocalizedString("Previous/Next", comment: "")
 }
 
 private let _minWidth: CGFloat = 24 * 2

+ 10 - 0
PDF Office/PDF Master/Class/Purchase/DMG/Verification/KMVerificationMessageViewController.m

@@ -623,6 +623,16 @@ NSPopoverDelegate>
 }
 
 - (IBAction)personalCenterAction:(NSButton *)sender {
+    if (![KMCloudServer isConnectionAvailable]) {
+        NSAlert *alert = [NSAlert alertWithMessageText:NSLocalizedString(@"Connection Error", nil)
+                                         defaultButton:NSLocalizedString(@"OK", nil)
+                                       alternateButton:nil
+                                           otherButton:nil
+                             informativeTextWithFormat:NSLocalizedString(@"Please make sure your internet connection is available.", nil), nil];
+        [alert runModal];
+        return;
+    }
+        
     // 用户头像点击事件
     self.userMenu = [[NSMenu alloc] init];
     KMUserInfoViewController *userInfo = [[KMUserInfoViewController alloc] init];

+ 1 - 1
PDF Office/PDF Master/MemberCenter/ViewController/KMUserInfoViewController.swift

@@ -171,10 +171,10 @@ class KMUserInfoViewController: NSViewController {
                     if KMMemberInfo.shared.isLogin {
                     }
                 } else {
-                    NotificationCenter.default.post(name: NSNotification.Name("CloseMenuNotification"), object: nil)
                     let code = resDic?.code
                     if code == 304 {
                         KMLoginWindowsController.shared.showWindow(nil)
+                        NotificationCenter.default.post(name: NSNotification.Name("CloseMenuNotification"), object: nil)
                     }
                 }
             }