فهرست منبع

【综合】整理代码

tangchao 4 روز پیش
والد
کامیت
0d47637aa3

+ 53 - 335
PDF Office/PDF Master/Class/Purchase/DMG/KMPurchaseEmbeddedWindowController.swift

@@ -47,33 +47,14 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
     @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!
-    @IBOutlet weak var IndividualLabel: NSTextField!
-    @IBOutlet weak var removeButton2: NSButton! // 减少按钮2
-    @IBOutlet weak var addButton2: NSButton! // 增加按钮2
-    @IBOutlet weak var amountTextField2: NSTextField! // 数目2
-    @IBOutlet weak var amountView2: NSView!
-    @IBOutlet weak var originalPriceLabel2: NSTextField! // 原价
-    @IBOutlet weak var discountPriceLabel2: NSTextField! // 折扣
-    @IBOutlet weak var aiAddOnButton1: NSButton!
-    
-    @IBOutlet weak var extendedView: NSView!
-    @IBOutlet weak var extendedButton: NSButton!
-    @IBOutlet weak var extendedLabel: NSTextField!
-    @IBOutlet weak var extendedImageView: NSImageView!
-    @IBOutlet weak var accessLabel: NSTextField!
-    @IBOutlet weak var removeButton3: NSButton! // 减少按钮3
-    @IBOutlet weak var addButton3: NSButton! // 增加按钮3
-    @IBOutlet weak var amountTextField3: NSTextField! // 数目3
-    @IBOutlet weak var amountView3: NSView!
-    @IBOutlet weak var originalPriceLabel3: NSTextField! // 原价
-    @IBOutlet weak var discountPriceLabel3: NSTextField! // 折扣
-    @IBOutlet weak var extendedButton1: NSButton!
-    
+            
+    @IBOutlet weak var firmLabel: NSTextField!
+    @IBOutlet weak var addbox: NSBox!
+    @IBOutlet weak var textbox: NSBox!
+    @IBOutlet weak var removebox: NSBox!
+    @IBOutlet weak var linebox: NSBox!
+
+    @IBOutlet weak var prodocumentView: NSView!
     @IBOutlet weak var couponView: NSView!
     @IBOutlet weak var couponButton: NSButton!
     @IBOutlet weak var couponBox: NSBox!
@@ -96,17 +77,7 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
     @IBOutlet weak var privacyLabel: NSTextField!
     
     @IBOutlet weak var billInformationLabel: NSTextField!
-    
-    @IBOutlet weak var licenseCodeView: NSView!
-    @IBOutlet weak var licenseCodeLabel: NSTextField!
-    @IBOutlet weak var licenseCodeBox: NSBox!
-    @IBOutlet weak var licenseCodeTextField: NSTextField!
-    @IBOutlet weak var notFoundButton: NSButton!
-    @IBOutlet weak var licenseCodeTopLayout: NSLayoutConstraint!
-    @IBOutlet weak var licenseCodeErrorView: NSView!
-    @IBOutlet weak var licenseCodeErrorLabel: NSTextField!
-    @IBOutlet weak var licenseCodeErrorTopLayout: NSLayoutConstraint!
-    
+        
     @IBOutlet weak var emailLabel: NSTextField!
     @IBOutlet weak var emailTextField: NSTextField!
     @IBOutlet weak var emailBox: NSBox!
