Browse Source

【综合】合并V4.6.0代码

tangchao 5 months ago
parent
commit
9d57438a3b
100 changed files with 6033 additions and 2116 deletions
  1. 36 5
      PDF Office/PDF Master/AppDelegate.swift
  2. 5 2
      PDF Office/PDF Master/Class/AIInfo/AIConfigWindowController/Views/AIHeaderView/AIHeaderView.swift
  3. 3 0
      PDF Office/PDF Master/Class/AIInfo/AIConfigWindowController/Views/AIInfoInputView/AIInfoInputView.swift
  4. 192 0
      PDF Office/PDF Master/Class/Analytics/KMAnalytics+KMExtensions.swift
  5. 10 0
      PDF Office/PDF Master/Class/Analytics/KMAnalytics.swift
  6. 38 0
      PDF Office/PDF Master/Class/Appearance/Color.xcassets/Purchase/KMPurchaseBoxColor.colorset/Contents.json
  7. 38 0
      PDF Office/PDF Master/Class/Appearance/Color.xcassets/Purchase/KMPurchaseBoxColor1.colorset/Contents.json
  8. 38 0
      PDF Office/PDF Master/Class/Appearance/Color.xcassets/Purchase/KMPurchaseErrorColor.colorset/Contents.json
  9. 38 0
      PDF Office/PDF Master/Class/Appearance/Color.xcassets/Purchase/KMPurchase_000000.colorset/Contents.json
  10. 38 0
      PDF Office/PDF Master/Class/Appearance/Color.xcassets/Purchase/KMPurchase_002143.colorset/Contents.json
  11. 38 0
      PDF Office/PDF Master/Class/Appearance/Color.xcassets/Purchase/KMPurchase_99A6B2.colorset/Contents.json
  12. 38 0
      PDF Office/PDF Master/Class/Appearance/Color.xcassets/Purchase/KMPurchase_DADBDE.colorset/Contents.json
  13. 38 0
      PDF Office/PDF Master/Class/Appearance/Color.xcassets/Purchase/KMPurchase_FFFFFF.colorset/Contents.json
  14. 22 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Purchase/EmbeddedPayment26.imageset/Contents.json
  15. 164 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Purchase/EmbeddedPayment26.imageset/label-text (1).pdf
  16. 164 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Purchase/EmbeddedPayment26.imageset/label-text 1.pdf
  17. 22 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Purchase/EmbeddedPayment27.imageset/Contents.json
  18. BIN
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Purchase/EmbeddedPayment27.imageset/Frame 1000007062 (1).pdf
  19. BIN
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Purchase/EmbeddedPayment27.imageset/Frame 1000007062.pdf
  20. 22 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Purchase/EmbeddedPayment28.imageset/Contents.json
  21. BIN
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Purchase/EmbeddedPayment28.imageset/Frame 1000007063 (1).pdf
  22. BIN
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Purchase/EmbeddedPayment28.imageset/Frame 1000007063.pdf
  23. 6 2
      PDF Office/PDF Master/Class/Batch/WindowController/KMBatchOperateLeftViewController.swift
  24. 14 1
      PDF Office/PDF Master/Class/Batch/WindowController/VC/KMBatchOperateConvertViewController.swift
  25. 9 0
      PDF Office/PDF Master/Class/ChromiumTabs/KMBrowserWindow.swift
  26. 5 0
      PDF Office/PDF Master/Class/ChromiumTabs/KMBrowserWindowController.swift
  27. 31 0
      PDF Office/PDF Master/Class/Common/Category/CPDFKit/CPDFAnnotation+KMExtension.swift
  28. 9 0
      PDF Office/PDF Master/Class/Common/KMCommonDefine.swift
  29. 1 1
      PDF Office/PDF Master/Class/GuideInfo/Controllers/FunctionGuide/KMOpenFileFunctionView.swift
  30. 1 1
      PDF Office/PDF Master/Class/GuideInfo/Controllers/KMFunctionGuideMultiController.swift
  31. 8 1
      PDF Office/PDF Master/Class/GuideInfo/KMCouponDueWindowController.swift
  32. 18 4
      PDF Office/PDF Master/Class/GuideInfo/KMFunctionGuideWindowController.swift
  33. 1 1
      PDF Office/PDF Master/Class/Home/View/HomeContentView/QucikTools/View/KMQucikToolCollectionViewItem.swift
  34. 32 9
      PDF Office/PDF Master/Class/Home/ViewController/KMHomeViewController+Action.swift
  35. 7 1
      PDF Office/PDF Master/Class/KMAdvertisement/View/Tableview/Cell/KMAdvertisementCollectionViewItem.swift
  36. 3 1
      PDF Office/PDF Master/Class/PDFTools/AddHeaderFooter/Model/KMBatchAddHeaderFooterOperation.swift
  37. 9 0
      PDF Office/PDF Master/Class/PDFTools/AddHeaderFooter/VC/KMBatchOperateAddHeaderFooterViewController.swift
  38. 1 0
      PDF Office/PDF Master/Class/PDFTools/Background/New/View/KMAddBackgroundView.swift
  39. 41 1
      PDF Office/PDF Master/Class/PDFTools/Convert/ExtractImage/Controller/KMExtractImageWindowController.swift
  40. 21 1
      PDF Office/PDF Master/Class/PDFTools/Convert/NewController/KMConvertWindowController.swift
  41. 11 5
      PDF Office/PDF Master/Class/PDFTools/Convert/NewController/KMToolCompareWindowController.swift
  42. 36 3
      PDF Office/PDF Master/Class/PDFTools/EditPDF/Tools/KMEditPDfHanddler.swift
  43. 7 1
      PDF Office/PDF Master/Class/PDFTools/Merge/MergeNew/KMMergeWindowController.swift
  44. 264 19
      PDF Office/PDF Master/Class/PDFTools/PageEdit/Controller/KMPDFEditViewController.swift
  45. 1 0
      PDF Office/PDF Master/Class/PDFTools/PageEdit/Window/KMPDFEditWindowController.swift
  46. 9 3
      PDF Office/PDF Master/Class/PDFTools/Print/PrintHelper/PrintManage/KMPDFPrintManageWindowController.m
  47. 3 1
      PDF Office/PDF Master/Class/PDFTools/RemovePassword/New/View/KMRemovePasswordView.swift
  48. 3 1
      PDF Office/PDF Master/Class/PDFTools/RemovePassword/VC/KMBatchOperateRemovePasswordViewController.swift
  49. 11 0
      PDF Office/PDF Master/Class/PDFTools/Watermark/Controller/KMBatchOperateAddWatermarkViewController.swift
  50. BIN
      PDF Office/PDF Master/Class/PDFWindowController/MainWindowController/Quick Start Guide.pdf
  51. 5 1
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFAnnotationModel.m
  52. 5 1
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFFreeTextAnnotation+PDFListView.swift
  53. 6 1
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/SelfSign/CSelfSignAnnotationFreeText.m
  54. 2 0
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFListViewExtension/CPDFListView+Tool.m
  55. BIN
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/ComPDFKit
  56. 1 1
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/_CodeSignature/CodeResources
  57. 7 4
      PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Annotation/Controller/KMNoteOutlineFilterViewController.swift
  58. 7 4
      PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Annotation/View/KMNoteTableViewCell.swift
  59. 3 3
      PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Annotation/View/KMNoteTypeCollectionViewItem.swift
  60. 24 6
      PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController+Note.swift
  61. 4 2
      PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController+Thumbnail.swift
  62. 2 2
      PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController.swift
  63. 21 3
      PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Thumbnail/Base/KMPDFThumbViewBaseController.swift
  64. 4 1
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMAnnotationPropertiesViewController.m
  65. 8 0
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMAnnotationSelectLinkViewController.swift
  66. 6 2
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/ViewController/PageDisplay/KMPageDisplayPropertiesViewController.swift
  67. 9 10
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/EditPDF/KMEditPDFTextPropertyViewController.swift
  68. 2 0
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/KMRightSideViewController.swift
  69. 12 1
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/Signature/KMSignatureAnnotationViewController.m
  70. 2 1
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/StampList/CreateStamp/Controller/KMStampCreaterWindowController.swift
  71. 8 4
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/StampList/KMAnnotationStampViewController.swift
  72. 3 1
      PDF Office/PDF Master/Class/PDFWindowController/TabWindowController/KMTabbingHintWindowController.swift
  73. 3 0
      PDF Office/PDF Master/Class/PDFWindowController/Toolbar/KMToolbarController.swift
  74. 3 1
      PDF Office/PDF Master/Class/PDFWindowController/Toolbar/KMToolbarViewController.swift
  75. 183 26
      PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+Action.swift
  76. 8 2
      PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+MenuAction.swift
  77. 27 7
      PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+UI.swift
  78. 111 68
      PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController.swift
  79. 2 0
      PDF Office/PDF Master/Class/Purchase/Appstore/KMPurchaseCompareWindowController.m
  80. 128 0
      PDF Office/PDF Master/Class/Purchase/DMG/KMEmbeddedPaymentPopWC.swift
  81. 60 0
      PDF Office/PDF Master/Class/Purchase/DMG/KMEmbeddedPaymentPopWC.xib
  82. 6 0
      PDF Office/PDF Master/Class/Purchase/DMG/KMPurchaseCompareDMGWindowController.h
  83. 650 15
      PDF Office/PDF Master/Class/Purchase/DMG/KMPurchaseCompareDMGWindowController.m
  84. 136 47
      PDF Office/PDF Master/Class/Purchase/DMG/KMPurchaseCompareDMGWindowController.xib
  85. 1553 827
      PDF Office/PDF Master/Class/Purchase/DMG/KMPurchaseEmbeddedWindowController.swift
  86. 1298 985
      PDF Office/PDF Master/Class/Purchase/DMG/KMPurchaseEmbeddedWindowController.xib
  87. 10 5
      PDF Office/PDF Master/Class/Purchase/DMG/KMPurchaseFirstTrialWindowController.swift
  88. 8 3
      PDF Office/PDF Master/Class/Purchase/DMG/KMPurchaseLimitWindowController.swift
  89. 1 1
      PDF Office/PDF Master/Class/Purchase/DMG/KMPurchaseLimitWindowController.xib
  90. 1 0
      PDF Office/PDF Master/Class/Purchase/DMG/Verification/KMActivityALertViewController.xib
  91. 1 1
      PDF Office/PDF Master/Class/Purchase/DMG/Verification/KMRepeatTrialAlertController.m
  92. 23 11
      PDF Office/PDF Master/Class/Purchase/DMG/Verification/KMVerificationMessageViewController.m
  93. 9 5
      PDF Office/PDF Master/Class/Purchase/DMG/Verification/KMVerificationWindowController.m
  94. 7 0
      PDF Office/PDF Master/Class/Purchase/DMG/Verification/VerificationManager/AIInfoManager.h
  95. 10 0
      PDF Office/PDF Master/Class/Purchase/DMG/Verification/VerificationManager/AIInfoManager.m
  96. 127 0
      PDF Office/PDF Master/Class/Purchase/DMG/Verification/VerificationManager/KMDMGProductsManager.swift
  97. 4 0
      PDF Office/PDF Master/Class/Purchase/DMG/Verification/VerificationManager/VerificationManager.h
  98. 16 0
      PDF Office/PDF Master/Class/Purchase/DMG/Verification/VerificationManager/VerificationManager.m
  99. 1 0
      PDF Office/PDF Master/Class/Purchase/DMG/paddle.js
  100. 0 0
      PDF Office/PDF Master/Class/Purchase/IAPProductsManager.h

+ 36 - 5
PDF Office/PDF Master/AppDelegate.swift

@@ -171,6 +171,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, iRateDelegate{
         
 #if VERSION_DMG
         VerificationManager.default()
+        KMDMGProductsManager.shareInstance.getProductDatas()
 #else
         self.initiVersionData()
         IAPProductsManager.default().initIAP()
@@ -190,6 +191,19 @@ class AppDelegate: NSObject, NSApplicationDelegate, iRateDelegate{
             }
              
         }
+        
+        let appMenu = NSApp.mainMenu?.item(at: 0)?.submenu
+        for item in appMenu!.items {
+            if item.action == #selector(aiToolsAction)  {
+                if let tManager = VerificationManager.default() {
+                    let status = tManager.status
+                    if status == ActivityStatusNone {
+                        item.isHidden = true
+                    }
+                }
+            }
+        }
+        NotificationCenter.default.addObserver(self, selector: #selector(deviceActivateStatusChangeNotification), name: NSNotification.Name(rawValue: "kDeviceActivateNotification"), object: nil)
     }
     
     func initiRateData() {
@@ -424,6 +438,20 @@ class AppDelegate: NSObject, NSApplicationDelegate, iRateDelegate{
         }
     }
     
