3 Коміти b9004a56f9 ... 7409b77abc

Автор SHA1 Опис Дата
  zenghong 7409b77abc Merge branch 'develop_PDFReaderPro_V4.7.0' of git.kdan.cc:Mac_PDF/PDF_Office into develop_PDFReaderPro_V4.7.0 1 тиждень тому
  zenghong 437f70c9aa Merge branch 'develop_PDFReaderPro_V4.7.0' of git.kdan.cc:Mac_PDF/PDF_Office into develop_PDFReaderPro_V4.7.0 1 тиждень тому
  zenghong 8374b7336b 【会员系统】DMG 订单结算界面数据串接 1 тиждень тому

+ 163 - 63
PDF Office/PDF Master/Class/Purchase/DMG/KMPurchaseEmbeddedWindowController.swift

@@ -16,6 +16,21 @@ import Cocoa
     case alipay
 }
 
+@objc enum KMDMGProductType: UInt32 {
+    
+    case advanced_annual_subscription_trail = 0                    // 全平台高级版年订阅             99.9 美金,带免费试用
+    case advanced_annual_subscription                              // 全平台高级版年订阅             99.9 美金
+    case advanced_annual_subscription_blackFive                    // 全平台高级版年订阅             99.9 美金,黑五订单,优惠价格不为空
+    
+    case standard_annual_subscription                              // 全平台标准版年订阅             79.9 美金
+    
+    case advanced_permanent                                        // Mac & Win 双平台高级永久      119.99 美金
+    case advanced_permanent_blackFive                              // Mac & Win 双平台高级永久      119.99 美金,黑五订单,优惠价格不为空
+    
+    case ai_subscription_year_trail                                // AI 年订阅                    125.99 美金,带免费试用
+    case ai_subscription_month                                     // AI 月订阅                    14.99 美金
+}
+
 class KMPurchaseEmbeddedWindowController: NSWindowController {
     
     @IBOutlet weak var mainBox: NSBox!
@@ -31,6 +46,9 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
     @IBOutlet weak var originalPriceLabel1: NSTextField! // 原价
     @IBOutlet weak var discountPriceLabel1: NSTextField! // 折扣
     
+    @IBOutlet weak var usualAddonView: NSView!
+    @IBOutlet weak var usualAddCountView: NSView!
+    
     @IBOutlet weak var aiAddOnView: NSView!
     @IBOutlet weak var aiAddOnButton: NSButton!
     @IBOutlet weak var aiAddOnLabel: NSTextField!
@@ -131,6 +149,9 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
     @IBOutlet weak var successfullyLabel: NSTextField!
     @IBOutlet weak var imageBottomLayout: NSLayoutConstraint!
     @IBOutlet weak var image2BottomLayout: NSLayoutConstraint!
+    
+    private var _dmgProductType: KMDMGProductType = .advanced_annual_subscription_trail
+    private var _product_Info: KMListingProductsModel = KMListingProductsModel(id: "23", productName: "PDF Reader Pro Advanced - Annual Plan", price: NSNumber(value: 99.99), maxDeviceNum: 4, levels: "3", platforms: "Windows,Android,Mac,iOS", productLineId: 1, paymentModel: 1, cycle: 4, code: "advanced-annual-subscription-trail", cnyPrice: 0)
 
     private var pdfCount: Int = 1
     private var _paymentMethod: KMPaymentType = .paypal
@@ -218,6 +239,18 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
     private var licenseAI1 = ""
     private var isApplyCoupon: Bool = false
 
+    @objc static func currentWC(_ productInfo: KMListingProductsModel) -> KMPurchaseEmbeddedWindowController {
+        if currentWindowController != nil {
+            currentWindowController.product_Info = productInfo
+            return currentWindowController
+        } else {
+            let configWC: KMPurchaseEmbeddedWindowController = KMPurchaseEmbeddedWindowController.init(windowNibName: "KMPurchaseEmbeddedWindowController")
+            currentWindowController = configWC;
+            currentWindowController.product_Info = productInfo
+            return currentWindowController
+        }
+     }
+    
     @objc static func currentFirstTrialWC(_ productId: String) -> KMPurchaseEmbeddedWindowController {
         if currentWindowController != nil {
             currentWindowController.productID = productId
@@ -254,6 +287,15 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
         self.clearEventData()
     }
     
+    // MARK: DMG Action
+    func isMoreCountViewShouldHidden(_ productinfo: KMListingProductsModel) -> Bool {
+        //买断版本才能一次购买多个,并且购买多个时,不会自动绑定,需要在后台给自己绑定才能有会员权益
+        if productinfo.paymentModel == 2 {
+            return false
+        }
+        return true
+    }
+    
     // MARK: UI
     
     private func xibInitialization() -> Void {
@@ -272,74 +314,106 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
         discountPriceLabel1.textColor = NSColor(named: "KMPurchaseDiscountColor")
         discountPriceLabel1.font = NSFont.SFProTextRegularFont(9.0)
         refreshLicenseCodeView(isReveal: false)
-        if productType == .ipaConvert || productType == .ipaAI {
+        usualAddCountView.isHidden = isMoreCountViewShouldHidden(product_Info)
+        
+        if _dmgProductType == .advanced_annual_subscription_trail {
             aiAddOnView.isHidden = true
             extendedView.isHidden = true
             
-            if productType == .ipaConvert {
-                pdfReaderProLabel.stringValue = NSLocalizedString("PDF to Office", comment: "")
-                prmiumLabel.stringValue = NSLocalizedString("Export PDF to Word(.docx), Excel (.xlsx), PowerPoint(.pptx)", comment: "")
-                oneLicenseLabel.stringValue = NSLocalizedString("and more offline. It's one time purchase.", comment: "")
-                licenseCodeLabel.stringValue = NSLocalizedString("License Code", comment: "")
-                licenseCodeLabel.textColor = NSColor(named: "KMPurchaseTitleColor1")
-                licenseCodeLabel.font = NSFont.SFProTextRegularFont(14.0)
-                licenseCodeTextField.placeholderString = NSLocalizedString("Input license code previously activated the app", comment: "")
-                licenseCodeTextField.delegate = self
-                licenseCodeBox.borderColor = NSColor(named: "KMPurchase_DADBDE")!
-                licenseCodeBox.fillColor = NSColor(named: "KMPurchase_FFFFFF")!
-                notFoundButton.title = NSLocalizedString("Not Found?", comment: "")
-                notFoundButton.setTitleColor(color: NSColor(named: "KMPurchaseCouponColor")!, font: NSFont(name: "body-s-regular", size: 14))
-                licenseCodeTextField.stringValue = VerificationManager.default().originLicenseCode ?? ""
-                refreshLicenseCodeView(isReveal: true)
-                licenseCodeErrorLabel.stringValue = NSLocalizedString("Please enter right license code. How to Retrieve License.", comment: "")
-                licenseCodeErrorLabel.textColor = NSColor(named: "KMPurchaseErrorColor")
-                licenseCodeErrorLabel.font = NSFont.SFProTextRegularFont(11.0)
-                refreshLicenseCodeErrorView(isReveal: false)
-            } else if productType == .ipaAI {
-                pdfReaderProLabel.stringValue = NSLocalizedString("PDF Reader Pro AI Tools", comment: "")
-                prmiumLabel.stringValue = NSLocalizedString("50 credits for 30 days", comment: "")
-                oneLicenseLabel.stringValue = NSLocalizedString("Manually renew at USD 14.99", comment: "")
-            }
-        } else {
-            pdfReaderProLabel.stringValue = NSLocalizedString("PDF Reader Pro for Mac", comment: "")
-            if productToType(originalProductID) == .ipaPremium {
-                prmiumLabel.stringValue = NSLocalizedString("Premium", comment: "")
-                oneLicenseLabel.stringValue = NSLocalizedString("One license for one device. One time purchase.", comment: "")
-            } else if productToType(originalProductID) == .ipaPermanent {
-                prmiumLabel.stringValue = NSLocalizedString("Permanent version (with PDF to Office Pack)", comment: "")
-                oneLicenseLabel.stringValue = NSLocalizedString("One license for one device. One time purchase.", comment: "")
-            }
-            aiAddOnButton.image = NSImage(named: "EmbeddedPayment06")
-            aiAddOnLabel.stringValue = NSLocalizedString("AI Add-on", comment: "")
-            aiAddOnLabel.textColor = NSColor(named: "KMPurchaseTitleColor")
-            aiAddOnLabel.font = NSFont.SFProTextRegularFont(14.0)
-            IndividualLabel.stringValue = NSLocalizedString("Individual monthly plan. Manually renew.", comment: "")
-            IndividualLabel.textColor = NSColor(named: "KMPurchaseSubTitleColor")
-            IndividualLabel.font = NSFont.SFProTextRegularFont(12.0)
-            originalPriceLabel2.textColor = NSColor(named: "KMPurchaseTitleColor")
-            originalPriceLabel2.font = NSFont.SFProTextRegularFont(16.0)
-            discountPriceLabel2.textColor = NSColor(named: "KMPurchaseDiscountColor")
-            discountPriceLabel2.font = NSFont.SFProTextRegularFont(9.0)
+            pdfReaderProLabel.stringValue = NSLocalizedString("PDF Reader Pro Standard - Annual Plan", comment: "")
             
-            if originalProductID == "com.brother.pdfreaderpro.mac.product_3" {
-                extendedLabel.stringValue = NSLocalizedString("Extended Device Access", comment: "")
-                accessLabel.stringValue = NSLocalizedString("Get access to your plan on up to 2 devices.", comment: "")
-                extendedImageView.isHidden = false
-            } else {
-                extendedLabel.stringValue = NSLocalizedString("PDF to Office Pack", comment: "")
-                accessLabel.stringValue = NSLocalizedString("One time purchase", comment: "")
-                extendedImageView.isHidden = true
-            }
-            extendedButton.image = NSImage(named: "EmbeddedPayment06")
-            extendedLabel.textColor = NSColor(named: "KMPurchaseTitleColor")
-            extendedLabel.font = NSFont.SFProTextRegularFont(14.0)
-            accessLabel.textColor = NSColor(named: "KMPurchaseSubTitleColor")
-            accessLabel.font = NSFont.SFProTextRegularFont(12.0)
-            originalPriceLabel3.textColor = NSColor(named: "KMPurchaseTitleColor")
-            originalPriceLabel3.font = NSFont.SFProTextRegularFont(16.0)
-            discountPriceLabel3.textColor = NSColor(named: "KMPurchaseDiscountColor")
-            discountPriceLabel3.font = NSFont.SFProTextRegularFont(9.0)
+            let tipsString = NSLocalizedString("%.2@/year, auto-renewal", comment: "")
+            let fullString = String(format: tipsString, product_Info.price)
+            prmiumLabel.stringValue = fullString
+            
+            
+            oneLicenseLabel.stringValue = NSLocalizedString("and more offline. It's one time purchase.", comment: "")
+            licenseCodeLabel.stringValue = NSLocalizedString("License Code", comment: "")
+            licenseCodeLabel.textColor = NSColor(named: "KMPurchaseTitleColor1")
+            licenseCodeLabel.font = NSFont.SFProTextRegularFont(14.0)
+            licenseCodeTextField.placeholderString = NSLocalizedString("Input license code previously activated the app", comment: "")
+            licenseCodeTextField.delegate = self
+            licenseCodeBox.borderColor = NSColor(named: "KMPurchase_DADBDE")!
+            licenseCodeBox.fillColor = NSColor(named: "KMPurchase_FFFFFF")!
+            notFoundButton.title = NSLocalizedString("Not Found?", comment: "")
+            notFoundButton.setTitleColor(color: NSColor(named: "KMPurchaseCouponColor")!, font: NSFont(name: "body-s-regular", size: 14))
+            licenseCodeTextField.stringValue = VerificationManager.default().originLicenseCode ?? ""
+            refreshLicenseCodeView(isReveal: true)
+            licenseCodeErrorLabel.stringValue = NSLocalizedString("Please enter right license code. How to Retrieve License.", comment: "")
+            licenseCodeErrorLabel.textColor = NSColor(named: "KMPurchaseErrorColor")
+            licenseCodeErrorLabel.font = NSFont.SFProTextRegularFont(11.0)
+            refreshLicenseCodeErrorView(isReveal: false)
         }
+        
+        
+//        if productType == .ipaConvert || productType == .ipaAI {
+//            aiAddOnView.isHidden = true
+//            extendedView.isHidden = true
+//            
+//            if productType == .ipaConvert {
+//                pdfReaderProLabel.stringValue = NSLocalizedString("PDF to Office", comment: "")
+//                prmiumLabel.stringValue = NSLocalizedString("Export PDF to Word(.docx), Excel (.xlsx), PowerPoint(.pptx)", comment: "")
+//                oneLicenseLabel.stringValue = NSLocalizedString("and more offline. It's one time purchase.", comment: "")
+//                licenseCodeLabel.stringValue = NSLocalizedString("License Code", comment: "")
+//                licenseCodeLabel.textColor = NSColor(named: "KMPurchaseTitleColor1")
+//                licenseCodeLabel.font = NSFont.SFProTextRegularFont(14.0)
+//                licenseCodeTextField.placeholderString = NSLocalizedString("Input license code previously activated the app", comment: "")
+//                licenseCodeTextField.delegate = self
+//                licenseCodeBox.borderColor = NSColor(named: "KMPurchase_DADBDE")!
+//                licenseCodeBox.fillColor = NSColor(named: "KMPurchase_FFFFFF")!
+//                notFoundButton.title = NSLocalizedString("Not Found?", comment: "")
+//                notFoundButton.setTitleColor(color: NSColor(named: "KMPurchaseCouponColor")!, font: NSFont(name: "body-s-regular", size: 14))
+//                licenseCodeTextField.stringValue = VerificationManager.default().originLicenseCode ?? ""
+//                refreshLicenseCodeView(isReveal: true)
+//                licenseCodeErrorLabel.stringValue = NSLocalizedString("Please enter right license code. How to Retrieve License.", comment: "")
+//                licenseCodeErrorLabel.textColor = NSColor(named: "KMPurchaseErrorColor")
+//                licenseCodeErrorLabel.font = NSFont.SFProTextRegularFont(11.0)
+//                refreshLicenseCodeErrorView(isReveal: false)
+//            } else if productType == .ipaAI {
+//                pdfReaderProLabel.stringValue = NSLocalizedString("PDF Reader Pro AI Tools", comment: "")
+//                prmiumLabel.stringValue = NSLocalizedString("50 credits for 30 days", comment: "")
+//                oneLicenseLabel.stringValue = NSLocalizedString("Manually renew at USD 14.99", comment: "")
+//            }
+//        } else {
+//            pdfReaderProLabel.stringValue = NSLocalizedString("PDF Reader Pro for Mac", comment: "")
+//            if productToType(originalProductID) == .ipaPremium {
+//                prmiumLabel.stringValue = NSLocalizedString("Premium", comment: "")
+//                oneLicenseLabel.stringValue = NSLocalizedString("One license for one device. One time purchase.", comment: "")
+//            } else if productToType(originalProductID) == .ipaPermanent {
+//                prmiumLabel.stringValue = NSLocalizedString("Permanent version (with PDF to Office Pack)", comment: "")
+//                oneLicenseLabel.stringValue = NSLocalizedString("One license for one device. One time purchase.", comment: "")
+//            }
+//            aiAddOnButton.image = NSImage(named: "EmbeddedPayment06")
+//            aiAddOnLabel.stringValue = NSLocalizedString("AI Add-on", comment: "")
+//            aiAddOnLabel.textColor = NSColor(named: "KMPurchaseTitleColor")
+//            aiAddOnLabel.font = NSFont.SFProTextRegularFont(14.0)
+//            IndividualLabel.stringValue = NSLocalizedString("Individual monthly plan. Manually renew.", comment: "")
+//            IndividualLabel.textColor = NSColor(named: "KMPurchaseSubTitleColor")
+//            IndividualLabel.font = NSFont.SFProTextRegularFont(12.0)
+//            originalPriceLabel2.textColor = NSColor(named: "KMPurchaseTitleColor")
+//            originalPriceLabel2.font = NSFont.SFProTextRegularFont(16.0)
+//            discountPriceLabel2.textColor = NSColor(named: "KMPurchaseDiscountColor")
+//            discountPriceLabel2.font = NSFont.SFProTextRegularFont(9.0)
+//            
+//            if originalProductID == "com.brother.pdfreaderpro.mac.product_3" {
+//                extendedLabel.stringValue = NSLocalizedString("Extended Device Access", comment: "")
+//                accessLabel.stringValue = NSLocalizedString("Get access to your plan on up to 2 devices.", comment: "")
+//                extendedImageView.isHidden = false
+//            } else {
+//                extendedLabel.stringValue = NSLocalizedString("PDF to Office Pack", comment: "")
+//                accessLabel.stringValue = NSLocalizedString("One time purchase", comment: "")
+//                extendedImageView.isHidden = true
+//            }
+//            extendedButton.image = NSImage(named: "EmbeddedPayment06")
+//            extendedLabel.textColor = NSColor(named: "KMPurchaseTitleColor")
+//            extendedLabel.font = NSFont.SFProTextRegularFont(14.0)
+//            accessLabel.textColor = NSColor(named: "KMPurchaseSubTitleColor")
+//            accessLabel.font = NSFont.SFProTextRegularFont(12.0)
+//            originalPriceLabel3.textColor = NSColor(named: "KMPurchaseTitleColor")
+//            originalPriceLabel3.font = NSFont.SFProTextRegularFont(16.0)
+//            discountPriceLabel3.textColor = NSColor(named: "KMPurchaseDiscountColor")
+//            discountPriceLabel3.font = NSFont.SFProTextRegularFont(9.0)
+//        }
         removeButton1.isEnabled = false
         amountTextField1.delegate = self
         amountTextField2.isEditable = false
@@ -1166,6 +1240,32 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
     
     // MARK: get & set
     
+    var product_Info: KMListingProductsModel {
+        get {
+            return _product_Info
+        }
+        set {
+            _product_Info = newValue
+            xibInitialization()
+            priceRefresh()
+            
+            confirmPayment(isConfirm: false)
+        }
+    }
+    
+    var dmgProductType: KMDMGProductType {
+        get {
+           return _dmgProductType
+        }
+        set {
+            _dmgProductType = newValue
+            xibInitialization()
+            priceRefresh()
+            
+            confirmPayment(isConfirm: false)
+        }
+    }
+    
     private var paymentMethod : KMPaymentType {
         get {
            return _paymentMethod

+ 7 - 5
PDF Office/PDF Master/Class/Purchase/DMG/KMPurchaseEmbeddedWindowController.xib

@@ -1,8 +1,8 @@
 <?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">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="23094" 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.InterfaceBuilder.CocoaPlugin" version="23094"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
@@ -99,6 +99,8 @@
                 <outlet property="scanLabel" destination="8Om-Bo-EFk" id="aau-Ii-1du"/>
                 <outlet property="successfullyLabel" destination="hj7-ST-7me" id="Kft-CA-jiD"/>
                 <outlet property="successfullyView" destination="LRb-Y6-ZvE" id="eWl-If-q4N"/>
+                <outlet property="usualAddCountView" destination="Sat-nf-b5q" id="qjf-Zb-wOb"/>
+                <outlet property="usualAddonView" destination="M6b-Qf-5FA" id="6Bw-Ee-0uH"/>
                 <outlet property="weChatBox" destination="3RR-ng-Us6" id="H3Q-Zj-hJo"/>
                 <outlet property="weChatButton" destination="hj1-6S-4j5" id="768-we-YrD"/>
                 <outlet property="weChatPayView" destination="pBx-yN-WZs" id="1hO-qE-DpL"/>
@@ -114,7 +116,7 @@
             <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
             <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
             <rect key="contentRect" x="196" y="240" width="970" height="612"/>
-            <rect key="screenRect" x="0.0" y="0.0" width="2560" height="1415"/>
+            <rect key="screenRect" x="0.0" y="0.0" width="1440" height="875"/>
             <value key="minSize" type="size" width="970" height="612"/>
             <value key="maxSize" type="size" width="970" height="612"/>
             <view key="contentView" id="se5-gp-TjO">
@@ -481,7 +483,7 @@
                                                                 <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="EmbeddedPayment26" id="dr8-sG-J6H"/>
                                                             </imageView>
                                                             <button translatesAutoresizingMaskIntoConstraints="NO" id="EEw-fo-cIt">
-                                                                <rect key="frame" x="260" y="48" width="75" height="20"/>
+                                                                <rect key="frame" x="261" y="48" width="74" height="20"/>
                                                                 <buttonCell key="cell" type="bevel" title="Not Found?" bezelStyle="rounded" alignment="center" imageScaling="proportionallyDown" inset="2" id="zXn-dP-FsP">
                                                                     <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                                                     <font key="font" metaFont="system"/>
@@ -1380,7 +1382,7 @@
                             <rect key="frame" x="-5" y="0.0" width="229" height="28"/>
                             <popUpButtonCell key="cell" type="square" bezelStyle="shadowlessSquare" alignment="left" lineBreakMode="truncatingTail" inset="2" arrowPosition="noArrow" id="7Au-hp-0Cm" customClass="KMPopUpButtonCell" customModule="PDF_Reader_Pro" customModuleProvider="target">
                                 <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
-                                <font key="font" metaFont="menu"/>
+                                <font key="font" metaFont="message"/>
                                 <menu key="menu" id="pry-dI-PhA"/>
                             </popUpButtonCell>
                             <connections>

+ 6 - 0
PDF Office/PDF Master/MemberCenter/WindowsController/KMProductCompareWC.swift

@@ -1028,10 +1028,16 @@ class KMProductCompareWC: NSWindowController {
     }
     
     @IBAction func appstorePurchaseAction(_ sender: NSButton) {
+#if VERSION_DMG
+        let embeddedWC = KMPurchaseEmbeddedWindowController.currentFirstTrialWC("com.brother.pdfreaderpro.mac.product_2")
+        embeddedWC.showWindow(nil)
+        embeddedWC.window?.center()
+#else
         model.appstorePurchaseAction(sender.tag) { [weak self] success, msg in
             guard let self = self else { return }
 
         }
+#endif
     }
     
     // MARK: - InAppPurchaseManager Notification