@@ -374,6 +345,15 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
     // MARK: UI
     
     private func xibInitialization() -> Void {
+        prodocumentView.wantsLayer = true
+        prodocumentView.layer?.cornerRadius = 5.0
+        prodocumentView.layer?.borderWidth = 1.0
+        prodocumentView.layer?.borderColor = linebox.fillColor.cgColor
+        
+        addbox.fillColor =  NSColor(named: "0E1114 1") ?? .white
+        removebox.fillColor =  NSColor(named: "0E1114 1") ?? .white
+
+        textbox.fillColor = NSColor(named: "0E1114 2") ?? .white
         yourOrderLabel.stringValue = NSLocalizedString("Your Order", comment: "")
         yourOrderLabel.textColor = NSColor(named: "KMPurchaseTitleColor")
         yourOrderLabel.font = NSFont.SFProTextBoldFont(20.0)
@@ -389,164 +369,56 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
         discountPriceLabel1.textColor = NSColor(named: "KMPurchaseDiscountColor")
         discountPriceLabel1.font = NSFont.SFProTextRegularFont(9.0)
         refreshLicenseCodeView(isReveal: false)
-        if isOneTimePurchase(product_Info) {
-            usualAddCountView.isHidden = false
-        } else {
-            usualAddCountView.isHidden = true
-        }
-        
-        
+                
         oneLicenseLabel.stringValue = NSLocalizedString("and more offline. It's one time purchase.", comment: "")
         oneLicenseLabel.isHidden = true
         
-        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 _dmgProductType == .advanced_annual_subscription_trail {
-            aiAddOnView.isHidden = true
-            extendedView.isHidden = true
             
             let productName = product_Info.productName
             pdfReaderProLabel.stringValue = productName
         }
         if _dmgProductType == .standard_annual_subscription {
-            aiAddOnView.isHidden = true
-            extendedView.isHidden = true
             
             let productName = product_Info.productName
             pdfReaderProLabel.stringValue = productName
         }
         if _dmgProductType == .advanced_annual_subscription {
-            aiAddOnView.isHidden = true
-            extendedView.isHidden = true
             
             let productName = product_Info.productName
-            pdfReaderProLabel.stringValue = productName
         }
         if _dmgProductType == .advanced_permanent {
-            aiAddOnView.isHidden = true
-            extendedView.isHidden = true
             
             let productName = product_Info.productName
             pdfReaderProLabel.stringValue = productName
         }
         if _dmgProductType == .ai_subscription_month {
-            aiAddOnView.isHidden = true
-            extendedView.isHidden = true
             
             let productName = product_Info.productName
             pdfReaderProLabel.stringValue = productName
         }
         if _dmgProductType == .ai_subscription_year_trail {
-            aiAddOnView.isHidden = true
-            extendedView.isHidden = true
             
             let productName = product_Info.productName
             pdfReaderProLabel.stringValue = productName
         }
         if _dmgProductType == .advanced_permanent_blackFive {
-            aiAddOnView.isHidden = true
-            extendedView.isHidden = true
             
             let productName = product_Info.productName
             pdfReaderProLabel.stringValue = productName
         }
         if _dmgProductType == .advanced_annual_subscription_blackFive {
-            aiAddOnView.isHidden = true
-            extendedView.isHidden = true
             
             let productName = product_Info.productName
             pdfReaderProLabel.stringValue = productName
         }
         
         
-//        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
-        amountTextField3.isEditable = false
-        amountView2.isHidden = true
-        amountView3.isHidden = true
 
         couponButton.title = NSLocalizedString("I have a coupon?", comment: "")
         couponButton.setTitleColor(color: NSColor(named: "KMPurchaseCouponColor")!, font: NSFont.SFProTextRegularFont(14))
@@ -618,24 +490,15 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
         billInformationLabel.stringValue = NSLocalizedString("Billing Information", comment: "")
         billInformationLabel.textColor = NSColor(named: "KMPurchaseTitleColor1")
         billInformationLabel.font = NSFont.SFProTextRegularFont(14.0)
-        emailLabel.stringValue = NSLocalizedString("Email", comment: "")
+        emailLabel.stringValue = NSLocalizedString("You can purchase from the account associated with this email. If the email address is not registered, it will be automatically registered for you after purchase.", comment: "")
         emailLabel.textColor = NSColor(named: "KMPurchaseTitleColor1")
         emailLabel.font = NSFont.SFProTextRegularFont(14.0)
         emailTextField.placeholderString = NSLocalizedString("Email to receive license code", comment: "")
         emailBox.borderColor = NSColor(named: "KMPurchase_DADBDE")!
 //        emailBox.fillColor = NSColor(named: "KMPurchase_FFFFFF")!
         errorLabel.stringValue = NSLocalizedString("Please enter your email for license receiving.", comment: "")
-        if VerificationManager.default().email != nil {
-            var emailString = ""
-            if let email = VerificationManager.default().email, email.count > 0 {
-                emailString = email
-            } else {
-                if let subscriptionEmail = VerificationManager.default().subscriptionEmail, subscriptionEmail.count > 0 {
-                    emailString = subscriptionEmail
-                }
-            }
-            emailTextField.stringValue = emailString
-        }
+        emailTextField.stringValue = KMMemberInfo.shared.userEmail
+
         emailTextField.delegate = self
         errorLabel.textColor = NSColor(named: "KMPurchaseErrorColor")
         errorLabel.font = NSFont.SFProTextRegularFont(11.0)
@@ -745,8 +608,6 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
             // 全平台高级版年订阅             99.9 美金,黑五订单
             // Mac & Win 双平台高级永久      119.99 美金,黑五订单
             // AI 年订阅                    125.99 美金,带免费试用
-            aiAddOnView.isHidden = true
-            extendedView.isHidden = true
             
             var tipsString = NSLocalizedString("%.2@/year, auto-renewal", comment: "")
             if product_Info.cycle == 4 {
@@ -802,8 +663,6 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
             // 全平台标准版年订阅             79.9 美金
             // Mac & Win 双平台高级永久      119.99 美金
             // AI 月订阅                    14.99 美金
-            aiAddOnView.isHidden = true
-            extendedView.isHidden = true
             
             var tipsString = NSLocalizedString("%.2@/year, auto-renewal", comment: "")
             if product_Info.cycle == 4 {
@@ -852,8 +711,6 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
         
         if _dmgProductType == .advanced_permanent {
             // Mac & Win 双平台高级永久      119.99 美金
-            aiAddOnView.isHidden = true
-            extendedView.isHidden = true
             
             var tipsString = NSLocalizedString("%.2@/year, auto-renewal", comment: "")
             if product_Info.cycle == 4 {
@@ -1037,8 +894,8 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
                     discount2 = aiBinding_discount - advanced_discount
                     original2 = aiBinding_original - advanced_original
                     
-                    listPrice = (original1 * Float(amountTextField1.stringValue)!) + (original3 * Float(amountTextField3.stringValue)!)
-                    paySum = (discount1 * Float(amountTextField1.stringValue)!) + (discount3 * Float(amountTextField3.stringValue)!)
+                    listPrice = (original1 * Float(amountTextField1.stringValue)!) + (original3 * Float("")!)
+                    paySum = (discount1 * Float(amountTextField1.stringValue)!) + (discount3 * Float("")!)
                     discount = listPrice - paySum
                 } else if originalType == .ipaPermanent {
                     listPrice = Float(KMDMGProductsManager.shareInstance.getPrice("com.brother.pdfreaderpro.mac.product_3")) ?? 79.99
@@ -1076,8 +933,8 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
                 discount3 = cross_discount - discount1
                 original3 = cross_original
                 
-                listPrice = (original1 * Float(amountTextField1.stringValue)!) + (discount3 * Float(amountTextField3.stringValue)!)
-                paySum = (discount1 * Float(amountTextField1.stringValue)!) + (discount3 * Float(amountTextField3.stringValue)!)
+                listPrice = (original1 * Float(amountTextField1.stringValue)!) + (discount3 * Float("")!)
+                paySum = (discount1 * Float(amountTextField1.stringValue)!) + (discount3 * Float("")!)
                 discount = listPrice - paySum
             } else if productType == .ipaPremiumAI {
                 let aiBinding_discount = Float(KMDMGProductsManager.shareInstance.getActivityPrice("com.brother.pdfreaderpro.mac.product_1+com.brother.pdfreaderpro.ai.product_1")) ?? 74.98
@@ -1090,8 +947,8 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
                 discount3 = Float(KMDMGProductsManager.shareInstance.getActivityPrice("com.brother.pdfreaderpro.mac.product_2.checkout")) ?? 20.00
                 original3 = Float(KMDMGProductsManager.shareInstance.getPrice("com.brother.pdfreaderpro.mac.product_2.checkout")) ?? 20.00
                 
-                listPrice = (original1 * Float(amountTextField1.stringValue)!) + (original2 * Float(amountTextField2.stringValue)!)
-                paySum = (discount1 * Float(amountTextField1.stringValue)!) + (discount2 * Float(amountTextField2.stringValue)!)
+                listPrice = (original1 * Float(amountTextField1.stringValue)!) + (original2 * 1)
+                paySum = (discount1 * Float(amountTextField1.stringValue)!) + (discount2 * 1)
                 discount = listPrice - paySum
             } else if productType == .ipaPermanentAI {
                 if originalType == .ipaPremium {
@@ -1110,8 +967,8 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
                     discount2 = aiBinding_discount - advanced_discount
                     original2 = aiBinding_original - advanced_original
                     
-                    listPrice = (original1 * Float(amountTextField1.stringValue)!) + (original2 * Float(amountTextField2.stringValue)!) + (original3 * Float(amountTextField3.stringValue)!)
-                    paySum = (discount1 * Float(amountTextField1.stringValue)!) + (discount2 * Float(amountTextField2.stringValue)!) + (discount3 * Float(amountTextField3.stringValue)!)
+                    listPrice = (original1 * Float("")!) + (original2 * Float("")!) + (original3 * Float("")!)
+                    paySum = (discount1 * Float("")!) + (discount2 * Float("")!) + (discount3 * Float("")!)
                     discount = listPrice - paySum
                 } else if originalType == .ipaPermanent {
                     listPrice = Float(KMDMGProductsManager.shareInstance.getPrice("com.brother.pdfreaderpro.mac.product_3+com.brother.pdfreaderpro.ai.product_1")) ?? 94.98
@@ -1128,8 +985,8 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
                     discount3 = cross_discount - discount1
                     original3 = cross_original
                     
-                    listPrice = (original1 * Float(amountTextField1.stringValue)!) + (original2 * Float(amountTextField2.stringValue)!)
-                    paySum = (discount1 * Float(amountTextField1.stringValue)!) + (discount2 * Float(amountTextField2.stringValue)!)
+                    listPrice = (original1 * Float(amountTextField1.stringValue)!) + (original2 * Float("")!)
+                    paySum = (discount1 * Float(amountTextField1.stringValue)!) + (discount2 * Float("")!)
                     discount = listPrice - paySum
                 }
             } else if productType == .ipaPermanentCrossPlatformAI {
@@ -1147,8 +1004,6 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
                 discount3 = cross_discount - discount1
                 original3 = cross_original
                 
-                listPrice = (original1 * Float(amountTextField1.stringValue)!) + (original2 * Float(amountTextField2.stringValue)!) + (original3 * Float(amountTextField3.stringValue)!)
-                paySum = (discount1 * Float(amountTextField1.stringValue)!) + (discount2 * Float(amountTextField2.stringValue)!) + (discount3 * Float(amountTextField3.stringValue)!)
                 discount = listPrice - paySum
             }
 
@@ -1163,26 +1018,18 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
                 discountPriceLabel1.attributedStringValue = attributedString
             }
             
-            originalPriceLabel2.stringValue = String(format: "%@ %@", abbreviation, String(format: "%.2f", discount2))
             if String(format: "%.2f", original2) == String(format: "%.2f", discount2) {
-                discountPriceLabel2.isHidden = true
             } else {
-                discountPriceLabel2.isHidden = false
                 let attributedString = NSMutableAttributedString(string: String(format: "%.2f", original2))
                 attributedString.addAttribute(.strikethroughStyle, value: NSNumber(value: NSUnderlineStyle.single.rawValue), range: NSMakeRange(0, attributedString.length))
                 attributedString.addAttribute(.strikethroughColor, value: NSColor(named: "KMPurchaseDiscountColor") as Any, range: NSMakeRange(0, attributedString.length))
-                discountPriceLabel2.attributedStringValue = attributedString
             }
             
-            originalPriceLabel3.stringValue = String(format: "%@ %@", abbreviation, String(format: "%.2f", discount3))
             if String(format: "%.2f", original3) == String(format: "%.2f", discount3) {
-                discountPriceLabel3.isHidden = true
             } else {
-                discountPriceLabel3.isHidden = false
                 let attributedString = NSMutableAttributedString(string: String(format: "%.2f", original3))
                 attributedString.addAttribute(.strikethroughStyle, value: NSNumber(value: NSUnderlineStyle.single.rawValue), range: NSMakeRange(0, attributedString.length))
                 attributedString.addAttribute(.strikethroughColor, value: NSColor(named: "KMPurchaseDiscountColor") as Any, range: NSMakeRange(0, attributedString.length))
-                discountPriceLabel3.attributedStringValue = attributedString
             }
         }
         if self.discountScale != "" || self.discountAmount != "" {
@@ -1254,12 +1101,6 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
                 wechatPayButton.isHidden = false
             }
             amountTextField1.stringValue = String(pdfCount)
-            if extendedButton.state == .on {
-                amountTextField2.stringValue = String(pdfCount * 2)
-            } else {
-                amountTextField2.stringValue = String(pdfCount * 1)
-            }
-            amountTextField3.stringValue = String(pdfCount)
         }
         
         // 价格刷新
@@ -1304,100 +1145,6 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
         }
     }
     