+    @objc func deviceActivateStatusChangeNotification() {
+        let appMenu = NSApp.mainMenu?.item(at: 0)?.submenu
+        for item in appMenu!.items {
+            if item.action == #selector(aiToolsAction)  {
+                if let tManager = VerificationManager.default() {
+                    let status = tManager.status
+                    if status == ActivityStatusNone {
+                        item.isHidden = true
+                    }
+                }
+            }
+        }
+    }
+    
     func refreshAIMenuItemInfo() -> Void {
         let appMenu = NSApp.mainMenu?.item(at: 0)?.submenu
         for item in appMenu!.items {
@@ -712,11 +740,14 @@ class AppDelegate: NSObject, NSApplicationDelegate, iRateDelegate{
     
     @objc func pdftoOfficeMenuItemAction(_ sender: NSMenuItem) {
 #if VERSION_DMG
-        var url = URL(string: Store_Link + "?product_code=product_2")
-        let tWorkSpace = NSWorkspace.shared
-        if tWorkSpace.open(url!) == false {
-            tWorkSpace.open(url!)
-        }
+//        var url = URL(string: Store_Link + "?product_code=product_2")
+//        let tWorkSpace = NSWorkspace.shared
+//        if tWorkSpace.open(url!) == false {
+//            tWorkSpace.open(url!)
+//        }
+        let embeddedWC = KMPurchaseEmbeddedWindowController.currentFirstTrialWC("com.brother.pdfreaderpro.mac.product_2")
+        embeddedWC.showWindow(nil)
+        embeddedWC.window?.center()
 #endif
     }
     

+ 5 - 2
PDF Office/PDF Master/Class/AIInfo/AIConfigWindowController/Views/AIHeaderView/AIHeaderView.swift

@@ -60,8 +60,11 @@ class AIHeaderView: NSView, NibLoadable {
         let controller = AIUserInfoController.init()
         controller.purchaseHandle = { vc in
 #if VERSION_DMG
-            let url = URL(string: AIProduct_Link)
-            NSWorkspace.shared.open(url!)
+//            let url = URL(string: AIProduct_Link)
+//            NSWorkspace.shared.open(url!)
+            let embeddedWC = KMPurchaseEmbeddedWindowController.currentFirstTrialWC("com.brother.pdfreaderpro.ai.product_1")
+            embeddedWC.showWindow(self)
+            embeddedWC.window?.center()
 #else
             AIPurchaseWindowController.currentWC().showWindow(nil)
 #endif

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

@@ -154,6 +154,9 @@ class AIInfoInputView: NSView, NibLoadable, NSTextFieldDelegate, NSTextViewDeleg
         self.inputTextCountLabel.formatter = countFormatter
         self.inputTextCountLabel.delegate = self
         
+        if let data = self.fileEmptyTextView.enclosingScrollView?.contentView, data.bounds.equalTo(.zero) == false {
+            self.fileEmptyTextView.frame = data.bounds
+        }
         self.fileEmptyTextView.font = NSFont.SFProTextRegularFont(14)
         self.fileEmptyTextView.delegate = self
         self.fileEmptyTextView.firstResponderHandle = {[unowned self] view, isFirstResponder in

+ 192 - 0
PDF Office/PDF Master/Class/Analytics/KMAnalytics+KMExtensions.swift

@@ -0,0 +1,192 @@
+//
+//  KMAnalytics+KMExtensions.swift
+//  PDF Reader Pro
+//
+//  Created by User-Tangchao on 2024/9/6.
+//
+
+import Foundation
+
+// 数据埋点 Category 参数
+extension KMAnalytics.Parameter.Category {
+    public static let purchase_Tools        = "Purchase_Tools"
+    public static let purchase_PageEdit     = "Purchase_PageEdit"
+    public static let purchase_Editor       = "Purchase_Editor"
+    public static let purchase_Converter    = "Purchase_Converter"
+    
+    public static let purchase_Form         = "Purchase_Form"
+    public static let purchase_Sign         = "Purchase_Sign"
+    public static let purchase_EditPDF      = "Purchase_EditPDF"
+    public static let purchase_Redact       = "Purchase_Redact"
+    
+    public static let purchase_OCR          = "Purchase_OCR"
+    public static let purchase_PageDisplay  = "Purchase_PageDisplay"
+    public static let purchase_Others       = "Purchase_Others"
+}
+
+@objc extension NSViewController {
+    private static var _eventNameKey = "KMEventNameKey"
+    var kEventName: String? {
+        get {
+            return objc_getAssociatedObject(self, &Self._eventNameKey) as? String
+        }
+        set {
+            objc_setAssociatedObject(self, &Self._eventNameKey, newValue, .OBJC_ASSOCIATION_COPY_NONATOMIC)
+        }
+    }
+    
+    private static var _eventParamsKey = "KMEventParamsKey"
+    var kEventParams: [String : Any]? {
+        get {
+            return objc_getAssociatedObject(self, &Self._eventParamsKey) as? [String : Any]
+        }
+        set {
+            objc_setAssociatedObject(self, &Self._eventParamsKey, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)
+        }
+    }
+    
+    private static var _eventTagKey = "KMEventTagKey"
+    var kEventTag: Int {
+        get {
+            return objc_getAssociatedObject(self, &Self._eventTagKey) as? Int ?? 0
+        }
+        set {
+            objc_setAssociatedObject(self, &Self._eventTagKey, newValue, .OBJC_ASSOCIATION_ASSIGN)
+        }
+    }
+    
+    @objc func trackEvent_buyNow_tool(type: CAnnotationType, index: Int) {
+        KMAnalytics._trackEvent_buyNow_tool(type: type, index: index, appTarget: .all)
+    }
+    
+    // MARK: - Track Events Basic
+    
+    @objc func trackEvent(eventName eveN: String, params: [String : Any]?, platform: KMAnalyticsPlatform) {
+        KMAnalytics.trackEvent(eventName: eveN, parameters: params, platform: platform, appTarget: .all)
+    }
+    
+    @objc func trackEvent_dmg(eventName eveN: String, params: [String : Any]?, platform: KMAnalyticsPlatform) {
+        KMAnalytics.trackEvent(eventName: eveN, parameters: params, platform: platform, appTarget: .dmg)
+    }
+    
+    @objc func trackEvent_free(eventName eveN: String, params: [String : Any]?, platform: KMAnalyticsPlatform) {
+        KMAnalytics.trackEvent(eventName: eveN, parameters: params, platform: platform, appTarget: .free)
+    }
+    
+    @objc func trackEvent_pro(eventName eveN: String, params: [String : Any]?, platform: KMAnalyticsPlatform) {
+        KMAnalytics.trackEvent(eventName: eveN, parameters: params, platform: platform, appTarget: .pro)
+    }
+    
+    @objc func trackEvent_appstore(eventName eveN: String, params: [String : Any]?, platform: KMAnalyticsPlatform) {
+        KMAnalytics.trackEvent(eventName: eveN, parameters: params, platform: platform, appTarget: [.free, .pro])
+    }
+    
+    func clearEventData() {
+        self.kEventName = nil
+        self.kEventTag = 0
+        self.kEventParams = nil
+    }
+}
+
+@objc extension NSWindowController {
+    private static var _eventNameKey = "KMEventNameKey"
+    var kEventName: String? {
+        get {
+            return objc_getAssociatedObject(self, &Self._eventNameKey) as? String
+        }
+        set {
+            objc_setAssociatedObject(self, &Self._eventNameKey, newValue, .OBJC_ASSOCIATION_COPY_NONATOMIC)
+        }
+    }
+    
+    private static var _eventParamsKey = "KMEventParamsKey"
+    var kEventParams: [String : Any]? {
+        get {
+            return objc_getAssociatedObject(self, &Self._eventParamsKey) as? [String : Any]
+        }
+        set {
+            objc_setAssociatedObject(self, &Self._eventParamsKey, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)
+        }
+    }
+    
+    private static var _eventTagKey = "KMEventTagKey"
+    var kEventTag: Int {
+        get {
+            return objc_getAssociatedObject(self, &Self._eventTagKey) as? Int ?? 0
+        }
+        set {
+            objc_setAssociatedObject(self, &Self._eventTagKey, newValue, .OBJC_ASSOCIATION_ASSIGN)
+        }
+    }
+    
+    // MARK: - Track Events Basic
+    
+    @objc func trackEvent(eventName eveN: String?, params: [String : Any]?, platform: KMAnalyticsPlatform) {
+        if let data = eveN {
+            KMAnalytics.trackEvent(eventName: data, parameters: params, platform: platform, appTarget: .all)
+        }
+    }
+    
+    @objc func trackEvent_dmg(eventName eveN: String?, params: [String : Any]?, platform: KMAnalyticsPlatform) {
+        if let data = eveN {
+            KMAnalytics.trackEvent(eventName: data, parameters: params, platform: platform, appTarget: .dmg)
+        }
+    }
+    
+    @objc func trackEvent_free(eventName eveN: String?, params: [String : Any]?, platform: KMAnalyticsPlatform) {
+        if let data = eveN {
+            KMAnalytics.trackEvent(eventName: data, parameters: params, platform: platform, appTarget: .free)
+        }
+    }
+    
+    @objc func trackEvent_pro(eventName eveN: String?, params: [String : Any]?, platform: KMAnalyticsPlatform) {
+        if let data = eveN {
+            KMAnalytics.trackEvent(eventName: data, parameters: params, platform: platform, appTarget: .pro)
+        }
+    }
+    
+    @objc func trackEvent_appstore(eventName eveN: String?, params: [String : Any]?, platform: KMAnalyticsPlatform) {
+        if let data = eveN {
+            KMAnalytics.trackEvent(eventName: data, parameters: params, platform: platform, appTarget: [.free, .pro])
+        }
+    }
+    
+    func clearEventData() {
+        self.kEventName = nil
+        self.kEventTag = 0
+        self.kEventParams = nil
+    }
+}
+
+// MARK: - KMAnalytics Private Methods
+
+extension KMAnalytics {
+    fileprivate static func _trackEvent_buyNow_tool(type: CAnnotationType, index: Int, platform: KMAnalyticsPlatform = .firebase, appTarget: AppTarget = [.free]) {
+        if let eventName = KMBuyNowEventNameFromCAnnotationType(type, index: index) {
+            let params: [String : Any]? = [KMAnalytics.Parameter.categoryKey : "Purchase_Tools", KMAnalytics.Parameter.labelKey : "SubTbr_Tools"]
+            KMAnalytics.trackEvent(eventName: eventName, parameters: params, platform: platform, appTarget: appTarget)
+        }
+    }
+}
+
+// MARK: - Pulick Methods
+
+public func KMBuyNowEventNameFromCAnnotationType(_ type: CAnnotationType, index: Int) -> String? {
+    if type == .link {
+        if index == 2 {
+            return "Reading_WebsiteLink_BuyNow"
+        } else if index == 3 {
+            return "Reading_EmailLink_BuyNow"
+        }
+    } else if type == .stamp {
+        if index == 2 {
+            return "Reading_DynamicStamp_BuyNow"
+        } else if index == 3 {
+            return "Reading_CustomStamp_BuyNow"
+        }
+    } else if type == .signature {
+        return "Reading_Signature_BuyNow"
+    }
+    return nil
+}
+

+ 10 - 0
PDF Office/PDF Master/Class/Analytics/KMAnalytics.swift

@@ -77,6 +77,16 @@ extension KMAnalytics.Parameter {
     // 配置
     static func configure() {
 #if DEBUG
+#if VERSION_FREE
+#if VERSION_DMG
+    let appSecret = "fb9d37aa-e3f2-4969-bd06-f65ce529a565"
+#else
+    let appSecret = "8c08296d-ca5c-44da-b68a-b4382f119b1f"
+#endif
+#else
+    let appSecret = "54212f10-3ac9-42d9-96c0-5387f4b78d30"
+#endif
+        AppCenter.start(withAppSecret: appSecret, services: [Analytics.self, Crashes.self])
 #else
 // #if VERSION_DMG
 //        AppCenter.start(withAppSecret: "416b8e45-69bd-4a16-8fec-b5206e913c4a", services: [Analytics.self, Crashes.self])

+ 38 - 0
PDF Office/PDF Master/Class/Appearance/Color.xcassets/Purchase/KMPurchaseBoxColor.colorset/Contents.json

@@ -0,0 +1,38 @@
+{
+  "colors" : [
+    {
+      "color" : {
+        "color-space" : "srgb",
+        "components" : {
+          "alpha" : "1.000",
+          "blue" : "0x62",
+          "green" : "0x3C",
+          "red" : "0x27"
+        }
+      },
+      "idiom" : "universal"
+    },
+    {
+      "appearances" : [
+        {
+          "appearance" : "luminosity",
+          "value" : "dark"
+        }
+      ],
+      "color" : {
+        "color-space" : "srgb",
+        "components" : {
+          "alpha" : "1.000",
+          "blue" : "0xDB",
+          "green" : "0x7F",
+          "red" : "0x4E"
+        }
+      },
+      "idiom" : "universal"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

+ 38 - 0
PDF Office/PDF Master/Class/Appearance/Color.xcassets/Purchase/KMPurchaseBoxColor1.colorset/Contents.json

@@ -0,0 +1,38 @@
+{
+  "colors" : [
+    {
+      "color" : {
+        "color-space" : "srgb",
+        "components" : {
+          "alpha" : "0.500",
+          "blue" : "0x62",
+          "green" : "0x3C",
+          "red" : "0x27"
+        }
+      },
+      "idiom" : "universal"
+    },
+    {
+      "appearances" : [
+        {
+          "appearance" : "luminosity",
+          "value" : "dark"
+        }
+      ],
+      "color" : {
+        "color-space" : "srgb",
+        "components" : {
+          "alpha" : "0.500",
+          "blue" : "0xDB",
+          "green" : "0x7F",
+          "red" : "0x4E"
+        }
+      },
+      "idiom" : "universal"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

+ 38 - 0
PDF Office/PDF Master/Class/Appearance/Color.xcassets/Purchase/KMPurchaseErrorColor.colorset/Contents.json

@@ -0,0 +1,38 @@
+{
+  "colors" : [
+    {
+      "color" : {
+        "color-space" : "srgb",
+        "components" : {
+          "alpha" : "1.000",
+          "blue" : "0x5D",
+          "green" : "0x1E",
+          "red" : "0xFA"
+        }
+      },
+      "idiom" : "universal"
+    },
+    {
+      "appearances" : [
+        {
+          "appearance" : "luminosity",
+          "value" : "dark"
+        }
+      ],
+      "color" : {
+        "color-space" : "srgb",
+        "components" : {
+          "alpha" : "1.000",
+          "blue" : "0x61",
+          "green" : "0x38",
+          "red" : "0xE7"
+        }
+      },
+      "idiom" : "universal"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

+ 38 - 0
PDF Office/PDF Master/Class/Appearance/Color.xcassets/Purchase/KMPurchase_000000.colorset/Contents.json

@@ -0,0 +1,38 @@
+{
+  "colors" : [
+    {
+      "color" : {
+        "color-space" : "srgb",
+        "components" : {
+          "alpha" : "1.000",
+          "blue" : "0x00",
+          "green" : "0x00",
+          "red" : "0x00"
+        }
+      },
+      "idiom" : "universal"
+    },
+    {
+      "appearances" : [
+        {
+          "appearance" : "luminosity",
+          "value" : "dark"
+        }
+      ],
+      "color" : {
+        "color-space" : "srgb",
+        "components" : {
+          "alpha" : "1.000",
+          "blue" : "0xFF",
+          "green" : "0xFF",
+          "red" : "0xFF"
+        }
+      },
+      "idiom" : "universal"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

+ 38 - 0
PDF Office/PDF Master/Class/Appearance/Color.xcassets/Purchase/KMPurchase_002143.colorset/Contents.json

@@ -0,0 +1,38 @@
+{
+  "colors" : [
+    {
+      "color" : {
+        "color-space" : "srgb",
+        "components" : {
+          "alpha" : "1.000",
+          "blue" : "0x43",
+          "green" : "0x21",
+          "red" : "0x00"
+        }
+      },
+      "idiom" : "universal"
+    },
+    {
+      "appearances" : [
+        {
+          "appearance" : "luminosity",
+          "value" : "dark"
+        }
+      ],
+      "color" : {
+        "color-space" : "srgb",
+        "components" : {
+          "alpha" : "1.000",
+          "blue" : "0xFF",
+          "green" : "0xFF",
+          "red" : "0xFF"
+        }
+      },
+      "idiom" : "universal"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

+ 38 - 0
PDF Office/PDF Master/Class/Appearance/Color.xcassets/Purchase/KMPurchase_99A6B2.colorset/Contents.json

@@ -0,0 +1,38 @@
+{
+  "colors" : [
+    {
+      "color" : {
+        "color-space" : "srgb",
+        "components" : {
+          "alpha" : "1.000",
+          "blue" : "0xB2",
+          "green" : "0xA6",
+          "red" : "0x99"
+        }
+      },
+      "idiom" : "universal"
+    },
+    {
+      "appearances" : [
+        {
+          "appearance" : "luminosity",
+          "value" : "dark"
+        }
+      ],
+      "color" : {
+        "color-space" : "srgb",
+        "components" : {
+          "alpha" : "1.000",
+          "blue" : "0x85",
+          "green" : "0x7F",
+          "red" : "0x7E"
+        }
+      },
+      "idiom" : "universal"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

+ 38 - 0
PDF Office/PDF Master/Class/Appearance/Color.xcassets/Purchase/KMPurchase_DADBDE.colorset/Contents.json

@@ -0,0 +1,38 @@
+{
+  "colors" : [
+    {
+      "color" : {
+        "color-space" : "srgb",
+        "components" : {
+          "alpha" : "1.000",
+          "blue" : "0xDE",
+          "green" : "0xDB",
+          "red" : "0xDA"
+        }
+      },
+      "idiom" : "universal"
+    },
+    {
+      "appearances" : [
+        {
+          "appearance" : "luminosity",
+          "value" : "dark"
+        }
+      ],
+      "color" : {
+        "color-space" : "srgb",
+        "components" : {
+          "alpha" : "1.000",
+          "blue" : "0x5A",
+          "green" : "0x58",
+          "red" : "0x56"
+        }
+      },
+      "idiom" : "universal"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

+ 38 - 0
PDF Office/PDF Master/Class/Appearance/Color.xcassets/Purchase/KMPurchase_FFFFFF.colorset/Contents.json

@@ -0,0 +1,38 @@
+{
+  "colors" : [
+    {
+      "color" : {
+        "color-space" : "srgb",
+        "components" : {
+          "alpha" : "1.000",
+          "blue" : "0xFF",
+          "green" : "0xFF",
+          "red" : "0xFF"
+        }
+      },
+      "idiom" : "universal"
+    },
+    {
+      "appearances" : [
+        {
+          "appearance" : "luminosity",
+          "value" : "dark"
+        }
+      ],
+      "color" : {
+        "color-space" : "srgb",
+        "components" : {
+          "alpha" : "1.000",
+          "blue" : "0x3E",
+          "green" : "0x3C",
+          "red" : "0x39"
+        }
+      },
+      "idiom" : "universal"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

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

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

+ 164 - 0
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Purchase/EmbeddedPayment26.imageset/label-text (1).pdf

@@ -0,0 +1,164 @@
+%PDF-1.7
+
+1 0 obj
+  << /Length 2 0 R >>
+stream
+0.471680 0 0.071289 0.353516 0.400391 0.413574 d1
+
+endstream
+endobj
+
+2 0 obj
+  50
+endobj
+
+3 0 obj
+  [ 0.471680 ]
+endobj
+
+4 0 obj
+  << /Length 5 0 R >>
+stream
+/CIDInit /ProcSet findresource begin
+12 dict begin
+begincmap
+/CIDSystemInfo
+<< /Registry (FigmaPDF)
+   /Ordering (FigmaPDF)
+   /Supplement 0
+>> def
+/CMapName /A-B-C def
+/CMapType 2 def
+1 begincodespacerange
+<00> <FF>
+endcodespacerange
+1 beginbfchar
+<00> <002A>
+endbfchar
+endcmap
+CMapName currentdict /CMap defineresource pop
+end
+end
+endstream
+endobj
+
+5 0 obj
+  332
+endobj
+
+6 0 obj
+  << /Subtype /Type3
+     /CharProcs << /C0 1 0 R >>
+     /Encoding << /Type /Encoding
+                  /Differences [ 0 /C0 ]
+               >>
+     /Widths 3 0 R
+     /FontBBox [ 0.000000 0.000000 0.000000 0.000000 ]
+     /FontMatrix [ 1.000000 0.000000 0.000000 1.000000 0.000000 0.000000 ]
+     /Type /Font
+     /ToUnicode 4 0 R
+     /FirstChar 0
+     /LastChar 0
+     /Resources << >>
+  >>
+endobj
+
+7 0 obj
+  << /Font << /F1 6 0 R >> >>
+endobj
+
+8 0 obj
+  << /Length 9 0 R >>
+stream
+/DeviceRGB CS
+/DeviceRGB cs
+q
+1.000000 0.000000 -0.000000 1.000000 -0.855469 2.650391 cm
+1.000000 0.286490 0.309884 scn
+0.000000 -6.892578 m
+h
+2.431641 -2.650391 m
+2.496094 -1.150391 l
+1.253906 -1.935547 l
+0.855469 -1.314453 l
+2.214844 -0.593750 l
+0.855469 0.121094 l
+1.253906 0.742188 l
+2.496094 -0.042969 l
+2.431641 1.457031 l
+3.234375 1.457031 l
+3.169922 -0.037109 l
+4.406250 0.742188 l
+4.804688 0.121094 l
+3.445312 -0.593750 l
+4.804688 -1.314453 l
+4.406250 -1.935547 l
+3.169922 -1.156250 l
+3.234375 -2.650391 l
+2.431641 -2.650391 l
+h
+f
+n
+Q
+q
+1.000000 0.000000 -0.000000 1.000000 -0.855469 2.650391 cm
+BT
+12.000000 0.000000 0.000000 12.000000 0.000000 -6.892578 Tm
+/F1 1.000000 Tf
+[ (\000) ] TJ
+ET
+Q
+
+endstream
+endobj
+
+9 0 obj
+  703
+endobj
+
+10 0 obj
+  << /Annots []
+     /Type /Page
+     /MediaBox [ 0.000000 0.000000 3.949219 4.107422 ]
+     /Resources 7 0 R
+     /Contents 8 0 R
+     /Parent 11 0 R
+  >>
+endobj
+
+11 0 obj
+  << /Kids [ 10 0 R ]
+     /Count 1
+     /Type /Pages
+  >>
+endobj
+
+12 0 obj
+  << /Pages 11 0 R
+     /Type /Catalog
+  >>
+endobj
+
+xref
+0 13
+0000000000 65535 f
+0000000010 00000 n
+0000000116 00000 n
+0000000137 00000 n
+0000000168 00000 n
+0000000556 00000 n
+0000000578 00000 n
+0000000990 00000 n
+0000001036 00000 n
+0000001795 00000 n
+0000001817 00000 n
+0000001990 00000 n
+0000002066 00000 n
+trailer
+<< /ID [ (some) (id) ]
+   /Root 12 0 R
+   /Size 13
+>>
+startxref
+2127
+%%EOF

+ 164 - 0
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Purchase/EmbeddedPayment26.imageset/label-text 1.pdf

@@ -0,0 +1,164 @@
+%PDF-1.7
+
+1 0 obj
+  << /Length 2 0 R >>
+stream
+0.471680 0 0.071289 0.353516 0.400391 0.413574 d1
+
+endstream
+endobj
+
+2 0 obj
+  50
+endobj
+
+3 0 obj
+  [ 0.471680 ]
+endobj
+
+4 0 obj
+  << /Length 5 0 R >>
+stream
+/CIDInit /ProcSet findresource begin
+12 dict begin
+begincmap
+/CIDSystemInfo
+<< /Registry (FigmaPDF)
+   /Ordering (FigmaPDF)
+   /Supplement 0
+>> def
+/CMapName /A-B-C def
+/CMapType 2 def
+1 begincodespacerange
+<00> <FF>
+endcodespacerange
+1 beginbfchar
+<00> <002A>
+endbfchar
+endcmap
+CMapName currentdict /CMap defineresource pop
+end
+end
+endstream
+endobj
+
+5 0 obj
+  332
+endobj
+
+6 0 obj
+  << /Subtype /Type3
+     /CharProcs << /C0 1 0 R >>
+     /Encoding << /Type /Encoding
+                  /Differences [ 0 /C0 ]
+               >>
+     /Widths 3 0 R
+     /FontBBox [ 0.000000 0.000000 0.000000 0.000000 ]
+     /FontMatrix [ 1.000000 0.000000 0.000000 1.000000 0.000000 0.000000 ]
+     /Type /Font
+     /ToUnicode 4 0 R
+     /FirstChar 0
+     /LastChar 0
+     /Resources << >>
+  >>
+endobj
+
+7 0 obj
+  << /Font << /F1 6 0 R >> >>
+endobj
+
+8 0 obj
+  << /Length 9 0 R >>
+stream
+/DeviceRGB CS
+/DeviceRGB cs
+q
+1.000000 0.000000 -0.000000 1.000000 -0.855469 2.650391 cm
+1.000000 0.286490 0.309884 scn
+0.000000 -6.892578 m
+h
+2.431641 -2.650391 m
+2.496094 -1.150391 l
+1.253906 -1.935547 l
+0.855469 -1.314453 l
+2.214844 -0.593750 l
+0.855469 0.121094 l
+1.253906 0.742188 l
+2.496094 -0.042969 l
+2.431641 1.457031 l
+3.234375 1.457031 l
+3.169922 -0.037109 l
+4.406250 0.742188 l
+4.804688 0.121094 l
+3.445312 -0.593750 l
+4.804688 -1.314453 l
+4.406250 -1.935547 l
+3.169922 -1.156250 l
+3.234375 -2.650391 l
+2.431641 -2.650391 l
+h
+f
+n
+Q
+q
+1.000000 0.000000 -0.000000 1.000000 -0.855469 2.650391 cm
+BT
+12.000000 0.000000 0.000000 12.000000 0.000000 -6.892578 Tm
+/F1 1.000000 Tf
+[ (\000) ] TJ
+ET
+Q
+
+endstream
+endobj
+
+9 0 obj
+  703
+endobj
+
+10 0 obj
+  << /Annots []
+     /Type /Page
+     /MediaBox [ 0.000000 0.000000 3.949219 4.107422 ]
+     /Resources 7 0 R
+     /Contents 8 0 R
+     /Parent 11 0 R
+  >>
+endobj
+
+11 0 obj
+  << /Kids [ 10 0 R ]
+     /Count 1
+     /Type /Pages
+  >>
+endobj
+
+12 0 obj
+  << /Pages 11 0 R
+     /Type /Catalog
+  >>
+endobj
+
+xref
+0 13
+0000000000 65535 f
+0000000010 00000 n
+0000000116 00000 n
+0000000137 00000 n
+0000000168 00000 n
+0000000556 00000 n
+0000000578 00000 n
+0000000990 00000 n
+0000001036 00000 n
+0000001795 00000 n
+0000001817 00000 n
+0000001990 00000 n
+0000002066 00000 n
+trailer
+<< /ID [ (some) (id) ]
+   /Root 12 0 R
+   /Size 13
+>>
+startxref
+2127
+%%EOF

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

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

BIN
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Purchase/EmbeddedPayment27.imageset/Frame 1000007062 (1).pdf


BIN
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Purchase/EmbeddedPayment27.imageset/Frame 1000007062.pdf


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

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

BIN
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Purchase/EmbeddedPayment28.imageset/Frame 1000007063 (1).pdf


BIN
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Purchase/EmbeddedPayment28.imageset/Frame 1000007063.pdf


+ 6 - 2
PDF Office/PDF Master/Class/Batch/WindowController/KMBatchOperateLeftViewController.swift

@@ -166,7 +166,11 @@ class KMBatchOperateLeftViewController: NSViewController,NSTableViewDelegate,NST
 #if VERSION_FREE
         if !IAPProductsManager.default().isAvailableAllFunction() {
             if files.count >= 1 {
-                KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+                let winC = KMPurchaseCompareWindowController.sharedInstance()
+                if type == .CreatePDF {
+                    winC?.kEventName = "Onbrd_ImagetoPDF_BuyNow"
+                }
+                winC?.showWindow(nil)
                 return
             }
         }
@@ -477,7 +481,7 @@ class KMBatchOperateLeftViewController: NSViewController,NSTableViewDelegate,NST
         addFilesToList(addArray: pdfArray)
     }
     func numberOfRows(in tableView: NSTableView) -> Int {
-        NotificationCenter.default.post(name: NSNotification.Name(rawValue: "KMBatchFilesCountNotification"), object: self.files)
+        NotificationCenter.default.post(name: NSNotification.Name(rawValue: "KMBatchFilesCountNotification"), object: self.files, userInfo: [kObjectKey : self])
         self.deleteFileButton.isEnabled = self.files.count > 0
         self.blankView.isHidden = self.files.count > 0
         return self.files.count;

+ 14 - 1
PDF Office/PDF Master/Class/Batch/WindowController/VC/KMBatchOperateConvertViewController.swift

@@ -621,7 +621,20 @@ class KMBatchOperateConvertViewController: KMBatchOperateBaseViewController,NSCo
                 limitWC.window?.center()
                 limitWC.showWindow(nil)
             }else{
-                KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+                let winC = KMPurchaseCompareWindowController.sharedInstance()
+                if let viewC = self.view.window?.contentViewController, viewC.kEventTag == 1 {
+                    winC?.kEventName = "Onbrd_ConvertPDF_BuyNow"
+                } else {
+                    if convertType == .WordStandard || convertType == .WordAdvance {
+                        winC?.kEventName = "Onbrd_PDFtoWord_BuyNow"
+                    } else if convertType == .Excel {
+                        winC?.kEventName = "Onbrd_PDFtoExcel_BuyNow"
+                    } else if convertType == .PowerPoint {
+                        winC?.kEventName = "Onbrd_PDFtoPPT_BuyNow"
+                    }
+                }
+                
+                winC?.showWindow(nil)
             }
 #else
             if IAPProductsManager.default().isAvailableAllFunction() {

+ 9 - 0
PDF Office/PDF Master/Class/ChromiumTabs/KMBrowserWindow.swift

@@ -26,4 +26,13 @@ class KMBrowserWindow: CTBrowserWindow {
         
         super.resignKey()
     }
+    
+    override func miniaturize(_ sender: Any?) {
+        super.miniaturize(sender)
+        
+        if let browser = (self.windowController as? KMBrowserWindowController)?.browser {
+            let document = browser.activeTabContents() as? KMMainDocument
+            document?.mainViewController?.hideMeasureFloatingWindows()
+        }
+    }
 }

+ 5 - 0
PDF Office/PDF Master/Class/ChromiumTabs/KMBrowserWindowController.swift

@@ -524,6 +524,11 @@ import Cocoa
         
         if let _userInfo = notification.userInfo, let _newContents = _userInfo[CTTabNewContentsUserInfoKey] as? KMMainDocument {
             _newContents.addWindowController(self)
+            
+            _newContents.mainViewController?.showMeasureFloatingWindowsIfNeed()
+        }
+        if let _userInfo = notification.userInfo, let _oldContents = _userInfo[CTTabContentsUserInfoKey] as? KMMainDocument {
+            _oldContents.mainViewController?.hideMeasureFloatingWindows()
         }
     }
     

+ 31 - 0
PDF Office/PDF Master/Class/Common/Category/CPDFKit/CPDFAnnotation+KMExtension.swift

@@ -7,6 +7,35 @@
 
 import Foundation
 
+extension CPDFAnnotation.kType {
+    public static let highlight                         = "Highlight"
+    public static let underline                         = "Underline"
+    public static let strikeout                         = "Strikeout"
+    public static let squiggly                          = "Squiggly"
+    
+    public static let freehand                          = "Freehand"
+    
+    public static let freetext                          = "FreeText"
+    public static let note                              = "Note"
+    
+    public static let square                            = "Square"
+    public static let circle                            = "Circle"
+    public static let arrow                             = "Arrow"
+    public static let line                              = "Line"
+    
+    public static let stamp                             = "Stamp"
+    public static let image                             = "Image"
+    
+    public static let redact                            = "Redact"
+    public static let sign                              = "Sign"
+    
+    public static let polyline                          = "Polyline"
+    public static let polygon                           = "Polygon"
+    
+    // 自定义的
+    public static let measureArrow                      = "MeasureArrow"
+}
+
 @objc extension CPDFAnnotation {
     static let kSquareType                              = "Square"
     static let kCircleType                              = "Circle"
@@ -16,4 +45,6 @@ import Foundation
 //    static let kClosedArrowType                         = "ClosedArrow"
     
     static let KSquigglyType                            = "Squiggly"
+    
+    public struct kType {}
 }

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

@@ -61,6 +61,7 @@ let kFTPPrefix = "ftp://"
 let kEmailPrefix = "mailto:"
 
 let kWindowFrameKey                     = "windowFrame"
+let kObjectKey                          = "kObject"
 
 // NSColorPanel
 let kColorPanel = NSColorPanel.shared
@@ -81,6 +82,14 @@ public func KMValidateEmail(email: String) -> Bool {
     return pred.evaluate(with: email)
 }
 
+public func KMMainThreadExecute(_ execute: @escaping (()->Void)) {
+    if Thread.isMainThread {
+        execute()
+    } else {
+        DispatchQueue.main.async(execute: execute)
+    }
+}
+
 // ColumnID
 
 let kPageColumnId = NSUserInterfaceItemIdentifier(rawValue: "page")

+ 1 - 1
PDF Office/PDF Master/Class/GuideInfo/Controllers/FunctionGuide/KMOpenFileFunctionView.swift

@@ -82,7 +82,7 @@ class KMOpenFileFunctionView: NSView, NibLoadable {
             }
         }
         
-        self.ntipLabel.stringValue = NSLocalizedString("New", comment: "")
+        self.ntipLabel.stringValue = NSLocalizedString("New Feature", comment: "")
         
         self.shadowView.wantsLayer = true
         self.shadowView.layer?.borderWidth = 0

+ 1 - 1
PDF Office/PDF Master/Class/GuideInfo/Controllers/KMFunctionGuideMultiController.swift

@@ -75,7 +75,7 @@ class KMFunctionGuideMultiController: NSViewController {
         self.getStartBox.layer?.masksToBounds = true
         
         self.titleLabel.stringValue = NSLocalizedString("What‘s New", comment: "")
-        self.getStartLabel.stringValue = NSLocalizedString("Buy Now", comment: "")
+        self.getStartLabel.stringValue = NSLocalizedString("Experience Now", comment: "")
         self.learnButton.title = NSLocalizedString("Feedback", comment: "")
         self.learnButton.toolTip = NSLocalizedString("Feedback", comment: "")
         

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

@@ -100,9 +100,16 @@ class KMCouponDueWindowController: NSWindowController {
             return
         }
         
-        let newURL = NSURL(string: string+"&coupon_code="+self.couponCode)
 
+#if VERSION_DMG
+        let embeddedWC = KMPurchaseEmbeddedWindowController.currentFirstTrialWC("com.brother.pdfreaderpro.mac.product_3")
+        embeddedWC.couponCode = self.couponCode
+        embeddedWC.showWindow(nil)
+        embeddedWC.window?.center()
+#else
+        let newURL = NSURL(string: string+"&coupon_code="+self.couponCode)
         NSWorkspace.shared.open(newURL! as URL)
+#endif
         
         FMTrackEventManager.defaultManager.trackEvent(event: "PUW", withProperties: ["PUW_Btn" : "Btn_PUW_TrialExpireOffer_Buy"])
     }

+ 18 - 4
PDF Office/PDF Master/Class/GuideInfo/KMFunctionGuideWindowController.swift

@@ -94,11 +94,25 @@ class KMFunctionGuideWindowController: NSWindowController {
                 self.multiController.clickHandle = {[weak self] controller in
 #if VERSION_DMG
                     if controller.currentNameKEY == controller.AIInfoKey {
-                        var url = URL(string: AIProduct_Link)!
-                        NSWorkspace.shared.open(url)
+//                        var url = URL(string: AIProduct_Link)!
+//                        NSWorkspace.shared.open(url)
+                        if AIInfoManager.default().aiInfoValid {
+                            self?.closeAction()
+                        } else {
+                            let singleTon = KMPurchaseCompareDMGWindowController.init()
+                            singleTon.showWindow(nil)
+                            singleTon.window?.center()
+                        }
                     } else if controller.currentNameKEY == controller.MeasureInfoKey {
-                        var url = URL(string: Store_Link)!
-                        NSWorkspace.shared.open(url)
+//                        var url = URL(string: Store_Link)!
+//                        NSWorkspace.shared.open(url)
+                        if VerificationManager.default().status == ActivityStatusVerification {
+                            self?.closeAction()
+                        } else {
+                            let singleTon = KMPurchaseCompareDMGWindowController.init()
+                            singleTon.showWindow(nil)
+                            singleTon.window?.center()
+                        }
                     } else {
                         KMPrint("请配置Key...")
                     }

+ 1 - 1
PDF Office/PDF Master/Class/Home/View/HomeContentView/QucikTools/View/KMQucikToolCollectionViewItem.swift

@@ -135,7 +135,7 @@ class KMQucikToolCollectionViewItem: NSCollectionViewItem {
         self.tagView.layer?.masksToBounds = true
         self.tagView.layer?.cornerRadius = 8
         
-        self.tagLabel.stringValue = NSLocalizedString("New", comment: "")
+        self.tagLabel.stringValue = NSLocalizedString("New Feature", comment: "")
     }
     
     func reloadData() {

+ 32 - 9
PDF Office/PDF Master/Class/Home/ViewController/KMHomeViewController+Action.swift

@@ -115,6 +115,7 @@ extension KMHomeViewController {
             break
         case .ConvertPDF:
             FMTrackEventManager.defaultManager.trackEvent(event: "Onbrd", withProperties: ["HP_Tools": "Convert PDF"])
+            self.kEventTag = 1
             fastTool_ConvertPDF()
             break
         case .ImageToPDF:
@@ -990,7 +991,9 @@ extension KMHomeViewController {
     func fastTool_OCR() {   // OCR
 //        KMOCRWindowController.openFiles(window: self.view.window!)
         if !IAPProductsManager.default().isAvailableAllFunction(){
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            let winC = KMPurchaseCompareWindowController.sharedInstance()
+            winC?.kEventName = "Onbrd_OCR_BuyNow"
+            winC?.showWindow(nil)
             return
         }
         let openPanel = NSOpenPanel()
@@ -1082,6 +1085,9 @@ extension KMHomeViewController {
             }
             if arr.count > 0 {
                 baseWindowController.checkNeedPasswordSwitchToOperateType(operateType: .Convert, files: arr)
+                
+                baseWindowController.window?.contentViewController?.kEventTag = self.kEventTag
+                self.kEventTag = 0
             }
             baseWindowController.switchToConvertType(convertType: type)
         }
@@ -1192,6 +1198,7 @@ extension KMHomeViewController {
                 self.view.window?.endSheet((self.mergeWindowController!.window)!)
             }
                 
+            self.mergeWindowController?.kEventTag = 1
             self.view.window?.beginSheet(self.mergeWindowController!.window!)
         }
     }
@@ -1308,7 +1315,9 @@ extension KMHomeViewController {
     
     func fastTool_FileCompare() {    // 文件对比
         if !IAPProductsManager.default().isAvailableAllFunction(){
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            let winC = KMPurchaseCompareWindowController.sharedInstance()
+            winC?.kEventName = "Onbrd_Compare_BuyNow"
+            winC?.showWindow(nil)
             return
         }
         let openPanel = NSOpenPanel()
@@ -1412,7 +1421,9 @@ extension KMHomeViewController {
     func fastTool_Watermark() { // 水印
 //        KMBatchWindowController.openFile(nil, .Watermark)
         if !IAPProductsManager.default().isAvailableAllFunction(){
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            let winC = KMPurchaseCompareWindowController.sharedInstance()
+            winC?.kEventName = "Onbrd_Watermard_BuyNow"
+            winC?.showWindow(nil)
             return
         }
         
@@ -1458,7 +1469,9 @@ extension KMHomeViewController {
     func fastTool_Background() {    // 背景
 //        KMBatchWindowController.openFile(nil, .Background)
         if !IAPProductsManager.default().isAvailableAllFunction(){
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            let winC = KMPurchaseCompareWindowController.sharedInstance()
+            winC?.kEventName = "Onbrd_Background_BuyNow"
+            winC?.showWindow(nil)
             return
         }
 
@@ -1504,7 +1517,9 @@ extension KMHomeViewController {
     func fastTool_HeaderAndFooter() {   // 页眉页脚
 //        KMBatchWindowController.openFile(nil, .HeaderAndFooter)
         if !IAPProductsManager.default().isAvailableAllFunction(){
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            let winC = KMPurchaseCompareWindowController.sharedInstance()
+            winC?.kEventName = "Onbrd_HeaderFooter_BuyNow"
+            winC?.showWindow(nil)
             return
         }
 
@@ -1551,7 +1566,9 @@ extension KMHomeViewController {
     func fastTool_BatesCode() { // 贝茨码
 //        KMBatchWindowController.openFile(nil, .BatesCode)
         if !IAPProductsManager.default().isAvailableAllFunction(){
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            let winC = KMPurchaseCompareWindowController.sharedInstance()
+            winC?.kEventName = "Onbrd_Bates_BuyNow"
+            winC?.showWindow(nil)
             return
         }
 
@@ -1805,7 +1822,9 @@ extension KMHomeViewController {
     
     func fastTool_printBooklet() {
         if !IAPProductsManager.default().isAvailableAllFunction(){
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            let winC = KMPurchaseCompareWindowController.sharedInstance()
+            winC?.kEventName = "Onbrd_PrintBooklet_BuyNow"
+            winC?.showWindow(nil)
             return
         }
 
@@ -1843,7 +1862,9 @@ extension KMHomeViewController {
     
     func fastTool_printPoster() {
         if !IAPProductsManager.default().isAvailableAllFunction(){
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            let winC = KMPurchaseCompareWindowController.sharedInstance()
+            winC?.kEventName = "Onbrd_PrintPoster_BuyNow"
+            winC?.showWindow(nil)
             return
         }
 
@@ -1881,7 +1902,9 @@ extension KMHomeViewController {
     
     func fastTool_printMultple() {
         if !IAPProductsManager.default().isAvailableAllFunction(){
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            let winC = KMPurchaseCompareWindowController.sharedInstance()
+            winC?.kEventName = "Onbrd_PrintMultiple_BuyNow"
+            winC?.showWindow(nil)
             return
         }
 

+ 7 - 1
PDF Office/PDF Master/Class/KMAdvertisement/View/Tableview/Cell/KMAdvertisementCollectionViewItem.swift

@@ -17,10 +17,16 @@ class KMAdvertisementCollectionViewItem: NSCollectionViewItem {
         }
     }
     
+    override func viewWillAppear() {
+        super.viewWillAppear()
+        
+        self.view.addTrackingRect(self.view.bounds, owner: self, userData: nil, assumeInside: false)
+    }
+    
     override func viewDidLoad() {
         super.viewDidLoad()
         // Do view setup here.
-        self.view.addTrackingRect(self.view.bounds, owner: self, userData: nil, assumeInside: false)
+//        self.view.addTrackingRect(self.view.bounds, owner: self, userData: nil, assumeInside: false)
         self.contentView.wantsLayer = true
         self.contentView.layer?.masksToBounds = true
         self.updateColor(false)

+ 3 - 1
PDF Office/PDF Master/Class/PDFTools/AddHeaderFooter/Model/KMBatchAddHeaderFooterOperation.swift

@@ -62,7 +62,9 @@ class KMBatchAddHeaderFooterOperation: KMBatchOperation{
                 self.didChangeValue(forKey: "isFinished")
                 return
             }
-            self.saveAsPDFToPath((self.operateFile?.currentOperateInfo?.fetchDestinationFilepath())!)
+            if let filepath = self.operateFile?.currentOperateInfo?.fetchDestinationFilepath() {
+                self.saveAsPDFToPath(filepath)
+            }
             
         }else {
             willChangeValue(forKey: "isFinished")

+ 9 - 0
PDF Office/PDF Master/Class/PDFTools/AddHeaderFooter/VC/KMBatchOperateAddHeaderFooterViewController.swift

@@ -216,6 +216,15 @@ class KMBatchOperateAddHeaderFooterViewController: KMBatchOperateBaseViewControl
     }
     @objc func batchFilesCountNotification(notification: Notification)  {
         let files: Array? = notification.object as? [KMBatchOperateFile]
+        if let data = files?.first {
+            if data.currentOperateType != self.operateType {
+                return
+            }
+        }
+        let viewC = notification.userInfo?[kObjectKey] as? NSViewController
+        if let data = self.view.window?.isEqual(to: viewC?.view.window), data == false {
+            return
+        }
         self.files? = files ?? []
         if files?.count ?? 0 > 0 {
             haveFiles = true

+ 1 - 0
PDF Office/PDF Master/Class/PDFTools/Background/New/View/KMAddBackgroundView.swift

@@ -478,6 +478,7 @@ class KMAddBackgroundView: KMBaseXibView, NSComboBoxDelegate {
         self.pdfView.document = document
         
         DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.1) {
+            self.pdfView.layoutDocumentView()
             self.isAllowReloadDocument = true
         }
     }

+ 41 - 1
PDF Office/PDF Master/Class/PDFTools/Convert/ExtractImage/Controller/KMExtractImageWindowController.swift

@@ -152,8 +152,13 @@ class KMExtractImageWindowController: NSWindowController,PDFConvertObjectDelegat
         let indeSet = self.selectIndexSet()
         if indeSet.count == 0 { return }
         let lastPathName = self.pdfDocument?.documentURL.deletingPathExtension().lastPathComponent ?? ""
-        let tFileName = (String(format: "%@_Extract Images", lastPathName))
+        var tFileName = (String(format: "%@_Extract Images", lastPathName))
         let outputSavePanel = NSSavePanel()
+        if let data = outputSavePanel.directoryURL?.appendingPathComponent(tFileName) {
+            let fileUrl = self.fetchUniquePath(data.path)
+            tFileName = fileUrl.lastPathComponent
+        }
+        
         outputSavePanel.title = NSLocalizedString("Save as PDF", comment: "")
         outputSavePanel.allowsOtherFileTypes = true
         outputSavePanel.isExtensionHidden = true
@@ -171,6 +176,41 @@ class KMExtractImageWindowController: NSWindowController,PDFConvertObjectDelegat
             }
         }
     }
+    
+    func fetchUniquePath(_ originalPath: String) -> String {
+        var path = originalPath
+        let dManager = FileManager.default
+        if !dManager.fileExists(atPath: path) {
+            if path.extension.count < 1 {
+                path = path.stringByAppendingPathExtension("pdf")
+            }
+            return path
+        } else {
+            let originalFullFileName = path.lastPathComponent
+            let url = URL(fileURLWithPath: path)
+//            let originalFileName = path.lastPathComponent.deletingPathExtension.lastPathComponent
+//            let originalFileName = url.deletingPathExtension().lastPathComponent
+            let originalFileName = originalFullFileName
+//            let originalExtension = path.extension
+            
+            let startIndex: Int = 0
+            let endIndex: Int = startIndex + originalPath.count - originalFullFileName.count - 1
+            let fileLocatePath = originalPath.substring(to: endIndex)
+            var i = 1
+            while (1 != 0) {
+                var newName = String(format: "%@(%ld)", originalFileName, i)
+//                newName = String(format: "%@%@", newName, originalExtension)
+                let newPath = fileLocatePath.stringByAppendingPathComponent(newName)
+                if !dManager.fileExists(atPath: newPath) {
+                    return newPath
+                } else {
+                    i+=1
+                    continue
+                }
+            }
+        }
+    }
+    
     func extractOK(_ folder: String) {
         self.hideWaitting()
         self.close()

+ 21 - 1
PDF Office/PDF Master/Class/PDFTools/Convert/NewController/KMConvertWindowController.swift

@@ -947,7 +947,27 @@ let kConvertFileSavePath = (kTempSavePath?.stringByAppendingPathComponent("conve
             limitWC.window?.center()
             limitWC.showWindow(nil)
         } else {
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            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"
+            }
+//            else if convertType == . {
+//                winC?.kEventName = "Reading_PDFtoExcel_BuyNow"
+//            }
+            winC?.showWindow(nil)
         }
 #else
         if IAPProductsManager.default().isAvailableAllFunction() {

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

@@ -237,16 +237,22 @@ 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!)
+//        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")
+        embeddedWC.showWindow(nil)
+        embeddedWC.window?.center()
 #endif
     }
     
     func officeVerificationBuy() {
 #if VERSION_DMG
-        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"])
+//        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")
+        embeddedWC.showWindow(nil)
+        embeddedWC.window?.center()
 #endif
     }
     

+ 36 - 3
PDF Office/PDF Master/Class/PDFTools/EditPDF/Tools/KMEditPDfHanddler.swift

@@ -126,6 +126,7 @@ class KMEditPDfHanddler: NSObject {
             self.listView?.updateActiveAnnotations([])
             self.listView?.setNeedsDisplayForVisiblePages()
             self.listView?.commitEditFormText()
+            self.listView?.commitEditing()
             self.listView?.layoutDocumentView()
             KMThumbnailCache.shared.clearCache()
             NotificationCenter.default.post(name: NSNotification.Name.init(rawValue: "CPDFDocumentPageCountChangedNotification"), object: self.listView?.document)
@@ -187,7 +188,9 @@ class KMEditPDfHanddler: NSObject {
         let isEdited = self.listView?.isEdited() ?? false
         let isPDFTextImageEdited = self.viewC?.model.isPDFTextImageEdited ?? false
         if isEdited || isPDFTextImageEdited {
+            self.viewC?.model.isPDFTextImageEdited = false
             self.listView?.commitEditing()
+            self.listView?.layoutDocumentView()
         }
         
         self.clearData()
@@ -1195,6 +1198,25 @@ extension KMEditPDfHanddler {
             return
         }
         if areas.count == 1 {
+            if KMTools.isPDFType(format) {
+                guard let image = areas.first?.thumbnailImage else {
+                    NSSound.beep()
+                    return
+                }
+                let pdfdocument = CPDFDocument()
+                pdfdocument?.km_insert(image: image, at: 0)
+                let savePanel = NSSavePanel()
+                savePanel.allowedFileTypes = ["pdf"]
+                savePanel.beginSheetModal(for: self.viewC!.view.window!) { response in
+                    if (response != .OK) {
+                        return
+                    }
+                    if let data = pdfdocument?.write(to: savePanel.url!), data {
+                        NSWorkspace.shared.selectFile(savePanel.url?.path, inFileViewerRootedAtPath: "");
+                    }
+                }
+                return
+            }
             let panel = NSSavePanel()
             panel.nameFieldStringValue = "\(NSLocalizedString("Untitled", comment: "")).\(format)"
             panel.isExtensionHidden = true
@@ -1237,9 +1259,20 @@ extension KMEditPDfHanddler {
                         outPath = outPath.stringByAppendingPathComponent(documentFileName)
                         outPath = outPath + "_page\(pageIndex+1)_\(j+1)"
                         outPath = outPath.stringByAppendingPathExtension(format)
-                        let result = self.listView?.extractImage(with: areas[j], toImagePath: outPath) ?? false
-                        if result {
-                            saveURLs.append(URL(fileURLWithPath: outPath))
+                        if KMTools.isPDFType(format) {
+                            if let image = areas[j].thumbnailImage {
+                                let pdfdocument = CPDFDocument()
+                                pdfdocument?.km_insert(image: image, at: 0)
+                                let suc = pdfdocument?.write(toFile: outPath) ?? false
+                                if suc {
+                                    saveURLs.append(URL(fileURLWithPath: outPath))
+                                }
+                            }
+                        } else {
+                            let result = self.listView?.extractImage(with: areas[j], toImagePath: outPath) ?? false
+                            if result {
+                                saveURLs.append(URL(fileURLWithPath: outPath))
+                            }
                         }
                     }
                     NSWorkspace.shared.activateFileViewerSelecting(saveURLs)

+ 7 - 1
PDF Office/PDF Master/Class/PDFTools/Merge/MergeNew/KMMergeWindowController.swift

@@ -99,7 +99,13 @@ extension KMMergeWindowController {
         }
         
         if !IAPProductsManager.default().isAvailableAllFunction() && (files.count >= 2 || size > 20 * 1024 * 1024) {
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            let winC = KMPurchaseCompareWindowController.sharedInstance()
+            if self.kEventTag == 1 {
+                winC?.kEventName = "Onbrd_Merge_BuyNow"
+            } else {
+                winC?.kEventName = "Reading_Merge_BuyNow"
+            }
+            winC?.showWindow(nil)
             return
         }
         

+ 264 - 19
PDF Office/PDF Master/Class/PDFTools/PageEdit/Controller/KMPDFEditViewController.swift

@@ -177,16 +177,22 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
             guard let type = KMPageEditType(rawValue: index) else {
                 if (index == KMPageEditType.insert_files) {
                     self.insertFileAction()
+                    self.trackEvent(type: .insert, index: index)
                 } else if (index == KMPageEditType.insert_blank_page) {
                     self.insertBlankPageAction()
+                    self.trackEvent(type: .insert, index: index)
                 } else if (index == KMPageEditType.insert_custom_page) {
                     self.item_insertCustomPage(sender: nil)
+                    self.trackEvent(type: .insert, index: index)
                 } else if (index == KMPageEditType.insert_fromImage) {
                     self.item_insertFromImage(sender: nil)
+                    self.trackEvent(type: .insert, index: index)
                 } else if (index == KMPageEditType.insert_fromClipboard) {
                     self.item_insertFromClipboard(sender: nil)
+                    self.trackEvent(type: .insert, index: index)
                 } else if (index == KMPageEditType.insert_fromScanner) {
                     self.item_insertFromScanner(sender: nil)
+                    self.trackEvent(type: .insert, index: index)
                 } else if (index == KMPageEditType.extract_selected_pages) {
                     self.extractSelectPageItemAction()
                 } else if (index == KMPageEditType.split_selected_pages) {
@@ -516,7 +522,13 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
     
     override func deleteAction() {
         if IAPProductsManager.default().isAvailableAllFunction() == false {
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            let winC = KMPurchaseCompareWindowController.sharedInstance()
+            if self.kEventTag == 1 {
+                winC?.kEventName = "Onbrd_EditPage_BuyNow"
+            } else {
+                winC?.kEventName = "Reading_Delete_BuyNow"
+            }
+            winC?.showWindow(nil)
             return
         }
         
@@ -577,7 +589,13 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
     
     override func rightRotateAction() {
         if IAPProductsManager.default().isAvailableAllFunction() == false {
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            let winC = KMPurchaseCompareWindowController.sharedInstance()
+            if self.kEventTag == 1 {
+                winC?.kEventName = "Onbrd_EditPage_BuyNow"
+            } else {
+                winC?.kEventName = "Reading_Rotate_BuyNow"
+            }
+            winC?.showWindow(nil)
             return
         }
         
@@ -649,7 +667,13 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
     
     override func extractAction() {
         if IAPProductsManager.default().isAvailableAllFunction() == false {
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            let winC = KMPurchaseCompareWindowController.sharedInstance()
+            if self.kEventTag == 1 {
+                winC?.kEventName = "Onbrd_EditPage_BuyNow"
+            } else {
+                winC?.kEventName = "Reading_Extract_BuyNow"
+            }
+            winC?.showWindow(nil)
             return
         }
         
@@ -669,7 +693,13 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
     
     override func replaceAction() {
         if IAPProductsManager.default().isAvailableAllFunction() == false {
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            let winC = KMPurchaseCompareWindowController.sharedInstance()
+            if self.kEventTag == 1 {
+                winC?.kEventName = "Onbrd_EditPage_BuyNow"
+            } else {
+                winC?.kEventName = "Reading_Replace_BuyNow"
+            }
+            winC?.showWindow(nil)
             return
         }
         
@@ -705,7 +735,13 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
     
     override func splitAction() {
         if IAPProductsManager.default().isAvailableAllFunction() == false {
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            let winC = KMPurchaseCompareWindowController.sharedInstance()
+            if self.kEventTag == 1 {
+                winC?.kEventName = "Onbrd_EditPage_BuyNow"
+            } else {
+                winC?.kEventName = "Reading_Split_BuyNow"
+            }
+            winC?.showWindow(nil)
             return
         }
         
@@ -751,7 +787,13 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
 //            return;
 //        }
         if IAPProductsManager.default().isAvailableAllFunction() == false {
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            let winC = KMPurchaseCompareWindowController.sharedInstance()
+            if self.kEventTag == 1 {
+                winC?.kEventName = "Onbrd_EditPage_BuyNow"
+            } else {
+                winC?.kEventName = "Reading_Split_BuyNow"
+            }
+            winC?.showWindow(nil)
             return
         }
         
@@ -830,7 +872,9 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
     
     override func reverseAction() {
         if IAPProductsManager.default().isAvailableAllFunction() == false {
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            let winC = KMPurchaseCompareWindowController.sharedInstance()
+            winC?.kEventName = "Reading_Reverse_BuyNow"
+            winC?.showWindow(nil)
             return
         }
         
@@ -958,9 +1002,9 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
         if (indexs.count <= 0) {
             return
         }
-        
+
         self.listViewCurrentPageUpdateForDrag(indexs: indexs, toIndex: toIndex)
-        
+
         // 插入位置偏移量
         var toIndexOffset: Int = 0
         // 需要移动的页面index数组
@@ -982,9 +1026,11 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
                 currentPage = newPage
             }
         }
+        
         if (indexs.last! < toIndex && dp == .on) { // 往后拖拽
             toIndexOffset -= 1
         }
+
         let insertIndex = max(0, toIndex-toIndexOffset)
         var selectIndexs: IndexSet = []
         for (index, page) in newPages.enumerated() {
@@ -1010,6 +1056,80 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
         }
     }
     
+    @objc private func new_dragPages(_ indexs: IndexSet, _ toIndex: Int, dp: NSCollectionView.DropOperation, reversed: Bool = false) {
+        if (indexs.count <= 0) {
+            return
+        }
+
+        self.listViewCurrentPageUpdateForDrag(indexs: indexs, toIndex: toIndex)
+
+        // 插入位置偏移量
+        var toIndexOffset: Int = 0
+        // 需要移动的页面index数组
+        var newPages: [CPDFPage] = []
+        var currentPage: CPDFPage?
+        var originalIndex = self.listViewCurrentIndex
+        // 从后面往前删除
+        for index in indexs.reversed() {
+            let newPage = (self.pdfDocument?.page(at: UInt(index)))?.copy() as? CPDFPage
+            if (newPage == nil) {
+                continue
+            }
+            newPages.insert(newPage!, at: 0)
+//            self.pdfDocument?.removePage(at: UInt(index))
+            if (index < toIndex) { /// 删除了插入位置前面的页面,需要改变 toIndex
+                toIndexOffset += 1
+            }
+            if (currentPage == nil) && (originalIndex == index)  {
+                currentPage = newPage
+            }
+        }
+        var after = false
+        if (indexs.last! < toIndex && dp == .on) { // 往后拖拽
+            toIndexOffset -= 1
+            after = true
+        }
+
+        let insertIndex = max(0, toIndex-toIndexOffset)
+        var selectIndexs: IndexSet = []
+        for (index, page) in newPages.enumerated() {
+//            self.pdfDocument?.insertPageObject(page, at: UInt(insertIndex+index))
+            selectIndexs.insert(insertIndex+index)
+            if (currentPage?.pageIndex() == page.pageIndex()) {
+//                self._listViewCurrentIndex = insertIndex+index
+            }
+//            self.pdfDocument?.movePage(at: UInt(index), withPageAt: UInt(insertIndex+index))
+        }
+
+        if after {
+            var offset = 0
+            for index in indexs {
+                self.pdfDocument?.movePage(at: UInt(index-offset), withPageAt: UInt(toIndex))
+                offset += 1
+            }
+        } else {
+            var offset = 0
+            for index in indexs.reversed() {
+                self.pdfDocument?.movePage(at: UInt(index+offset), withPageAt: UInt(toIndex))
+                offset += 1
+            }
+        }
+        
+        // 新增 undo
+        self.kmUndoManager?.registerUndo(withTarget: self) { target in
+            target.clearSelectPages()
+            target.new_dragPages_reversed(indexs, toIndex, newPages, dp: dp)
+        }
+        
+        KMThumbnailCache.shared.clearCache()
+        // 刷新UI
+        self.refreshUI()
+        
+        if (reversed == false) {
+            self.selectPages(indexs: selectIndexs)
+        }
+    }
+    
     @objc private func dragPages_reversed(_ indexs: IndexSet, _ toIndex: Int, _ pages: [CPDFPage], dp: NSCollectionView.DropOperation) {
         if (indexs.count <= 0) {
             return
@@ -1055,6 +1175,77 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
         self.refreshUI()
     }
     
+    @objc private func new_dragPages_reversed(_ indexs: IndexSet, _ toIndex: Int, _ pages: [CPDFPage], dp: NSCollectionView.DropOperation) {
+        if (indexs.count <= 0) {
+            return
+        }
+        
+        // 插入位置偏移量
+        var toIndexOffset: Int = 0
+        for index in indexs {
+            if (index < toIndex) { /// 删除了插入位置前面的页面,需要改变 toIndex
+                toIndexOffset += 1
+            }
+        }
+        var after = false
+        if (indexs.last! < toIndex && dp == .on) { // 往后拖拽
+            toIndexOffset -= 1
+            after = true
+        }
+        let insertIndex = max(0, toIndex-toIndexOffset)
+        // 需要移动的页面index数组
+        var datas: [Int] = []
+        for index in insertIndex ..< (insertIndex + indexs.count) {
+            datas.append(index)
+        }
+        
+        // 从后面开始删除
+        for index in datas.reversed() {
+//            self.pdfDocument?.removePage(at: UInt(index))
+        }
+        // 再插入到对应的位置
+        for (index,value) in indexs.enumerated() {
+            var page: CPDFPage?
+            if (index < pages.count) {
+                page = pages[index]
+            }
+            if (page != nil) {
+//                self.pdfDocument?.insertPageObject(page!, at: UInt(value))
+            }
+        }
+        
+        if after {
+//            var offset = 0
+            for (index,value) in indexs.enumerated() {
+                let idx = datas[index]
+                self.pdfDocument?.movePage(at: UInt(idx), withPageAt: UInt(value))
+//                offset += 1
+            }
+//            for index in datas.reversed() {
+//                self.pdfDocument?.movePage(at: UInt(index+offset), withPageAt: UInt(toIndex))
+//                offset += 1
+//            }
+        } else {
+//            var offset = 0
+            for (index,value) in indexs.reversed().enumerated() {
+                let idx = datas.reversed()[index]
+                self.pdfDocument?.movePage(at: UInt(idx), withPageAt: UInt(value))
+            }
+//            for index in indexs {
+//                self.pdfDocument?.movePage(at: UInt(index-offset), withPageAt: UInt(toIndex))
+//                offset += 1
+//            }
+        }
+        
+        // 新增 undo
+        self.kmUndoManager?.registerUndo(withTarget: self) { target in
+            target.new_dragPages(indexs, toIndex, dp: dp, reversed: true)
+        }
+        KMThumbnailCache.shared.clearCache()
+        // 刷新UI
+        self.refreshUI()
+    }
+    
     // MARK: topBar 事件
     
     @objc func zoomOutButtonAction(sender: NSButton?) {
@@ -1072,6 +1263,7 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
 //        if (self.itemSize.width > self.defaultItemSize.width) {
 //            sender?.isEnabled = false
 //        }
+        KMThumbnailCache.shared.clearCache()
         self.pageEditThumbnailView.zoomOut()
     }
     
@@ -1090,6 +1282,7 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
 //        if (self.itemSize.width < self.defaultItemSize.width) {
 //            sender?.isEnabled = false
 //        }
+        KMThumbnailCache.shared.clearCache()
         self.pageEditThumbnailView.zoomIn()
     }
     
@@ -1119,7 +1312,13 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
     
     @objc func item_insertCustomPage(sender: NSMenuItem?) {
         if IAPProductsManager.default().isAvailableAllFunction() == false {
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            let winC = KMPurchaseCompareWindowController.sharedInstance()
+            if self.kEventTag == 1 {
+                winC?.kEventName = "Onbrd_EditPage_BuyNow"
+            } else {
+                winC?.kEventName = "Reading_InsertBlankPage_BuyNow"
+            }
+            winC?.showWindow(nil)
             return
         }
         
@@ -1174,7 +1373,13 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
     
     @objc func item_insertFromImage(sender: NSMenuItem?) {
         if IAPProductsManager.default().isAvailableAllFunction() == false {
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            let winC = KMPurchaseCompareWindowController.sharedInstance()
+            if self.kEventTag == 1 {
+                winC?.kEventName = "Onbrd_EditPage_BuyNow"
+            } else {
+                winC?.kEventName = "Reading_InsertImage_BuyNow"
+            }
+            winC?.showWindow(nil)
             return
         }
         
@@ -1227,7 +1432,13 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
     
     @objc func item_insertFromClipboard(sender: NSMenuItem?) {
         if IAPProductsManager.default().isAvailableAllFunction() == false {
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            let winC = KMPurchaseCompareWindowController.sharedInstance()
+            if self.kEventTag == 1 {
+                winC?.kEventName = "Onbrd_EditPage_BuyNow"
+            } else {
+                winC?.kEventName = "Reading_InsertClipboard_BuyNow"
+            }
+            winC?.showWindow(nil)
             return
         }
 //        self.choosePositionWindow {[weak self] index in
@@ -1247,7 +1458,13 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
     
     @objc func item_insertFromScanner(sender: NSMenuItem?) {
         if IAPProductsManager.default().isAvailableAllFunction() == false {
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            let winC = KMPurchaseCompareWindowController.sharedInstance()
+            if self.kEventTag == 1 {
+                winC?.kEventName = "Onbrd_EditPage_BuyNow"
+            } else {
+                winC?.kEventName = "Reading_InsertSacnner_BuyNow"
+            }
+            winC?.showWindow(nil)
             return
         }
         
@@ -1319,7 +1536,13 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
     
     func extractSelectPageItemAction() {
         if IAPProductsManager.default().isAvailableAllFunction() == false {
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            let winC = KMPurchaseCompareWindowController.sharedInstance()
+            if self.kEventTag == 1 {
+                winC?.kEventName = "Onbrd_EditPage_BuyNow"
+            } else {
+                winC?.kEventName = "Reading_Extract_BuyNow"
+            }
+            winC?.showWindow(nil)
             return
         }
         
@@ -1619,7 +1842,7 @@ extension KMPDFEditViewController: KMThumbnailViewDelegate {
             dp = _dp
         }
         
-        self.dragPages(indexs, toIndex, dp: dp)
+        self.new_dragPages(indexs, toIndex, dp: dp)
         
         if (dragedIndexPaths.count > 0) {
             self.dealPdfDocumentDidEditCallback()
@@ -1812,11 +2035,33 @@ extension KMPDFEditViewController {
 // MARK: - Analytics (埋点)
 
 extension KMPDFEditViewController {
-    func trackEvent(type: KMPageEditType) -> Void {
+    func trackEvent(type: KMPageEditType, index: Int = 0) -> Void {
         if (type == .insert) {
-            KMAnalytics.trackEvent(eventName: "Btn_SubTbr_Insert", parameters: [
-                KMAnalytics.Parameter.categoryKey : KMAnalytics.Category.subTbr_PageEdit,
-                KMAnalytics.Parameter.labelKey : KMAnalytics.Label.subTbr_Btn], platform: .AppCenter, appTarget: .all)
+            if index == 0 {
+                KMAnalytics.trackEvent(eventName: "Btn_SubTbr_Insert", parameters: [
+                    KMAnalytics.Parameter.categoryKey : KMAnalytics.Category.subTbr_PageEdit,
+                    KMAnalytics.Parameter.labelKey : KMAnalytics.Label.subTbr_Btn], platform: .AppCenter, appTarget: .all)
+            } else if index == KMPageEditType.insert_blank_page || index == KMPageEditType.insert_custom_page {
+                KMAnalytics.trackEvent(eventName: "Btn_SubTbr_PageEdit_InsertBlankPage", parameters: [
+                    KMAnalytics.Parameter.categoryKey : KMAnalytics.Category.subTbr_PageEdit,
+                    KMAnalytics.Parameter.labelKey : KMAnalytics.Label.subTbr_Btn], platform: .AppCenter, appTarget: .all)
+            } else if index == KMPageEditType.insert_files {
+                KMAnalytics.trackEvent(eventName: "Btn_SubTbr_PageEdit_InsertPDF", parameters: [
+                    KMAnalytics.Parameter.categoryKey : KMAnalytics.Category.subTbr_PageEdit,
+                    KMAnalytics.Parameter.labelKey : KMAnalytics.Label.subTbr_Btn], platform: .AppCenter, appTarget: .all)
+            } else if index == KMPageEditType.insert_fromImage {
+                KMAnalytics.trackEvent(eventName: "Btn_SubTbr_PageEdit_InsertImage", parameters: [
+                    KMAnalytics.Parameter.categoryKey : KMAnalytics.Category.subTbr_PageEdit,
+                    KMAnalytics.Parameter.labelKey : KMAnalytics.Label.subTbr_Btn], platform: .AppCenter, appTarget: .all)
+            } else if index == KMPageEditType.insert_fromClipboard {
+                KMAnalytics.trackEvent(eventName: "Btn_SubTbr_PageEdit_InsertClipboard", parameters: [
+                    KMAnalytics.Parameter.categoryKey : KMAnalytics.Category.subTbr_PageEdit,
+                    KMAnalytics.Parameter.labelKey : KMAnalytics.Label.subTbr_Btn], platform: .AppCenter, appTarget: .all)
+            } else if index == KMPageEditType.insert_fromScanner {
+                KMAnalytics.trackEvent(eventName: "Btn_SubTbr_PageEdit_InsertScanner", parameters: [
+                    KMAnalytics.Parameter.categoryKey : KMAnalytics.Category.subTbr_PageEdit,
+                    KMAnalytics.Parameter.labelKey : KMAnalytics.Label.subTbr_Btn], platform: .AppCenter, appTarget: .all)
+            }
         } else if (type == .extract) {
             KMAnalytics.trackEvent(eventName: "Btn_SubTbr_Extract", parameters: [
                 KMAnalytics.Parameter.categoryKey : KMAnalytics.Category.subTbr_PageEdit,

+ 1 - 0
PDF Office/PDF Master/Class/PDFTools/PageEdit/Window/KMPDFEditWindowController.swift

@@ -18,6 +18,7 @@ class KMPDFEditWindowController: KMBaseWindowController {
         
         if let document = CPDFDocument(url: URL(fileURLWithPath: filepath)) {
             self._viewController = KMPDFEditViewController(document)
+            self._viewController?.kEventTag = 1
             self._viewController?.documentEditedCallback = { [weak self] _ in
                 self?._isEdited = true
             }

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

@@ -600,7 +600,9 @@ typedef NS_ENUM(NSUInteger, kPageSelectStyle) {
 {
     if (![IAPProductsManager defaultManager].isAvailableAllFunction) {
         [self close];
-        [[KMPurchaseCompareWindowController sharedInstance] showWindow:nil];
+        NSWindowController *winC = [KMPurchaseCompareWindowController sharedInstance];
+        winC.kEventName = @"MenuBar_PrintPoster_BuyNow";
+        [winC showWindow:nil];
         return;
     }
     
@@ -617,7 +619,9 @@ typedef NS_ENUM(NSUInteger, kPageSelectStyle) {
 {
     if (![IAPProductsManager defaultManager].isAvailableAllFunction) {
         [self close];
-        [[KMPurchaseCompareWindowController sharedInstance] showWindow:nil];
+        NSWindowController *winC = [KMPurchaseCompareWindowController sharedInstance];
+        winC.kEventName = @"MenuBar_PrintMultiple_BuyNow";
+        [winC showWindow:nil];
         return;
     }
     [self close];
@@ -633,7 +637,9 @@ typedef NS_ENUM(NSUInteger, kPageSelectStyle) {
 {
     if (![IAPProductsManager defaultManager].isAvailableAllFunction) {
         [self close];
-        [[KMPurchaseCompareWindowController sharedInstance] showWindow:nil];
+        NSWindowController *winC = [KMPurchaseCompareWindowController sharedInstance];
+        winC.kEventName = @"MenuBar_PrintBooklet_BuyNow";
+        [winC showWindow:nil];
         return;
     }
     

+ 3 - 1
PDF Office/PDF Master/Class/PDFTools/RemovePassword/New/View/KMRemovePasswordView.swift

@@ -71,7 +71,9 @@ extension KMRemovePasswordView {
     
     @IBAction func removeButtonAction(_ sender: Any) {
         if !IAPProductsManager.default().isAvailableAllFunction(){
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            let winC = KMPurchaseCompareWindowController.sharedInstance()
+            winC?.kEventName = "Reading_RemoveSecurity_BuyNow"
+            winC?.showWindow(nil)
             return
         }
 

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

@@ -121,7 +121,9 @@ class KMBatchOperateRemovePasswordViewController: KMBatchOperateBaseViewControll
             return;
         }
         if !IAPProductsManager.default().isAvailableAllFunction(){
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            let winC = KMPurchaseCompareWindowController.sharedInstance()
+            winC?.kEventName = "Onbrd_Security_BuyNow"
+            winC?.showWindow(nil)
             return
         }
         //MARK: 判断是否能用pro功能

+ 11 - 0
PDF Office/PDF Master/Class/PDFTools/Watermark/Controller/KMBatchOperateAddWatermarkViewController.swift

@@ -878,6 +878,17 @@ extension KMBatchOperateAddWatermarkViewController {
     }
     
     @objc private func _batchFilesCountNotification(_ notification: NSNotification) {
+        let files: Array? = notification.object as? [KMBatchOperateFile]
+        if let data = files?.first {
+            if data.currentOperateType != self.operateType {
+                return
+            }
+        }
+        let viewC = notification.userInfo?[kObjectKey] as? NSViewController
+        if let data = self.view.window?.isEqual(to: viewC?.view.window), data == false {
+            return
+        }
+        
         if (!self.onlyManagerTemplate) {
             let files: Array? = notification.object as? [KMBatchOperateFile]
             self.files? = files ?? []

BIN
PDF Office/PDF Master/Class/PDFWindowController/MainWindowController/Quick Start Guide.pdf


+ 5 - 1
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFAnnotationModel.m

@@ -267,10 +267,14 @@
         NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
         switch (_annotationType) {
             case CAnnotationTypeFreeText:
+                color = [userDefaults PDFListViewColorForKey:CFreeTextNoteBorderColorKey] ? : NSColor.clearColor;
+                break;
             case CAnnotationTypeSignText:
-            case CAnnotationTypeSignDate:
                 color = [userDefaults PDFListViewColorForKey:CFreeTextNoteBorderColorKey] ? : NSColor.whiteColor;
                 break;
+            case CAnnotationTypeSignDate:
+                color = [userDefaults PDFListViewColorForKey:CFreeTextNoteBorderColorKey] ? : NSColor.clearColor;
+                break;
             case CAnnotationTypeAnchored:
                 color = [userDefaults PDFListViewColorForKey:CAnchoredNoteColorKey];
                 break;

+ 5 - 1
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFFreeTextAnnotation+PDFListView.swift

@@ -19,7 +19,11 @@ import Foundation
             if ((red == 0) && (green == 0) && (blue == 0) && (alpha == 1)) {
                 self.color = nil
             } else {
-                self.color = model.color()
+                if model.color().isEqual(to: NSColor.clear) {
+                    self.color = nil
+                } else {
+                    self.color = model.color()
+                }
             }
             
             if let data = model.fontColor() {

+ 6 - 1
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/SelfSign/CSelfSignAnnotationFreeText.m

@@ -245,7 +245,12 @@
         if (font)
             [self setFont:font];
         
-        [self setColor:annotationModel.color];
+        if ([annotationModel.color isEqualTo:NSColor.clearColor]) {
+            [self setColor:nil];
+        } else {
+            [self setColor:annotationModel.color];
+        }
+        
         [self setAlignment:annotationModel.alignment];
         if (!annotationModel.fontColor) {
             [self setFontColor:[NSColor blackColor]];

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

@@ -135,6 +135,8 @@
             if (CNoteToolMode == self.toolMode)
                 area &= ~CPDFLinkArea;
             
+            NSRect rect = CPDFListViewRectFromCenterAndSize(p, CGSizeMake(80, 100));
+            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) {

BIN
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/ComPDFKit


+ 1 - 1
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/_CodeSignature/CodeResources

@@ -6,7 +6,7 @@
 	<dict>
 		<key>Resources/.DS_Store</key>
 		<data>
-		GmM7AsvXFgRNznkIqKE51ZVh4vs=
+		h8JtUfHSGJ7UtYRzanub3WwcwNY=
 		</data>
 		<key>Resources/Assets.car</key>
 		<data>

+ 7 - 4
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Annotation/Controller/KMNoteOutlineFilterViewController.swift

@@ -40,8 +40,7 @@ class KMNoteOutlineFilterViewController: NSViewController {
                 self._addNoteColorWith(noteColor)
                 if let data = _anno as? CPDFLineAnnotation {
                     if data.isMeasure {
-                        self._addNoteTypeWith(noteType + "_Measure")
-//                        self._addNoteTypeWith(noteType)
+                        self._addNoteTypeWith(CPDFAnnotation.kType.measureArrow)
                     } else {
                         self._addNoteTypeWith(noteType)
                     }
@@ -319,10 +318,14 @@ extension KMNoteOutlineFilterViewController {
     private func _addNoteTypeWith(_ type: String) {
         if let cnt = self._typeMutableArray?.count, cnt > 0 {
             if self._typeMutableArray?.contains(type) == false {
-                self._typeMutableArray?.add(type as Any)
+                if type.isEmpty == false && type != "Image" {
+                    self._typeMutableArray?.add(type as Any)
+                }
             }
         } else {
-            self._typeMutableArray?.add(type as Any)
+            if type.isEmpty == false && type != "Image" {
+                self._typeMutableArray?.add(type as Any)
+            }
         }
     }
     

+ 7 - 4
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Annotation/View/KMNoteTableViewCell.swift

@@ -264,11 +264,11 @@ extension KMNoteTableViewCell {
                 if (markup.markupType() == .highlight) {
                     attributeStr.addAttribute(.backgroundColor, value: noteColor as Any, range: NSMakeRange(0, contentString.count))
                 } else if (markup.markupType() == .strikeOut) {
-                    attributeStr.addAttribute(.strikethroughStyle, value: NSUnderlineStyle.single.rawValue, range: NSMakeRange(0, noteString.count))
-                    attributeStr.addAttribute(.strikethroughColor, value: noteColor as Any, range: NSMakeRange(0, noteString.count))
+                    attributeStr.addAttribute(.strikethroughStyle, value: NSUnderlineStyle.single.rawValue, range: NSMakeRange(0, contentString.count))
+                    attributeStr.addAttribute(.strikethroughColor, value: noteColor as Any, range: NSMakeRange(0, contentString.count))
                 } else if (markup.markupType() == .underline) {
-                    attributeStr.addAttribute(.underlineStyle, value: NSUnderlineStyle.single.rawValue, range: NSMakeRange(0, noteString.count))
-                    attributeStr.addAttribute(.underlineColor, value: noteColor as Any, range: NSMakeRange(0, noteString.count))
+                    attributeStr.addAttribute(.underlineStyle, value: NSUnderlineStyle.single.rawValue, range: NSMakeRange(0, contentString.count))
+                    attributeStr.addAttribute(.underlineColor, value: noteColor as Any, range: NSMakeRange(0, contentString.count))
                 }
                 self.annotationContentLabel.attributedStringValue = attributeStr
                 
@@ -281,6 +281,9 @@ extension KMNoteTableViewCell {
             } else if data.isKind(of: CPDFLineAnnotation.self) || noteType == SKNSquareString || noteType == SKNCircleString { //  || noteType == SKNInkString
 //                noteString = data.page?.string(for: data.bounds) ?? ""
                 noteString = data.contents ?? ""
+                if let anno = data as? CPDFLineAnnotation, anno.isMeasure {
+                    noteString = anno.string() ?? ""
+                }
                 self.annotationContentLabel.stringValue = noteString
                 
                 self.isFold = isFold

+ 3 - 3
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Annotation/View/KMNoteTypeCollectionViewItem.swift

@@ -89,7 +89,7 @@ class KMNoteTypeCollectionViewItem: NSCollectionViewItem {
             } else {
                 isSelect = false
             }
-        } else if (self.typeString == "Arrow_Measure") {
+        } else if (self.typeString == CPDFAnnotation.kType.measureArrow) {
             if (self._equalToImage(sender.image!, otherImage: NSImage(named: "KMImageNameFilterMeasure")!)) {
                 isSelect = true
             } else {
@@ -183,7 +183,7 @@ class KMNoteTypeCollectionViewItem: NSCollectionViewItem {
                 self.typeButton.image = NSImage(named: "KMImageNameSidebarAnnotationFilterStrikeoutWhite")
             } else if (self.typeString == "Line") {
                 self.typeButton.image = NSImage(named: "KMImageNameSidebarAnnotationFilterLineWhite")
-            } else if (self.typeString == "Arrow_Measure") {
+            } else if (self.typeString == CPDFAnnotation.kType.measureArrow) {
                 self.typeButton.image = NSImage(named: "KMImageNameFilterMeasureSelected")
             } else if (self.typeString == "Arrow") {
                 self.typeButton.image = NSImage(named: "KMImageNameSidebarAnnotationFilterArrowWhite")
@@ -228,7 +228,7 @@ class KMNoteTypeCollectionViewItem: NSCollectionViewItem {
                 self.typeButton.image = NSImage(named: "KMImageNameSidebarAnnotationFilterStrikeoutNor")
             } else if (self.typeString == "Line") {
                 self.typeButton.image = NSImage(named: "KMImageNameSidebarAnnotationFilterLineNor")
-            } else if (self.typeString == "Arrow_Measure") {
+            } else if (self.typeString == CPDFAnnotation.kType.measureArrow) {
                 self.typeButton.image = NSImage(named: "KMImageNameFilterMeasure")
             } else if (self.typeString == "Arrow") {
                 self.typeButton.image = NSImage(named: "KMImageNameSidebarAnnotationFilterArrowNor")

+ 24 - 6
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController+Note.swift

@@ -769,7 +769,7 @@ extension KMLeftSideViewController {
     func reloadAnnotation() {
         if self.listView != nil {
             let filterKey = self.pdfDocument()?.documentURL.path ?? ""
-            let typeArr: [Any] = KMBotaTools.noteFilterAnnoTypes(key: filterKey)
+            let typeArr: [String] = KMBotaTools.noteFilterAnnoTypes(key: filterKey)
             let colorArr: [Any] = KMBotaTools.noteFilterColors(key: filterKey)
             let authorArr: [Any] = KMBotaTools.noteFilterAuthors(key: filterKey)
             if typeArr.count == 0 && colorArr.count == 0 && authorArr.count == 0 {
@@ -796,7 +796,11 @@ extension KMLeftSideViewController {
                     annotationArray += allAnnos
                     
                     if typeArr.count > 0 {
-                        filterAnnos = (KMOCToolClass.filterAnnotation(annotations: filterAnnos, types: typeArr) as? [CPDFAnnotation]) ?? []
+                        var theTypes = typeArr
+                        if typeArr.contains(CPDFAnnotation.kType.measureArrow) && typeArr.contains(CPDFAnnotation.kType.arrow) == false {
+                            theTypes.append(CPDFAnnotation.kType.arrow)
+                        }
+                        filterAnnos = (KMOCToolClass.filterAnnotation(annotations: filterAnnos, types: theTypes) as? [CPDFAnnotation]) ?? []
                     }
                     if (colorArr.count > 0) {
                         filterAnnos = (KMOCToolClass.filterAnnotation(annotations: filterAnnos,colors: colorArr) as? [CPDFAnnotation]) ?? []
@@ -804,12 +808,19 @@ extension KMLeftSideViewController {
                     if (authorArr.count > 0) {
                         filterAnnos = (KMOCToolClass.filterAnnotation(annotations: filterAnnos,authors: authorArr) as? [CPDFAnnotation]) ?? []
                     }
-                    if types.contains("Arrow_Measure") {
-                        
+                    
+                    if typeArr.contains(CPDFAnnotation.kType.measureArrow) {
+                        if typeArr.contains(CPDFAnnotation.kType.arrow) == false {
+                            for anno in filterAnnos {
+                                if let data = anno as? CPDFLineAnnotation, data.type == CPDFAnnotation.kType.arrow && data.isMeasure == false {
+                                    filterAnnos.removeObject(anno)
+                                }
+                            }
+                        }
                     } else {
-                        for anno in annos {
+                        for anno in filterAnnos {
                             if let data = anno as? CPDFLineAnnotation, data.isMeasure {
-                                annos.removeObject(anno)
+                                filterAnnos.removeObject(anno)
                             }
                         }
                     }
@@ -1007,6 +1018,13 @@ extension KMLeftSideViewController {
                     
                     self.listView?.updateActiveAnnotations([annotation])
                     self.listView?.setNeedsDisplayAnnotationViewForVisiblePages()
+                if annotation is CPDFPolygonAnnotation || annotation is CPDFPolylineAnnotation {
+                    self.listView?.pdfListViewDelegate.pdfListViewAnnotationMeasureInfoChange?(self.listView, with: annotation)
+                } else if let anno = annotation as? CPDFLineAnnotation {
+                    if anno.isMeasure {
+                        self.listView?.pdfListViewDelegate.pdfListViewAnnotationMeasureInfoChange?(self.listView, with: annotation)
+                    }
+                }
 //                }
                 
             }

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

@@ -75,8 +75,10 @@ extension KMLeftSideViewController {
             self.thumbnails[index].dirty = true
             self.thumbnailTableView.reloadData(forRowIndexes: IndexSet(integer: index), columnIndexes: IndexSet(integer: 0))
             
-            let thumbailTabCell = self.thumbnailTableView.view(atColumn: 0, row: index, makeIfNecessary: true) as? KMThumbnailTableviewCell
-            thumbailTabCell?.pageView.updateThumbnial(needReset: true)
+            if index < self.thumbnailTableView.numberOfRows {
+                let thumbailTabCell = self.thumbnailTableView.view(atColumn: 0, row: index, makeIfNecessary: true) as? KMThumbnailTableviewCell
+                thumbailTabCell?.pageView.updateThumbnial(needReset: true)
+            }
             /*
              原问题:CrashKit - SKMainWindowController updateThumbnailAtPageIndex:] ([__NSArrayM objectAtIndex:]: index 9223372036854775807 beyond bounds [0 .. 17])
              注释原因:缩略图高亮为自定义后,刷新会将高亮刷新到0行

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

@@ -323,7 +323,7 @@ class KMLeftSideViewController: KMSideViewController {
                 }
                 FMTrackEventManager.defaultManager.trackEvent(event: "LeftSidebar", withProperties: ["LeftSidebar_Btn": "Btn_LeftSidebar_Thumbnail"])
                 self.refreshMethodType(methodType: .Thumbnail)
-                DispatchQueue.main.async {
+                KMMainThreadExecute {
                     self.toolButtonBox.contentView = self.thumbnailView
                     self.displayThumbnailViewAnimating(false)
                 }
@@ -744,7 +744,7 @@ class KMLeftSideViewController: KMSideViewController {
             }
         }
         
-        DispatchQueue.main.async {
+        KMMainThreadExecute {
             let ris = self.thumbnailTableView.selectedRowIndexes
             self.thumbnailTableView.reloadData()
             if ks {

+ 21 - 3
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Thumbnail/Base/KMPDFThumbViewBaseController.swift

@@ -153,7 +153,13 @@ class KMPDFThumbViewBaseController: KMBaseViewController {
     
     public func insertFileAction() {
         if IAPProductsManager.default().isAvailableAllFunction() == false {
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            let winC = KMPurchaseCompareWindowController.sharedInstance()
+            if self.kEventTag == 1 {
+                winC?.kEventName = "Onbrd_EditPage_BuyNow"
+            } else {
+                winC?.kEventName = "Reading_InsertPDF_BuyNow"
+            }
+            winC?.showWindow(nil)
             return
         }
         
@@ -201,7 +207,13 @@ class KMPDFThumbViewBaseController: KMBaseViewController {
     
     public func insertBlankPageAction() {
         if IAPProductsManager.default().isAvailableAllFunction() == false {
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            let winC = KMPurchaseCompareWindowController.sharedInstance()
+            if self.kEventTag == 1 {
+                winC?.kEventName = "Onbrd_EditPage_BuyNow"
+            } else {
+                winC?.kEventName = "Reading_InsertBlankPage_BuyNow"
+            }
+            winC?.showWindow(nil)
             return
         }
         
@@ -267,7 +279,13 @@ class KMPDFThumbViewBaseController: KMBaseViewController {
     
     public func copyAction() {
         if IAPProductsManager.default().isAvailableAllFunction() == false {
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            let winC = KMPurchaseCompareWindowController.sharedInstance()
+            if self.kEventTag == 1 {
+                winC?.kEventName = "Onbrd_EditPage_BuyNow"
+            } else {
+                winC?.kEventName = "Reading_Copy_BuyNow"
+            }
+            winC?.showWindow(nil)
             return
         }
         

+ 4 - 1
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMAnnotationPropertiesViewController.m

@@ -122,7 +122,8 @@
     NSMutableParagraphStyle *ps = [[NSMutableParagraphStyle alloc] init];
     ps.lineSpacing = 10;
     ps.alignment = NSTextAlignmentCenter;
-    self.subTitleLabel.attributedStringValue = [[NSAttributedString alloc] initWithString:self.subTitleLabel.stringValue attributes:@{
+    NSString *subTitle = self.subTitleLabel.stringValue != nil ? self.subTitleLabel.stringValue : @"";
+    self.subTitleLabel.attributedStringValue = [[NSAttributedString alloc] initWithString:subTitle attributes:@{
         NSForegroundColorAttributeName : [NSColor colorWithRed:148/255.f green:152/255.f blue:156/255.f alpha:1.f],
         NSFontAttributeName : [NSFont fontWithName:@"SFProText-Regular" size:12],
         NSParagraphStyleAttributeName : ps}];
@@ -748,6 +749,8 @@
         self.titleViewHeightConstraint.constant = 0;
         vc.annotationModel = annotationModel;
         vc.pdfView = self.pdfView;
+        vc.kEventTag = self.kEventTag;
+        self.kEventTag = 0;
         self.propertiesBox.contentView = vc.view;
         self.contentViewController = vc;
     } 

+ 8 - 0
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMAnnotationSelectLinkViewController.swift

@@ -132,6 +132,14 @@ enum KMAnnotationLinkType: UInt {
                 if downEntered {
                     if !IAPProductsManager.default().isAvailableAllFunction() {
                         if mouseBox == self.linkUrlBox || mouseBox == self.linkEmailBox {
+                            if mouseBox == self.linkUrlBox {
+                                let winC = KMPurchaseCompareWindowController.sharedInstance()
+                                winC?.kEventName = "Reading_WebsiteLink_BuyNow"
+                            } else if mouseBox == self.linkEmailBox {
+                                let winC = KMPurchaseCompareWindowController.sharedInstance()
+                                winC?.kEventName = "Reading_EmailLink_BuyNow"
+                            }
+                            
                             KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
                             return
                         }

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

@@ -528,7 +528,9 @@ class KMPageDisplayPropertiesButton: NSButton {
         FMTrackEventManager.defaultManager.trackEvent(event: "SubTbr_PageDisplay", withProperties: ["SubTbr_Btn": "Btn_SubTbr_PageDisplay_ViewSetting_SplitView"])
         
         if sender.tag > 0 && IAPProductsManager.default().isAvailableAllFunction() == false {
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            let winC = KMPurchaseCompareWindowController.sharedInstance()
+            winC?.kEventName = "Reading_SplitView_BuyNow"
+            winC?.showWindow(nil)
             return
         }
         
@@ -727,7 +729,9 @@ extension KMPageDisplayPropertiesViewController: NSCollectionViewDelegate, NSCol
         for indexPath in indexPathArr {
             if IAPProductsManager.default().isAvailableAllFunction() == false {
                 if indexPath.item > 0 {
-                    KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+                    let winC = KMPurchaseCompareWindowController.sharedInstance()
+                    winC?.kEventName = "Reading_Theme_BuyNow"
+                    winC?.showWindow(nil)
                     return
                 }
             }

+ 9 - 10
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/EditPDF/KMEditPDFTextPropertyViewController.swift

@@ -246,7 +246,7 @@ class KMEditPDFTextPropertyViewController: NSViewController {
         self.initData()
 //        self.reloadData()
         self.updateLanguage()
-        self.updatePreviewImage()
+//        self.updatePreviewImage()
         self.updateUI()
         
         self.headerBox.isHidden = true
@@ -797,7 +797,7 @@ class KMEditPDFTextPropertyViewController: NSViewController {
                 self.alignment = alignment
                 self.selectAlignment(alignment: alignment)
                 
-                self.updatePreviewImage()
+//                self.updatePreviewImage()
                 
                 let opacity = self.listView.opacity(for: areas as? CPDFEditArea)
                 let sliderView = self.opacityBox.contentView as? KMSliderItemView
@@ -959,7 +959,7 @@ extension KMEditPDFTextPropertyViewController {
         } else {
             KMEditPDFTextManager.manager.setCommonlyFontColor(color: self.currentColor)
         }
-        self.updatePreviewImage()
+//        self.updatePreviewImage()
     }
     
     @objc func fontBoldAction(_ sender: AnyObject) {
@@ -1053,9 +1053,8 @@ extension KMEditPDFTextPropertyViewController {
         self.updateAlignment(alignment: .left)
         if let _ = sender {
             KMEditPDFPopToolBarWindow.shared.updateTextAlign(align: .left)
+            self._trackEvent()
         }
-        
-        self._trackEvent()
     }
     
     @objc func centerAlignmentAction(sender: NSButton?) {
@@ -1204,7 +1203,7 @@ extension KMEditPDFTextPropertyViewController {
                 KMEditPDFTextManager.manager.setFontAlignment(alignment: alignment)
             }
             self.alignment = alignment
-            self.updatePreviewImage()
+//            self.updatePreviewImage()
         }
     }
     
@@ -1245,7 +1244,7 @@ extension KMEditPDFTextPropertyViewController: KMSelectPopButtonDelegate {
             self.updateTextPresupposition(type: type)
         } else if obj == fontNameVC {
             self.updateFontNameAndStyle(name: obj.stringValue, style: fontStyle)
-            self.updatePreviewImage()
+//            self.updatePreviewImage()
             let win = KMEditPDFPopToolBarWindow.shared
             if win.isVisible {
                 (win.contentViewController as? KMEditPDFPopToolBarController)?.toolbarView?.reloadData()
@@ -1253,12 +1252,12 @@ extension KMEditPDFTextPropertyViewController: KMSelectPopButtonDelegate {
         } else if obj == fontSizeVC {
             let size = CGFloat(Float((obj.stringValue.replacingOccurrences(of: "pt", with: "")))!)
             self.updateFontSize(size: size)
-            self.updatePreviewImage()
+//            self.updatePreviewImage()
             
             KMEditPDFPopToolBarWindow.shared.updateFontSizeButtons(enable: true)
         } else if obj == fontStyleVC {
             self.updateFontNameAndStyle(name: fontName, style: obj.stringValue)
-            self.updatePreviewImage()
+//            self.updatePreviewImage()
         } else if obj == self.opacitVC {
             let stringValue = self.opacitVC?.stringValue ?? ""
             let value = (stringValue.components(separatedBy: "%").first?.stringToCGFloat() ?? 0) / 100
@@ -1396,7 +1395,7 @@ extension KMEditPDFTextPropertyViewController {
         
         self.updateFontNameAndStyle(name: fontName, style: style, needChangeListView: needChangeListView, needSave: false)
         self.updateFontSize(size: size, needChangeListView: needChangeListView, needSave: false)
-        self.updatePreviewImage()
+//        self.updatePreviewImage()
     }
     
     func resetTextPresuppositionData() {

+ 2 - 0
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/KMRightSideViewController.swift

@@ -123,6 +123,8 @@ class KMRightSideViewController: NSViewController,CipherTextViewDelegate {
         }  else if listView.toolMode == .selfSignMode && KMAnnotationPropertiesViewController.height(withAnnotationMode: pdfView.annotationType) > 0 {
             self.isHidden = false
             self.annotationProperties.annotations = []
+            self.annotationProperties.kEventTag = self.kEventTag
+            self.kEventTag = 0
             self.annotationProperties.annotationMode = annotationType
         } else if (annotationType == .line || annotationType == .polyLine || annotationType == .polyGon || (annotationType == .square && self.listView.toolMode != .noteToolMode)) && KMAnnotationPropertiesViewController.height(withAnnotationMode: pdfView.annotationType) > 0 {
             self.isHidden = false

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

@@ -138,7 +138,14 @@ KMSigntureViewItemDelegate>
 
 - (IBAction)insertSignatureButton_Click:(id)sender {
     if (![[IAPProductsManager defaultManager] isAvailableAllFunction]) {
-        [[KMPurchaseCompareWindowController sharedInstance] showWindow:nil];
+        NSWindowController *winC = [KMPurchaseCompareWindowController sharedInstance];
+        if (self.kEventTag == 1) {
+            winC.kEventName = @"Reading_FillSign_Signature_BuyNow";
+        } else {
+            winC.kEventName = @"Reading_Signature_BuyNow";
+        }
+        
+        [winC showWindow:nil];
         return;
     }
     [self showSignatureWindow];
@@ -382,6 +389,10 @@ KMSigntureViewItemDelegate>
             [page addAnnotation:signatureaAnnotation];
             [self.pdfView setNeedsDisplayAnnotationViewForPage:page];
             [signatureaAnnotation setShouldDisplay:YES];
+            
+            if (self.view.window != nil) {
+                [KMTools setDocumentEditedStateWithWindow:self.view.window];
+            }
         }
         
         return;

+ 2 - 1
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/StampList/CreateStamp/Controller/KMStampCreaterWindowController.swift

@@ -207,7 +207,8 @@ class KMStampCreaterWindowController: NSWindowController, NSTextViewDelegate{
     func textViewDidChangeSelection(_ notification: Notification) {
         let textView = notification.object as! NSTextView
         if textView == self.textView {
-            let string = textView.string.count > 0 ? textView.string : ""
+            var string = textView.string.count > 0 ? textView.string : ""
+            string = string.replacingOccurrences(of: "\n", with: "")
             self.stamp?.bounds = self.preView.bounds
             self.stamp?.setCustomStampString(string, dateString: self.stamp?.dateString ?? "")
             self.preView.image = self.stamp?.stampPreviewImage()

+ 8 - 4
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/StampList/KMAnnotationStampViewController.swift

@@ -287,8 +287,10 @@ let KMPDFDynamicStampNeedAuthorKey1 = "km_pdfview_dynamic_stamp_need_author"
         self.dynamicBoxNew?.downCallback = { [weak self] downEntered, mouseBox, event in
 //        dynamicBox.downCallback = { [weak self] downEntered, mouseBox, event in
             guard let blockSelf = self else { return }
-            if !IAPProductsManager.default().isAvailableAllFunction() {
-                KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            if downEntered && !IAPProductsManager.default().isAvailableAllFunction() {
+                let winC = KMPurchaseCompareWindowController.sharedInstance()
+                winC?.kEventName = "Reading_DynamicStamp_BuyNow"
+                winC?.showWindow(nil)
                 return
             }
             if downEntered && (blockSelf.stampType != .dynamic) {
@@ -307,8 +309,10 @@ let KMPDFDynamicStampNeedAuthorKey1 = "km_pdfview_dynamic_stamp_need_author"
         self.customBoxNew?.downCallback = { [weak self] downEntered, mouseBox, event in
 //        customBox.downCallback = { [weak self] downEntered, mouseBox, event in
             guard let blockSelf = self else { return }
-            if !IAPProductsManager.default().isAvailableAllFunction() {
-                KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            if downEntered && !IAPProductsManager.default().isAvailableAllFunction() {
+                let winC = KMPurchaseCompareWindowController.sharedInstance()
+                winC?.kEventName = "Reading_CustomStamp_BuyNow"
+                winC?.showWindow(nil)
                 return
             }
             if downEntered && (blockSelf.stampType != .custom) {

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

@@ -73,7 +73,9 @@ class KMTabbingHintWindowController: NSWindowController{
     }
     @IBAction func buttonClicked_NewTabInWindowButton(_ sender: NSButton) {
         sender.state = NSControl.StateValue.off;
-        KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+        let winC = KMPurchaseCompareWindowController.sharedInstance()
+        winC?.kEventName = "Reading_MultiTab_BuyNow"
+        winC?.showWindow(nil)
     }
     
     @IBAction func buttonClicked_NewWindow(_ sender: NSButton) {

+ 3 - 0
PDF Office/PDF Master/Class/PDFWindowController/Toolbar/KMToolbarController.swift

@@ -776,6 +776,7 @@ extension KMToolbarController: KMToolbarViewControllerDelegate {
                 if resp != .alertFirstButtonReturn {  // 取消
                     return
                 }
+                control?.redactPdfView.newAddAnnotation.removeAll()
             }
         }
         if self.lastItemBox != nil {
@@ -1004,6 +1005,7 @@ extension KMToolbarController: KMToolbarViewControllerDelegate {
                 if resp != .alertFirstButtonReturn {  // 取消
                     return
                 }
+                control?.redactPdfView.newAddAnnotation.removeAll()
             }
         }
         
@@ -1055,6 +1057,7 @@ extension KMToolbarController: KMToolbarViewControllerDelegate {
                 if resp != .alertFirstButtonReturn {  // 取消
                     return
                 }
+                control?.redactPdfView.newAddAnnotation.removeAll()
             }
         }
         

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

@@ -234,7 +234,9 @@ class KMToolbarViewController: NSViewController, NSTextFieldDelegate {
         if tag == .editPDF {
             if IAPProductsManager.default().isAvailableAllFunction() == false {
                 KMPreference.shared.openDocumentType = .newWindow
-                KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+                let winC = KMPurchaseCompareWindowController.sharedInstance()
+                winC?.kEventName = "Reading_EditPDF_BuyNow"
+                winC?.showWindow(nil)
                 return
             }
             let allowsPrinting = self.pdfView?.document?.allowsPrinting ?? false

+ 183 - 26
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+Action.swift

@@ -1092,7 +1092,7 @@ extension KMMainViewController {
         window.km_beginSheet(windowC: cropVC)
         cropVC.cropWindowCloseBlock = { [weak self] doc in
             window.km_quick_endSheet()
-            let isSuccessful = doc.write(to: self?.listView.document.documentURL)
+            let isSuccessful = doc.write(to: self?.listView.document?.documentURL)
             if isSuccessful {
                 if let documen = CPDFDocument(url: self?.document?.documentURL) {
                     if documen.isLocked {
@@ -1510,6 +1510,8 @@ extension KMMainViewController {
         KMPrintWindowController.printImage(image: image)
     }
     
+    // MARK: - Measure
+    
     @objc func menuItemActionMeasureProperty(sender: NSMenuItem) {
         guard let anno = sender.representedObject as? CPDFAnnotation else {
             return
@@ -1540,9 +1542,14 @@ extension KMMainViewController {
         }
         
         self.listView.updateActiveAnnotations([anno])
-        self.pdfListViewAnnotationMeasureInfoChange(self.listView, with: anno)
-        self.pdfListViewChangeatioActiveAnnotations(self.listView, forActiveAnnotations: [anno], isRightMenu: false)
         self.listView.setNeedsDisplayForVisiblePages()
+        if let data = anno as? CPDFLineAnnotation, data.isMeasure {
+            self.showMeasureDistanceSettingWindow(measureInfo: data.measureInfo)
+        } else if let data = anno as? CPDFPolylineAnnotation {
+            self.showMeasurePerimeterSettingWindow(measureInfo: data.measureInfo)
+        } else if let data = anno as? CPDFPolygonAnnotation {
+            self.showMeasureAreaSettingWindow(measureInfo: data.measureInfo)
+        }
     }
     
     @objc func menuItemActionMeasureDelete(sender: NSMenuItem) {
@@ -1553,6 +1560,42 @@ extension KMMainViewController {
         self.listView.remove(anno)
     }
     
+    func showMeasureDistanceSettingWindow(measureInfo: CPDFDistanceMeasureInfo?, hideInfoWindow: Bool = true) {
+        guard let mInfo = measureInfo else {
+            return
+        }
+        let winC = CDistanceSettingWindowController(distanceMeasureInfo: mInfo)
+        if hideInfoWindow {
+            self.distanceMeasureInfoWindowController?.hideFloatingWindow()
+        }
+        winC.delegate = self
+        winC.startModal("")
+    }
+    
+    func showMeasurePerimeterSettingWindow(measureInfo: CPDFPerimeterMeasureInfo?, hideInfoWindow: Bool = true) {
+        guard let mInfo = measureInfo else {
+            return
+        }
+        let winC = CDistanceSettingWindowController(perimeterMeasureInfo: mInfo)
+        if hideInfoWindow {
+            self.perimeterMeasureInfoWindowController?.hideFloatingWindow()
+        }
+        winC.delegate = self
+        winC.startModal("")
+    }
+    
+    func showMeasureAreaSettingWindow(measureInfo: CPDFAreaMeasureInfo?, hideInfoWindow: Bool = true) {
+        guard let mInfo = measureInfo else {
+            return
+        }
+        let winC = CAreaSettingWindowController(measureInfo: mInfo)
+        if hideInfoWindow {
+            self.areaMeasureInfoWindowController?.hideFloatingWindow()
+        }
+        winC.delegate = self
+        winC.startModal("")
+    }
+    
     func splitView(withTag tag: Int) {
         if tag == 0 {
             self.listView.viewSplitMode = KMPDFViewSplitMode.horizontal
@@ -1682,7 +1725,7 @@ extension KMMainViewController {
         }
         
         let windowController = KMRedactMutilPageFlagWindowController(windowNibName: "KMRedactBaseWindowController")
-        windowController.pageCount = Int(self.listView.document.pageCount)
+        windowController.pageCount = Int(self.listView.document?.pageCount ?? 0)
         self.currentWindowController = windowController
         self.view.window?.beginSheet(windowController.window!)
         windowController.itemClick = { [weak self] index, value in
@@ -1696,7 +1739,7 @@ extension KMMainViewController {
             let pageType = windowController_mutilPageFlag.pageType
             let pageString = windowController_mutilPageFlag.pageString
             if (pageType == 4) { /// 自定义页面
-                let array = KMPageRangeTools.findSelectPage(pageRangeString: pageString, pageCount: Int((self?.listView.document.pageCount)!))
+                let array = KMPageRangeTools.findSelectPage(pageRangeString: pageString, pageCount: Int((self?.listView.document?.pageCount) ?? 0))
                 if (array.count == 0) {
                     let alert = NSAlert()
                     alert.messageText = NSLocalizedString("Invalid page range or the page number is out of range. Please try again.", comment: "")
@@ -1708,13 +1751,13 @@ extension KMMainViewController {
             self!.view.window?.endSheet(self!.currentWindowController.window!)
             self!.currentWindowController = nil
             
-            let indexs = KMRedactTools.getPageIndexs(pageType, string: pageString, Int((self?.listView.document.pageCount)!))
+            let indexs = KMRedactTools.getPageIndexs(pageType, string: pageString, Int((self?.listView.document?.pageCount) ?? 0))
             if (indexs.count == 0) {
                 return
             }
             
             for i in indexs {
-                let page: CPDFPage = (self?.listView.document.page(at: UInt(i)))!
+                let page: CPDFPage = (self?.listView.document?.page(at: UInt(i)))!
                 let redactAnno = KMRedactTools.createRedactAnnotation((self?.listView.document)!, anno as! CPDFRedactAnnotation)
                 self?.listView.add(redactAnno, to: page)
             }
@@ -1763,7 +1806,7 @@ extension KMMainViewController {
                 let pdfdocument = CPDFDocument()
                 let signatureImagePath = NSSearchPathForDirectoriesInDomains(.applicationSupportDirectory, .userDomainMask, true).first?.stringByAppendingPathComponent("signatureImage.png")
                 if NSData(data: data!).write(to: URL(fileURLWithPath: signatureImagePath!), atomically: true) {
-                    pdfdocument?.insertPage(image.size, withImage: signatureImagePath, at: 0)
+                    pdfdocument?.km_insertPage(image.size, withImage: signatureImagePath!, at: 0)
                     let savePanel = NSSavePanel()
                     savePanel.allowedFileTypes = ["pdf"]
                     savePanel.beginSheetModal(for: self.view.window!) { response in
@@ -2982,10 +3025,17 @@ extension KMMainViewController {
     //MARK: 转档 - OCR
     func showOCRWindow() {
         if !IAPProductsManager.default().isAvailableAllFunction(){
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            let winC = KMPurchaseCompareWindowController.sharedInstance()
+            let type = self.toolbarController.toolbarType ?? .None
+            if type == .Conversion {
+                winC?.kEventName = "Reading_Convert_OCR_BuyNow"
+            } else {
+                winC?.kEventName = "Reading_OCR_BuyNow"
+            }
+            winC?.showWindow(nil)
             return
         }
-        let com = KMOCRPDFWindowController(cpdfDocument: self.listView.document!, pwd: self.listView.document.password)
+        let com = KMOCRPDFWindowController(cpdfDocument: self.listView.document!, pwd: self.listView.document?.password ?? "")
         com.currentIndexPage = self.listView.currentPageIndex
         self.km_beginSheet(windowC: com)
     }
@@ -2993,7 +3043,9 @@ extension KMMainViewController {
     //MARK: 导出图片
     func extractImageAction(num: Int) {
         if !IAPProductsManager.default().isAvailableAllFunction(){
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            let winC = KMPurchaseCompareWindowController.sharedInstance()
+            winC?.kEventName = "Reading_ExtractImage_BuyNow"
+            winC?.showWindow(nil)
             return
         }
         
@@ -3210,7 +3262,9 @@ extension KMMainViewController {
         FMTrackEventManager.defaultManager.trackEvent(event: "SubTbr_Tools", withProperties: ["SubTbr_Btn": "Btn_SubTbr_Tools_Table"])
         changeAnnotationMode(sender)
         guard IAPProductsManager.default().isAvailableAllFunction() else {
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            let winC = KMPurchaseCompareWindowController.sharedInstance()
+            winC?.kEventName = "Reading_Table_BuyNow"
+            winC?.showWindow(nil)
             return
         }
         listView.addAnnotationWithTable()
@@ -3693,7 +3747,9 @@ extension KMMainViewController : KMMainToolbarControllerDelegate {
     
     func toolbarViewController(_ viewController: KMToolbarViewController, shareFlatten item: NSMenuItem) {
         if IAPProductsManager.default().isAvailableAllFunction() == false {
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            let winC = KMPurchaseCompareWindowController.sharedInstance()
+            winC?.kEventName = "Reading_Flatten_BuyNow"
+            winC?.showWindow(nil)
             return
         }
         self.shareFlatten(sender: viewController)
@@ -3760,7 +3816,17 @@ extension KMMainViewController : KMMainToolbarControllerDelegate {
                 }
                 return
             }
-            self.enterRedact()
+            let isEdited = self.listView.isEdited()
+            let isPDFTextImageEdited =  self.model.isPDFTextImageEdited
+            if isEdited || isPDFTextImageEdited {
+                self.commitEditingIfNeed()
+                
+//                DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
+                    self.enterRedact()
+//                }
+            } else {
+                self.enterRedact()
+            }
         } else if type == .Tool {
             if KMGuideInfoWindowController.availableShow(.pdfCompareGuide) {
                 self.loadOpenFileFunctionGuide(.pdfCompareGuide)
@@ -3854,7 +3920,21 @@ extension KMMainViewController : KMMainToolbarControllerDelegate {
             if (type == .bates || type == .headerAndFooter) {
                 
                 if !IAPProductsManager.default().isAvailableAllFunction(){
-                    KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+                    let winC = KMPurchaseCompareWindowController.sharedInstance()
+                    if type == .headerAndFooter {
+                        if index == 1 {
+                            winC?.kEventName = "Reading_AddHeaderFooter_BuyNow"
+                        } else if index == 2 {
+                            winC?.kEventName = "Reading_RemoveHeaderFooter_BuyNow"
+                        }
+                    } else if type == .bates {
+                        if index == 1 {
+                            winC?.kEventName = "Reading_AddBates_BuyNow"
+                        } else if index == 2 {
+                            winC?.kEventName = "Reading_RemoveBates_BuyNow"
+                        }
+                    }
+                    winC?.showWindow(nil)
                     return
                 }
                 
@@ -3926,6 +4006,10 @@ extension KMMainViewController : KMMainToolbarControllerDelegate {
                         savePanel.beginSheetModal(for: NSWindow.currentWindow()) { [unowned self] result in
                             if result.rawValue == NSApplication.ModalResponse.OK.rawValue {
                                 KMHeaderFooterView.saveAsPDFRemoveAllHeaderFooter(document!, password: document?.password, toPath: savePanel.url!.path) { success in
+                                    if success == 1 &&  savePanel.url?.path == self.listView?.document?.documentURL.path {
+                                        self.setDocument = CPDFDocument(url: savePanel.url!)
+                                        return
+                                    }
                                     if savePanelAccessoryViewController.openAutomaticButton.state == .on {
                                         NSDocumentController.shared.openDocument(withContentsOf: URL(fileURLWithPath: savePanel.url!.path), display: true) { _, _, _ in
                                         }
@@ -3944,6 +4028,10 @@ extension KMMainViewController : KMMainToolbarControllerDelegate {
                         savePanel.beginSheetModal(for: NSWindow.currentWindow()) { [unowned self] result in
                             if result.rawValue == NSApplication.ModalResponse.OK.rawValue {
                                 KMHeaderFooterView.saveAsPDFRemoveAllHeaderFooterBates(document!, password: document?.password, toPath: savePanel.url!.path) { success in
+                                    if success == 1 &&  savePanel.url?.path == self.listView?.document?.documentURL.path {
+                                        self.setDocument = CPDFDocument(url: savePanel.url!)
+                                        return
+                                    }
                                     if savePanelAccessoryViewController.openAutomaticButton.state == .on {
                                         NSDocumentController.shared.openDocument(withContentsOf: URL(fileURLWithPath: savePanel.url!.path), display: true) { _, _, _ in
                                         }
@@ -4056,7 +4144,7 @@ extension KMMainViewController : KMMainToolbarControllerDelegate {
                         let pageType = windowController_pageRange.pageType
                         let pageString = windowController_pageRange.pageString
                         if (pageType == 5) { /// 自定义页面
-                            let array = KMPageRangeTools.findSelectPage(pageRangeString: pageString, pageCount: Int((self?.listView.document.pageCount)!))
+                            let array = KMPageRangeTools.findSelectPage(pageRangeString: pageString, pageCount: Int((self?.listView.document?.pageCount) ?? 0))
                             if (array.count == 0) {
                                 let alert = NSAlert()
                                 alert.messageText = NSLocalizedString("Invalid page range or the page number is out of range. Please try again.", comment: "")
@@ -4071,7 +4159,7 @@ extension KMMainViewController : KMMainToolbarControllerDelegate {
                         if (pageType == 1) { /// 当前页面
                             indexs.insert((self?.listView.currentPageIndex)!)
                         } else {
-                            indexs = KMRedactTools.getPageIndexs(pageType-1, string: pageString, Int((self?.listView.document.pageCount)!))
+                            indexs = KMRedactTools.getPageIndexs(pageType-1, string: pageString, Int((self?.listView.document?.pageCount) ?? 0))
                         }
                         
                         if (indexs.count == 0) {
@@ -4213,7 +4301,9 @@ extension KMMainViewController : KMMainToolbarControllerDelegate {
             } else if type == .comparison {
                 FMTrackEventManager.defaultManager.trackEvent(event: "SubTbr_Editor", withProperties: ["SubTbr_Btn": "Btn_SubTbr_Editor_Compare"])
                 if !IAPProductsManager.default().isAvailableAllFunction(){
-                    KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+                    let winC = KMPurchaseCompareWindowController.sharedInstance()
+                    winC?.kEventName = "Reading_Compare_BuyNow"
+                    winC?.showWindow(nil)
                     return
                 }
                 
@@ -4250,7 +4340,13 @@ extension KMMainViewController : KMMainToolbarControllerDelegate {
                 await NSWindow.currentWindow().beginSheet(controller.window!)
             } else if type == .watermark {
                 if !IAPProductsManager.default().isAvailableAllFunction(){
-                    KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+                    let winC = KMPurchaseCompareWindowController.sharedInstance()
+                    if index == 1 {
+                        winC?.kEventName = "Reading_AddWatermark_BuyNow"
+                    } else if index == 2 {
+                        winC?.kEventName = "Reading_RemoveWatermark_BuyNow"
+                    }
+                    winC?.showWindow(nil)
                     return
                 }
                 
@@ -4318,12 +4414,24 @@ extension KMMainViewController : KMMainToolbarControllerDelegate {
                             if (result) {
                                 let alert = NSAlert()
                                 alert.alertStyle = .warning
-                                alert.messageText = "成功"
+                                alert.messageText = NSLocalizedString("Finish", comment: "")
                                 alert.runModal()
+                                
+                                if savePanel.url?.path == self.listView?.document?.documentURL.path {
+                                    self.setDocument = CPDFDocument(url: savePanel.url!)
+                                    return
+                                }
+                                
+                                let needOpen = savePanelAccessoryViewController.needOpen
+                                if needOpen {
+                                    NSDocumentController.shared.km_safe_openDocument(withContentsOf: savePanel.url!, display: true) { document, hasOpen, err in }
+                                } else {
+                                    NSWorkspace.shared.activateFileViewerSelecting([savePanel.url!])
+                                }
                             } else {
                                 let alert = NSAlert()
                                 alert.alertStyle = .critical
-                                alert.messageText = "失败"
+                                alert.messageText = NSLocalizedString("Failed", comment: "")
                                 alert.runModal()
                             }
                         }
@@ -4342,7 +4450,13 @@ extension KMMainViewController : KMMainToolbarControllerDelegate {
                 }
             } else if type == .background {
                 if !IAPProductsManager.default().isAvailableAllFunction(){
-                    KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+                    let winC = KMPurchaseCompareWindowController.sharedInstance()
+                    if index == 1 {
+                        winC?.kEventName = "Reading_AddBackground_BuyNow"
+                    } else if index == 2 {
+                        winC?.kEventName = "Reading_RemoveBackground_BuyNow"
+                    }
+                    winC?.showWindow(nil)
                     return
                 }
                 
@@ -4390,6 +4504,11 @@ extension KMMainViewController : KMMainToolbarControllerDelegate {
 
                         KMAddBackgroundView.saveAsPDFRemoveAllBackground(PDFDocument: document, password: document.password, toPath: savePanel.url!.path, completionHandler: { [unowned self] success in
                             if success == 1 {
+                                if savePanel.url?.path == self.listView?.document?.documentURL.path {
+                                    self.setDocument = CPDFDocument(url: savePanel.url!)
+                                    return
+                                }
+                                
                                 if savePanelAccessoryViewController.openAutomaticButton.state == .on {
                                     NSDocumentController.shared.openDocument(withContentsOf: savePanel.url!, display: true) { _, _, _ in }
                                 } else {
@@ -4412,7 +4531,9 @@ extension KMMainViewController : KMMainToolbarControllerDelegate {
                 }
             } else if type == .measure {
                 if !IAPProductsManager.default().isAvailableAllFunction(){
-                    KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+                    let winC = KMPurchaseCompareWindowController.sharedInstance()
+                    winC?.kEventName = "Reading_Measure_BuyNow"
+                    winC?.showWindow(nil)
                     return
                 }
                 
@@ -4466,6 +4587,8 @@ extension KMMainViewController : KMMainToolbarControllerDelegate {
                     self.toolbarController.findItem(KMToolbarMeasureItemIdentifier)?.isSelected = true
                     
                     _ = CustomAlertView.alertView(message: "ESC to exit continuous measuring mode.", fromView: self.view, withStyle: .black)
+                    
+                    self.trackEvent(toolMode: .measureToolMode)
                 } else if index == 2 {
                     self.listView.annotationType = .polyLine
 
@@ -4481,6 +4604,8 @@ extension KMMainViewController : KMMainToolbarControllerDelegate {
                     self.toolbarController.findItem(KMToolbarMeasureItemIdentifier)?.isSelected = true
                     
                     _ = CustomAlertView.alertView(message: "Double-click to finish drawing. Press ESC to exit continuous measuring mode.", fromView: self.view, withStyle: .black)
+                    
+                    self.trackEvent(toolMode: .measureToolMode)
                 } else if index == 3 {
                     self.listView.annotationType = .polyGon
 
@@ -4496,6 +4621,8 @@ extension KMMainViewController : KMMainToolbarControllerDelegate {
                     self.toolbarController.findItem(KMToolbarMeasureItemIdentifier)?.isSelected = true
                     
                     _ = CustomAlertView.alertView(message: "Double-click to finish drawing. Press ESC to exit continuous measuring mode.", fromView: self.view, withStyle: .black)
+                    
+                    self.trackEvent(toolMode: .measureToolMode)
                 } else if index == 4 {
                     self.listView.annotationType = .square
 
@@ -4511,6 +4638,8 @@ extension KMMainViewController : KMMainToolbarControllerDelegate {
                     self.toolbarController.findItem(KMToolbarMeasureItemIdentifier)?.isSelected = true
                     
                     _ = CustomAlertView.alertView(message: "ESC to exit continuous measuring mode.", fromView: self.view, withStyle: .black)
+                    
+                    self.trackEvent(toolMode: .measureToolMode)
                 } else {
                     if let isVisible = distanceMeasureInfoWindowController!.window?.isVisible, isVisible {
                         distanceMeasureInfoWindowController?.hideFloatingWindow()
@@ -4872,7 +5001,9 @@ extension KMMainViewController : KMMainToolbarControllerDelegate {
                 winC.startModal(nil)
             } else if index == 12 {
                 if IAPProductsManager.default().isAvailableAllFunction() == false {
-                    KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+                    let winC = KMPurchaseCompareWindowController.sharedInstance()
+                    winC?.kEventName = "Reading_ReplaceText_BuyNow"
+                    winC?.showWindow(nil)
                     return
                 }
                 
@@ -4885,6 +5016,7 @@ extension KMMainViewController : KMMainToolbarControllerDelegate {
                     self.toolbarController.clickItem(KMDocumentEditToolbarItemIdentifier)
                 }
                 
+                self.trackEvent_replace()
                 let winC = KMSearchReplaceWindowController(with: self.listView, type: .replace)
                 self.currentWindowController = winC
                 winC.replaceCallback = { [weak self] in
@@ -5144,6 +5276,10 @@ extension KMMainViewController : CDistanceSettingWindowControllerDelegate {
                 self.distanceMeasureInfoWindowController?.xLabel.stringValue = ""
                 self.distanceMeasureInfoWindowController?.yLabel.stringValue = ""
             }
+            
+            if let data = self.listView?.activeAnnotation {
+                self.leftSideViewController.refreshUIForAnnoAttributeDidChange(data, attributes: nil)
+            }
         }
         self.distanceMeasureInfoWindowController?.showWindow(self)
     }
@@ -5162,7 +5298,12 @@ extension KMMainViewController : CDistanceSettingWindowControllerDelegate {
                 self.perimeterMeasureInfoWindowController?.lengthLabel.stringValue = ""
                 self.perimeterMeasureInfoWindowController?.angleLabel.stringValue = ""
             }
+            
+            if let data = self.listView?.activeAnnotation {
+                self.leftSideViewController.refreshUIForAnnoAttributeDidChange(data, attributes: nil)
+            }
         }
+        
         self.perimeterMeasureInfoWindowController?.showWindow(self)
     }
 }
@@ -5215,6 +5356,12 @@ extension KMMainViewController : CAreaSettingWindowControllerDelegate {
             }
             self.areaMeasureInfoWindowController?.showWindow(self)
         }
+        
+        if measureInfo != nil {
+            if let data = self.listView?.activeAnnotation {
+                self.leftSideViewController.refreshUIForAnnoAttributeDidChange(data, attributes: nil)
+            }
+        }
     }
 }
 
@@ -5502,8 +5649,10 @@ extension KMMainViewController {
             FMTrackEventManager.defaultManager.trackEvent(event: "SubTbr_Form", withProperties: ["SubTbr_Btn" : "Btn_SubTbr_Form_Button"])
         } else if (type == .signature) {
             FMTrackEventManager.defaultManager.trackEvent(event: "SubTbr_Form", withProperties: ["SubTbr_Btn" : "Btn_SubTbr_Form_Signature"])
-        } else {
-            
+        } else if (type == .squiggly) {
+            FMTrackEventManager.defaultManager.trackEvent(event: "SubTbr_Tools", withProperties: ["SubTbr_Btn" : "Btn_SubTbr_Tools_Squiglly"])
+        } else if (type == .eraser) {
+            FMTrackEventManager.defaultManager.trackEvent(event: "SubTbr_Tools", withProperties: ["SubTbr_Btn" : "Btn_SubTbr_Tools_Erasder"])
         }
     }
     
@@ -5516,6 +5665,8 @@ extension KMMainViewController {
             KMAnalytics.trackEvent(eventName: "Btn_SubTbr_Scroll", parameters: [
                 KMAnalytics.Parameter.categoryKey : KMAnalytics.Category.subTbr_annotation,
                 KMAnalytics.Parameter.labelKey : KMAnalytics.Label.subTbr_Btn], platform: .AppCenter, appTarget: .all)
+        } else if mode == .measureToolMode {
+            FMTrackEventManager.defaultManager.trackEvent(event: "SubTbr_Editor", withProperties: ["SubTbr_Btn" : "Btn_SubTbr_Editor_Measure"])
         }
     }
     
@@ -5558,6 +5709,12 @@ extension KMMainViewController {
             KMAnalytics.Parameter.categoryKey : KMAnalytics.Category.subTbr_Tools,
             KMAnalytics.Parameter.labelKey : KMAnalytics.Label.subTbr_Btn], platform: .AppCenter, appTarget: .all)
     }
+    
+    func trackEvent_replace() -> Void {
+        KMAnalytics.trackEvent(eventName: "Btn_Tbr_ReplaceText", parameters: [
+            KMAnalytics.Parameter.categoryKey : KMAnalytics.Category.tbr,
+            KMAnalytics.Parameter.labelKey : KMAnalytics.Label.tbr_Btn], platform: .AppCenter, appTarget: .all)
+    }
 }
 
 extension KMMainViewController {

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

@@ -1215,7 +1215,10 @@ extension KMMainViewController: KMSystemToolMenuProtocol {
     
     func rotateLeft(_ sender: Any?) {
         if IAPProductsManager.default().isAvailableAllFunction() == false {
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            let winC = KMPurchaseCompareWindowController.sharedInstance()
+            winC?.kEventName = "Reading_Rotate_BuyNow"
+            winC?.kEventTag = 1
+            winC?.showWindow(nil)
             return
         }
         
@@ -1231,7 +1234,10 @@ extension KMMainViewController: KMSystemToolMenuProtocol {
     
     func rotateRight(_ sender: Any?) {
         if IAPProductsManager.default().isAvailableAllFunction() == false {
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            let winC = KMPurchaseCompareWindowController.sharedInstance()
+            winC?.kEventName = "Reading_Rotate_BuyNow"
+            winC?.kEventTag = 1
+            winC?.showWindow(nil)
             return
         }
         

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

@@ -28,7 +28,7 @@ extension KMMainViewController {
     
     @IBAction func stopSpeaking(_ sender: Any) {
         let ttsWindowC = KMTTSWindowController.share
-        if ttsWindowC.pdfView?.document?.documentURL.path == self.listView.document.documentURL.path {
+        if ttsWindowC.pdfView?.document?.documentURL.path == self.listView.document?.documentURL.path {
             if let data = ttsWindowC.window?.isVisible, data {
                 ttsWindowC.stopSpeaking()
                 ttsWindowC.close()
@@ -181,7 +181,7 @@ extension KMMainViewController {
             return
         }
         DispatchQueue.main.async {
-            self.beginProgressSheet(withMessage: NSLocalizedString("Converting notes", comment: "Message for progress sheet").appending("..."), maxValue: 0)
+            self.beginProgressSheet(withMessage: "", maxValue: 0)
             
             let count = pdfDocument.pageCount
             DispatchQueue.global().async {
@@ -305,14 +305,32 @@ extension KMMainViewController: KMToolbarControllerDelegate {
     func changeAnnotationModeAction(item: KMToolbarClickButton) {
         if self.listView.toolMode == .formToolMode {
             if !IAPProductsManager.default().isAvailableAllFunction(){
-                KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+                let winC = KMPurchaseCompareWindowController.sharedInstance()
+                if let type = CAnnotationType(rawValue: item.tag) {
+                    if type == .textField {
+                        winC?.kEventName = "Reading_TextField_BuyNow"
+                    } else if type == .checkBox {
+                        winC?.kEventName = "Reading_CheckBox_BuyNow"
+                    } else if type == .radioButton {
+                        winC?.kEventName = "Reading_RadioButton_BuyNow"
+                    } else if type == .listMenu {
+                        winC?.kEventName = "Reading_ListBox_BuyNow"
+                    } else if type == .comboBox {
+                        winC?.kEventName = "Reading_ComboBox_BuyNow"
+                    } else if type == .actionButton {
+                        winC?.kEventName = "Reading_Button_BuyNow"
+                    }
+                }
+                winC?.showWindow(nil)
                 return
             }
         } else {
             let type = CAnnotationType(rawValue: item.tag) ?? CAnnotationType.unkown
             if type == .signature {
                 if !IAPProductsManager.default().isAvailableAllFunction(){
-                    KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+                    let winC = KMPurchaseCompareWindowController.sharedInstance()
+                    winC?.kEventName = "Reading_ElectronicSign_BuyNow"
+                    winC?.showWindow(nil)
                     return
                 }
             }
@@ -385,6 +403,8 @@ extension KMMainViewController: KMToolbarControllerDelegate {
         
         if self.listView.toolMode != .editPDFToolMode && self.listView.annotationType != .unkown {
             self.rightSideViewController.isHidden = false
+            let toolMode = self.listView?.toolMode ?? .none
+            self.rightSideViewController.kEventTag = toolMode == .selfSignMode ? 1 : 0
             self.rightSideViewController.subViewType = .AnnotationProperts
             if !self.isReadMode {
                 self.openRightPane()
@@ -779,7 +799,7 @@ extension KMMainViewController {
         readToolbarType = self.toolbarController.toolbarType
         readToolMode = self.listView.toolMode
         readAnnotationType = self.listView.annotationType
-        readSubViewType = self.rightSideViewController.subViewType ?? .None
+        readSubViewType = self.rightSideViewController?.subViewType ?? .None
         
         if self.toolbarController.lastItemBox.isSelected {
             readToolbarItemIdentifier = self.toolbarController.lastItemBox.itemIdentifier ?? ""
@@ -809,7 +829,7 @@ extension KMMainViewController {
         //阅读界面初始化
         self.readModelView.isHidden = false
         self.readModelView.currentPageIndex = self.listView.currentPageIndex
-        self.readModelView.totalPagesCount = Int(self.listView.document?.pageCount ?? 0)
+        self.readModelView.totalPagesCount = Int(self.listView?.document?.pageCount ?? 0)
         self.readModelView.beginTimer()
 //        self.listView.autoScales = true
 //        self.readModelView.scaleType = .autoSize
@@ -1169,7 +1189,7 @@ extension KMMainViewController: CPDFViewDelegate,CPDFListViewDelegate {
     func pdfViewPerformReset(_ pdfView: CPDFView!) {
         KMPrint("pdfViewPerformReset")
 //        self.listView.resetFormAnnotation()
-        pdfView.document.resetForm()
+        pdfView.document?.resetForm()
     }
     
     func pdfViewEditingBlockDidChanged(_ pdfView: CPDFView!) {

+ 111 - 68
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController.swift

@@ -217,7 +217,7 @@ import Cocoa
         NotificationCenter.default.removeObserver(self)
         
         self.listView.delegate = nil
-        self.listView.document.delegate = nil
+        self.listView.document?.delegate = nil
         
         self.editPDFHanddler.clearData()
         self.removeEventMonitor()
@@ -240,10 +240,10 @@ import Cocoa
                 
 //            }
             
-            DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.3) {
+//            DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.3) {
                 self.listView.document = self.document
-                self.listView.document.delegate = self
-            }
+                self.listView.document?.delegate = self
+//            }
             
             let autoScale = listView.autoScales
             if !autoScale {
@@ -306,7 +306,7 @@ import Cocoa
             return
         }
         if (self.model.password != nil) {
-            if self.listView.document.unlock(withPassword: self.model.password) {
+            if let data = self.listView.document?.unlock(withPassword: self.model.password), data {
                 self.model.isSaveKeyChain = false
                 if self.model.needConvertNotes && self.tabViewIsDragging() == false {
                     self.showConvertNotesProgress()
@@ -395,9 +395,9 @@ import Cocoa
         
         if (KMPreferenceManager.shared.openLastUnlockedDocumentWhenAppStart) {
             if (self.listView.document != nil) {
-                let pageNumber = KMPreferenceManager.shared.getPageNumber(forKey: self.listView.document.documentURL.path)
-                let pageScale = KMPreferenceManager.shared.getPageScale(forKey: self.listView.document.documentURL.path)
-                if (pageNumber != nil && pageNumber! >= 0 && pageNumber! < self.listView.document.pageCount) {
+                let pageNumber = KMPreferenceManager.shared.getPageNumber(forKey: self.listView.document?.documentURL.path ?? "")
+                let pageScale = KMPreferenceManager.shared.getPageScale(forKey: self.listView.document?.documentURL.path ?? "")
+                if (pageNumber != nil && pageNumber! >= 0 && pageNumber! < (self.listView.document?.pageCount ?? 0)) {
                     DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
                         if (pageScale != nil) {
                             self.listView.scaleFactor = CGFloat(pageScale!)
@@ -481,11 +481,6 @@ import Cocoa
                 self.showSnapshots(setups: snapshotSetups)
             }
         }
-        
-        let readModel = UserDefaults.standard.bool(forKey: "kKMPDFViewIsReadMode")
-        if readModel == true {
-            self.openReadModel()
-        }
 
         let hasWindowSetup = savedNormalSetup.count > 0
         if UserDefaults.standard.dictionary(forKey: KMDefaultPDFDisplaySettingsKey) != nil {
@@ -594,7 +589,7 @@ import Cocoa
         if self.model.leftPanelOpen {
             return
         }
-        Task { @MainActor in
+        KMMainThreadExecute {
             self.leftSideViewController.showThumbnail()
             self.toolbarController.findItem(KMLeftControlToolbarItemIdentifier)?.isSelected = true
         }
@@ -623,6 +618,12 @@ import Cocoa
     }
     
     @objc func cancelMeasureType() {
+        self.hideMeasureFloatingWindows()
+        
+        self.toolbarController.findItem(KMToolbarMeasureItemIdentifier)?.isSelected = false
+    }
+    
+    func hideMeasureFloatingWindows() {
         if distanceMeasureInfoWindowController?.window?.isVisible == true {
             distanceMeasureInfoWindowController?.hideFloatingWindow()
         } else if perimeterMeasureInfoWindowController?.window?.isVisible == true {
@@ -630,8 +631,23 @@ import Cocoa
         } else if areaMeasureInfoWindowController?.window?.isVisible == true {
             areaMeasureInfoWindowController?.hideFloatingWindow()
         }
-        
-        self.toolbarController.findItem(KMToolbarMeasureItemIdentifier)?.isSelected = false
+    }
+    
+    func showMeasureFloatingWindowsIfNeed() {
+        let toolMode = self.listView?.toolMode ?? .none
+        if toolMode != .measureToolMode {
+            return
+        }
+        let type = self.listView?.annotationType ?? .none
+        if type == .line {
+            self.distanceMeasureInfoWindowController?.window?.orderFront(nil)
+        } else if type == .polyLine {
+            self.perimeterMeasureInfoWindowController?.window?.orderFront(nil)
+        } else if type == .polyGon {
+            self.areaMeasureInfoWindowController?.window?.orderFront(nil)
+        } else if type == .square {
+            self.areaMeasureInfoWindowController?.window?.orderFront(nil)
+        }
     }
     
     // MARK: Set Methods
@@ -657,13 +673,13 @@ import Cocoa
             return pageNumber!
         }
         set {
-            let pageCount = listView.document.pageCount
+            let pageCount = listView.document?.pageCount ?? 0
             var value = newValue
             if value > pageCount {
                 value = pageCount
             }
             if value > 0 && listView.currentPage().pageIndex() != value-1 {
-                listView.go(to: listView.document.page(at: value-1))
+                listView.go(to: listView.document?.page(at: value-1))
             }
             if pageNumber != value {
                 pageNumber = value
@@ -675,11 +691,13 @@ import Cocoa
     
     func enterRedact() {
         if !IAPProductsManager.default().isAvailableAllFunction(){
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            let winC = KMPurchaseCompareWindowController.sharedInstance()
+            winC?.kEventName = "Reading_Redact_BuyNow"
+            winC?.showWindow(nil)
             return
         }
         
-        if self.listView.document.allowsPrinting == false || self.listView.document.allowsCopying == false {
+        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))
             }
@@ -691,6 +709,8 @@ import Cocoa
             return
         }
         
+        self.commitEditingIfNeed()
+        
         self.leftSideViewController.thumbnailTableView.isEnabled = false
         self.leftSideViewController.tocOutlineView.isEnabled = false
         self.leftSideViewController.noteOutlineView.isEnabled = false
@@ -700,7 +720,7 @@ import Cocoa
         
         
         let ttsWindowC = KMTTSWindowController.share
-        if ttsWindowC.pdfView?.document?.documentURL.path == self.listView.document.documentURL.path {
+        if ttsWindowC.pdfView?.document?.documentURL.path == self.listView.document?.documentURL.path {
             if let data = ttsWindowC.window?.isVisible, data {
                 ttsWindowC.stopSpeaking()
                 ttsWindowC.close()
@@ -708,7 +728,7 @@ import Cocoa
         }
         NSColorPanel.shared.showsAlpha = false
         
-        redactController = KMPDFRedactViewController(url: self.listView.document!.documentURL, password: self.listView.document.password)
+        redactController = KMPDFRedactViewController(url: self.listView.document!.documentURL, password: self.listView.document?.password)
         self.addChild(redactController)
         self.PDFContendView.addSubview(redactController.view)
         redactController.view.frame = self.PDFContendView.bounds
@@ -732,7 +752,7 @@ import Cocoa
             if saveResult {
                 let newDocument = CPDFDocument(url: saveUrl)
                 if let data = newDocument?.isLocked, data {
-                    newDocument?.unlock(withPassword: self?.listView.document.password ?? "")
+                    newDocument?.unlock(withPassword: self?.listView.document?.password ?? "")
                 }
                 self?.document = newDocument
                 self?.listView.document = newDocument
@@ -753,13 +773,13 @@ import Cocoa
         let controller = self._getPDFRedactController()
         if let data = controller {
             if data.redactPdfView.newAddAnnotation.count > 0 {
-//                KMAlertTool.runModel(message: "", informative: KMLocalizedString("There are unapplied redactions in this file. Exit will not save redaction.", nil), buttons: [KMLocalizedString("Exit", nil), KMLocalizedString("Cancel", nil)]) { response in
-//                    if response == .alertFirstButtonReturn {
-                controller?.redactPdfView.newAddAnnotation.removeAll()
-//                        self.exitRedact()
-//                    }
-//                }
-//                return
+                KMAlertTool.runModel(message: "", informative: KMLocalizedString("There are unapplied redactions in this file. Exit will not save redaction.", nil), buttons: [KMLocalizedString("Exit", nil), KMLocalizedString("Cancel", nil)]) { response in
+                    if response == .alertFirstButtonReturn {
+                        controller?.redactPdfView.newAddAnnotation.removeAll()
+                        self.exitRedact()
+                    }
+                }
+                return
             }
         }
         NSColorPanel.shared.showsAlpha = true
@@ -919,7 +939,7 @@ import Cocoa
             guideWC.show()
             
         } else if showType == .pdfCompareGuide && KMGuideInfoWindowController.availableShow(.pdfCompareGuide) {
-            DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 1) {
+            DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.2) {
                 self.guideInfoWindowController = KMGuideInfoWindowController.currentWC()
                 guard let guideWC = self.guideInfoWindowController else { return }
                 
@@ -928,10 +948,13 @@ import Cocoa
                 guard let digitalPanelItem = self.toolbarController.findItem(KMDocumentSignToolbarItemIdentifier) else {
                     return
                 }
-                guideWC.digitalBoxRect = (self.view.window?.contentView?.convert(digitalPanelItem.frame, from: digitalPanelItem.superview))!
+                guard let win = self.view.window else {
+                    return
+                }
+                guideWC.digitalBoxRect = (win.contentView?.convert(digitalPanelItem.frame, from: digitalPanelItem.superview)) ?? .zero
                 
-                let compareItem:KMToolbarItemView = self.toolbarController.findItem(KMToolbarComparisonItemIdentifier)!
-                guideWC.compareItemRect = (self.view.window?.contentView?.convert(compareItem.frame, from: compareItem.superview))!
+                let compareItem = self.toolbarController.findItem(KMToolbarComparisonItemIdentifier)
+                guideWC.compareItemRect = (win.contentView?.convert(compareItem?.frame ?? .zero, from: compareItem?.superview)) ?? .zero
                 
                 guideWC.finishHandle = { [weak self] winC, type in
                     if type == .windowNewFinish {
@@ -952,22 +975,25 @@ import Cocoa
                 guideWC.show()
             }
         } else if showType == .measureGuide && KMGuideInfoWindowController.availableShow(.measureGuide) {
-            DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 1) {
+            DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.2) {
                 self.guideInfoWindowController = KMGuideInfoWindowController.currentWC()
                 guard let guideWC = self.guideInfoWindowController else { return }
+                guard let _ = self.view.window else {
+                    return
+                }
                 
                 guideWC.type = .measureGuide
                 
                 guard let digitalPanelItem = self.toolbarController.findItem(KMDocumentSignToolbarItemIdentifier) else {
                     return
                 }
-                guideWC.digitalBoxRect = (self.view.window?.contentView?.convert(digitalPanelItem.frame, from: digitalPanelItem.superview))!
+                guideWC.digitalBoxRect = (self.view.window?.contentView?.convert(digitalPanelItem.frame, from: digitalPanelItem.superview)) ?? .zero
                 
                 let compareItem:KMToolbarItemView = self.toolbarController.findItem(KMToolbarMeasureItemIdentifier)!
-                guideWC.compareItemRect = (self.view.window?.contentView?.convert(compareItem.frame, from: compareItem.superview))!
+                guideWC.compareItemRect = (self.view.window?.contentView?.convert(compareItem.frame, from: compareItem.superview)) ?? .zero
                 
                 guideWC.window?.collectionBehavior = [.canJoinAllSpaces]
-                var rect = self.view.window!.frame
+                var rect = self.view.window?.frame ?? .zero
                 rect.size.height -= 20
                 guideWC.window?.setFrame(rect, display: false)
                 guideWC.window?.minSize = rect.size
@@ -984,7 +1010,10 @@ import Cocoa
                 guard let digitalPanelItem = self.toolbarController.findItem(KMDocumentSignToolbarItemIdentifier) else {
                     return
                 }
-                guideWC.digitalBoxRect = (self.view.window?.contentView?.convert(digitalPanelItem.frame, from: digitalPanelItem.superview))!
+                guard let win = self.view.window else {
+                    return
+                }
+                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() {
@@ -1017,7 +1046,7 @@ import Cocoa
                 }
                 
                 guideWC.window?.collectionBehavior = [.canJoinAllSpaces]
-                var rect = self.view.window!.frame
+                var rect = self.view.window?.frame ?? .zero
                 rect.size.height -= 20
                 guideWC.window?.setFrame(rect, display: false)
                 guideWC.window?.minSize = rect.size
@@ -1194,11 +1223,15 @@ import Cocoa
         } else {
             if self.needSaveDocument() {
                 self.saveDocumentWithProgressAlert { [unowned self] params in
-                    self.showDigitalSignWindow(withFilePathURL: self.listView.document.documentURL)
+                    if (self.listView.document != nil) {
+                        self.showDigitalSignWindow(withFilePathURL: self.listView.document.documentURL)
+                    }
                 }
                 return
             }
-            self.showDigitalSignWindow(withFilePathURL: self.listView.document.documentURL)
+            if (self.listView.document != nil) {
+                self.showDigitalSignWindow(withFilePathURL: self.listView.document.documentURL)
+            }
         }
     }
     
@@ -1212,7 +1245,9 @@ import Cocoa
     
     func showDigitalSignWindow(withFilePathURL fileURL: URL) {
         if !IAPProductsManager.default().isAvailableAllFunction(){
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            let winC = KMPurchaseCompareWindowController.sharedInstance()
+            winC?.kEventName = "Reading_DigitalSign_BuyNow"
+            winC?.showWindow(nil)
             return
         }
         
@@ -1224,14 +1259,14 @@ import Cocoa
         var password: String = ""
         
         self.toolbarController.toolbarType = .None
-        if digitalSignController == nil {
+//        if digitalSignController == nil {
             password = listView.document?.password ?? ""
             
             digitalSignController = KMPDFDigitalSignViewController()
-        }
+//        }
         
         digitalSignController?.currentPageIndex = Int(currentPageIndex)
-        digitalSignController?.url = listView.document.documentURL
+        digitalSignController?.url = listView.document?.documentURL
         digitalSignController?.password = password
         digitalSignController?.scaleFactor = listView.scaleFactor
         
@@ -1276,7 +1311,8 @@ import Cocoa
             }
         }
         if toolbarItem.itemIdentifier != KMDocumentEditToolbarItemIdentifier && toolbarItem.itemIdentifier != KMRightControlToolbarItemIdentifier && toolbarItem.itemIdentifier != KMLeftControlToolbarItemIdentifier {
-            self.editPDFHanddler.clearData()
+//            self.editPDFHanddler.clearData()
+            self.commitEditingIfNeed()
         }
     }
     
@@ -1357,7 +1393,7 @@ import Cocoa
             self?.currentWindowController = nil
             
             let panel = NSSavePanel()
-            panel.nameFieldStringValue = "[新文件]"+(self?.listView.document.documentURL.lastPathComponent)!
+            panel.nameFieldStringValue = "[新文件]"+((self?.listView.document?.documentURL.lastPathComponent) ?? "")
             let button = NSButton.init(checkboxWithTitle: "保存后打开文档", target: nil, action: nil)
             button.state = .on
             panel.accessoryView = button
@@ -1377,9 +1413,9 @@ import Cocoa
                     
                     (anno as! CPDFRedactAnnotation).applyRedaction()
                 } else if (type == .redactAll) {
-                    self?.listView.document.applyRedactions()
+                    self?.listView.document?.applyRedactions()
                 } else if (type == .eraserOne) {
-                    let anno = self!.listView.activeAnnotation
+                    let anno = self!.listView?.activeAnnotation
                     if (anno == nil || (anno?.isKind(of: CPDFRedactAnnotation.self)) == false) {
                         callback()
                         return
@@ -1395,7 +1431,7 @@ import Cocoa
                     }
                 }
                 
-                self!.listView.document.write(to: panel.url)
+                self!.listView.document?.write(to: panel.url)
                 if (button.state == .on) {
                     NSDocumentController.shared.openDocument(withContentsOf: panel.url!, display: true) { document, alreadyOpen, error in
                         
@@ -1448,7 +1484,7 @@ import Cocoa
             /// 解密成功
             self?.hiddenSecureLimitTip()
             self?.model.isSaveKeyChain = false
-            self?.listView.document.unlock(withPassword: password)
+            self?.listView.document?.unlock(withPassword: password)
         }
     }
     
@@ -1497,14 +1533,14 @@ import Cocoa
         DispatchQueue.main.async {
             var documentURL = url
             if documentURL == nil {
-                documentURL = self.listView.document.documentURL
+                documentURL = self.listView.document?.documentURL
             }
             
             guard let _url = documentURL else { return }
             guard let document = PDFDocument(url: _url) else { return }
             
             self.mergeWindowController = KMMergeWindowController(document: document, password: password ?? "")
-            self.mergeWindowController!.oriDucumentUrl = self.listView.document.documentURL
+            self.mergeWindowController!.oriDucumentUrl = self.listView.document?.documentURL
             self.mergeWindowController!.pageIndex = self.listView.currentPageIndex
             
             self.mergeWindowController!.cancelAction = { [unowned self] controller in
@@ -1526,7 +1562,7 @@ import Cocoa
         self.securityWindowController = KMSecurityWindowController(windowNibName: "KMSecurityWindowController")
         guard let securityWindowController = securityWindowController else { return }
         
-        securityWindowController.documentURL = self.listView.document.documentURL
+        securityWindowController.documentURL = self.listView.document?.documentURL
         securityWindowController.batchAction = { [unowned self] controller, files in
             self.view.window?.endSheet((securityWindowController.window)!)
 
@@ -1580,7 +1616,7 @@ import Cocoa
         }
         
         let document: KMMainDocument? = self.myDocument as? KMMainDocument
-        if (document?.isDocumentEdited == nil || document!.isDocumentEdited == false) {
+        if (document?.isDocumentEdited == nil || document?.isDocumentEdited == false) {
             return false
         }
         return true
@@ -1598,7 +1634,7 @@ import Cocoa
             document?.save(nil)
             return
         }
-        if (document?.isDocumentEdited == nil || document!.isDocumentEdited == false) {
+        if (document?.isDocumentEdited == nil || document?.isDocumentEdited == false) {
             return
         }
         
@@ -1623,7 +1659,7 @@ import Cocoa
             }
             return
         }
-        if (document?.isDocumentEdited == nil || document!.isDocumentEdited == false) {
+        if (document?.isDocumentEdited == nil || document?.isDocumentEdited == false) {
             callback()
             return
         }
@@ -2102,12 +2138,14 @@ import Cocoa
     }
     
     func showSnapshots(setups: NSArray?) {
-        for setup in setups ?? [] {
-            let swc = KMSnapshotWindowController()
-            swc.delegate = self
-            swc.setPdfDocument(self.listView.document, setup: setup as? NSDictionary)
-            swc.setForceOnTop(self.interactionMode != .normal)
-            self.myDocument?.addWindowController(swc)
+        if self.listView.document != nil {
+            for setup in setups ?? [] {
+                let swc = KMSnapshotWindowController()
+                swc.delegate = self
+                swc.setPdfDocument(self.listView.document, setup: setup as? NSDictionary)
+                swc.setForceOnTop(self.interactionMode != .normal)
+                self.myDocument?.addWindowController(swc)
+            }
         }
     }
     
@@ -2117,18 +2155,23 @@ import Cocoa
             self.showSecureLimitTip()
         }
         
+//        let readModel = UserDefaults.standard.bool(forKey: "kKMPDFViewIsReadMode")
+//        if readModel == true {
+//            self.openReadModel()
+//        }
+        
         if self.model.needConvertNotes {
             self.showConvertNotesProgress()
         }
         if (self._documentFirstLoad) {
             self.checkShouldAutoOpenLeftVC()
             if (KMPreferenceManager.shared.openLastUnlockedDocumentWhenAppStart) {
-                let pageNumber = KMPreferenceManager.shared.getPageNumber(forKey: self.listView.document.documentURL.path)
-                let pageScale = KMPreferenceManager.shared.getPageScale(forKey: self.listView.document.documentURL.path)
+                let pageNumber = KMPreferenceManager.shared.getPageNumber(forKey: self.listView.document?.documentURL.path ?? "")
+                let pageScale = KMPreferenceManager.shared.getPageScale(forKey: self.listView.document?.documentURL.path ?? "")
                 if (pageScale != nil) {
                     self.listView.scaleFactor = CGFloat(pageScale!)
                 }
-                if (pageNumber != nil && pageNumber! >= 0 && pageNumber! < self.listView.document.pageCount) {
+                if (pageNumber != nil && pageNumber! >= 0 && pageNumber! < (self.listView.document?.pageCount ?? 0)) {
                     self.listView.go(toPageIndex: pageNumber!, animated: false)
                 } else {
                     self._goToFirstPageForFristAppear()
@@ -2221,7 +2264,7 @@ import Cocoa
     
     func CPDFDocumentPageCountChangedNotification(_ sender: Notification) {
         if self.isReadMode {
-            self.readModelView.totalPagesCount = Int(self.listView.document.pageCount)
+            self.readModelView.totalPagesCount = Int(self.listView.document?.pageCount ?? 0)
         }
         //刷新前一页后一页按钮
         self.updateNextAndPreViousButtonState()

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

@@ -917,6 +917,7 @@ static NSString *const KMPurchaseCompareCellIdentifier       = @"KMPurchaseCompa
                             @[@"Create fattened copies",@"X",@"✓",@"✓",@"✓"],
                             @[@"Extract Images",@"X",@"✓",@"✓",@"✓"],
                             @[@"Extract tables",@"Only first 10 pages",@"✓",@"✓",@"Only first 10 pages"],
+                            @[@"Measuring Tools",@"X",@"✓",@"✓",@"✓"],
                             @"Fill & Sign",
                             @[@"Create digital signature",@"X",@"✓",@"✓",@"✓"],
                             @[@"Create & Edit & Fill Adobe Fillable PDF Forms",@"X",@"✓",@"✓",@"✓"],
@@ -965,6 +966,7 @@ static NSString *const KMPurchaseCompareCellIdentifier       = @"KMPurchaseCompa
                             @[@"Create fattened copies",@"X",@"✓",@"✓",@"✓"],
                             @[@"Extract Images",@"X",@"✓",@"✓",@"✓"],
                             @[@"Extract tables",@"Only first 10 pages",@"✓",@"✓",@"Only first 10 pages"],
+                            @[@"Measuring Tools",@"X",@"✓",@"✓",@"✓"],
                             @"Fill & Sign",
                             @[@"Create digital signature",@"X",@"✓",@"✓",@"✓"],
                             @[@"Create & Edit & Fill Adobe Fillable PDF Forms",@"X",@"✓",@"✓",@"✓"],

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

@@ -0,0 +1,128 @@
+//
+//  KMEmbeddedPaymentPopWC.swift
+//  PDF Reader Pro
+//
+//  Created by wanjun on 2024/9/4.
+//
+
+import Cocoa
+import WebKit
+
+class KMEmbeddedPaymentPopWC: NSWindowController, WKNavigationDelegate {
+
+    @IBOutlet weak var mainView: NSView!
+    @IBOutlet weak var webView: WKWebView!
+    var urlPath: String?
+    var countryCode: String?
+    var postCode: String?
+    var isPaddle: Bool = false
+    var callback: ((_ isClose: Bool) -> Void)?
+    
+    static var currentWindowController: KMEmbeddedPaymentPopWC!
+    
+    @objc static func currentFirstTrialWC(_ urlPath: String) -> KMEmbeddedPaymentPopWC {
+        if currentWindowController != nil {
+            currentWindowController.urlPath = urlPath
+            return currentWindowController
+        } else {
+            let configWC: KMEmbeddedPaymentPopWC = KMEmbeddedPaymentPopWC.init(windowNibName: "KMEmbeddedPaymentPopWC")
+            currentWindowController = configWC;
+            currentWindowController.urlPath = urlPath
+            return currentWindowController
+        }
+     }
+    
+    override func windowDidLoad() {
+        super.windowDidLoad()
+
+        // Implement this method to handle any initialization after your window controller's window has been loaded from its nib file.
+        
+        window?.title = ""
+
+        if isPaddle {
+            let blankHTML = """
+                <html>
+                <head></head>
+                <body style="background-color:white;"></body>
+                </html>
+            """
+            webView.navigationDelegate = self
+            webView.loadHTMLString(blankHTML, baseURL: URL(string: "https://cdn.paddle.com/paddle/paddle.js"))
+        } else {
+            if urlPath != nil {
+                if let url = URL(string: urlPath!) {
+                    let request = URLRequest(url: url)
+                    webView.load(request)
+                }
+            }
+        }
+        self.window?.delegate = self;
+    }
+
+    func webView(_ webView: WKWebView, didFail navigation: WKNavigation!, withError error: Error) {
+        print("WebView load error: \(error.localizedDescription)")
+    }
+    
+    func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
+        if isPaddle {
+            if let url = navigationAction.request.url {
+                print("Navigating to URL: \(url)")
+                // 你可以根据 URL 判断是否是重定向页面,执行特定逻辑
+            }
+        }
+        decisionHandler(.allow)
+    }
+
+    func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
+        if isPaddle {
+            if let localPaddleJsPath = Bundle.main.path(forResource: "paddle", ofType: "js") {
+                let localPaddleJsURL = URL(fileURLWithPath: localPaddleJsPath)
+                let paddleScript = generatePaddleScript(overrideUrl: localPaddleJsURL.absoluteString, countryCode: countryCode!, postCode: postCode!)
+                webView.evaluateJavaScript(paddleScript) { (result, error) in
+                    if let error = error {
+                        print("Error evaluating JavaScript: \(error.localizedDescription)")
+                    } else {
+                        print("JavaScript executed successfully")
+                    }
+                }
+            } else {
+                print("Paddle.js file not found in bundle")
+            }
+        }
+    }
+
+    func generatePaddleScript(overrideUrl: String, countryCode: String, postCode: String) -> String {
+        let script = """
+            var script = document.createElement('script');
+            script.src = 'https://cdn.paddle.com/paddle/paddle.js';
+            script.onload = function() {
+                try {
+                    Paddle.Setup({ vendor: 134050 });
+                    var overrideUrl = '\(urlPath!)';
+                    Paddle.Checkout.open({
+                        method: 'sdk', //隐藏弹窗的关闭按钮
+                        override: overrideUrl,
+                        country: '\(countryCode)',
+                        postcode: '\(postCode)',
+                    });
+                } catch (error) {
+                    console.log('Paddle setup or checkout error:', error);
+                }
+            };
+            script.onerror = function() {
+                console.log('Failed to load Paddle.js');
+            };
+            document.head.appendChild(script);
+            """
+        return script
+    }
+}
+
+extension KMEmbeddedPaymentPopWC: NSWindowDelegate {
+    func windowWillClose(_ notification: Notification) {
+        if let callback = self.callback {
+            callback(true)
+        }
+        KMEmbeddedPaymentPopWC.currentWindowController = nil
+    }
+}

+ 60 - 0
PDF Office/PDF Master/Class/Purchase/DMG/KMEmbeddedPaymentPopWC.xib

@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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="22505"/>
+        <plugIn identifier="com.apple.WebKit2IBPlugin" version="22505"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <customObject id="-2" userLabel="File's Owner" customClass="KMEmbeddedPaymentPopWC" customModule="PDF_Reader_Pro" customModuleProvider="target">
+            <connections>
+                <outlet property="mainView" destination="ha1-rh-fVy" id="JMi-Dj-vmh"/>
+                <outlet property="webView" destination="xYX-Ie-8hw" id="0FR-Ky-hiP"/>
+                <outlet property="window" destination="F0z-JX-Cv5" id="gIp-Ho-8D9"/>
+            </connections>
+        </customObject>
+        <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
+        <customObject id="-3" userLabel="Application" customClass="NSObject"/>
+        <window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="F0z-JX-Cv5">
+            <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="460" height="693"/>
+            <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="460" height="693"/>
+                <autoresizingMask key="autoresizingMask"/>
+                <subviews>
+                    <customView translatesAutoresizingMaskIntoConstraints="NO" id="ha1-rh-fVy">
+                        <rect key="frame" x="0.0" y="0.0" width="460" height="693"/>
+                        <subviews>
+                            <wkWebView wantsLayer="YES" translatesAutoresizingMaskIntoConstraints="NO" id="xYX-Ie-8hw">
+                                <rect key="frame" x="0.0" y="0.0" width="460" height="693"/>
+                                <wkWebViewConfiguration key="configuration">
+                                    <audiovisualMediaTypes key="mediaTypesRequiringUserActionForPlayback" none="YES"/>
+                                    <wkPreferences key="preferences"/>
+                                </wkWebViewConfiguration>
+                            </wkWebView>
+                        </subviews>
+                        <constraints>
+                            <constraint firstItem="xYX-Ie-8hw" firstAttribute="leading" secondItem="ha1-rh-fVy" secondAttribute="leading" id="Itd-UM-zZ8"/>
+                            <constraint firstAttribute="trailing" secondItem="xYX-Ie-8hw" secondAttribute="trailing" id="XDn-y3-Bms"/>
+                            <constraint firstAttribute="bottom" secondItem="xYX-Ie-8hw" secondAttribute="bottom" id="tGk-76-oqq"/>
+                            <constraint firstItem="xYX-Ie-8hw" firstAttribute="top" secondItem="ha1-rh-fVy" secondAttribute="top" id="tec-jh-YPH"/>
+                        </constraints>
+                    </customView>
+                </subviews>
+                <constraints>
+                    <constraint firstAttribute="trailing" secondItem="ha1-rh-fVy" secondAttribute="trailing" id="1Fp-qg-7im"/>
+                    <constraint firstAttribute="bottom" secondItem="ha1-rh-fVy" secondAttribute="bottom" id="B9d-Z2-yJH"/>
+                    <constraint firstItem="ha1-rh-fVy" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" id="OxT-lh-s2T"/>
+                    <constraint firstItem="ha1-rh-fVy" firstAttribute="top" secondItem="se5-gp-TjO" secondAttribute="top" id="jHn-wP-Tas"/>
+                </constraints>
+            </view>
+            <connections>
+                <outlet property="delegate" destination="-2" id="0bl-1N-AYu"/>
+            </connections>
+            <point key="canvasLocation" x="105" y="276.5"/>
+        </window>
+    </objects>
+</document>

+ 6 - 0
PDF Office/PDF Master/Class/Purchase/DMG/KMPurchaseCompareDMGWindowController.h

@@ -17,3 +17,9 @@
 - (void)showWindowRestore:(id)sender;
 
 @end
+
+@interface KMPurchaseCompareDMGWindowController(KMAnalytic)
+
+- (void)trackEvent_buyNow;
+
+@end

+ 650 - 15
PDF Office/PDF Master/Class/Purchase/DMG/KMPurchaseCompareDMGWindowController.m

@@ -159,6 +159,7 @@ static NSString *const KMPurchaseCompareDMGCellIdentifier       = @"KMPurchaseCo
 @property (assign) IBOutlet NSTextField *parmanentVerInfoLbl7;
 @property (assign) IBOutlet NSTextField *parmanentVerInfoLbl8;
 @property (assign) IBOutlet NSTextField *parmanentVerInfoLbl9;
+@property (weak) IBOutlet NSImageView *parmanentVerInfoImage1;
 
 @property (weak) IBOutlet NSTextField *parmanentVerInfoLbl10;
 
@@ -186,10 +187,20 @@ static NSString *const KMPurchaseCompareDMGCellIdentifier       = @"KMPurchaseCo
 @property (assign) IBOutlet NSTextField *aiPurchaseLabel;
 @property (assign) IBOutlet KMButton *aiPurchaseButton;
 
+@property (weak) IBOutlet NSTextField *premiumLabel;
+@property (weak) IBOutlet NSTextField *permanentLabel;
+@property (weak) IBOutlet NSSwitch *buySwitch;
+@property (weak) IBOutlet NSTextField *discountPriceLabel;
+@property (weak) IBOutlet NSTextField *originalPriceLabel;
+@property (weak) IBOutlet NSTextField *discountPriceLabel2;
+
 @property (nonatomic, assign) NSModalSession modalSession;
 @property (nonatomic, retain) NSArray *dataSource;
 @property (nonatomic, retain) NSPopover *popOver;
 
+- (NSString *)_buyNowEventToPaidEventName;
+- (NSDictionary *)_getPaidEventParamsWith:(NSString *)eventN;
+
 @end
 
 @implementation KMPurchaseCompareDMGWindowController
@@ -221,6 +232,21 @@ static NSString *const KMPurchaseCompareDMGCellIdentifier       = @"KMPurchaseCo
     
     self.freeVersionLineView.wantsLayer = YES;
     
+    self.premiumLabel.stringValue = NSLocalizedString(@"Premium", nil);
+    self.premiumLabel.textColor = [NSColor colorWithRed:255.0/255.0 green:255.0/255.0 blue:255.0/255.0 alpha:0.7];
+    self.premiumLabel.font = [NSFont SFProTextRegularFont:14.0];
+    self.permanentLabel.stringValue = NSLocalizedString(@"Permanent", nil);
+    self.permanentLabel.textColor = [NSColor colorWithRed:255.0/255.0 green:94.0/255.0 blue:44.0/255.0 alpha:1.0];
+    self.permanentLabel.font = [NSFont SFProTextRegularFont:14.0];
+
+    self.discountPriceLabel.textColor = [NSColor colorWithRed:255.0/255.0 green:231.0/255.0 blue:106.0/255.0 alpha:1.0];
+    self.discountPriceLabel.font = [NSFont fontWithName:@"Ubuntu" size:36.0];
+    self.originalPriceLabel.textColor = [NSColor whiteColor];
+    self.originalPriceLabel.font = [NSFont fontWithName:@"Ubuntu" size:14.0];
+    self.discountPriceLabel2.textColor = [NSColor colorWithRed:255.0/255.0 green:231.0/255.0 blue:106.0/255.0 alpha:1.0];
+    self.discountPriceLabel2.font = [NSFont fontWithName:@"Ubuntu" size:36.0];
+    [self.discountPriceLabel2 setHidden:YES];
+
     self.freeVersionLbl.stringValue = NSLocalizedString(@"Free Version", nil);
     self.parmanentVerLbl.stringValue = NSLocalizedString(@"Permanent License", nil);
     
@@ -235,6 +261,7 @@ static NSString *const KMPurchaseCompareDMGCellIdentifier       = @"KMPurchaseCo
     self.freeVersionInfoLbl8.stringValue = self.parmanentVerInfoLbl8.stringValue = NSLocalizedString(@"OCR PDFs", nil);
     self.freeVersionInfoLbl9.stringValue = self.parmanentVerInfoLbl9.stringValue = NSLocalizedString(@"Measuring Tools", nil);
     self.freeVersionInfoLbl10.stringValue = self.parmanentVerInfoLbl10.stringValue = NSLocalizedString(@"Ad-free", nil);
+    [self refreshParmanentVerInfo];
 
 //    self.parmanentVerinfoimg2.toolTip = NSLocalizedString(@"Support insert links and custom stamps", nil);
     self.parmanentVerInfoBtn2.mouseMoveCallback = ^(BOOL mouseEntered) {
@@ -331,6 +358,7 @@ static NSString *const KMPurchaseCompareDMGCellIdentifier       = @"KMPurchaseCo
         }
     };
     self.discountTipImage.hidden = YES;
+    [self updatePriceLabel];
     
     self.aiSepLineView.wantsLayer = YES;
     self.aiInfoLbl1.font = self.aiInfoLbl2.font = self.aiInfoLbl3.font = self.aiInfoLbl4.font = [NSFont SFProTextRegularFont:14];
@@ -435,7 +463,7 @@ static NSString *const KMPurchaseCompareDMGCellIdentifier       = @"KMPurchaseCo
         self.aiTitleLabel.textColor = [NSColor colorWithRed:20/255. green:0 blue:102/255. alpha:1];
     }
     
-    self.parmanentVerLbl.textColor = [NSColor colorWithRed:255/255. green:94/255. blue:44/255. alpha:1.];
+    self.parmanentVerLbl.textColor = [NSColor colorWithRed:252/255. green:253/255. blue:255/255. alpha:1.];
     self.oneTimeTipLbl.textColor = [NSColor colorWithRed:255/255. green:231/255. blue:106/255. alpha:1.];
     
     if ([KMAppearance isDarkMode]) {
@@ -471,6 +499,33 @@ static NSString *const KMPurchaseCompareDMGCellIdentifier       = @"KMPurchaseCo
     }
     [self.buyNowButton setTitleColor:[NSColor whiteColor]];
     
+    [self updatePriceLabel];
+}
+
+- (void)updatePriceLabel {
+    NSString *originalText = @"";
+    NSString *discountText = @"";
+#if VERSION_DMG
+    NSString *abbreviation = @"$";
+    if ([@"CNY" isEqualToString:NSLocalizedString(@"USD", nil)])  {
+        abbreviation = @"¥";
+    }
+    if ([self.buySwitch state]) {
+        originalText = [NSString stringWithFormat:@"%@%@", abbreviation, [[KMDMGProductsManager shareInstance] getPrice:@"com.brother.pdfreaderpro.mac.product_3"]];
+        discountText = [NSString stringWithFormat:@"%@%@", abbreviation, [[KMDMGProductsManager shareInstance] getActivityPrice:@"com.brother.pdfreaderpro.mac.product_3"]];
+    } else {
+        originalText = [NSString stringWithFormat:@"%@%@", abbreviation, [[KMDMGProductsManager shareInstance] getPrice:@"com.brother.pdfreaderpro.mac.product_1"]];
+        discountText = [NSString stringWithFormat:@"%@%@", abbreviation, [[KMDMGProductsManager shareInstance] getActivityPrice:@"com.brother.pdfreaderpro.mac.product_1"]];
+    }
+#endif
+    NSMutableAttributedString *attributedText = [[NSMutableAttributedString alloc] initWithString:originalText];
+    [attributedText addAttribute:NSStrikethroughStyleAttributeName
+                           value:@(NSUnderlineStyleSingle)
+                           range:NSMakeRange(0, originalText.length)];
+    self.originalPriceLabel.attributedStringValue = attributedText;
+    self.discountPriceLabel.stringValue = discountText;
+    self.discountPriceLabel2.stringValue = discountText;
+
     if (KMAdvertisementManager.manager.info.discountContent.content.count > 0) {
         KMAdvertisementItemInfo *info = KMAdvertisementManager.manager.info.discountContent.content.firstObject;
         if ([KMAdvertisementManager checkAdvertisementValid:info]) {
@@ -480,12 +535,98 @@ static NSString *const KMPurchaseCompareDMGCellIdentifier       = @"KMPurchaseCo
             self.discountTipImage.image = [KMAdvertisementImage imageWithURLWithUrl:url completion:^(NSImage * _Nonnull image) {
                 self.discountTipImage.image = image;
             }];
+            if ([originalText isEqualToString:discountText]) {
+                [self.originalPriceLabel setHidden:YES];
+                [self.discountPriceLabel setHidden:YES];
+                [self.discountPriceLabel2 setHidden:NO];
+                [self.discountTipImage setHidden:YES];
+            } else {
+                [self.originalPriceLabel setHidden:NO];
+                [self.discountPriceLabel setHidden:NO];
+                [self.discountPriceLabel2 setHidden:YES];
+                [self.discountTipImage setHidden:NO];
+            }
         } else {
             self.discountTipImage.hidden = YES;
+            if ([originalText isEqualToString:discountText]) {
+                [self.originalPriceLabel setHidden:YES];
+                [self.discountPriceLabel setHidden:YES];
+                [self.discountPriceLabel2 setHidden:NO];
+            } else {
+                [self.originalPriceLabel setHidden:NO];
+                [self.discountPriceLabel setHidden:NO];
+                [self.discountPriceLabel2 setHidden:YES];
+            }
         }
     }
 }
 
+//- (void)updatePriceLabel {
+//    NSString *originalText = @"";
+//    NSString *discountText = @"";
+//    if ([@"USD" isEqualToString:NSLocalizedString(@"USD", nil)]) {
+//#if VERSION_DMG
+//        if ([self.buySwitch state]) {
+//            originalText = [NSString stringWithFormat:@"$%@", [[KMDMGProductsManager shareInstance] getPrice:@"com.brother.pdfreaderpro.mac.product_3"]];
+//            discountText = [NSString stringWithFormat:@"$%@", [[KMDMGProductsManager shareInstance] getActivityPrice:@"com.brother.pdfreaderpro.mac.product_3"]];
+//        } else {
+//            originalText = [NSString stringWithFormat:@"$%@", [[KMDMGProductsManager shareInstance] getPrice:@"com.brother.pdfreaderpro.mac.product_1"]];
+//            discountText = [NSString stringWithFormat:@"$%@", [[KMDMGProductsManager shareInstance] getActivityPrice:@"com.brother.pdfreaderpro.mac.product_1"]];
+//        }
+//#endif
+//    } else {
+//#if VERSION_DMG
+//        if ([self.buySwitch state]) {
+//            originalText = [NSString stringWithFormat:@"¥%@", [[KMDMGProductsManager shareInstance] getPriceCNY:@"com.brother.pdfreaderpro.mac.product_3"]];
+//            discountText = [NSString stringWithFormat:@"¥%@", [[KMDMGProductsManager shareInstance] getActivityPriceCNY:@"com.brother.pdfreaderpro.mac.product_3"]];
+//        } else {
+//            originalText = [NSString stringWithFormat:@"¥%@", [[KMDMGProductsManager shareInstance] getPriceCNY:@"com.brother.pdfreaderpro.mac.product_1"]];
+//            discountText = [NSString stringWithFormat:@"¥%@", [[KMDMGProductsManager shareInstance] getActivityPriceCNY:@"com.brother.pdfreaderpro.mac.product_1"]];
+//        }
+//#endif
+//    }
+//    NSMutableAttributedString *attributedText = [[NSMutableAttributedString alloc] initWithString:originalText];
+//    [attributedText addAttribute:NSStrikethroughStyleAttributeName
+//                           value:@(NSUnderlineStyleSingle)
+//                           range:NSMakeRange(0, originalText.length)];
+//    self.originalPriceLabel.attributedStringValue = attributedText;
+//    self.discountPriceLabel.stringValue = discountText;
+//
+//    if ([originalText isEqualToString:discountText]) {
+//        [self.originalPriceLabel setHidden:YES];
+//    } else {
+//        [self.originalPriceLabel setHidden:NO];
+//    }
+//}
+
+- (void)refreshParmanentVerInfo {
+    if ([self.buySwitch state] == NSControlStateValueOn) {
+        self.parmanentVerInfoLbl1.stringValue = NSLocalizedString(@"View PDFs", nil);
+        self.parmanentVerInfoLbl2.stringValue = NSLocalizedString(@"Annotate PDFs (advanced)", nil);
+        self.parmanentVerInfoLbl3.stringValue = NSLocalizedString(@"Unlimited file conversion", nil);
+        self.parmanentVerInfoLbl4.stringValue = NSLocalizedString(@"Edit PDF text and images", nil);
+        self.parmanentVerInfoLbl5.stringValue = NSLocalizedString(@"Digital signature", nil);
+        self.parmanentVerInfoLbl6.stringValue = NSLocalizedString(@"Organize pages", nil);
+        self.parmanentVerInfoLbl7.stringValue = NSLocalizedString(@"Batch process", nil);
+        self.parmanentVerInfoLbl8.stringValue = NSLocalizedString(@"OCR PDFs", nil);
+        self.parmanentVerInfoLbl9.stringValue = NSLocalizedString(@"Measuring Tools", nil);
+        self.parmanentVerInfoLbl10.stringValue = NSLocalizedString(@"Ad-free", nil);
+        self.parmanentVerInfoImage1.image = [NSImage imageNamed:@"function_vip"];
+    } else {
+        self.parmanentVerInfoLbl1.stringValue = NSLocalizedString(@"Unlimited file conversion", nil);
+        self.parmanentVerInfoLbl2.stringValue = NSLocalizedString(@"Annotate PDFs (advanced)", nil);
+        self.parmanentVerInfoLbl3.stringValue = NSLocalizedString(@"View PDFs", nil);
+        self.parmanentVerInfoLbl4.stringValue = NSLocalizedString(@"Edit PDF text and images", nil);
+        self.parmanentVerInfoLbl5.stringValue = NSLocalizedString(@"Digital signature", nil);
+        self.parmanentVerInfoLbl6.stringValue = NSLocalizedString(@"Organize pages", nil);
+        self.parmanentVerInfoLbl7.stringValue = NSLocalizedString(@"Batch process", nil);
+        self.parmanentVerInfoLbl8.stringValue = NSLocalizedString(@"OCR PDFs", nil);
+        self.parmanentVerInfoLbl9.stringValue = NSLocalizedString(@"Measuring Tools", nil);
+        self.parmanentVerInfoLbl10.stringValue = NSLocalizedString(@"Ad-free", nil);
+        self.parmanentVerInfoImage1.image = [NSImage imageNamed:@"compare_nosupport"];
+    }
+}
+
 #pragma mark - Window Method
 - (void)showWindow:(id)sender {
     [super showWindow:nil];
@@ -493,6 +634,8 @@ static NSString *const KMPurchaseCompareDMGCellIdentifier       = @"KMPurchaseCo
     [self.window center];
     [self.window orderFront:nil];
     
+    [self.buySwitch setState:NSControlStateValueOn];
+    [self updatePriceLabel];
     [self updatePurchaseInformation];
 }
 
@@ -503,6 +646,11 @@ static NSString *const KMPurchaseCompareDMGCellIdentifier       = @"KMPurchaseCo
 
 - (void)close {
     [super close];
+    
+    // 清空埋点的数据
+    self.kEventName = nil;
+    self.kEventTag = 0;
+    
     [self endModal:nil];
 }
 
@@ -592,10 +740,35 @@ static NSString *const KMPurchaseCompareDMGCellIdentifier       = @"KMPurchaseCo
 //    [[NSWorkspace sharedWorkspace] openURL:url];
 //    [[FMTrackEventManager defaultManager] trackEventWithEvent:@"PUW" withProperties:@{@"PUW_Btn":@"PUW_Btn_UpgradeBuyNow"}];
 //#endif
+    
 #if VERSION_DMG
+    [self trackEvent_buyNow];
+    NSString *paidEventName = [self _buyNowEventToPaidEventName];
+    NSDictionary *paidEventParams = [self _getPaidEventParamsWith:paidEventName];
+    
+    NSString *thePaidEventName = paidEventParams.allKeys.firstObject;
+    NSDictionary *thePaidEventParams = nil;
+    if (paidEventName != nil && paidEventParams.allValues.firstObject != nil) {
+        thePaidEventParams = @{paidEventParams.allValues.firstObject : paidEventName};
+    }
+    
     [self close];
-    KMPurchaseEmbeddedWindowController *embeddedWC = [[KMPurchaseEmbeddedWindowController alloc] initWithWindowNibName:@"KMPurchaseEmbeddedWindowController"];
-    [NSApp runModalForWindow:embeddedWC.window];
+    
+    NSString *productID = @"";
+    if ([self.buySwitch state]) {
+        productID = @"com.brother.pdfreaderpro.mac.product_3";
+    } else {
+        productID = @"com.brother.pdfreaderpro.mac.product_1";
+    }
+//    KMPurchaseEmbeddedWindowController *embeddedWC = [[KMPurchaseEmbeddedWindowController alloc] initWithWindowNibName:@"KMPurchaseEmbeddedWindowController"];
+    KMPurchaseEmbeddedWindowController *embeddedWC = [KMPurchaseEmbeddedWindowController currentFirstTrialWC:productID];
+//    [embeddedWC beginSheetModalFor:NSApp.mainWindow completionHandler:^(NSInteger result) {
+//            
+//    }];
+    embeddedWC.kEventName = thePaidEventName;
+    embeddedWC.kEventParams = thePaidEventParams;
+    [embeddedWC showWindow:nil];
+    [[embeddedWC window] center];
 #endif
 }
 
@@ -649,10 +822,32 @@ static NSString *const KMPurchaseCompareDMGCellIdentifier       = @"KMPurchaseCo
 }
 
 - (IBAction)aiPurchaseButtonClick:(NSButton *)sender {
-    NSURL *url = [NSURL URLWithString:Swift_oc_Tool.AIProduct_Link_OC];
-    [[NSWorkspace sharedWorkspace] openURL:url];
+//    NSURL *url = [NSURL URLWithString:Swift_oc_Tool.AIProduct_Link_OC];
+//    [[NSWorkspace sharedWorkspace] openURL:url];
+//    
+//    [[FMTrackEventManager defaultManager] trackEventWithEvent:@"PUW" withProperties:@{@"PUW_Btn":@"PUW_Btn_BuyAITools"}];
+    [self trackEvent_buyNow];
+    NSString *paidEventName = [self _buyNowEventToPaidEventName];
+    NSDictionary *paidEventParams = [self _getPaidEventParamsWith:paidEventName];
+    NSString *thePaidEventName = paidEventParams.allKeys.firstObject;
+    NSDictionary *thePaidEventParams = nil;
+    if (paidEventName != nil && paidEventParams.allValues.firstObject != nil) {
+        thePaidEventParams = @{paidEventParams.allValues.firstObject : paidEventName};
+    }
     
-    [[FMTrackEventManager defaultManager] trackEventWithEvent:@"PUW" withProperties:@{@"PUW_Btn":@"PUW_Btn_BuyAITools"}];
+    [self close];
+#if VERSION_DMG
+    KMPurchaseEmbeddedWindowController *embeddedWC = [KMPurchaseEmbeddedWindowController currentFirstTrialWC:@"com.brother.pdfreaderpro.ai.product_1"];
+    embeddedWC.kEventName = thePaidEventName;
+    embeddedWC.kEventParams = thePaidEventParams;
+    [embeddedWC showWindow:nil];
+    [[embeddedWC window] center];
+#endif
+}
+
+- (IBAction)buySwitchAction:(NSSwitch *)sender {
+    [self refreshParmanentVerInfo];
+    [self updatePriceLabel];
 }
 
 #pragma mark - Noti
@@ -664,16 +859,456 @@ static NSString *const KMPurchaseCompareDMGCellIdentifier       = @"KMPurchaseCo
 
 - (void)recommondInfoUpdateNoti:(NSNotification *)noti {
     dispatch_async(dispatch_get_main_queue(), ^{
-        if (KMAdvertisementManager.manager.info.discountContent.content.count > 0) {
-            KMAdvertisementItemInfo *info = KMAdvertisementManager.manager.info.discountContent.content.firstObject;
-            if ([KMAdvertisementManager checkAdvertisementValid:info]) {
-                self.discountTipImage.hidden = NO;
-                self.discountTipImage.image = info.image;
-            } else {
-                self.discountTipImage.hidden = YES;
-            }
-        }
+        [self updatePriceLabel];
     });
 }
 
+@end
+
+@implementation KMPurchaseCompareDMGWindowController (KMAnalytic)
+
+- (void)trackEvent_buyNow {
+    NSDictionary *params = [self _getBuyNowEventParams];
+    NSString *theEventName = params.allKeys.firstObject;
+    NSDictionary *theParams = nil;
+    if (self.kEventName != nil && params.allValues.firstObject != nil) {
+        theParams = @{params.allValues.firstObject : self.kEventName};
+    }
+    
+    [self trackEvent_dmgWithEventName:theEventName params:theParams platform:KMAnalyticsPlatformAppCenter];
+}
+
+- (NSDictionary *)_getBuyNowEventParams {
+    NSString *eveN = self.kEventName;
+    if (eveN == nil || eveN.length == 0) {
+        return nil;
+    }
+    
+    if ([eveN isEqual:@"Reading_WebsiteLink_BuyNow"] ||
+        [eveN isEqual:@"Reading_EmailLink_BuyNow"] ||
+        [eveN isEqual:@"Reading_DynamicStamp_BuyNow"] ||
+        [eveN isEqual:@"Reading_CustomStamp_BuyNow"] ||
+        [eveN isEqual:@"Reading_Signature_BuyNow"] ||
+        [eveN isEqual:@"Reading_Table_BuyNow"]) {
+        return @{@"Purchase_Tools" : @"SubTbr_Tools"};
+    } else if ([eveN isEqual:@"Reading_InsertBlankPage_BuyNow"] ||
+               [eveN isEqual:@"Reading_InsertPDF_BuyNow"] ||
+               [eveN isEqual:@"Reading_InsertSacnner_BuyNow"] ||
+               [eveN isEqual:@"Reading_InsertImage_BuyNow"] ||
+               [eveN isEqual:@"Reading_InsertClipboard_BuyNow"] ||
+               [eveN isEqual:@"Reading_Replace_BuyNow"] ||
+               [eveN isEqual:@"Reading_Extract_BuyNow"] ||
+               [eveN isEqual:@"Reading_Split_BuyNow"] ||
+               ([eveN isEqual:@"Reading_Rotate_BuyNow"] && self.kEventTag == 0) ||
+               [eveN isEqual:@"Reading_Reverse_BuyNow"] ||
+               [eveN isEqual:@"Reading_Copy_BuyNow"] ||
+               [eveN isEqual:@"Reading_Delete_BuyNow"] ||
+               [eveN isEqual:@"Reading_Merge_BuyNow"]) {
+        return @{@"Purchase_PageEdit" : @"SubTbr_PageEdit"};
+    } else if ([eveN isEqual:@"Onbrd_EditPage_BuyNow"] ||
+               [eveN isEqual:@"Onbrd_Merge_BuyNow"]) {
+        return @{@"Purchase_PageEdit" : @"Home_PageEdit"};
+    } else if ([eveN isEqual:@"Reading_RemoveSecurity_BuyNow"] ||
+               [eveN isEqual:@"Reading_Compare_BuyNow"] ||
+               [eveN isEqual:@"Reading_AddWatermark_BuyNow"] ||
+               [eveN isEqual:@"Reading_RemoveWatermark_BuyNow"] ||
+               [eveN isEqual:@"Reading_AddBackground_BuyNow"] ||
+               [eveN isEqual:@"Reading_RemoveBackground_BuyNow"] ||
+               [eveN isEqual:@"Reading_AddHeaderFooter_BuyNow"] ||
+               [eveN isEqual:@"Reading_RemoveHeaderFooter_BuyNow"] ||
+               [eveN isEqual:@"Reading_AddBates_BuyNow"] ||
+               [eveN isEqual:@"Reading_RemoveBates_BuyNow"] ||
+               [eveN isEqual:@"Reading_Measure_BuyNow"]) {
+        return @{@"Purchase_Editor" : @"SubTbr_Editor"};
+    } else if ([eveN isEqual:@"Onbrd_Compare_BuyNow"] ||
+               [eveN isEqual:@"Onbrd_Background_BuyNow"] ||
+               [eveN isEqual:@"Onbrd_Watermard_BuyNow"] ||
+               [eveN isEqual:@"Onbrd_HeaderFooter_BuyNow"] ||
+               [eveN isEqual:@"Onbrd_Bates_BuyNow"] ||
+               [eveN isEqual:@"Onbrd_Security_BuyNow"]) {
+        return @{@"Purchase_Editor" : @"Home_Editor"};
+    } else if ([eveN isEqual:@"Reading_PDFtoWord_BuyNow"] ||
+              [eveN isEqual:@"Reading_PDFtoExcel_BuyNow"] ||
+              [eveN isEqual:@"Reading_PDFtoPPT_BuyNow"] ||
+              [eveN isEqual:@"Reading_PDFtoRTF_BuyNow"] ||
+              [eveN isEqual:@"Reading_PDFtoCSV_BuyNow"] ||
+              [eveN isEqual:@"Reading_PDFtoText_BuyNow"] ||
+              [eveN isEqual:@"Reading_PDFtoImage_BuyNow"] ||
+              [eveN isEqual:@"Reading_ExtractImage_BuyNow"]) {
+       return @{@"Purchase_Converter" : @"SubTbr_Converter"};
+    } else if ([eveN isEqual:@"Onbrd_ConvertPDF_BuyNow"] ||
+               [eveN isEqual:@"Onbrd_PDFtoWord_BuyNow"] ||
+               [eveN isEqual:@"Onbrd_PDFtoExcel_BuyNow"] ||
+               [eveN isEqual:@"Onbrd_PDFtoPPT_BuyNow"] ||
+               [eveN isEqual:@"Onbrd_ImagetoPDF_BuyNow"]) {
+        return @{@"Purchase_Converter" : @"Home_Converter"};
+    } else if ([eveN isEqual:@"Reading_TextField_BuyNow"] ||
+               [eveN isEqual:@"Reading_CheckBox_BuyNow"] ||
+               [eveN isEqual:@"Reading_RadioButton_BuyNow"] ||
+               [eveN isEqual:@"Reading_ListBox_BuyNow"] ||
+               [eveN isEqual:@"Reading_ComboBox_BuyNow"] ||
+               [eveN isEqual:@"Reading_Button_BuyNow"]) {
+        return @{@"Purchase_Form" : @"SubTbr_Forms"};
+    } else if ([eveN isEqual:@"Reading_FillSign_Signature_BuyNow"] ||
+               [eveN isEqual:@"Reading_DigitalSign_BuyNow"] ||
+               [eveN isEqual:@"Reading_ElectronicSign_BuyNow"]) {
+        return @{@"Purchase_Sign" : @"SunTbr_Signature"};
+    } else if ([eveN isEqual:@"Reading_EditPDF_BuyNow"] ||
+                [eveN isEqual:@"Reading_ReplaceText_BuyNow"]) {
+         return @{@"Purchase_EditPDF" : @"Tbr_Edit PDF"};
+    } else if ([eveN isEqual:@"Reading_Redact_BuyNow"]) {
+        return @{@"Purchase_Redact" : @"Tbr_Redact"};
+    } else if ([eveN isEqual:@"Reading_OCR_BuyNow"] ||
+               [eveN isEqual:@"Reading_Convert_OCR_BuyNow"] ||
+               [eveN isEqual:@"Onbrd_OCR_BuyNow"]) {
+        return @{@"Purchase_OCR" : @"SubTbr_OCR"};
+    } else if ([eveN isEqual:@"Reading_SplitView_BuyNow"] ||
+               [eveN isEqual:@"Reading_Rotate_BuyNow"] ||
+               [eveN isEqual:@"Reading_Theme_BuyNow"] ||
+               [eveN isEqual:@"Reading_MultiTab_BuyNow"]) {
+        return @{@"Purchase_PageDisplay" : @"SubTbr_PageDisplay"};
+    } else if ([eveN isEqual:@"Onbrd_PrintPoster_BuyNow"] ||
+               [eveN isEqual:@"Onbrd_PrintMultiple_BuyNow"] ||
+               [eveN isEqual:@"Onbrd_PrintBooklet_BuyNow"]) {
+        return @{@"Purchase_Others" : @"Home_Others"};
+    } else if ([eveN isEqual:@"Reading_Flatten_BuyNow"]) {
+        return @{@"Purchase_Others" : @"SubTbr_Others"};
+    } else if ([eveN isEqual:@"MenuBar_PrintPoster_BuyNow"] ||
+               [eveN isEqual:@"MenuBar_PrintMultiple_BuyNow"] ||
+               [eveN isEqual:@"MenuBar_PrintBooklet_BuyNow"]) {
+        return @{@"Purchase_Others" : @"MenuBar_Others"};
+    }
+    return nil;
+}
+
+- (NSString *)_buyNowEventToPaidEventName {
+    NSString *eveN = self.kEventName;
+    if (eveN == nil || eveN.length == 0) {
+        return nil;
+    }
+
+    // Paid_Tools
+    if ([eveN isEqual:@"Reading_WebsiteLink_BuyNow"]) {
+        return @"Reading_WebsiteLink_Paid";
+    } else if ([eveN isEqual:@"Reading_EmailLink_BuyNow"]) {
+        return @"Reading_EmailLink_Paid";
+    } else if ([eveN isEqual:@"Reading_DynamicStamp_BuyNow"]) {
+        return @"Reading_DynamicStamp_Paid";
+    } else if ([eveN isEqual:@"Reading_CustomStamp_BuyNow"]) {
+        return @"Reading_CustomStamp_Paid";
+    } else if ([eveN isEqual:@"Reading_Signature_BuyNow"]) {
+        return @"Reading_Signature_Paid";
+    } else if ([eveN isEqual:@"Reading_Table_BuyNow"]) {
+        return @"Reading_Table_Paid";
+    }
+    // Paid_PageEdit SubTbr_PageEdit
+    else if ([eveN isEqual:@"Reading_InsertBlankPage_BuyNow"]) {
+        return @"Reading_InsertBlankPage_Paid";
+    } else if ([eveN isEqual:@"Reading_InsertPDF_BuyNow"]) {
+        return @"Reading_InsertPDF_Paid";
+    } else if ([eveN isEqual:@"Reading_InsertSacnner_BuyNow"]) {
+        return @"Reading_InsertSacnner_Paid";
+    } else if ([eveN isEqual:@"Reading_InsertImage_BuyNow"]) {
+        return @"Reading_InsertImage_Paid";
+    } else if ([eveN isEqual:@"Reading_InsertClipboard_BuyNow"]) {
+        return @"Reading_InsertClipboard_Paid";
+    } else if ([eveN isEqual:@"Reading_Replace_BuyNow"]) {
+        return @"Reading_Replace_Paid";
+    } else if ([eveN isEqual:@"Reading_Extract_BuyNow"]) {
+        return @"Reading_Extract_Paid";
+    } else if ([eveN isEqual:@"Reading_Split_BuyNow"]) {
+        return @"Reading_Split_Paid";
+    } else if ([eveN isEqual:@"Reading_Rotate_BuyNow"]) {
+        return @"Reading_Rotate_Paid";
+    } else if ([eveN isEqual:@"Reading_Reverse_BuyNow"]) {
+        return @"Reading_Reverse_Paid";
+    } else if ([eveN isEqual:@"Reading_Copy_BuyNow"]) {
+        return @"Reading_Copy_Paid";
+    } else if ([eveN isEqual:@"Reading_Delete_BuyNow"]) {
+        return @"Reading_Delete_Paid";
+    } else if ([eveN isEqual:@"Reading_Merge_BuyNow"]) {
+        return @"Reading_Merge_Paid";
+    }
+    // Paid_PageEdit Home_PageEdit
+    else if ([eveN isEqual:@"Onbrd_EditPage_BuyNow"]) {
+        return  @"Onbrd_EditPage_Paid";
+    } else if ([eveN isEqual:@"Onbrd_Merge_BuyNow"]) {
+        return  @"Onbrd_Merge_Paid";
+    }
+    // Paid_Editor SubTbr_Editor
+    else if ([eveN isEqual:@"Reading_RemoveSecurity_BuyNow"]) {
+        return @"Reading_RemoveSecurity_Paid";
+    } else if ([eveN isEqual:@"Reading_Compare_BuyNow"]) {
+        return @"Reading_Compare_Paid";
+    } else if ([eveN isEqual:@"Reading_AddWatermark_BuyNow"]) {
+        return @"Reading_AddWatermark_Paid";
+    } else if ([eveN isEqual:@"Reading_RemoveWatermark_BuyNow"]) {
+        return @"Reading_RemoveWatermark_Paid";
+    } else if ([eveN isEqual:@"Reading_AddBackground_BuyNow"]) {
+        return @"Reading_AddBackground_Paid";
+    } else if ([eveN isEqual:@"Reading_RemoveBackground_BuyNow"]) {
+        return @"Reading_RemoveBackground_Paid";
+    } else if ([eveN isEqual:@"Reading_AddHeaderFooter_BuyNow"]) {
+        return @"Reading_AddHeaderFooter_Paid";
+    } else if ([eveN isEqual:@"Reading_RemoveHeaderFooter_BuyNow"]) {
+        return @"Reading_RemoveHeaderFooter_Paid";
+    } else if ([eveN isEqual:@"Reading_AddBates_BuyNow"]) {
+        return @"Reading_AddBates_Paid";
+    } else if ([eveN isEqual:@"Reading_RemoveBates_BuyNow"]) {
+        return @"Reading_RemoveBates_Paid";
+    } else if ([eveN isEqual:@"Reading_Measure_BuyNow"]) {
+        return @"Reading_Measure_Paid";
+    }
+    // Paid_Editor Home_Editor
+    else if ([eveN isEqual:@"Onbrd_Compare_BuyNow"]) {
+        return @"Onbrd_Compare_Paid";
+    } else if ([eveN isEqual:@"Onbrd_Background_BuyNow"]) {
+        return @"Onbrd_Background_Paid";
+    } else if ([eveN isEqual:@"Onbrd_Watermard_BuyNow"]) {
+        return @"Onbrd_Watermard_Paid";
+    } else if ([eveN isEqual:@"Onbrd_HeaderFooter_BuyNow"]) {
+        return @"Onbrd_HeaderFooter_Paid";
+    } else if ([eveN isEqual:@"Onbrd_Bates_BuyNow"]) {
+        return @"Onbrd_Bates_Paid";
+    } else if ([eveN isEqual:@"Onbrd_Security_BuyNow"]) {
+        return @"Onbrd_Security_Paid";
+    }
+    // Paid_Converter SubTbr_Converte
+    else if ([eveN isEqual:@"Reading_PDFtoWord_BuyNow"]) {
+        return @"Reading_PDFtoWord_Paid";
+    } else if ([eveN isEqual:@"Reading_PDFtoExcel_BuyNow"]) {
+        return @"Reading_PDFtoExcel_Paid";
+    } else if ([eveN isEqual:@"Reading_PDFtoPPT_BuyNow"]) {
+        return @"Reading_PDFtoPPT_Paid";
+    } else if ([eveN isEqual:@"Reading_PDFtoRTF_BuyNow"]) {
+        return @"Reading_PDFtoRTF_Paid";
+    } else if ([eveN isEqual:@"Reading_PDFtoCSV_BuyNow"]) {
+        return @"Reading_PDFtoCSV_Paid";
+    } else if ([eveN isEqual:@"Reading_PDFtoText_BuyNow"]) {
+        return @"Reading_PDFtoText_Paid";
+    } else if ([eveN isEqual:@"Reading_PDFtoImage_BuyNow"]) {
+        return @"Reading_PDFtoImage_Paid";
+    } else if ([eveN isEqual:@"Reading_ExtractImage_BuyNow"]) {
+        return @"Reading_ExtractImage_Paid";
+    }
+    // Paid_Converter Home_Converter
+    else if ([eveN isEqual:@"Onbrd_ConvertPDF_BuyNow"]) {
+        return @"Onbrd_ConvertPDF_Paid";
+    } else if ([eveN isEqual:@"Onbrd_PDFtoWord_BuyNow"]) {
+        return @"Onbrd_PDFtoWord_Paid";
+    } else if ([eveN isEqual:@"Onbrd_PDFtoExcel_BuyNow"]) {
+        return @"Onbrd_PDFtoExcel_Paid";
+    } else if ([eveN isEqual:@"Onbrd_PDFtoPPT_BuyNow"]) {
+        return @"Onbrd_PDFtoPPT_Paid";
+    } else if ([eveN isEqual:@"Onbrd_ImagetoPDF_BuyNow"]) {
+        return @"Onbrd_ImagetoPDF_Paid";
+    }
+    // Paid_Form SubTbr_Forms
+    else if ([eveN isEqual:@"Reading_TextField_BuyNow"]) {
+        return @"Reading_TextField_Paid";
+    } else if ([eveN isEqual:@"Reading_CheckBox_BuyNow"]) {
+        return @"Reading_CheckBox_Paid";
+    } else if ([eveN isEqual:@"Reading_RadioButton_BuyNow"]) {
+        return @"Reading_RadioButton_Paid";
+    } else if ([eveN isEqual:@"Reading_ListBox_BuyNow"]) {
+        return @"Reading_ListBox_Paid";
+    } else if ([eveN isEqual:@"Reading_ComboBox_BuyNow"]) {
+        return @"Reading_ComboBox_Paid";
+    } else if ([eveN isEqual:@"Reading_Button_BuyNow"]) {
+        return @"Reading_Button_Paid";
+    }
+    // Paid_Sign SunTbr_Signature
+    else if ([eveN isEqual:@"Reading_FillSign_Signature_BuyNow"]) {
+        return @"Reading_FillSign_Signature_Paid";
+    } else if ([eveN isEqual:@"Reading_DigitalSign_BuyNow"]) {
+        return @"Reading_DigitalSign_Paid";
+    } else if ([eveN isEqual:@"Reading_ElectronicSign_BuyNow"]) {
+        return @"Reading_ElectronicSign_Paid";
+    }
+    // Paid_EditPDF Tbr_Edit PDF
+    else if ([eveN isEqual:@"Reading_EditPDF_BuyNow"]) {
+        return @"Reading_EditPDF_Paid";
+    } else if ([eveN isEqual:@"Reading_ReplaceText_BuyNow"]) {
+        return @"Reading_ReplaceText_Paid";
+    }
+    // Paid_Redact Tbr_Redact
+    else if ([eveN isEqual:@"Reading_Redact_BuyNow"]) {
+        return @"Reading_Redact_Paid";
+    }
+    // Paid_OCR SubTbr_OCR
+    else if ([eveN isEqual:@"Reading_OCR_BuyNow"]) {
+        return @"Reading_OCR_Paid";
+    } else if ([eveN isEqual:@"Reading_Convert_OCR_BuyNow"]) {
+        return @"Reading_Convert_OCR_Paid";
+    } else if ([eveN isEqual:@"Onbrd_OCR_BuyNow"]) {
+        return @"Onbrd_OCR_Paid";
+    }
+    // Paid_PageDisplay SubTbr_Page Display
+    else if ([eveN isEqual:@"Reading_SplitView_BuyNow"]) {
+        return @"Reading_SplitView_Paid";
+    } else if ([eveN isEqual:@"Reading_Rotate_BuyNow"]) {
+        return @"Reading_Rotate_Paid";
+    } else if ([eveN isEqual:@"Reading_Theme_BuyNow"]) {
+        return @"Reading_Theme_Paid";
+    } else if ([eveN isEqual:@"Reading_MultiTab_BuyNow"]) {
+        return @"Reading_MultiTab_Paid";
+    }
+    //  Home_Others
+    else if ([eveN isEqual:@"Onbrd_PrintPoster_BuyNow"]) {
+        return @"Onbrd_PrintPoster_Paid";
+    } else if ([eveN isEqual:@"Onbrd_PrintMultiple_BuyNow"]) {
+        return @"Onbrd_PrintMultiple_Paid";
+    } else if ([eveN isEqual:@"Onbrd_PrintBooklet_BuyNow"]) {
+        return @"Onbrd_PrintBooklet_Paid";
+    }
+    // Paid_Others SubTbr_Others
+    else if ([eveN isEqual:@"Reading_Flatten_BuyNow"]) {
+        return @"Reading_Flatten_Paid";
+    }
+    // Paid_Others MenuBar_Others
+    else if ([eveN isEqual:@"MenuBar_PrintPoster_BuyNow"]) {
+        return @"MenuBar_PrintPoster_Paid";
+    } else if ([eveN isEqual:@"MenuBar_PrintMultiple_BuyNow"]) {
+        return @"MenuBar_PrintMultiple_Paid";
+    } else if ([eveN isEqual:@"MenuBar_PrintBooklet_BuyNow"]) {
+        return @"MenuBar_PrintBooklet_Paid";
+    }
+    return nil;
+}
+
+- (NSDictionary *)_getPaidEventParamsWith:(NSString *)eventN {
+    NSString *eveN = eventN;
+    if (eveN == nil || eveN.length == 0) {
+        return nil;
+    }
+    
+    // Paid_Tools SubTbr_Tools
+    if ([eveN isEqual:@"Reading_WebsiteLink_Paid"] ||
+        [eveN isEqual:@"Reading_EmailLink_Paid"] ||
+        [eveN isEqual:@"Reading_DynamicStamp_Paid"] ||
+        [eveN isEqual:@"Reading_CustomStamp_Paid"] ||
+        [eveN isEqual:@"Reading_Signature_Paid"] ||
+        [eveN isEqual:@"Reading_Table_Paid"]) {
+        return @{@"Paid_Tools" : @"SubTbr_Tools"};
+    }
+    // Paid_PageEdit SubTbr_PageEdit
+    else if ([eveN isEqual:@"Reading_InsertBlankPage_Paid"] ||
+             [eveN isEqual:@"Reading_InsertPDF_Paid"] ||
+             [eveN isEqual:@"Reading_InsertSacnner_Paid"] ||
+             [eveN isEqual:@"Reading_InsertImage_Paid"] ||
+             [eveN isEqual:@"Reading_InsertClipboard_Paid"] ||
+             [eveN isEqual:@"Reading_Replace_Paid"] ||
+             [eveN isEqual:@"Reading_Extract_Paid"] ||
+             [eveN isEqual:@"Reading_Split_Paid"] ||
+             [eveN isEqual:@"Reading_Rotate_Paid"] ||
+             [eveN isEqual:@"Reading_Reverse_Paid"] ||
+             [eveN isEqual:@"Reading_Copy_Paid"] ||
+             [eveN isEqual:@"Reading_Delete_Paid"] ||
+             [eveN isEqual:@"Reading_Merge_Paid"]) {
+        return @{@"Paid_PageEdit" : @"SubTbr_PageEdit"};
+    }
+    // Paid_PageEdit Home_PageEdit
+    else if ([eveN isEqual:@"Onbrd_EditPage_Paid"] ||
+             [eveN isEqual:@"Onbrd_Merge_Paid"]) {
+        return @{@"Paid_PageEdit" : @"Home_PageEdit"};
+    }
+    // Paid_Editor SubTbr_Editor
+    else if ([eveN isEqual:@"Reading_RemoveSecurity_Paid"] ||
+             [eveN isEqual:@"Reading_Compare_Paid"] ||
+             [eveN isEqual:@"Reading_AddWatermark_Paid"] ||
+             [eveN isEqual:@"Reading_RemoveWatermark_Paid"] ||
+             [eveN isEqual:@"Reading_AddBackground_Paid"] ||
+             [eveN isEqual:@"Reading_RemoveBackground_Paid"] ||
+             [eveN isEqual:@"Reading_AddHeaderFooter_Paid"] ||
+             [eveN isEqual:@"Reading_RemoveHeaderFooter_Paid"] ||
+             [eveN isEqual:@"Reading_AddBates_Paid"] ||
+             [eveN isEqual:@"Reading_RemoveBates_Paid"] ||
+             [eveN isEqual:@"Reading_Measure_Paid"]) {
+        return @{@"" : @""};
+    }
+    // Paid_Editor Home_Editor
+    else if ([eveN isEqual:@"Onbrd_Compare_Paid"] ||
+             [eveN isEqual:@"Onbrd_Background_Paid"] ||
+             [eveN isEqual:@"Onbrd_Watermard_Paid"] ||
+             [eveN isEqual:@"Onbrd_HeaderFooter_Paid"] ||
+             [eveN isEqual:@"Onbrd_Bates_Paid"] ||
+             [eveN isEqual:@"Onbrd_Security_Paid"]) {
+        return @{@"Paid_Editor" : @"Home_Editor"};
+    }
+    // Paid_Converter SubTbr_Converter
+    else if ([eveN isEqual:@"Reading_PDFtoWord_Paid"] ||
+             [eveN isEqual:@"Reading_PDFtoExcel_Paid"] ||
+              [eveN isEqual:@"Reading_PDFtoPPT_Paid"] ||
+              [eveN isEqual:@"Reading_PDFtoRTF_Paid"] ||
+              [eveN isEqual:@"Reading_PDFtoCSV_Paid"] ||
+              [eveN isEqual:@"Reading_PDFtoText_Paid"] ||
+              [eveN isEqual:@"Reading_PDFtoImage_Paid"] ||
+              [eveN isEqual:@"Reading_ExtractImage_Paid"]) {
+        return @{@"Paid_Converter" : @"SubTbr_Converter"};
+    }
+    // Paid_Converter Home_Converter
+    else if ([eveN isEqual:@"Onbrd_ConvertPDF_Paid"] ||
+             [eveN isEqual:@"Onbrd_PDFtoWord_Paid"] ||
+             [eveN isEqual:@"Onbrd_PDFtoExcel_Paid"] ||
+              [eveN isEqual:@"Onbrd_PDFtoPPT_Paid"] ||
+              [eveN isEqual:@"Onbrd_ImagetoPDF_Paid"]) {
+        return @{@"Paid_Converter" : @"Home_Converter"};
+    }
+    // Paid_Form SubTbr_Forms
+    else if ([eveN isEqual:@"Reading_TextField_Paid"] ||
+             [eveN isEqual:@"Reading_CheckBox_Paid"] ||
+             [eveN isEqual:@"Reading_RadioButton_Paid"] ||
+             [eveN isEqual:@"Reading_ListBox_Paid"] ||
+             [eveN isEqual:@"Reading_ComboBox_Paid"] ||
+             [eveN isEqual:@"Reading_Button_Paid"]) {
+        return @{@"Paid_Form" : @"SubTbr_Forms"};
+    }
+    // Paid_Sign SunTbr_Signature
+    else if ([eveN isEqual:@"Reading_FillSign_Signature_Paid"] ||
+             [eveN isEqual:@"Reading_DigitalSign_Paid"] ||
+             [eveN isEqual:@"Reading_ElectronicSign_Paid"]) {
+        return @{@"Paid_Sign" : @"SunTbr_Signature"};
+    }
+    // Paid_EditPDF Tbr_Edit PDF
+    else if ([eveN isEqual:@"Reading_EditPDF_Paid"] ||
+             [eveN isEqual:@"Reading_ReplaceText_Paid"]) {
+        return @{@"Paid_EditPDF" : @"Tbr_Edit PDF"};
+    }
+    // Paid_Redact Tbr_Redact
+    else if ([eveN isEqual:@"Reading_Redact_Paid"]) {
+        return @{@"Paid_Redact" : @"Tbr_Redact"};
+    }
+    // Paid_OCR SubTbr_OCR
+    else if ([eveN isEqual:@"Reading_OCR_Paid"] ||
+             [eveN isEqual:@"Reading_Convert_OCR_Paid"] ||
+             [eveN isEqual:@"Onbrd_OCR_Paid"]) {
+        return @{@"Paid_OCR" : @"SubTbr_OCR"};
+    }
+    // Paid_PageDisplay SubTbr_Page Display
+    else if ([eveN isEqual:@"Reading_SplitView_Paid"] ||
+             [eveN isEqual:@"Reading_Rotate_Paid"] ||
+             [eveN isEqual:@"Reading_Theme_Paid"] ||
+             [eveN isEqual:@"Reading_MultiTab_Paid"]) {
+        return @{@"Paid_PageDisplay" : @"SubTbr_Page Display"};
+    }
+    //  Home_Others
+    else if ([eveN isEqual:@"Onbrd_PrintPoster_Paid"] ||
+             [eveN isEqual:@"Onbrd_PrintMultiple_Paid"] ||
+             [eveN isEqual:@"Onbrd_PrintBooklet_Paid"]) {
+        return @{@"Paid_Others" : @"Home_Others"};
+    }
+    // Paid_Others SubTbr_Others
+    else if ([eveN isEqual:@"Reading_Flatten_Paid"]) {
+        return @{@"Paid_Others" : @"SubTbr_Others"};
+    }
+    // Paid_Others MenuBar_Others
+    else if ([eveN isEqual:@"MenuBar_PrintPoster_Paid"] ||
+             [eveN isEqual:@"MenuBar_PrintMultiple_Paid"] ||
+             [eveN isEqual:@"MenuBar_PrintBooklet_Paid"]) {
+        return @{@"Paid_Others" : @"MenuBar_Others"};
+    }
+    return nil;
+}
+
+
 @end

+ 136 - 47
PDF Office/PDF Master/Class/Purchase/DMG/KMPurchaseCompareDMGWindowController.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>
@@ -19,6 +19,9 @@
                 <outlet property="aiTitleLabel" destination="inx-bW-irf" id="RYQ-CD-MPH"/>
                 <outlet property="buyNowBox" destination="uWP-u3-9ES" id="7M1-B9-9w1"/>
                 <outlet property="buyNowButton" destination="HrV-Kb-x66" id="Qc0-hK-Otk"/>
+                <outlet property="buySwitch" destination="tbA-Jh-3g0" id="3Ix-rM-0vu"/>
+                <outlet property="discountPriceLabel" destination="2Ai-gP-tyw" id="otG-Wx-3sn"/>
+                <outlet property="discountPriceLabel2" destination="Utf-37-XY7" id="kss-xI-f9y"/>
                 <outlet property="discountTipImage" destination="KBo-MG-ErN" id="xI6-Lo-YRE"/>
                 <outlet property="enterLicenseButton" destination="JrW-cc-ivk" id="8vR-Ti-GJy"/>
                 <outlet property="freeContendView" destination="bSI-fT-0EN" id="dpN-M9-Jg2"/>
@@ -38,9 +41,11 @@
                 <outlet property="freeVersionLbl" destination="hW7-gR-Gg1" id="x2T-M6-cXN"/>
                 <outlet property="freeVersionLineView" destination="vL8-ba-6qD" id="qPG-2Q-Y4Z"/>
                 <outlet property="oneTimeTipLbl" destination="tDw-Yz-8eU" id="JzJ-Bq-FFG"/>
+                <outlet property="originalPriceLabel" destination="ff7-bb-SZU" id="wMW-2K-rl6"/>
                 <outlet property="parmanentInfoView" destination="pBx-aL-HB5" id="bES-gi-ZXJ"/>
                 <outlet property="parmanentVerBGView" destination="sMr-Hu-FgQ" id="qBw-GC-9u7"/>
                 <outlet property="parmanentVerInfoBtn2" destination="3mX-DM-Ssw" id="wor-Lh-GWC"/>
+                <outlet property="parmanentVerInfoImage1" destination="XEN-LV-Gvh" id="tdi-Sb-6ua"/>
                 <outlet property="parmanentVerInfoLbl1" destination="zlT-ii-WYi" id="DXw-7o-Se2"/>
                 <outlet property="parmanentVerInfoLbl10" destination="HWK-kT-yEA" id="Sb9-FY-5sU"/>
                 <outlet property="parmanentVerInfoLbl2" destination="xnv-Sf-nZ1" id="4ek-uc-drU"/>
@@ -53,6 +58,8 @@
                 <outlet property="parmanentVerInfoLbl9" destination="sAj-ob-iZk" id="IhT-MV-o7P"/>
                 <outlet property="parmanentVerLbl" destination="xB9-aF-9mk" id="ya8-aa-ISN"/>
                 <outlet property="parmanentVerinfoimg2" destination="Tko-Q7-b96" id="jxq-yK-b9I"/>
+                <outlet property="permanentLabel" destination="7RN-3g-qpL" id="J1U-hW-PCm"/>
+                <outlet property="premiumLabel" destination="UAe-RJ-yib" id="yhm-cr-zxi"/>
                 <outlet property="titleLabel" destination="PYw-CG-kOA" id="97w-HQ-3Fh"/>
                 <outlet property="window" destination="F0z-JX-Cv5" id="gIp-Ho-8D9"/>
             </connections>
@@ -63,7 +70,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="160" y="33" width="932" height="610"/>
-            <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="932" height="610"/>
             <value key="maxSize" type="size" width="932" height="1110"/>
             <view key="contentView" wantsLayer="YES" id="se5-gp-TjO">
@@ -88,7 +95,7 @@
                                     <action selector="enterLicenseAction:" target="-2" id="c66-I2-Yta"/>
                                 </connections>
                             </button>
-                            <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="PYw-CG-kOA">
+                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="PYw-CG-kOA">
                                 <rect key="frame" x="330" y="556" width="273" height="24"/>
                                 <textFieldCell key="cell" lineBreakMode="clipping" title="Upgrade to Permanent Version" id="mXT-0V-U8G">
                                     <font key="font" metaFont="system" size="20"/>
@@ -102,7 +109,7 @@
                                     <customView translatesAutoresizingMaskIntoConstraints="NO" id="wbK-Ex-3dw">
                                         <rect key="frame" x="0.0" y="0.0" width="284" height="474"/>
                                         <subviews>
-                                            <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="hW7-gR-Gg1">
+                                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="hW7-gR-Gg1">
                                                 <rect key="frame" x="73" y="427" width="139" height="28"/>
                                                 <textFieldCell key="cell" lineBreakMode="clipping" title="Free Version" id="l5l-jW-bbS">
                                                     <font key="font" metaFont="systemSemibold" size="24"/>
@@ -128,7 +135,7 @@
                                                         </constraints>
                                                         <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="function_vip" id="TRW-cy-tts"/>
                                                     </imageView>
-                                                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="xaG-Yc-Kmu">
+                                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="xaG-Yc-Kmu">
                                                         <rect key="frame" x="34" y="253" width="202" height="20"/>
                                                         <constraints>
                                                             <constraint firstAttribute="height" relation="greaterThanOrEqual" constant="20" id="c8L-yx-7H9"/>
@@ -147,7 +154,7 @@
                                                         </constraints>
                                                         <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="function_vip" id="BZa-F2-hcC"/>
                                                     </imageView>
-                                                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="11Y-f7-Zj2">
+                                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="11Y-f7-Zj2">
                                                         <rect key="frame" x="34" y="225" width="202" height="20"/>
                                                         <constraints>
                                                             <constraint firstAttribute="height" relation="greaterThanOrEqual" constant="20" id="3V1-ua-cBJ"/>
@@ -166,7 +173,7 @@
                                                         </constraints>
                                                         <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="compare_nosupport" id="a1c-h0-EhN"/>
                                                     </imageView>
-                                                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="cIu-Xk-RbB">
+                                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="cIu-Xk-RbB">
                                                         <rect key="frame" x="34" y="197" width="202" height="20"/>
                                                         <constraints>
                                                             <constraint firstAttribute="height" relation="greaterThanOrEqual" constant="20" id="n6a-8j-4Jx"/>
@@ -185,7 +192,7 @@
                                                         </constraints>
                                                         <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="compare_nosupport" id="Mi1-wo-N70"/>
                                                     </imageView>
-                                                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="drj-ku-nB2">
+                                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="drj-ku-nB2">
                                                         <rect key="frame" x="34" y="169" width="202" height="20"/>
                                                         <constraints>
                                                             <constraint firstAttribute="height" relation="greaterThanOrEqual" constant="20" id="jSe-bh-zc6"/>
@@ -204,7 +211,7 @@
                                                         </constraints>
                                                         <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="compare_nosupport" id="lih-Ae-WxX"/>
                                                     </imageView>
-                                                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="aqC-Bx-eUM">
+                                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="aqC-Bx-eUM">
                                                         <rect key="frame" x="34" y="141" width="202" height="20"/>
                                                         <constraints>
                                                             <constraint firstAttribute="height" relation="greaterThanOrEqual" constant="20" id="xx6-Qz-oju"/>
@@ -223,7 +230,7 @@
                                                         </constraints>
                                                         <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="compare_nosupport" id="SwV-uC-WHy"/>
                                                     </imageView>
-                                                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="9Cn-ee-K9o">
+                                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="9Cn-ee-K9o">
                                                         <rect key="frame" x="34" y="113" width="202" height="20"/>
                                                         <constraints>
                                                             <constraint firstAttribute="height" relation="greaterThanOrEqual" constant="20" id="9E4-1b-Xxa"/>
@@ -242,7 +249,7 @@
                                                         </constraints>
                                                         <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="compare_nosupport" id="rdh-jo-8al"/>
                                                     </imageView>
-                                                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="8Eg-fh-d4o">
+                                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="8Eg-fh-d4o">
                                                         <rect key="frame" x="34" y="85" width="202" height="20"/>
                                                         <constraints>
                                                             <constraint firstAttribute="height" relation="greaterThanOrEqual" constant="20" id="uZT-B7-cDY"/>
@@ -261,7 +268,7 @@
                                                         </constraints>
                                                         <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="compare_nosupport" id="9at-M1-45l"/>
                                                     </imageView>
-                                                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="AAH-AD-uBk">
+                                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="AAH-AD-uBk">
                                                         <rect key="frame" x="34" y="57" width="202" height="20"/>
                                                         <constraints>
                                                             <constraint firstAttribute="height" relation="greaterThanOrEqual" constant="20" id="lyK-Wx-OUz"/>
@@ -280,7 +287,7 @@
                                                         </constraints>
                                                         <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="compare_nosupport" id="rfl-3x-q37"/>
                                                     </imageView>
-                                                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="GCv-Zo-FpH">
+                                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="GCv-Zo-FpH">
                                                         <rect key="frame" x="34" y="32" width="202" height="17"/>
                                                         <textFieldCell key="cell" title="View PDFs" id="JPB-N9-U7c">
                                                             <font key="font" metaFont="system" size="14"/>
@@ -296,7 +303,7 @@
                                                         </constraints>
                                                         <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="compare_nosupport" id="Pim-As-S9G"/>
                                                     </imageView>
-                                                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="UKG-ux-KRO">
+                                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="UKG-ux-KRO">
                                                         <rect key="frame" x="34" y="5" width="202" height="17"/>
                                                         <textFieldCell key="cell" title="View PDFs" id="KKy-Bg-y3A">
                                                             <font key="font" metaFont="system" size="14"/>
@@ -318,6 +325,7 @@
                                                     <constraint firstItem="Jgm-mH-Qhj" firstAttribute="leading" secondItem="uTt-h1-2BX" secondAttribute="leading" id="Ibc-dS-SY0"/>
                                                     <constraint firstItem="AAH-AD-uBk" firstAttribute="top" secondItem="7w2-Se-UeC" secondAttribute="top" id="Kbb-bf-cIA"/>
                                                     <constraint firstItem="i1G-04-uom" firstAttribute="top" secondItem="AAH-AD-uBk" secondAttribute="bottom" constant="8" id="KzE-XJ-Bfk"/>
+                                                    <constraint firstItem="UKG-ux-KRO" firstAttribute="leading" secondItem="GCv-Zo-FpH" secondAttribute="leading" id="L2e-qD-HhH"/>
                                                     <constraint firstItem="9Cn-ee-K9o" firstAttribute="top" secondItem="8ix-zm-8qS" secondAttribute="top" id="L2r-fk-Q05"/>
                                                     <constraint firstAttribute="trailing" secondItem="xaG-Yc-Kmu" secondAttribute="trailing" constant="2" id="Lde-xs-gYU"/>
                                                     <constraint firstItem="GCv-Zo-FpH" firstAttribute="leading" secondItem="i1G-04-uom" secondAttribute="trailing" constant="16" id="MTn-iq-17X"/>
@@ -353,6 +361,7 @@
                                                     <constraint firstItem="8Eg-fh-d4o" firstAttribute="top" secondItem="Jgm-mH-Qhj" secondAttribute="top" id="slH-LP-MHQ"/>
                                                     <constraint firstAttribute="trailing" secondItem="11Y-f7-Zj2" secondAttribute="trailing" constant="2" id="t1X-RU-Kg8"/>
                                                     <constraint firstAttribute="trailing" secondItem="GCv-Zo-FpH" secondAttribute="trailing" constant="2" id="tUS-kN-mJh"/>
+                                                    <constraint firstItem="UKG-ux-KRO" firstAttribute="trailing" secondItem="GCv-Zo-FpH" secondAttribute="trailing" id="vll-kb-gpx"/>
                                                     <constraint firstItem="xaG-Yc-Kmu" firstAttribute="top" secondItem="uTt-h1-2BX" secondAttribute="top" constant="2" id="xoC-Fj-Oj0"/>
                                                     <constraint firstAttribute="trailing" secondItem="8Eg-fh-d4o" secondAttribute="trailing" constant="2" id="zBb-1p-gNr"/>
                                                     <constraint firstItem="11Y-f7-Zj2" firstAttribute="leading" secondItem="WpI-yY-axs" secondAttribute="trailing" constant="16" id="zSU-Og-Ggx"/>
@@ -364,7 +373,7 @@
                                                     <rect key="frame" x="1" y="1" width="160" height="38"/>
                                                     <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                                     <subviews>
-                                                        <button focusRingType="none" verticalHuggingPriority="750" fixedFrame="YES" allowsExpansionToolTips="YES" translatesAutoresizingMaskIntoConstraints="NO" id="4fI-f7-Qnp" customClass="KMButton" customModule="PDF_Reader_Pro" customModuleProvider="target">
+                                                        <button focusRingType="none" allowsExpansionToolTips="YES" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="4fI-f7-Qnp" customClass="KMButton" customModule="PDF_Reader_Pro" customModuleProvider="target">
                                                             <rect key="frame" x="0.0" y="0.0" width="162" height="40"/>
                                                             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                                             <buttonCell key="cell" type="square" title="Free Trial" bezelStyle="shadowlessSquare" alignment="center" lineBreakMode="truncatingMiddle" focusRingType="none" imageScaling="proportionallyDown" inset="2" id="OUe-aZ-jdt">
@@ -408,7 +417,7 @@
                                         <rect key="frame" x="0.0" y="0.0" width="284" height="474"/>
                                         <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="axesIndependently" image="AIDMGBG" id="pL4-Kh-6Ho"/>
                                     </imageView>
-                                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="inx-bW-irf">
+                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="inx-bW-irf">
                                         <rect key="frame" x="102" y="428" width="89" height="28"/>
                                         <textFieldCell key="cell" lineBreakMode="clipping" title="AI Tools" id="uog-PY-C6F">
                                             <font key="font" metaFont="systemSemibold" size="24"/>
@@ -434,7 +443,7 @@
                                                 </constraints>
                                                 <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="vipAbleIcon" id="usA-3E-SLF"/>
                                             </imageView>
-                                            <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="dD0-C2-Lga">
+                                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="dD0-C2-Lga">
                                                 <rect key="frame" x="30" y="184" width="88" height="16"/>
                                                 <textFieldCell key="cell" title="AI Summarize" id="3vB-Fw-N6B">
                                                     <font key="font" metaFont="system"/>
@@ -450,7 +459,7 @@
                                                 </constraints>
                                                 <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="vipAbleIcon" id="LzZ-iP-8em"/>
                                             </imageView>
-                                            <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="pdE-kf-rtu">
+                                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="pdE-kf-rtu">
                                                 <rect key="frame" x="30" y="156" width="73" height="17"/>
                                                 <textFieldCell key="cell" title="View PDFs" id="83k-RN-53d">
                                                     <font key="font" metaFont="system" size="14"/>
@@ -466,7 +475,7 @@
                                                 </constraints>
                                                 <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="vipAbleIcon" id="csy-Zd-yX9"/>
                                             </imageView>
-                                            <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="zyJ-pN-yCh">
+                                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="zyJ-pN-yCh">
                                                 <rect key="frame" x="30" y="128" width="73" height="17"/>
                                                 <textFieldCell key="cell" title="View PDFs" id="LBd-dR-Ld1">
                                                     <font key="font" metaFont="system" size="14"/>
@@ -482,7 +491,7 @@
                                                 </constraints>
                                                 <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="vipAbleIcon" id="bdL-7C-DKn"/>
                                             </imageView>
-                                            <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="1OY-mu-1YV">
+                                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="1OY-mu-1YV">
                                                 <rect key="frame" x="30" y="100" width="73" height="17"/>
                                                 <textFieldCell key="cell" title="View PDFs" id="p6V-Sz-eSC">
                                                     <font key="font" metaFont="system" size="14"/>
@@ -530,7 +539,7 @@
                                                         </constraints>
                                                         <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="axesIndependently" image="aiIconA" id="bjw-7w-ecP"/>
                                                     </imageView>
-                                                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="2yh-PK-SVp">
+                                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="2yh-PK-SVp">
                                                         <rect key="frame" x="26" y="4" width="79" height="16"/>
                                                         <textFieldCell key="cell" lineBreakMode="clipping" title="My AI Credit" id="PkG-XP-GsP">
                                                             <font key="font" metaFont="system"/>
@@ -550,14 +559,14 @@
                                             </customView>
                                             <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="0S4-Y8-qlW" customClass="KMButton" customModule="PDF_Reader_Pro" customModuleProvider="target">
                                                 <rect key="frame" x="0.0" y="0.0" width="200" height="40"/>
-                                                <constraints>
-                                                    <constraint firstAttribute="height" constant="40" id="gtc-cl-Yxg"/>
-                                                    <constraint firstAttribute="width" constant="200" id="rJW-IL-6Pp"/>
-                                                </constraints>
                                                 <buttonCell key="cell" type="bevel" bezelStyle="rounded" imagePosition="overlaps" alignment="center" lineBreakMode="charWrapping" imageScaling="axesIndependently" inset="2" id="nfY-Ib-pyH">
                                                     <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                                     <font key="font" metaFont="smallSystem"/>
                                                 </buttonCell>
+                                                <constraints>
+                                                    <constraint firstAttribute="height" constant="40" id="gtc-cl-Yxg"/>
+                                                    <constraint firstAttribute="width" constant="200" id="rJW-IL-6Pp"/>
+                                                </constraints>
                                                 <connections>
                                                     <action selector="aiPurchaseButtonClick:" target="-2" id="1LH-Br-IFZ"/>
                                                 </connections>
@@ -600,7 +609,7 @@
                                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                         <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="axesIndependently" image="dmg_upgrade_part_bg" id="gA1-8q-pda"/>
                                     </imageView>
-                                    <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="40K-mz-4Ku">
+                                    <imageView hidden="YES" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="40K-mz-4Ku">
                                         <rect key="frame" x="221" y="478" width="71" height="24"/>
                                         <constraints>
                                             <constraint firstAttribute="height" constant="24" id="DGI-EH-CtC"/>
@@ -608,7 +617,7 @@
                                         </constraints>
                                         <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="vip_pro_icon" id="ay0-vg-Q18"/>
                                     </imageView>
-                                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="xB9-aF-9mk">
+                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="xB9-aF-9mk">
                                         <rect key="frame" x="44" y="438" width="213" height="28"/>
                                         <textFieldCell key="cell" lineBreakMode="clipping" title="Permanent License" id="bgF-Cs-9jH">
                                             <font key="font" metaFont="systemSemibold" size="24"/>
@@ -616,7 +625,7 @@
                                             <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                                         </textFieldCell>
                                     </textField>
-                                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="tDw-Yz-8eU">
+                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="tDw-Yz-8eU">
                                         <rect key="frame" x="87" y="417" width="126" height="17"/>
                                         <textFieldCell key="cell" lineBreakMode="clipping" title="one-time purchase" id="AmC-dB-pSk">
                                             <font key="font" metaFont="system" size="14"/>
@@ -625,7 +634,7 @@
                                         </textFieldCell>
                                     </textField>
                                     <customView translatesAutoresizingMaskIntoConstraints="NO" id="pBx-aL-HB5">
-                                        <rect key="frame" x="32" y="106" width="236" height="274"/>
+                                        <rect key="frame" x="32" y="84" width="236" height="274"/>
                                         <subviews>
                                             <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="XEN-LV-Gvh">
                                                 <rect key="frame" x="0.0" y="252" width="20" height="20"/>
@@ -635,7 +644,7 @@
                                                 </constraints>
                                                 <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="function_vip" id="MoF-fp-kom"/>
                                             </imageView>
-                                            <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="zlT-ii-WYi">
+                                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="zlT-ii-WYi">
                                                 <rect key="frame" x="34" y="252" width="202" height="20"/>
                                                 <constraints>
                                                     <constraint firstAttribute="height" relation="greaterThanOrEqual" constant="20" id="SyG-jP-ZTw"/>
@@ -654,7 +663,7 @@
                                                 </constraints>
                                                 <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="function_vip" id="dbH-z7-kvT"/>
                                             </imageView>
-                                            <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="xnv-Sf-nZ1">
+                                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="xnv-Sf-nZ1">
                                                 <rect key="frame" x="34" y="224" width="69" height="20"/>
                                                 <constraints>
                                                     <constraint firstAttribute="height" relation="greaterThanOrEqual" constant="20" id="sQH-yQ-S3I"/>
@@ -671,14 +680,14 @@
                                             </imageView>
                                             <button translatesAutoresizingMaskIntoConstraints="NO" id="3mX-DM-Ssw" customClass="KMButton" customModule="PDF_Reader_Pro" customModuleProvider="target">
                                                 <rect key="frame" x="101" y="224" width="20" height="20"/>
-                                                <constraints>
-                                                    <constraint firstAttribute="height" constant="20" id="DQB-Bc-Hea"/>
-                                                    <constraint firstAttribute="width" constant="20" id="rlY-sN-tsh"/>
-                                                </constraints>
                                                 <buttonCell key="cell" type="roundRect" bezelStyle="roundedRect" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="kWd-ga-hI9">
                                                     <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                                     <font key="font" metaFont="cellTitle"/>
                                                 </buttonCell>
+                                                <constraints>
+                                                    <constraint firstAttribute="height" constant="20" id="DQB-Bc-Hea"/>
+                                                    <constraint firstAttribute="width" constant="20" id="rlY-sN-tsh"/>
+                                                </constraints>
                                             </button>
                                             <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="Xkj-ZO-il5">
                                                 <rect key="frame" x="0.0" y="196" width="20" height="20"/>
@@ -688,7 +697,7 @@
                                                 </constraints>
                                                 <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="function_vip" id="PWy-Nb-1Kk"/>
                                             </imageView>
-                                            <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Dgh-Aq-0O5">
+                                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Dgh-Aq-0O5">
                                                 <rect key="frame" x="34" y="196" width="202" height="20"/>
                                                 <constraints>
                                                     <constraint firstAttribute="height" relation="greaterThanOrEqual" constant="20" id="3dA-qn-Ega"/>
@@ -707,7 +716,7 @@
                                                 </constraints>
                                                 <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="function_vip" id="QTF-cc-g3j"/>
                                             </imageView>
-                                            <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="kaB-X2-mLe">
+                                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="kaB-X2-mLe">
                                                 <rect key="frame" x="34" y="168" width="202" height="20"/>
                                                 <constraints>
                                                     <constraint firstAttribute="height" relation="greaterThanOrEqual" constant="20" id="kis-m3-acf"/>
@@ -726,7 +735,7 @@
                                                 </constraints>
                                                 <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="function_vip" id="t4N-s0-4sh"/>
                                             </imageView>
-                                            <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Jb1-Ji-S0u">
+                                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Jb1-Ji-S0u">
                                                 <rect key="frame" x="34" y="140" width="202" height="20"/>
                                                 <constraints>
                                                     <constraint firstAttribute="height" relation="greaterThanOrEqual" constant="20" id="wTt-gm-QMU"/>
@@ -745,7 +754,7 @@
                                                 </constraints>
                                                 <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="function_vip" id="VnB-Ak-Vqh"/>
                                             </imageView>
-                                            <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="tPr-KE-sls">
+                                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="tPr-KE-sls">
                                                 <rect key="frame" x="34" y="112" width="202" height="20"/>
                                                 <constraints>
                                                     <constraint firstAttribute="height" constant="20" id="ziu-1B-u5w"/>
@@ -764,7 +773,7 @@
                                                 </constraints>
                                                 <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="function_vip" id="nj8-hb-08Z"/>
                                             </imageView>
-                                            <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="7p3-XR-Rs2">
+                                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="7p3-XR-Rs2">
                                                 <rect key="frame" x="34" y="84" width="202" height="20"/>
                                                 <constraints>
                                                     <constraint firstAttribute="height" relation="greaterThanOrEqual" constant="20" id="3np-Nn-FMA"/>
@@ -783,7 +792,7 @@
                                                 </constraints>
                                                 <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="function_vip" id="EsP-2z-FmA"/>
                                             </imageView>
-                                            <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="6cc-rQ-t1T">
+                                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="6cc-rQ-t1T">
                                                 <rect key="frame" x="34" y="56" width="202" height="20"/>
                                                 <constraints>
                                                     <constraint firstAttribute="height" relation="greaterThanOrEqual" constant="20" id="OSv-xl-VPX"/>
@@ -802,7 +811,7 @@
                                                 </constraints>
                                                 <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="function_vip" id="fnP-JO-ygh"/>
                                             </imageView>
-                                            <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="sAj-ob-iZk">
+                                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="sAj-ob-iZk">
                                                 <rect key="frame" x="34" y="32" width="202" height="16"/>
                                                 <textFieldCell key="cell" title="View PDFs" id="Ytw-iw-WBb">
                                                     <font key="font" metaFont="system"/>
@@ -810,7 +819,7 @@
                                                     <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                                                 </textFieldCell>
                                             </textField>
-                                            <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ezi-hQ-XkB">
+                                            <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="ezi-hQ-XkB">
                                                 <rect key="frame" x="0.0" y="4" width="20" height="20"/>
                                                 <constraints>
                                                     <constraint firstAttribute="height" constant="20" id="Kwv-NQ-3dl"/>
@@ -818,7 +827,7 @@
                                                 </constraints>
                                                 <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="function_vip" id="J2C-Nf-Uoq"/>
                                             </imageView>
-                                            <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="HWK-kT-yEA">
+                                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="HWK-kT-yEA">
                                                 <rect key="frame" x="34" y="6" width="69" height="16"/>
                                                 <textFieldCell key="cell" title="View PDFs" id="FEt-6L-A3r">
                                                     <font key="font" metaFont="system"/>
@@ -874,6 +883,7 @@
                                             <constraint firstItem="HHk-6V-4yO" firstAttribute="leading" secondItem="pBx-aL-HB5" secondAttribute="leading" id="hee-kE-zBr"/>
                                             <constraint firstAttribute="trailing" secondItem="tPr-KE-sls" secondAttribute="trailing" constant="2" id="hpZ-4G-Nqz"/>
                                             <constraint firstItem="Tko-Q7-b96" firstAttribute="top" secondItem="3mX-DM-Ssw" secondAttribute="top" id="iNb-vf-kIX"/>
+                                            <constraint firstItem="ezi-hQ-XkB" firstAttribute="centerY" secondItem="HWK-kT-yEA" secondAttribute="centerY" id="ks3-B0-jfd"/>
                                             <constraint firstItem="3mX-DM-Ssw" firstAttribute="centerY" secondItem="xnv-Sf-nZ1" secondAttribute="centerY" id="mAY-Hd-isN"/>
                                             <constraint firstItem="XEN-LV-Gvh" firstAttribute="leading" secondItem="pBx-aL-HB5" secondAttribute="leading" id="nSi-B8-wBW"/>
                                             <constraint firstItem="Tko-Q7-b96" firstAttribute="trailing" secondItem="3mX-DM-Ssw" secondAttribute="trailing" id="ngv-2q-YxI"/>
@@ -887,7 +897,7 @@
                                         </constraints>
                                     </customView>
                                     <box boxType="custom" borderType="none" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="uWP-u3-9ES">
-                                        <rect key="frame" x="32" y="46" width="236" height="40"/>
+                                        <rect key="frame" x="32" y="24" width="236" height="40"/>
                                         <view key="contentView" id="bnD-WE-LiI">
                                             <rect key="frame" x="0.0" y="0.0" width="236" height="40"/>
                                             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
@@ -911,18 +921,97 @@
                                         </constraints>
                                         <color key="fillColor" red="1" green="0.36862745098039218" blue="0.17254901960784313" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                     </box>
+                                    <switch horizontalHuggingPriority="750" verticalHuggingPriority="750" baseWritingDirection="leftToRight" alignment="left" state="on" translatesAutoresizingMaskIntoConstraints="NO" id="tbA-Jh-3g0">
+                                        <rect key="frame" x="128" y="468" width="44" height="23"/>
+                                        <constraints>
+                                            <constraint firstAttribute="width" constant="40" id="Pmx-W4-KxA"/>
+                                            <constraint firstAttribute="height" constant="20" id="qRM-7N-pfi"/>
+                                        </constraints>
+                                        <connections>
+                                            <action selector="buySwitchAction:" target="-2" id="aGa-wU-cTS"/>
+                                        </connections>
+                                    </switch>
+                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="UAe-RJ-yib">
+                                        <rect key="frame" x="87" y="472" width="37" height="16"/>
+                                        <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="hjh-hL-QZA">
+                                            <font key="font" metaFont="system"/>
+                                            <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="7RN-3g-qpL">
+                                        <rect key="frame" x="176" y="472" width="37" height="16"/>
+                                        <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="z8K-Cc-0da">
+                                            <font key="font" metaFont="system"/>
+                                            <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                        </textFieldCell>
+                                    </textField>
+                                    <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="ZIL-vW-TJt">
+                                        <rect key="frame" x="115" y="363" width="70" height="54"/>
+                                        <view key="contentView" id="jja-GZ-6mb">
+                                            <rect key="frame" x="0.0" y="0.0" width="70" height="54"/>
+                                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                            <subviews>
+                                                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="2Ai-gP-tyw">
+                                                    <rect key="frame" x="-2" y="19" width="37" height="16"/>
+                                                    <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="Pdd-go-c9s">
+                                                        <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>
+                                                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ff7-bb-SZU">
+                                                    <rect key="frame" x="35" y="8" width="37" height="16"/>
+                                                    <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="giy-sO-fLN">
+                                                        <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>
+                                                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Utf-37-XY7">
+                                                    <rect key="frame" x="17" y="19" width="37" height="16"/>
+                                                    <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="A8X-la-7P2">
+                                                        <font key="font" metaFont="system"/>
+                                                        <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                                        <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                    </textFieldCell>
+                                                </textField>
+                                            </subviews>
+                                            <constraints>
+                                                <constraint firstItem="2Ai-gP-tyw" firstAttribute="leading" secondItem="jja-GZ-6mb" secondAttribute="leading" id="Zbp-ib-vwL"/>
+                                                <constraint firstAttribute="bottom" secondItem="ff7-bb-SZU" secondAttribute="bottom" constant="8" id="gEx-E2-yEP"/>
+                                                <constraint firstItem="ff7-bb-SZU" firstAttribute="leading" secondItem="2Ai-gP-tyw" secondAttribute="trailing" constant="4" id="x4f-DK-uBx"/>
+                                                <constraint firstAttribute="trailing" secondItem="ff7-bb-SZU" secondAttribute="trailing" id="zeZ-KC-fCO"/>
+                                            </constraints>
+                                        </view>
+                                        <constraints>
+                                            <constraint firstItem="2Ai-gP-tyw" firstAttribute="centerY" secondItem="ZIL-vW-TJt" secondAttribute="centerY" id="6QE-RL-Ti6"/>
+                                            <constraint firstItem="Utf-37-XY7" firstAttribute="centerY" secondItem="ZIL-vW-TJt" secondAttribute="centerY" id="Nx6-i7-a2N"/>
+                                            <constraint firstItem="Utf-37-XY7" firstAttribute="centerX" secondItem="ZIL-vW-TJt" secondAttribute="centerX" id="Ny9-Rf-4ej"/>
+                                            <constraint firstAttribute="height" constant="54" id="QTP-2n-xhK"/>
+                                        </constraints>
+                                    </box>
                                 </subviews>
                                 <constraints>
+                                    <constraint firstItem="tbA-Jh-3g0" firstAttribute="centerX" secondItem="sMr-Hu-FgQ" secondAttribute="centerX" id="3St-Et-kjV"/>
+                                    <constraint firstItem="tbA-Jh-3g0" firstAttribute="centerY" secondItem="UAe-RJ-yib" secondAttribute="centerY" id="4aI-Xh-UaT"/>
+                                    <constraint firstItem="7RN-3g-qpL" firstAttribute="leading" secondItem="tbA-Jh-3g0" secondAttribute="trailing" constant="8" id="7hz-hH-dDG"/>
+                                    <constraint firstItem="ZIL-vW-TJt" firstAttribute="centerX" secondItem="sMr-Hu-FgQ" secondAttribute="centerX" id="9t3-KT-9Jb"/>
                                     <constraint firstItem="uWP-u3-9ES" firstAttribute="centerX" secondItem="sMr-Hu-FgQ" secondAttribute="centerX" id="Bqf-og-JFh"/>
                                     <constraint firstItem="tDw-Yz-8eU" firstAttribute="top" secondItem="xB9-aF-9mk" secondAttribute="bottom" constant="4" id="DGA-bU-9gY"/>
                                     <constraint firstItem="40K-mz-4Ku" firstAttribute="top" secondItem="sMr-Hu-FgQ" secondAttribute="top" constant="8" id="Dkp-Hb-ZFe"/>
                                     <constraint firstItem="pBx-aL-HB5" firstAttribute="centerX" secondItem="sMr-Hu-FgQ" secondAttribute="centerX" id="FdQ-LU-Vhk"/>
+                                    <constraint firstItem="xB9-aF-9mk" firstAttribute="top" secondItem="tbA-Jh-3g0" secondAttribute="bottom" constant="4" id="NKf-rd-VIZ"/>
                                     <constraint firstAttribute="trailing" secondItem="40K-mz-4Ku" secondAttribute="trailing" constant="8" id="Y1o-3d-tAd"/>
-                                    <constraint firstItem="pBx-aL-HB5" firstAttribute="top" secondItem="sMr-Hu-FgQ" secondAttribute="top" constant="130" id="aoK-Tz-SkB"/>
+                                    <constraint firstItem="ZIL-vW-TJt" firstAttribute="top" secondItem="tDw-Yz-8eU" secondAttribute="bottom" id="bdg-uw-NXC"/>
+                                    <constraint firstItem="tbA-Jh-3g0" firstAttribute="leading" secondItem="UAe-RJ-yib" secondAttribute="trailing" constant="8" id="etL-d2-map"/>
                                     <constraint firstItem="xB9-aF-9mk" firstAttribute="centerX" secondItem="sMr-Hu-FgQ" secondAttribute="centerX" id="ivC-qZ-v9a"/>
                                     <constraint firstItem="uWP-u3-9ES" firstAttribute="top" secondItem="pBx-aL-HB5" secondAttribute="bottom" constant="20" id="jk7-qg-Ge3"/>
                                     <constraint firstItem="tDw-Yz-8eU" firstAttribute="centerX" secondItem="sMr-Hu-FgQ" secondAttribute="centerX" id="nWr-w9-XPl"/>
+                                    <constraint firstItem="pBx-aL-HB5" firstAttribute="top" secondItem="ZIL-vW-TJt" secondAttribute="bottom" constant="5" id="qvX-h0-gak"/>
                                     <constraint firstAttribute="width" constant="300" id="tFa-vJ-rIX"/>
+                                    <constraint firstItem="7RN-3g-qpL" firstAttribute="centerY" secondItem="tbA-Jh-3g0" secondAttribute="centerY" id="tJV-X7-fKl"/>
                                     <constraint firstItem="xB9-aF-9mk" firstAttribute="top" secondItem="sMr-Hu-FgQ" secondAttribute="top" constant="44" id="zv3-r4-BjG"/>
                                 </constraints>
                             </customView>

File diff suppressed because it is too large
+ 1553 - 827
PDF Office/PDF Master/Class/Purchase/DMG/KMPurchaseEmbeddedWindowController.swift


File diff suppressed because it is too large
+ 1298 - 985
PDF Office/PDF Master/Class/Purchase/DMG/KMPurchaseEmbeddedWindowController.xib


+ 10 - 5
PDF Office/PDF Master/Class/Purchase/DMG/KMPurchaseFirstTrialWindowController.swift

@@ -412,11 +412,16 @@ import Cocoa
     }
     
     @IBAction func buyNowAction(_ sender: HyperLinkButton) {
-        guard let callBack = self.buttonActionBlock else {
-            return
-        }
-        callBack(self,sender,self.emailTextField.stringValue,self.nameTextField.stringValue)
-        FMTrackEventManager.defaultManager.trackOnceEvent(event: "PUW", withProperties: ["PUW_Btn":"Btn_PUW_BuyNow"])
+//        guard let callBack = self.buttonActionBlock else {
+//            return
+//        }
+//        callBack(self,sender,self.emailTextField.stringValue,self.nameTextField.stringValue)
+//        FMTrackEventManager.defaultManager.trackOnceEvent(event: "PUW", withProperties: ["PUW_Btn":"Btn_PUW_BuyNow"])
+#if VERSION_DMG
+        let singleTon = KMPurchaseCompareDMGWindowController.init()
+        singleTon.showWindow(nil)
+        singleTon.window?.center()
+#endif
     }
     
     @IBAction func enterLicenseAction(_ sender: HyperLinkButton) {

+ 8 - 3
PDF Office/PDF Master/Class/Purchase/DMG/KMPurchaseLimitWindowController.swift

@@ -158,9 +158,14 @@ class KMPurchaseLimitWindowController: NSWindowController {
     
     //MARK: IBAction
     @IBAction func unlimitConvertAction(_ sender: Any) {
-        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"])
+//        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"])
+#if VERSION_DMG
+        let embeddedWC = KMPurchaseEmbeddedWindowController.currentFirstTrialWC("com.brother.pdfreaderpro.mac.product_2")
+        embeddedWC.showWindow(nil)
+        embeddedWC.window?.center()
+#endif
     }
     
     @IBAction func continueConvertAction(_ sender: Any) {

+ 1 - 1
PDF Office/PDF Master/Class/Purchase/DMG/KMPurchaseLimitWindowController.xib

@@ -28,7 +28,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="726" height="460"/>
-            <rect key="screenRect" x="0.0" y="0.0" width="1920" height="1055"/>
+            <rect key="screenRect" x="0.0" y="0.0" width="2560" height="1415"/>
             <value key="minSize" type="size" width="726" height="460"/>
             <value key="maxSize" type="size" width="726" height="460"/>
             <view key="contentView" id="se5-gp-TjO">

+ 1 - 0
PDF Office/PDF Master/Class/Purchase/DMG/Verification/KMActivityALertViewController.xib

@@ -78,6 +78,7 @@ DQ
                 <constraint firstItem="lqs-Fp-4oP" firstAttribute="top" secondItem="pm5-8h-PY3" secondAttribute="bottom" constant="16" id="OUT-cN-oDM"/>
                 <constraint firstItem="GJM-ad-Iuh" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" constant="39" id="PPB-Xq-onL"/>
                 <constraint firstItem="lqs-Fp-4oP" firstAttribute="top" secondItem="Qwn-MB-Wut" secondAttribute="top" id="QKz-IF-5gd"/>
+                <constraint firstAttribute="bottom" secondItem="lqs-Fp-4oP" secondAttribute="bottom" constant="28" id="YFZ-o0-HXG"/>
                 <constraint firstItem="pm5-8h-PY3" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="20" id="YTB-Ci-avl"/>
                 <constraint firstItem="Msy-3S-d2h" firstAttribute="top" secondItem="GJM-ad-Iuh" secondAttribute="bottom" constant="23" id="deA-aA-meK"/>
                 <constraint firstItem="pm5-8h-PY3" firstAttribute="centerX" secondItem="Hz6-mo-xeY" secondAttribute="centerX" id="fha-zz-EQE"/>

+ 1 - 1
PDF Office/PDF Master/Class/Purchase/DMG/Verification/KMRepeatTrialAlertController.m

@@ -72,7 +72,7 @@
     self.infoTitleLabel.stringValue = [@"👋🏻 " stringByAppendingString:NSLocalizedString(@"7-day Free Trial", nil)];
     self.infoSubTitleLabel.stringValue = NSLocalizedString(@"PDF Reader Pro offers a 7-day free trial of the full functions.", nil);
     self.featureLbl.stringValue = NSLocalizedString(@"Key Features", nil);
-    self.nTipLabel.stringValue = NSLocalizedString(@"New", nil);
+    self.nTipLabel.stringValue = NSLocalizedString(@"New Feature", nil);
     self.nInfoLabel.stringValue = NSLocalizedString(@"Digital signature", nil);
     self.featureInfoLabel1.stringValue = NSLocalizedString(@"Edit PDF", nil);
     self.featureInfoLabel2.stringValue = NSLocalizedString(@"Organize pages", nil);

+ 23 - 11
PDF Office/PDF Master/Class/Purchase/DMG/Verification/KMVerificationMessageViewController.m

@@ -445,9 +445,12 @@ NSPopoverDelegate>
                     KMVerificationWindowController *vc = [KMVerificationWindowController verificationWithType:KMVerificationTypeActivate];
                     [vc showWindow:nil];
                 } else if (index == 2) {
-                    NSURL *url = [NSURL URLWithString:Swift_oc_Tool.Store_Link_OC];
-                    [[NSWorkspace sharedWorkspace] openURL:url];
-                    [[FMTrackEventManager defaultManager] trackEventWithEvent:@"PUW" withProperties:@{@"PUW_Btn":@"Btn_PUW_BuyNow-Expire"}];
+//                    NSURL *url = [NSURL URLWithString:Swift_oc_Tool.Store_Link_OC];
+//                    [[NSWorkspace sharedWorkspace] openURL:url];
+//                    [[FMTrackEventManager defaultManager] trackEventWithEvent:@"PUW" withProperties:@{@"PUW_Btn":@"Btn_PUW_BuyNow-Expire"}];
+                    KMPurchaseEmbeddedWindowController *embeddedWC = [KMPurchaseEmbeddedWindowController currentFirstTrialWC:@"com.brother.pdfreaderpro.mac.product_3"];
+                    [embeddedWC showWindow:nil];
+                    [[embeddedWC window] center];
                 }
             };
         self.testVC.mouseEventCall = ^(BOOL mouseEnter) {
@@ -480,15 +483,21 @@ NSPopoverDelegate>
         [vc showWindow:nil];
     } else if (ActivityStatusVerification == [VerificationManager manager].status) {
         if ([VerificationManager manager].needUpgradeLicense) {
-            NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@?product_code=product_2", Swift_oc_Tool.Store_Link_OC]];
-            [[NSWorkspace sharedWorkspace] openURL:url];
-            [[FMTrackEventManager defaultManager] trackEventWithEvent:@"Tbr" withProperties:@{@"Tbr_Btn":@"Btn_Tbr_PDFtoOffice"}];
+//            NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@?product_code=product_2", Swift_oc_Tool.Store_Link_OC]];
+//            [[NSWorkspace sharedWorkspace] openURL:url];
+//            [[FMTrackEventManager defaultManager] trackEventWithEvent:@"Tbr" withProperties:@{@"Tbr_Btn":@"Btn_Tbr_PDFtoOffice"}];
+            KMPurchaseEmbeddedWindowController *embeddedWC = [KMPurchaseEmbeddedWindowController currentFirstTrialWC:@"com.brother.pdfreaderpro.mac.product_2"];
+            [embeddedWC showWindow:nil];
+            [[embeddedWC window] center];
         }
     } else {
         if ([VerificationManager manager].needUpgradeLicense) {
-            NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@?product_code=product_2", Swift_oc_Tool.Store_Link_OC]];
-            [[NSWorkspace sharedWorkspace] openURL:url];
-            [[FMTrackEventManager defaultManager] trackEventWithEvent:@"Tbr" withProperties:@{@"Tbr_Btn":@"Btn_Tbr_PDFtoOffice"}];
+//            NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@?product_code=product_2", Swift_oc_Tool.Store_Link_OC]];
+//            [[NSWorkspace sharedWorkspace] openURL:url];
+//            [[FMTrackEventManager defaultManager] trackEventWithEvent:@"Tbr" withProperties:@{@"Tbr_Btn":@"Btn_Tbr_PDFtoOffice"}];
+            KMPurchaseEmbeddedWindowController *embeddedWC = [KMPurchaseEmbeddedWindowController currentFirstTrialWC:@"com.brother.pdfreaderpro.mac.product_2"];
+            [embeddedWC showWindow:nil];
+            [[embeddedWC window] center];
         } else {
             KMVerificationWindowController *vc = [KMVerificationWindowController verificationWithType:KMVerificationTypeNormal];
             [vc showWindow:nil];
@@ -544,8 +553,11 @@ NSPopoverDelegate>
     AIUserInfoController *controller = [[AIUserInfoController alloc] init];
     controller.purchaseHandle = ^(AIUserInfoController * _Nonnull vc) {
 #if VERSION_DMG
-        NSURL *url = [NSURL URLWithString:Swift_oc_Tool.AIProduct_Link_OC];
-        [[NSWorkspace sharedWorkspace] openURL:url];
+//        NSURL *url = [NSURL URLWithString:Swift_oc_Tool.AIProduct_Link_OC];
+//        [[NSWorkspace sharedWorkspace] openURL:url];
+        KMPurchaseEmbeddedWindowController *embeddedWC = [KMPurchaseEmbeddedWindowController currentFirstTrialWC:@"com.brother.pdfreaderpro.ai.product_1"];
+        [embeddedWC showWindow:nil];
+        [[embeddedWC window] center];
 #else
         
         [[AIPurchaseWindowController currentWC] showWindow:nil];

+ 9 - 5
PDF Office/PDF Master/Class/Purchase/DMG/Verification/KMVerificationWindowController.m

@@ -299,9 +299,11 @@ static KMVerificationWindowController *_currentWindowController = nil;
                                                 name:[VerificationManager manager].accountName] ;
             } else if (clickIndex == 1) {
                 //了解更多
-                NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@?utm_source=app_dmg&utm_medium=dmg_puw_sec_free_trial", Swift_oc_Tool.Store_Link_OC]];
-                [[NSWorkspace sharedWorkspace] openURL:url];
-                [blockSelf close];
+//                NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@?utm_source=app_dmg&utm_medium=dmg_puw_sec_free_trial", Swift_oc_Tool.Store_Link_OC]];
+//                [[NSWorkspace sharedWorkspace] openURL:url];
+//                [blockSelf close];
+                KMPurchaseCompareDMGWindowController *singleTon = [[KMPurchaseCompareDMGWindowController alloc] init];
+                [singleTon showWindow:nil];
             } else if (clickIndex == 2) {
                 //输入序列码
                 KMVerificationWindowController *vc = [KMVerificationWindowController verificationWithType:KMVerificationTypeActivate];
@@ -755,8 +757,10 @@ static KMVerificationWindowController *_currentWindowController = nil;
 
 - (void)verificationBuy {
 #if VERSION_DMG
-    NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@?utm_source=MacAppDmg&utm_campaign=StoreLink&utm_medium=PdfStore", Swift_oc_Tool.Store_Link_OC]];
-    [[NSWorkspace sharedWorkspace] openURL:url];
+//    NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@?utm_source=MacAppDmg&utm_campaign=StoreLink&utm_medium=PdfStore", Swift_oc_Tool.Store_Link_OC]];
+//    [[NSWorkspace sharedWorkspace] openURL:url];
+    KMPurchaseCompareDMGWindowController *singleTon = [[KMPurchaseCompareDMGWindowController alloc] init];
+    [singleTon showWindow:nil];
 #endif
     
 }

+ 7 - 0
PDF Office/PDF Master/Class/Purchase/DMG/Verification/VerificationManager/AIInfoManager.h

@@ -61,4 +61,11 @@ typedef void(^AIActivityComplention)(NSDictionary *info, NSError *error);
 @property (nonatomic, readonly) int pre_creditToken;
 
 @end
+
+#if DEBUG
+@interface AIInfoManager (KMTest)
+
+@end
+#endif
+
 NS_ASSUME_NONNULL_END

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

@@ -504,3 +504,13 @@ static AIInfoManager *__Manager = nil;
 }
 
 @end
+
+#if DEBUG
+@implementation AIInfoManager (KMTest)
+
+//- (AIInfo *)aiInfo {
+//    return [[AIInfo alloc] initWithDict:@{@"1" : @"1"}];
+//}
+
+@end
+#endif

+ 127 - 0
PDF Office/PDF Master/Class/Purchase/DMG/Verification/VerificationManager/KMDMGProductsManager.swift

@@ -0,0 +1,127 @@
+//
+//  KMDMGProductsManager.swift
+//  PDF Reader Pro
+//
+//  Created by wanjun on 2024/9/2.
+//
+
+import Cocoa
+
+#if VERSION_DMG
+enum ProductType {
+    case ipaConvert                     // 转档 单独
+    case ipaConvert_checkout            // 转档
+    case ipaPremium                     // 标准
+    case ipaPermanent                   // 高级
+    case ipaPremiumCrossPlatform        // 标准跨平台
+    case ipaPermanentCrossPlatform      // 高级跨平台
+    case ipaAI                          // AI
+    case ipaPremiumAI                   // 标准包 AI
+    case ipaPermanentAI                 // 高级包 AI
+    case ipaPermanentCrossPlatformAI    // 高级 跨平台 AI
+}
+
+@objcMembers class KMDMGProductsManager: NSObject {
+    public static let shareInstance = KMDMGProductsManager.init()
+    
+    var productDatas: [String : Any]?
+    var activityPrice: String = "0.00"
+    var price: String = "0.00"
+    
+    override init() {
+        super.init()
+        
+    }
+    
+    func getProductDatas() -> Void? {
+        self._getProductDatas { [weak self] info, err in
+            /*
+             activity_cny_price 优惠价(人民币)
+             activity_price 优惠价(美元)
+             price 原价(美元)
+             cny_price 原价(人民币)
+             */
+            guard let self = self else { return }
+            if err != nil {return}
+            self.productDatas = info!
+        }
+    }
+    
+    func getAllPrice(_ productID: String) -> Void {
+        if productDatas == nil {
+            getProductDatas()
+        } else {
+            if let isExist = productDatas?.keys.contains(productID), isExist {
+                let value: [String : Any] = productDatas?[productID] as! [String : Any]
+                if NSLocalizedString("USD", comment: "") == "CNY" {
+                    activityPrice = value["activity_cny_price"] as! String
+                    price = value["cny_price"] as! String
+                } else {
+                    activityPrice = value["activity_price"] as! String
+                    price = value["price"] as! String
+                }
+            }
+        }
+    }
+
+    // 优惠价
+    func getActivityPrice(_ productID: String) -> String {
+        if productDatas == nil {
+            getProductDatas()
+        } else {
+            if let isExist = productDatas?.keys.contains(productID), isExist {
+                let value: [String : Any] = productDatas?[productID] as! [String : Any]
+                if NSLocalizedString("USD", comment: "") == "CNY" {
+                    return value["activity_cny_price"] as! String
+                } else {
+                    return value["activity_price"] as! String
+                }
+            }
+        }
+        if NSLocalizedString("USD", comment: "") == "CNY" {
+            return "388.0"
+        } else {
+            return "59.99"
+        }
+    }
+    
+    // 原价
+    func getPrice(_ productID: String) -> String {
+        if productDatas == nil {
+            getProductDatas()
+        } else {
+            if let isExist = productDatas?.keys.contains(productID), isExist {
+                let value: [String : Any] = productDatas?[productID] as! [String : Any]
+                if NSLocalizedString("USD", comment: "") == "CNY" {
+                    return value["cny_price"] as! String
+                } else {
+                    return value["price"] as! String
+                }
+            }
+        }
+        if NSLocalizedString("USD", comment: "") == "CNY" {
+            return "388"
+        } else {
+            return "59.99"
+        }
+    }
+    
+    private func _getProductDatas(callback: @escaping (([String:Any]?, Any?)->Void)) {
+        let urlString = kVerificationServer + "/api/product/get-price/v2"
+        KMAdvertisementRequestServer.requestServer.request(urlString: urlString, method: "GET", params: nil) { task, responseObject, error in
+            if (error == nil && responseObject != nil) {
+                let array = responseObject?["data"] as? NSDictionary
+                if array != nil {
+                    //解析数据
+                    let productsDict = array?.object(forKey: "data") as? NSDictionary
+                    callback(productsDict as? [String : Any], nil)
+                } else {
+                    callback([:], error.debugDescription)
+                }
+            } else {
+                callback(nil, error.debugDescription)
+            }
+        }
+    }
+}
+#endif

+ 4 - 0
PDF Office/PDF Master/Class/Purchase/DMG/Verification/VerificationManager/VerificationManager.h

@@ -64,6 +64,7 @@ typedef void(^ActivityComplention)(ActivityStatus status, NSDictionary *info, NS
 @property (nonatomic, readonly) ActivityStatus status;
 @property (nonatomic, readonly) BOOL needUpgradeLicense;
 @property (nonatomic, readonly) NSString *licenseCode;
+@property (nonatomic, readonly) NSString *originLicenseCode;
 @property (nonatomic, readonly) NSDictionary *detailInfo;
 
 @property (nonatomic, readonly) BOOL secondTrialEnabled;
@@ -71,6 +72,7 @@ typedef void(^ActivityComplention)(ActivityStatus status, NSDictionary *info, NS
 @property (nonatomic, readonly) NSInteger trialTimes;
 
 @property (nonatomic, readonly) NSString *email;
+@property (nonatomic, readonly) NSString *subscriptionEmail;
 
 @property (nonatomic, readonly) NSString *accountName;
 
@@ -145,6 +147,7 @@ typedef void(^ActivityComplention)(ActivityStatus status, NSDictionary *info, NS
 @property (nonatomic, readonly) NSDate *createDate;
 @property (nonatomic, readonly) NSDate *expireDate;
 @property (nonatomic, readonly) NSString *licenseCode;
+@property (nonatomic, readonly) NSString *originLicenseCode;
 
 @property (nonatomic, readonly) NSString *shareCode;
 @property (nonatomic, readonly) NSUInteger invateUsersCount;
@@ -157,6 +160,7 @@ typedef void(^ActivityComplention)(ActivityStatus status, NSDictionary *info, NS
 @property (nonatomic, readonly) BOOL repeatTrial;
 
 @property (nonatomic, readonly) NSString *email;
+@property (nonatomic, readonly) NSString *subscriptionEmail;
 
 @property (nonatomic, readonly) NSString *accountName;
 

+ 16 - 0
PDF Office/PDF Master/Class/Purchase/DMG/Verification/VerificationManager/VerificationManager.m

@@ -95,10 +95,18 @@ static VerificationManager *__verificationManager = nil;
     return self.detailInfo.licenseCode;
 }
 
+- (NSString *)originLicenseCode {
+    return self.detailInfo.originLicenseCode;
+}
+
 - (NSString *)email {
     return self.detailInfo.email?:@"";
 }
 
+- (NSString *)subscriptionEmail {
+    return self.detailInfo.subscriptionEmail?:@"";
+}
+
 - (NSString *)accountName {
     return self.detailInfo.accountName;
 }
@@ -1067,6 +1075,10 @@ static VerificationManager *__verificationManager = nil;
     return self[@"device"][@"cdkey"];
 }
 
+- (NSString*)originLicenseCode {
+    return self[@"device"][@"origin_cdkey"];
+}
+
 - (NSString*)shareCode {
     return self[@"invite"][@"share_code"]?:@"";
 }
@@ -1112,6 +1124,10 @@ static VerificationManager *__verificationManager = nil;
     return self[@"device"][@"email"]?:@"";
 }
 
+- (NSString *)subscriptionEmail {
+    return self[@"subscription"][@"email"]?:@"";
+}
+
 - (NSString *)accountName {
     return self[@"device"][@"contact_name"]?:@"";
 }

File diff suppressed because it is too large
+ 1 - 0
PDF Office/PDF Master/Class/Purchase/DMG/paddle.js


+ 0 - 0
PDF Office/PDF Master/Class/Purchase/IAPProductsManager.h


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