Browse Source

Merge branch 'develop_PDFReaderPro_V4.7.0' into develop_PDFReaderProNew

# Conflicts:
#	PDF Office/PDF Master/Strings/zh-Hans.lproj/Localizable.strings
#	PDF Office/PDF Master/Strings/zh-Hant.lproj/Localizable.strings
wangshuai 3 months ago
parent
commit
5751a1cbe0
100 changed files with 1874 additions and 1730 deletions
  1. 75 6
      PDF Office/PDF Master/AppDelegate.swift
  2. 0 1
      PDF Office/PDF Master/Class/AD/KMAdsManager.swift
  3. 2 1
      PDF Office/PDF Master/Class/AD/KMAdsWebView.swift
  4. 8 1
      PDF Office/PDF Master/Class/AIInfo/AIConfigWindowController/AIConfigWindowController.swift
  5. 3 1
      PDF Office/PDF Master/Class/AIInfo/AIConfigWindowController/AIConfigWindowController.xib
  6. 20 7
      PDF Office/PDF Master/Class/AIInfo/AIConfigWindowController/AINewConfigWindowController.swift
  7. 1 1
      PDF Office/PDF Master/Class/AIInfo/AIConfigWindowController/AINewConfigWindowController.xib
  8. 1 1
      PDF Office/PDF Master/Class/AIInfo/AIConfigWindowController/Views/AIChatView/CollectionViewItems/AIChatTranslateResultItem.swift
  9. 25 6
      PDF Office/PDF Master/Class/AIInfo/AIConfigWindowController/Views/AIHeaderView/AIHeaderView.swift
  10. 1 1
      PDF Office/PDF Master/Class/AIInfo/AIConfigWindowController/Views/AIInfoInputView/AIInfoInputView.swift
  11. 20 20
      PDF Office/PDF Master/Class/AIInfo/AIConfigWindowController/Views/AIInfoInputView/AIInfoInputView.xib
  12. 4 5
      PDF Office/PDF Master/Class/AIInfo/AIInfoConfig.swift
  13. 17 18
      PDF Office/PDF Master/Class/AIInfo/AIPurchaseWindowController/AIPurchaseWindowController.swift
  14. 3 3
      PDF Office/PDF Master/Class/AIInfo/AIPurchaseWindowController/AIPurchaseWindowController.xib
  15. 1 1
      PDF Office/PDF Master/Class/AIInfo/AITranslateTipWindowController/AITranslateTipWindowController.swift
  16. 1 1
      PDF Office/PDF Master/Class/AIInfo/AITranslateTipWindowController/AITranslateTipWindowController.xib
  17. 32 76
      PDF Office/PDF Master/Class/AIInfo/AIUserInfoController/AIUserInfoController.swift
  18. 21 118
      PDF Office/PDF Master/Class/AIInfo/AIUserInfoController/AIUserInfoController.xib
  19. 419 115
      PDF Office/PDF Master/Class/AIInfo/KMAIRequestServerManager.swift
  20. 6 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Other/Purchase/Contents.json
  21. 22 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Other/Purchase/KMImageNamePurchaseImage.imageset/Contents.json
  22. BIN
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Other/Purchase/KMImageNamePurchaseImage.imageset/Frame 1000007032.pdf
  23. BIN
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Other/Purchase/KMImageNamePurchaseImage.imageset/Frame 1000007033.pdf
  24. 22 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Other/Purchase/KMImageNamePurchaseImage2.imageset/Contents.json
  25. BIN
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Other/Purchase/KMImageNamePurchaseImage2.imageset/Frame 1000007031.pdf
  26. BIN
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Other/Purchase/KMImageNamePurchaseImage2.imageset/Frame 1000007032.pdf
  27. 22 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Other/Purchase/KMImageNamePurchaseSuccessIcon.imageset/Contents.json
  28. 86 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Other/Purchase/KMImageNamePurchaseSuccessIcon.imageset/success 1.pdf
  29. 86 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Other/Purchase/KMImageNamePurchaseSuccessIcon.imageset/success.pdf
  30. 2 2
      PDF Office/PDF Master/Class/Batch/Data/KMBatchConvertParameter.swift
  31. 2 2
      PDF Office/PDF Master/Class/Batch/View/KMBatchoperateConvertCollectionViewItem.swift
  32. 2 6
      PDF Office/PDF Master/Class/Batch/View/KMConvertCollectionViewHeader.swift
  33. 9 12
      PDF Office/PDF Master/Class/Batch/WindowController/KMBatchOperateLeftViewController.swift
  34. 1 1
      PDF Office/PDF Master/Class/Batch/WindowController/KMBatchOperateWindowController.swift
  35. 38 47
      PDF Office/PDF Master/Class/Batch/WindowController/VC/KMBatchOperateConvertViewController.swift
  36. 36 33
      PDF Office/PDF Master/Class/Batch/WindowController/VC/KMBatchOperateConvertViewController.xib
  37. 6 4
      PDF Office/PDF Master/Class/Batch/WindowController/VC/KMBatchOperateImageToPDFViewController.swift
  38. 15 1
      PDF Office/PDF Master/Class/Batch/WindowController/VC/KMToolbarItemPopViewController.swift
  39. 7 3
      PDF Office/PDF Master/Class/Batch/WindowController/VC/KMToolbarItemPopViewController.xib
  40. 7 6
      PDF Office/PDF Master/Class/ChromiumTabs/KMBrowserWindowController.swift
  41. 2 2
      PDF Office/PDF Master/Class/ChromiumTabs/src/Tab Strip/CTTabStripDragController.m
  42. 0 4
      PDF Office/PDF Master/Class/ChromiumTabs/src/Tab Strip/CTTabStripModel.m
  43. 36 0
      PDF Office/PDF Master/Class/Common/Category/NSWindowController+KMExtension.swift
  44. 9 0
      PDF Office/PDF Master/Class/Common/KMCommonDefine.swift
  45. 2 2
      PDF Office/PDF Master/Class/Common/OC/StatusBar/KMStatusBar.m
  46. 6 1
      PDF Office/PDF Master/Class/Document/KMMainDocument.swift
  47. 1 2
      PDF Office/PDF Master/Class/GuideInfo/KMCouponDueWindowController.swift
  48. 6 6
      PDF Office/PDF Master/Class/GuideInfo/KMCouponDueWindowController.xib
  49. 5 5
      PDF Office/PDF Master/Class/GuideInfo/KMFunctionGuideWindowController.swift
  50. 3 10
      PDF Office/PDF Master/Class/Home/NSObject/Services/DropboxModel.m
  51. 47 117
      PDF Office/PDF Master/Class/Home/ViewController/KMHomeViewController+Action.swift
  52. 11 42
      PDF Office/PDF Master/Class/Home/ViewController/KMHomeViewController.swift
  53. 5 5
      PDF Office/PDF Master/Class/Home/WindowController/KMAITranslationConfirmWindowController.xib
  54. 32 32
      PDF Office/PDF Master/Class/KMAdvertisement/Config/KMAdvertisementConfig.swift
  55. 54 117
      PDF Office/PDF Master/Class/KMAdvertisement/Manager/KMAdvertisementManager.swift
  56. 3 8
      PDF Office/PDF Master/Class/KMAdvertisement/Model/KMAdvertisementImage.swift
  57. 8 88
      PDF Office/PDF Master/Class/KMAdvertisement/Model/KMAdvertisementModel.swift
  58. 9 63
      PDF Office/PDF Master/Class/KMAdvertisement/Model/KMAdvertisementModelTransition.swift
  59. 10 4
      PDF Office/PDF Master/Class/KMAdvertisement/View/KMRecommondPopWindow/KMRecommondPopWindow.m
  60. 3 3
      PDF Office/PDF Master/Class/KMAdvertisement/View/Tableview/Cell/KMAdvertisementCollectionHeadView.xib
  61. 3 3
      PDF Office/PDF Master/Class/KMAdvertisement/View/Tableview/Cell/KMAdvertisementCollectionViewItem.xib
  62. 1 1
      PDF Office/PDF Master/Class/KMLightMember/InAppPurchase/KMPurchaseManager.swift
  63. 1 1
      PDF Office/PDF Master/Class/KMLightMember/KMRequestServer/KMRequestServer.swift
  64. 2 2
      PDF Office/PDF Master/Class/PDFTools/AddPassword/New/View/KMSecurityView.swift
  65. 2 2
      PDF Office/PDF Master/Class/PDFTools/Compress/Controller/KMCompressWIndowControllerNew.swift
  66. 45 67
      PDF Office/PDF Master/Class/PDFTools/Convert/NewController/KMConvertWindowController.swift
  67. 61 61
      PDF Office/PDF Master/Class/PDFTools/Convert/NewController/KMConvertWindowController.xib
  68. 11 13
      PDF Office/PDF Master/Class/PDFTools/Convert/NewController/KMToolCompareWindowController.swift
  69. 13 17
      PDF Office/PDF Master/Class/PDFTools/Merge/MergeNew/KMMergeWindowController.swift
  70. 0 33
      PDF Office/PDF Master/Class/PDFTools/Merge/MergeNew/View/KMMergeView.swift
  71. 8 10
      PDF Office/PDF Master/Class/PDFTools/Merge/OCPart/KMPDFEditAppendWindow.m
  72. 71 87
      PDF Office/PDF Master/Class/PDFTools/PageEdit/Controller/KMPDFEditViewController.swift
  73. 4 4
      PDF Office/PDF Master/Class/PDFTools/PageEdit/Window/SplitWindowController.swift
  74. 2 2
      PDF Office/PDF Master/Class/PDFTools/Print/KMPrintWindowController.swift
  75. 10 10
      PDF Office/PDF Master/Class/PDFTools/Print/PrintHelper/PrintManage/KMPDFPrintManageWindowController.m
  76. 4 9
      PDF Office/PDF Master/Class/PDFTools/RemovePassword/New/View/KMRemovePasswordView.swift
  77. 4 4
      PDF Office/PDF Master/Class/PDFTools/RemovePassword/VC/KMBatchOperateRemovePasswordViewController.swift
  78. 2 2
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFListView.m
  79. 1 1
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFListViewExtension/CPDFListView+Tool.m
  80. 19 19
      PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController+Thumbnail.swift
  81. 8 8
      PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController.swift
  82. 24 28
      PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Thumbnail/Base/KMPDFThumbViewBaseController.swift
  83. 6 7
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMAnnotationSelectLinkViewController.swift
  84. 2 2
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/ViewController/PageDisplay/KMPageDisplayCustomThemesCollectionViewItem.swift
  85. 21 11
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/ViewController/PageDisplay/KMPageDisplayPropertiesViewController.swift
  86. 3 3
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/ViewController/PageDisplay/KMPageDisplayThemeCollectionViewItem.swift
  87. 4 4
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/Signature/KMSignatureAnnotationViewController.m
  88. 0 1
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/Signature/KMSignatureWindowController.m
  89. 80 80
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/Signature/KMSignatureWindowController.xib
  90. 10 16
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/StampList/KMAnnotationStampViewController.swift
  91. 5 5
      PDF Office/PDF Master/Class/PDFWindowController/TabWindowController/KMTabbingHintWindowController.swift
  92. 4 4
      PDF Office/PDF Master/Class/PDFWindowController/Toolbar/KMToolbarViewController.swift
  93. 55 70
      PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+Action.swift
  94. 20 20
      PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+MenuAction.swift
  95. 13 13
      PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+UI.swift
  96. 31 49
      PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController.swift
  97. 3 4
      PDF Office/PDF Master/Class/Preference/Controller/KMGeneralPreferences.swift
  98. 45 45
      PDF Office/PDF Master/Class/Purchase/Appstore/KMPurchaseCompareWindowController.m
  99. 1 1
      PDF Office/PDF Master/Class/Purchase/Appstore/KMPurchaseCompareWindowController.xib
  100. 0 0
      PDF Office/PDF Master/Class/Purchase/DMG/DMGEmbeddedOldWC.swift

+ 75 - 6
PDF Office/PDF Master/AppDelegate.swift

@@ -38,7 +38,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, iRateDelegate{
     
     func applicationDidFinishLaunching(_ aNotification: Notification) {
         // Insert code here to initialize your application
-        
+                
         //通知
         UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound, .badge]) { granted, error in
             if granted {
@@ -115,6 +115,34 @@ class AppDelegate: NSObject, NSApplicationDelegate, iRateDelegate{
         KMKdanRemoteConfig.remoteConfig.fetchWithRemoteConfigCompletionHandler { status, error in
             
         }
+        
+        let token = UserDefaults.standard.value(forKey: "MemberAccessToken")
+        if token is String {
+            if (token as! String).count > 0 {
+                KMMemberInfo.shared.access_token = token as! String
+                KMUserInfoVCModel().refreshUserInfo { success, msg,dic  in
+                    if success {
+                        KMMemberInfo.shared.isLogin = true
+                        NotificationCenter.default.post(name: NSNotification.Name(rawValue: "MemberCenterLoginSuccess"), object: nil)
+                    } else {
+                        KMMemberInfo.shared.isLogin = false
+                    }
+#if VERSION_DMG
+                    let model = KMProductModel.shared
+                    model.getDMGProductDatas() { [weak self] success, result in
+                        
+                    }
+#endif
+                }
+            }
+        } else {
+#if VERSION_DMG
+            let model = KMProductModel.shared
+            model.getDMGProductDatas() { [weak self] success, result in
+                
+            }
+#endif
+        }
 
         KMStatusBar.system()
         
@@ -203,7 +231,38 @@ class AppDelegate: NSObject, NSApplicationDelegate, iRateDelegate{
                 }
             }
         }
+        
         NotificationCenter.default.addObserver(self, selector: #selector(deviceActivateStatusChangeNotification), name: NSNotification.Name(rawValue: "kDeviceActivateNotification"), object: nil)
+        
+        initDidFinish()
+    }
+    
+    func initDidFinish() {
+#if VERSION_DMG
+        let memberInfo: KMMemberInfo = KMMemberInfo.shared
+        if KMMemberInfo.shared.isMemberAllFunction == false && memberInfo.isLogin == false {
+                checkLoginAndPrompt()
+            }
+#endif
+        }
+    
+    func checkLoginAndPrompt() {
+        let lastPromptDateKey = "kUserfreehaveDMGAIlastPromptDate"
+        
+        let userDefaults = UserDefaults.standard
+        let lastPromptDate = userDefaults.object(forKey: lastPromptDateKey) as? Date
+        
+        if let lastDate = lastPromptDate {
+            // 如果距离上次提示超过7天,则再次提示
+            if Calendar.current.date(byAdding: .day, value: 7, to: lastDate)! <= Date() {
+                KMOpenDMGPopupBootWC.shared.showWindow(nil)
+                userDefaults.set(Date(), forKey: lastPromptDateKey) // 更新提示日期
+            }
+        } else {
+            // 如果没有记录,则显示提示
+            KMOpenDMGPopupBootWC.shared.showWindow(nil)
+            userDefaults.set(Date(), forKey: lastPromptDateKey) // 保存提示日期
+        }
     }
     
     func initiRateData() {
@@ -357,6 +416,11 @@ class AppDelegate: NSObject, NSApplicationDelegate, iRateDelegate{
         if let browser = windowControler?.browser {
             if browser.tabCount() == 1 {
                 windowControler?.window?.close()
+                
+                if KMAdvertisementManager.manager.appClosedCount == 0 {
+                    KMAdvertisementManager.manager.appClosedCount = 1
+                }
+                
             } else {
                 if let _ = windowControler?.window?.attachedSheet {
                     NSSound.beep()
@@ -710,10 +774,14 @@ class AppDelegate: NSObject, NSApplicationDelegate, iRateDelegate{
     }
     
     @objc func restoreSubscriptions(_ sender: NSMenuItem) {
-#if VERSION_FREE
+        if(KMMemberInfo.shared.isLogin == false) {
+            KMLoginWindowsController.shared.showWindow(nil)
+            return
+        }
+#if !VERSION_DMG
         KMPrint("restoreSubscriptions ...")
-        let compareWindowVC: KMPurchaseCompareWindowController = KMPurchaseCompareWindowController.sharedInstance() as! KMPurchaseCompareWindowController
-        compareWindowVC.showWindowRestore(nil)
+        KMProductCompareWC.shared.orientation = false
+        KMProductCompareWC.shared.showWindowRestore(sender)
 #else
         var vc: KMToolCompareWindowController? = nil
         vc = KMToolCompareWindowController.toolCompare(toolType: .Convert, selectNum: 0)
@@ -754,7 +822,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, iRateDelegate{
 //        if tWorkSpace.open(url!) == false {
 //            tWorkSpace.open(url!)
 //        }
-        let embeddedWC = KMPurchaseEmbeddedWindowController.currentFirstTrialWC("com.brother.pdfreaderpro.mac.product_2")
+        let embeddedWC = DMGEmbeddedOldWC.currentFirstTrialWC("com.brother.pdfreaderpro.mac.product_2")
         embeddedWC.showWindow(nil)
         embeddedWC.window?.center()
 #endif
@@ -807,7 +875,8 @@ class AppDelegate: NSObject, NSApplicationDelegate, iRateDelegate{
     
     @IBAction func aiToolsAction(_ sender: NSMenuItem) {
 #if VERSION_DMG
-        KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+        KMProductCompareWC.shared.orientation = false
+        KMProductCompareWC.shared.showWindow(nil)
 #else
         AIPurchaseWindowController.currentWC().showWindow(nil)
 #endif

+ 0 - 1
PDF Office/PDF Master/Class/AD/KMAdsManager.swift

@@ -133,7 +133,6 @@ class KMAdsManager: NSObject {
 
     func showFreeTimeAdsInfo() {
         print("KMPurchaseCompareWindowController")
-//        KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
     }
 
     func checkNetworkAvailable() -> Bool {

+ 2 - 1
PDF Office/PDF Master/Class/AD/KMAdsWebView.swift

@@ -297,7 +297,8 @@ class KMAdsWebView: NSView, WKNavigationDelegate, CAAnimationDelegate {
         }
         
         if type == .ComparisonSheet {
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            KMProductCompareWC.shared.orientation = false
+            KMProductCompareWC.shared.showWindow(nil)
         } else {
             let newURL = NSURL(string: string)
             NSWorkspace.shared.open(newURL! as URL)

+ 8 - 1
PDF Office/PDF Master/Class/AIInfo/AIConfigWindowController/AIConfigWindowController.swift

@@ -108,7 +108,7 @@ import Cocoa
                 } else if self.configType == .proofreading {
                     tipString = NSLocalizedString("No more than 2000 characters.", comment: "")
                 } else if self.configType == .translate {
-                    tipString = NSLocalizedString("1 credit for every 10,000 characters", comment: "")
+                    tipString = NSLocalizedString("2 credit for every 10,000 characters", comment: "")
                 }
                 let popViewController = KMToolbarItemPopViewController.init()
                 if self.popOver == nil {
@@ -736,6 +736,13 @@ import Cocoa
                             var charCount: Int = 0
                             if infoDict["charCount"] != nil {
                                 charCount = (infoDict["charCount"] ?? "0") as! Int
+                                if credit == 0 {
+                                    if charCount < 10000 {
+                                       credit = 2
+                                   } else {
+                                       credit = charCount/5000 + 1
+                                   }
+                                }
                             }
                             
                             translateTipWC.creditValid = true

+ 3 - 1
PDF Office/PDF Master/Class/AIInfo/AIConfigWindowController/AIConfigWindowController.xib

@@ -58,7 +58,7 @@
             <windowStyleMask key="styleMask" titled="YES" fullSizeContentView="YES"/>
             <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
             <rect key="contentRect" x="196" y="240" width="795" height="551"/>
-            <rect key="screenRect" x="0.0" y="0.0" width="1920" height="1055"/>
+            <rect key="screenRect" x="0.0" y="0.0" width="1800" height="1125"/>
             <view key="contentView" id="se5-gp-TjO">
                 <rect key="frame" x="0.0" y="0.0" width="795" height="551"/>
                 <autoresizingMask key="autoresizingMask"/>
@@ -310,6 +310,7 @@
                                                                 <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                                                                 <size key="minSize" width="348" height="276"/>
                                                                 <size key="maxSize" width="348" height="10000000"/>
+                                                                <color key="insertionPointColor" name="textInsertionPointColor" catalog="System" colorSpace="catalog"/>
                                                             </textView>
                                                         </subviews>
                                                     </clipView>
@@ -498,6 +499,7 @@
                                                                 <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                                                                 <size key="minSize" width="350" height="324"/>
                                                                 <size key="maxSize" width="355" height="10000000"/>
+                                                                <color key="insertionPointColor" name="textInsertionPointColor" catalog="System" colorSpace="catalog"/>
                                                             </textView>
                                                         </subviews>
                                                     </clipView>

+ 20 - 7
PDF Office/PDF Master/Class/AIInfo/AIConfigWindowController/AINewConfigWindowController.swift

@@ -291,13 +291,19 @@ protocol AIConfigWindowDelegate: AnyObject {
     }
     
     func chooseAIFunctionWithType(_ aiConfigType: AIConfigType) -> Void {
-        if AIInfoManager.default().aiInfo.infoDict.keys.count == 0 {
-#if VERSION_DMG
-            KMPurchaseCompareWindowController.dmgPurchaseInstance().showWindow(nil)
-#else
-            AIPurchaseWindowController.currentWC().showWindow(nil)
-#endif
-            return;
+        if KMMemberInfo.shared.aiSubscription() == false {
+            return
+        }
+        if KMMemberInfo.shared.aiPoint == 0 &&
+            (AIInfoManager.default().aiInfo.totalToken - AIInfoManager.default().aiInfo.usedTimes) < 1 {
+            
+            let alert = NSAlert()
+            alert.alertStyle = .critical
+            alert.informativeText = NSLocalizedString("No Value Present", comment: "")
+            alert.addButton(withTitle: NSLocalizedString("OK", comment: ""))
+            alert.runModal()
+            
+            return
         }
         
         if self.eventLabel.isEmpty {
@@ -601,6 +607,13 @@ protocol AIConfigWindowDelegate: AnyObject {
                         var charCount: Int = 0
                         if infoDict["charCount"] != nil {
                             charCount = (infoDict["charCount"] ?? "0") as! Int
+                            if credit == 0 {
+                                 if charCount < 10000 {
+                                    credit = 2
+                                } else {
+                                    credit = charCount/5000 + 1
+                                }
+                            }
                         }
                         
                         chatModel.creditsValid = true

+ 1 - 1
PDF Office/PDF Master/Class/AIInfo/AIConfigWindowController/AINewConfigWindowController.xib

@@ -18,7 +18,7 @@
             <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES" fullSizeContentView="YES"/>
             <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
             <rect key="contentRect" x="196" y="240" width="276" height="739"/>
-            <rect key="screenRect" x="0.0" y="0.0" width="1512" height="944"/>
+            <rect key="screenRect" x="0.0" y="0.0" width="1920" height="1055"/>
             <value key="minSize" type="size" width="276" height="739"/>
             <value key="maxSize" type="size" width="276" height="2739"/>
             <view key="contentView" id="se5-gp-TjO">

+ 1 - 1
PDF Office/PDF Master/Class/AIInfo/AIConfigWindowController/Views/AIChatView/CollectionViewItems/AIChatTranslateResultItem.swift

@@ -100,7 +100,7 @@ class AIChatTranslateResultItem: NSCollectionViewItem {
         self.errorTipLabel.font = NSFont.SFProTextRegularFont(12)
         
         self.titleLabel1.stringValue = NSLocalizedString("You will cost:", comment: "")
-        self.creditTipLabel.stringValue = NSLocalizedString("Tip: 1 credit for each 10,000 characters", comment: "")
+        self.creditTipLabel.stringValue = NSLocalizedString("Tip: 2 credit for each 10,000 characters", comment: "")
         self.errorTipLabel.stringValue = NSLocalizedString("Insufficient credit", comment: "")
         
         self.cancelBtn.title = NSLocalizedString("Cancel", comment: "")

+ 25 - 6
PDF Office/PDF Master/Class/AIInfo/AIConfigWindowController/Views/AIHeaderView/AIHeaderView.swift

@@ -52,28 +52,48 @@ class AIHeaderView: NSView, NibLoadable {
     
     //MARK: IBAction
     @IBAction func creditInfoAction(_ sender: NSButton) {
-       
         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)
+        }
+    }
+    
+    func enterAIInfo(_ sender: NSButton) {
+        
+        KMUserInfoVCModel().refreshUserInfo { success, msg ,res in
+            NotificationCenter.default.post(name: NSNotification.Name(rawValue: kDeviceAIStatusChangeNotification), object: nil)
+         }
         
         let controller = AIUserInfoController.init()
         controller.purchaseHandle = { vc in
 #if VERSION_DMG
 //            let url = URL(string: AIProduct_Link)
 //            NSWorkspace.shared.open(url!)
-            let embeddedWC = KMPurchaseEmbeddedWindowController.currentFirstTrialWC("com.brother.pdfreaderpro.ai.product_1")
+            let embeddedWC = KMPurchaseEmbeddedWindowController.currentCode(KMAISubscriptionMonthCodeKey_DMG)
             embeddedWC.showWindow(self)
             embeddedWC.window?.center()
 #else
-            AIPurchaseWindowController.currentWC().showWindow(nil)
+            if KMMemberInfo.shared.aiPoint > 0 {
+                
+            } else {
+                AIPurchaseWindowController.currentWC().showWindow(nil)
+            }
 #endif
         }
         
         controller.enterLicenseHandle = { vc in
             let verifyVC = KMVerificationWindowController.verification(with: .activateAIInfo)
             verifyVC?.callback = {
-                KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+                KMProductCompareWC.shared.orientation = false
+                KMProductCompareWC.shared.showWindow(nil)
             }
             verifyVC?.showWindow(nil)
             
@@ -95,7 +115,6 @@ class AIHeaderView: NSView, NibLoadable {
         popover.contentViewController = controller
         popover.behavior = .transient
         popover.show(relativeTo: sender.bounds, of: sender, preferredEdge: .minY)
-        
-        
+    
     }
 }

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

@@ -126,7 +126,7 @@ class AIInfoInputView: NSView, NibLoadable, NSTextFieldDelegate, NSTextViewDeleg
                 } else if self.aiConfigType == .proofreading {
                     tipString = NSLocalizedString("No more than 2000 characters.", comment: "")
                 } else if self.aiConfigType == .translate {
-                    tipString = NSLocalizedString("1 credit for every 10,000 characters; No more than 10M of a document. ", comment: "")
+                    tipString = NSLocalizedString("2 credit for every 10,000 characters; No more than 10M of a document. ", comment: "")
                 }
                 let popViewController = KMToolbarItemPopViewController.init()
                 if self.popOver == nil {

+ 20 - 20
PDF Office/PDF Master/Class/AIInfo/AIConfigWindowController/Views/AIInfoInputView/AIInfoInputView.xib

@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21507" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22505" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
     <dependencies>
         <deployment identifier="macosx"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21507"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22505"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
@@ -22,7 +22,7 @@
                             <customView translatesAutoresizingMaskIntoConstraints="NO" id="6CO-V7-P4Z">
                                 <rect key="frame" x="0.0" y="0.0" width="238" height="245"/>
                                 <subviews>
-                                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="sz6-fP-Bdb">
+                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="sz6-fP-Bdb">
                                         <rect key="frame" x="6" y="221" width="124" height="16"/>
                                         <textFieldCell key="cell" lineBreakMode="clipping" title="选择需要使用的工具" id="dJu-ok-6Gz">
                                             <font key="font" usesAppearanceFont="YES"/>
@@ -42,7 +42,7 @@
                                     <customView translatesAutoresizingMaskIntoConstraints="NO" id="y7L-XQ-ePy">
                                         <rect key="frame" x="0.0" y="221" width="238" height="24"/>
                                         <subviews>
-                                            <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="2Wj-F1-dBg">
+                                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="2Wj-F1-dBg">
                                                 <rect key="frame" x="6" y="4" width="37" height="16"/>
                                                 <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="LAJ-dW-gv1">
                                                     <font key="font" usesAppearanceFont="YES"/>
@@ -59,14 +59,14 @@
                                             </button>
                                             <button translatesAutoresizingMaskIntoConstraints="NO" id="0vw-Pt-XuK">
                                                 <rect key="frame" x="214" y="4" width="16" height="16"/>
-                                                <constraints>
-                                                    <constraint firstAttribute="height" constant="16" id="HeR-Wc-V1d"/>
-                                                    <constraint firstAttribute="width" constant="16" id="XlK-Gq-dro"/>
-                                                </constraints>
                                                 <buttonCell key="cell" type="bevel" bezelStyle="rounded" image="aiTextClose" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="y9h-U2-9FO">
                                                     <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                                     <font key="font" metaFont="system"/>
                                                 </buttonCell>
+                                                <constraints>
+                                                    <constraint firstAttribute="height" constant="16" id="HeR-Wc-V1d"/>
+                                                    <constraint firstAttribute="width" constant="16" id="XlK-Gq-dro"/>
+                                                </constraints>
                                                 <connections>
                                                     <action selector="clearInputStringAction:" target="c22-O7-iKe" id="jab-YX-zEd"/>
                                                 </connections>
@@ -85,7 +85,7 @@
                                     <customView translatesAutoresizingMaskIntoConstraints="NO" id="Tld-qg-AAs">
                                         <rect key="frame" x="0.0" y="32" width="238" height="185"/>
                                         <subviews>
-                                            <textField hidden="YES" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="dSN-RY-s4T">
+                                            <textField hidden="YES" focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="dSN-RY-s4T">
                                                 <rect key="frame" x="10" y="155" width="228" height="32"/>
                                                 <constraints>
                                                     <constraint firstAttribute="width" constant="224" id="6s5-gx-pwz"/>
@@ -139,7 +139,7 @@
                                                         </constraints>
                                                         <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="axesIndependently" image="ic_else_alert" id="Dh6-Iw-zHM"/>
                                                     </imageView>
-                                                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="gTS-09-xht">
+                                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="gTS-09-xht">
                                                         <rect key="frame" x="24" y="8" width="194" height="16"/>
                                                         <constraints>
                                                             <constraint firstAttribute="width" constant="190" id="0MZ-vx-2fb"/>
@@ -191,7 +191,7 @@
                                                     <customView translatesAutoresizingMaskIntoConstraints="NO" id="z3M-0o-bfB">
                                                         <rect key="frame" x="0.0" y="0.0" width="61" height="20"/>
                                                         <subviews>
-                                                            <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" allowsExpansionToolTips="YES" translatesAutoresizingMaskIntoConstraints="NO" id="awg-zk-OOg">
+                                                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" allowsExpansionToolTips="YES" translatesAutoresizingMaskIntoConstraints="NO" id="awg-zk-OOg">
                                                                 <rect key="frame" x="6" y="2" width="37" height="16"/>
                                                                 <textFieldCell key="cell" lineBreakMode="truncatingTail" title="Label" id="dZ8-fk-3O1">
                                                                     <font key="font" usesAppearanceFont="YES"/>
@@ -244,7 +244,7 @@
                                                     <customView translatesAutoresizingMaskIntoConstraints="NO" id="Ek7-fa-Yrv">
                                                         <rect key="frame" x="87" y="0.0" width="61" height="20"/>
                                                         <subviews>
-                                                            <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" allowsExpansionToolTips="YES" translatesAutoresizingMaskIntoConstraints="NO" id="afk-d4-8cf">
+                                                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" allowsExpansionToolTips="YES" translatesAutoresizingMaskIntoConstraints="NO" id="afk-d4-8cf">
                                                                 <rect key="frame" x="6" y="2" width="37" height="16"/>
                                                                 <textFieldCell key="cell" lineBreakMode="truncatingTail" title="Label" id="ls7-Pa-Kn8">
                                                                     <font key="font" usesAppearanceFont="YES"/>
@@ -308,7 +308,7 @@
                                                         </constraints>
                                                         <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyUpOrDown" image="ic_propertybar_file_pdf" id="9yq-c5-Xp9"/>
                                                     </imageView>
-                                                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" allowsExpansionToolTips="YES" translatesAutoresizingMaskIntoConstraints="NO" id="POe-MA-3Cr">
+                                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" allowsExpansionToolTips="YES" translatesAutoresizingMaskIntoConstraints="NO" id="POe-MA-3Cr">
                                                         <rect key="frame" x="42" y="30" width="172" height="16"/>
                                                         <constraints>
                                                             <constraint firstAttribute="width" constant="168" id="fnM-KA-hiY"/>
@@ -319,7 +319,7 @@
                                                             <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                                                         </textFieldCell>
                                                     </textField>
-                                                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="D1d-zo-pBW">
+                                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="D1d-zo-pBW">
                                                         <rect key="frame" x="42" y="10" width="37" height="16"/>
                                                         <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="AUp-s3-0NI">
                                                             <font key="font" metaFont="system"/>
@@ -327,7 +327,7 @@
                                                             <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                                                         </textFieldCell>
                                                     </textField>
-                                                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="l6f-Zr-7WC">
+                                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="l6f-Zr-7WC">
                                                         <rect key="frame" x="83" y="10" width="37" height="16"/>
                                                         <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="pq1-Ar-zaK">
                                                             <font key="font" metaFont="system"/>
@@ -351,14 +351,14 @@
                                             </customView>
                                             <button translatesAutoresizingMaskIntoConstraints="NO" id="Vj8-am-8Gm">
                                                 <rect key="frame" x="218" y="140" width="20" height="20"/>
-                                                <constraints>
-                                                    <constraint firstAttribute="height" constant="20" id="Phs-Z3-91k"/>
-                                                    <constraint firstAttribute="width" constant="20" id="QDu-7B-heo"/>
-                                                </constraints>
                                                 <buttonCell key="cell" type="bevel" bezelStyle="rounded" image="aiPDF_Clear" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="V8Q-CY-OqW">
                                                     <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                                     <font key="font" metaFont="system"/>
                                                 </buttonCell>
+                                                <constraints>
+                                                    <constraint firstAttribute="height" constant="20" id="Phs-Z3-91k"/>
+                                                    <constraint firstAttribute="width" constant="20" id="QDu-7B-heo"/>
+                                                </constraints>
                                                 <connections>
                                                     <action selector="removeChooseFile:" target="c22-O7-iKe" id="enL-rL-Sz0"/>
                                                 </connections>
@@ -389,7 +389,7 @@
                                     <customView translatesAutoresizingMaskIntoConstraints="NO" id="rB9-d1-Cdg">
                                         <rect key="frame" x="0.0" y="0.0" width="238" height="32"/>
                                         <subviews>
-                                            <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="x8R-lQ-xRW">
+                                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="x8R-lQ-xRW">
                                                 <rect key="frame" x="10" y="8" width="49" height="16"/>
                                                 <textFieldCell key="cell" lineBreakMode="clipping" title="0/2000" id="Geq-53-8fy">
                                                     <font key="font" metaFont="system"/>

+ 4 - 5
PDF Office/PDF Master/Class/AIInfo/AIInfoConfig.swift

@@ -42,12 +42,11 @@ import Foundation
 class AIInfoConfig: NSObject {
     var aiActionURL: String {
         get {
-//            #if DEBUG
             return kVerificationServer
-//            #else
-//            //正式服务器
-//            return "https://store.pdfreaderpro.com"
-//            #endif
         }
     }
+    
+    var memberAIActionURL: String {
+        return "http://139.196.160.101:8081"
+    }
 }

+ 17 - 18
PDF Office/PDF Master/Class/AIInfo/AIPurchaseWindowController/AIPurchaseWindowController.swift

@@ -61,7 +61,7 @@ class AIPurchaseWindowController: NSWindowController, NSWindowDelegate {
         
         self.titleLabel.stringValue = NSLocalizedString("Purchase AI Tools", comment: "")
         self.subTitleLabel.stringValue = NSLocalizedString("Level up your PDF workflow with AI assistant. Unlock advanced features like AI Summarize, AI Translate, AI Rewrite, AI Proofread. ", comment: "")
-        self.priceDesLabel.stringValue = NSLocalizedString("Purchase for 50 credits within 30 days", comment: "")
+        self.priceDesLabel.stringValue = NSLocalizedString("Auto-renewal | 50 credits/month | Cancel anytime", comment: "")
         self.restoreButton.title = NSLocalizedString("Restore", comment: "")
         self.privacyButton.title = NSLocalizedString("Privacy Policy", comment: "")
         self.termOfButton.title = NSLocalizedString("Terms of Service", comment: "")
@@ -129,7 +129,6 @@ class AIPurchaseWindowController: NSWindowController, NSWindowDelegate {
         NotificationCenter.default.addObserver(self, selector: #selector(IAPProductRestoreFinishedNotification), name: NSNotification.Name(rawValue: NSNotification.Name.KMIAPProductRestoreFinished.rawValue), object: nil)
         NotificationCenter.default.addObserver(self, selector: #selector(IAPProductRestoreFailedNotification), name: NSNotification.Name(rawValue: NSNotification.Name.KMIAPProductRestoreFailed.rawValue), object: nil)
         NotificationCenter.default.addObserver(self, selector: #selector(AIDeviceStatusChangeNotification), name: NSNotification.Name(rawValue: "kDeviceAIStatusChangeNotification"), object: nil)
-        
     }
     
     func refreshUI() -> Void {
@@ -143,18 +142,18 @@ class AIPurchaseWindowController: NSWindowController, NSWindowDelegate {
     func reloadData() -> Void {
         self.purchaseButton.isEnabled = true
 #if VERSION_FREE
-        let priceLabel = IAPProductsManager.default().liteAIProduct.price()
+        let priceLabel = IAPProductsManager.default().aiAllAccessPack1month_lite.price()
 #else
-        let priceLabel = IAPProductsManager.default().proAIProduct.price()
+        let priceLabel = IAPProductsManager.default().aiAllAccessPack1month_pro.price()
 #endif
         
-        let aiInfoValid = AIInfoManager.default().aiInfoValid
-        if  aiInfoValid {
-            self.purchaseButton.isEnabled = false
-            self.purchaseButton.layer?.backgroundColor = NSColor.white.withAlphaComponent(0.2).cgColor
-        } else {
+        let allowPurchaseAI = KMMemberInfo.shared.allowPurchaseAI
+        if allowPurchaseAI {
             self.purchaseButton.isEnabled = true
             self.purchaseButton.layer?.backgroundColor = NSColor.clear.cgColor
+        } else {
+            self.purchaseButton.isEnabled = false
+            self.purchaseButton.layer?.backgroundColor = NSColor.white.withAlphaComponent(0.2).cgColor
         }
         self.priceLabel.stringValue = priceLabel!
     }
@@ -162,9 +161,9 @@ class AIPurchaseWindowController: NSWindowController, NSWindowDelegate {
     func appStoreRestoreFinish() -> Void {
         var didPurchased: Bool = false
 #if VERSION_FREE
-        didPurchased = IAPProductsManager.default().liteAIProduct.isSubscribed
+        didPurchased = IAPProductsManager.default().aiAllAccessPack1month_lite.isSubscribed
 #else
-        didPurchased = IAPProductsManager.default().proAIProduct.isSubscribed
+        didPurchased = IAPProductsManager.default().aiAllAccessPack1month_pro.isSubscribed
 #endif
         if didPurchased {
             AIInfoManager.default().restoreAI(withInfo: ["receipt_str":IAPProductsManager.default().temptransactioReceipt as Any]) { dict, error in
@@ -201,9 +200,9 @@ class AIPurchaseWindowController: NSWindowController, NSWindowDelegate {
     //MARK: - IBAction
     @IBAction func purchaseAction(_ sender: KMButton) {
 #if VERSION_FREE
-        IAPProductsManager.default().make(IAPProductsManager.default().liteAIProduct)
+        IAPProductsManager.default().make(IAPProductsManager.default().aiAllAccessPack1month_lite)
 #else
-        IAPProductsManager.default().make(IAPProductsManager.default().proAIProduct)
+        IAPProductsManager.default().make(IAPProductsManager.default().aiAllAccessPack1month_pro)
 #endif
         self.addWaingView((self.window?.contentView)!)
         FMTrackEventManager.defaultManager.trackOnceEvent(event: "PUW", withProperties: ["PUW_Btn":"PUW_Btn_BuyAITools"])
@@ -254,19 +253,19 @@ class AIPurchaseWindowController: NSWindowController, NSWindowDelegate {
             
             //Appstore购买结束后绑定票据信息
 #if VERSION_FREE
-            if IAPProductsManager.default().liteAIProduct.isSubscribed {
+            if IAPProductsManager.default().aiAllAccessPack1month_lite.isSubscribed {
                 AIInfoManager.default().activateAI(withInfo: ["receipt_str":IAPProductsManager.default().temptransactioReceipt as Any]) { dict, error in
                     self.reloadData()
-                    if AIInfoManager.default().aiInfoValid {
+                    if KMMemberInfo.shared.isPermitAI {
                         self.close()
                     }
                 }
             }
 #else
-            if IAPProductsManager.default().proAIProduct.isSubscribed {
+            if IAPProductsManager.default().aiAllAccessPack1month_pro.isSubscribed {
                 AIInfoManager.default().activateAI(withInfo: ["receipt_str":IAPProductsManager.default().temptransactioReceipt as Any]) { dict, error in
                     self.reloadData()
-                    if AIInfoManager.default().aiInfoValid {
+                    if KMMemberInfo.shared.isPermitAI {
                         self.close()
                     }
                 }
@@ -296,7 +295,7 @@ class AIPurchaseWindowController: NSWindowController, NSWindowDelegate {
     @objc func AIDeviceStatusChangeNotification() {
         DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.3) {
             self.reloadData()
-            if AIInfoManager.default().aiInfoValid {
+            if KMMemberInfo.shared.isPermitAI {
                 self.close()
             }
         }

+ 3 - 3
PDF Office/PDF Master/Class/AIInfo/AIPurchaseWindowController/AIPurchaseWindowController.xib

@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21507" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22505" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
     <dependencies>
         <deployment identifier="macosx"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21507"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22505"/>
         <capability name="Named colors" minToolsVersion="9.0"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
@@ -28,7 +28,7 @@
         <window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" titlebarAppearsTransparent="YES" titleVisibility="hidden" id="F0z-JX-Cv5">
             <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES" fullSizeContentView="YES"/>
             <rect key="contentRect" x="196" y="240" width="490" height="530"/>
-            <rect key="screenRect" x="0.0" y="0.0" width="1440" height="875"/>
+            <rect key="screenRect" x="0.0" y="0.0" width="2560" height="1415"/>
             <view key="contentView" id="se5-gp-TjO">
                 <rect key="frame" x="0.0" y="0.0" width="490" height="530"/>
                 <autoresizingMask key="autoresizingMask"/>

+ 1 - 1
PDF Office/PDF Master/Class/AIInfo/AITranslateTipWindowController/AITranslateTipWindowController.swift

@@ -58,7 +58,7 @@ class AITranslateTipWindowController: NSWindowController {
         
         self.titleLabel1.stringValue = NSLocalizedString("You will cost:", comment: "")
                 
-        self.creditTipLabel.stringValue = NSLocalizedString("1 credit for every 10,000 characters", comment: "")
+        self.creditTipLabel.stringValue = NSLocalizedString("2 credit for every 10,000 characters", comment: "")
         self.errorTipLabel.stringValue = NSLocalizedString("Insufficient credit", comment: "")
         
         self.cancelBtn.title = NSLocalizedString("Cancel", comment: "")

+ 1 - 1
PDF Office/PDF Master/Class/AIInfo/AITranslateTipWindowController/AITranslateTipWindowController.xib

@@ -27,7 +27,7 @@
             <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
             <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
             <rect key="contentRect" x="196" y="240" width="438" height="140"/>
-            <rect key="screenRect" x="0.0" y="0.0" width="1920" height="1055"/>
+            <rect key="screenRect" x="0.0" y="0.0" width="1800" height="1125"/>
             <view key="contentView" id="se5-gp-TjO">
                 <rect key="frame" x="0.0" y="0.0" width="438" height="140"/>
                 <autoresizingMask key="autoresizingMask"/>

+ 32 - 76
PDF Office/PDF Master/Class/AIInfo/AIUserInfoController/AIUserInfoController.swift

@@ -25,19 +25,13 @@ import Cocoa
     
     @IBOutlet weak var creditsContendBox: NSBox!
     @IBOutlet weak var creditsInfoBox: KMBox!
-    @IBOutlet weak var creditsTitleLabel: NSTextField!
     @IBOutlet weak var validCreditLabel: NSTextField!
-    @IBOutlet weak var totalCreditLabel: NSTextField!
-    @IBOutlet weak var alreadCreditBox: NSBox!
-    @IBOutlet weak var alreadyCreditLabel: NSTextField!
-    @IBOutlet weak var timeDescriptionInfoLabel: NSTextField!
-    @IBOutlet weak var dateInfoLabel: NSTextField!
     @IBOutlet weak var creditsBuyNowBox: KMBox!
     @IBOutlet weak var creditsBuyNowLabel: NSTextField!
     @IBOutlet weak var creditsRestoreBtn: HyperLinkButton!
     @IBOutlet weak var creditBuyNowBtn: KMButton!
-    @IBOutlet weak var creditTipBtn: KMButton!
     @IBOutlet weak var showAIRobotBtn: NSButton!
+    @IBOutlet weak var remainLabel: NSTextField!
     
     var popOver: NSPopover!
     
@@ -68,14 +62,11 @@ import Cocoa
         self.titleLabel.stringValue = NSLocalizedString("AI Tools Title", comment: "")
         self.whatNewlabel.stringValue = NSLocalizedString("What‘s New", comment: "") + " →"
         
-        self.creditsTitleLabel.stringValue = NSLocalizedString("Available credits this month", comment: "")
-        self.alreadyCreditLabel.stringValue = NSLocalizedString("Credits to be unlocked: ", comment: "")
         self.creditsBuyNowLabel.stringValue = NSLocalizedString("Buy Now", comment: "")
         
         self.emptyContendBox.isHidden = true
         self.creditsContendBox.isHidden = true
-        self.emptyShowAIBtn.isHidden = true
-        if AIInfoManager.default().aiInfoValid == true {
+        if KMMemberInfo.shared.isPermitAI == true {
             self.creditsContendBox.isHidden = false
             
             var viewRect = self.view.frame
@@ -84,8 +75,7 @@ import Cocoa
             
         } else {
             self.emptyContendBox.isHidden = false
-            self.emptyShowAIBtn.isHidden = false
-            
+ 
             var viewRect = self.view.frame
             viewRect.size.height = 386
             self.view.frame = viewRect
@@ -100,25 +90,6 @@ import Cocoa
         
         self.updateCreditsViewInfo()
         
-        self.creditTipBtn.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()
-                }
-                self.popOver.contentViewController = popViewController
-                self.popOver.animates = false
-                self.popOver.behavior = .semitransient
-                self.popOver.contentSize = (popViewController.view.frame.size)
-                popViewController.updateWithHelpTip(helpTip: tipString)
-                self.popOver.show(relativeTo: self.creditTipBtn.frame, of: self.creditTipBtn.superview!, preferredEdge: .maxY)
-            } else {
-                self.popOver.close()
-            }
-        }
-        
         self.emptyTipButton.mouseMoveCallback = {[unowned self] mouseEntered in
             if mouseEntered {
                 let tipString = NSLocalizedString("Each use of the AI tools costs 1 or more credits.", comment: "")
@@ -156,6 +127,11 @@ import Cocoa
         self.emptyBuyNowBox.wantsLayer = true
         self.emptyBuyNowBox.layer?.cornerRadius = 20
         self.emptyBuyNowBox.layer?.masksToBounds = true
+        if KMMemberInfo.shared.ai_status == 1 {
+            self.emptyBuyNowBox.isHidden = true
+        } else {
+            self.emptyBuyNowBox.isHidden = false
+        }
         
         self.emptyBuyNowBtn.wantsLayer = true
         self.emptyBuyNowBtn.layer?.backgroundColor = NSColor.clear.cgColor
@@ -205,12 +181,8 @@ import Cocoa
         
         if KMAppearance.isDarkMode() {
             self.creditsInfoBox.fillColor = NSColor(red: 0, green: 0, blue: 0, alpha: 0.4)
-            self.creditsTitleLabel.textColor = NSColor.white
-            self.alreadCreditBox.fillColor = NSColor(red: 155/255, green: 83/255, blue: 1, alpha: 0.3)
         } else {
             self.creditsInfoBox.fillColor = NSColor(red: 249/255, green: 247/255, blue: 250/255, alpha: 1)
-            self.creditsTitleLabel.textColor = KMAppearance.KMColor_Layout_H0()
-            self.alreadCreditBox.fillColor = NSColor(red: 155/255, green: 83/255, blue: 1, alpha: 0.1)
         }
         
         self.creditsRestoreBtn.title = NSLocalizedString("Enter AI License", comment: "")
@@ -225,24 +197,12 @@ import Cocoa
                 self?.creditBuyNowBtn.layer?.backgroundColor = NSColor.clear.cgColor
             }
         }
-            
-        self.creditsTitleLabel.font = NSFont.SFProTextSemiboldFont(14)
-        
         self.validCreditLabel.font = NSFont.UbuntuBoldFontWithSize(32)
-        self.validCreditLabel.textColor = NSColor(red: 166/255, green: 102/255, blue: 1, alpha: 1)
-        self.totalCreditLabel.font = NSFont.UbuntuMediumFontWithSize(20)
-        self.totalCreditLabel.textColor = KMAppearance.KMColor_Layout_H2()
-        
-        self.alreadCreditBox.borderWidth = 0
-        self.alreadyCreditLabel.font = NSFont.SFProTextRegularFont(13)
-        self.alreadyCreditLabel.textColor = KMAppearance.KMColor_Layout_H1()
-        
-        self.timeDescriptionInfoLabel.textColor = KMAppearance.KMColor_Status_Err()
-        self.timeDescriptionInfoLabel.font = NSFont.SFProTextRegularFont(13)
-        
-        self.dateInfoLabel.textColor = KMAppearance.KMColor_Layout_H2()
-        self.dateInfoLabel.font = NSFont.SFProTextRegularFont(12)
-        
+        self.validCreditLabel.textColor = .blue
+        self.remainLabel.font = NSFont.UbuntuBoldFontWithSize(20)
+//        self.remainLabel.textColor = .black
+        self.remainLabel.textColor = KMAppearance.KMColor_Layout_H0()
+
         self.creditsRestoreBtn.font = NSFont.SFProTextRegularFont(14)
         self.creditsBuyNowBox.fillColor = NSColor.clear
         self.creditsBuyNowBox.wantsLayer = true
@@ -263,7 +223,7 @@ import Cocoa
 #else
         self.emptyRestoreBtn.isHidden = true
         self.creditsRestoreBtn.isHidden = true
-        if AIInfoManager.default().aiInfoValid == true {
+        if KMMemberInfo.shared.isPermitAI == true {
             self.creditsBuyNowBox.isHidden = true
         } else {
             self.creditsBuyNowBox.isHidden = false
@@ -273,34 +233,18 @@ import Cocoa
     
     func updateCreditsViewInfo() -> Void {
         let aiInfo: AIInfo = AIInfoManager.default().aiInfo
-        if aiInfo.infoDict.keys.count == 0 {
-            return
-        }
-        self.validCreditLabel.stringValue = String(format: "%d", aiInfo.totalToken-aiInfo.usedTimes)
-        self.totalCreditLabel.stringValue = "/" + String(format: "%d", aiInfo.totalToken)
-        
-        self.alreadyCreditLabel.stringValue = NSLocalizedString("Credits to be unlocked: ", comment: "") + String(format: "%d", aiInfo.pre_creditToken)
-        
-        let leftDays = String(format: "%ld", aiInfo.remainingDays)
-        self.timeDescriptionInfoLabel.stringValue = String(format: NSLocalizedString("%@ days left on subscription", comment: ""), leftDays)
-        
-        let dateFormatter = DateFormatter.init()
-        dateFormatter.dateFormat = "yyyy.MM.dd"
-        let startDateStr = dateFormatter.string(from: aiInfo.startDate)
-        let endDateStr = dateFormatter.string(from: aiInfo.endDate)
-        self.dateInfoLabel.stringValue = startDateStr + " - " + endDateStr
-        
+
+        self.validCreditLabel.stringValue = String(format: "%d", aiInfo.totalToken-aiInfo.usedTimes + Int32(KMMemberInfo.shared.aiPoint))
+         
         self.emptyContendBox.isHidden = true
-        self.emptyShowAIBtn.isHidden = true
         self.creditsContendBox.isHidden = true
-        if AIInfoManager.default().aiInfoValid == true {
+        if KMMemberInfo.shared.isPermitAI == true {
             self.creditsContendBox.isHidden = false
         } else {
             self.emptyContendBox.isHidden = false
-            self.emptyShowAIBtn.isHidden = false
-        }
+         }
         
-        if AIInfoManager.default().aiInfoValid == true {
+        if KMMemberInfo.shared.isPermitAI == true {
             var viewRect = self.view.frame
             viewRect.size.height = 330
             self.view.frame = viewRect
@@ -324,6 +268,18 @@ import Cocoa
         guard let callBack = self.purchaseHandle else {
             return
         }
+        if KMMemberInfo.shared.isLogin == false {
+            KMLoginWindowsController.shared.openWindow() { success in
+                if KMMemberInfo.shared.aiPoint > 0 {
+                    
+                } else {
+                    if success {
+                        callBack(self)
+                    }
+                }
+            }
+            return
+        }
         
         let newStatus: Bool = KMCloudServer.isConnectionAvailable()
         if !newStatus {

+ 21 - 118
PDF Office/PDF Master/Class/AIInfo/AIUserInfoController/AIUserInfoController.xib

@@ -8,18 +8,13 @@
     <objects>
         <customObject id="-2" userLabel="File's Owner" customClass="AIUserInfoController" customModule="PDF_Reader_Pro" customModuleProvider="target">
             <connections>
-                <outlet property="alreadCreditBox" destination="wL8-6H-Mln" id="B6C-z9-vOk"/>
-                <outlet property="alreadyCreditLabel" destination="hIB-Pj-wes" id="7Wh-43-bF9"/>
                 <outlet property="contendBox" destination="akw-x7-mRX" id="6Oq-Dr-0is"/>
                 <outlet property="creditBuyNowBtn" destination="hpn-rW-lvk" id="2hn-Oh-eND"/>
-                <outlet property="creditTipBtn" destination="KZA-Yp-MhB" id="xqD-in-37v"/>
                 <outlet property="creditsBuyNowBox" destination="3ww-dO-Gu1" id="kzF-yB-kG5"/>
                 <outlet property="creditsBuyNowLabel" destination="8uq-YH-AiO" id="lyc-pL-Man"/>
                 <outlet property="creditsContendBox" destination="cRO-N6-ubp" id="SNv-MM-M8C"/>
                 <outlet property="creditsInfoBox" destination="mXw-IG-R8O" id="RhP-4S-LBY"/>
                 <outlet property="creditsRestoreBtn" destination="wbW-uf-Ro8" id="aLM-ax-1Gi"/>
-                <outlet property="creditsTitleLabel" destination="YdG-Tk-l0v" id="qI0-OA-lxO"/>
-                <outlet property="dateInfoLabel" destination="Zbs-pI-MoH" id="nq3-wI-nNZ"/>
                 <outlet property="emptyBuyNowBox" destination="snp-Q1-6ab" id="fg5-08-YCs"/>
                 <outlet property="emptyBuyNowBtn" destination="xzZ-jv-ubi" id="4eH-f6-98P"/>
                 <outlet property="emptyBuyNowLabel" destination="48H-5O-CmE" id="OWg-qN-1Tn"/>
@@ -28,10 +23,9 @@
                 <outlet property="emptyShowAIBtn" destination="XLU-ab-HmG" id="nmr-Py-H1V"/>
                 <outlet property="emptyTipButton" destination="uJ1-HE-KIh" id="dbE-HW-Tvg"/>
                 <outlet property="emptyTitleLabel" destination="8m3-0H-Jn2" id="lad-b4-DEX"/>
+                <outlet property="remainLabel" destination="5Ie-gP-WAM" id="Rcu-Fs-KwZ"/>
                 <outlet property="showAIRobotBtn" destination="1oj-bO-SIV" id="nZg-bQ-PI7"/>
-                <outlet property="timeDescriptionInfoLabel" destination="s7r-9O-yQi" id="0uc-fz-Gpu"/>
                 <outlet property="titleLabel" destination="xGE-Qj-Kve" id="JCg-2L-25z"/>
-                <outlet property="totalCreditLabel" destination="DHJ-4U-157" id="fcK-vm-PZs"/>
                 <outlet property="validCreditLabel" destination="8Ut-gB-hN2" id="HGH-Ax-i27"/>
                 <outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
                 <outlet property="whatNewlabel" destination="dmF-GY-xqk" id="vjx-pq-HF9"/>
@@ -224,132 +218,42 @@
                                                 <rect key="frame" x="0.0" y="0.0" width="360" height="178"/>
                                                 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                                 <subviews>
-                                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="YdG-Tk-l0v">
-                                                        <rect key="frame" x="130" y="137" width="101" height="17"/>
-                                                        <textFieldCell key="cell" lineBreakMode="clipping" title="available credit" id="PVf-Mg-fDX">
-                                                            <font key="font" metaFont="system" size="14"/>
-                                                            <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
-                                                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
-                                                        </textFieldCell>
-                                                    </textField>
-                                                    <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="3no-nh-cQE">
-                                                        <rect key="frame" x="233" y="138" width="16" height="16"/>
-                                                        <constraints>
-                                                            <constraint firstAttribute="width" constant="16" id="XWU-mS-QDn"/>
-                                                            <constraint firstAttribute="height" constant="16" id="nfu-nO-EdR"/>
-                                                        </constraints>
-                                                        <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="aiInfoIcon" id="4G3-ba-ndv"/>
-                                                    </imageView>
-                                                    <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="KZA-Yp-MhB" customClass="KMButton" customModule="PDF_Reader_Pro" customModuleProvider="target">
-                                                        <rect key="frame" x="233" y="138" width="16" height="16"/>
-                                                        <buttonCell key="cell" type="bevel" bezelStyle="rounded" alignment="center" imageScaling="proportionallyDown" inset="2" id="tg2-1W-zFB">
-                                                            <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
-                                                            <font key="font" metaFont="system"/>
-                                                        </buttonCell>
-                                                    </button>
-                                                    <customView translatesAutoresizingMaskIntoConstraints="NO" id="tLy-1k-P2i">
-                                                        <rect key="frame" x="144" y="89" width="72" height="48"/>
+                                                    <customView translatesAutoresizingMaskIntoConstraints="NO" id="6ch-H6-iib">
+                                                        <rect key="frame" x="116" y="52" width="129" height="75"/>
                                                         <subviews>
-                                                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="8Ut-gB-hN2">
-                                                                <rect key="frame" x="-2" y="5" width="46" height="38"/>
-                                                                <textFieldCell key="cell" lineBreakMode="clipping" title="50" id="XHY-3k-AmS">
-                                                                    <font key="font" metaFont="systemBold" size="32"/>
+                                                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="5Ie-gP-WAM">
+                                                                <rect key="frame" x="-2" y="50" width="133" height="25"/>
+                                                                <textFieldCell key="cell" lineBreakMode="clipping" title="剩余可用点数" id="oab-W0-WEg">
+                                                                    <font key="font" metaFont="systemBold" size="21"/>
                                                                     <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
                                                                     <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                                                                 </textFieldCell>
                                                             </textField>
-                                                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="DHJ-4U-157">
-                                                                <rect key="frame" x="40" y="12" width="34" height="24"/>
-                                                                <textFieldCell key="cell" lineBreakMode="clipping" title="/50" id="U9f-eJ-r2m">
-                                                                    <font key="font" metaFont="system" size="20"/>
+                                                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="8Ut-gB-hN2">
+                                                                <rect key="frame" x="-2" y="0.0" width="133" height="38"/>
+                                                                <textFieldCell key="cell" lineBreakMode="clipping" alignment="center" title="50" id="XHY-3k-AmS">
+                                                                    <font key="font" metaFont="systemBold" size="32"/>
                                                                     <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
                                                                     <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                                                                 </textFieldCell>
                                                             </textField>
                                                         </subviews>
                                                         <constraints>
-                                                            <constraint firstItem="8Ut-gB-hN2" firstAttribute="leading" secondItem="tLy-1k-P2i" secondAttribute="leading" id="8FQ-DX-N3S"/>
-                                                            <constraint firstAttribute="height" constant="48" id="AJ2-dI-OyW"/>
-                                                            <constraint firstItem="DHJ-4U-157" firstAttribute="centerY" secondItem="tLy-1k-P2i" secondAttribute="centerY" id="bVQ-BJ-3uX"/>
-                                                            <constraint firstItem="DHJ-4U-157" firstAttribute="leading" secondItem="8Ut-gB-hN2" secondAttribute="trailing" id="eKP-eb-WPT"/>
-                                                            <constraint firstItem="8Ut-gB-hN2" firstAttribute="centerY" secondItem="tLy-1k-P2i" secondAttribute="centerY" id="tpw-1a-Fwf"/>
-                                                            <constraint firstAttribute="trailing" secondItem="DHJ-4U-157" secondAttribute="trailing" id="ykL-ce-SQ5"/>
+                                                            <constraint firstAttribute="trailing" secondItem="5Ie-gP-WAM" secondAttribute="trailing" id="3DI-p4-Wb9"/>
+                                                            <constraint firstItem="5Ie-gP-WAM" firstAttribute="leading" secondItem="6ch-H6-iib" secondAttribute="leading" id="FRb-zh-L5M"/>
+                                                            <constraint firstItem="8Ut-gB-hN2" firstAttribute="top" secondItem="5Ie-gP-WAM" secondAttribute="bottom" constant="12" id="P0Z-yy-R5f"/>
+                                                            <constraint firstItem="5Ie-gP-WAM" firstAttribute="top" secondItem="6ch-H6-iib" secondAttribute="top" id="T0b-H0-ZKt"/>
+                                                            <constraint firstItem="8Ut-gB-hN2" firstAttribute="leading" secondItem="6ch-H6-iib" secondAttribute="leading" id="aKX-6o-gac"/>
+                                                            <constraint firstAttribute="bottom" secondItem="8Ut-gB-hN2" secondAttribute="bottom" id="eq3-op-oDz"/>
+                                                            <constraint firstAttribute="trailing" secondItem="8Ut-gB-hN2" secondAttribute="trailing" id="jLV-x5-2uW"/>
                                                         </constraints>
                                                     </customView>
-                                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="s7r-9O-yQi">
-                                                        <rect key="frame" x="68" y="73" width="224" height="16"/>
-                                                        <textFieldCell key="cell" lineBreakMode="clipping" title="30 days left before the subscription." id="DmZ-Bv-4Ki">
-                                                            <font key="font" usesAppearanceFont="YES"/>
-                                                            <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
-                                                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
-                                                        </textFieldCell>
-                                                    </textField>
-                                                    <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="doF-hX-U7U">
-                                                        <rect key="frame" x="99" y="56" width="12" height="12"/>
-                                                        <constraints>
-                                                            <constraint firstAttribute="height" constant="12" id="G5B-3Y-NOf"/>
-                                                            <constraint firstAttribute="width" constant="12" id="XuW-DN-Unx"/>
-                                                        </constraints>
-                                                        <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="AItime" id="Mxf-cB-HpL"/>
-                                                    </imageView>
-                                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Zbs-pI-MoH">
-                                                        <rect key="frame" x="113" y="55" width="155" height="16"/>
-                                                        <textFieldCell key="cell" lineBreakMode="clipping" title="2024.01.20 - 2024.02.20" id="s1i-rh-7sB">
-                                                            <font key="font" usesAppearanceFont="YES"/>
-                                                            <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
-                                                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
-                                                        </textFieldCell>
-                                                    </textField>
-                                                    <box boxType="custom" cornerRadius="4" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="wL8-6H-Mln">
-                                                        <rect key="frame" x="0.0" y="0.0" width="360" height="24"/>
-                                                        <view key="contentView" id="ndM-ZU-LBf">
-                                                            <rect key="frame" x="1" y="1" width="358" height="22"/>
-                                                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
-                                                            <subviews>
-                                                                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="hIB-Pj-wes">
-                                                                    <rect key="frame" x="125" y="3" width="109" height="16"/>
-                                                                    <textFieldCell key="cell" lineBreakMode="clipping" title="Total credits: 100" id="tiG-j0-XJN">
-                                                                        <font key="font" usesAppearanceFont="YES"/>
-                                                                        <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
-                                                                        <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
-                                                                    </textFieldCell>
-                                                                </textField>
-                                                            </subviews>
-                                                            <constraints>
-                                                                <constraint firstItem="hIB-Pj-wes" firstAttribute="centerX" secondItem="ndM-ZU-LBf" secondAttribute="centerX" id="Nro-nY-4su"/>
-                                                                <constraint firstItem="hIB-Pj-wes" firstAttribute="centerY" secondItem="ndM-ZU-LBf" secondAttribute="centerY" id="jw2-V3-f79"/>
-                                                            </constraints>
-                                                        </view>
-                                                        <constraints>
-                                                            <constraint firstAttribute="height" constant="24" id="Skt-Vg-3kw"/>
-                                                        </constraints>
-                                                    </box>
                                                 </subviews>
-                                                <constraints>
-                                                    <constraint firstItem="Zbs-pI-MoH" firstAttribute="leading" secondItem="doF-hX-U7U" secondAttribute="trailing" constant="4" id="0Ss-nd-CcE"/>
-                                                    <constraint firstItem="3no-nh-cQE" firstAttribute="bottom" secondItem="KZA-Yp-MhB" secondAttribute="bottom" id="2Nb-WB-tZ2"/>
-                                                    <constraint firstAttribute="trailing" secondItem="wL8-6H-Mln" secondAttribute="trailing" id="9xm-vc-YWO"/>
-                                                    <constraint firstItem="wL8-6H-Mln" firstAttribute="leading" secondItem="xxJ-j6-3lD" secondAttribute="leading" id="B2X-4l-6ce"/>
-                                                    <constraint firstItem="3no-nh-cQE" firstAttribute="leading" secondItem="YdG-Tk-l0v" secondAttribute="trailing" constant="4" id="BT1-8b-a1w"/>
-                                                    <constraint firstItem="YdG-Tk-l0v" firstAttribute="centerX" secondItem="xxJ-j6-3lD" secondAttribute="centerX" id="C9o-Uv-tdz"/>
-                                                    <constraint firstItem="3no-nh-cQE" firstAttribute="leading" secondItem="KZA-Yp-MhB" secondAttribute="leading" id="Cbz-nl-R7z"/>
-                                                    <constraint firstItem="s7r-9O-yQi" firstAttribute="top" secondItem="tLy-1k-P2i" secondAttribute="bottom" id="DON-us-8yp"/>
-                                                    <constraint firstItem="Zbs-pI-MoH" firstAttribute="centerX" secondItem="xxJ-j6-3lD" secondAttribute="centerX" constant="10" id="KNx-K1-AIu"/>
-                                                    <constraint firstItem="wL8-6H-Mln" firstAttribute="centerX" secondItem="xxJ-j6-3lD" secondAttribute="centerX" id="Lxq-u0-Jyj"/>
-                                                    <constraint firstItem="s7r-9O-yQi" firstAttribute="centerX" secondItem="xxJ-j6-3lD" secondAttribute="centerX" id="R4O-o5-IMd"/>
-                                                    <constraint firstItem="tLy-1k-P2i" firstAttribute="top" secondItem="YdG-Tk-l0v" secondAttribute="bottom" id="U6j-Tg-ZBV"/>
-                                                    <constraint firstItem="3no-nh-cQE" firstAttribute="top" secondItem="KZA-Yp-MhB" secondAttribute="top" id="Vd5-ND-Xhr"/>
-                                                    <constraint firstItem="Zbs-pI-MoH" firstAttribute="centerY" secondItem="doF-hX-U7U" secondAttribute="centerY" constant="-1" id="aEc-GT-Mk8"/>
-                                                    <constraint firstAttribute="bottom" secondItem="wL8-6H-Mln" secondAttribute="bottom" id="dIg-Yh-ccd"/>
-                                                    <constraint firstItem="YdG-Tk-l0v" firstAttribute="top" secondItem="xxJ-j6-3lD" secondAttribute="top" constant="24" id="iKS-ve-G3n"/>
-                                                    <constraint firstItem="tLy-1k-P2i" firstAttribute="centerX" secondItem="xxJ-j6-3lD" secondAttribute="centerX" id="kA3-ke-FXk"/>
-                                                    <constraint firstItem="Zbs-pI-MoH" firstAttribute="top" secondItem="s7r-9O-yQi" secondAttribute="bottom" constant="2" id="nzZ-hR-XdD"/>
-                                                    <constraint firstItem="3no-nh-cQE" firstAttribute="trailing" secondItem="KZA-Yp-MhB" secondAttribute="trailing" id="wUc-wh-HId"/>
-                                                    <constraint firstItem="3no-nh-cQE" firstAttribute="centerY" secondItem="YdG-Tk-l0v" secondAttribute="centerY" id="wbw-kY-05Z"/>
-                                                </constraints>
                                             </view>
                                             <constraints>
                                                 <constraint firstAttribute="height" constant="178" id="0pD-T0-Tbz"/>
+                                                <constraint firstItem="6ch-H6-iib" firstAttribute="centerX" secondItem="mXw-IG-R8O" secondAttribute="centerX" id="3nv-XP-ddB"/>
+                                                <constraint firstItem="6ch-H6-iib" firstAttribute="centerY" secondItem="mXw-IG-R8O" secondAttribute="centerY" id="FCi-sf-XdU"/>
                                                 <constraint firstAttribute="width" constant="360" id="ix4-MV-gpm"/>
                                             </constraints>
                                             <color key="fillColor" red="1" green="0.36862745099999999" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
@@ -366,7 +270,7 @@
                                                         <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="axesIndependently" image="AICreditIcon" id="I0p-5s-QZA"/>
                                                     </imageView>
                                                     <customView translatesAutoresizingMaskIntoConstraints="NO" id="4On-El-gaN">
-                                                        <rect key="frame" x="17" y="6" width="85" height="24"/>
+                                                        <rect key="frame" x="27" y="6" width="85" height="24"/>
                                                         <subviews>
                                                             <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="8uq-YH-AiO">
                                                                 <rect key="frame" x="22" y="4" width="65" height="16"/>
@@ -493,7 +397,6 @@
     </objects>
     <resources>
         <image name="AICreditIcon" width="103" height="20"/>
-        <image name="AItime" width="12" height="12"/>
         <image name="aiIconA" width="16" height="16"/>
         <image name="aiInfoIcon" width="16" height="16"/>
         <image name="creditEmptyIcon" width="112" height="112"/>

+ 419 - 115
PDF Office/PDF Master/Class/AIInfo/KMAIRequestServerManager.swift

@@ -12,20 +12,9 @@ import AFNetworking
 class ResultWrapper: NSObject {
     var success: Bool = false
     var result: NSDictionary = [:]
-//    var message: String = ""
-//    var code : Int = 200
-//    var error: NSError?
-//    var state: KMAIRewritingState = .rewrite
+ 
     var content: String = ""
-
-//    init(success: Bool, result: NSDictionary, message: String, code: Int, error: NSError? = nil, state: KMAIRewritingState) {
-//        self.success = success
-//        self.result = result
-//        self.message = message
-//        self.code = code
-//        self.error = error
-//        self.state = state
-//    }
+ 
     init(success: Bool, content: String) {
         self.success = success
         self.content = content
@@ -70,21 +59,46 @@ class ResultWrapper: NSObject {
         if state == .rewrite || state == .correctTypos {  //重写 && 纠错
             aiRewriting(content: content, state: state, complete: complete)
         } else if state == .uploadTranslate || state == .fileTranslate {    // 上传文件 || 文件翻译
-            aiTranslationFileUpload(file: content, complete: { [weak self] wrapper in
-                let success: Bool = wrapper.success
-                let fileKey = wrapper.content
-                if success {
-                    let fileData = wrapper.result
-                    complete(wrapper)
-//                    aiTranslationFileTranslateHandle(fileKey: fileKey, from: languageAbbreviation(from), to: languageAbbreviation(to), complete: complete)
-                } else {
-                    complete(wrapper)
-                }
-            })
+            let aiInfo: AIInfo = AIInfoManager.default().aiInfo
+            if aiInfo.totalToken - aiInfo.usedTimes > 1 {
+                aiTranslationFileUpload(file: content, complete: { [weak self] wrapper in
+                    let success: Bool = wrapper.success
+                    let fileKey = wrapper.content
+                    if success {
+                        let fileData = wrapper.result
+                        complete(wrapper)
+     
+                    } else {
+                        complete(wrapper)
+                    }
+                })
+            } else {
+                memberAITranslationFileUpload(file: content, complete: { [weak self] wrapper in
+                    let success: Bool = wrapper.success
+                    let fileKey = wrapper.content
+                    if success {
+                        let fileData = wrapper.result
+                        complete(wrapper)
+                        
+                    } else {
+                        complete(wrapper)
+                    }
+                })
+            }
         } else if state == .textTranslate { // 文本翻译
-            aiTranslationTextTrans(q: content, from: languageAbbreviation(from), to: languageAbbreviation(to), complete: complete)
+            let aiInfo: AIInfo = AIInfoManager.default().aiInfo
+            if aiInfo.totalToken - aiInfo.usedTimes > 1 {
+                aiTranslationTextTrans(q: content, from: languageAbbreviation(from), to: languageAbbreviation(to), complete: complete)
+            } else {
+                aiMemberTranslationTextTrans(q: content, from: languageAbbreviation(from), to: languageAbbreviation(to), complete: complete)
+            }
         } else if state == .extractSummaryFile {    // 提取摘要
-            extractSummaryFile(file: content, complete: complete)
+            let aiInfo: AIInfo = AIInfoManager.default().aiInfo
+            if aiInfo.totalToken - aiInfo.usedTimes > 0 {
+                extractSummaryFile(file: content, complete: complete)
+            } else {
+                memberExtractSummaryFile(file: content, complete: complete)
+            }
         }
     }
     
@@ -262,14 +276,7 @@ class ResultWrapper: NSObject {
                 
                 let message: String = responseObject!["message"] as? String ?? "unknown error"
                 let error = NSError(domain: message, code: Int(code)!)
-//                let result = ResultWrapper(success: true, result: data, message: message, code: Int(code)!, error: error, state: .uploadTranslate)
-//                if result.code == 200 {
-//                    result.success = true
-//                    complete(result)
-//                } else {
-//                    result.success = false
-//                    complete(result)
-//                }
+ 
                 if Int(code)! == 200 {
                     let wrapper = ResultWrapper(success: true, resultData: data)
                     wrapper.content = data["fileKey"] as! String
@@ -284,9 +291,69 @@ class ResultWrapper: NSObject {
                     complete(wrapper)
                 }
             } else {
-//                let error = NSError(domain: "unknown error", code: 404)
-//                let result = ResultWrapper(success: false, result: [:], message: "unknown error", code: 404, error: error, state: .uploadTranslate)
-//                complete(result)
+                 complete(ResultWrapper(success: false, content: "unknown error"))
+            }
+        }
+    }
+    
+    private func memberAITranslationFileUpload(file: String, complete: @escaping KMRequestServerComplete) {
+        let token: String = KMMemberInfo.shared.access_token
+        if token == "" {
+            complete(ResultWrapper(success: false, content: "unknown error"))
+            
+            if(KMMemberInfo.shared.isLogin == true) {
+                KMUserInfoViewController.refreshTokenUserInfo {[weak self] success, resDic in
+                    if(success == true) {
+                        
+                    } else {
+                        let code = resDic?.code ?? 200
+                        if(code == 304) {
+                            KMLoginWindowsController.shared.showWindow(nil)
+                        }
+                    }
+                }
+            } else {
+                KMLoginWindowsController.shared.showWindow(nil)
+            }
+            
+            return
+        }
+        
+        let urlString = AIInfoConfig().memberAIActionURL + "/member-system-website/v1/translate/fileUpload"
+        let fileData = FileManager.default.contents(atPath: file)
+        let params: [String: Any] = ["file" : fileData,
+                                     "calculate" : "1"]
+  
+        KMAIRequestServer.requestServer.uploadFile(urlString: urlString, params: params) { formData in
+            let fileURL = URL(fileURLWithPath: file)
+            try? formData.appendPart(withFileURL: fileURL, name: "file", fileName: fileURL.lastPathComponent, mimeType: "application/octet-stream")
+        } requestSerializer: { requestSerializer in
+            requestSerializer.setValue("Apifox/1.0.0 (https://www.apifox.cn)", forHTTPHeaderField: "User-Agent")
+            requestSerializer.setValue("Bearer " + token, forHTTPHeaderField: "Authorization")
+        } completion: { task, responseObject, error in
+            if responseObject != nil {
+                let data: NSDictionary = responseObject as? NSDictionary ?? [:]
+                if data.count > 0 {
+                    let code: String = data["code"] as? String ?? "06005"
+                    if Int(code)! == 200, let dataDic = data["data"] {
+                        let wrapper = ResultWrapper(success: true, resultData: dataDic as! NSDictionary)
+                        if let value = (dataDic as! NSDictionary)["fileKey"] {
+                            wrapper.content = value as! String
+                        }
+                        complete(wrapper)
+                    } else {
+                        let wrapper = ResultWrapper(success: false, resultData: data)
+                        if let value = data["msg"] {
+                            wrapper.content = value as! String
+                        }
+                        complete(wrapper)
+                    }
+                } else {
+                    let error = NSError(domain: "unknown error", code: 404)
+                    complete(ResultWrapper(success: false, content: "unknown error"))
+                }
+            } else {
+                let error = NSError(domain: "unknown error", code: 404)
                 complete(ResultWrapper(success: false, content: "unknown error"))
             }
         }
@@ -299,26 +366,81 @@ class ResultWrapper: NSObject {
      @param to 结束语言
      */
     func aiTranslationFileTranslateHandle(fileKey: String, from: String, to: String, complete: @escaping KMRequestServerComplete) {
-        
-        let infoDictionary = Bundle .main.infoDictionary!
-        let urlString = AIInfoConfig().aiActionURL + "/api/AI/fileTranslate"
+        let aiInfo: AIInfo = AIInfoManager.default().aiInfo
+        if aiInfo.totalToken - aiInfo.usedTimes > 1 {
+            let infoDictionary = Bundle .main.infoDictionary!
+            let urlString = AIInfoConfig().aiActionURL + "/api/AI/fileTranslate"
+            
+            let paraDict = ["fileKey": fileKey,
+                            "from": languageAbbreviation(from),
+                            "to": languageAbbreviation(to),
+                            "uuid": uuid(),
+                            "platform": platform(),
+                            "app_name": app_name()]
+            var postData  = try! JSONSerialization.data(withJSONObject: paraDict)
+            
+            
+            var request = URLRequest(url: URL(string: urlString)!,timeoutInterval: Double.infinity)
+            request.addValue("Apifox/1.0.0 (https://www.apifox.cn)", forHTTPHeaderField: "User-Agent")
+            request.addValue("application/json", forHTTPHeaderField: "Content-Type")
+            
+            request.httpMethod = "POST"
+            request.httpBody = postData
+            
+            let task = URLSession.shared.dataTask(with: request) { data, response, error in
+                guard let data = data else {
+                    print(String(describing: error))
+                    return
+                }
+                let jsonObject = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary ?? [:]
+                if jsonObject != nil {
+                    let data1: NSDictionary = jsonObject!["data"] as? NSDictionary ?? [:]
+                    let code: String = jsonObject!["code"] as? String ?? "06005"
+                    let message: String = jsonObject!["message"] as? String ?? "unknown error"
+                    let error = NSError(domain: message, code: Int(code)!)
+                    
+                    if Int(code)! == 200 {
+                        let fileUrl = data1["fileUrl"]
+                        let downFileUrl = data1["downFileUrl"]
+                        let ossDownUrl = data1["ossDownUrl"]
+                        let fileName = data1["fileName"]
+                        let downFileName = data1["downFileName"]
+                        let fromStr = data1["from"]
+                        let toStr = data1["to"]
+                        
+                        self.downFileName = downFileName as! String
+                        complete(ResultWrapper(success: true, content: ossDownUrl as! String))
+                    } else {
+                        complete(ResultWrapper(success: false, content: message))
+                    }
+                } else {
+                    complete(ResultWrapper(success: false, content: "unknown error"))
+                }
+            }
+            task.resume()
+        } else {
+            memberAITranslationFileTranslateHandle(fileKey: fileKey, from: from, to: to, complete: complete)
+        }
+    }
+    
+    func memberAITranslationFileTranslateHandle(fileKey: String, from: String, to: String, complete: @escaping KMRequestServerComplete) {
+        let token: String = KMMemberInfo.shared.access_token
+
+        let urlString = AIInfoConfig().memberAIActionURL + "/member-system-website/v1/translate/fileTranslateHandle"
 
         let paraDict = ["fileKey": fileKey,
                         "from": languageAbbreviation(from),
-                        "to": languageAbbreviation(to),
-                        "uuid": uuid(),
-                        "platform": platform(),
-                        "app_name": app_name()]
-        var postData  = try! JSONSerialization.data(withJSONObject: paraDict)
-
-        
+                        "to": languageAbbreviation(to)]
+        let postData  = try! JSONSerialization.data(withJSONObject: paraDict)
+ 
         var request = URLRequest(url: URL(string: urlString)!,timeoutInterval: Double.infinity)
-        request.addValue("Apifox/1.0.0 (https://www.apifox.cn)", forHTTPHeaderField: "User-Agent")
         request.addValue("application/json", forHTTPHeaderField: "Content-Type")
-
+        
+        request.addValue("Apifox/1.0.0 (https://www.apifox.cn)", forHTTPHeaderField: "User-Agent")
+        request.addValue("Bearer " + token, forHTTPHeaderField: "Authorization")
         request.httpMethod = "POST"
         request.httpBody = postData
-
+        
         let task = URLSession.shared.dataTask(with: request) { data, response, error in
            guard let data = data else {
                print(String(describing: error))
@@ -326,38 +448,38 @@ class ResultWrapper: NSObject {
            }
             let jsonObject = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary ?? [:]
             if jsonObject != nil {
-                let data1: NSDictionary = jsonObject!["data"] as? NSDictionary ?? [:]
-                let code: String = jsonObject!["code"] as? String ?? "06005"
-                let message: String = jsonObject!["message"] as? String ?? "unknown error"
-                let error = NSError(domain: message, code: Int(code)!)
-//                let result = ResultWrapper(success: true, result: data1, message: message, code: Int(code)!, error: error, state: .fileTranslate)
-//                if result.code == 200 {
-//                    result.success = true
-//                    complete(result)
-//                } else {
-//                    result.success = false
-//                    complete(result)
-//                }
-                if Int(code)! == 200 {
-                    let fileUrl = data1["fileUrl"]
-                    let downFileUrl = data1["downFileUrl"]
-                    let ossDownUrl = data1["ossDownUrl"]
-                    let fileName = data1["fileName"]
-                    let downFileName = data1["downFileName"]
-                    let fromStr = data1["from"]
-                    let toStr = data1["to"]
-                    
-                    self.downFileName = downFileName as! String
-//                    self.downloadFile(filePath: ossDownUrl as! String, downFileName: downFileName as! String)
-                    complete(ResultWrapper(success: true, content: ossDownUrl as! String))
+                let codeStr: String = jsonObject!["code"] as! String
+                var code: Int = 0
+                if let numCode = Int(codeStr) {
+                    code = numCode
+                }
+                var result_bool: Bool = true
+                var message: String = ""
+                if let value = jsonObject!["message"]{
+                    message = value as! String
+                }
+                
+                let result = KMMemberCenterResult(code: code, msg: message, result: result_bool)
+                if code == 200 {
+                    if jsonObject!["data"] != nil {
+                        let dataDic = jsonObject!["data"] as? NSDictionary ?? [:]
+                        
+                        let fileUrl = dataDic["fileUrl"]
+                        let downFileUrl = dataDic["downFileUrl"]
+                        let ossDownUrl = dataDic["ossDownUrl"]
+                        let fileName = dataDic["fileName"]
+                        let downFileName = dataDic["downFileName"]
+                        let fromStr = dataDic["from"]
+                        let toStr = dataDic["to"]
+                        
+                        self.downFileName = downFileName as! String
+                        complete(ResultWrapper(success: true, content: ossDownUrl as! String))
+                    }
                 } else {
                     complete(ResultWrapper(success: false, content: message))
                 }
             } else {
-//                let error = NSError(domain: "unknown error", code: 404)
-//                let result = ResultWrapper(success: false, result: [:], message: "unknown error", code: 404, error: error, state: .fileTranslate)
-//                complete(result)
-                complete(ResultWrapper(success: false, content: "unknown error"))
+                complete(ResultWrapper(success: false, content: ""))
             }
         }
         task.resume()
@@ -415,53 +537,143 @@ class ResultWrapper: NSObject {
         task.resume()
     }
     
+    private func aiMemberTranslationTextTrans(q: String, from: String, to: String, complete: @escaping KMRequestServerComplete) {
+        if(KMMemberInfo.shared.isLogin == true) {
+            KMUserInfoViewController.refreshTokenUserInfo {[weak self] success, resDic in
+                if(success == true) {
+                    self?.aiMemberTranslationTextTransReq(q: q, from: from, to: to, complete: complete)
+                } else {
+                    let code = resDic?.code ?? 200
+                    if(code == 304) {
+                        KMLoginWindowsController.shared.showWindow(nil)
+                    }
+                }
+            }
+            
+        }
+    }
+    
+    func aiMemberTranslationTextTransReq(q: String, from: String, to: String, complete: @escaping KMRequestServerComplete) {
+        let urlString = AIInfoConfig().memberAIActionURL + "/member-system-website/v1/translate/textTrans"
+        let token: String = KMMemberInfo.shared.access_token
+
+        var escapedString = q
+        escapedString = String(data: escapedString.data(using: .utf8)!, encoding: .utf8)!
+        let paraDict = ["text":escapedString,
+                        "from":from,
+                        "to":to,
+                        "uuid":uuid(),
+                        "platform": platform(),
+                        "app_name": app_name()]
+        var postData  = try! JSONSerialization.data(withJSONObject: paraDict)
+ 
+        KMAIRequestServer.requestServer.aiMemberRewriting(urlString: urlString, params: paraDict) { formData in
+            
+        } requestSerializer: { requestSerializer in
+            requestSerializer.setValue("Apifox/1.0.0 (https://www.apifox.cn)", forHTTPHeaderField: "User-Agent")
+            requestSerializer.setValue("Bearer " + token, forHTTPHeaderField: "Authorization")
+        } completion: { task, responseObject, error in
+            if responseObject is KMMemberCenterResult {
+                let resultObjct = responseObject as! KMMemberCenterResult
+                let code = resultObjct.code
+                let message: String = resultObjct.msg ?? ""
+                if code == 200 {
+                    complete(ResultWrapper(success: true, content: message))
+                } else {
+                    complete(ResultWrapper(success: false, content: message))
+                }
+            } else {
+                complete(ResultWrapper(success: false, content: "unknown error"))
+            }
+        }
+    }
+    
     /**
      @abstract重写 & 纠错
      @param content  内容
      @param state  类型
      */
     private func aiRewriting(content: String, state: KMAIRewritingState, complete: @escaping KMRequestServerComplete) {
+        let aiInfo: AIInfo = AIInfoManager.default().aiInfo
         
-        var urlString = AIInfoConfig().aiActionURL + "/api/AI/rewrite"
+        if aiInfo.totalToken - aiInfo.usedTimes > 0 {
+            var urlString = AIInfoConfig().aiActionURL + "/api/AI/rewrite"
+            if state == .correctTypos {
+                urlString = AIInfoConfig().aiActionURL + "/api/AI/correctTypos"
+            }
+            let params: [String: Any] = ["content": content,
+                                         "uuid": uuid(),
+                                         "platform": platform(),
+                                         "app_name": app_name()]
+            
+            KMAIRequestServer.requestServer.aiRewriting(urlString: urlString, params: params) { formData in
+                
+            } requestSerializer: { requestSerializer in
+                requestSerializer.setValue("Apifox/1.0.0 (https://www.apifox.cn)", forHTTPHeaderField: "User-Agent")
+            } completion: { task, responseObject, error in
+                if responseObject != nil {
+                    let data: NSDictionary = responseObject!["data"] as? NSDictionary ?? [:]
+                    let code: String = responseObject!["code"] as? String ?? "06005"
+                    let message: String = responseObject!["message"] as? String ?? "unknown error"
+ 
+                    if Int(code)! == 200 {
+                        complete(ResultWrapper(success: true, content: data["content"] as! String))
+                    } else {
+                        complete(ResultWrapper(success: false, content: message))
+                    }
+                } else {
+                    complete(ResultWrapper(success: false, content: "unknown error"))
+                }
+            }
+        } else {
+            if(KMMemberInfo.shared.isLogin == true) {
+                KMUserInfoViewController.refreshTokenUserInfo {[weak self] success, resDic in
+                    if(success == true) {
+                        self?.aiMemberRewriting(content: content, state: state, complete: complete)
+                    } else {
+                        let code = resDic?.code ?? 200
+                        if(code == 304) {
+                            KMLoginWindowsController.shared.showWindow(nil)
+                        }
+                    }
+                }
+                
+            }
+        }
+    }
+    
+    func aiMemberRewriting(content: String, state: KMAIRewritingState, complete: @escaping KMRequestServerComplete) {
+        let token: String = KMMemberInfo.shared.access_token
+        if token == "" {
+            complete(ResultWrapper(success: false, content: "unknown error"))
+        }
+        var urlString = AIInfoConfig().memberAIActionURL + "/member-system-website/api/rewrite"
         if state == .correctTypos {
-            urlString = AIInfoConfig().aiActionURL + "/api/AI/correctTypos"
+            urlString = AIInfoConfig().memberAIActionURL + "/member-system-website/api/correct-typos"
         }
-        let params: [String: Any] = ["content": content,
-                                     "uuid": uuid(),
-                                     "platform": platform(),
-                                     "app_name": app_name()]
+        let params: [String: Any] = ["content": content]
         
-        KMAIRequestServer.requestServer.aiRewriting(urlString: urlString, params: params) { formData in
+        KMAIRequestServer.requestServer.aiMemberRewriting(urlString: urlString, params: params) { formData in
             
         } requestSerializer: { requestSerializer in
             requestSerializer.setValue("Apifox/1.0.0 (https://www.apifox.cn)", forHTTPHeaderField: "User-Agent")
+            requestSerializer.setValue("Bearer " + token, forHTTPHeaderField: "Authorization")
         } completion: { task, responseObject, error in
-            if responseObject != nil {
-                let data: NSDictionary = responseObject!["data"] as? NSDictionary ?? [:]
-                let code: String = responseObject!["code"] as? String ?? "06005"
-                let message: String = responseObject!["message"] as? String ?? "unknown error"
-                let error = NSError(domain: message, code: Int(code)!)
-//                let result = ResultWrapper(success: true, result: data, message: message, code: Int(code)!, error: error, state: state)
-//                if result.code == 200 {
-//                    result.success = true
-//                    complete(result)
-//                } else {
-//                    result.success = false
-//                    complete(result)
-//                }
-                if Int(code)! == 200 {
-                    complete(ResultWrapper(success: true, content: data["content"] as! String))
+            if responseObject is KMMemberCenterResult {
+                let resultObjct = responseObject as! KMMemberCenterResult
+                let code = resultObjct.code
+                let message: String = resultObjct.msg ?? ""
+                if code == 200 {
+                    complete(ResultWrapper(success: true, content: message))
                 } else {
                     complete(ResultWrapper(success: false, content: message))
                 }
             } else {
-//                let error = NSError(domain: "unknown error", code: 404)
-//                let result = ResultWrapper(success: false, result: [:], message: "unknown error", code: 404, error: error, state: state)
-//                complete(result)
                 complete(ResultWrapper(success: false, content: "unknown error"))
             }
         }
     }
+
     
     /**
      @abstract 提取摘要
@@ -487,14 +699,7 @@ class ResultWrapper: NSObject {
                 let code: Int = responseObject!["code"] as? Int ?? 06005
                 let message: String = responseObject!["message"] as? String ?? "unknown error"
                 let error = NSError(domain: message, code: code)
-//                let result = ResultWrapper(success: true, result: data, message: message, code: Int(code)!, error: error, state: .extractSummaryFile)
-//                if result.code == 200 {
-//                    result.success = true
-//                    complete(result)
-//                } else {
-//                    result.success = false
-//                    complete(result)
-//                }
+ 
                 if code == 200 {
                     complete(ResultWrapper(success: true, content: data["summary"] as! String))
                 } else {
@@ -502,13 +707,47 @@ class ResultWrapper: NSObject {
                 }
             } else {
                 let error = NSError(domain: "unknown error", code: 404)
-//                let result = ResultWrapper(success: false, result: [:], message: "unknown error", code: 404, error: error, state: .extractSummaryFile)
-//                complete(result)
-                complete(ResultWrapper(success: false, content: "unknown error"))
+                 complete(ResultWrapper(success: false, content: "unknown error"))
             }
         }
     }
 
+    private func memberExtractSummaryFile(file: String, complete: @escaping KMRequestServerComplete) {
+        let token: String = KMMemberInfo.shared.access_token
+        if token == "" {
+            return
+        }
+
+        let urlString = AIInfoConfig().memberAIActionURL + "/member-system-website/api/extract-file-summary"
+        let fileData = FileManager.default.contents(atPath: file)
+        let params: [String: Any] = ["file": fileData]
+        
+        KMAIRequestServer.requestServer.uploadFile(urlString: urlString, params: params) { formData in
+            let fileURL = URL(fileURLWithPath: file)
+            try? formData.appendPart(withFileURL: fileURL, name: "file", fileName: fileURL.lastPathComponent, mimeType: "application/octet-stream")
+        } requestSerializer: { requestSerializer in
+            requestSerializer.setValue("Apifox/1.0.0 (https://www.apifox.cn)", forHTTPHeaderField: "User-Agent")
+            requestSerializer.setValue("Bearer " + token, forHTTPHeaderField: "Authorization")
+        } completion: { task, responseObject, error in
+            if responseObject != nil {
+                let data: NSDictionary = responseObject!["data"] as? NSDictionary ?? [:]
+                let code: Int = responseObject!["code"] as? Int ?? 06005
+                let message: String = responseObject!["message"] as? String ?? "unknown error"
+                let error = NSError(domain: message, code: code)
+ 
+                if code == 200 {
+                    complete(ResultWrapper(success: true, content: data["summary"] as! String))
+                } else {
+                    complete(ResultWrapper(success: false, content: message))
+                }
+            } else {
+                let error = NSError(domain: "unknown error", code: 404)
+                 complete(ResultWrapper(success: false, content: "unknown error"))
+            }
+        }
+    }
+    
+    
 }
 
 //typealias KMHttpRequestServerComplete = (_ task: URLSessionDataTask?, _ responseObject: AnyObject?, _ error: NSError?) -> Void
@@ -570,7 +809,7 @@ class KMAIRequestServer {
             }
         }
     }
-    
+     
     /**
      文件翻译
      */
@@ -661,4 +900,69 @@ class KMAIRequestServer {
             }
         }
     }
+    
+    func aiMemberRewriting(urlString: String,
+                           params: Dictionary<String, Any>?,
+                           body: ((_ formData:AFMultipartFormData) -> Void)?,
+                           requestSerializer: ((_ requestSerializer:AFHTTPRequestSerializer) -> Void)?,
+                           completion: KMHttpRequestServerComplete?) -> Void {
+        
+        let token: String = KMMemberInfo.shared.access_token
+        
+        let urlString = urlString
+        let paraDict: [String: Any] = params!
+        let postData  = try! JSONSerialization.data(withJSONObject: paraDict)
+        
+        var request = URLRequest(url: URL(string: urlString)!,timeoutInterval: Double.infinity)
+        request.addValue("application/json", forHTTPHeaderField: "Content-Type")
+        
+        request.addValue("Apifox/1.0.0 (https://www.apifox.cn)", forHTTPHeaderField: "User-Agent")
+        request.addValue("Bearer " + token, forHTTPHeaderField: "Authorization")
+        request.httpMethod = "POST"
+        request.httpBody = postData
+        
+        let task = URLSession.shared.dataTask(with: request) { data, response, error in
+           guard let data = data else {
+               print(String(describing: error))
+               return
+           }
+            let jsonObject = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary ?? [:]
+            if jsonObject != nil {
+                let codeStr: String = jsonObject!["code"] as? String ?? ""
+                var code: Int = 0
+                if let numCode = Int(codeStr) {
+                    code = numCode
+                }
+                var result_bool: Bool = true
+                
+                var message: String = ""
+                if let value = jsonObject!["message"]{
+                    message = value as! String
+                }
+                if let string = jsonObject!["data"] {
+                    let dataDic = jsonObject!["data"] as? NSDictionary ?? [:]
+                    if let dataStr = dataDic["content"] {
+                        message = dataStr as! String
+                        result_bool = true
+                    }
+                }
+                let result = KMMemberCenterResult(code: code, msg: message, result: result_bool)
+                if code == 200 {
+                    if (completion != nil) {
+                        completion!(nil, result, nil);
+                    }
+                } else {
+                    if (completion != nil) {
+                        completion!(nil, nil, error as? NSError);
+                    }
+                }
+            } else {
+                if (completion != nil) {
+                    completion!(nil, nil, error as? NSError);
+                }
+            }
+        }
+        task.resume()
+         
+    }
 }

+ 6 - 0
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Other/Purchase/Contents.json

@@ -0,0 +1,6 @@
+{
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

+ 22 - 0
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Other/Purchase/KMImageNamePurchaseImage.imageset/Contents.json

@@ -0,0 +1,22 @@
+{
+  "images" : [
+    {
+      "filename" : "Frame 1000007032.pdf",
+      "idiom" : "universal"
+    },
+    {
+      "appearances" : [
+        {
+          "appearance" : "luminosity",
+          "value" : "dark"
+        }
+      ],
+      "filename" : "Frame 1000007033.pdf",
+      "idiom" : "universal"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Other/Purchase/KMImageNamePurchaseImage.imageset/Frame 1000007032.pdf


BIN
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Other/Purchase/KMImageNamePurchaseImage.imageset/Frame 1000007033.pdf


+ 22 - 0
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Other/Purchase/KMImageNamePurchaseImage2.imageset/Contents.json

@@ -0,0 +1,22 @@
+{
+  "images" : [
+    {
+      "filename" : "Frame 1000007031.pdf",
+      "idiom" : "universal"
+    },
+    {
+      "appearances" : [
+        {
+          "appearance" : "luminosity",
+          "value" : "dark"
+        }
+      ],
+      "filename" : "Frame 1000007032.pdf",
+      "idiom" : "universal"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Other/Purchase/KMImageNamePurchaseImage2.imageset/Frame 1000007031.pdf


BIN
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Other/Purchase/KMImageNamePurchaseImage2.imageset/Frame 1000007032.pdf


+ 22 - 0
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Other/Purchase/KMImageNamePurchaseSuccessIcon.imageset/Contents.json

@@ -0,0 +1,22 @@
+{
+  "images" : [
+    {
+      "filename" : "success.pdf",
+      "idiom" : "universal"
+    },
+    {
+      "appearances" : [
+        {
+          "appearance" : "luminosity",
+          "value" : "dark"
+        }
+      ],
+      "filename" : "success 1.pdf",
+      "idiom" : "universal"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

+ 86 - 0
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Other/Purchase/KMImageNamePurchaseSuccessIcon.imageset/success 1.pdf

@@ -0,0 +1,86 @@
+%PDF-1.7
+
+1 0 obj
+  << >>
+endobj
+
+2 0 obj
+  << /Length 3 0 R >>
+stream
+/DeviceRGB CS
+/DeviceRGB cs
+q
+1.000000 0.000000 -0.000000 1.000000 2.909180 2.909058 cm
+0.235294 0.803922 0.458824 scn
+29.090910 58.181763 m
+13.024418 58.181763 0.000000 45.157345 0.000000 29.090853 c
+0.000000 13.024361 13.024418 -0.000057 29.090910 -0.000057 c
+45.157402 -0.000057 58.181820 13.024361 58.181820 29.090853 c
+58.181820 45.157345 45.157402 58.181763 29.090910 58.181763 c
+h
+14.886293 29.049620 m
+14.431865 29.504047 14.431864 30.240824 14.886292 30.695251 c
+18.177551 33.986511 l
+18.631979 34.440941 19.368753 34.440941 19.823183 33.986511 c
+26.576174 27.233522 l
+39.728943 40.386292 l
+40.183369 40.840721 40.920143 40.840721 41.374573 40.386292 c
+44.665833 37.095032 l
+45.120262 36.640602 45.120262 35.903831 44.665833 35.449402 c
+27.386717 18.170284 l
+26.932289 17.715855 26.195515 17.715855 25.741085 18.170284 c
+22.449825 21.461544 l
+22.401272 21.510098 22.357904 21.561874 22.319727 21.616184 c
+14.886293 29.049620 l
+h
+f*
+n
+Q
+
+endstream
+endobj
+
+3 0 obj
+  945
+endobj
+
+4 0 obj
+  << /Annots []
+     /Type /Page
+     /MediaBox [ 0.000000 0.000000 64.000000 64.000000 ]
+     /Resources 1 0 R
+     /Contents 2 0 R
+     /Parent 5 0 R
+  >>
+endobj
+
+5 0 obj
+  << /Kids [ 4 0 R ]
+     /Count 1
+     /Type /Pages
+  >>
+endobj
+
+6 0 obj
+  << /Pages 5 0 R
+     /Type /Catalog
+  >>
+endobj
+
+xref
+0 7
+0000000000 65535 f
+0000000010 00000 n
+0000000034 00000 n
+0000001035 00000 n
+0000001057 00000 n
+0000001230 00000 n
+0000001304 00000 n
+trailer
+<< /ID [ (some) (id) ]
+   /Root 6 0 R
+   /Size 7
+>>
+startxref
+1363
+%%EOF

+ 86 - 0
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Other/Purchase/KMImageNamePurchaseSuccessIcon.imageset/success.pdf

@@ -0,0 +1,86 @@
+%PDF-1.7
+
+1 0 obj
+  << >>
+endobj
+
+2 0 obj
+  << /Length 3 0 R >>
+stream
+/DeviceRGB CS
+/DeviceRGB cs
+q
+1.000000 0.000000 -0.000000 1.000000 2.909180 2.909058 cm
+0.235294 0.803922 0.458824 scn
+29.090910 58.181763 m
+13.024418 58.181763 0.000000 45.157345 0.000000 29.090853 c
+0.000000 13.024361 13.024418 -0.000057 29.090910 -0.000057 c
+45.157402 -0.000057 58.181820 13.024361 58.181820 29.090853 c
+58.181820 45.157345 45.157402 58.181763 29.090910 58.181763 c
+h
+14.886293 29.049620 m
+14.431865 29.504047 14.431864 30.240824 14.886292 30.695251 c
+18.177551 33.986511 l
+18.631979 34.440941 19.368753 34.440941 19.823183 33.986511 c
+26.576174 27.233522 l
+39.728943 40.386292 l
+40.183369 40.840721 40.920143 40.840721 41.374573 40.386292 c
+44.665833 37.095032 l
+45.120262 36.640602 45.120262 35.903831 44.665833 35.449402 c
+27.386717 18.170284 l
+26.932289 17.715855 26.195515 17.715855 25.741085 18.170284 c
+22.449825 21.461544 l
+22.401272 21.510098 22.357904 21.561874 22.319727 21.616184 c
+14.886293 29.049620 l
+h
+f*
+n
+Q
+
+endstream
+endobj
+
+3 0 obj
+  945
+endobj
+
+4 0 obj
+  << /Annots []
+     /Type /Page
+     /MediaBox [ 0.000000 0.000000 64.000000 64.000000 ]
+     /Resources 1 0 R
+     /Contents 2 0 R
+     /Parent 5 0 R
+  >>
+endobj
+
+5 0 obj
+  << /Kids [ 4 0 R ]
+     /Count 1
+     /Type /Pages
+  >>
+endobj
+
+6 0 obj
+  << /Pages 5 0 R
+     /Type /Catalog
+  >>
+endobj
+
+xref
+0 7
+0000000000 65535 f
+0000000010 00000 n
+0000000034 00000 n
+0000001035 00000 n
+0000001057 00000 n
+0000001230 00000 n
+0000001304 00000 n
+trailer
+<< /ID [ (some) (id) ]
+   /Root 6 0 R
+   /Size 7
+>>
+startxref
+1363
+%%EOF

+ 2 - 2
PDF Office/PDF Master/Class/Batch/Data/KMBatchConvertParameter.swift

@@ -111,7 +111,7 @@ class KMBatchConvertParameter: KMBatchBaseParameter {
         var isLimitConvert = false
 #if VERSION_FREE
         //         桌机版
-        if IAPProductsManager.default().isAvailableAdvancedPDFToOffice() {
+        if KMMemberInfo.shared.isPermitConvert {
             isLimitConvert = false
         } else {
             if .PNG == self.convertType ||
@@ -127,7 +127,7 @@ class KMBatchConvertParameter: KMBatchBaseParameter {
         }
 #else
         //         付费版
-        if IAPProductsManager.default().isAvailableAdvancedPDFToOffice() {
+        if KMMemberInfo.shared.isPermitConvert {
             isLimitConvert = false
         } else {
             if .PNG == self.convertType ||

+ 2 - 2
PDF Office/PDF Master/Class/Batch/View/KMBatchoperateConvertCollectionViewItem.swift

@@ -48,8 +48,8 @@ class KMBatchoperateConvertCollectionViewItem: NSCollectionViewItem{
     }
     
     @IBAction func buttonClicked_AdvancedClicked(_ sender: Any) {
-        if !IAPProductsManager.default().isAvailableAdvancedPDFToOffice() {
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+        if !KMMemberInfo.shared.isPermitConvert {
+            KMMemberInfo.shared.advancedFunctionUsage()
         }
     }
 

+ 2 - 6
PDF Office/PDF Master/Class/Batch/View/KMConvertCollectionViewHeader.swift

@@ -36,10 +36,6 @@ class KMConvertCollectionViewHeader: KMBaseXibView{
         super.awakeFromNib()
 
         containerView.wantsLayer = true
-//        containerView.layer?.cornerRadius = 12
-//                if IAPProductsManager.defaultManager().isAvailableAdvancedPDFToOffice {
-//                    containerView.isHidden = true
-//                }
 //        购买状态变化通知
         self.layerColorView.wantsLayer = true
         self.layerColorView.layer?.masksToBounds = true
@@ -67,14 +63,14 @@ class KMConvertCollectionViewHeader: KMBaseXibView{
         let point = event.locationInWindow
         let newPoint = convert(point, from: nil)
         if let data = self.containerView?.frame.contains(newPoint), data {
-            if !IAPProductsManager.default().isAvailableAdvancedPDFToOffice() {
+            if !KMMemberInfo.shared.isPermitConvert {
                 self.convertHeaderClickedCallBack?()
             }
         }
     }
     
     func refreshData() {
-        if IAPProductsManager.default().isAvailableAdvancedPDFToOffice() {
+        if KMMemberInfo.shared.isPermitConvert {
             containerView.isHidden = true
         } else {
             containerView.isHidden = false

+ 9 - 12
PDF Office/PDF Master/Class/Batch/WindowController/KMBatchOperateLeftViewController.swift

@@ -164,13 +164,13 @@ class KMBatchOperateLeftViewController: NSViewController,NSTableViewDelegate,NST
     
     func chooseFile() {
 #if VERSION_FREE
-        if !IAPProductsManager.default().isAvailableAllFunction() {
+        if KMMemberInfo.shared.isMemberAllFunction == false {
             if files.count >= 1 {
-                let winC = KMPurchaseCompareWindowController.sharedInstance()
+                let winC = KMProductCompareWC.shared
                 if type == .CreatePDF {
-                    winC?.kEventName = "Onbrd_ImagetoPDF_BuyNow"
+                    winC.kEventName = "Onbrd_ImagetoPDF_BuyNow"
                 }
-                winC?.showWindow(nil)
+                KMMemberInfo.shared.advancedFunctionUsage()
                 return
             }
         }
@@ -182,7 +182,7 @@ class KMBatchOperateLeftViewController: NSViewController,NSTableViewDelegate,NST
         } else {
             panel.allowedFileTypes = ["pdf", "PDF"]
         }
-        if IAPProductsManager.default().isAvailableAllFunction() {
+        if KMMemberInfo.shared.isMemberAllFunction {
             panel.allowsMultipleSelection = true
             panel.canChooseDirectories = true
         }
@@ -460,21 +460,18 @@ class KMBatchOperateLeftViewController: NSViewController,NSTableViewDelegate,NST
         for i in 0..<documentArray.count {
             let document = documentArray[i]
             let path: String = document.fileURL?.path ?? ""
-//            let UTTypeString = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, path!.customPathExtension as CFString, nil)
             let UTTypeString = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, path.customPathExtension as CFString, nil)?.takeRetainedValue() as String?
             let TypeCFString = UTTypeString as CFString?
             if UTTypeConformsTo(TypeCFString!, kUTTypePDF) {
                 pdfArray.add(path as Any)
-//                UTTypeString?.release()
             } else {
-//                UTTypeString?.release()
             }
         }
-        if !IAPProductsManager.default().isAvailableAllFunction() {
+        if KMMemberInfo.shared.isMemberAllFunction == false {
             if self.files.count < 1 {
                 pdfArray = NSMutableArray(array: [pdfArray.firstObject as Any])
             } else {
-                KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+                KMMemberInfo.shared.advancedFunctionUsage()
                 return
             }
         }
@@ -720,13 +717,13 @@ class KMBatchOperateLeftViewController: NSViewController,NSTableViewDelegate,NST
                     }
                 }
             }
-            if !(IAPProductsManager.default().isAvailableAllFunction)() {
+            if KMMemberInfo.shared.isMemberAllFunction == false {
                 if self.files.count < 1 && insertArray.count > 0 {
                     let firstObject = insertArray.firstObject
                     insertArray.removeAllObjects()
                     insertArray.add(firstObject as Any)
                 } else {
-                    KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+                    KMMemberInfo.shared.advancedFunctionUsage()
                     return false
                 }
             }

+ 1 - 1
PDF Office/PDF Master/Class/Batch/WindowController/KMBatchOperateWindowController.swift

@@ -320,7 +320,7 @@ let kBatchOperateToolbar_BatesIdentifier = "kBatchOperateToolbar_BatesIdentifier
         
         wc.switchToOperateType(.Convert, files:KMBatchOperateManager.defaultManager.files!)
         
-        wc.switchToConvertType(convertType: IAPProductsManager.default().isAvailableAdvancedPDFToOffice() ? .WordAdvance : .WordStandard)
+        wc.switchToConvertType(convertType: KMMemberInfo.shared.isPermitConvert ? .WordAdvance : .WordStandard)
         
         wc.updateViewColor()
         

+ 38 - 47
PDF Office/PDF Master/Class/Batch/WindowController/VC/KMBatchOperateConvertViewController.swift

@@ -152,8 +152,8 @@ class KMBatchOperateConvertViewController: KMBatchOperateBaseViewController{
 #if VERSION_FREE
 #if VERSION_DMG
         // 桌机版
-        if IAPProductsManager.default().isAvailableAllFunction() {
-            if IAPProductsManager.default().isAvailableAdvancedPDFToOffice() {
+        if KMMemberInfo.shared.isMemberAllFunction {
+            if KMMemberInfo.shared.isPermitConvert {
             } else {
                 isShowUpgrade = true
             }
@@ -162,8 +162,8 @@ class KMBatchOperateConvertViewController: KMBatchOperateBaseViewController{
         }
 #else
         // 免费版
-        if IAPProductsManager.default().isAvailableAllFunction() {
-            if IAPProductsManager.default().isAvailableAdvancedPDFToOffice() {
+        if KMMemberInfo.shared.isMemberAllFunction {
+            if KMMemberInfo.shared.isPermitConvert {
             } else {
                 isShowUpgrade = true
             }
@@ -173,25 +173,18 @@ class KMBatchOperateConvertViewController: KMBatchOperateBaseViewController{
         
 #endif
 #else
-        if IAPProductsManager.default().isAvailableAdvancedPDFToOffice() {
+        if KMMemberInfo.shared.isPermitConvert {
         } else {
             isShowUpgrade = true
         }
 #endif
-//        if !isShowUpgrade {
-//            headerView.isHidden = true
-//            headerTopOffset.constant = 0
-//        } else {
-//            headerView.isHidden = false
-//            headerTopOffset.constant = self.headerView.frame.height
-//        }
 
         var moreLabelString = ""
 #if VERSION_FREE
-        if !IAPProductsManager.default().isAvailableAllFunction() {
+        if !KMMemberInfo.shared.isMemberAllFunction {
             moreLabelString = String(format: "%@ %@", KMLocalizedString("The first 10 pages for free"), KMLocalizedString("Unlimited Convert"))
-        }else {
-            if !IAPProductsManager.default().isAvailableAdvancedPDFToOffice() {
+        } else {
+            if !KMMemberInfo.shared.isPermitConvert {
                 if .WordAdvance == self.convertType ||
                     .WordStandard == self.convertType ||
                     .Excel == self.convertType ||
@@ -210,7 +203,7 @@ class KMBatchOperateConvertViewController: KMBatchOperateBaseViewController{
         }
 #else
         // 付费版
-        if !IAPProductsManager.default().isAvailableAdvancedPDFToOffice() {
+        if !KMMemberInfo.shared.isPermitConvert {
             if .WordAdvance == self.convertType ||
                 .WordStandard == self.convertType ||
                 .Excel == self.convertType ||
@@ -407,20 +400,9 @@ class KMBatchOperateConvertViewController: KMBatchOperateBaseViewController{
     }
     
     func convertActionVC() {
-        var vc: KMToolCompareWindowController? = nil
-        if(.WordStandard == self.convertType ||
-            .WordAdvance == self.convertType) {
-            vc = KMToolCompareWindowController(toolType: .Convert, selectNum: 1)
-        } else if (.Excel == self.convertType) {
-            vc = KMToolCompareWindowController(toolType: .Convert, selectNum: 2)
-        } else if (.PowerPoint == self.convertType) {
-            vc = KMToolCompareWindowController(toolType: .Convert, selectNum: 3)
-        } else if (self.convertType == .JPG || self.convertType == .PNG || self.convertType == .GIF || self.convertType == .TIFF || self.convertType == .TGA || self.convertType == .BMP){
-            vc = KMToolCompareWindowController(toolType: .Convert, selectNum: 4)
-        } else {
-            vc = KMToolCompareWindowController(toolType: .Convert, selectNum: 0)
+        if(KMMemberInfo.shared.isLogin == false) {
+            KMLoginWindowsController.shared.showWindow(nil)
         }
-        vc?.showWindow(nil)
     }
     
     func prepareData() {
@@ -432,14 +414,14 @@ class KMBatchOperateConvertViewController: KMBatchOperateBaseViewController{
         
 #if VERSION_FREE
         // 桌机版
-        if IAPProductsManager.default().isAvailableAllFunction() {
-            if IAPProductsManager.default().isAvailableAdvancedPDFToOffice() {
+        if KMMemberInfo.shared.isMemberAllFunction {
+            if KMMemberInfo.shared.isPermitConvert {
                 needShowAdvance = true
                 needShowDefault = false
             }
         }
 #else
-        if IAPProductsManager.default().isAvailableAdvancedPDFToOffice() {
+        if KMMemberInfo.shared.isPermitConvert {
             needShowAdvance = true
             needShowDefault = false
         }
@@ -463,16 +445,16 @@ class KMBatchOperateConvertViewController: KMBatchOperateBaseViewController{
 #if VERSION_DMG
         // 桌机版
         isShowAdvanced = true
-        if IAPProductsManager.default().isAvailableAllFunction() {
-            if IAPProductsManager.default().isAvailableAdvancedPDFToOffice() {
+        if KMMemberInfo.shared.isMemberAllFunction {
+            if KMMemberInfo.shared.isPermitConvert {
                 isShowAdvanced = false
             }
         }
 #else
         // 免费版
         isShowAdvanced = true
-        if IAPProductsManager.default().isAvailableAllFunction() {
-            if IAPProductsManager.default().isAvailableAdvancedPDFToOffice() {
+        if KMMemberInfo.shared.isMemberAllFunction {
+            if KMMemberInfo.shared.isPermitConvert {
                 isShowAdvanced = false
             }
         }
@@ -480,7 +462,7 @@ class KMBatchOperateConvertViewController: KMBatchOperateBaseViewController{
 #endif
 #else
         isShowAdvanced = true
-        if IAPProductsManager.default().isAvailableAdvancedPDFToOffice() {
+        if KMMemberInfo.shared.isPermitConvert {
             isShowAdvanced = false
         }
 #endif
@@ -630,6 +612,14 @@ class KMBatchOperateConvertViewController: KMBatchOperateBaseViewController{
         }
     }
     
+    @IBAction func buttonClicked_MoreConvert(_ sender: NSButton) {
+        if KMMemberInfo.shared.isMemberAllFunction == true {
+            if(KMMemberInfo.shared.isLogin == false) {
+                KMLoginWindowsController.shared.showWindow(nil)
+            }
+        }
+    }
+    
     @IBAction func buttonClicked_excelStyle(_ sender: NSButton) {
         if sender == onlyTextBtn {
             onlyTextBtn.state = NSControl.StateValue.on
@@ -710,9 +700,9 @@ class KMBatchOperateConvertViewController: KMBatchOperateBaseViewController{
     }
     
     func moreConvertInfoAction() {
-        if IAPProductsManager.default().isAvailableAdvancedPDFToOffice() == false {
+        if KMMemberInfo.shared.isPermitConvert == false {
 #if VERSION_DMG
-            if IAPProductsManager.default().isAvailableAllFunction() && IAPProductsManager.default().isAvailableAdvancedPDFToOffice() == false {
+            if KMMemberInfo.shared.isMemberAllFunction && KMMemberInfo.shared.isPermitConvert == false {
                 let limitWC = KMPurchaseLimitWindowController.currentLimitWC()
                 limitWC.continueBlock = { windowController in
                     
@@ -720,26 +710,27 @@ class KMBatchOperateConvertViewController: KMBatchOperateBaseViewController{
                 limitWC.window?.center()
                 limitWC.showWindow(nil)
             }else{
-                let winC = KMPurchaseCompareWindowController.sharedInstance()
+                KMProductCompareWC.shared.orientation = false
+                let winC = KMProductCompareWC.shared
                 if let viewC = self.view.window?.contentViewController, viewC.kEventTag == 1 {
-                    winC?.kEventName = "Onbrd_ConvertPDF_BuyNow"
+                    winC.kEventName = "Onbrd_ConvertPDF_BuyNow"
                 } else {
                     if convertType == .WordStandard || convertType == .WordAdvance {
-                        winC?.kEventName = "Onbrd_PDFtoWord_BuyNow"
+                        winC.kEventName = "Onbrd_PDFtoWord_BuyNow"
                     } else if convertType == .Excel {
-                        winC?.kEventName = "Onbrd_PDFtoExcel_BuyNow"
+                        winC.kEventName = "Onbrd_PDFtoExcel_BuyNow"
                     } else if convertType == .PowerPoint {
-                        winC?.kEventName = "Onbrd_PDFtoPPT_BuyNow"
+                        winC.kEventName = "Onbrd_PDFtoPPT_BuyNow"
                     }
                 }
                 
-                winC?.showWindow(nil)
+                winC.showWindow(nil)
             }
 #else
-            if IAPProductsManager.default().isAvailableAllFunction() {
+            if KMMemberInfo.shared.isPermitConvert {
                 self.convertActionVC()
             } else {
-                KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+                KMMemberInfo.shared.advancedFunctionUsage()
             }
 #endif
         }

+ 36 - 33
PDF Office/PDF Master/Class/Batch/WindowController/VC/KMBatchOperateConvertViewController.xib

@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21507" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="23504" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
     <dependencies>
         <deployment identifier="macosx"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21507"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="23504"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
@@ -44,32 +44,32 @@
         <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
         <customObject id="-3" userLabel="Application" customClass="NSObject"/>
         <customView id="Hz6-mo-xeY">
-            <rect key="frame" x="0.0" y="0.0" width="334" height="575"/>
+            <rect key="frame" x="0.0" y="0.0" width="340" height="575"/>
             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
             <subviews>
                 <customView translatesAutoresizingMaskIntoConstraints="NO" id="RWh-gu-eYa">
-                    <rect key="frame" x="0.0" y="0.0" width="334" height="525"/>
+                    <rect key="frame" x="0.0" y="0.0" width="340" height="525"/>
                     <subviews>
                         <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="x4l-h4-1bj">
-                            <rect key="frame" x="16" y="16" width="302" height="32"/>
-                            <constraints>
-                                <constraint firstAttribute="height" constant="32" id="SUn-Xj-aci"/>
-                            </constraints>
+                            <rect key="frame" x="16" y="16" width="308" height="32"/>
                             <buttonCell key="cell" type="square" title="Button" bezelStyle="shadowlessSquare" alignment="center" imageScaling="proportionallyDown" inset="2" id="46F-Eo-5Pf">
                                 <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                 <font key="font" metaFont="system"/>
                             </buttonCell>
+                            <constraints>
+                                <constraint firstAttribute="height" constant="32" id="SUn-Xj-aci"/>
+                            </constraints>
                             <connections>
                                 <action selector="buttonClicked_Convert:" target="-2" id="Lwc-MC-9me"/>
                             </connections>
                         </button>
                         <box borderType="none" title="Box" titlePosition="noTitle" translatesAutoresizingMaskIntoConstraints="NO" id="CFq-W0-Zmt">
-                            <rect key="frame" x="7" y="421" width="320" height="96"/>
+                            <rect key="frame" x="10" y="419" width="320" height="96"/>
                             <view key="contentView" id="nMO-Go-Yia">
                                 <rect key="frame" x="0.0" y="0.0" width="320" height="96"/>
                                 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                 <subviews>
-                                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="QnU-CY-IXa">
+                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="QnU-CY-IXa">
                                         <rect key="frame" x="8" y="80" width="47" height="16"/>
                                         <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Format" id="L4l-l6-Cwv">
                                             <font key="font" metaFont="system"/>
@@ -102,16 +102,19 @@
                                             <subviews>
                                                 <button translatesAutoresizingMaskIntoConstraints="NO" id="NEt-WC-ZBS">
                                                     <rect key="frame" x="0.0" y="17" width="20" height="14"/>
-                                                    <constraints>
-                                                        <constraint firstAttribute="height" constant="14" id="JCq-cE-ega"/>
-                                                        <constraint firstAttribute="width" constant="20" id="hrx-ih-W3K"/>
-                                                    </constraints>
                                                     <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="KMImageNameElsei" imagePosition="only" alignment="center" imageScaling="proportionallyUpOrDown" inset="2" id="DQY-j6-yh4">
                                                         <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                                         <font key="font" metaFont="system"/>
                                                     </buttonCell>
+                                                    <constraints>
+                                                        <constraint firstAttribute="height" constant="14" id="JCq-cE-ega"/>
+                                                        <constraint firstAttribute="width" constant="20" id="hrx-ih-W3K"/>
+                                                    </constraints>
+                                                    <connections>
+                                                        <action selector="moreButtonAction:" target="-2" id="9u4-j3-jvc"/>
+                                                    </connections>
                                                 </button>
-                                                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="l7W-85-8as">
+                                                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="l7W-85-8as">
                                                     <rect key="frame" x="23" y="0.0" width="279" height="34"/>
                                                     <textFieldCell key="cell" title="Export PDF to Word and other Microsoft Office formats" id="pwH-2G-D1M">
                                                         <font key="font" metaFont="system"/>
@@ -162,13 +165,13 @@
                             </view>
                         </box>
                         <box hidden="YES" boxType="custom" borderWidth="0.0" title="Box" titlePosition="noTitle" translatesAutoresizingMaskIntoConstraints="NO" id="ibJ-Ae-4ze">
-                            <rect key="frame" x="10" y="368" width="314" height="52"/>
+                            <rect key="frame" x="10" y="362" width="320" height="52"/>
                             <view key="contentView" id="wyk-JI-a7n">
-                                <rect key="frame" x="0.0" y="0.0" width="314" height="52"/>
+                                <rect key="frame" x="0.0" y="0.0" width="320" height="52"/>
                                 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                 <subviews>
                                     <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="25B-gC-8fw">
-                                        <rect key="frame" x="8" y="35" width="296" height="18"/>
+                                        <rect key="frame" x="8" y="35" width="302" height="18"/>
                                         <buttonCell key="cell" type="radio" title="Convert each page to a separate worksheet" bezelStyle="regularSquare" imagePosition="left" alignment="left" state="on" inset="2" id="1mv-Zc-aNk">
                                             <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
                                             <font key="font" metaFont="system"/>
@@ -178,7 +181,7 @@
                                         </connections>
                                     </button>
                                     <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="W18-qh-sPN">
-                                        <rect key="frame" x="8" y="9" width="296" height="18"/>
+                                        <rect key="frame" x="8" y="9" width="302" height="18"/>
                                         <buttonCell key="cell" type="radio" title="Convert all pages to a single worksheet(.xlsx)" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="QLl-EC-oIz">
                                             <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
                                             <font key="font" metaFont="system"/>
@@ -201,17 +204,13 @@
                             <font key="titleFont" metaFont="system"/>
                         </box>
                         <box boxType="custom" borderWidth="0.0" title="Box" titlePosition="noTitle" translatesAutoresizingMaskIntoConstraints="NO" id="uy4-Qr-7eJ">
-                            <rect key="frame" x="10" y="342" width="314" height="78"/>
+                            <rect key="frame" x="10" y="336" width="320" height="78"/>
                             <view key="contentView" id="R8m-s9-ne3">
-                                <rect key="frame" x="0.0" y="0.0" width="314" height="78"/>
+                                <rect key="frame" x="0.0" y="0.0" width="320" height="78"/>
                                 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                 <subviews>
                                     <popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="9la-KC-6B2">
                                         <rect key="frame" x="105" y="56" width="142" height="25"/>
-                                        <constraints>
-                                            <constraint firstAttribute="width" relation="lessThanOrEqual" constant="135" id="JWV-qB-ggN"/>
-                                            <constraint firstAttribute="height" constant="20" id="fWe-45-Ym6"/>
-                                        </constraints>
                                         <popUpButtonCell key="cell" type="push" title="For Each Page" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="epp-Ft-5F3" id="xeQ-6P-lCV">
                                             <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
                                             <font key="font" metaFont="menu"/>
@@ -222,6 +221,10 @@
                                                 </items>
                                             </menu>
                                         </popUpButtonCell>
+                                        <constraints>
+                                            <constraint firstAttribute="width" relation="lessThanOrEqual" constant="135" id="JWV-qB-ggN"/>
+                                            <constraint firstAttribute="height" constant="20" id="fWe-45-Ym6"/>
+                                        </constraints>
                                         <connections>
                                             <action selector="buttonClickec_allContentMenu:" target="-2" id="eQx-K2-gok"/>
                                         </connections>
@@ -248,10 +251,6 @@
                                     </button>
                                     <popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="7w3-37-Dma">
                                         <rect key="frame" x="96" y="30" width="152" height="25"/>
-                                        <constraints>
-                                            <constraint firstAttribute="width" constant="145" id="2cD-S3-EPI"/>
-                                            <constraint firstAttribute="height" constant="20" id="tN7-9c-6nd"/>
-                                        </constraints>
                                         <popUpButtonCell key="cell" type="push" title="For Each Table" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="lcq-HI-HHW" id="92O-me-cxZ">
                                             <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
                                             <font key="font" metaFont="menu"/>
@@ -263,6 +262,10 @@
                                                 </items>
                                             </menu>
                                         </popUpButtonCell>
+                                        <constraints>
+                                            <constraint firstAttribute="width" constant="145" id="2cD-S3-EPI"/>
+                                            <constraint firstAttribute="height" constant="20" id="tN7-9c-6nd"/>
+                                        </constraints>
                                         <connections>
                                             <action selector="buttonClicked_tableMenu:" target="-2" id="Wev-Mw-MFp"/>
                                         </connections>
@@ -297,7 +300,7 @@
                             <font key="titleFont" metaFont="system"/>
                         </box>
                         <button hidden="YES" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="9oz-Jm-qNR">
-                            <rect key="frame" x="13" y="403" width="306" height="18"/>
+                            <rect key="frame" x="13" y="397" width="312" height="18"/>
                             <buttonCell key="cell" type="check" title="Check" bezelStyle="regularSquare" imagePosition="left" inset="2" id="SV4-we-las">
                                 <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
                                 <font key="font" metaFont="system"/>
@@ -307,7 +310,7 @@
                             </connections>
                         </button>
                         <box borderType="none" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="pvL-bb-6g1">
-                            <rect key="frame" x="7" y="168" width="320" height="104"/>
+                            <rect key="frame" x="10" y="165" width="320" height="101"/>
                             <view key="contentView" id="wNe-bc-ZiD">
                                 <rect key="frame" x="0.0" y="0.0" width="320" height="87"/>
                                 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
@@ -322,7 +325,7 @@
                                             <action selector="comboxClicked_SupoortOCR:" target="-2" id="Pkn-i5-sfR"/>
                                         </connections>
                                     </button>
-                                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="IFE-Qi-wNe">
+                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="IFE-Qi-wNe">
                                         <rect key="frame" x="18" y="35" width="294" height="16"/>
                                         <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Document Language:" id="cJh-KZ-pao">
                                             <font key="font" metaFont="system"/>
@@ -508,7 +511,7 @@
                     </constraints>
                 </customView>
                 <customView translatesAutoresizingMaskIntoConstraints="NO" id="HlZ-Fb-Ttq" customClass="KMConvertCollectionViewHeader" customModule="PDF_Reader_Pro" customModuleProvider="target">
-                    <rect key="frame" x="0.0" y="525" width="334" height="50"/>
+                    <rect key="frame" x="0.0" y="525" width="340" height="50"/>
                     <constraints>
                         <constraint firstAttribute="height" constant="50" id="H2J-A1-Bx6"/>
                     </constraints>

+ 6 - 4
PDF Office/PDF Master/Class/Batch/WindowController/VC/KMBatchOperateImageToPDFViewController.swift

@@ -378,11 +378,12 @@ class KMBatchOperateImageToPDFViewController: KMBatchOperateBaseViewController,
     
     @IBAction func buttonClicked_OCRSelect(_ sender: NSButton) {
         //MARK: 判断是否付费用户
-        if IAPProductsManager.default().isAvailableAllFunction() == false {
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            KMMemberInfo.shared.advancedFunctionUsage()
             self.ocrSelectBtn.state = .off
             return
         }
+
         if (sender.state == .on) {
             self.languageButton.isEnabled = true
             self.planButton.isEnabled = true
@@ -423,10 +424,11 @@ class KMBatchOperateImageToPDFViewController: KMBatchOperateBaseViewController,
         if self.files?.count ?? 0 < 1 {
             return
         }
-        if IAPProductsManager.default().isAvailableAllFunction() == false && self.files?.count ?? 0 > 1{
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+        if KMMemberInfo.shared.isMemberAllFunction == false && self.files?.count ?? 0 > 1 {
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
+
         if sender.tag == 1 {
             self.choosePath = ""
             var hasTask = false

+ 15 - 1
PDF Office/PDF Master/Class/Batch/WindowController/VC/KMToolbarItemPopViewController.swift

@@ -10,6 +10,20 @@ import Cocoa
 class KMToolbarItemPopViewController: NSViewController{
     @IBOutlet var toolbarHelpTipLabel: NSTextField!
     
+    @IBOutlet weak var topConst: NSLayoutConstraint!
+    @IBOutlet weak var leftConst: NSLayoutConstraint!
+    @IBOutlet weak var rightConst: NSLayoutConstraint!
+    @IBOutlet weak var bottomConst: NSLayoutConstraint!
+    
+    var contentInset: NSEdgeInsets = .init(top: 5, left: 5, bottom: 5, right: 5) {
+        didSet {
+            topConst.constant = contentInset.top
+            leftConst.constant = contentInset.left
+            rightConst.constant = contentInset.right
+            bottomConst.constant = contentInset.bottom
+        }
+    }
+    
     convenience init() {
         self.init(nibName: "KMToolbarItemPopViewController", bundle: nil)
         
@@ -21,6 +35,6 @@ class KMToolbarItemPopViewController: NSViewController{
     
     override func viewDidLoad() {
         super.viewDidLoad()
-        self.toolbarHelpTipLabel.textColor = .labelColor
+        self.toolbarHelpTipLabel?.textColor = .labelColor
     }
 }

+ 7 - 3
PDF Office/PDF Master/Class/Batch/WindowController/VC/KMToolbarItemPopViewController.xib

@@ -1,14 +1,18 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22155" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21507" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
     <dependencies>
         <deployment identifier="macosx"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22155"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21507"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
         <customObject id="-2" userLabel="File's Owner" customClass="KMToolbarItemPopViewController" customModule="PDF_Reader_Pro" customModuleProvider="target">
             <connections>
+                <outlet property="bottomConst" destination="pgE-Je-WDF" id="nbE-mW-Vj6"/>
+                <outlet property="leftConst" destination="TC0-WL-8ct" id="1ub-0I-SsO"/>
+                <outlet property="rightConst" destination="Vvb-Qb-5dD" id="hCZ-bs-ehU"/>
                 <outlet property="toolbarHelpTipLabel" destination="Anw-6R-RbF" id="Ra3-8V-bZf"/>
+                <outlet property="topConst" destination="I9x-u0-py7" id="z4m-m7-8Sg"/>
                 <outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
             </connections>
         </customObject>
@@ -18,7 +22,7 @@
             <rect key="frame" x="0.0" y="0.0" width="10" height="24"/>
             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
             <subviews>
-                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Anw-6R-RbF">
+                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Anw-6R-RbF">
                     <rect key="frame" x="3" y="5" width="4" height="14"/>
                     <constraints>
                         <constraint firstAttribute="width" relation="lessThanOrEqual" constant="300" id="jFH-vi-FyE"/>

+ 7 - 6
PDF Office/PDF Master/Class/ChromiumTabs/KMBrowserWindowController.swift

@@ -99,7 +99,7 @@ import Cocoa
             tabbingMode = .disallowed
         }
 #if VERSION_FREE
-        if IAPProductsManager.default().isAvailableAllFunction() == false {
+        if KMMemberInfo.shared.isMemberAllFunction == false {
             tabbingMode = .disallowed
         }
 #endif
@@ -349,7 +349,7 @@ import Cocoa
         var needShowChooseWindow = false
 //#if VERSION_FREE
 //#if VERSION_DMG
-        if (!IAPProductsManager.default().isAvailableAllFunction()) {
+        if (!KMMemberInfo.shared.isMemberAllFunction) {
             needShowChooseWindow = true
         }
 //#endif
@@ -367,7 +367,7 @@ import Cocoa
                         let winC = self?.kmCurrentWindowC as? KMTabbingHintWindowController
                         let newTab = winC?.newTabInWindowButton.state == .on
                         if continueOrNot {
-                            if IAPProductsManager.default().isAvailableAllFunction() && newTab {
+                            if KMMemberInfo.shared.isMemberAllFunction && newTab {
                                 self?.openDocumentWindow()
                             } else {
                                 self?.reopenDocument(forPaths: nil)
@@ -550,7 +550,7 @@ import Cocoa
             return
         }
         if let cnt = self.browser?.tabCount(), cnt > 1{
-            if !IAPProductsManager.default().isAvailableAllFunction() {
+            if !KMMemberInfo.shared.isMemberAllFunction {
                 if !KMDataManager.default.isTabbingWin{
                     KMDataManager.default.isTabbingWin = true
                     let tabbingWin: KMTabbingHintWindowController = KMTabbingHintWindowController()
@@ -640,7 +640,8 @@ extension KMBrowserWindowController: KMToolbarRightViewDelegate {
         self.trackEvent_upgrade()
 //        KMComparativeTableViewController.show(window: self.window!, .upgrade)
         DispatchQueue.main.async {
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            KMProductCompareWC.shared.orientation = false
+            KMProductCompareWC.shared.showWindow(nil)
         }
     }
     
@@ -1550,7 +1551,7 @@ extension KMBrowserWindowController: KMSystemFileMenuProtocol {
     func checkOpenNewDocument(path: String) -> Bool {
         let tabCount = self.km_browser?.tabCount() ?? 0
         if tabCount > 1{
-            if !IAPProductsManager.default().isAvailableAllFunction() {
+            if !KMMemberInfo.shared.isMemberAllFunction {
                 let preferenceNoteShow = UserDefaults.standard.bool(forKey: KMTabbingHintShowFlag)
                 if preferenceNoteShow {
                     menuItemAction_newTagPageToNewWindow("")

+ 2 - 2
PDF Office/PDF Master/Class/ChromiumTabs/src/Tab Strip/CTTabStripDragController.m

@@ -12,6 +12,7 @@
 #import "CTBrowserWindowController.h"
 #import "common.h"
 #import "IAPProductsManager.h"
+#import <PDF_Reader_Pro-Swift.h>
 
 // Replicate specific 10.7 SDK declarations for building with prior SDKs.
 #if !defined(MAC_OS_X_VERSION_10_7) || \
@@ -74,8 +75,7 @@ const NSTimeInterval kTearDuration = 0.333;
             return NO;
         }
     }
-//    CTBrowserWindowController *tBrowserWindowController  = (CTBrowserWindowController *)draggedController_;
-    if (![IAPProductsManager defaultManager].isAvailableAllFunction /*&& tBrowserWindowController.browser.tabCount > 1*/) {
+    if (![KMMemberInfo shared].isMemberAllFunction) {
         return NO;
     }
 

+ 0 - 4
PDF Office/PDF Master/Class/ChromiumTabs/src/Tab Strip/CTTabStripModel.m

@@ -295,10 +295,6 @@ const int kNoTab = NSNotFound;
     NSLog(@"切换document:%d",index);
 #endif
 	if ([self containsIndex:index]) {
-//        if (![IAPProductsManager defaultManager].isAvailableAllFunction && [self count] > 1 && activeIndex_ != index){
-//            [[NSNotificationCenter defaultCenter]postNotificationName:@"KMCTTableChangeShowAlertView" object:nil userInfo:nil];
-//            return;
-//        }
 		[self changeSelectedContentsFrom:[self activeTabContents]
 								 toIndex:index
 							 userGesture:userGesture];

+ 36 - 0
PDF Office/PDF Master/Class/Common/Category/NSWindowController+KMExtension.swift

@@ -27,6 +27,16 @@ extension NSWindowController {
             }
         }
     }
+    
+    func showWaitingView(to view: NSView) {
+        window?.hideWaitingView()
+        
+        window?.showWaitingView()
+    }
+
+    func hideWaitingView(from view: NSView) {
+        window?.hideWaitingView()
+    }
 }
 
 extension NSWindowController: KMForceProtocol {
@@ -39,6 +49,32 @@ extension NSWindow {
     override func km_window() -> NSWindow? {
         return self
     }
+    
+    func showWaitingView() {
+        hideWaitingView()
+        
+        guard let view = contentView else {
+            return
+        }
+        
+        let waitingView = WaitingView(frame: view.bounds)
+        waitingView.autoresizingMask = [.width, .height]
+        view.addSubview(waitingView)
+        waitingView.startAnimation()
+    }
+
+    func hideWaitingView() {
+        guard let view = contentView else {
+            return
+        }
+        
+        for subview in view.subviews {
+            if subview is WaitingView {
+                subview.removeFromSuperview()
+                break
+            }
+        }
+    }
 }
 
 // MARK: - 互动模式

+ 9 - 0
PDF Office/PDF Master/Class/Common/KMCommonDefine.swift

@@ -90,6 +90,15 @@ public func KMMainThreadExecute(_ execute: @escaping (()->Void)) {
     }
 }
 
+public func KMFormatNSNumber(_ number: NSNumber, to n: Int) -> String? {
+    let formatter = NumberFormatter()
+    formatter.minimumIntegerDigits = 1
+    formatter.maximumIntegerDigits = 20 // or however many digits you need
+    formatter.minimumFractionDigits = n
+    formatter.maximumFractionDigits = n
+    return formatter.string(from: number)
+}
+
 // ColumnID
 
 let kPageColumnId = NSUserInterfaceItemIdentifier(rawValue: "page")

+ 2 - 2
PDF Office/PDF Master/Class/Common/OC/StatusBar/KMStatusBar.m

@@ -111,7 +111,7 @@
 #pragma mark - Item Action
 
 - (void)convertItemAction:(id)sender {
-    if ([IAPProductsManager defaultManager].isAvailableAllFunction) {
+    if (KMMemberInfo.shared.isMemberAllFunction) {
         NSOpenPanel *openPanel = [NSOpenPanel openPanel];
         [openPanel setAllowedFileTypes:@[@"pdf",@"PDF"]];
         [openPanel setAllowsMultipleSelection:NO];
@@ -124,7 +124,7 @@
                     [arr addObject:file];
                     [baseWindowController.window makeKeyAndOrderFront:nil];
                     [baseWindowController checkNeedPasswordSwitchToOperateTypeWithOperateType:KMBatchOperationTypeConvert files:arr];
-                    [baseWindowController switchToConvertTypeWithConvertType:[IAPProductsManager defaultManager].isAvailableAdvancedPDFToOffice? KMConvertWithPDFTypeWordAdvance:KMConvertWithPDFTypeWordStandard];
+                    [baseWindowController switchToConvertTypeWithConvertType:[KMMemberInfo shared].isPermitConvert? KMConvertWithPDFTypeWordAdvance:KMConvertWithPDFTypeWordStandard];
                 });
             }
         }];

+ 6 - 1
PDF Office/PDF Master/Class/Document/KMMainDocument.swift

@@ -239,7 +239,7 @@ typealias KMMainDocumentCloudUploadHanddler = (@escaping(Bool, String)->()) -> (
                     }
                 }
             } else {
-                if currentWindowController?.browser.tabCount() ?? 0 > 1 && (!IAPProductsManager.default().isAvailableAllFunction() || KMPreference.shared.openDocumentType == .newWindow){
+                if currentWindowController?.browser.tabCount() ?? 0 > 1 && (!KMMemberInfo.shared.isMemberAllFunction || KMPreference.shared.openDocumentType == .newWindow){
                         // 开启新窗口
                         let browser = KMBrowser.init() as KMBrowser
                         browser.windowController = KMBrowserWindowController.init(browser: browser)
@@ -303,6 +303,11 @@ typealias KMMainDocumentCloudUploadHanddler = (@escaping(Bool, String)->()) -> (
         let isPrompt = KMPreferenceManager.shared.closeFileIsPrompt()
         if (isPrompt) {
             super.canClose(withDelegate: delegate, shouldClose: shouldCloseSelector, contextInfo: contextInfo)
+            
+            if KMAdvertisementManager.manager.appClosedCount == 0 {
+                KMAdvertisementManager.manager.appClosedCount = 1
+            }
+            
             return
         }
 

+ 1 - 2
PDF Office/PDF Master/Class/GuideInfo/KMCouponDueWindowController.swift

@@ -109,8 +109,7 @@ class KMCouponDueWindowController: NSWindowController {
         
 
 #if VERSION_DMG
-        let embeddedWC = KMPurchaseEmbeddedWindowController.currentFirstTrialWC("com.brother.pdfreaderpro.mac.product_3")
-        embeddedWC.couponCode = self.couponCode
+        let embeddedWC = KMPurchaseEmbeddedWindowController.currentCode(KMAdvancedAnnualSubscriptionCodeKey_DMG)
         embeddedWC.showWindow(nil)
         embeddedWC.window?.center()
 #else

+ 6 - 6
PDF Office/PDF Master/Class/GuideInfo/KMCouponDueWindowController.xib

@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21507" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22505" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
     <dependencies>
         <deployment identifier="macosx"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21507"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22505"/>
         <capability name="Named colors" minToolsVersion="9.0"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
@@ -26,7 +26,7 @@
         <window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" titlebarAppearsTransparent="YES" titleVisibility="hidden" id="F0z-JX-Cv5">
             <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES" fullSizeContentView="YES"/>
             <rect key="contentRect" x="196" y="240" width="660" height="443"/>
-            <rect key="screenRect" x="0.0" y="0.0" width="1440" height="875"/>
+            <rect key="screenRect" x="0.0" y="0.0" width="2560" height="1415"/>
             <value key="minSize" type="size" width="660" height="443"/>
             <value key="maxSize" type="size" width="660" height="443"/>
             <view key="contentView" id="se5-gp-TjO">
@@ -59,7 +59,7 @@
                                 <customView translatesAutoresizingMaskIntoConstraints="NO" id="IRn-Nx-1SH">
                                     <rect key="frame" x="336" y="21" width="266" height="338"/>
                                     <subviews>
-                                        <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="mL0-nw-nO3">
+                                        <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="mL0-nw-nO3">
                                             <rect key="frame" x="-2" y="313" width="172" height="25"/>
                                             <textFieldCell key="cell" alignment="left" title="Limited-time Offer" id="Dv5-Ir-uCY">
                                                 <font key="font" metaFont="system" size="21"/>
@@ -67,7 +67,7 @@
                                                 <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                                             </textFieldCell>
                                         </textField>
-                                        <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="jjn-yZ-D7c">
+                                        <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="jjn-yZ-D7c">
                                             <rect key="frame" x="-2" y="258" width="270" height="51"/>
                                             <constraints>
                                                 <constraint firstAttribute="width" constant="266" id="6J1-BA-Y1S"/>
@@ -117,7 +117,7 @@
                                             </constraints>
                                             <color key="fillColor" red="1" green="0.61799015410958902" blue="0.16566780821917809" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                         </box>
-                                        <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="VRY-Yk-fAD">
+                                        <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="VRY-Yk-fAD">
                                             <rect key="frame" x="-2" y="20" width="270" height="14"/>
                                             <constraints>
                                                 <constraint firstAttribute="width" constant="266" id="5bJ-Fv-1Zy"/>

+ 5 - 5
PDF Office/PDF Master/Class/GuideInfo/KMFunctionGuideWindowController.swift

@@ -96,7 +96,7 @@ class KMFunctionGuideWindowController: NSWindowController {
                     if controller.currentNameKEY == controller.AIInfoKey {
 //                        var url = URL(string: AIProduct_Link)!
 //                        NSWorkspace.shared.open(url)
-                        if AIInfoManager.default().aiInfoValid {
+                        if KMMemberInfo.shared.isPermitAI {
                             self?.closeAction()
                         } else {
                             let singleTon = KMPurchaseCompareDMGWindowController.init()
@@ -118,17 +118,17 @@ class KMFunctionGuideWindowController: NSWindowController {
                     }
 #else
                     if controller.currentNameKEY == controller.AIInfoKey {
-                        if AIInfoManager.default().aiInfoValid {
+                        if KMMemberInfo.shared.isPermitAI {
                             self?.closeAction()
                         } else {
                             AIPurchaseWindowController.currentWC().showWindow(nil)
                         }
                     } else if controller.currentNameKEY == controller.MeasureInfoKey {
-                        if IAPProductsManager.default().isAvailableAllFunction() {
+                        if KMMemberInfo.shared.isMemberAllFunction == true {
                             self?.closeAction()
                         } else {
-                            let singleTon = KMPurchaseCompareWindowController.init()
-                            singleTon.showWindow(nil)
+                            let singleTon = KMProductCompareWC.shared
+                            KMMemberInfo.shared.advancedFunctionUsage()
                             singleTon.window?.center()
                         }
                     }

+ 3 - 10
PDF Office/PDF Master/Class/Home/NSObject/Services/DropboxModel.m

@@ -257,18 +257,11 @@
 - (BOOL)uploadFile:(NSArray *)filePathArray
 {
     self.filePathArray = filePathArray;
-//    if (![IAPProductsManager defaultManager].isAvailableAllFunction) {
         //免費版當天只能限制dropbox 10個檔案同步
         NSUInteger count = [self numberOfUploadFile];
-//        if (10 <= count) {
-//            [KMPurchaseCompareTool showPurchaseCompareWindowController];
-//            return NO;
-//        } else if (count<10 && count > 0) {
-            if (self.filePathArray.count > (10-count)) {
-                self.filePathArray = [filePathArray subarrayWithRange:NSMakeRange(0, 10-count)];
-            }
-//        }
-//    }
+    if (self.filePathArray.count > (10-count)) {
+        self.filePathArray = [filePathArray subarrayWithRange:NSMakeRange(0, 10-count)];
+    }
     if ([self isLinked]) {
         [self uploadFileToServer];
     } else {

+ 47 - 117
PDF Office/PDF Master/Class/Home/ViewController/KMHomeViewController+Action.swift

@@ -439,7 +439,7 @@ extension KMHomeViewController {
                 if !alreadyOpen {
                     let controll: KMBrowserWindowController? = self.view.window?.windowController as? KMBrowserWindowController
                     if controll?.browser?.tabCount() ?? 0 > 1{
-                        if !IAPProductsManager.default().isAvailableAllFunction() {
+                        if !KMMemberInfo.shared.isMemberAllFunction {
                             showLimitWindowAlert(url: url)
                             return
                         }else {
@@ -987,9 +987,8 @@ extension KMHomeViewController {
     }
     
     func fastTool_Batch() { // Batch
-//        KMBatchWindowController.openFile(nil, .Batch)
-        if !IAPProductsManager.default().isAvailableAllFunction(){
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
         let batchWindowController = KMBatchOperateWindowController.sharedWindowController
@@ -997,11 +996,10 @@ extension KMHomeViewController {
     }
     
     func fastTool_OCR() {   // OCR
-//        KMOCRWindowController.openFiles(window: self.view.window!)
-        if !IAPProductsManager.default().isAvailableAllFunction(){
-            let winC = KMPurchaseCompareWindowController.sharedInstance()
-            winC?.kEventName = "Onbrd_OCR_BuyNow"
-            winC?.showWindow(nil)
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            let winC = KMProductCompareWC.shared
+            winC.kEventName = "Onbrd_OCR_BuyNow"
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
         let openPanel = NSOpenPanel()
@@ -1108,10 +1106,7 @@ extension KMHomeViewController {
         //MARK: 允许多选还是单选,如果是付费用户允许多选
         openPanel.allowsMultipleSelection = true
         openPanel.message = KMLocalizedString("Select images to create a new document. To select multiple files press cmd ⌘ button on keyboard and click on the target files one by one.", nil)
-//        openPanel.canChooseFiles = false
-//        openPanel.canChooseDirectories = true
-//        openPanel.canCreateDirectories = true
-        if IAPProductsManager.default().isAvailableAllFunction(){
+        if KMMemberInfo.shared.isMemberAllFunction {
             openPanel.allowsMultipleSelection = true
         }else{
             openPanel.allowsMultipleSelection = false
@@ -1322,10 +1317,10 @@ extension KMHomeViewController {
     }
     
     func fastTool_FileCompare() {    // 文件对比
-        if !IAPProductsManager.default().isAvailableAllFunction(){
-            let winC = KMPurchaseCompareWindowController.sharedInstance()
-            winC?.kEventName = "Onbrd_Compare_BuyNow"
-            winC?.showWindow(nil)
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            let winC = KMProductCompareWC.shared
+            winC.kEventName = "Onbrd_Compare_BuyNow"
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
         let openPanel = NSOpenPanel()
@@ -1427,14 +1422,13 @@ extension KMHomeViewController {
     }
     
     func fastTool_Watermark() { // 水印
-//        KMBatchWindowController.openFile(nil, .Watermark)
-        if !IAPProductsManager.default().isAvailableAllFunction(){
-            let winC = KMPurchaseCompareWindowController.sharedInstance()
-            winC?.kEventName = "Onbrd_Watermard_BuyNow"
-            winC?.showWindow(nil)
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            let winC = KMProductCompareWC.shared
+            winC.kEventName = "Onbrd_Watermard_BuyNow"
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
-        
+
         let openPanel = NSOpenPanel()
         openPanel.allowedFileTypes = ["pdf","PDF"]
         //MARK: 允许多选还是单选,如果是付费用户允许多选
@@ -1475,11 +1469,10 @@ extension KMHomeViewController {
     }
     
     func fastTool_Background() {    // 背景
-//        KMBatchWindowController.openFile(nil, .Background)
-        if !IAPProductsManager.default().isAvailableAllFunction(){
-            let winC = KMPurchaseCompareWindowController.sharedInstance()
-            winC?.kEventName = "Onbrd_Background_BuyNow"
-            winC?.showWindow(nil)
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            let winC = KMProductCompareWC.shared
+            winC.kEventName = "Onbrd_Background_BuyNow"
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
 
@@ -1523,11 +1516,10 @@ extension KMHomeViewController {
     }
     
     func fastTool_HeaderAndFooter() {   // 页眉页脚
-//        KMBatchWindowController.openFile(nil, .HeaderAndFooter)
-        if !IAPProductsManager.default().isAvailableAllFunction(){
-            let winC = KMPurchaseCompareWindowController.sharedInstance()
-            winC?.kEventName = "Onbrd_HeaderFooter_BuyNow"
-            winC?.showWindow(nil)
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            let winC = KMProductCompareWC.shared
+            winC.kEventName = "Onbrd_HeaderFooter_BuyNow"
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
 
@@ -1572,11 +1564,10 @@ extension KMHomeViewController {
     
     
     func fastTool_BatesCode() { // 贝茨码
-//        KMBatchWindowController.openFile(nil, .BatesCode)
-        if !IAPProductsManager.default().isAvailableAllFunction(){
-            let winC = KMPurchaseCompareWindowController.sharedInstance()
-            winC?.kEventName = "Onbrd_Bates_BuyNow"
-            winC?.showWindow(nil)
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            let winC = KMProductCompareWC.shared
+            winC.kEventName = "Onbrd_Bates_BuyNow"
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
 
@@ -1628,8 +1619,8 @@ extension KMHomeViewController {
     }
     
     func fastTool_Insert() {    // 插入
-        if !IAPProductsManager.default().isAvailableAllFunction(){
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
 
@@ -1640,24 +1631,10 @@ extension KMHomeViewController {
         
         openPanel.beginSheetModal(for: NSApp.mainWindow!) { result in
             if result == .OK {
-                //                DispatchQueue.main.asyncAfter(deadline: .now() + 0.25) {
-                //                    let insertWindowController: KMPDFInsertPageWindow = KMPDFInsertPageWindow.init(documentPath: openPanel.url!, toolType: .Insert)
-                //                    insertWindowController.beginSheetModal(for: self.view.window!) { pdfDocument, password, pages, indexPage in
-                //                        self.insertPageAction(pdfDocument, password, pages, indexPage)
-                //                    }
-                //                }
-                //            }
                 let windowC = KMPDFInsertWindowController(fileURL: openPanel.url!)
-//                [com beginSheetModalForWindow:[NSApp mainWindow] completionHandler:^(PDFDocument *pdfDocument, NSString *password, NSMutableArray<PDFPage *> *pages, NSInteger indexPage) {
-//                    if (pdfDocument && indexPage >= 0) {
-//                        [pdfDocument insertWithInsertPages:pages insertPageIndex:indexPage];
-//                        [self savePDFDocument:pdfDocument password:password];
-//                    }
-//                }];
                 windowC.callback = { [weak self] idx, params in
                     if params.count >= 4 {
                         if let doc = params.first as? CPDFDocument {
-//                            doc.insertWithInsertPages((params[2] as? [CPDFPage]) ?? [], insertPageIndex: params[3] as! Int)
                             self?.savePDFDocument(doc, password: params[1] as? String ?? "")
                         }
                     }
@@ -1668,55 +1645,9 @@ extension KMHomeViewController {
         }
     }
     
-    
-//    func savePDFDocument(_ pdf: CPDFDocument, password: String?) {
-////        KMProgressWindowController * vc = [[KMProgressWindowController alloc] init];
-////        [NSApp beginSheet:[vc window] modalForWindow:[NSApp mainWindow] modalDelegate:nil didEndSelector:nil contextInfo:NULL];
-//
-//        DispatchQueue.global().async {
-//            var isSuccessfully = false
-//            if (pdf.isEncrypted) {
-//                isSuccessfully = pdf.write(to: pdf.documentURL, withOptions: [.userPasswordOption : password ?? "", .ownerPasswordOption : password ?? ""])
-//            } else {
-//                isSuccessfully = pdf.write(to: pdf.documentURL)
-//            }
-//            if (!isSuccessfully) {
-////                isSuccessfully = [pdf.dataRepresentation writeToURL:pdf.documentURL atomically:YES];
-//                try?pdf.dataRepresentation().write(to: pdf.documentURL)
-//            }
-//
-//            Task { @MainActor in
-////                [NSApp endSheet:vc.window];
-////                [vc close];
-//
-//                if (isSuccessfully) {
-////                    BOOL autoOpen = [[NSUserDefaults standardUserDefaults] boolForKey:KMAutoOpenDocumentKey];
-////                    if (autoOpen) {
-////                        [[NSDocumentController sharedDocumentController] openDocumentWithContentsOfURL:pdf.documentURL display:YES completionHandler:^(NSDocument * _Nullable document, BOOL documentWasAlreadyOpen, NSError * _Nullable error) {
-////
-////                        }];
-////                    } else {
-//                    let workspace = NSWorkspace.shared
-//                    let url = URL(fileURLWithPath: pdf.documentURL.path)
-//                    workspace.activateFileViewerSelecting([url])
-////                    }
-//                } else {
-//                    _ = await KMAlertTool.runModel(message: KMLocalizedString("Failed to insert page(s)!", nil))
-//                }
-//            }
-//        }
-//    }
-    
     func fastTool_BreakUp() {   // 拆分
-//        [[FMTrackEventManager manager] trackEvent:@"Onbrd" withProperties:@{@"HP_Tools":@"Split"}];
-//
-//        if (![IAPProductsManager defaultManager].isAvailableAllFunction) {
-//            [[KMPurchaseCompareWindowController sharedInstance] showWindow:nil];
-//            return;
-//        }
-//        self.isDragEntered = YES;
-        if !IAPProductsManager.default().isAvailableAllFunction(){
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
 
@@ -1724,7 +1655,6 @@ extension KMHomeViewController {
         openPanel.allowedFileTypes = ["pdf"]
         openPanel.allowsMultipleSelection = false
         openPanel.beginSheetModal(for: NSApp.mainWindow!) { result in
-//            self.isDragEntered = NO;
             if result == .OK {
                 DispatchQueue.main.asyncAfter(deadline: .now() + 0.25) {
                     let com = SplitWindowController(fileURL: openPanel.url!)
@@ -1752,8 +1682,8 @@ extension KMHomeViewController {
     }
     
     func fastTool_MarkCipher() {    // 标记密文
-        if !IAPProductsManager.default().isAvailableAllFunction(){
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
         
@@ -1829,10 +1759,10 @@ extension KMHomeViewController {
     }
     
     func fastTool_printBooklet() {
-        if !IAPProductsManager.default().isAvailableAllFunction(){
-            let winC = KMPurchaseCompareWindowController.sharedInstance()
-            winC?.kEventName = "Onbrd_PrintBooklet_BuyNow"
-            winC?.showWindow(nil)
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            let winC = KMProductCompareWC.shared
+            winC.kEventName = "Onbrd_PrintBooklet_BuyNow"
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
 
@@ -1869,10 +1799,10 @@ extension KMHomeViewController {
     }
     
     func fastTool_printPoster() {
-        if !IAPProductsManager.default().isAvailableAllFunction(){
-            let winC = KMPurchaseCompareWindowController.sharedInstance()
-            winC?.kEventName = "Onbrd_PrintPoster_BuyNow"
-            winC?.showWindow(nil)
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            let winC = KMProductCompareWC.shared
+            winC.kEventName = "Onbrd_PrintPoster_BuyNow"
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
 
@@ -1909,10 +1839,10 @@ extension KMHomeViewController {
     }
     
     func fastTool_printMultple() {
-        if !IAPProductsManager.default().isAvailableAllFunction(){
-            let winC = KMPurchaseCompareWindowController.sharedInstance()
-            winC?.kEventName = "Onbrd_PrintMultiple_BuyNow"
-            winC?.showWindow(nil)
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            let winC = KMProductCompareWC.shared
+            winC.kEventName = "Onbrd_PrintMultiple_BuyNow"
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
 

+ 11 - 42
PDF Office/PDF Master/Class/Home/ViewController/KMHomeViewController.swift

@@ -116,9 +116,9 @@ import Cocoa
     
     override func viewWillAppear() {
         super.viewWillAppear()
-        if !KMLightMemberManager.manager.isLogin() {
-            KMLightMemberManager.manager.canShowAdvancedView = true
-        }
+//        if !KMLightMemberManager.manager.isLogin() {
+//            KMLightMemberManager.manager.canShowAdvancedView = true
+//        }
         self.homeContentView.reloadData()
 #if VERSION_DMG
         let kDMGFirstInstallKey = "DMGFirstInstallKey"
@@ -223,7 +223,7 @@ import Cocoa
                 var infos: [KMAdvertisementItemInfo] = []
                 for info in item?.content ?? [] {
                     if info.version == "recommondPDF-PDFtoOfficePack" {
-                        if IAPProductsManager.default().isAvailableAdvancedPDFToOffice() == false && IAPProductsManager.default().isAvailableAllFunction() {
+                        if KMMemberInfo.shared.isPermitConvert == false && KMMemberInfo.shared.isMemberAllFunction {
                             infos.append(info)
                         }
                     } else {
@@ -352,11 +352,11 @@ import Cocoa
             self.fastToolItemAction(item.type!)
         }
         
-        if IAPProductsManager.default().isAvailableAllFunction() {
+//        if KMMemberInfo.shared.isMemberAllFunction {
             self.advertisementShowView.isHidden = true
-        } else {
-            self.advertisementShowView.isHidden = false
-        }
+//        } else {
+//            self.advertisementShowView.isHidden = false
+//        }
         
         NotificationCenter.default.addObserver(self, selector: #selector(purchaseStateUpdateNoti), name: NSNotification.Name(rawValue: "KMIAPProductPurchasedNotification"), object: nil)
         NotificationCenter.default.addObserver(self, selector: #selector(purchaseStateUpdateNoti), name: NSNotification.Name(rawValue: "kDeviceActivateNotification"), object: nil)
@@ -764,7 +764,7 @@ extension KMHomeViewController {
     
     func needShowTabbingHintWindow() -> Bool {
         let controll: KMBrowserWindowController? = self.view.window?.windowController as? KMBrowserWindowController
-        if controll?.browser?.tabCount() ?? 0 > 1 && !IAPProductsManager.default().isAvailableAllFunction() {
+        if controll?.browser?.tabCount() ?? 0 > 1 && !KMMemberInfo.shared.isMemberAllFunction {
             return true
         }
         return false
@@ -889,42 +889,11 @@ extension KMHomeViewController {
     
     func newFromImages() {
         fastTool_ImageToPDF()
-//        let openPanel = NSOpenPanel()
-//        openPanel.allowedFileTypes = KMImageAccessoryController.supportedImageTypes()
-//        if IAPProductsManager.defaultManager().isAvailableAllFunction {
-//            openPanel.allowsMultipleSelection = true
-//        } else {
-//            openPanel.allowsMultipleSelection = false
-//        }
-//        openPanel.message = NSLocalizedString("Select images to create a new document. To select multiple files press cmd ⌘ button on the keyboard and click on the target files one by one.", comment: "")
-//        openPanel.beginSheetModal(for: NSApp.mainWindow!) { result in
-//            if result == .OK {
-//                DispatchQueue.main.asyncAfter(deadline: .now() + 0.25) {
-//                    debugPrint("缺少图片转PDF")
-//                    let baseWindowController = KMBatchOperateBaseWindowController(windowNibName: "KMBatchOperateBaseWindowController")
-//                    var arr: [KMBatchOperateFile] = []
-//                    for url in openPanel.urls {
-//                        let file = KMBatchOperateFile(filePath: url.path, type: .createPDF)
-//                        arr.append(file)
-//                    }
-//                   
-//                    if #available(macOS 10.13, *) {
-//                        baseWindowController.window?.makeKeyAndOrderFront(nil)
-//                    } else {
-//                        baseWindowController.showWindow(nil)
-//                    }
-//                    baseWindowController.checkNeedPasswordSwitch(toOperateType: .createPDF, files: arr)
-//                    if #available(macOS 10.13, *) {
-//                        baseWindowController.release()
-//                    }
-//                }
-//            }
-//        }
     }
     
     //MARK: Purchase
     @objc func purchaseStateUpdateNoti() {
-        if IAPProductsManager.default().isAvailableAllFunction() {
+        if KMMemberInfo.shared.isMemberAllFunction {
             self.advertisementShowView.isHidden = true
             
             guard let content = self.advertisementTableView.inputData else {
@@ -934,7 +903,7 @@ extension KMHomeViewController {
             var infos: [KMAdvertisementItemInfo] = []
             for info in item?.content ?? [] {
                 if info.version == "recommondPDF-PDFtoOfficePack" {
-                    if IAPProductsManager.default().isAvailableAdvancedPDFToOffice() == false && IAPProductsManager.default().isAvailableAllFunction() {
+                    if KMMemberInfo.shared.isPermitConvert == false && KMMemberInfo.shared.isMemberAllFunction {
                         infos.append(info)
                     }
                 } else {

+ 5 - 5
PDF Office/PDF Master/Class/Home/WindowController/KMAITranslationConfirmWindowController.xib

@@ -1,12 +1,12 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22155" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22505" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
     <dependencies>
         <deployment identifier="macosx"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22155"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22505"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
-        <customObject id="-2" userLabel="File's Owner" customClass="KMAITranslationConfirmWindowController" customModule="PDF_Master" customModuleProvider="target">
+        <customObject id="-2" userLabel="File's Owner" customClass="KMAITranslationConfirmWindowController" customModule="PDF_Reader_Pro" customModuleProvider="target">
             <connections>
                 <outlet property="cancelBox" destination="vyK-GF-45b" id="SmK-bv-L3Z"/>
                 <outlet property="cancelButton" destination="cGZ-Im-IxK" id="rmV-MT-RM5"/>
@@ -33,7 +33,7 @@
             <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
             <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
             <rect key="contentRect" x="196" y="240" width="628" height="334"/>
-            <rect key="screenRect" x="0.0" y="0.0" width="2560" height="1415"/>
+            <rect key="screenRect" x="0.0" y="0.0" width="1920" height="1055"/>
             <view key="contentView" id="se5-gp-TjO">
                 <rect key="frame" x="0.0" y="0.0" width="628" height="276"/>
                 <autoresizingMask key="autoresizingMask"/>
@@ -158,7 +158,7 @@
                     <customView translatesAutoresizingMaskIntoConstraints="NO" id="WyA-fZ-iqG">
                         <rect key="frame" x="16" y="64" width="596" height="162"/>
                         <subviews>
-                            <customView translatesAutoresizingMaskIntoConstraints="NO" id="g0s-3J-B7Z" customClass="KMCustomPDFView" customModule="PDF_Master" customModuleProvider="target">
+                            <customView translatesAutoresizingMaskIntoConstraints="NO" id="g0s-3J-B7Z" customClass="KMCustomPDFView" customModule="PDF_Reader_Pro" customModuleProvider="target">
                                 <rect key="frame" x="0.0" y="22" width="106" height="140"/>
                                 <constraints>
                                     <constraint firstAttribute="width" constant="106" id="bJf-WD-7Mo"/>

+ 32 - 32
PDF Office/PDF Master/Class/KMAdvertisement/Config/KMAdvertisementConfig.swift

@@ -6,9 +6,9 @@
 //
 
 #if os(OSX)
-    import AppKit
+import AppKit
 #elseif os(iOS)
-    import UIKit
+import UIKit
 #endif
 
 //APP类型
@@ -35,29 +35,29 @@
     case PDFReaderProIOSPro = 19
     
     func string() -> String {
-            switch self {
-            case .RecordIt: return "RecordIt"
-            case .RecordItPro: return "RecordItPro"
-            case .RecordItDMG: return "RecordItDMG"
-            case .FilmageScreen: return "FilmageScreen"
-            case .FilmageScreenPro: return "FilmageScreenPro"
-            case .FilmageScreenDMG: return "FilmageScreenDMG"
-            case .FilmageEditorMac: return "FilmageEditorMac"
-            case .FilmageEditorMacPro: return "FilmageEditorMacPro"
-            case .FilmageEditorMacDMG: return "FilmageEditorMacDMG"
-            case .FilmageConverterMac: return "FilmageConverterMac"
-            case .FilmageConverterMacPro: return "FilmageConverterMacPro"
-            case .FilmageConverterMacDMG: return "FilmageConverterMacDMG"
-            case .FilmagePlayerMac: return "FilmagePlayerMac"
-            case .FilmagePlayerMacPro: return "FilmagePlayerMacPro"
-            case .FilmagePlayerMacDMG: return "FilmagePlayerMacDMG"
-            case .PDFReaderProMac: return "PDFReaderProMac"
-            case .PDFReaderProMacPro: return "PDFReaderProMacPro"
-            case .PDFReaderProMacDMG: return "PDFReaderProMacDMG"
-            case .PDFReaderProIOS: return "PDFReaderProIOS"
-            case .PDFReaderProIOSPro: return "PDFReaderProIOSPro"
-            }
+        switch self {
+        case .RecordIt: return "RecordIt"
+        case .RecordItPro: return "RecordItPro"
+        case .RecordItDMG: return "RecordItDMG"
+        case .FilmageScreen: return "FilmageScreen"
+        case .FilmageScreenPro: return "FilmageScreenPro"
+        case .FilmageScreenDMG: return "FilmageScreenDMG"
+        case .FilmageEditorMac: return "FilmageEditorMac"
+        case .FilmageEditorMacPro: return "FilmageEditorMacPro"
+        case .FilmageEditorMacDMG: return "FilmageEditorMacDMG"
+        case .FilmageConverterMac: return "FilmageConverterMac"
+        case .FilmageConverterMacPro: return "FilmageConverterMacPro"
+        case .FilmageConverterMacDMG: return "FilmageConverterMacDMG"
+        case .FilmagePlayerMac: return "FilmagePlayerMac"
+        case .FilmagePlayerMacPro: return "FilmagePlayerMacPro"
+        case .FilmagePlayerMacDMG: return "FilmagePlayerMacDMG"
+        case .PDFReaderProMac: return "PDFReaderProMac"
+        case .PDFReaderProMacPro: return "PDFReaderProMacPro"
+        case .PDFReaderProMacDMG: return "PDFReaderProMacDMG"
+        case .PDFReaderProIOS: return "PDFReaderProIOS"
+        case .PDFReaderProIOSPro: return "PDFReaderProIOSPro"
         }
+    }
 }
 
 //显示样式
@@ -114,15 +114,15 @@
     public var language: KMAdvertisementLanguageType = .unknow
     
     func activityBaseURL() -> String {
-        #if DEBUG
-        if kTestMode == 1{
+#if DEBUG
+        if kTestMode == 1 {
             return "http://test-store.kdan.cn:3019"
         } else {
             return "https://store.filmagepro.com:3018"
         }
-        #else
+#else
         return "https://store.filmagepro.com:3018"
-        #endif
+#endif
     }
     
     public func initParameters(appName: KMAdvertisementAppNameType, subscribeType:KMAdvertisementSubscribeType, platform: KMAdvertisementPlatformType) {
@@ -154,22 +154,22 @@ extension KMAdvertisementConfig {
         if #available(macOS 10.14, *) {
             let dict = UserDefaults.standard.persistentDomain(forName: UserDefaults.globalDomain) ?? nil
             guard let dicts: Dictionary = dict else {
-//                print("不是字典类型")
+                //                print("不是字典类型")
                 return false
             }
             
             guard let style = dicts["AppleInterfaceStyle"] as? String else {
-//                print("style is not string")
+                //                print("style is not string")
                 return false
             }
             
             let isDarkMode : Bool = style.compare("Dark").rawValue == 0
             
             if isDarkMode {
-//                print("暗黑模式\(style)")
+                //                print("暗黑模式\(style)")
                 return true
             } else {
-//                print("正常模式\(style)")
+                //                print("正常模式\(style)")
                 return false
             }
         } else {

+ 54 - 117
PDF Office/PDF Master/Class/KMAdvertisement/Manager/KMAdvertisementManager.swift

@@ -10,12 +10,14 @@
     @objc public static let manager = KMAdvertisementManager()
     @objc public var configuration: KMAdvertisementConfig = KMAdvertisementConfig()
     
+    var appClosedCount = 0
+    
     var info: KMAdvertisementInfo = KMAdvertisementInfo()
     var infoDict: NSDictionary = NSDictionary()
     
     /**
      @abstract 测试模式,默认为false
-      */
+     */
     @objc public var debug: Bool = false
     
     /**
@@ -24,7 +26,7 @@
      @param subscribeType 订阅状态,可单独在configuration设置
      @param platform 平台
      @return
-      */
+     */
     @objc public func initConfig(appName: KMAdvertisementAppNameType,
                                  subscribeType:KMAdvertisementSubscribeType,
                                  platform: KMAdvertisementPlatformType) {
@@ -32,18 +34,18 @@
     }
     
     private class InternalImplementation {
-            fileprivate var privateProperty: String = "Hidden"
-            fileprivate func internalMethod() {
-                // 实现细节
-            }
-        }
-        
-        private let internalImplementation = InternalImplementation()
-        
-        public func publicMethod() {
-            // 使用内部实现
-            internalImplementation.internalMethod()
+        fileprivate var privateProperty: String = "Hidden"
+        fileprivate func internalMethod() {
+            // 实现细节
         }
+    }
+    
+    private let internalImplementation = InternalImplementation()
+    
+    public func publicMethod() {
+        // 使用内部实现
+        internalImplementation.internalMethod()
+    }
 }
 
 extension KMAdvertisementManager {
@@ -52,7 +54,7 @@ extension KMAdvertisementManager {
      @abstract 获取数据
      @param data 传入参数 类型为KMAdvertisementModel
      @return
-      */
+     */
     @objc public func fetchData(completion: @escaping (_ data: KMAdvertisementInfo?, _ error:Error?) -> Void) -> Void {
         self.fetchDataWithResponseObject { data, responseObject, error in
             if completion != nil {
@@ -74,21 +76,21 @@ extension KMAdvertisementManager {
                                     "app_version": version]
         
         //先拿缓存数据 再请求新数据
-        let cacheData = KMAdvertisementCache.default.readData()
-        if cacheData.count != 0 {
-            for model in cacheData {
-                let jsonString: String = (model["detail"] as? String) ?? ""
-                let jsonData: Data = jsonString.data(using: .utf8)!
-                let dict = try?JSONSerialization.jsonObject(with: jsonData)
-                infoDict = dict as! NSDictionary
-            }
-            self.parseData(data: cacheData, isNeedLocalComparison: true) { result in
-                if result.count != 0 {
-                    info = result.first!
-                    completion(result.first, nil, nil)
-                }
-            }
-        }
+//        let cacheData = KMAdvertisementCache.default.readData()
+//        if cacheData.count != 0 {
+//            for model in cacheData {
+//                let jsonString: String = (model["detail"] as? String) ?? ""
+//                let jsonData: Data = jsonString.data(using: .utf8)!
+//                let dict = try?JSONSerialization.jsonObject(with: jsonData)
+//                infoDict = dict as! NSDictionary
+//            }
+//            self.parseData(data: cacheData, isNeedLocalComparison: true) { result in
+//                if result.count != 0 {
+//                    info = result.first!
+//                    completion(result.first, nil, nil)
+//                }
+//            }
+//        }
         
         unowned let weakSelf = self
         KMAdvertisementRequestServer.requestServer.request(urlString: urlString, method: "GET", params: params) { [self] task, responseObject, error in
@@ -201,29 +203,6 @@ extension KMAdvertisementManager {
         return result
     }
     
-    //    func allowLoadContentData(data: KMAdvertisementModel) -> Bool {
-    //        var result = false
-    //
-    //        let time: NSInteger = NSInteger(KMAdvertisementTimeStampConversion.getCurrentTimeInterval())!
-    //        let startTime: NSInteger = NSInteger(data.startTime!)!
-    //        let endTime: NSInteger = NSInteger(data.endTime!)!
-    //        let platform = configuration.platform
-    //        let subscribeType = configuration.subscribeType
-    //        let version = data.version ?? "1.0"
-    //        let localVersion = self.getLocalVersion()
-    //        let hidden = data.hidden ?? false
-    //
-    //        if (time >= startTime &&
-    //            time <= endTime &&
-    //            platform == data.platform &&
-    //            self.compareVersion(nowVersion:localVersion, newVersion: version) &&
-    //            (subscribeType == data.subscribeType || data.subscribeType == .all) &&
-    //            !hidden) {
-    //            result = true
-    //        }
-    //        return result
-    //    }
-    
     //过滤item是否显示
     func allowLoadItemData(_ data: KMAdvertisementInfo) -> KMAdvertisementInfo {
         let advertisement = data.advertisement
@@ -241,6 +220,21 @@ extension KMAdvertisementManager {
         recommondContent?.recommondContentPDFPro = recommondContentPDFPro
         data.recommondContent = recommondContent
         
+        let topRightInfoContent = data.topRightInfoContent
+        if let content = topRightInfoContent?.content {
+            topRightInfoContent?.content = self.canShow(data: content)
+        }
+        
+        let loginViewContent = data.loginViewContent
+        if let content = loginViewContent?.content {
+            loginViewContent?.content = self.canShow(data: content)
+        }
+        
+        let userViewInfoContent = data.userViewInfoContent
+        if let content = userViewInfoContent?.content {
+            userViewInfoContent?.content = self.canShow(data: content)
+        }
+        
         return data;
     }
     
@@ -254,15 +248,15 @@ extension KMAdvertisementManager {
                 
                 var canAdd = true
                 if item.subscriptionType == "1" {
-                    if (IAPProductsManager.default().isAvailableAllFunction()) {
+                    if (KMMemberInfo.shared.isMemberAllFunction == true) {
                         canAdd = false
                     }
                 } else if item.subscriptionType == "2" {
-                    if (IAPProductsManager.default().isAvailableAllFunction() == false) {
+                    if (KMMemberInfo.shared.isMemberAllFunction == false) {
                         canAdd = false
                     }
                 }
-            
+                
                 if canAdd {
                     dataArray.append(item)
                 }
@@ -272,61 +266,6 @@ extension KMAdvertisementManager {
         return dataArray
     }
     
-//    + (BOOL)checkAdvertisementValid:(KMRecommondInfo *)info {
-//    #if DEBUG
-//        [[NSUserDefaults standardUserDefaults] removeObjectForKey:info.versionKey];
-//    #endif
-//        if ([[NSUserDefaults standardUserDefaults] objectForKey:info.versionKey]) {
-//            return NO;
-//        }
-//        if (!info.show) {
-//            return NO;
-//        }
-//        if (info.showType == KMRecommondShowType_Lite) {
-//            if ([[IAPProductsManager defaultManager] isAvailableAllFunction]) {
-//                return NO;
-//            }
-//        } else if (info.showType == KMRecommondShowType_Pro) {
-//            if (![[IAPProductsManager defaultManager] isAvailableAllFunction]) {
-//                return NO;
-//            }
-//        }
-//        return YES;
-//    }
-    
-//    func allowLoadItemData(_ data: KMAdvertisementModel) -> KMAdvertisementModel {
-//        //获取缓存数据
-//        if (UserDefaults.standard.object(forKey: "KMAdvertisementShowScroll_iOS") == nil) {
-//            UserDefaults.standard.set([], forKey: "KMAdvertisementShowScroll_iOS")
-//        }
-//        let cacheArray: [String] = UserDefaults.standard.object(forKey: "KMAdvertisementShowScroll_iOS") as! [String]
-//        
-//        let model = data
-//        var sections: [KMAdvertisementModelSection] = []
-//        for section in data.content! {
-//            var items: [KMAdvertisementModelItem] = []
-//            for item in section.content! {
-//                let timeString = KMAdvertisementTimeStampConversion.getCurrentTimeInterval()
-//                let time: NSInteger = NSInteger(timeString)!
-//                let startTime: NSInteger = NSInteger(item.startTime ?? timeString)!
-//                let endTime: NSInteger = NSInteger(item.endTime ?? timeString)!
-//                let hidden = item.hidden ?? false
-//
-////                print(hidden ? "隐藏" : "显示")
-//                if (!hidden &&
-//                    time >= startTime &&
-//                    time <= endTime &&
-//                    !cacheArray.contains(item.productID ?? "")) {
-//                    items.append(item)
-//                }
-//            }
-//            section.content = items
-//            sections.append(section)
-//        }
-//        model.content = sections
-//        return model
-//    }
-    
     //获取本地版本号
     func getLocalVersion() -> String {
         var localVersion = ""
@@ -362,9 +301,9 @@ extension KMAdvertisementManager {
 
 extension KMAdvertisementManager {
     static func checkAdvertisementValid(_ info: KMAdvertisementItemInfo) -> Bool {
-        #if DEBUG
+#if DEBUG
         UserDefaults.standard.removeObject(forKey: info.version ?? "")
-        #endif
+#endif
         
         if UserDefaults.standard.object(forKey: info.version ?? "") != nil {
             return false
@@ -377,19 +316,17 @@ extension KMAdvertisementManager {
         let currentTime = Int(NSDate.init().timeIntervalSince1970 * 1000)
         if currentTime > Int(info.startTime ?? "0") ?? currentTime &&
             currentTime < Int(info.endTime ?? "0") ?? currentTime {
-           
+            
         } else {
             return false
         }
         
-        
         if info.subscriptionType == "1" {
-//            if IAPProductsManager.default().isAvailableAllFunction() {
-            if IAPProductsManager.default().isAvailableAllFunction() == true {
+            if KMMemberInfo.shared.isMemberAllFunction == true {
                 return false
             }
         } else if info.subscriptionType == "2" {
-            if !IAPProductsManager.default().isAvailableAllFunction() {
+            if !KMMemberInfo.shared.isMemberAllFunction {
                 return true
             }
         }

+ 3 - 8
PDF Office/PDF Master/Class/KMAdvertisement/Model/KMAdvertisementImage.swift

@@ -54,11 +54,9 @@ class KMAdvertisementImageCache: NSObject {
                 try?FileManager.default.createDirectory(atPath: path as String, withIntermediateDirectories: true, attributes: nil)
             }
             
-            #if os(iOS)
+#if os(iOS)
             
-//            [UIImagePNGRepresentation(image) writeToFile:path + name
-//                                              atomically:YES]
-            #elseif os(OSX)
+#elseif os(OSX)
             let cgimage = image.cgImage(forProposedRect: nil, context: nil, hints: nil)
             if cgimage != nil {
                 let rep = NSBitmapImageRep.init(cgImage: cgimage!)
@@ -67,7 +65,7 @@ class KMAdvertisementImageCache: NSObject {
                 try?image.tiffRepresentation?.write(to: URL(fileURLWithPath: filePath))
             }
             print(path)
-            #endif
+#endif
         }
     }
     
@@ -83,9 +81,6 @@ class KMAdvertisementImageCache: NSObject {
         
         if (contentsOfPath!.contains(name)) {
             string = (kImageCacheFilePath as String) + "/" + name
-//            print("图片存在" + string)
-        } else {
-//            print("图片不存在" + (kImageCacheFilePath as String) + "/" + name)
         }
         return string
     }

+ 8 - 88
PDF Office/PDF Master/Class/KMAdvertisement/Model/KMAdvertisementModel.swift

@@ -14,6 +14,11 @@
     public var discountContent: KMAdvertisementItem?
     public var popWindowContent: KMAdvertisementItem?
     public var StoreUserRecovery: KMAdvertisementItem?
+    
+    public var topRightInfoContent: KMAdvertisementItem?  //顶部右上角信息
+    public var loginViewContent: KMAdvertisementItem?  //登录界面信息
+    public var userViewInfoContent: KMAdvertisementItem?   //会员信息界面信息
+    
 }
 
 @objcMembers public class KMAdvertisementContent: NSObject, Codable {
@@ -36,6 +41,7 @@
     var show: String? //是否显示,内部有做了时间区间判断
     var subscriptionType: String? //类型
     var showType: KMAdvertisementShowType?
+    var jumpType: String?
     var startTime: String?
     var endTime: String?
     var version: String? //版本号,唯一标识符
@@ -43,10 +49,12 @@
     var image: Image? //APP互推,常规状态下的图片
     var saleImage: Image? // 订阅折扣图片
     var iconImage: String? //广告显示图片(自适应多语)
+    var dfpImage: Image?
     var name: Language? //名称(自适应多语)
     var tooltip: Language? //提示语(自适应多语)
     var linkURL: Language? //跳转链接(自适应多语)
     var subTitle: Language? //名称(自适应多语)
+    var newSubTitle: Language? //名称(自适应多语)
     var otherTitle: Language? //名称(自适应多语)
     var btnTitle: Language? //名称(自适应多语)
     
@@ -80,91 +88,3 @@ public class Language: NSObject, Codable {
     var zh_TW: String?
     var zh_CN: String?
 }
-
-//@objcMembers public class KMAdvertisementModel: NSObject, Codable {
-//    public var appName: KMAdvertisementAppNameType = .FilmageEditorMac //产品名
-//    public var platform: KMAdvertisementPlatformType = .Mac //平台
-//    public var showType: KMAdvertisementShowType = .view //显示类型
-//    public let startTime: String? //开始时间 时间戳
-//    public let endTime: String? //结束时间 时间戳
-//    public let version: String? //小于等于此版本生效
-//    public let hidden: Bool? //是否显示
-//    let subscribeType: KMAdvertisementSubscribeType? //是否订阅
-//    public var content: [KMAdvertisementModelSection]?
-//}
-//
-//@objcMembers public class KMAdvertisementModelSection: NSObject, Codable {
-//    public let sectionTitle: KMAdvertisementModelItem.Text?
-//    public var content: [KMAdvertisementModelItem]?
-//}
-//
-//@objcMembers public class KMAdvertisementModelItem: NSObject, Codable {
-//    public var productID: String?
-//    public let startTime: String? //开始时间 时间戳
-//    public let endTime: String? //结束时间 时间戳
-//    public var hidden: Bool?
-//    
-//    public var index: Int?
-//    public let title: Text?
-//    public let imageURL: Image?
-//    public let ipadImageURL: Image?
-//    public let linkURL: Language?
-//    public let tips: Language?
-//    public let button: Text?
-//    public var actionType: KMAdvertisementActionType = .URL
-//    
-//    public struct Text: Codable {
-//        public let font: Font?
-//        public let color: Color?
-//        public let background: Background?
-//        public let language: Language?
-//    }
-//    
-//    public struct Font: Codable {
-//        public let name: String?
-//        public let size: Int?
-//    }
-//    
-//    public struct Color: Codable {
-//        let height: ColorState?
-//        let normal: ColorState?
-//        
-//        struct ColorState: Codable {
-//            public let dark: ColorInfo?
-//            public let universal: ColorInfo?
-//            
-//            struct ColorInfo: Codable {
-//                public var hex: String?
-//                public var alpha: Float?
-//            }
-//        }
-//    }
-//
-//    public struct Background: Codable {
-//        let color: Color?
-//        let layer: Layer?
-//        
-//        struct Layer: Codable {
-//            public let cornerRadius: CGFloat?
-//            public let borderWidth: CGFloat?
-//            public let borderColor: Color?
-//        }
-//    }
-//    
-//    public struct Image: Codable {
-//        public let height: ImageInfo?
-//        public let normal: ImageInfo?
-//        public let background: Background?
-//    }
-//    
-//    public struct ImageInfo: Codable {
-//        public let dark: Language?
-//        public let universal: Language?
-//    }
-//    
-//    public class Language: NSObject, Codable {
-//        public let en: String?
-//        public let zh_TW: String?
-//        public let zh_CN: String?
-//    }
-//}

+ 9 - 63
PDF Office/PDF Master/Class/KMAdvertisement/Model/KMAdvertisementModelTransition.swift

@@ -7,33 +7,6 @@
 import AppKit
 @objcMembers open class KMAdvertisementModelTransition: NSObject {
     //MARK: 模型转换
-    //颜色模型转换
-//    public static func transitionColor(color: KMAdvertisementModelItem.Color?, highlight:Bool) -> NSColor {
-//        var result = NSColor.clear
-//        guard let tempColor = color else { return result }
-//        
-//        if highlight {
-//            let darkHex = tempColor.height?.dark?.hex
-//            let darkAlpha = tempColor.height?.dark?.alpha
-//            let universalHex = tempColor.height?.universal?.hex
-//            let universalAlpha = tempColor.height?.universal?.alpha
-//            let light = NSColor.init(hex: universalHex ?? "").withAlphaComponent(CGFloat(universalAlpha ?? 1))
-//            let dark = NSColor.init(hex: darkHex ?? universalHex ?? "").withAlphaComponent(CGFloat(darkAlpha ?? universalAlpha ?? 1))
-//            
-//            result = KMAdvertisementConfig.adapterDark(light: light , dark: dark) as! NSColor
-//        } else {
-//            let darkHex = tempColor.normal?.dark?.hex
-//            let darkAlpha = tempColor.normal?.dark?.alpha
-//            let universalHex = tempColor.normal?.universal?.hex
-//            let universalAlpha = tempColor.normal?.universal?.alpha
-//            
-//            let light = NSColor.init(hex: universalHex ?? "").withAlphaComponent(CGFloat(universalAlpha ?? 1))
-//            let dark = NSColor.init(hex: darkHex ?? universalHex ?? "").withAlphaComponent(CGFloat(darkAlpha ?? universalAlpha ?? 1))
-//            result = KMAdvertisementConfig.adapterDark(light: light, dark: dark) as! NSColor
-//        }
-//        
-//        return result
-//    }
     
     //图片转换
     public static func transitionImagePath(image: KMAdvertisementItemInfo.Image?, highlight:Bool) -> String {
@@ -80,8 +53,6 @@ import AppKit
         let chooseLanguage = allLanguages.first
         return chooseLanguage ?? "en"
 #elseif os(OSX)
-//        let locale = NSLocale.current.languageCode
-        //        let chooseLanguage = Locale.preferredLanguages[0]
         let allLanguages: [String] = UserDefaults.standard.object(forKey: "AppleLanguages") as! [String]
         let chooseLanguage: String = allLanguages.first ?? "en"
         return chooseLanguage
@@ -116,39 +87,14 @@ extension NSColor {
         } else {
             self.init(hex: 0)  // <--- black
         }
-        // or using ternaries as requested
-        // let hexString = hex.starts(with: "#") ? String(hex.dropFirst()) : hex
-        // let ui64 = UInt64(hexString, radix: 16)
-        // self.init(hex: ui64 != nil ? Int(ui64!) : 0)
     }
-        
-        convenience init(hex: Int) {
-            let components = (
-                R: CGFloat((hex >> 16) & 0xff) / 255,
-                G: CGFloat((hex >> 08) & 0xff) / 255,
-                B: CGFloat((hex >> 00) & 0xff) / 255
-            )
-            self.init(red: components.R, green: components.G, blue: components.B, alpha: 1)
-        }
-
-//     func toHex(alpha: Bool = false) -> String? {
-//        guard let components = cgColor.components, components.count >= 3 else {
-//            return nil
-//        }
-//        
-//        let r = Float(components[0])
-//        let g = Float(components[1])
-//        let b = Float(components[2])
-//        var a = Float(1.0)
-//        
-//        if components.count >= 4 {
-//            a = Float(components[3])
-//        }
-//        
-//        if alpha {
-//            return String(format: "%02lX%02lX%02lX%02lX", lroundf(r * 255), lroundf(g * 255), lroundf(b * 255), lroundf(a * 255))
-//        } else {
-//            return String(format: "%02lX%02lX%02lX", lroundf(r * 255), lroundf(g * 255), lroundf(b * 255))
-//        }
-//    }
+    
+    convenience init(hex: Int) {
+        let components = (
+            R: CGFloat((hex >> 16) & 0xff) / 255,
+            G: CGFloat((hex >> 08) & 0xff) / 255,
+            B: CGFloat((hex >> 00) & 0xff) / 255
+        )
+        self.init(red: components.R, green: components.G, blue: components.B, alpha: 1)
+    }
 }

+ 10 - 4
PDF Office/PDF Master/Class/KMAdvertisement/View/KMRecommondPopWindow/KMRecommondPopWindow.m

@@ -75,7 +75,7 @@ NSWindowDelegate>
     }];
 
     self.titleLbl.stringValue = [KMAdvertisementModelTransition transitionLanguageWithLangeuage:_info.name];
-    NSString *subT = [KMAdvertisementModelTransition transitionLanguageWithLangeuage:_info.subTitle];
+    NSString *subT = [KMAdvertisementModelTransition transitionLanguageWithLangeuage:_info.newSubTitle];
     if ([subT containsString:@"\\n"]) {
         subT = [subT stringByReplacingOccurrencesOfString:@"\\n" withString:@"\n"];
     }
@@ -95,8 +95,13 @@ NSWindowDelegate>
 #pragma mark - IBAction
 - (IBAction)buyAction:(NSButton *)sender {
     if (_info.version) {
-        [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:[KMAdvertisementModelTransition transitionLanguageWithLangeuage:_info.linkURL]]];
-        
+        if ([_info.jumpType isEqualToString:@"Comparison Sheet"]) {
+            [[KMProductCompareWC shared] setOrientation:NO];
+            [[KMProductCompareWC shared] showWindow:nil];
+        } else {
+            [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:[KMAdvertisementModelTransition transitionLanguageWithLangeuage:_info.linkURL]]];
+        }
+         
         if (_info.firebase != nil) {
             [KMAdvertisementModelTransition sendFireBaseEventWithFirebase:_info.firebase];
         }
@@ -114,8 +119,9 @@ NSWindowDelegate>
 #pragma mark - Noti
 - (void)recommondInfoUpdateNoti:(NSNotification *)noti {
     if ([noti.object[@"unique"] isEqualToString:_info.version]) {
+        __weak typeof(self) weakSelf = self;
         dispatch_async(dispatch_get_main_queue(), ^{
-            self.infoImg.image = _info.iconImage;
+            weakSelf.infoImg.image = weakSelf.info.iconImage;
         });
     }
 }

+ 3 - 3
PDF Office/PDF Master/Class/KMAdvertisement/View/Tableview/Cell/KMAdvertisementCollectionHeadView.xib

@@ -1,15 +1,15 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22155" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22505" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
     <dependencies>
         <deployment identifier="macosx"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22155"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22505"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
         <customObject id="-2" userLabel="File's Owner"/>
         <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
         <customObject id="-3" userLabel="Application" customClass="NSObject"/>
-        <customView id="c22-O7-iKe" customClass="KMAdvertisementCollectionHeadView" customModule="PDF_Master" customModuleProvider="target">
+        <customView id="c22-O7-iKe" customClass="KMAdvertisementCollectionHeadView" customModule="PDF_Reader_Pro" customModuleProvider="target">
             <rect key="frame" x="0.0" y="0.0" width="480" height="30"/>
             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
             <subviews>

+ 3 - 3
PDF Office/PDF Master/Class/KMAdvertisement/View/Tableview/Cell/KMAdvertisementCollectionViewItem.xib

@@ -1,12 +1,12 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22155" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22505" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
     <dependencies>
         <deployment identifier="macosx"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22155"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22505"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
-        <customObject id="-2" userLabel="File's Owner" customClass="KMAdvertisementCollectionViewItem" customModule="PDF_Master" customModuleProvider="target">
+        <customObject id="-2" userLabel="File's Owner" customClass="KMAdvertisementCollectionViewItem" customModule="PDF_Reader_Pro" customModuleProvider="target">
             <connections>
                 <outlet property="contentView" destination="LdM-b2-48C" id="hxf-ZH-gmW"/>
                 <outlet property="iconImageView" destination="EPJ-sc-6wa" id="qq0-MW-YTG"/>

+ 1 - 1
PDF Office/PDF Master/Class/KMLightMember/InAppPurchase/KMPurchaseManager.swift

@@ -32,7 +32,7 @@ class KMPurchaseManager: NSObject {
             //方便调整订阅状态
 //            return .subscription
 #endif
-            if (IAPProductsManager.default().isAvailableAllFunction()) {
+            if (KMMemberInfo.shared.isMemberAllFunction) {
                 return .subscription
             }
             

+ 1 - 1
PDF Office/PDF Master/Class/KMLightMember/KMRequestServer/KMRequestServer.swift

@@ -64,7 +64,7 @@ typealias KMHttpRequestServerComplete = (_ task: URLSessionDataTask?, _ response
         sessionManager.requestSerializer = AFJSONRequestSerializer()
         sessionManager.responseSerializer = AFJSONResponseSerializer()
         sessionManager.responseSerializer.acceptableContentTypes = ["application/json","text/html","text/json","text/javascript","text/plain","image/gif"]
-        sessionManager.requestSerializer.timeoutInterval = 10
+        sessionManager.requestSerializer.timeoutInterval = 60
 //        [requestSerializer setValue:@"application/vnd.api+json;version=1" forHTTPHeaderField:@"Accept"];
         if (requestSerializer != nil) {
             requestSerializer!(sessionManager.requestSerializer);

+ 2 - 2
PDF Office/PDF Master/Class/PDFTools/AddPassword/New/View/KMSecurityView.swift

@@ -159,8 +159,8 @@ extension KMSecurityView {
 
 extension KMSecurityView {
     @IBAction func batchButtonAction(_ sender: Any) {
-        if !IAPProductsManager.default().isAvailableAllFunction(){
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
         guard let callBack = batchAction else { return }

+ 2 - 2
PDF Office/PDF Master/Class/PDFTools/Compress/Controller/KMCompressWIndowControllerNew.swift

@@ -62,8 +62,8 @@ class KMCompressWIndowControllerNew: KMBaseWindowController {
         
         self.compressView.batchAction = { [unowned self] view in
             print("Batch 按钮点击")
-            if !IAPProductsManager.default().isAvailableAllFunction(){
-                KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            if KMMemberInfo.shared.isMemberAllFunction == false {
+                KMMemberInfo.shared.advancedFunctionUsage()
                 return
             }
             guard let callBack = batchAction else { return }

+ 45 - 67
PDF Office/PDF Master/Class/PDFTools/Convert/NewController/KMConvertWindowController.swift

@@ -278,8 +278,8 @@ let kConvertFileSavePath = (kTempSavePath?.stringByAppendingPathComponent("conve
         // 桌机版
         wordItem.tag = convertSample.rawValue
         isShowAdvanced = true
-        if IAPProductsManager.default().isAvailableAllFunction() {
-            if IAPProductsManager.default().isAvailableAdvancedPDFToOffice() {
+        if KMMemberInfo.shared.isMemberAllFunction {
+            if KMMemberInfo.shared.isPermitConvert {
                 convertSample = .AdvancedWord
                 wordItem.tag = convertSample.rawValue
                 isShowAdvanced = false
@@ -294,8 +294,8 @@ let kConvertFileSavePath = (kTempSavePath?.stringByAppendingPathComponent("conve
         convertSample = .Word
         wordItem.tag = convertSample.rawValue
         isShowAdvanced = true
-        if IAPProductsManager.default().isAvailableAllFunction() {
-            if IAPProductsManager.default().isAvailableAdvancedPDFToOffice() {
+        if KMMemberInfo.shared.isMemberAllFunction {
+            if KMMemberInfo.shared.isPermitConvert {
                 convertSample = .AdvancedWord
                 wordItem.tag = convertSample.rawValue
                 isShowAdvanced = false
@@ -312,7 +312,7 @@ let kConvertFileSavePath = (kTempSavePath?.stringByAppendingPathComponent("conve
         wordItem.tag = convertSample.rawValue
         // 付费版
         isShowAdvanced = true
-        if IAPProductsManager.default().isAvailableAdvancedPDFToOffice() {
+        if KMMemberInfo.shared.isPermitConvert {
             isShowAdvanced = false
             convertSample = .AdvancedWord
             wordItem.tag = convertSample.rawValue
@@ -415,10 +415,10 @@ let kConvertFileSavePath = (kTempSavePath?.stringByAppendingPathComponent("conve
         excelStyleBox.isHidden = true
 #if VERSION_FREE
         // 座机版
-        if !IAPProductsManager.default().isAvailableAllFunction() {
+        if !KMMemberInfo.shared.isMemberAllFunction {
             moreLabelString = String(format: "%@ %@", KMLocalizedString("The first 10 pages for free"), KMLocalizedString("Unlimited Convert"))
         } else {
-            if !IAPProductsManager.default().isAvailableAdvancedPDFToOffice() {
+            if !KMMemberInfo.shared.isPermitConvert {
                 if .Word == self.convertType ||
                     self.convertType == .AdvancedWord ||
                     .Excel == self.convertType ||
@@ -438,7 +438,7 @@ let kConvertFileSavePath = (kTempSavePath?.stringByAppendingPathComponent("conve
         
 #else
         // 付费版
-        if !(IAPProductsManager.default().isAvailableAdvancedPDFToOffice()) {
+        if !(KMMemberInfo.shared.isPermitConvert) {
             if .Word == self.convertType ||
                 self.convertType == .AdvancedWord ||
                 .Excel == self.convertType ||
@@ -596,12 +596,6 @@ let kConvertFileSavePath = (kTempSavePath?.stringByAppendingPathComponent("conve
                 print("Error removing item at path: (error.localizedDescription)")
             }
         }
-//        if self.prePDFView.document != nil {
-//            self.prePDFView.document = nil
-//        }
-//        if self.tempPDFDocument != nil {
-//            self.tempPDFDocument = nil
-//        }
         self.km_quick_endSheet()
     }
     func showCriticalAlert(_ alertMsg: String?) {
@@ -618,19 +612,15 @@ let kConvertFileSavePath = (kTempSavePath?.stringByAppendingPathComponent("conve
     }
     func produceNewPDF(with pagesArray: [CPDFPage]) {
         tempPDFDocument = nil
-//        if self.tempPDFDocument == nil || self.tempPDFDocument!.isLocked {
-            self.tempPDFDocument = CPDFDocument()
-//        }
+        self.tempPDFDocument = CPDFDocument()
         var indexs = IndexSet()
         let pageCount = self.pdfDocument?.pageCount ?? 0
         for addedPage in pagesArray {
-//            tempPDFDocument?.insertPageObject(addedPage, at: tempPDFDocument!.pageCount)
             let idx = addedPage.pageIndex()
             if idx >= 0 && idx < pageCount {
                 indexs.insert(IndexSet.Element(idx))
             }
         }
-//        self.tempPDFDocument?.removePage(at: IndexSet(integersIn: 0..<(Int(self.tempPDFDocument?.pageCount ?? 0))))
         _ = self.tempPDFDocument?.importPages(indexs, from: self.pdfDocument, at: 0)
         self.prePDFView.document = self.tempPDFDocument
         self.prePDFView.layoutDocumentView()
@@ -711,8 +701,8 @@ let kConvertFileSavePath = (kTempSavePath?.stringByAppendingPathComponent("conve
         }
     }
     @IBAction func buttonClicked_Batch(_ sender: NSButton) {
-        if !IAPProductsManager.default().isAvailableAllFunction() {
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
         if self.pdfDocument?.documentURL == nil {
@@ -759,8 +749,8 @@ let kConvertFileSavePath = (kTempSavePath?.stringByAppendingPathComponent("conve
 #if VERSION_FREE
 #if VERSION_DMG
         // 桌机版
-        if IAPProductsManager.default().isAvailableAllFunction() {
-            if IAPProductsManager.default().isAvailableAdvancedPDFToOffice() {
+        if KMMemberInfo.shared.isMemberAllFunction {
+            if KMMemberInfo.shared.isPermitConvert {
                 isLimitConvert = false
             } else {
                 if (.PNG == self.convertType ||
@@ -779,13 +769,13 @@ let kConvertFileSavePath = (kTempSavePath?.stringByAppendingPathComponent("conve
         }
 #else
         // 免费版
-        if IAPProductsManager.default().isAvailableAdvancedPDFToOffice() == false {
+        if KMMemberInfo.shared.isPermitConvert == false {
             isLimitConvert = true
         }
 #endif
 #else
         // 付费版
-        if IAPProductsManager.default().isAvailableAdvancedPDFToOffice() {
+        if KMMemberInfo.shared.isPermitConvert {
             isLimitConvert = false
         } else {
             if (.PNG == self.convertType ||
@@ -1010,7 +1000,7 @@ let kConvertFileSavePath = (kTempSavePath?.stringByAppendingPathComponent("conve
             FMTrackEventManager.defaultManager.trackEvent(event: "PUW", withProperties: ["PUW_Btn": "Btn_PUW_Converter_Premium_Upgrade"])
         }
 #if VERSION_DMG
-        if IAPProductsManager.default().isAvailableAllFunction() && !IAPProductsManager.default().isAvailableAdvancedPDFToOffice() {
+        if KMMemberInfo.shared.isMemberAllFunction && !KMMemberInfo.shared.isPermitConvert {
             let limitWC = KMPurchaseLimitWindowController.currentLimitWC()
             limitWC.continueBlock = { windowController in
                 
@@ -1018,50 +1008,38 @@ let kConvertFileSavePath = (kTempSavePath?.stringByAppendingPathComponent("conve
             limitWC.window?.center()
             limitWC.showWindow(nil)
         } else {
-            let winC = KMPurchaseCompareWindowController.sharedInstance()
-            if convertType == .Word || convertType == .AdvancedWord {
-                winC?.kEventName = "Reading_PDFtoWord_BuyNow"
-            } else if convertType == .Excel {
-                winC?.kEventName = "Reading_PDFtoExcel_BuyNow"
-            } else if convertType == .PPT {
-                winC?.kEventName = "Reading_PDFtoPPT_BuyNow"
-            } else if convertType == .RTF {
-                winC?.kEventName = "Reading_PDFtoRTF_BuyNow"
-            } else if convertType == .CSV {
-                winC?.kEventName = "Reading_PDFtoCSV_BuyNow"
-            } else if convertType == .Text {
-                winC?.kEventName = "Reading_PDFtoText_BuyNow"
-            }
-            if convertType == .JPEG || convertType == .JPG || convertType == .PNG || convertType == .GIF || convertType == .TIFF || convertType == .TGA || convertType == .BMP || convertType == .JP2 {
-                winC?.kEventName = "Reading_PDFtoImage_BuyNow"
+            if KMMemberInfo.shared.userScenarioType == .dmg_type16 ||
+                KMMemberInfo.shared.userScenarioType == .dmg_type17 {
+                let alert = NSAlert()
+                alert.alertStyle = .critical
+                alert.informativeText = NSLocalizedString("Sorry, you do not have the rights to this paid feature and cannot use it. If you have any questions, please contact customer service at support@pdfreaderpro.com", comment: "")
+                alert.addButton(withTitle: NSLocalizedString("Got it", comment: ""))
+                alert.runModal()
+            } else {
+                KMProductCompareWC.shared.orientation = false
+                let winC = KMProductCompareWC.shared
+                if convertType == .Word || convertType == .AdvancedWord {
+                    winC.kEventName = "Reading_PDFtoWord_BuyNow"
+                } else if convertType == .Excel {
+                    winC.kEventName = "Reading_PDFtoExcel_BuyNow"
+                } else if convertType == .PPT {
+                    winC.kEventName = "Reading_PDFtoPPT_BuyNow"
+                } else if convertType == .RTF {
+                    winC.kEventName = "Reading_PDFtoRTF_BuyNow"
+                } else if convertType == .CSV {
+                    winC.kEventName = "Reading_PDFtoCSV_BuyNow"
+                } else if convertType == .Text {
+                    winC.kEventName = "Reading_PDFtoText_BuyNow"
+                }
+                if convertType == .JPEG || convertType == .JPG || convertType == .PNG || convertType == .GIF || convertType == .TIFF || convertType == .TGA || convertType == .BMP || convertType == .JP2 {
+                    winC.kEventName = "Reading_PDFtoImage_BuyNow"
+                }
+                winC.showWindow(nil)
             }
-//            else if convertType == . {
-//                winC?.kEventName = "Reading_PDFtoExcel_BuyNow"
-//            }
-            winC?.showWindow(nil)
         }
 #else
-        if IAPProductsManager.default().isAvailableAllFunction() {
-            var vc: KMToolCompareWindowController? = nil
-            if convertType == .Word || convertType == .AdvancedWord {
-//                vc = KMToolCompareWindowController(toolType: .Convert, selectNum: 1)
-                vc = KMToolCompareWindowController.toolCompare(toolType: .Convert, selectNum: 1)
-            } else if convertType == .Excel {
-//                vc = KMToolCompareWindowController(toolType: .Convert, selectNum: 2)
-                vc = KMToolCompareWindowController.toolCompare(toolType: .Convert, selectNum: 2)
-            } else if convertType == .PPT {
-//                vc = KMToolCompareWindowController(toolType: .Convert, selectNum: 3)
-                vc = KMToolCompareWindowController.toolCompare(toolType: .Convert, selectNum: 3)
-            } else if convertType.rawValue < 15 && convertType.rawValue > 7 {
-//                vc = KMToolCompareWindowController(toolType: .Convert, selectNum: 4)
-                vc = KMToolCompareWindowController.toolCompare(toolType: .Convert, selectNum: 4)
-            } else {
-//                vc = KMToolCompareWindowController(toolType: .Convert, selectNum: 0)
-                vc = KMToolCompareWindowController.toolCompare(toolType: .Convert, selectNum: 0)
-            }
-            vc?.showWindow(nil)
-        } else {
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+        if !KMMemberInfo.shared.isPermitConvert {
+            KMMemberInfo.shared.advancedFunctionUsage()
         }
 #endif
         self.buttonClicked_Cancel(self.cancelButton)

+ 61 - 61
PDF Office/PDF Master/Class/PDFTools/Convert/NewController/KMConvertWindowController.xib

@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21507" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22505" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
     <dependencies>
         <deployment identifier="macosx"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21507"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22505"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
@@ -57,18 +57,18 @@
             <windowStyleMask key="styleMask" titled="YES" closable="YES"/>
             <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
             <rect key="contentRect" x="196" y="240" width="740" height="461"/>
-            <rect key="screenRect" x="0.0" y="0.0" width="2560" height="1415"/>
+            <rect key="screenRect" x="0.0" y="0.0" width="1800" height="1125"/>
             <value key="minSize" type="size" width="700" height="524"/>
             <value key="maxSize" type="size" width="700" height="524"/>
             <view key="contentView" wantsLayer="YES" id="se5-gp-TjO">
-                <rect key="frame" x="0.0" y="0.0" width="718" height="461"/>
+                <rect key="frame" x="0.0" y="0.0" width="730" height="461"/>
                 <autoresizingMask key="autoresizingMask"/>
                 <subviews>
                     <customView translatesAutoresizingMaskIntoConstraints="NO" id="9e4-ci-JPQ">
-                        <rect key="frame" x="0.0" y="50" width="359" height="411"/>
+                        <rect key="frame" x="0.0" y="50" width="365" height="411"/>
                         <subviews>
                             <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="X0Q-MI-4li">
-                                <rect key="frame" x="89" y="8" width="26" height="26"/>
+                                <rect key="frame" x="92" y="8" width="26" height="26"/>
                                 <buttonCell key="cell" type="round" bezelStyle="circular" image="NSGoLeftTemplate" imagePosition="overlaps" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="YGV-tr-NS4">
                                     <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                     <font key="font" metaFont="system"/>
@@ -78,7 +78,7 @@
                                 </connections>
                             </button>
                             <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="GvR-dU-AwU">
-                                <rect key="frame" x="245" y="8" width="26" height="26"/>
+                                <rect key="frame" x="248" y="8" width="26" height="26"/>
                                 <buttonCell key="cell" type="round" bezelStyle="circular" image="NSGoRightTemplate" imagePosition="only" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="QOu-1C-uhN">
                                     <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                     <font key="font" metaFont="system"/>
@@ -88,9 +88,9 @@
                                 </connections>
                             </button>
                             <customView translatesAutoresizingMaskIntoConstraints="NO" id="ioL-gH-agJ">
-                                <rect key="frame" x="152" y="10" width="56" height="22"/>
+                                <rect key="frame" x="155" y="10" width="56" height="22"/>
                                 <subviews>
-                                    <textField verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="SOc-Qh-Bb7">
+                                    <textField focusRingType="none" verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="SOc-Qh-Bb7">
                                         <rect key="frame" x="0.0" y="0.0" width="40" height="22"/>
                                         <constraints>
                                             <constraint firstAttribute="height" constant="22" id="3Jq-m9-DeQ"/>
@@ -105,7 +105,7 @@
                                             <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                                         </textFieldCell>
                                     </textField>
-                                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="z3E-2c-R0k">
+                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="z3E-2c-R0k">
                                         <rect key="frame" x="38" y="3" width="20" height="16"/>
                                         <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="/ 0" id="DYY-wZ-Qj3">
                                             <font key="font" metaFont="system"/>
@@ -124,7 +124,7 @@
                                 </constraints>
                             </customView>
                             <customView translatesAutoresizingMaskIntoConstraints="NO" id="CBx-MQ-cXc">
-                                <rect key="frame" x="61" y="58" width="237" height="325"/>
+                                <rect key="frame" x="64" y="58" width="237" height="325"/>
                                 <constraints>
                                     <constraint firstAttribute="width" constant="237" id="OK9-1V-VQX"/>
                                     <constraint firstAttribute="height" constant="325" id="kqf-Fz-QAp"/>
@@ -144,12 +144,12 @@
                         </constraints>
                     </customView>
                     <box borderType="none" title="Box" titlePosition="noTitle" translatesAutoresizingMaskIntoConstraints="NO" id="3if-Xs-8Lv">
-                        <rect key="frame" x="361" y="340" width="320" height="106"/>
+                        <rect key="frame" x="370" y="338" width="320" height="106"/>
                         <view key="contentView" id="LK9-KO-5na">
                             <rect key="frame" x="0.0" y="0.0" width="320" height="106"/>
                             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                             <subviews>
-                                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="A06-uc-UOW">
+                                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="A06-uc-UOW">
                                     <rect key="frame" x="8" y="90" width="47" height="16"/>
                                     <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Format" id="I6C-fa-6mM">
                                         <font key="font" metaFont="system"/>
@@ -159,9 +159,6 @@
                                 </textField>
                                 <popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="t4K-iL-FMn">
                                     <rect key="frame" x="7" y="56" width="307" height="25"/>
-                                    <constraints>
-                                        <constraint firstAttribute="width" constant="300" id="IW3-cd-aif"/>
-                                    </constraints>
                                     <popUpButtonCell key="cell" type="push" title="Item 1" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="KBs-bN-RpD" id="ebx-HJ-6OI">
                                         <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
                                         <font key="font" metaFont="menu"/>
@@ -173,15 +170,15 @@
                                             </items>
                                         </menu>
                                     </popUpButtonCell>
+                                    <constraints>
+                                        <constraint firstAttribute="width" constant="300" id="IW3-cd-aif"/>
+                                    </constraints>
                                     <connections>
                                         <action selector="buttonClicked_FormatSelect:" target="-2" id="lCG-tq-rib"/>
                                     </connections>
                                 </popUpButton>
                                 <popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="uzi-Qq-1mA">
                                     <rect key="frame" x="7" y="31" width="307" height="25"/>
-                                    <constraints>
-                                        <constraint firstAttribute="width" constant="300" id="oBX-Vi-zz7"/>
-                                    </constraints>
                                     <popUpButtonCell key="cell" type="push" title="Item 1" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="0hG-DD-Tut" id="cKX-RA-nQ3">
                                         <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
                                         <font key="font" metaFont="menu"/>
@@ -193,6 +190,9 @@
                                             </items>
                                         </menu>
                                     </popUpButtonCell>
+                                    <constraints>
+                                        <constraint firstAttribute="width" constant="300" id="oBX-Vi-zz7"/>
+                                    </constraints>
                                     <connections>
                                         <action selector="buttonClicked_DpiSelect:" target="-2" id="NLj-oZ-ugE"/>
                                     </connections>
@@ -205,16 +205,16 @@
                                         <subviews>
                                             <button translatesAutoresizingMaskIntoConstraints="NO" id="Krh-ke-zCQ">
                                                 <rect key="frame" x="0.0" y="17" width="20" height="14"/>
-                                                <constraints>
-                                                    <constraint firstAttribute="height" constant="14" id="1xt-pb-BQw"/>
-                                                    <constraint firstAttribute="width" constant="20" id="uhJ-3t-Ju2"/>
-                                                </constraints>
                                                 <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="KMImageNameElsei" imagePosition="only" alignment="center" imageScaling="proportionallyUpOrDown" inset="2" id="dFD-t2-jnf">
                                                     <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                                     <font key="font" metaFont="system"/>
                                                 </buttonCell>
+                                                <constraints>
+                                                    <constraint firstAttribute="height" constant="14" id="1xt-pb-BQw"/>
+                                                    <constraint firstAttribute="width" constant="20" id="uhJ-3t-Ju2"/>
+                                                </constraints>
                                             </button>
-                                            <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ckr-Wn-5Tf">
+                                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ckr-Wn-5Tf">
                                                 <rect key="frame" x="23" y="0.0" width="279" height="34"/>
                                                 <textFieldCell key="cell" title="Export PDF to Word and other Microsoft Office formats" id="sBS-zf-jgA">
                                                     <font key="font" metaFont="system"/>
@@ -239,13 +239,13 @@
                                 </box>
                                 <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="0Oz-gz-y6o">
                                     <rect key="frame" x="10" y="0.0" width="300" height="34"/>
-                                    <constraints>
-                                        <constraint firstAttribute="width" constant="300" id="ELD-e9-9yi"/>
-                                    </constraints>
                                     <buttonCell key="cell" type="bevel" bezelStyle="rounded" alignment="left" imageScaling="proportionallyDown" inset="2" id="pOx-Rw-MAb">
                                         <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                         <font key="font" usesAppearanceFont="YES"/>
                                     </buttonCell>
+                                    <constraints>
+                                        <constraint firstAttribute="width" constant="300" id="ELD-e9-9yi"/>
+                                    </constraints>
                                     <connections>
                                         <action selector="buttonClicked_MoreConvert:" target="-2" id="PeR-FV-SSc"/>
                                     </connections>
@@ -269,7 +269,7 @@
                         </view>
                     </box>
                     <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="EbI-Wk-CCv">
-                        <rect key="frame" x="623" y="7" width="82" height="32"/>
+                        <rect key="frame" x="635" y="7" width="82" height="32"/>
                         <buttonCell key="cell" type="push" title="Convert" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="clK-sD-xOl">
                             <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                             <font key="font" metaFont="system"/>
@@ -282,7 +282,7 @@ DQ
                         </connections>
                     </button>
                     <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="GDI-DM-qg0">
-                        <rect key="frame" x="552" y="7" width="76" height="32"/>
+                        <rect key="frame" x="564" y="7" width="76" height="32"/>
                         <buttonCell key="cell" type="push" title="Cancel" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="q06-7Z-li8">
                             <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                             <font key="font" metaFont="system"/>
@@ -315,13 +315,13 @@ Gw
                         </connections>
                     </button>
                     <box hidden="YES" title="Box" titlePosition="noTitle" translatesAutoresizingMaskIntoConstraints="NO" id="aGQ-OF-WXB">
-                        <rect key="frame" x="361" y="253" width="310" height="68"/>
+                        <rect key="frame" x="367" y="231" width="316" height="84"/>
                         <view key="contentView" id="uh9-fs-9X0">
-                            <rect key="frame" x="3" y="3" width="304" height="62"/>
+                            <rect key="frame" x="4" y="5" width="308" height="76"/>
                             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                             <subviews>
                                 <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="47o-yu-wxa">
-                                    <rect key="frame" x="8" y="35" width="286" height="18"/>
+                                    <rect key="frame" x="8" y="49" width="290" height="18"/>
                                     <buttonCell key="cell" type="radio" title="Convert each page to a separate worksheet" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="hVc-jP-hSM">
                                         <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
                                         <font key="font" metaFont="system"/>
@@ -331,7 +331,7 @@ Gw
                                     </connections>
                                 </button>
                                 <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="DRT-Gg-QW1">
-                                    <rect key="frame" x="8" y="9" width="286" height="18"/>
+                                    <rect key="frame" x="8" y="9" width="290" height="32"/>
                                     <buttonCell key="cell" type="radio" title="Convert all pages to a single worksheet(.xlsx)" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="MKV-oI-hZ0">
                                         <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
                                         <font key="font" metaFont="system"/>
@@ -354,17 +354,13 @@ Gw
                         <font key="titleFont" metaFont="system"/>
                     </box>
                     <box title="Box" titlePosition="noTitle" translatesAutoresizingMaskIntoConstraints="NO" id="R2E-0y-EaA">
-                        <rect key="frame" x="361" y="227" width="310" height="94"/>
+                        <rect key="frame" x="367" y="219" width="316" height="96"/>
                         <view key="contentView" id="kdq-H7-lg3">
-                            <rect key="frame" x="3" y="3" width="304" height="88"/>
+                            <rect key="frame" x="4" y="5" width="308" height="88"/>
                             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                             <subviews>
                                 <popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="CPK-uS-4AE">
                                     <rect key="frame" x="105" y="56" width="152" height="25"/>
-                                    <constraints>
-                                        <constraint firstAttribute="width" constant="145" id="5hD-rD-DZ8"/>
-                                        <constraint firstAttribute="height" constant="20" id="8wZ-JW-rou"/>
-                                    </constraints>
                                     <popUpButtonCell key="cell" type="push" title="For Each Page" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="vBM-XN-pKT" id="HZz-2Y-eKt">
                                         <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
                                         <font key="font" metaFont="menu"/>
@@ -375,6 +371,10 @@ Gw
                                             </items>
                                         </menu>
                                     </popUpButtonCell>
+                                    <constraints>
+                                        <constraint firstAttribute="width" constant="145" id="5hD-rD-DZ8"/>
+                                        <constraint firstAttribute="height" constant="20" id="8wZ-JW-rou"/>
+                                    </constraints>
                                     <connections>
                                         <action selector="buttonClicked_allContentMenu:" target="-2" id="wyQ-bt-seM"/>
                                     </connections>
@@ -401,10 +401,6 @@ Gw
                                 </button>
                                 <popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="sq1-RM-hUc">
                                     <rect key="frame" x="96" y="30" width="152" height="25"/>
-                                    <constraints>
-                                        <constraint firstAttribute="width" constant="145" id="0cK-il-Qad"/>
-                                        <constraint firstAttribute="height" constant="20" id="79Y-YK-1pF"/>
-                                    </constraints>
                                     <popUpButtonCell key="cell" type="push" title="For Each Table" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="kP9-YO-QvE" id="JnU-hE-bwh">
                                         <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
                                         <font key="font" metaFont="menu"/>
@@ -416,6 +412,10 @@ Gw
                                             </items>
                                         </menu>
                                     </popUpButtonCell>
+                                    <constraints>
+                                        <constraint firstAttribute="width" constant="145" id="0cK-il-Qad"/>
+                                        <constraint firstAttribute="height" constant="20" id="79Y-YK-1pF"/>
+                                    </constraints>
                                     <connections>
                                         <action selector="buttonClicked_tableMenu:" target="-2" id="n4N-sh-aIg"/>
                                     </connections>
@@ -450,7 +450,7 @@ Gw
                         <font key="titleFont" metaFont="system"/>
                     </box>
                     <button hidden="YES" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="UPM-vO-BAb">
-                        <rect key="frame" x="373" y="225" width="65" height="18"/>
+                        <rect key="frame" x="379" y="219" width="65" height="18"/>
                         <buttonCell key="cell" type="check" title="Check" bezelStyle="regularSquare" imagePosition="left" inset="2" id="2xT-Sc-V3O">
                             <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
                             <font key="font" metaFont="system"/>
@@ -459,8 +459,8 @@ Gw
                             <action selector="buttonClicked_extractTable:" target="-2" id="0No-NT-2vF"/>
                         </connections>
                     </button>
-                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="hQ6-L6-IW2">
-                        <rect key="frame" x="373" y="320" width="37" height="16"/>
+                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="hQ6-L6-IW2">
+                        <rect key="frame" x="379" y="314" width="37" height="16"/>
                         <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="8X0-Hn-fJf">
                             <font key="font" metaFont="system"/>
                             <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
@@ -468,13 +468,13 @@ Gw
                         </textFieldCell>
                     </textField>
                     <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="RKf-EU-J3Q">
-                        <rect key="frame" x="364" y="78" width="304" height="26"/>
+                        <rect key="frame" x="370" y="72" width="310" height="26"/>
                         <view key="contentView" id="VEv-bs-dGD">
-                            <rect key="frame" x="0.0" y="0.0" width="304" height="26"/>
+                            <rect key="frame" x="0.0" y="0.0" width="310" height="26"/>
                             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                             <subviews>
-                                <comboBox verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="C7X-dj-upX">
-                                    <rect key="frame" x="78" y="0.0" width="229" height="25"/>
+                                <comboBox focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="C7X-dj-upX">
+                                    <rect key="frame" x="77" y="1" width="236" height="23"/>
                                     <comboBoxCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" drawsBackground="YES" completes="NO" numberOfVisibleItems="5" id="fAw-sA-HYt">
                                         <font key="font" metaFont="system"/>
                                         <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@@ -484,7 +484,7 @@ Gw
                                         <action selector="comboxClicked_PageRange:" target="-2" id="OGm-9q-dQX"/>
                                     </connections>
                                 </comboBox>
-                                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="WyY-GN-uWB">
+                                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="WyY-GN-uWB">
                                     <rect key="frame" x="3" y="5" width="77" height="16"/>
                                     <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Page Range" id="Jzz-uI-b7L">
                                         <font key="font" metaFont="system"/>
@@ -504,13 +504,13 @@ Gw
                         </view>
                     </box>
                     <box title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="Bpl-Ox-GVU">
-                        <rect key="frame" x="361" y="109" width="310" height="107"/>
+                        <rect key="frame" x="367" y="101" width="316" height="109"/>
                         <view key="contentView" id="hjw-de-suY">
-                            <rect key="frame" x="3" y="3" width="304" height="87"/>
+                            <rect key="frame" x="4" y="5" width="308" height="87"/>
                             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                             <subviews>
                                 <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="7HT-Vw-exZ">
-                                    <rect key="frame" x="8" y="60" width="286" height="18"/>
+                                    <rect key="frame" x="8" y="60" width="290" height="18"/>
                                     <buttonCell key="cell" type="check" title="Recognize text if needed" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="jEU-BR-ipB">
                                         <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
                                         <font key="font" metaFont="system"/>
@@ -519,8 +519,8 @@ Gw
                                         <action selector="comboxClicked_SupoortOCR:" target="-2" id="lpV-4f-DKW"/>
                                     </connections>
                                 </button>
-                                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="q5x-u2-fel">
-                                    <rect key="frame" x="8" y="35" width="288" height="16"/>
+                                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="q5x-u2-fel">
+                                    <rect key="frame" x="8" y="35" width="292" height="16"/>
                                     <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Document Language:" id="FGe-fQ-1t7">
                                         <font key="font" metaFont="system"/>
                                         <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
@@ -529,9 +529,6 @@ Gw
                                 </textField>
                                 <popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="lx7-mQ-roc">
                                     <rect key="frame" x="7" y="6" width="257" height="25"/>
-                                    <constraints>
-                                        <constraint firstAttribute="width" constant="250" id="wV8-iV-cmR"/>
-                                    </constraints>
                                     <popUpButtonCell key="cell" type="push" title="Chinese" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="18N-pp-JIQ" id="6dK-AP-h63">
                                         <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
                                         <font key="font" metaFont="menu"/>
@@ -663,6 +660,9 @@ Gw
                                             </items>
                                         </menu>
                                     </popUpButtonCell>
+                                    <constraints>
+                                        <constraint firstAttribute="width" constant="250" id="wV8-iV-cmR"/>
+                                    </constraints>
                                     <connections>
                                         <action selector="comboxClicked_OcrLanguage:" target="-2" id="eCf-WM-PUN"/>
                                     </connections>
@@ -725,7 +725,7 @@ Gw
     </objects>
     <resources>
         <image name="KMImageNameElsei" width="15" height="14"/>
-        <image name="NSGoLeftTemplate" width="10" height="14"/>
-        <image name="NSGoRightTemplate" width="10" height="14"/>
+        <image name="NSGoLeftTemplate" width="12" height="17"/>
+        <image name="NSGoRightTemplate" width="12" height="17"/>
     </resources>
 </document>

+ 11 - 13
PDF Office/PDF Master/Class/PDFTools/Convert/NewController/KMToolCompareWindowController.swift

@@ -34,7 +34,7 @@ var currentWindowController: KMToolCompareWindowController? = nil
                 
                 self.addWaingView(view: self.window?.contentView ?? NSView())
             } else if type == .STORE {
-                IAPProductsManager.default().make(IAPProductsManager.default().pdfToOfficeProduct)
+                IAPProductsManager.default().make(IAPProductsManager.default().pdfToOfficePackPermanent_pro)
                 self.addWaingView(view: self.window?.contentView ?? NSView())
             } else if type == .DMG {
                 self.officeVerificationBuy()
@@ -51,7 +51,6 @@ var currentWindowController: KMToolCompareWindowController? = nil
                 if #available(macOS 10.13, *) {
                     self.close()
                 }
-//                KMPurchaseCompareWindowController.sharedInstance().startModal("")
             } else if type == .license {
                 self.close()
                 if VerificationManager.default().status == .none {
@@ -61,13 +60,14 @@ var currentWindowController: KMToolCompareWindowController? = nil
                     let vc = KMVerificationWindowController.verification(with: .activate)
                     vc?.callback = { [weak self] in
 #if VERSION_DMG
-                        KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+                        KMProductCompareWC.shared.orientation = false
+                        KMProductCompareWC.shared.showWindow(nil)
 #else
-                        if IAPProductsManager.default().isAvailableAllFunction() {
+                        if KMMemberInfo.shared.isMemberAllFunction == false {
                             let vc = KMToolCompareWindowController.toolCompare(toolType: self?.type ?? .Convert, selectNum: self?.selectIndex ?? 0)
                             vc.showWindow(nil)
                         } else {
-                            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+                            KMMemberInfo.shared.advancedFunctionUsage()
                         }
 #endif
                     }
@@ -77,13 +77,13 @@ var currentWindowController: KMToolCompareWindowController? = nil
                 IAPProductsManager.default().restoreSubscriptions()
                 self.addWaingView(view: self.window?.contentView ?? NSView())
             } else if type == .month {
-                IAPProductsManager.default().make(IAPProductsManager.default().newlyMonthProduct)
+                IAPProductsManager.default().make(IAPProductsManager.default().allAccessPackNew6months_lite)
                 self.addWaingView(view: self.window?.contentView ?? NSView())
             } else if type == .oneTime {
 #if VERSION_DMG
                 self.verificationBuy()
 #else
-                IAPProductsManager.default().make(IAPProductsManager.default().allAccessProduct)
+                IAPProductsManager.default().make(IAPProductsManager.default().allAccessPackPermanent_lite)
                 self.addWaingView(view: self.window?.contentView ?? NSView())
 #endif
             }
@@ -137,7 +137,7 @@ var currentWindowController: KMToolCompareWindowController? = nil
         if type == .Convert {
             self.window?.title = NSLocalizedString("PDF to Office", comment: "")
             
-            if IAPProductsManager.default().isAvailableAllFunction() {
+            if KMMemberInfo.shared.isMemberAllFunction {
                 self.setContentView(self.payConvertCompareViewController?.view ?? NSView())
             } else {
                 self.setContentView(self.convertCompareViewController?.view ?? NSView())
@@ -228,7 +228,7 @@ var currentWindowController: KMToolCompareWindowController? = nil
     }
     
     func reloadData() {
-        if IAPProductsManager.default().isAvailableAllFunction() {
+        if KMMemberInfo.shared.isMemberAllFunction {
             self.payConvertCompareViewController?.reloadData()
         } else {
             self.convertCompareViewController?.reloadData()
@@ -237,9 +237,7 @@ var currentWindowController: KMToolCompareWindowController? = nil
     
     func verificationBuy() {
 #if VERSION_DMG
-//        var url = URL(string: Store_Link + "?utm_source=MacAppDmg&utm_campaign=StoreLink&utm_medium=PdfStore")
-//        NSWorkspace.shared.open(url!)
-        let embeddedWC = KMPurchaseEmbeddedWindowController.currentFirstTrialWC("com.brother.pdfreaderpro.mac.product_1")
+        let embeddedWC = KMPurchaseEmbeddedWindowController.currentCode(KMStandardAnnualSubscriptionCodeKey_DMG)
         embeddedWC.showWindow(nil)
         embeddedWC.window?.center()
 #endif
@@ -250,7 +248,7 @@ var currentWindowController: KMToolCompareWindowController? = nil
 //        var url = URL(string: Store_Link + "?product_code=product_2&utm_source=MacAppDmg&utm_campaign=OfficeStoreLink&utm_medium=PdfOfficeStore")
 //        NSWorkspace.shared.open(url!)
 //        FMTrackEventManager.defaultManager.trackOnceEvent(event: "PUW", withProperties: ["PUW_Btn":"Btn_PUW_PDFtoOffice_Buy"])
-        let embeddedWC = KMPurchaseEmbeddedWindowController.currentFirstTrialWC("com.brother.pdfreaderpro.mac.product_2")
+        let embeddedWC = DMGEmbeddedOldWC.currentFirstTrialWC("com.brother.pdfreaderpro.mac.product_2")
         embeddedWC.showWindow(nil)
         embeddedWC.window?.center()
 #endif

+ 13 - 17
PDF Office/PDF Master/Class/PDFTools/Merge/MergeNew/KMMergeWindowController.swift

@@ -98,14 +98,14 @@ extension KMMergeWindowController {
             size = size + file.fileSize
         }
         
-        if !IAPProductsManager.default().isAvailableAllFunction() && (files.count >= 2 || size > 20 * 1024 * 1024) {
-            let winC = KMPurchaseCompareWindowController.sharedInstance()
+        if KMMemberInfo.shared.isMemberAllFunction == false && (files.count >= 2 || size > 20 * 1024 * 1024) {
+            let winC = KMProductCompareWC.shared
             if self.kEventTag == 1 {
-                winC?.kEventName = "Onbrd_Merge_BuyNow"
+                winC.kEventName = "Onbrd_Merge_BuyNow"
             } else {
-                winC?.kEventName = "Reading_Merge_BuyNow"
+                winC.kEventName = "Reading_Merge_BuyNow"
             }
-            winC?.showWindow(nil)
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
         
@@ -145,8 +145,8 @@ extension KMMergeWindowController {
                                     let fileSize = attribe?[FileAttributeKey.size] as? CGFloat ?? 0
                                     size = fileSize + size
 
-                                    if !IAPProductsManager.default().isAvailableAllFunction() && (files.count >= 2 || size > 20 * 1024 * 1024) {
-                                        KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+                                    if KMMemberInfo.shared.isMemberAllFunction == false && (files.count >= 2 || size > 20 * 1024 * 1024) {
+                                        KMMemberInfo.shared.advancedFunctionUsage()
                                         return
                                     }
                                     
@@ -167,11 +167,11 @@ extension KMMergeWindowController {
                 let fileSize = attribe?[FileAttributeKey.size] as? CGFloat ?? 0
                 size = fileSize + size
 
-                if !IAPProductsManager.default().isAvailableAllFunction() && (files.count >= 2 || size > 20 * 1024 * 1024) {
-                    KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+                if KMMemberInfo.shared.isMemberAllFunction == false && (files.count >= 2 || size > 20 * 1024 * 1024) {
+                    KMMemberInfo.shared.advancedFunctionUsage()
                     return
                 }
-                
+
                 self.mergeView.addFilePaths(urls: array)
             }
         }
@@ -200,11 +200,11 @@ extension KMMergeWindowController {
             size = size + file.fileSize
         }
         
-        if !IAPProductsManager.default().isAvailableAllFunction() && (files.count >= 2 || size > 20 * 1024 * 1024) {
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+        if KMMemberInfo.shared.isMemberAllFunction == false && (files.count >= 2 || size > 20 * 1024 * 1024) {
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
-        
+
         var filesCount = 1
         if self.oriDucumentUrl != nil {
             filesCount = 0
@@ -217,10 +217,6 @@ extension KMMergeWindowController {
             return
         }
         
-//        _isSuccessfully = NO;
-//        [self.nCancelVC setEnabled:NO];
-//        self.canMerge = NO;
-//
         var rootPDFOutlineArray: [PDFOutline] = []
         var allPage = true //只有是全部才支持大纲的合并
         for file in files {

+ 0 - 33
PDF Office/PDF Master/Class/PDFTools/Merge/MergeNew/View/KMMergeView.swift

@@ -245,30 +245,6 @@ extension KMMergeView: NSTableViewDelegate {
             let url = URL(string: filePath!)
             var array = [URL]()
             array.append(url!)
-//               for path in fileNames {
-//                   if !isExistAtFilePath(filePath: path) {
-//                       continue
-//                   }
-////                       if let attrib = try? FileManager.default.attributesOfItem(atPath: path),
-////                          let fileSize = attrib[.size] as? CGFloat {
-////
-////                           allFileSize += fileSize
-////
-////                           if !IAPProductsManager.defaultManager.isAvailableAllFunction {
-////                               // 免费版只支持2个文件做合并,小于20M的文件合并
-////                               if files.count >= 2 || allFileSize > (20 * 1024 * 1024) {
-////                                   let vc = KMToolCompareWindowController.toolCompare(with: .pageEdit, setSelectIndex: 1)
-////                                   vc.showWindow(nil)
-////
-////                                   allFileSize -= fileSize
-////                                   addFiles(array)
-////                                   result = true
-////                                   return false
-////                               }
-////                           }
-//                   array.append(URL(string: path)!)
-////                       }
-//               }
             var theFileUrls: [URL] = []
             for fileUrl in array {
                 if KMTools.isImageType(fileUrl.pathExtension) {
@@ -427,15 +403,6 @@ extension KMMergeView {
                     file.oriFilePath = fileUrl.path
                     file.myPDFDocument = document
                     
-//                    let attribe = try?FileManager.default.attributesOfItem(atPath: fileURL.path)
-//                    let fileSize = attribe?[FileAttributeKey.size] as? CGFloat ?? 0
-//                    size = fileSize + size
-//
-//                    if !IAPProductsManager.default().isAvailableAllFunction() && (files.count >= 2 || size > 20 * 1024 * 1024) {
-//                        KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
-//                        return
-//                    }
-                    
                     self.files.append(file)
                 }
             }

+ 8 - 10
PDF Office/PDF Master/Class/PDFTools/Merge/OCPart/KMPDFEditAppendWindow.m

@@ -446,10 +446,10 @@ static KMPDFEditAppendWindow *windowController = nil;
             CGFloat fileSize = [[attrib objectForKey:NSFileSize] floatValue];
             
             weakSelf.allFileSize =  weakSelf.allFileSize + fileSize;
-            if (![IAPProductsManager defaultManager].isAvailableAllFunction) {
+            if (![KMMemberInfo shared].isMemberAllFunction) {
                 //免費版只支援2個檔案做合併小于20M的文件合并
                 if (self->_files.count >= 2 || self.allFileSize > (20 * 1024 * 1024)) {
-                    [[KMPurchaseCompareWindowController sharedInstance] showWindow:nil];
+                    [[KMMemberInfo shared] advancedFunctionUsage];
                     self.allFileSize = self.allFileSize - fileSize;
 
                     [self addFiles:array];
@@ -1095,10 +1095,10 @@ static KMPDFEditAppendWindow *windowController = nil;
             CGFloat fileSize = [[attrib objectForKey:NSFileSize] floatValue];
             
             self.allFileSize = self.allFileSize + fileSize;
-            if (![IAPProductsManager defaultManager].isAvailableAllFunction) {
+            if (![KMMemberInfo shared].isMemberAllFunction) {
                 //免費版只支援2個檔案做合併小于20M的文件合并
                 if (_files.count >= 2 || self.allFileSize > (20 * 1024 * 1024)) {
-                    [[KMPurchaseCompareWindowController sharedInstance] showWindow:nil];
+                    [[KMMemberInfo shared] advancedFunctionUsage];
                     self.allFileSize = self.allFileSize - fileSize;
                     [self addFiles:array];
                     result = YES;
@@ -1303,13 +1303,12 @@ static KMPDFEditAppendWindow *windowController = nil;
         
     }
     
-    if (![IAPProductsManager defaultManager].isAvailableAllFunction) {
+    if (![KMMemberInfo shared].isMemberAllFunction) {
         if (allSize > (20 * 1024 * 1024) || _files.count > 2) {
-            [[KMPurchaseCompareWindowController sharedInstance] showWindow:nil];
+            [[KMMemberInfo shared] advancedFunctionUsage];
             return;
         }
     }
-    
     _isSuccessfully = NO;
     [self.nCancelVC setEnabled:NO];
     self.canMerge = NO;
@@ -1592,13 +1591,12 @@ static KMPDFEditAppendWindow *windowController = nil;
 
 - (IBAction)buttonItemClicked_AddFile:(id)sender
 {
-    if (![IAPProductsManager defaultManager].isAvailableAllFunction) {
+    if (![KMMemberInfo shared].isMemberAllFunction) {
         //免費版只支援2個檔案做合併小于20M的文件合并
         if (_files.count >= 2 || self.allFileSize > (20 * 1024 * 1024)) {
-            [[KMPurchaseCompareWindowController sharedInstance] showWindow:nil];
+            [[KMMemberInfo shared] advancedFunctionUsage];
             return;
         }
-        
     }
     NSMenu *menu = [[NSMenu alloc] init];
     NSMenuItem *addFileItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"add files", "") action:@selector(itemAddFileAction) keyEquivalent:@""];

+ 71 - 87
PDF Office/PDF Master/Class/PDFTools/PageEdit/Controller/KMPDFEditViewController.swift

@@ -510,10 +510,11 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
     }
     
     override func cutAction() {
-        if IAPProductsManager.default().isAvailableAllFunction() == false {
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
+
         let pageCnt = self.pdfDocument?.pageCount ?? 0
         if (self.thumbnailView.selectionIndexPaths.count == pageCnt) {
             self._progressHUD(message: NSLocalizedString("Can not delete all pages.", comment: ""))
@@ -529,14 +530,14 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
     }
     
     override func deleteAction() {
-        if IAPProductsManager.default().isAvailableAllFunction() == false {
-            let winC = KMPurchaseCompareWindowController.sharedInstance()
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            let winC = KMProductCompareWC.shared
             if self.kEventTag == 1 {
-                winC?.kEventName = "Onbrd_EditPage_BuyNow"
+                winC.kEventName = "Onbrd_EditPage_BuyNow"
             } else {
-                winC?.kEventName = "Reading_Delete_BuyNow"
+                winC.kEventName = "Reading_Delete_BuyNow"
             }
-            winC?.showWindow(nil)
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
         
@@ -575,16 +576,14 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
     }
     
     override func leftRotateAction() {
-        if IAPProductsManager.default().isAvailableAllFunction() == false {
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
         
         self.trackEvent(type: .leftRotate)
         
         super.leftRotateAction()
-        
-//        self.toolBar.unSelectItem(for: KMToolbarPageEditLeftRotateItemIdentifier)
     }
     
     override func leftRotateIndexpaths(indexpaths: Set<IndexPath>) {
@@ -596,14 +595,14 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
     }
     
     override func rightRotateAction() {
-        if IAPProductsManager.default().isAvailableAllFunction() == false {
-            let winC = KMPurchaseCompareWindowController.sharedInstance()
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            let winC = KMProductCompareWC.shared
             if self.kEventTag == 1 {
-                winC?.kEventName = "Onbrd_EditPage_BuyNow"
+                winC.kEventName = "Onbrd_EditPage_BuyNow"
             } else {
-                winC?.kEventName = "Reading_Rotate_BuyNow"
+                winC.kEventName = "Reading_Rotate_BuyNow"
             }
-            winC?.showWindow(nil)
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
         
@@ -615,8 +614,6 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
         self.trackEvent(type: .rightRotate)
         
         super.rightRotateAction()
-        
-//        self.toolBar.unSelectItem(for: KMToolbarPageEditRightRotateItemIdentifier)
     }
     
     override func rightRotateIndexpaths(indexpaths: Set<IndexPath>) {
@@ -638,8 +635,8 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
     }
     
     override func pasteAction() {
-        if IAPProductsManager.default().isAvailableAllFunction() == false {
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
         
@@ -667,8 +664,8 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
     }
     
     override func pastePage(at index: Int) {
-        if IAPProductsManager.default().isAvailableAllFunction() == false {
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
         
@@ -676,14 +673,14 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
     }
     
     override func extractAction() {
-        if IAPProductsManager.default().isAvailableAllFunction() == false {
-            let winC = KMPurchaseCompareWindowController.sharedInstance()
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            let winC = KMProductCompareWC.shared
             if self.kEventTag == 1 {
-                winC?.kEventName = "Onbrd_EditPage_BuyNow"
+                winC.kEventName = "Onbrd_EditPage_BuyNow"
             } else {
-                winC?.kEventName = "Reading_Extract_BuyNow"
+                winC.kEventName = "Reading_Extract_BuyNow"
             }
-            winC?.showWindow(nil)
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
         
@@ -702,14 +699,14 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
     }
     
     override func replaceAction() {
-        if IAPProductsManager.default().isAvailableAllFunction() == false {
-            let winC = KMPurchaseCompareWindowController.sharedInstance()
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            let winC = KMProductCompareWC.shared
             if self.kEventTag == 1 {
-                winC?.kEventName = "Onbrd_EditPage_BuyNow"
+                winC.kEventName = "Onbrd_EditPage_BuyNow"
             } else {
-                winC?.kEventName = "Reading_Replace_BuyNow"
+                winC.kEventName = "Reading_Replace_BuyNow"
             }
-            winC?.showWindow(nil)
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
         
@@ -744,14 +741,14 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
     }
     
     override func splitAction() {
-        if IAPProductsManager.default().isAvailableAllFunction() == false {
-            let winC = KMPurchaseCompareWindowController.sharedInstance()
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            let winC = KMProductCompareWC.shared
             if self.kEventTag == 1 {
-                winC?.kEventName = "Onbrd_EditPage_BuyNow"
+                winC.kEventName = "Onbrd_EditPage_BuyNow"
             } else {
-                winC?.kEventName = "Reading_Split_BuyNow"
+                winC.kEventName = "Reading_Split_BuyNow"
             }
-            winC?.showWindow(nil)
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
         
@@ -773,8 +770,8 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
     }
     
     func splitMethod(windowC: KMPageEditSplitWindowController, model: KMPageEditSplitSettingModel, limit: Bool = false) {
-        if IAPProductsManager.default().isAvailableAllFunction() == false {
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
         
@@ -787,23 +784,14 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
     }
     
     func splitMenuAction() {
-//        if (![IAPProductsManager defaultManager].isAvailableAllFunction) {
-//    #if VERSION_DMG
-//            [[KMPurchaseCompareWindowController sharedInstance] showWindow:nil];
-//    #else
-//            KMToolCompareWindowController * vc = [KMToolCompareWindowController toolCompareWithType:KMCompareWithToolType_PageEdit setSelectIndex:1];
-//            [vc startModal:nil];
-//    #endif
-//            return;
-//        }
-        if IAPProductsManager.default().isAvailableAllFunction() == false {
-            let winC = KMPurchaseCompareWindowController.sharedInstance()
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            let winC = KMProductCompareWC.shared
             if self.kEventTag == 1 {
-                winC?.kEventName = "Onbrd_EditPage_BuyNow"
+                winC.kEventName = "Onbrd_EditPage_BuyNow"
             } else {
-                winC?.kEventName = "Reading_Split_BuyNow"
+                winC.kEventName = "Reading_Split_BuyNow"
             }
-            winC?.showWindow(nil)
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
         
@@ -881,10 +869,10 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
     }
     
     override func reverseAction() {
-        if IAPProductsManager.default().isAvailableAllFunction() == false {
-            let winC = KMPurchaseCompareWindowController.sharedInstance()
-            winC?.kEventName = "Reading_Reverse_BuyNow"
-            winC?.showWindow(nil)
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            let winC = KMProductCompareWC.shared
+            winC.kEventName = "Reading_Reverse_BuyNow"
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
         
@@ -1369,14 +1357,14 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
     }
     
     @objc func item_insertCustomPage(sender: NSMenuItem?) {
-        if IAPProductsManager.default().isAvailableAllFunction() == false {
-            let winC = KMPurchaseCompareWindowController.sharedInstance()
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            let winC = KMProductCompareWC.shared
             if self.kEventTag == 1 {
-                winC?.kEventName = "Onbrd_EditPage_BuyNow"
+                winC.kEventName = "Onbrd_EditPage_BuyNow"
             } else {
-                winC?.kEventName = "Reading_InsertBlankPage_BuyNow"
+                winC.kEventName = "Reading_InsertBlankPage_BuyNow"
             }
-            winC?.showWindow(nil)
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
         
@@ -1430,14 +1418,14 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
     }
     
     @objc func item_insertFromImage(sender: NSMenuItem?) {
-        if IAPProductsManager.default().isAvailableAllFunction() == false {
-            let winC = KMPurchaseCompareWindowController.sharedInstance()
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            let winC = KMProductCompareWC.shared
             if self.kEventTag == 1 {
-                winC?.kEventName = "Onbrd_EditPage_BuyNow"
+                winC.kEventName = "Onbrd_EditPage_BuyNow"
             } else {
-                winC?.kEventName = "Reading_InsertImage_BuyNow"
+                winC.kEventName = "Reading_InsertImage_BuyNow"
             }
-            winC?.showWindow(nil)
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
         
@@ -1492,17 +1480,16 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
     }
     
     @objc func item_insertFromClipboard(sender: NSMenuItem?) {
-        if IAPProductsManager.default().isAvailableAllFunction() == false {
-            let winC = KMPurchaseCompareWindowController.sharedInstance()
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            let winC = KMProductCompareWC.shared
             if self.kEventTag == 1 {
-                winC?.kEventName = "Onbrd_EditPage_BuyNow"
+                winC.kEventName = "Onbrd_EditPage_BuyNow"
             } else {
-                winC?.kEventName = "Reading_InsertClipboard_BuyNow"
+                winC.kEventName = "Reading_InsertClipboard_BuyNow"
             }
-            winC?.showWindow(nil)
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
-//        self.choosePositionWindow {[weak self] index in
             /// 插入位置
             var error: NSError?
             guard let document: CPDFDocument = self.openDocumentWithImageFromPasteboard(NSPasteboard.general, error: &error) else {
@@ -1514,25 +1501,23 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
             }
             let ips: Set<IndexPath> = [IndexPath(item: index, section: 0)]
             self.thumbnailView.collectionView.scrollToItems(at: ips, scrollPosition: .centeredVertically)
-//        }
     }
     
     @objc func item_insertFromScanner(sender: NSMenuItem?) {
-        if IAPProductsManager.default().isAvailableAllFunction() == false {
-            let winC = KMPurchaseCompareWindowController.sharedInstance()
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            let winC = KMProductCompareWC.shared
             if self.kEventTag == 1 {
-                winC?.kEventName = "Onbrd_EditPage_BuyNow"
+                winC.kEventName = "Onbrd_EditPage_BuyNow"
             } else {
-                winC?.kEventName = "Reading_InsertSacnner_BuyNow"
+                winC.kEventName = "Reading_InsertSacnner_BuyNow"
             }
-            winC?.showWindow(nil)
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
         
         let vc = KMDeviceBrowserWindowController.shared
         vc.type = .scanner
         vc.importScannerFileCallback = { [weak self](url: NSURL) -> Void in
-//            self?.choosePositionWindow {[weak self] index in
                 /// 插入位置
                 if let imag = NSImage(contentsOfFile: url.path! ) {
                     let index = (self?.getInsertIndex())! + 1
@@ -1544,7 +1529,6 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
                     let ips: Set<IndexPath> = [IndexPath(item: index, section: 0)]
                     self?.thumbnailView.collectionView.scrollToItems(at: ips, scrollPosition: .centeredVertically)
                 }
-//            }
             vc.close()
         }
         vc.showWindow(NSApp.mainWindow)
@@ -1596,14 +1580,14 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
     }
     
     func extractSelectPageItemAction() {
-        if IAPProductsManager.default().isAvailableAllFunction() == false {
-            let winC = KMPurchaseCompareWindowController.sharedInstance()
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            let winC = KMProductCompareWC.shared
             if self.kEventTag == 1 {
-                winC?.kEventName = "Onbrd_EditPage_BuyNow"
+                winC.kEventName = "Onbrd_EditPage_BuyNow"
             } else {
-                winC?.kEventName = "Reading_Extract_BuyNow"
+                winC.kEventName = "Reading_Extract_BuyNow"
             }
-            winC?.showWindow(nil)
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
         
@@ -1853,7 +1837,7 @@ extension KMPDFEditViewController {
 
 extension KMPDFEditViewController: KMThumbnailViewDelegate {
     func thumbnailView(thumbanView: KMThumbnailView, canDragItemsAt indexPaths: Set<IndexPath>, with event: NSEvent) -> Bool {
-        return IAPProductsManager.default().isAvailableAllFunction()
+        return KMMemberInfo.shared.isMemberAllFunction
     }
     func thumbnailView(thumbanView: KMThumbnailView, shouldAcceptDrop draggingInfo: NSDraggingInfo, indexPath: IndexPath, dropOperation: NSCollectionView.DropOperation) -> Bool {
         return true

+ 4 - 4
PDF Office/PDF Master/Class/PDFTools/PageEdit/Window/SplitWindowController.swift

@@ -85,7 +85,7 @@ class SplitWindowController: KMBaseWindowController {
         self._fileURL = document.documentURL
         self._PDFDocument = document
         self.fileAttribute?.pdfDocument = document
-        if IAPProductsManager.default().isAvailableAllFunction() {
+        if KMMemberInfo.shared.isMemberAllFunction {
             self._splitType = 3
         }
     }
@@ -157,10 +157,10 @@ class SplitWindowController: KMBaseWindowController {
     }
     
     @IBAction func buttonItemClicked_ByRange(_ sender: AnyObject) {
-        if !IAPProductsManager.default().isAvailableAllFunction() {
+        if KMMemberInfo.shared.isMemberAllFunction == false {
             pageFromButton.state = .off
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
-            return;
+            KMMemberInfo.shared.advancedFunctionUsage()
+            return
         }
 
         self.byFileButton.state = .off

+ 2 - 2
PDF Office/PDF Master/Class/PDFTools/Print/KMPrintWindowController.swift

@@ -186,8 +186,8 @@ extension KMPrintWindowController {
     
     static func showNewPrintWindowControll(inputDocument: CPDFDocument?, inputType: DataNavigationViewButtonActionType = .Print, inputPageRange: KMPrintPageRange, printType: KMPrintModelType = .size) {
         //订阅
-        if !IAPProductsManager.default().isAvailableAllFunction() && printType != .size {
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+        if KMMemberInfo.shared.isMemberAllFunction == false && printType != .size {
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
         

+ 10 - 10
PDF Office/PDF Master/Class/PDFTools/Print/PrintHelper/PrintManage/KMPDFPrintManageWindowController.m

@@ -11,7 +11,6 @@
 #import "KMPDFMultiplePrintWindowController.h"
 #import "KMPDFPosterPrintWindowController.h"
 #import "KMPDFBookletWindowController.h"
-#import "KMPurchaseCompareWindowController.h"
 //#import "NSWindowController_SKExtensions.h"
 
 //#import "KMBookletMaskView.h"
@@ -598,11 +597,11 @@ typedef NS_ENUM(NSUInteger, kPageSelectStyle) {
 //Poster
 - (IBAction)buttonItemClicked_Poster:(NSButton *)sender
 {
-    if (![IAPProductsManager defaultManager].isAvailableAllFunction) {
+    if (![KMMemberInfo shared].isMemberAllFunction) {
         [self close];
-        NSWindowController *winC = [KMPurchaseCompareWindowController sharedInstance];
+        NSWindowController *winC = [KMProductCompareWC shared];
         winC.kEventName = @"MenuBar_PrintPoster_BuyNow";
-        [winC showWindow:nil];
+        [[KMMemberInfo shared] advancedFunctionUsage];
         return;
     }
     
@@ -617,13 +616,14 @@ typedef NS_ENUM(NSUInteger, kPageSelectStyle) {
 //Multiple
 - (IBAction)buttonItemClicked_Multiple:(NSButton *)sender
 {
-    if (![IAPProductsManager defaultManager].isAvailableAllFunction) {
+    if (![KMMemberInfo shared].isMemberAllFunction) {
         [self close];
-        NSWindowController *winC = [KMPurchaseCompareWindowController sharedInstance];
+        NSWindowController *winC = [KMProductCompareWC shared];
         winC.kEventName = @"MenuBar_PrintMultiple_BuyNow";
-        [winC showWindow:nil];
+        [[KMMemberInfo shared] advancedFunctionUsage];
         return;
     }
+
     [self close];
     _multipleVC = [[KMPDFMultiplePrintWindowController alloc] initWithPDFDocument:self.pdfDocument];
 //    [multipleVC beginSheetModalForWindow:[NSApp mainWindow] completionHandler:nil];
@@ -635,11 +635,11 @@ typedef NS_ENUM(NSUInteger, kPageSelectStyle) {
 //Booklet
 - (IBAction)buttonItemClicked_Booklet:(NSButton *)sender
 {
-    if (![IAPProductsManager defaultManager].isAvailableAllFunction) {
+    if (![KMMemberInfo shared].isMemberAllFunction) {
         [self close];
-        NSWindowController *winC = [KMPurchaseCompareWindowController sharedInstance];
+        NSWindowController *winC = [KMProductCompareWC shared];
         winC.kEventName = @"MenuBar_PrintBooklet_BuyNow";
-        [winC showWindow:nil];
+        [[KMMemberInfo shared] advancedFunctionUsage];
         return;
     }
     

+ 4 - 9
PDF Office/PDF Master/Class/PDFTools/RemovePassword/New/View/KMRemovePasswordView.swift

@@ -52,11 +52,6 @@ class KMRemovePasswordView: KMBaseXibView {
 
 extension KMRemovePasswordView {
     @IBAction func batchButtonAction(_ sender: Any) {
-//        if !IAPProductsManager.default().isAvailableAllFunction(){
-//            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
-//            return
-//        }
-
         guard let callBack = batchAction else { return }
         
         callBack(self, files)
@@ -70,10 +65,10 @@ extension KMRemovePasswordView {
     
     
     @IBAction func removeButtonAction(_ sender: Any) {
-        if !IAPProductsManager.default().isAvailableAllFunction(){
-            let winC = KMPurchaseCompareWindowController.sharedInstance()
-            winC?.kEventName = "Reading_RemoveSecurity_BuyNow"
-            winC?.showWindow(nil)
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            let winC = KMProductCompareWC.shared
+            winC.kEventName = "Reading_RemoveSecurity_BuyNow"
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
 

+ 4 - 4
PDF Office/PDF Master/Class/PDFTools/RemovePassword/VC/KMBatchOperateRemovePasswordViewController.swift

@@ -120,10 +120,10 @@ class KMBatchOperateRemovePasswordViewController: KMBatchOperateBaseViewControll
         if self.files?.count ?? 0 < 1 {
             return;
         }
-        if !IAPProductsManager.default().isAvailableAllFunction(){
-            let winC = KMPurchaseCompareWindowController.sharedInstance()
-            winC?.kEventName = "Onbrd_Security_BuyNow"
-            winC?.showWindow(nil)
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            let winC = KMProductCompareWC.shared
+            winC.kEventName = "Onbrd_Security_BuyNow"
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
         //MARK: 判断是否能用pro功能

+ 2 - 2
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFListView.m

@@ -1651,8 +1651,8 @@ NSNotificationName const CPDFListViewDisplayModeChangeNotification = @"CPDFListV
         
         NSString *filePath = filePaths.firstObject;
         if ([supportArray containsObject:[filePath.pathExtension lowercaseString]]) {
-            if (![[IAPProductsManager defaultManager] isAvailableAllFunction]) {
-                [[KMPurchaseCompareWindowController sharedInstance] showWindow:nil];
+            if (![KMMemberInfo shared].isMemberAllFunction) {
+                [[KMMemberInfo shared] advancedFunctionUsage];
                 return NO;
             }
             if([[filePath.pathExtension lowercaseString] isEqual:@"pdf"]) {

+ 1 - 1
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFListViewExtension/CPDFListView+Tool.m

@@ -136,7 +136,7 @@
                 area &= ~CPDFLinkArea;
             
             NSRect rect = CPDFListViewRectFromCenterAndSize(p, CGSizeMake(80, 100));
-            CPDFSelection *sel = [page selectionForRect:rect];
+//            CPDFSelection *sel = [page selectionForRect:rect];
             if ([self isEditWithCurrentFreeText:self.activeAnnotation] && [[self.activeAnnotation page] isEqual:page] && NSPointInRect(p, [self.activeAnnotation bounds])) {
                 area = CPDFTextFieldArea;
             } else if ((area & CReadingBarArea) == 0) {

+ 19 - 19
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController+Thumbnail.swift

@@ -322,8 +322,8 @@ extension KMLeftSideViewController {
 
 extension KMLeftSideViewController {
     @objc func cutPage(_ sender: AnyObject?) {
-        if IAPProductsManager.default().isAvailableAllFunction() == false {
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
         self.tableView(self.thumbnailTableView, cutRowsWithIndexes: self.thumbnailTableView.selectedRowIndexes)
@@ -338,24 +338,24 @@ extension KMLeftSideViewController {
     }
     
     @objc func deletePage(_ sender: AnyObject?) {
-        if IAPProductsManager.default().isAvailableAllFunction() == false {
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
         self.tableView(self.thumbnailTableView, deleteRowsWithIndexes: self.thumbnailTableView.selectedRowIndexes)
     }
     
     @objc func rotatePageMenuAction(_ sender: AnyObject?) {
-        if IAPProductsManager.default().isAvailableAllFunction() == false {
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
         self.tableView(self.thumbnailTableView, rotateRowsWithIndexes: self.thumbnailTableView.selectedRowIndexes as NSIndexSet)
     }
     
     @objc func quickInsert(_ sender: AnyObject?) {
-        if IAPProductsManager.default().isAvailableAllFunction() == false {
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
         let idx = self.thumbnailTableView.selectedRowIndexes.first ?? NSNotFound
@@ -373,8 +373,8 @@ extension KMLeftSideViewController {
     }
     
     @objc func insert(_ sender: AnyObject?) {
-        if IAPProductsManager.default().isAvailableAllFunction() == false {
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
         guard let document = self.pdfDocument() else {
@@ -433,8 +433,8 @@ extension KMLeftSideViewController {
     }
     
     @objc func insertPDF(_ sender: AnyObject?) {
-        if IAPProductsManager.default().isAvailableAllFunction() == false {
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
                 
@@ -536,8 +536,8 @@ extension KMLeftSideViewController {
     }
     
     @objc func extractPage(_ sender: AnyObject?) {
-        if IAPProductsManager.default().isAvailableAllFunction() == false {
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
         self.tableView(self.thumbnailTableView, extractRowsWithIndexes: self.thumbnailTableView.selectedRowIndexes)
@@ -548,11 +548,11 @@ extension KMLeftSideViewController {
     }
     
     @objc func displayPageSize(_ sender: AnyObject?) {
-        if IAPProductsManager.default().isAvailableAllFunction() == false {
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
-        
+
         self.isDisplayPageSize = !self.isDisplayPageSize
         KMDataManager.ud_set(self.isDisplayPageSize, forKey: Self.Key.thumbDisplayPageSizeKey)
         
@@ -562,8 +562,8 @@ extension KMLeftSideViewController {
     }
     
     @objc func sharePage(_ sender: AnyObject?) {
-        if IAPProductsManager.default().isAvailableAllFunction() == false {
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
         

+ 8 - 8
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController.swift

@@ -899,8 +899,8 @@ extension KMLeftSideViewController: KMBotaTableViewDelegate {
     }
     
     func tableView(_ aTableView: NSTableView, pasteFromPasteboard pboard: NSPasteboard?) {
-        if IAPProductsManager.default().isAvailableAllFunction() == false {
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
         
@@ -1488,8 +1488,8 @@ extension KMLeftSideViewController: NSTableViewDelegate, NSTableViewDataSource {
             self.layoutDocumentView()
             self.resetThumbnails()
         } else if pasteboard.availableType(from: [.fileURL]) != nil && tableView.isEqual(to: self.thumbnailTableView) {
-            if IAPProductsManager.default().isAvailableAllFunction() == false {
-                KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            if KMMemberInfo.shared.isMemberAllFunction == false {
+                KMMemberInfo.shared.advancedFunctionUsage()
                 return false
             }
 
@@ -1634,8 +1634,8 @@ extension KMLeftSideViewController: NSTableViewDelegate, NSTableViewDataSource {
     }
     
     @objc dynamic func tableView(_ aTableView: NSTableView, deleteRowsWithIndexes rowIndexes: IndexSet) {
-        if IAPProductsManager.default().isAvailableAllFunction() == false {
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
         if aTableView.isEqual(to: self.snapshotTableView) {
@@ -1675,8 +1675,8 @@ extension KMLeftSideViewController: NSTableViewDelegate, NSTableViewDataSource {
     }
     
     func tableView(_ aTableView: NSTableView, copyRowsWithIndexes rowIndexes: IndexSet) {
-        if IAPProductsManager.default().isAvailableAllFunction() == false {
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
         if aTableView.isEqual(to: self.thumbnailTableView) {

+ 24 - 28
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Thumbnail/Base/KMPDFThumbViewBaseController.swift

@@ -152,14 +152,14 @@ class KMPDFThumbViewBaseController: KMBaseViewController {
     // 插入文件事件
     
     public func insertFileAction() {
-        if IAPProductsManager.default().isAvailableAllFunction() == false {
-            let winC = KMPurchaseCompareWindowController.sharedInstance()
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            let winC = KMProductCompareWC.shared
             if self.kEventTag == 1 {
-                winC?.kEventName = "Onbrd_EditPage_BuyNow"
+                winC.kEventName = "Onbrd_EditPage_BuyNow"
             } else {
-                winC?.kEventName = "Reading_InsertPDF_BuyNow"
+                winC.kEventName = "Reading_InsertPDF_BuyNow"
             }
-            winC?.showWindow(nil)
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
         
@@ -206,14 +206,14 @@ class KMPDFThumbViewBaseController: KMBaseViewController {
     // 插入空白页面事件
     
     public func insertBlankPageAction() {
-        if IAPProductsManager.default().isAvailableAllFunction() == false {
-            let winC = KMPurchaseCompareWindowController.sharedInstance()
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            let winC = KMProductCompareWC.shared
             if self.kEventTag == 1 {
-                winC?.kEventName = "Onbrd_EditPage_BuyNow"
+                winC.kEventName = "Onbrd_EditPage_BuyNow"
             } else {
-                winC?.kEventName = "Reading_InsertBlankPage_BuyNow"
+                winC.kEventName = "Reading_InsertBlankPage_BuyNow"
             }
-            winC?.showWindow(nil)
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
         
@@ -267,8 +267,8 @@ class KMPDFThumbViewBaseController: KMBaseViewController {
     }
     
     public func cutAction() {
-        if IAPProductsManager.default().isAvailableAllFunction() == false {
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
         
@@ -278,17 +278,17 @@ class KMPDFThumbViewBaseController: KMBaseViewController {
     }
     
     public func copyAction() {
-        if IAPProductsManager.default().isAvailableAllFunction() == false {
-            let winC = KMPurchaseCompareWindowController.sharedInstance()
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            let winC = KMProductCompareWC.shared
             if self.kEventTag == 1 {
-                winC?.kEventName = "Onbrd_EditPage_BuyNow"
+                winC.kEventName = "Onbrd_EditPage_BuyNow"
             } else {
-                winC?.kEventName = "Reading_Copy_BuyNow"
+                winC.kEventName = "Reading_Copy_BuyNow"
             }
-            winC?.showWindow(nil)
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
-        
+
         let indexpaths = self.thumbnailView.selectionIndexPaths
         self._copyPages(indexpaths: indexpaths)
         self.copyAfter(indexpaths: indexpaths)
@@ -317,8 +317,8 @@ class KMPDFThumbViewBaseController: KMBaseViewController {
     }
     
     public func pasteAction() {
-        if IAPProductsManager.default().isAvailableAllFunction() == false {
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
         
@@ -334,7 +334,6 @@ class KMPDFThumbViewBaseController: KMBaseViewController {
     
     public func pastePage(at index: Int) {
         if KMThumbnailManager.manager.copyPages.isEmpty {
-//        if (!self.canPaste()) {
             KMPrint("no can paste.")
             NSSound.beep()
             return
@@ -358,11 +357,8 @@ class KMPDFThumbViewBaseController: KMBaseViewController {
     
     // 提取 指定的item
     public func extractActionIndexpaths(indexpaths: Set<IndexPath>) {
-//        let pageIndexs = self.indexpathsToIndexs(indexpaths: indexpaths)
-//        var fileName = self.thumbnailView.document?.documentURL.deletingPathExtension().lastPathComponent
-//        fileName?.append(KMPageRangeTools.newParseSelectedIndexs(selectedIndex: pageIndexs.sorted()))
-        if IAPProductsManager.default().isAvailableAllFunction() == false {
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
         
@@ -391,8 +387,8 @@ class KMPDFThumbViewBaseController: KMBaseViewController {
     
     // 替换 特定的item
     public func replaceAction() {
-        if IAPProductsManager.default().isAvailableAllFunction() == false {
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
         self.km_open_file_multi {  [unowned self] index, params in

+ 6 - 7
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMAnnotationSelectLinkViewController.swift

@@ -130,17 +130,16 @@ enum KMAnnotationLinkType: UInt {
             box.downCallback = { [weak self] downEntered, mouseBox, event in
                 guard let self = self else { return }
                 if downEntered {
-                    if !IAPProductsManager.default().isAvailableAllFunction() {
+                    if KMMemberInfo.shared.isMemberAllFunction == false {
                         if mouseBox == self.linkUrlBox || mouseBox == self.linkEmailBox {
                             if mouseBox == self.linkUrlBox {
-                                let winC = KMPurchaseCompareWindowController.sharedInstance()
-                                winC?.kEventName = "Reading_WebsiteLink_BuyNow"
+                                let winC = KMProductCompareWC.shared
+                                winC.kEventName = "Reading_WebsiteLink_BuyNow"
                             } else if mouseBox == self.linkEmailBox {
-                                let winC = KMPurchaseCompareWindowController.sharedInstance()
-                                winC?.kEventName = "Reading_EmailLink_BuyNow"
+                                let winC = KMProductCompareWC.shared
+                                winC.kEventName = "Reading_EmailLink_BuyNow"
                             }
-                            
-                            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+                            KMMemberInfo.shared.advancedFunctionUsage()
                             return
                         }
                     }

+ 2 - 2
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/ViewController/PageDisplay/KMPageDisplayCustomThemesCollectionViewItem.swift

@@ -86,8 +86,8 @@ class KMPageDisplayCustomThemesCollectionViewItem: NSCollectionViewItem {
         itemCount = item
         themesBox.mouseDownCallback = { [weak self] downEntered in
             if downEntered {
-                if !IAPProductsManager.default().isAvailableAllFunction() {
-                    KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+                if KMMemberInfo.shared.isMemberAllFunction == false {
+                    KMMemberInfo.shared.advancedFunctionUsage()
                     return
                 }
                 

+ 21 - 11
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/ViewController/PageDisplay/KMPageDisplayPropertiesViewController.swift

@@ -306,6 +306,8 @@ class KMPageDisplayPropertiesButton: NSButton {
 
         NotificationCenter.default.addObserver(self, selector: #selector(removeSecondaryPdfContentView(_:)), name: NSNotification.Name("KMSplitSinglePageNotification"), object: nil)
         NotificationCenter.default.addObserver(self, selector: #selector(viewModeChangeUpdateState(_:)), name: Notification.Name("CPDFListViewDisplayModeChangeNotification"), object: nil)
+        NotificationCenter.default.addObserver(self, selector: #selector(loginSuccessNotification), name: NSNotification.Name(rawValue: "MemberCenterLoginSuccess"), object: nil)
+        NotificationCenter.default.addObserver(self, selector: #selector(logoutSuccessNotification), name: NSNotification.Name(rawValue: "MemberCenterLogoutSuccess"), object: nil)
     }
     
     private func reloadReplaceView() {
@@ -558,10 +560,10 @@ class KMPageDisplayPropertiesButton: NSButton {
 //        [[FMTrackEventManager manager] trackEvent:@"SubTbr_PageDisplay" withProperties:@{@"SubTbr_Btn":@"Btn_SubTbr_PageDisplay_ViewSetting_SplitView"}];
         FMTrackEventManager.defaultManager.trackEvent(event: "SubTbr_PageDisplay", withProperties: ["SubTbr_Btn": "Btn_SubTbr_PageDisplay_ViewSetting_SplitView"])
         
-        if sender.tag > 0 && IAPProductsManager.default().isAvailableAllFunction() == false {
-            let winC = KMPurchaseCompareWindowController.sharedInstance()
-            winC?.kEventName = "Reading_SplitView_BuyNow"
-            winC?.showWindow(nil)
+        if sender.tag > 0 && KMMemberInfo.shared.isMemberAllFunction == false {
+            let winC = KMProductCompareWC.shared
+            winC.kEventName = "Reading_SplitView_BuyNow"
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
         
@@ -626,6 +628,14 @@ class KMPageDisplayPropertiesButton: NSButton {
     @objc func viewModeChangNotification(_ notification: Notification) {
         reloadData()
     }
+    
+    @objc func loginSuccessNotification() -> Void {
+        themeCollectionView.reloadData()
+    }
+    
+    @objc func logoutSuccessNotification() -> Void {
+        themeCollectionView.reloadData()
+    }
 
 //    override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
 //        guard let object = object as? YourObjectType, keyPath == "yourKeyPath" else {
@@ -671,7 +681,7 @@ extension KMPageDisplayPropertiesViewController: NSCollectionViewDelegate, NSCol
                 UserDefaults.standard.synchronize()
             }
             
-            if IAPProductsManager.default().isAvailableAllFunction() == false {
+            if KMMemberInfo.shared.isMemberAllFunction == false {
                 item.vipImageView.isHidden = indexPath.item == 0 ? true : false
             } else {
                 item.vipImageView.isHidden = true
@@ -704,7 +714,7 @@ extension KMPageDisplayPropertiesViewController: NSCollectionViewDelegate, NSCol
                     UserDefaults.standard.synchronize()
                 }
                 
-                if IAPProductsManager.default().isAvailableAllFunction() == false {
+                if KMMemberInfo.shared.isMemberAllFunction == false {
                     item.vipImageView.isHidden = false
                 } else {
                     item.vipImageView.isHidden = true
@@ -733,7 +743,7 @@ extension KMPageDisplayPropertiesViewController: NSCollectionViewDelegate, NSCol
                     UserDefaults.standard.synchronize()
                 }
                 
-                if IAPProductsManager.default().isAvailableAllFunction() == false {
+                if KMMemberInfo.shared.isMemberAllFunction == false {
                     item.vipImageView.isHidden = indexPath.item == 0 ? true : false
                 } else {
                     item.vipImageView.isHidden = true
@@ -758,11 +768,11 @@ extension KMPageDisplayPropertiesViewController: NSCollectionViewDelegate, NSCol
         FMTrackEventManager.defaultManager.trackEvent(event: "SubTbr_PageDisplay", withProperties: ["SubTbr_Btn": "Btn_SubTbr_PageDisplay_ViewSetting_Themes"])
         
         for indexPath in indexPathArr {
-            if IAPProductsManager.default().isAvailableAllFunction() == false {
+            if KMMemberInfo.shared.isMemberAllFunction == false {
                 if indexPath.item > 0 {
-                    let winC = KMPurchaseCompareWindowController.sharedInstance()
-                    winC?.kEventName = "Reading_Theme_BuyNow"
-                    winC?.showWindow(nil)
+                    let winC = KMProductCompareWC.shared
+                    winC.kEventName = "Reading_Theme_BuyNow"
+                    KMMemberInfo.shared.advancedFunctionUsage()
                     return
                 }
             }

+ 3 - 3
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/ViewController/PageDisplay/KMPageDisplayThemeCollectionViewItem.swift

@@ -40,8 +40,8 @@ class KMPageDisplayThemeCollectionViewItem: NSCollectionViewItem {
     }
     
     @IBAction func closeButtonAction(_ sender: Any) {
-        if !IAPProductsManager.default().isAvailableAllFunction() {
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
         if let callback = itemCallBack {
@@ -84,7 +84,7 @@ class KMPageDisplayThemeCollectionViewItem: NSCollectionViewItem {
 
             if mouseEntered {
                 if self.itemInteger.rawValue > 3 {
-                    if !IAPProductsManager.default().isAvailableAllFunction() {
+                    if !KMMemberInfo.shared.isMemberAllFunction {
                         self.closeButton.isHidden = true
                     } else {
                         self.closeButton.isHidden = false

+ 4 - 4
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/Signature/KMSignatureAnnotationViewController.m

@@ -146,17 +146,17 @@ KMSigntureViewItemDelegate>
 }
 
 - (IBAction)insertSignatureButton_Click:(id)sender {
-    if (![[IAPProductsManager defaultManager] isAvailableAllFunction]) {
-        NSWindowController *winC = [KMPurchaseCompareWindowController sharedInstance];
+    if (![KMMemberInfo shared].isMemberAllFunction) {
+        NSWindowController *winC = [KMProductCompareWC shared];
         if (self.kEventTag == 1) {
             winC.kEventName = @"Reading_FillSign_Signature_BuyNow";
         } else {
             winC.kEventName = @"Reading_Signature_BuyNow";
         }
-        
-        [winC showWindow:nil];
+        [[KMMemberInfo shared] advancedFunctionUsage];
         return;
     }
+
     [self showSignatureWindow];
 }
 

+ 0 - 1
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/Signature/KMSignatureWindowController.m

@@ -8,7 +8,6 @@
 
 #import "KMSignatureWindowController.h"
 #import "NSImage+PDFListView.h"
-#import "KMPurchaseCompareWindowController.h"
 #import "NSMenu_SKExtensions.h"
 
 #import <PDF_Reader_Pro-Swift.h>

+ 80 - 80
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/Signature/KMSignatureWindowController.xib

@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21507" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22505" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
     <dependencies>
         <deployment identifier="macosx"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21507"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22505"/>
         <capability name="Named colors" minToolsVersion="9.0"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
@@ -44,7 +44,7 @@
             <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES"/>
             <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
             <rect key="contentRect" x="196" y="240" width="590" height="400"/>
-            <rect key="screenRect" x="0.0" y="0.0" width="1512" height="944"/>
+            <rect key="screenRect" x="0.0" y="0.0" width="2560" height="1415"/>
             <view key="contentView" id="se5-gp-TjO">
                 <rect key="frame" x="0.0" y="0.0" width="590" height="400"/>
                 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
@@ -128,10 +128,6 @@ Gw
                                         </customView>
                                         <popUpButton translatesAutoresizingMaskIntoConstraints="NO" id="xZO-qY-11k">
                                             <rect key="frame" x="17" y="35" width="227" height="24"/>
-                                            <constraints>
-                                                <constraint firstAttribute="height" constant="19" id="4WS-1q-cr1"/>
-                                                <constraint firstAttribute="width" constant="220" id="SaO-WH-b9f"/>
-                                            </constraints>
                                             <popUpButtonCell key="cell" type="push" title="Item 1" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="border" inset="2" pullsDown="YES" selectedItem="Xy9-aP-3ec" id="G3V-L8-1Ia">
                                                 <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                                 <font key="font" metaFont="menu"/>
@@ -141,6 +137,10 @@ Gw
                                                     </items>
                                                 </menu>
                                             </popUpButtonCell>
+                                            <constraints>
+                                                <constraint firstAttribute="height" constant="19" id="4WS-1q-cr1"/>
+                                                <constraint firstAttribute="width" constant="220" id="SaO-WH-b9f"/>
+                                            </constraints>
                                             <connections>
                                                 <action selector="boxItemClicked_Font:" target="-2" id="h6E-tB-xDM"/>
                                             </connections>
@@ -150,98 +150,98 @@ Gw
                                             <subviews>
                                                 <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="dSP-K5-TWG" customClass="KMSignatureColorButton">
                                                     <rect key="frame" x="0.0" y="0.0" width="24" height="24"/>
-                                                    <constraints>
-                                                        <constraint firstAttribute="height" constant="24" id="QRO-nN-dVg"/>
-                                                        <constraint firstAttribute="width" constant="24" id="hBr-MY-39t"/>
-                                                    </constraints>
                                                     <buttonCell key="cell" type="bevel" bezelStyle="rounded" alignment="center" inset="2" id="m9W-Ec-Vo0">
                                                         <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                                         <font key="font" metaFont="system"/>
                                                     </buttonCell>
+                                                    <constraints>
+                                                        <constraint firstAttribute="height" constant="24" id="QRO-nN-dVg"/>
+                                                        <constraint firstAttribute="width" constant="24" id="hBr-MY-39t"/>
+                                                    </constraints>
                                                     <connections>
                                                         <action selector="colorTextButtonAction:" target="-2" id="89L-Xi-DhT"/>
                                                     </connections>
                                                 </button>
-                                                <button verticalHuggingPriority="750" tag="1" translatesAutoresizingMaskIntoConstraints="NO" id="kaa-TU-cyJ" customClass="KMSignatureColorButton">
+                                                <button tag="1" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="kaa-TU-cyJ" customClass="KMSignatureColorButton">
                                                     <rect key="frame" x="34" y="0.0" width="24" height="24"/>
-                                                    <constraints>
-                                                        <constraint firstAttribute="width" constant="24" id="6b4-z5-yb6"/>
-                                                        <constraint firstAttribute="height" constant="24" id="Fyg-fl-TyW"/>
-                                                    </constraints>
                                                     <buttonCell key="cell" type="bevel" bezelStyle="rounded" alignment="center" inset="2" id="Irw-w1-sO2">
                                                         <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                                         <font key="font" metaFont="system"/>
                                                     </buttonCell>
+                                                    <constraints>
+                                                        <constraint firstAttribute="width" constant="24" id="6b4-z5-yb6"/>
+                                                        <constraint firstAttribute="height" constant="24" id="Fyg-fl-TyW"/>
+                                                    </constraints>
                                                     <connections>
                                                         <action selector="colorTextButtonAction:" target="-2" id="ZyU-m5-2ZT"/>
                                                     </connections>
                                                 </button>
-                                                <button verticalHuggingPriority="750" tag="2" translatesAutoresizingMaskIntoConstraints="NO" id="SJT-jB-SRM" customClass="KMSignatureColorButton">
+                                                <button tag="2" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="SJT-jB-SRM" customClass="KMSignatureColorButton">
                                                     <rect key="frame" x="68" y="0.0" width="24" height="24"/>
-                                                    <constraints>
-                                                        <constraint firstAttribute="width" constant="24" id="S2e-hv-gju"/>
-                                                        <constraint firstAttribute="height" constant="24" id="cA3-vf-DmP"/>
-                                                    </constraints>
                                                     <buttonCell key="cell" type="bevel" bezelStyle="rounded" alignment="center" inset="2" id="0wJ-Rg-Wfl">
                                                         <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                                         <font key="font" metaFont="system"/>
                                                     </buttonCell>
+                                                    <constraints>
+                                                        <constraint firstAttribute="width" constant="24" id="S2e-hv-gju"/>
+                                                        <constraint firstAttribute="height" constant="24" id="cA3-vf-DmP"/>
+                                                    </constraints>
                                                     <connections>
                                                         <action selector="colorTextButtonAction:" target="-2" id="WdT-BN-gLT"/>
                                                     </connections>
                                                 </button>
-                                                <button verticalHuggingPriority="750" tag="3" translatesAutoresizingMaskIntoConstraints="NO" id="yfE-5n-2V6" customClass="KMSignatureColorButton">
+                                                <button tag="3" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="yfE-5n-2V6" customClass="KMSignatureColorButton">
                                                     <rect key="frame" x="102" y="0.0" width="24" height="24"/>
-                                                    <constraints>
-                                                        <constraint firstAttribute="width" constant="24" id="ERH-zJ-cZP"/>
-                                                        <constraint firstAttribute="height" constant="24" id="M9I-A1-y1V"/>
-                                                    </constraints>
                                                     <buttonCell key="cell" type="bevel" bezelStyle="rounded" alignment="center" inset="2" id="1sM-mn-Lff">
                                                         <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                                         <font key="font" metaFont="system"/>
                                                     </buttonCell>
+                                                    <constraints>
+                                                        <constraint firstAttribute="width" constant="24" id="ERH-zJ-cZP"/>
+                                                        <constraint firstAttribute="height" constant="24" id="M9I-A1-y1V"/>
+                                                    </constraints>
                                                     <connections>
                                                         <action selector="colorTextButtonAction:" target="-2" id="tdr-Gl-mHr"/>
                                                     </connections>
                                                 </button>
-                                                <button verticalHuggingPriority="750" tag="4" translatesAutoresizingMaskIntoConstraints="NO" id="SWP-Bp-BEe" customClass="KMSignatureColorButton">
+                                                <button tag="4" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="SWP-Bp-BEe" customClass="KMSignatureColorButton">
                                                     <rect key="frame" x="136" y="0.0" width="24" height="24"/>
-                                                    <constraints>
-                                                        <constraint firstAttribute="width" constant="24" id="RSn-Vv-2yE"/>
-                                                        <constraint firstAttribute="height" constant="24" id="Zqa-T0-jMF"/>
-                                                    </constraints>
                                                     <buttonCell key="cell" type="bevel" bezelStyle="rounded" alignment="center" inset="2" id="cuU-Zj-w1v">
                                                         <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                                         <font key="font" metaFont="system"/>
                                                     </buttonCell>
+                                                    <constraints>
+                                                        <constraint firstAttribute="width" constant="24" id="RSn-Vv-2yE"/>
+                                                        <constraint firstAttribute="height" constant="24" id="Zqa-T0-jMF"/>
+                                                    </constraints>
                                                     <connections>
                                                         <action selector="colorTextButtonAction:" target="-2" id="ncR-XO-Zqm"/>
                                                     </connections>
                                                 </button>
-                                                <button verticalHuggingPriority="750" tag="5" translatesAutoresizingMaskIntoConstraints="NO" id="g0a-Fj-PUV" customClass="KMSignatureColorButton">
+                                                <button tag="5" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="g0a-Fj-PUV" customClass="KMSignatureColorButton">
                                                     <rect key="frame" x="170" y="0.0" width="24" height="24"/>
-                                                    <constraints>
-                                                        <constraint firstAttribute="width" constant="24" id="gIu-i5-ZnX"/>
-                                                        <constraint firstAttribute="height" constant="24" id="qzg-Sx-WiY"/>
-                                                    </constraints>
                                                     <buttonCell key="cell" type="bevel" bezelStyle="rounded" alignment="center" inset="2" id="3wu-Sw-P2D">
                                                         <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                                         <font key="font" metaFont="system"/>
                                                     </buttonCell>
+                                                    <constraints>
+                                                        <constraint firstAttribute="width" constant="24" id="gIu-i5-ZnX"/>
+                                                        <constraint firstAttribute="height" constant="24" id="qzg-Sx-WiY"/>
+                                                    </constraints>
                                                     <connections>
                                                         <action selector="colorTextButtonAction:" target="-2" id="uQ6-s6-Bwf"/>
                                                     </connections>
                                                 </button>
                                                 <button focusRingType="none" tag="6" translatesAutoresizingMaskIntoConstraints="NO" id="vMd-TE-sxe" customClass="KMSignatureColorButton">
                                                     <rect key="frame" x="204" y="0.0" width="24" height="24"/>
-                                                    <constraints>
-                                                        <constraint firstAttribute="height" constant="24" id="DiX-LS-v5t"/>
-                                                        <constraint firstAttribute="width" constant="24" id="wHf-oh-Cmm"/>
-                                                    </constraints>
                                                     <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" imagePosition="only" alignment="center" focusRingType="none" imageScaling="proportionallyUpOrDown" inset="2" id="Miw-7x-tka">
                                                         <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                                         <font key="font" metaFont="system"/>
                                                     </buttonCell>
+                                                    <constraints>
+                                                        <constraint firstAttribute="height" constant="24" id="DiX-LS-v5t"/>
+                                                        <constraint firstAttribute="width" constant="24" id="wHf-oh-Cmm"/>
+                                                    </constraints>
                                                     <connections>
                                                         <action selector="colorTextButtonAction:" target="-2" id="hVx-KF-N1B"/>
                                                     </connections>
@@ -312,98 +312,98 @@ Gw
                                             <subviews>
                                                 <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="hmB-iA-f1I" customClass="KMSignatureColorButton">
                                                     <rect key="frame" x="0.0" y="0.0" width="24" height="24"/>
-                                                    <constraints>
-                                                        <constraint firstAttribute="width" constant="24" id="pct-Mn-IE9"/>
-                                                        <constraint firstAttribute="height" constant="24" id="s1c-ca-yuF"/>
-                                                    </constraints>
                                                     <buttonCell key="cell" type="bevel" bezelStyle="rounded" alignment="center" inset="2" id="nxT-KZ-YW4">
                                                         <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                                         <font key="font" metaFont="system"/>
                                                     </buttonCell>
+                                                    <constraints>
+                                                        <constraint firstAttribute="width" constant="24" id="pct-Mn-IE9"/>
+                                                        <constraint firstAttribute="height" constant="24" id="s1c-ca-yuF"/>
+                                                    </constraints>
                                                     <connections>
                                                         <action selector="colorInkButtonAction:" target="-2" id="9jD-aD-amY"/>
                                                     </connections>
                                                 </button>
-                                                <button verticalHuggingPriority="750" tag="1" translatesAutoresizingMaskIntoConstraints="NO" id="W3o-fN-rOw" customClass="KMSignatureColorButton">
+                                                <button tag="1" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="W3o-fN-rOw" customClass="KMSignatureColorButton">
                                                     <rect key="frame" x="34" y="0.0" width="24" height="24"/>
-                                                    <constraints>
-                                                        <constraint firstAttribute="width" constant="24" id="5zu-28-PR7"/>
-                                                        <constraint firstAttribute="height" constant="24" id="BOC-Od-gVp"/>
-                                                    </constraints>
                                                     <buttonCell key="cell" type="bevel" bezelStyle="rounded" alignment="center" inset="2" id="chZ-50-dOm">
                                                         <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                                         <font key="font" metaFont="system"/>
                                                     </buttonCell>
+                                                    <constraints>
+                                                        <constraint firstAttribute="width" constant="24" id="5zu-28-PR7"/>
+                                                        <constraint firstAttribute="height" constant="24" id="BOC-Od-gVp"/>
+                                                    </constraints>
                                                     <connections>
                                                         <action selector="colorInkButtonAction:" target="-2" id="0YI-oM-64g"/>
                                                     </connections>
                                                 </button>
-                                                <button verticalHuggingPriority="750" tag="2" translatesAutoresizingMaskIntoConstraints="NO" id="wUy-ZZ-NV6" customClass="KMSignatureColorButton">
+                                                <button tag="2" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="wUy-ZZ-NV6" customClass="KMSignatureColorButton">
                                                     <rect key="frame" x="68" y="0.0" width="24" height="24"/>
-                                                    <constraints>
-                                                        <constraint firstAttribute="height" constant="24" id="0RT-zb-Ren"/>
-                                                        <constraint firstAttribute="width" constant="24" id="pkk-VY-zwP"/>
-                                                    </constraints>
                                                     <buttonCell key="cell" type="bevel" bezelStyle="rounded" alignment="center" inset="2" id="rBt-4e-ahZ">
                                                         <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                                         <font key="font" metaFont="system"/>
                                                     </buttonCell>
+                                                    <constraints>
+                                                        <constraint firstAttribute="height" constant="24" id="0RT-zb-Ren"/>
+                                                        <constraint firstAttribute="width" constant="24" id="pkk-VY-zwP"/>
+                                                    </constraints>
                                                     <connections>
                                                         <action selector="colorInkButtonAction:" target="-2" id="E55-WE-yqx"/>
                                                     </connections>
                                                 </button>
-                                                <button verticalHuggingPriority="750" tag="3" translatesAutoresizingMaskIntoConstraints="NO" id="5Ho-ZM-JxE" customClass="KMSignatureColorButton">
+                                                <button tag="3" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="5Ho-ZM-JxE" customClass="KMSignatureColorButton">
                                                     <rect key="frame" x="102" y="0.0" width="24" height="24"/>
-                                                    <constraints>
-                                                        <constraint firstAttribute="width" constant="24" id="XNe-yI-UVq"/>
-                                                        <constraint firstAttribute="height" constant="24" id="cds-J6-0Ar"/>
-                                                    </constraints>
                                                     <buttonCell key="cell" type="bevel" bezelStyle="rounded" alignment="center" inset="2" id="ch8-ra-a1j">
                                                         <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                                         <font key="font" metaFont="system"/>
                                                     </buttonCell>
+                                                    <constraints>
+                                                        <constraint firstAttribute="width" constant="24" id="XNe-yI-UVq"/>
+                                                        <constraint firstAttribute="height" constant="24" id="cds-J6-0Ar"/>
+                                                    </constraints>
                                                     <connections>
                                                         <action selector="colorInkButtonAction:" target="-2" id="DzY-KX-vNt"/>
                                                     </connections>
                                                 </button>
-                                                <button verticalHuggingPriority="750" tag="4" translatesAutoresizingMaskIntoConstraints="NO" id="cVn-Dj-7k0" customClass="KMSignatureColorButton">
+                                                <button tag="4" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="cVn-Dj-7k0" customClass="KMSignatureColorButton">
                                                     <rect key="frame" x="136" y="0.0" width="24" height="24"/>
-                                                    <constraints>
-                                                        <constraint firstAttribute="height" constant="24" id="3Hk-P5-83Z"/>
-                                                        <constraint firstAttribute="width" constant="24" id="5fH-gv-5XX"/>
-                                                    </constraints>
                                                     <buttonCell key="cell" type="bevel" bezelStyle="rounded" alignment="center" inset="2" id="g56-pL-apT">
                                                         <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                                         <font key="font" metaFont="system"/>
                                                     </buttonCell>
+                                                    <constraints>
+                                                        <constraint firstAttribute="height" constant="24" id="3Hk-P5-83Z"/>
+                                                        <constraint firstAttribute="width" constant="24" id="5fH-gv-5XX"/>
+                                                    </constraints>
                                                     <connections>
                                                         <action selector="colorInkButtonAction:" target="-2" id="2Vg-k2-X1t"/>
                                                     </connections>
                                                 </button>
-                                                <button verticalHuggingPriority="750" tag="5" translatesAutoresizingMaskIntoConstraints="NO" id="g94-8v-Pzp" customClass="KMSignatureColorButton">
+                                                <button tag="5" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="g94-8v-Pzp" customClass="KMSignatureColorButton">
                                                     <rect key="frame" x="170" y="0.0" width="24" height="24"/>
-                                                    <constraints>
-                                                        <constraint firstAttribute="height" constant="24" id="Gk1-OZ-Kc6"/>
-                                                        <constraint firstAttribute="width" constant="24" id="RTZ-NT-TMX"/>
-                                                    </constraints>
                                                     <buttonCell key="cell" type="bevel" bezelStyle="rounded" alignment="center" inset="2" id="5YQ-gx-saR">
                                                         <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                                         <font key="font" metaFont="system"/>
                                                     </buttonCell>
+                                                    <constraints>
+                                                        <constraint firstAttribute="height" constant="24" id="Gk1-OZ-Kc6"/>
+                                                        <constraint firstAttribute="width" constant="24" id="RTZ-NT-TMX"/>
+                                                    </constraints>
                                                     <connections>
                                                         <action selector="colorInkButtonAction:" target="-2" id="gct-3E-aAS"/>
                                                     </connections>
                                                 </button>
                                                 <button focusRingType="none" tag="6" translatesAutoresizingMaskIntoConstraints="NO" id="pdk-Nk-qtg" customClass="KMSignatureColorButton">
                                                     <rect key="frame" x="204" y="0.0" width="24" height="24"/>
-                                                    <constraints>
-                                                        <constraint firstAttribute="width" constant="24" id="9aL-e7-EBd"/>
-                                                        <constraint firstAttribute="height" constant="24" id="xrt-fT-Naw"/>
-                                                    </constraints>
                                                     <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" imagePosition="only" alignment="center" focusRingType="none" imageScaling="proportionallyUpOrDown" inset="2" id="ZY8-WX-cML">
                                                         <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                                         <font key="font" metaFont="system"/>
                                                     </buttonCell>
+                                                    <constraints>
+                                                        <constraint firstAttribute="width" constant="24" id="9aL-e7-EBd"/>
+                                                        <constraint firstAttribute="height" constant="24" id="xrt-fT-Naw"/>
+                                                    </constraints>
                                                     <connections>
                                                         <action selector="colorInkButtonAction:" target="-2" id="5EN-D9-4rU"/>
                                                     </connections>
@@ -428,7 +428,7 @@ Gw
                                                 <constraint firstItem="wUy-ZZ-NV6" firstAttribute="leading" secondItem="W3o-fN-rOw" secondAttribute="trailing" constant="10" id="zjb-QB-E8h"/>
                                             </constraints>
                                         </customView>
-                                        <textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="PHX-fM-ig4">
+                                        <textField focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="PHX-fM-ig4">
                                             <rect key="frame" x="248" y="38" width="40" height="20"/>
                                             <constraints>
                                                 <constraint firstAttribute="height" constant="20" id="fBk-ak-0rC"/>
@@ -468,7 +468,7 @@ Gw
                                                 <customView translatesAutoresizingMaskIntoConstraints="NO" id="BdH-VL-hQf">
                                                     <rect key="frame" x="138" y="81" width="240" height="68"/>
                                                     <subviews>
-                                                        <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ZaA-uR-3WB">
+                                                        <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ZaA-uR-3WB">
                                                             <rect key="frame" x="111" y="29" width="18" height="17"/>
                                                             <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="or" id="wfl-jK-Qgx">
                                                                 <font key="font" metaFont="system" size="14"/>
@@ -476,7 +476,7 @@ Gw
                                                                 <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
                                                             </textFieldCell>
                                                         </textField>
-                                                        <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="3D8-bL-P1k">
+                                                        <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="3D8-bL-P1k">
                                                             <rect key="frame" x="8" y="51" width="224" height="17"/>
                                                             <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="Drag image here" id="Wzz-YY-UHL">
                                                                 <font key="font" metaFont="system" size="14"/>
@@ -486,9 +486,6 @@ Gw
                                                         </textField>
                                                         <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="7oB-5a-zwH">
                                                             <rect key="frame" x="68" y="-7" width="105" height="32"/>
-                                                            <constraints>
-                                                                <constraint firstAttribute="height" constant="20" id="eTG-Lz-5rx"/>
-                                                            </constraints>
                                                             <buttonCell key="cell" type="push" title="Select a file" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="tKF-mG-edD">
                                                                 <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                                                 <font key="font" metaFont="system"/>
@@ -496,6 +493,9 @@ Gw
 DQ
 </string>
                                                             </buttonCell>
+                                                            <constraints>
+                                                                <constraint firstAttribute="height" constant="20" id="eTG-Lz-5rx"/>
+                                                            </constraints>
                                                             <connections>
                                                                 <action selector="buttonItemClick_SelectPhoto:" target="mpG-Sx-Pe8" id="CbX-fd-MLn"/>
                                                             </connections>
@@ -536,7 +536,7 @@ DQ
                             </tabViewItem>
                         </tabViewItems>
                     </tabView>
-                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="8sI-6n-jcW">
+                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="8sI-6n-jcW">
                         <rect key="frame" x="126" y="20" width="229" height="16"/>
                         <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="Press &quot;esc&quot; to disable the Trackpad." id="m48-yd-Nf0">
                             <font key="font" metaFont="system"/>

+ 10 - 16
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/StampList/KMAnnotationStampViewController.swift

@@ -282,15 +282,13 @@ let KMPDFDynamicStampNeedAuthorKey1 = "km_pdfview_dynamic_stamp_need_author"
         standardLabel.stringValue = NSLocalizedString("Standard", comment: "")
         standardLabel.textColor = KMAppearance.Layout.h1Color()
         
-//        dynamicBox.fillColor = KMAppearance.Layout.l1Color()
         self.dynamicBoxNew?.fillColor = KMAppearance.Layout.l1Color()
         self.dynamicBoxNew?.downCallback = { [weak self] downEntered, mouseBox, event in
-//        dynamicBox.downCallback = { [weak self] downEntered, mouseBox, event in
             guard let blockSelf = self else { return }
-            if downEntered && !IAPProductsManager.default().isAvailableAllFunction() {
-                let winC = KMPurchaseCompareWindowController.sharedInstance()
-                winC?.kEventName = "Reading_DynamicStamp_BuyNow"
-                winC?.showWindow(nil)
+            if downEntered && KMMemberInfo.shared.isMemberAllFunction == false {
+                let winC = KMProductCompareWC.shared
+                winC.kEventName = "Reading_DynamicStamp_BuyNow"
+                KMMemberInfo.shared.advancedFunctionUsage()
                 return
             }
             if downEntered && (blockSelf.stampType != .dynamic) {
@@ -299,20 +297,16 @@ let KMPDFDynamicStampNeedAuthorKey1 = "km_pdfview_dynamic_stamp_need_author"
                 blockSelf.stampType = .dynamic
             }
         }
-//        dynamicLabel.stringValue = NSLocalizedString("Dynamic", comment: "")
-//        dynamicLabel.textColor = KMAppearance.Layout.h1Color()
         self.dynamicLabelNew?.stringValue = NSLocalizedString("Dynamic", comment: "")
         self.dynamicLabelNew?.textColor = KMAppearance.Layout.h1Color()
         
-//        customBox.fillColor = KMAppearance.Layout.l1Color()
         self.customBoxNew?.fillColor = KMAppearance.Layout.l1Color()
         self.customBoxNew?.downCallback = { [weak self] downEntered, mouseBox, event in
-//        customBox.downCallback = { [weak self] downEntered, mouseBox, event in
             guard let blockSelf = self else { return }
-            if downEntered && !IAPProductsManager.default().isAvailableAllFunction() {
-                let winC = KMPurchaseCompareWindowController.sharedInstance()
-                winC?.kEventName = "Reading_CustomStamp_BuyNow"
-                winC?.showWindow(nil)
+            if downEntered && KMMemberInfo.shared.isMemberAllFunction == false {
+                let winC = KMProductCompareWC.shared
+                winC.kEventName = "Reading_CustomStamp_BuyNow"
+                KMMemberInfo.shared.advancedFunctionUsage()
                 return
             }
             if downEntered && (blockSelf.stampType != .custom) {
@@ -1024,8 +1018,8 @@ let KMPDFDynamicStampNeedAuthorKey1 = "km_pdfview_dynamic_stamp_need_author"
     }
     
     @IBAction func addButtonAction(_ sender: NSButton) {
-        if !IAPProductsManager.default().isAvailableAllFunction() {
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
         

+ 5 - 5
PDF Office/PDF Master/Class/PDFWindowController/TabWindowController/KMTabbingHintWindowController.swift

@@ -86,11 +86,11 @@ class KMTabbingHintWindowController: NSWindowController{
         self.reloadData()
     }
     @IBAction func buttonClicked_NewTabInWindowButton(_ sender: NSButton) {
-        if IAPProductsManager.default().isAvailableAllFunction() == false {
+        if KMMemberInfo.shared.isMemberAllFunction == false {
             sender.state = NSControl.StateValue.off
-            let winC = KMPurchaseCompareWindowController.sharedInstance()
-            winC?.kEventName = "Reading_MultiTab_BuyNow"
-            winC?.showWindow(nil)
+            let winC = KMProductCompareWC.shared
+            winC.kEventName = "Reading_MultiTab_BuyNow"
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
         sender.state = NSControl.StateValue.on
@@ -121,7 +121,7 @@ class KMTabbingHintWindowController: NSWindowController{
     
     func reloadData() {
         KMMainThreadExecute {
-            self.lockIv.isHidden = IAPProductsManager.default().isAvailableAllFunction()
+            self.lockIv.isHidden = KMMemberInfo.shared.isMemberAllFunction
         }
     }
     

+ 4 - 4
PDF Office/PDF Master/Class/PDFWindowController/Toolbar/KMToolbarViewController.swift

@@ -235,11 +235,11 @@ class KMToolbarViewController: NSViewController, NSTextFieldDelegate {
     @IBAction func leftControllButtonAction(item: KMToolbarClickButton) {
         let tag = KMToolbarViewType(rawValue: item.tag) ?? .None
         if tag == .editPDF {
-            if IAPProductsManager.default().isAvailableAllFunction() == false {
+            if KMMemberInfo.shared.isMemberAllFunction == false {
                 KMPreference.shared.openDocumentType = .newWindow
-                let winC = KMPurchaseCompareWindowController.sharedInstance()
-                winC?.kEventName = "Reading_EditPDF_BuyNow"
-                winC?.showWindow(nil)
+                let winC = KMProductCompareWC.shared
+                winC.kEventName = "Reading_EditPDF_BuyNow"
+                KMMemberInfo.shared.advancedFunctionUsage()
                 return
             }
             let allowsPrinting = self.pdfView?.document?.allowsPrinting ?? false

+ 55 - 70
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+Action.swift

@@ -1254,8 +1254,8 @@ extension KMMainViewController {
         Task { @MainActor in
             let idx = sender.tag
             if idx == 10 {
-                if IAPProductsManager.default().isAvailableAllFunction() == false {
-                    KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+                if KMMemberInfo.shared.isMemberAllFunction == false {
+                    KMMemberInfo.shared.advancedFunctionUsage()
                     return
                 }
             }
@@ -3037,15 +3037,15 @@ extension KMMainViewController {
     
     //MARK: 转档 - OCR
     func showOCRWindow() {
-        if !IAPProductsManager.default().isAvailableAllFunction(){
-            let winC = KMPurchaseCompareWindowController.sharedInstance()
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            let winC = KMProductCompareWC.shared
             let type = self.toolbarController.toolbarType ?? .None
             if type == .Conversion {
-                winC?.kEventName = "Reading_Convert_OCR_BuyNow"
+                winC.kEventName = "Reading_Convert_OCR_BuyNow"
             } else {
-                winC?.kEventName = "Reading_OCR_BuyNow"
+                winC.kEventName = "Reading_OCR_BuyNow"
             }
-            winC?.showWindow(nil)
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
         let com = KMOCRPDFWindowController(cpdfDocument: self.listView.document!, pwd: self.listView.document?.password ?? "")
@@ -3055,10 +3055,10 @@ extension KMMainViewController {
     
     //MARK: 导出图片
     func extractImageAction(num: Int) {
-        if !IAPProductsManager.default().isAvailableAllFunction(){
-            let winC = KMPurchaseCompareWindowController.sharedInstance()
-            winC?.kEventName = "Reading_ExtractImage_BuyNow"
-            winC?.showWindow(nil)
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            let winC = KMProductCompareWC.shared
+            winC.kEventName = "Reading_ExtractImage_BuyNow"
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
         
@@ -3069,10 +3069,6 @@ extension KMMainViewController {
             alert.runModal()
             return
         }
-        //        if sender is KMToolbarItem {
-        //            (sender as! KMToolbarItem).isSelected = false
-        //        }
-
         
         let document = self.listView.document
         var fileURL = document?.documentURL
@@ -3221,19 +3217,18 @@ extension KMMainViewController {
         FMTrackEventManager.defaultManager.trackEvent(event: "SubTbr_Tools", withProperties: ["SubTbr_Btn": "Btn_SubTbr_Tools_Image"])
         
         changeAnnotationMode(sender)
-        guard IAPProductsManager.default().isAvailableAllFunction() else {
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+        guard KMMemberInfo.shared.isMemberAllFunction else {
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
+
         
         let accessoryCtr = KMImageAccessoryController()
         let openPanel = NSOpenPanel()
         openPanel.allowedFileTypes = KMImageAccessoryController.supportedImageTypes()
         openPanel.allowsMultipleSelection = false
         openPanel.accessoryView = accessoryCtr.view
-//        if #available(macOS 10.11, *) {
-            openPanel.canSelectHiddenExtension = true
-//        }
+        openPanel.canSelectHiddenExtension = true
         openPanel.beginSheetModal(for: NSApp.mainWindow!) { [self] (result) in
             if result == .OK {
                 guard let url = openPanel.url else {
@@ -3287,10 +3282,10 @@ extension KMMainViewController {
     @IBAction func tableAnnotation(_ sender: Any) {
         FMTrackEventManager.defaultManager.trackEvent(event: "SubTbr_Tools", withProperties: ["SubTbr_Btn": "Btn_SubTbr_Tools_Table"])
         changeAnnotationMode(sender)
-        guard IAPProductsManager.default().isAvailableAllFunction() else {
-            let winC = KMPurchaseCompareWindowController.sharedInstance()
-            winC?.kEventName = "Reading_Table_BuyNow"
-            winC?.showWindow(nil)
+        guard KMMemberInfo.shared.isMemberAllFunction else {
+            let winC = KMProductCompareWC.shared
+            winC.kEventName = "Reading_Table_BuyNow"
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
         listView.addAnnotationWithTable()
@@ -3786,10 +3781,10 @@ extension KMMainViewController : KMToolbarViewControllerDelegate {
     }
     
     func toolbarViewController(_ viewController: KMToolbarViewController, shareFlatten item: NSMenuItem) {
-        if IAPProductsManager.default().isAvailableAllFunction() == false {
-            let winC = KMPurchaseCompareWindowController.sharedInstance()
-            winC?.kEventName = "Reading_Flatten_BuyNow"
-            winC?.showWindow(nil)
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            let winC = KMProductCompareWC.shared
+            winC.kEventName = "Reading_Flatten_BuyNow"
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
         self.shareFlatten(sender: viewController)
@@ -3801,14 +3796,8 @@ extension KMMainViewController : KMToolbarViewControllerDelegate {
     
     func toolbarViewController(_ viewController: KMToolbarViewController, scanOCRModel selectedTag: Int) {
         if(0 == selectedTag) {
-//            self.documentAIViewController?.enteredIncreaseAllPage()
-//            self.documentAIViewController?.updateToolState(false)
         } else {
-//            self.documentAIViewController?.recognitionPageString("1", with: .english)
-//            self.documentAIViewController?.recognitionPartModel(with: .english)
-//            self.documentAIViewController?.updateToolState(true)
         }
-        // 0 : Scan  1:OCR Text
     }
     
     func mainToolDidClicked(_ toolController: KMToolbarController, _ beforeType: KMToolbarViewType, _ type: KMToolbarViewType, _ item: KMToolbarItemView , _ pages: [Int]) {
@@ -3964,23 +3953,22 @@ extension KMMainViewController : KMToolbarViewControllerDelegate {
             }
             
             if (type == .bates || type == .headerAndFooter) {
-                
-                if !IAPProductsManager.default().isAvailableAllFunction(){
-                    let winC = KMPurchaseCompareWindowController.sharedInstance()
+                if KMMemberInfo.shared.isMemberAllFunction == false {
+                    let winC = KMProductCompareWC.shared
                     if type == .headerAndFooter {
                         if index == 1 {
-                            winC?.kEventName = "Reading_AddHeaderFooter_BuyNow"
+                            winC.kEventName = "Reading_AddHeaderFooter_BuyNow"
                         } else if index == 2 {
-                            winC?.kEventName = "Reading_RemoveHeaderFooter_BuyNow"
+                            winC.kEventName = "Reading_RemoveHeaderFooter_BuyNow"
                         }
                     } else if type == .bates {
                         if index == 1 {
-                            winC?.kEventName = "Reading_AddBates_BuyNow"
+                            winC.kEventName = "Reading_AddBates_BuyNow"
                         } else if index == 2 {
-                            winC?.kEventName = "Reading_RemoveBates_BuyNow"
+                            winC.kEventName = "Reading_RemoveBates_BuyNow"
                         }
                     }
-                    winC?.showWindow(nil)
+                    KMMemberInfo.shared.advancedFunctionUsage()
                     return
                 }
                 
@@ -4135,8 +4123,8 @@ extension KMMainViewController : KMToolbarViewControllerDelegate {
                     self.openRightPane()
                 }
             } else if (type == .redact) { /// 标记密文
-                if !IAPProductsManager.default().isAvailableAllFunction(){
-                    KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+                if KMMemberInfo.shared.isMemberAllFunction == false {
+                    KMMemberInfo.shared.advancedFunctionUsage()
                     return
                 }
                 
@@ -4346,10 +4334,10 @@ extension KMMainViewController : KMToolbarViewControllerDelegate {
                 }
             } else if type == .comparison {
                 FMTrackEventManager.defaultManager.trackEvent(event: "SubTbr_Editor", withProperties: ["SubTbr_Btn": "Btn_SubTbr_Editor_Compare"])
-                if !IAPProductsManager.default().isAvailableAllFunction(){
-                    let winC = KMPurchaseCompareWindowController.sharedInstance()
-                    winC?.kEventName = "Reading_Compare_BuyNow"
-                    winC?.showWindow(nil)
+                if KMMemberInfo.shared.isMemberAllFunction == false {
+                    let winC = KMProductCompareWC.shared
+                    winC.kEventName = "Reading_Compare_BuyNow"
+                    KMMemberInfo.shared.advancedFunctionUsage()
                     return
                 }
                 
@@ -4385,14 +4373,14 @@ extension KMMainViewController : KMToolbarViewControllerDelegate {
             
                 await NSWindow.currentWindow().beginSheet(controller.window!)
             } else if type == .watermark {
-                if !IAPProductsManager.default().isAvailableAllFunction(){
-                    let winC = KMPurchaseCompareWindowController.sharedInstance()
+                if KMMemberInfo.shared.isMemberAllFunction == false {
+                    let winC = KMProductCompareWC.shared
                     if index == 1 {
-                        winC?.kEventName = "Reading_AddWatermark_BuyNow"
+                        winC.kEventName = "Reading_AddWatermark_BuyNow"
                     } else if index == 2 {
-                        winC?.kEventName = "Reading_RemoveWatermark_BuyNow"
+                        winC.kEventName = "Reading_RemoveWatermark_BuyNow"
                     }
-                    winC?.showWindow(nil)
+                    KMMemberInfo.shared.advancedFunctionUsage()
                     return
                 }
                 
@@ -4495,14 +4483,14 @@ extension KMMainViewController : KMToolbarViewControllerDelegate {
                     return
                 }
             } else if type == .background {
-                if !IAPProductsManager.default().isAvailableAllFunction(){
-                    let winC = KMPurchaseCompareWindowController.sharedInstance()
+                if KMMemberInfo.shared.isMemberAllFunction == false {
+                    let winC = KMProductCompareWC.shared
                     if index == 1 {
-                        winC?.kEventName = "Reading_AddBackground_BuyNow"
+                        winC.kEventName = "Reading_AddBackground_BuyNow"
                     } else if index == 2 {
-                        winC?.kEventName = "Reading_RemoveBackground_BuyNow"
+                        winC.kEventName = "Reading_RemoveBackground_BuyNow"
                     }
-                    winC?.showWindow(nil)
+                    KMMemberInfo.shared.advancedFunctionUsage()
                     return
                 }
                 
@@ -4576,10 +4564,10 @@ extension KMMainViewController : KMToolbarViewControllerDelegate {
                     return
                 }
             } else if type == .measure {
-                if !IAPProductsManager.default().isAvailableAllFunction(){
-                    let winC = KMPurchaseCompareWindowController.sharedInstance()
-                    winC?.kEventName = "Reading_Measure_BuyNow"
-                    winC?.showWindow(nil)
+                if KMMemberInfo.shared.isMemberAllFunction == false {
+                    let winC = KMProductCompareWC.shared
+                    winC.kEventName = "Reading_Measure_BuyNow"
+                    KMMemberInfo.shared.advancedFunctionUsage()
                     return
                 }
                 
@@ -4902,11 +4890,9 @@ extension KMMainViewController : KMToolbarViewControllerDelegate {
     
     func openNewWindowAlertWindow() {
         var needShowChooseWindow = false
-//#if VERSION_FREE
-        if (!IAPProductsManager.default().isAvailableAllFunction()) {
+        if (!KMMemberInfo.shared.isMemberAllFunction) {
             needShowChooseWindow = true
         }
-//#endif
         if needShowChooseWindow {
             let preferenceNoteShow = UserDefaults.standard.bool(forKey: KMTabbingHintShowFlag)
             if preferenceNoteShow {
@@ -5047,10 +5033,10 @@ extension KMMainViewController : KMToolbarViewControllerDelegate {
                 
                 winC.startModal(nil)
             } else if index == 12 {
-                if IAPProductsManager.default().isAvailableAllFunction() == false {
-                    let winC = KMPurchaseCompareWindowController.sharedInstance()
-                    winC?.kEventName = "Reading_ReplaceText_BuyNow"
-                    winC?.showWindow(nil)
+                if KMMemberInfo.shared.isMemberAllFunction == false {
+                    let winC = KMProductCompareWC.shared
+                    winC.kEventName = "Reading_ReplaceText_BuyNow"
+                    KMMemberInfo.shared.advancedFunctionUsage()
                     return
                 }
                 
@@ -5077,7 +5063,6 @@ extension KMMainViewController : KMToolbarViewControllerDelegate {
                 }
                 
                 let point = toolbarItem.convert(toolbarItem.frame.origin, to: nil)
-//                - (winC.window?.frame.size.width ?? 0)
                 let x = point.x + (toolbarItem.window?.frame.origin.x ?? 0) - 200
                 let y = point.y + (toolbarItem.window?.frame.origin.y ?? 0) - 388
                 let winFramePoint = NSPoint(x: x, y: y)

+ 20 - 20
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+MenuAction.swift

@@ -95,8 +95,8 @@ extension KMMainViewController: KMSystemFileMenuProtocol {
     
     @IBAction func menuItemClick_saveAsFlattenedPDF(_ sender: Any) {
         Task { @MainActor in
-            if IAPProductsManager.default().isAvailableAllFunction() == false {
-                KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            if KMMemberInfo.shared.isMemberAllFunction == false {
+                KMMemberInfo.shared.advancedFunctionUsage()
                 return
             }
             self.saveAsFlattenedPDFAction()
@@ -393,8 +393,8 @@ extension KMMainViewController {
             return
         }
 
-        if item.tag < 2 && IAPProductsManager.default().isAvailableAllFunction() == false {
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+        if item.tag < 2 && KMMemberInfo.shared.isMemberAllFunction == false {
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
         self.splitView(withTag: item.tag)
@@ -407,8 +407,8 @@ extension KMMainViewController {
         }
         let mode = item.tag
         if mode > 0 {
-            if !IAPProductsManager.default().isAvailableAllFunction() {
-                KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            if KMMemberInfo.shared.isMemberAllFunction == false {
+                KMMemberInfo.shared.advancedFunctionUsage()
                 return
             }
         }
@@ -1218,11 +1218,11 @@ extension KMMainViewController: KMSystemToolMenuProtocol {
     }
     
     func rotateLeft(_ sender: Any?) {
-        if IAPProductsManager.default().isAvailableAllFunction() == false {
-            let winC = KMPurchaseCompareWindowController.sharedInstance()
-            winC?.kEventName = "Reading_Rotate_BuyNow"
-            winC?.kEventTag = 1
-            winC?.showWindow(nil)
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            let winC = KMProductCompareWC.shared
+            winC.kEventName = "Reading_Rotate_BuyNow"
+            winC.kEventTag = 1
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
         
@@ -1237,11 +1237,11 @@ extension KMMainViewController: KMSystemToolMenuProtocol {
     }
     
     func rotateRight(_ sender: Any?) {
-        if IAPProductsManager.default().isAvailableAllFunction() == false {
-            let winC = KMPurchaseCompareWindowController.sharedInstance()
-            winC?.kEventName = "Reading_Rotate_BuyNow"
-            winC?.kEventTag = 1
-            winC?.showWindow(nil)
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            let winC = KMProductCompareWC.shared
+            winC.kEventName = "Reading_Rotate_BuyNow"
+            winC.kEventTag = 1
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
         
@@ -1256,8 +1256,8 @@ extension KMMainViewController: KMSystemToolMenuProtocol {
     }
     
     func rotateAllLeft(_ sender: Any?) {
-        if IAPProductsManager.default().isAvailableAllFunction() == false {
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
         
@@ -1276,8 +1276,8 @@ extension KMMainViewController: KMSystemToolMenuProtocol {
     }
     
     func rotateAllRight(_ sender: Any?) {
-        if IAPProductsManager.default().isAvailableAllFunction() == false {
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
         

+ 13 - 13
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+UI.swift

@@ -306,33 +306,33 @@ extension KMMainViewController: KMToolbarControllerDelegate {
     
     func changeAnnotationModeAction(item: KMToolbarClickButton) {
         if self.listView.toolMode == .formToolMode {
-            if !IAPProductsManager.default().isAvailableAllFunction(){
-                let winC = KMPurchaseCompareWindowController.sharedInstance()
+            if KMMemberInfo.shared.isMemberAllFunction == false {
+                let winC = KMProductCompareWC.shared
                 if let type = CAnnotationType(rawValue: item.tag) {
                     if type == .textField {
-                        winC?.kEventName = "Reading_TextField_BuyNow"
+                        winC.kEventName = "Reading_TextField_BuyNow"
                     } else if type == .checkBox {
-                        winC?.kEventName = "Reading_CheckBox_BuyNow"
+                        winC.kEventName = "Reading_CheckBox_BuyNow"
                     } else if type == .radioButton {
-                        winC?.kEventName = "Reading_RadioButton_BuyNow"
+                        winC.kEventName = "Reading_RadioButton_BuyNow"
                     } else if type == .listMenu {
-                        winC?.kEventName = "Reading_ListBox_BuyNow"
+                        winC.kEventName = "Reading_ListBox_BuyNow"
                     } else if type == .comboBox {
-                        winC?.kEventName = "Reading_ComboBox_BuyNow"
+                        winC.kEventName = "Reading_ComboBox_BuyNow"
                     } else if type == .actionButton {
-                        winC?.kEventName = "Reading_Button_BuyNow"
+                        winC.kEventName = "Reading_Button_BuyNow"
                     }
                 }
-                winC?.showWindow(nil)
+                KMMemberInfo.shared.advancedFunctionUsage()
                 return
             }
         } else {
             let type = CAnnotationType(rawValue: item.tag) ?? CAnnotationType.unkown
             if type == .signature {
-                if !IAPProductsManager.default().isAvailableAllFunction(){
-                    let winC = KMPurchaseCompareWindowController.sharedInstance()
-                    winC?.kEventName = "Reading_ElectronicSign_BuyNow"
-                    winC?.showWindow(nil)
+                if KMMemberInfo.shared.isMemberAllFunction == false {
+                    let winC = KMProductCompareWC.shared
+                    winC.kEventName = "Reading_ElectronicSign_BuyNow"
+                    KMMemberInfo.shared.advancedFunctionUsage()
                     return
                 }
             }

+ 31 - 49
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController.swift

@@ -269,13 +269,16 @@ import Cocoa
         super.viewDidAppear()
         
         //春季活动
-        if ((KMAdvertisementManager.manager.info.popWindowContent) != nil) {
-            if KMAdvertisementManager.manager.info.popWindowContent!.content!.count > 0 {
-                let info = KMAdvertisementManager.manager.info.popWindowContent!.content?.first
-                if KMAdvertisementManager.checkAdvertisementValid(info!) {
-                    self.loadRecommondPopWindow()
+        if KMAdvertisementManager.manager.appClosedCount == 1 {
+            if ((KMAdvertisementManager.manager.info.popWindowContent) != nil) {
+                if KMAdvertisementManager.manager.info.popWindowContent!.content!.count > 0 {
+                    let info = KMAdvertisementManager.manager.info.popWindowContent!.content?.first
+                    if KMAdvertisementManager.checkAdvertisementValid(info!) {
+                        self.loadRecommondPopWindow()
+                    }
                 }
             }
+            KMAdvertisementManager.manager.appClosedCount = 2
         }
         
         //刷新前一页后一页按钮
@@ -539,7 +542,7 @@ import Cocoa
     
     func addAdsBannerView() {
 #if VERSION_FREE
-        if !IAPProductsManager.default().isAvailableAllFunction(){
+        if !KMMemberInfo.shared.isMemberAllFunction {
             guard let document = self.listView.document else {
                 return
             }
@@ -554,29 +557,6 @@ import Cocoa
         }
 
 #endif
-        //加载底部banner
-    //    - (void)loadingAdsManager {
-    //    #if VERSION_FREE
-    //            if(![self.pdfDocument isLocked]) {
-    //                if (![IAPProductsManager defaultManager].isAvailableAllFunction) {
-    //                    [[KMAdsManager defaultManager] beginSheetModalForView:self.pdfView
-    //                                                               directions:KMADViewDirectionsDown
-    //                                                                 animated:NO
-    //                                                        completionHandler:nil];
-    //                }
-    //                [[NSNotificationCenter defaultCenter] addObserverForName:KMIAPProductPurchasedNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *note){
-    //                    if ([IAPProductsManager defaultManager].isAvailableAllFunction) {
-    //                        [[KMAdsManager defaultManager] dismissSheetModalForView:self.pdfView];
-    //                    }
-    //                }];
-    //                [[NSNotificationCenter defaultCenter] addObserverForName:kDeviceActivateStatusChangeNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *note){
-    //                    if ([IAPProductsManager defaultManager].isAvailableAllFunction) {
-    //                        [[KMAdsManager defaultManager] dismissSheetModalForView:self.pdfView];
-    //                    }
-    //                }];
-    //            }
-    //    #endif
-    //    }
     }
     
     // MARK: Private Methods
@@ -705,13 +685,13 @@ import Cocoa
     // MARK: - 标记密文
     
     func enterRedact() {
-        if !IAPProductsManager.default().isAvailableAllFunction(){
-            let winC = KMPurchaseCompareWindowController.sharedInstance()
-            winC?.kEventName = "Reading_Redact_BuyNow"
-            winC?.showWindow(nil)
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            let winC = KMProductCompareWC.shared
+            winC.kEventName = "Reading_Redact_BuyNow"
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
-        
+
         if self.listView.document?.allowsPrinting == false || self.listView.document?.allowsCopying == false {
             Task {
                 _ = await KMAlertTool.runModel(message: KMLocalizedString("This is a secured document. Editing is not permitted.", nil))
@@ -1031,8 +1011,8 @@ import Cocoa
                 guideWC.digitalBoxRect = (self.view.window?.contentView?.convert(digitalPanelItem.frame, from: digitalPanelItem.superview)) ?? .zero
                 guideWC.purchaseHandle = { [weak self] windowVC in
 #if VERSION_DMG
-                    if IAPProductsManager.default().isAvailableAllFunction() {
-                        if IAPProductsManager.default().isAvailableAdvancedPDFToOffice() {
+                    if KMMemberInfo.shared.isMemberAllFunction {
+                        if KMMemberInfo.shared.isPermitConvert {
                             //Convert:
                             self?.showAllConvertWindow(convertT: .Word)
                         } else {
@@ -1044,18 +1024,19 @@ import Cocoa
                             limitWC.showWindow(nil)
                         }
                     } else {
-                        KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+                        KMProductCompareWC.shared.orientation = false
+                        KMProductCompareWC.shared.showWindow(nil)
                     }
 #else
-                    if IAPProductsManager.default().isAvailableAllFunction() {
-                        if IAPProductsManager.default().isAvailableAdvancedPDFToOffice() {
-                            //Convert:
+                    if KMMemberInfo.shared.isMemberAllFunction == true {
+                        if KMMemberInfo.shared.isPermitConvert == true {
+                            
                         } else {
                             var vc = KMToolCompareWindowController(toolType: .Convert, selectNum: 1)
                             vc.showWindow(nil)
                         }
                     } else {
-                        KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+                        KMMemberInfo.shared.advancedFunctionUsage()
                     }
 #endif
                 }
@@ -1083,7 +1064,8 @@ import Cocoa
             if lastVersion.isEmpty || lastVersion != appVersion {
                 UserDefaults.standard.setValue(appVersion, forKey: "SKLastTrialVersionMainDocumentLaunchedKey")
                 UserDefaults.standard.synchronize()
-                KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+                KMProductCompareWC.shared.orientation = false
+                KMProductCompareWC.shared.showWindow(nil)
             }
         }
 #endif
@@ -1260,13 +1242,13 @@ import Cocoa
     }
     
     func showDigitalSignWindow(withFilePathURL fileURL: URL) {
-        if !IAPProductsManager.default().isAvailableAllFunction(){
-            let winC = KMPurchaseCompareWindowController.sharedInstance()
-            winC?.kEventName = "Reading_DigitalSign_BuyNow"
-            winC?.showWindow(nil)
+        if KMMemberInfo.shared.isMemberAllFunction == false {
+            let winC = KMProductCompareWC.shared
+            winC.kEventName = "Reading_DigitalSign_BuyNow"
+            KMMemberInfo.shared.advancedFunctionUsage()
             return
         }
-        
+
         if hasShowDigitalSign() {
             self.exitDigitalSign()
         }
@@ -2455,7 +2437,7 @@ import Cocoa
     }
     
     @objc func purchaseStateUpdateNoti() {
-        if IAPProductsManager.default().isAvailableAllFunction() {
+        if KMMemberInfo.shared.isMemberAllFunction {
             KMAdsManager.defaultManager.dismissSheetModal(for: self.readContentView)
         }
     }
@@ -2542,7 +2524,7 @@ extension KMMainViewController {
     // MARK: - Recommond活动
     
     func loadRecommondPopWindow() {
-        if IAPProductsManager.default().isAvailableAllFunction() {
+        if KMMemberInfo.shared.isMemberAllFunction {
             return
         }
         

+ 3 - 4
PDF Office/PDF Master/Class/Preference/Controller/KMGeneralPreferences.swift

@@ -129,7 +129,7 @@ class KMGeneralPreferences: NSViewController {
         KMShiftAndResizeView(self.view, dx: 0.0, dw: dw)
         
 #if VERSION_FREE
-    if IAPProductsManager.default().isAvailableAllFunction() == false {
+    if KMMemberInfo.shared.isMemberAllFunction == false {
         KMPreference.shared.openDocumentType = .newWindow
     }
 #endif
@@ -188,9 +188,8 @@ class KMGeneralPreferences: NSViewController {
         var tabbingMode = NSWindow.TabbingMode.automatic
         if (self.openTabButton.indexOfSelectedItem == 0) {
 #if VERSION_FREE
-            if IAPProductsManager.default().isAvailableAllFunction() == false {
-                KMPreference.shared.openDocumentType = .newWindow
-                KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            if KMMemberInfo.shared.isMemberAllFunction == false {
+                KMMemberInfo.shared.advancedFunctionUsage()
                 self.openTabButton.selectItem(at: 1)
                 return
             }

+ 45 - 45
PDF Office/PDF Master/Class/Purchase/Appstore/KMPurchaseCompareWindowController.m

@@ -697,28 +697,28 @@ static NSString *const KMPurchaseCompareCellIdentifier       = @"KMPurchaseCompa
     self.value1PurchaseBtnLblBtn.enabled = self.value1PurchaseButton.enabled;
     
     self.value1PurchaseBtnLbl.stringValue = NSLocalizedString(@"Subscribe", nil);
-    if ([IAPProductsManager defaultManager].newlyMonthProduct.isTrialPeriod) {
+    if ([IAPProductsManager defaultManager].allAccessPackNew6months_lite.isTrialPeriod) {
         self.value1PurchaseBtnLbl.stringValue = NSLocalizedString(@"Subscribe", nil);
-        if ([IAPProductsManager defaultManager].newlyMonthProduct.isSubscribed) {
+        if ([IAPProductsManager defaultManager].allAccessPackNew6months_lite.isSubscribed) {
             self.value1PurchaseBtnLbl.stringValue = NSLocalizedString(@"Subscribed", nil);
         }
-    } else if ([IAPProductsManager defaultManager].yearProduct.isTrialPeriod) {
+    } else if ([IAPProductsManager defaultManager].allAccessPack12months_lite.isTrialPeriod) {
         self.value1PurchaseBtnLbl.stringValue = NSLocalizedString(@"Subscribe", nil);
-        if ([IAPProductsManager defaultManager].yearProduct.isSubscribed) {
+        if ([IAPProductsManager defaultManager].allAccessPack12months_lite.isSubscribed) {
             self.value1PurchaseBtnLbl.stringValue = NSLocalizedString(@"Subscribed", nil);
         }
     } else {
-        if ([IAPProductsManager defaultManager].newlyMonthProduct.isSubscribed) {
+        if ([IAPProductsManager defaultManager].allAccessPackNew6months_lite.isSubscribed) {
             self.value1PurchaseBtnLbl.stringValue = NSLocalizedString(@"Subscribed", nil);
-        } else if ([IAPProductsManager defaultManager].yearProduct.isSubscribed) {
+        } else if ([IAPProductsManager defaultManager].allAccessPack12months_lite.isSubscribed) {
             self.value1PurchaseBtnLbl.stringValue = NSLocalizedString(@"Subscribed", nil);
         } else {
             self.value1PurchaseBtnLbl.stringValue = NSLocalizedString(@"Free Trial", nil);
             if (@available(macOS 10.13.2, *)) {
 #if !VERSION_DMG
-                if (![IAPProductsManager defaultManager].newlyMonthProduct.product.introductoryPrice) {
+                if (![IAPProductsManager defaultManager].allAccessPackNew6months_lite.product.introductoryPrice) {
                     self.value1PurchaseBtnLbl.stringValue = NSLocalizedString(@"Subscribe", nil);
-                } else if (![IAPProductsManager defaultManager].yearProduct.product.introductoryPrice) {
+                } else if (![IAPProductsManager defaultManager].allAccessPack12months_lite.product.introductoryPrice) {
                     self.value1PurchaseBtnLbl.stringValue = NSLocalizedString(@"Subscribe", nil);
                 }
 #endif
@@ -739,53 +739,53 @@ static NSString *const KMPurchaseCompareCellIdentifier       = @"KMPurchaseCompa
     NSString *averageMonthPrice_discount = nil;
     NSString *monthPrice_discount = nil;
     NSString *allPrice = nil;
-    if ([IAPProductsManager defaultManager].newlyMonthProduct.isOffers) {
+    if ([IAPProductsManager defaultManager].allAccessPackNew6months_lite.isOffers) {
         self.specialView1.hidden = NO;
-        averageMonthPrice = [IAPProductsManager defaultManager].newlyMonthProduct.offersAveragePrice;
-        monthPrice = [IAPProductsManager defaultManager].newlyMonthProduct.offersPrice;
-        averageMonthPrice_discount = [IAPProductsManager defaultManager].newlyMonthProduct.discountAveragePrice;
-        monthPrice_discount = [IAPProductsManager defaultManager].newlyMonthProduct.discountPrice;
+        averageMonthPrice = [IAPProductsManager defaultManager].allAccessPackNew6months_lite.offersAveragePrice;
+        monthPrice = [IAPProductsManager defaultManager].allAccessPackNew6months_lite.offersPrice;
+        averageMonthPrice_discount = [IAPProductsManager defaultManager].allAccessPackNew6months_lite.discountAveragePrice;
+        monthPrice_discount = [IAPProductsManager defaultManager].allAccessPackNew6months_lite.discountPrice;
         self.topButtonOffset.constant = 20;
-    } else if ([IAPProductsManager defaultManager].yearProduct.isOffers) {
-        averageMonthPrice = [IAPProductsManager defaultManager].yearProduct.offersAveragePrice;
-        monthPrice = [IAPProductsManager defaultManager].yearProduct.offersPrice;
-        averageMonthPrice_discount = [IAPProductsManager defaultManager].yearProduct.discountAveragePrice;
-        monthPrice_discount = [IAPProductsManager defaultManager].yearProduct.discountPrice;
+    } else if ([IAPProductsManager defaultManager].allAccessPack12months_lite.isOffers) {
+        averageMonthPrice = [IAPProductsManager defaultManager].allAccessPack12months_lite.offersAveragePrice;
+        monthPrice = [IAPProductsManager defaultManager].allAccessPack12months_lite.offersPrice;
+        averageMonthPrice_discount = [IAPProductsManager defaultManager].allAccessPack12months_lite.discountAveragePrice;
+        monthPrice_discount = [IAPProductsManager defaultManager].allAccessPack12months_lite.discountPrice;
         self.topButtonOffset.constant = 20;
     } else {
         self.specialView1.hidden = YES;
         if (self.isPurchaseSwitch == false) {
-            averageMonthPrice = [IAPProductsManager defaultManager].newlyMonthProduct.averagePrice;
-            monthPrice = [IAPProductsManager defaultManager].newlyMonthProduct.price;
-            averageMonthPrice_discount = [IAPProductsManager defaultManager].newlyMonthProduct.discountAveragePrice;
-            monthPrice_discount = [IAPProductsManager defaultManager].newlyMonthProduct.discountPrice;
+            averageMonthPrice = [IAPProductsManager defaultManager].allAccessPackNew6months_lite.averagePrice;
+            monthPrice = [IAPProductsManager defaultManager].allAccessPackNew6months_lite.price;
+            averageMonthPrice_discount = [IAPProductsManager defaultManager].allAccessPackNew6months_lite.discountAveragePrice;
+            monthPrice_discount = [IAPProductsManager defaultManager].allAccessPackNew6months_lite.discountPrice;
         } else {
-            averageMonthPrice = [IAPProductsManager defaultManager].yearProduct.averagePrice;
-            monthPrice = [IAPProductsManager defaultManager].yearProduct.price;
-            averageMonthPrice_discount = [IAPProductsManager defaultManager].yearProduct.discountAveragePrice;
-            monthPrice_discount = [IAPProductsManager defaultManager].yearProduct.discountPrice;
+            averageMonthPrice = [IAPProductsManager defaultManager].allAccessPack12months_lite.averagePrice;
+            monthPrice = [IAPProductsManager defaultManager].allAccessPack12months_lite.price;
+            averageMonthPrice_discount = [IAPProductsManager defaultManager].allAccessPack12months_lite.discountAveragePrice;
+            monthPrice_discount = [IAPProductsManager defaultManager].allAccessPack12months_lite.discountPrice;
         }
         self.topButtonOffset.constant = 10;
     }
     
-    if ([IAPProductsManager defaultManager].allAccessProduct.isOffers) {
+    if ([IAPProductsManager defaultManager].allAccessPackPermanent_lite.isOffers) {
         self.topButtonOffset.constant = 20;
         self.specialView.hidden = NO;
-        allPrice = [IAPProductsManager defaultManager].allAccessProduct.offersPrice;
+        allPrice = [IAPProductsManager defaultManager].allAccessPackPermanent_lite.offersPrice;
     } else {
         self.topButtonOffset.constant = 10;
         self.specialView.hidden = YES;
-        allPrice = [IAPProductsManager defaultManager].allAccessProduct.price;
+        allPrice = [IAPProductsManager defaultManager].allAccessPackPermanent_lite.price;
     }
     
-    CGFloat off = 1 -[IAPProductsManager defaultManager].allAccessProduct.offers;
+    CGFloat off = 1 -[IAPProductsManager defaultManager].allAccessPackPermanent_lite.offers;
     NSString *offString = [NSString stringWithFormat:@"%.f%%",off * 100];
     self.specialLabel.stringValue = [NSString stringWithFormat:NSLocalizedString(@"%@ off", @""),offString];
     
     if (self.isPurchaseSwitch) {
-        off = 1 -[IAPProductsManager defaultManager].yearProduct.offers;
+        off = 1 -[IAPProductsManager defaultManager].allAccessPack12months_lite.offers;
     } else {
-        off = 1 -[IAPProductsManager defaultManager].newlyMonthProduct.offers;
+        off = 1 -[IAPProductsManager defaultManager].allAccessPackNew6months_lite.offers;
     }
     offString = [NSString stringWithFormat:@"%.f%%",off * 100];
     self.specialLabel1.stringValue = [NSString stringWithFormat:NSLocalizedString(@"%@ off", @""),offString];
@@ -850,15 +850,15 @@ static NSString *const KMPurchaseCompareCellIdentifier       = @"KMPurchaseCompa
         tTips = [NSString stringWithFormat:NSLocalizedString(@"Billed every 6 months at %@ after 7-day trial ends.", nil), monthPrice];
 #if !VERSION_DMG
         if (self.isPurchaseSwitch) {
-            if ([IAPProductsManager defaultManager].yearProduct.product) {
+            if ([IAPProductsManager defaultManager].allAccessPack12months_lite.product) {
                 if (@available(macOS 10.13.2, *)) {
-                    tTips = [NSString stringWithFormat:NSLocalizedString(@"Billed every 12 months at %@ after %@-day trial ends.", nil), monthPrice,@([IAPProductsManager defaultManager].yearProduct.product.introductoryPrice.subscriptionPeriod.numberOfUnits)];
+                    tTips = [NSString stringWithFormat:NSLocalizedString(@"Billed every 12 months at %@ after %@-day trial ends.", nil), monthPrice,@([IAPProductsManager defaultManager].allAccessPack12months_lite.product.introductoryPrice.subscriptionPeriod.numberOfUnits)];
                 }
             }
         } else {
-            if ([IAPProductsManager defaultManager].newlyMonthProduct.product) {
+            if ([IAPProductsManager defaultManager].allAccessPackNew6months_lite.product) {
                 if (@available(macOS 10.13.2, *)) {
-                    tTips = [NSString stringWithFormat:NSLocalizedString(@"Billed every 6 months at %@ after %@-day trial ends.", nil), monthPrice,@([IAPProductsManager defaultManager].newlyMonthProduct.product.introductoryPrice.subscriptionPeriod.numberOfUnits)];
+                    tTips = [NSString stringWithFormat:NSLocalizedString(@"Billed every 6 months at %@ after %@-day trial ends.", nil), monthPrice,@([IAPProductsManager defaultManager].allAccessPackNew6months_lite.product.introductoryPrice.subscriptionPeriod.numberOfUnits)];
                 }
             }
         }
@@ -867,7 +867,7 @@ static NSString *const KMPurchaseCompareCellIdentifier       = @"KMPurchaseCompa
     if (@available(macOS 10.13.2, *)) {
 #if !VERSION_DMG
         if (self.isPurchaseSwitch) {
-            if (![IAPProductsManager defaultManager].yearProduct.product.introductoryPrice) {
+            if (![IAPProductsManager defaultManager].allAccessPack12months_lite.product.introductoryPrice) {
                 if (isShowSale) {
                     tTips = [NSString stringWithFormat:NSLocalizedString(@"%@ for the first year's subscription", nil), monthPrice_discount];
                 } else {
@@ -875,7 +875,7 @@ static NSString *const KMPurchaseCompareCellIdentifier       = @"KMPurchaseCompa
                 }
             }
         } else {
-            if (![IAPProductsManager defaultManager].newlyMonthProduct.product.introductoryPrice) {
+            if (![IAPProductsManager defaultManager].allAccessPackNew6months_lite.product.introductoryPrice) {
                 if (isShowSale) {
                     tTips = [NSString stringWithFormat:NSLocalizedString(@"%@ for the first 6-month subscription", nil), monthPrice_discount];
                 } else {
@@ -1043,11 +1043,11 @@ static NSString *const KMPurchaseCompareCellIdentifier       = @"KMPurchaseCompa
 - (BOOL)isShowSale {
     if (@available(macOS 10.14.4, *)) {
         if ([self isCancelAutoRenew]) {
-            BOOL isSubscribed = [IAPProductsManager defaultManager].newlyMonthProduct.isSubscribed;
+            BOOL isSubscribed = [IAPProductsManager defaultManager].allAccessPackNew6months_lite.isSubscribed;
             if (isSubscribed) {
                 return false;
             }
-            isSubscribed = [IAPProductsManager defaultManager].yearProduct.isSubscribed;
+            isSubscribed = [IAPProductsManager defaultManager].allAccessPack12months_lite.isSubscribed;
             if (isSubscribed) {
                 return false;
             }
@@ -1112,10 +1112,10 @@ static NSString *const KMPurchaseCompareCellIdentifier       = @"KMPurchaseCompa
 
 - (IBAction)buttonItemClicked_Subscribe:(id)sender {
     if (self.isPurchaseSwitch) {
-        [[IAPProductsManager defaultManager] makeSubProduct:[IAPProductsManager defaultManager].yearProduct discount:[self isCancelAutoRenew]];
+        [[IAPProductsManager defaultManager] makeSubProduct:[IAPProductsManager defaultManager].allAccessPack12months_lite discount:[self isCancelAutoRenew]];
         
     } else {
-        [[IAPProductsManager defaultManager] makeSubProduct:[IAPProductsManager defaultManager].newlyMonthProduct discount:[self isCancelAutoRenew]];
+        [[IAPProductsManager defaultManager] makeSubProduct:[IAPProductsManager defaultManager].allAccessPackNew6months_lite discount:[self isCancelAutoRenew]];
     }
     [self addWaingView:self.window.contentView];
     [[FMTrackEventManager defaultManager] trackEventWithEvent:@"PUW" withProperties:@{@"PUW_Btn":@"PUW_Btn_Upgrade_6Mon"}];
@@ -1185,7 +1185,7 @@ static NSString *const KMPurchaseCompareCellIdentifier       = @"KMPurchaseCompa
 }
 
 - (IBAction)buttonItemClicked_LicenseUpgrade:(id)sender {
-    [[IAPProductsManager defaultManager] makeProduct:[IAPProductsManager defaultManager].allAccessProduct];
+    [[IAPProductsManager defaultManager] makeProduct:[IAPProductsManager defaultManager].allAccessPackPermanent_lite];
     [self addWaingView:self.window.contentView];
     [[FMTrackEventManager defaultManager] trackEventWithEvent:@"PUW" withProperties:@{@"PUW_Btn":@"PUW_Btn_Upgrade_Permanent"}];
 }
@@ -1371,11 +1371,11 @@ static NSString *const KMPurchaseCompareCellIdentifier       = @"KMPurchaseCompa
     [self removeWaitingView:self.window.contentView];
     [self reloadData];
     
-    if (IAPProductsManager.defaultManager.newlyMonthProduct.isSubscribed) {
+    if (IAPProductsManager.defaultManager.allAccessPackNew6months_lite.isSubscribed) {
         if (self.kEventTag == 1) {
             [self trackEvent_freeWithEventName:@"PromotionalOffer" params:@{@"PUW_Btn" : @"PUW_7OffUpgrade_6MonthPaid"} platform:KMAnalyticsPlatformAppCenter];
         }
-    } else if (IAPProductsManager.defaultManager.yearProduct.isSubscribed) {
+    } else if (IAPProductsManager.defaultManager.allAccessPack12months_lite.isSubscribed) {
         if (self.kEventTag == 1) {
             [self trackEvent_freeWithEventName:@"PromotionalOffer" params:@{@"PUW_Btn" : @"PUW_7OffUpgrade_12MonthPaid"} platform:KMAnalyticsPlatformAppCenter];
         }

+ 1 - 1
PDF Office/PDF Master/Class/Purchase/Appstore/KMPurchaseCompareWindowController.xib

@@ -71,7 +71,7 @@
             <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES" fullSizeContentView="YES"/>
             <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
             <rect key="contentRect" x="77" y="40" width="1114" height="720"/>
-            <rect key="screenRect" x="0.0" y="0.0" width="2560" height="1415"/>
+            <rect key="screenRect" x="0.0" y="0.0" width="1800" height="1125"/>
             <value key="minSize" type="size" width="1114" height="720"/>
             <value key="maxSize" type="size" width="1114" height="720"/>
             <view key="contentView" wantsLayer="YES" misplaced="YES" id="se5-gp-TjO">

+ 0 - 0
PDF Office/PDF Master/Class/Purchase/DMG/DMGEmbeddedOldWC.swift


Some files were not shown because too many files changed in this diff