-    @IBAction func aiAddOnButtonAction(_ sender: NSButton) {
-        let type: ProductType = productToType(originalProductID)
-        aiAddOnButton.state = sender.state
-        if sender.state == .on {
-            amountView2.isHidden = false
-            aiAddOnButton.image = NSImage(named: "EmbeddedPayment07")
-            if extendedButton.state == .on {
-                if type == .ipaPremium {
-                    productType = .ipaPermanentAI
-                } else if type == .ipaPermanent {
-                    productType = .ipaPermanentCrossPlatformAI
-                }
-            } else {
-                if type == .ipaPremium {
-                    productType = .ipaPremiumAI
-                } else if type == .ipaPermanent {
-                    productType = .ipaPermanentAI
-                }
-            }
-        } else {
-            amountView2.isHidden = true
-            aiAddOnButton.image = NSImage(named: "EmbeddedPayment06")
-            if extendedButton.state == .on {
-                if type == .ipaPremium {
-                    productType = .ipaPermanent
-                } else if type == .ipaPermanent {
-                    productType = .ipaPermanentCrossPlatform
-                }
-            } else {
-                if type == .ipaPremium {
-                    productType = .ipaPremium
-                } else if type == .ipaPermanent {
-                    productType = .ipaPermanent
-                }
-            }
-        }
-        
-        discountScale = ""
-        discountAmount = ""
-        coupomTextField.isEnabled = true
-        // 价格刷新
-        priceRefresh()
-    }
-    
-    @IBAction func extendedButtonAction(_ sender: NSButton) {
-        let type: ProductType = productToType(originalProductID)
-        extendedButton.state = sender.state
-        if sender.state == .on {
-            amountView3.isHidden = false
-            if type == .ipaPremium {
-                amountTextField2.stringValue = String(pdfCount)
-            } else {
-                amountTextField2.stringValue = String(pdfCount * 2)
-            }
-            extendedButton.image = NSImage(named: "EmbeddedPayment07")
-            if aiAddOnButton.state == .on {
-                if type == .ipaPremium {
-                    productType = .ipaPermanentAI
-                } else if type == .ipaPermanent {
-                    productType = .ipaPermanentCrossPlatformAI
-                }
-            } else {
-                if type == .ipaPremium {
-                    productType = .ipaPermanent
-                } else if type == .ipaPermanent {
-                    productType = .ipaPermanentCrossPlatform
-                } 
-            }
-        } else {
-            amountView3.isHidden = true
-            amountTextField2.stringValue = String(pdfCount)
-            extendedButton.image = NSImage(named: "EmbeddedPayment06")
-            if aiAddOnButton.state == .on {
-                if type == .ipaPremium {
-                    productType = .ipaPremiumAI
-                } else if type == .ipaPermanent {
-                    productType = .ipaPermanentAI
-                }
-            } else {
-                if type == .ipaPremium {
-                    productType = .ipaPremium
-                } else if type == .ipaPermanent {
-                    productType = .ipaPermanent
-                }
-            }
-        }
-        
-        discountScale = ""
-        discountAmount = ""
-        coupomTextField.isEnabled = true
-        // 价格刷新
-        priceRefresh()
-    }
-    
     @IBAction func payButtonAction(_ sender: NSButton) {
         emailErrorLabel(isReveal: false)
         confirmPayment(isConfirm: false)
@@ -1583,24 +1330,6 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
             }
         }
 
