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

【订阅】调整比较表弹出规则(送审被拒)

lizhe 1 год назад
Родитель
Сommit
7386ff7237

+ 14 - 3
PDF Office/PDF Master/Class/ChromiumTabs/KMToolbarRightView.swift

@@ -54,9 +54,7 @@ import Cocoa
     
     @objc func updateView() -> Void {
 //        KMLightMemberManager.manager.canShowAdvancedView &&
-        if (!KMLightMemberManager.manager.isLogin() ||
-             (KMLightMemberManager.manager.purchaseState != .subscription &&
-              KMLightMemberManager.manager.purchaseState != .trial)) {
+        if canShowAdvanced() {
             if self.advancedLabel != nil {
                 self.advancedContentView.isHidden = false
                 self.advancedViewRightConstraint.constant = 8.0
@@ -93,6 +91,19 @@ import Cocoa
         }
     }
     
+    func canShowAdvanced() -> Bool {
+        #if VERSION_FREE
+        return (KMLightMemberManager.manager.isLogin() &&
+             (KMLightMemberManager.manager.purchaseState != .subscription &&
+              KMLightMemberManager.manager.purchaseState != .trial))
+        #else
+        return (!KMLightMemberManager.manager.isLogin() ||
+             (KMLightMemberManager.manager.purchaseState != .subscription &&
+              KMLightMemberManager.manager.purchaseState != .trial))
+        #endif
+        
+    }
+    
     func fetchAdvancedViewSize() -> CGSize {
         var advancedString = NSLocalizedString("Upgrade", comment: "")
 //        if KMLightMemberManager.manager.purchaseState == .trial {

+ 51 - 42
PDF Office/PDF Master/Class/KMLightMember/Controller/ComparativeTable/KMComparativeTableViewController.swift

@@ -25,15 +25,16 @@ enum KMComparativeInputType: Int {
     case loginInputPassword = 6 //登录密码输入
     case accountInfo = 7 //用户信息
     case loginSuccess = 8 //用户登录成功
+    case loginCancel = 9 //用户登录成功
     
-    case compress       = 9         // 压缩
-    case convert        = 10         // 转档
-    case secure         = 11        // 安全
-    case pageEdit       = 12        // 页面编辑
-    case merge          = 13        // 合并
-    case crop           = 14        // 裁切
-    case thumb          = 15        // 缩略图列表
-    case shareFlatten   = 16        // 分享副本
+    case compress       = 10         // 压缩
+    case convert        = 11         // 转档
+    case secure         = 12        // 安全
+    case pageEdit       = 13        // 页面编辑
+    case merge          = 14        // 合并
+    case crop           = 15        // 裁切
+    case thumb          = 16        // 缩略图列表
+    case shareFlatten   = 17        // 分享副本
     //后续添加
 }
 
@@ -71,48 +72,56 @@ class KMComparativeTableViewController: NSWindowController {
 #endif
         
 #if VERSION_FREE
-        let controller: KMComparativeTableViewController = KMComparativeTableViewController.init(windowNibName: "KMComparativeTableViewController")
-        controller.inputType = type
+        if KMLightMemberManager.manager.isLogin() {
+            let controller: KMComparativeTableViewController = KMComparativeTableViewController.init(windowNibName: "KMComparativeTableViewController")
+            controller.inputType = type
 
-        controller.loginAction = { controller in
-            comparativeController = nil
-            comparativeMainWindow?.endSheet(controller.window!)
-            comparativeMainWindow = nil
-            controller.close()
+            controller.loginAction = { controller in
+                comparativeController = nil
+                comparativeMainWindow?.endSheet(controller.window!)
+                comparativeMainWindow = nil
+                controller.close()
 
-            if NSApp.mainWindow != nil {
-                KMLoginWindowController.show(window: NSApp.mainWindow!, .ComparativeTable, .login)
+                if NSApp.mainWindow != nil {
+                    KMLoginWindowController.show(window: NSApp.mainWindow!, .ComparativeTable, .login)
+                }
             }
-        }
 
-        controller.signUpAction = { controller in
-            comparativeController = nil
-            comparativeMainWindow?.endSheet(controller.window!)
-            comparativeMainWindow = nil
-            controller.close()
+            controller.signUpAction = { controller in
+                comparativeController = nil
+                comparativeMainWindow?.endSheet(controller.window!)
+                comparativeMainWindow = nil
+                controller.close()
 
-            if NSApp.mainWindow != nil {
-                KMLoginWindowController.show(window: NSApp.mainWindow!, .ComparativeTable, .register)
+                if NSApp.mainWindow != nil {
+                    KMLoginWindowController.show(window: NSApp.mainWindow!, .ComparativeTable, .register)
+                }
             }
-        }
-        
-        controller.subscriptionAction = { controller in
-            controller.subscribeAction(controller: controller)
-        }
-        
-        controller.restoreAction = { controller in
-            controller.subscribeAction(controller: controller, isRestore:true)
-        }
-        
-        window.beginSheet(controller.window!)
+            
+            controller.subscriptionAction = { controller in
+                controller.subscribeAction(controller: controller)
+            }
+            
+            controller.restoreAction = { controller in
+                controller.subscribeAction(controller: controller, isRestore:true)
+            }
+            
+            window.beginSheet(controller.window!)
 
-        comparativeController = controller
-        comparativeMainWindow = window
-        
-        if type == .loginSuccess && KMLightMemberManager.manager.purchaseState != .subscription {
-            controller.subscribeAction(controller: controller)
+            comparativeController = controller
+            comparativeMainWindow = window
+            
+//            if type == .loginSuccess && KMLightMemberManager.manager.purchaseState != .subscription {
+//                controller.subscribeAction(controller: controller)
+//            }
+            return controller
+        } else {
+            if type == .loginCancel {
+                
+            } else {
+                KMLoginWindowController.show(window: NSApp.mainWindow!, .ComparativeTable)
+            }
         }
-        return controller
 #endif
         return nil
     }

+ 1 - 1
PDF Office/PDF Master/Class/KMLightMember/Controller/Login&Register/KMLoginWindowController.swift

@@ -95,7 +95,7 @@ class KMLoginWindowController: NSWindowController {
             
             if self?.inputType == .ComparativeTable {
                 //跳转订阅比较表
-                let _ = KMComparativeTableViewController.show(window: NSApp.mainWindow ?? NSWindow())
+                let _ = KMComparativeTableViewController.show(window: NSApp.mainWindow ?? NSWindow(),.loginCancel)
             }
         }
         

+ 7 - 7
PDF Office/PDF Master/Class/KMLightMember/Controller/Login&Register/View/KMLoginLeftImageView.swift

@@ -30,8 +30,8 @@ class KMLoginLeftImageView: KMBaseXibView {
     override func setup() {
         super.setup()
         
-        self.subscriptionButton.setTitleColor(NSColor(hex: "#3F8FF6"))
-        self.subscriptionButton.font = NSFont.SFProTextSemibold(12.0)
+//        self.subscriptionButton.setTitleColor(NSColor(hex: "#3F8FF6"))
+//        self.subscriptionButton.font = NSFont.SFProTextSemibold(12.0)
         
         self.closeBox.moveCallback = { [weak self] (mouseEntered, mouseBox) in
             if mouseEntered {
@@ -42,17 +42,17 @@ class KMLoginLeftImageView: KMBaseXibView {
         }
         
         Task { @MainActor in
-            self.subscriptionButton.isHidden = true
+//            self.subscriptionButton.isHidden = true
             if self.logType != .registerSuccess {
                 if await (KMLightMemberManager.manager.canUseAdvanced() == false) {
-                    self.subscriptionButton.isHidden = false
+//                    self.subscriptionButton.isHidden = false
                 }
             }
         }
     }
     
     override func updateLanguage() {
-        self.subscriptionButton.title = NSLocalizedString("Subscribe Now", comment: "")
+//        self.subscriptionButton.title = NSLocalizedString("Subscribe Now", comment: "")
     }
     
     func updateImage() {
@@ -60,10 +60,10 @@ class KMLoginLeftImageView: KMBaseXibView {
         switch logType {
         case .registerSuccess:
             image = NSImage(named: "image_registerSuccess")!
-            self.subscriptionButton.isHidden = true
+//            self.subscriptionButton.isHidden = true
         default:
             image = NSImage(named: "image_other")!
-            self.subscriptionButton.isHidden = false
+//            self.subscriptionButton.isHidden = false
         }
         self.imageView.image = image
     }

+ 1 - 1
PDF Office/PDF Master/Class/KMLightMember/Controller/Login&Register/View/KMLoginLeftImageView.xib

@@ -61,7 +61,7 @@
                         <action selector="cancelButtonAction:" target="-2" id="df5-MO-xjM"/>
                     </connections>
                 </button>
-                <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="7z9-Ga-XM3">
+                <button hidden="YES" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="7z9-Ga-XM3">
                     <rect key="frame" x="160" y="26" width="96" height="16"/>
                     <buttonCell key="cell" type="square" title="Subscribe Now" bezelStyle="shadowlessSquare" alignment="center" imageScaling="proportionallyDown" inset="2" id="H4X-qF-Fef">
                         <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>