-//        var licenseCode = ""
-//        if productID == "com.brother.pdfreaderpro.mac.product_2" {
-//            if licenseCodeTextField.stringValue.count > 0 {
-//                licenseCode = licenseCodeTextField.stringValue
-//            } else {
-//                let alert = NSAlert()
-//                alert.alertStyle = .critical
-//                alert.messageText = NSLocalizedString("Error Information", comment: "")
-//                alert.informativeText = NSLocalizedString("Input license code previously activated the app", comment: "")
-//                alert.addButton(withTitle: NSLocalizedString("OK", comment: ""))
-//                alert.runModal()
-//
-//                return
-//            }
-//            if let license = VerificationManager.default().originLicenseCode, license.count > 0 {
-//                licenseCode = license
-//            }
-//        }
         var couponCode = ""
         if coupomErrorLabel.isHidden {
             couponCode = coupomTextField.stringValue
@@ -2209,23 +1938,19 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
             }
             self.embeddedPaymentPopWC?.showWindow(nil)
             self.embeddedPaymentPopWC?.callback = { isClose in
-//                let alert = NSAlert()
-//                alert.alertStyle = .critical
-//                alert.messageText = NSLocalizedString("Checking payment status", comment: "")
-////                alert.informativeText = NSLocalizedString("Get License Code is empty.", comment: "")
-//                alert.addButton(withTitle: NSLocalizedString("OK", comment: ""))
-//                if alert.responds(to: #selector(alert.beginSheetModal(for:completionHandler:))) {
-//                    alert.beginSheetModal(for: self.window!, completionHandler: nil)
-//                } else {
-//                    alert.runModal()
-//                }
             }
         }
         startPolling()
     }
     
     private func convertBase64StringToNSImage(base64String: String) -> NSImage? {
-        // 待补充base64转NSImage方法
+        let sepS = "data:image/png;base64,"
+        guard let baseStr = base64String.components(separatedBy: sepS).last else {
+            return nil
+        }
+        if let data = Data(base64Encoded: baseStr) {
+            return NSImage(data: data)
+        }
         return nil
     }
     
@@ -2241,7 +1966,10 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
                 self.scanLabel.stringValue = NSLocalizedString("Scan QR Code with Alipay", comment: "")
                 self.payTypeImageView.image = NSImage(named: "EmbeddedPayment28")
             }
-            self.payTypeImageView.image = self.convertBase64StringToNSImage(base64String: urlPath)
+
+            let img = self.convertBase64StringToNSImage(base64String: urlPath)
+            self.qrCodeImageView.image = img
+            
         }
     }
     
@@ -2333,8 +2061,16 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
             if self.orderID == "" { return }
             KMMemberCenterManager.manager.getStateByOrderId(orderId: self.orderID) { success, info in
                 if (success) {
-                    NotificationCenter.default.post(name: NSNotification.Name(rawValue: "KMIAPSubscriptionLoadedNotification"), object: nil)
-                    self.stopPolling();
+                    let dic: NSDictionary = info ?? [:]
+                    let requestDic: NSDictionary = dic["result"] as? NSDictionary ?? [:]
+                    let status:String = requestDic["status"]  as? String ?? ""
+                    if(status.uppercased() == "COMPLETED") {
+                        NotificationCenter.default.post(name: NSNotification.Name(rawValue: "KMIAPSubscriptionLoadedNotification"), object: nil)
+                        self.stopPolling()
+                        
+                        self.close()
+                        
+                    }
                 }
             }
         }
@@ -2516,22 +2252,16 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
         if isConfirm {
             removeButton1.isEnabled = false
             addButton1.isEnabled = false
-            aiAddOnButton1.isEnabled = false
-            extendedButton1.isEnabled = false
             couponButton.isEnabled = false
             coupomTextField.isEnabled = false
             applyButton.isEnabled = false
             emailTextField.isEnabled = false
-            licenseCodeTextField.isEnabled = false
         } else {
             removeButton1.isEnabled = true
             addButton1.isEnabled = true
-            aiAddOnButton1.isEnabled = true
-            extendedButton1.isEnabled = true
             coupomTextField.isEnabled = true
             couponButton.isEnabled = true
             emailTextField.isEnabled = true
-            licenseCodeTextField.isEnabled = true
         }
     }
     
@@ -2545,15 +2275,9 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
     }
     
     private func refreshLicenseCodeView(isReveal: Bool) {
-        licenseCodeView.isHidden = !isReveal
-        licenseCodeTopLayout.constant = licenseCodeView.isHidden ? -CGRectGetHeight(licenseCodeView.bounds)-8 : 8.0
-        imageBottomLayout.constant = licenseCodeView.isHidden ? 16.0 : 8.0
-        image2BottomLayout.constant = licenseCodeView.isHidden ? 20.0 : 8.0
     }
     
     private func refreshLicenseCodeErrorView(isReveal: Bool) {
-        licenseCodeErrorView.isHidden = !isReveal
-        licenseCodeErrorTopLayout.constant = licenseCodeErrorView.isHidden ? -CGRectGetHeight(licenseCodeErrorView.bounds) : 4.0
     }
     
     private func refreshCouponError(isReveal: Bool) {
@@ -2647,12 +2371,6 @@ extension KMPurchaseEmbeddedWindowController: NSTextFieldDelegate {
                 }
             }
             priceRefresh()
-        } else if textField == licenseCodeTextField {
-            if textField!.stringValue.count > 0 {
-                refreshLicenseCodeErrorView(isReveal: false)
-            } else {
-                refreshLicenseCodeErrorView(isReveal: false)
-            }
         }
     }
 }

+ 38 - 0
PDF Office/PDF Master/MemberCenter/Assets/MemberCenter.xcassets/Color/0E1114 1.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" : "0x2B",
+          "green" : "0x28",
+          "red" : "0x26"
+        }
+      },
+      "idiom" : "universal"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

+ 38 - 0
PDF Office/PDF Master/MemberCenter/Assets/MemberCenter.xcassets/Color/0E1114 2.colorset/Contents.json

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

+ 1 - 1
PDF Office/PDF Master/MemberCenter/Model/KMMemberCenterManager.swift

@@ -1317,7 +1317,7 @@ class KMMemberCenterManager: NSObject {
                 let requestCode: Int = dic["code"] as? Int ?? 0
                 let requestDic: NSDictionary = dic["result"] as? NSDictionary ?? [:]
                 let status:String = requestDic["status"]  as? String ?? ""
-                if requestCode == 200  &&  status.uppercased() == "COMPLETED"{
+                if requestCode == 200{
                     complete(true, dic)
                 } else {
                     complete(false, dic)

+ 27 - 0
PDF Office/build/XCBuildData/37370a69f01414f1797cd67fd9c52870.xcbuilddata/build-request.json

@@ -0,0 +1,27 @@
+{
+  "buildCommand" : {
+    "command" : "build",
+    "skipDependencies" : false,
+    "style" : "buildOnly"
+  },
+  "configuredTargets" : [
+
+  ],
+  "continueBuildingAfterErrors" : false,
+  "dependencyScope" : "workspace",
+  "enableIndexBuildArena" : false,
+  "hideShellScriptEnvironment" : false,
+  "parameters" : {
+    "action" : "build",
+    "overrides" : {
+
+    }
+  },
+  "qos" : "utility",
+  "schemeCommand" : "launch",
+  "showNonLoggedProgress" : true,
+  "useDryRun" : false,
+  "useImplicitDependencies" : false,
+  "useLegacyBuildLocations" : false,
+  "useParallelTargets" : true
+}

BIN
PDF Office/build/XCBuildData/37370a69f01414f1797cd67fd9c52870.xcbuilddata/description.msgpack


+ 1 - 0
PDF Office/build/XCBuildData/37370a69f01414f1797cd67fd9c52870.xcbuilddata/manifest.json

@@ -0,0 +1 @@
+{"client":{"name":"basic","version":0,"file-system":"device-agnostic","perform-ownership-analysis":"no"},"targets":{"":["<all>"]},"commands":{"<all>":{"tool":"phony","inputs":["<WorkspaceHeaderMapVFSFilesWritten>"],"outputs":["<all>"]},"P0:::Gate WorkspaceHeaderMapVFSFilesWritten":{"tool":"phony","inputs":[],"outputs":["<WorkspaceHeaderMapVFSFilesWritten>"]}}}

+ 1 - 0
PDF Office/build/XCBuildData/37370a69f01414f1797cd67fd9c52870.xcbuilddata/target-graph.txt

@@ -0,0 +1 @@
+Target dependency graph (0 target)

BIN
PDF Office/build/XCBuildData/37370a69f01414f1797cd67fd9c52870.xcbuilddata/task-store.msgpack