Browse Source

优惠券到期逻辑调整

niehaoyu 9 months ago
parent
commit
f091c1facb

+ 12 - 0
PDF Office/PDF Master/Class/GuideInfo/GuideInfoImages.xcassets/cnLight.imageset/Contents.json

@@ -0,0 +1,12 @@
+{
+  "images" : [
+    {
+      "filename" : "cnLight.pdf",
+      "idiom" : "universal"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
PDF Office/PDF Master/Class/GuideInfo/GuideInfoImages.xcassets/cnLight.imageset/cnLight.pdf


+ 12 - 0
PDF Office/PDF Master/Class/GuideInfo/GuideInfoImages.xcassets/detailCnDark.imageset/Contents.json

@@ -0,0 +1,12 @@
+{
+  "images" : [
+    {
+      "filename" : "detailCnDark.pdf",
+      "idiom" : "universal"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

File diff suppressed because it is too large
+ 811 - 0
PDF Office/PDF Master/Class/GuideInfo/GuideInfoImages.xcassets/detailCnDark.imageset/detailCnDark.pdf


+ 54 - 4
PDF Office/PDF Master/Class/GuideInfo/KMCouponDueWindowController.swift

@@ -11,35 +11,85 @@ class KMCouponDueWindowController: NSWindowController {
 
     @IBOutlet var contendBox: NSBox!
     
+    @IBOutlet var contendImage: NSImageView!
+    
     @IBOutlet var titleLabel: NSTextField!
     @IBOutlet var subTitleLabel: NSTextField!
     
-    @IBOutlet var tipInfoView: NSTextField!
+    @IBOutlet var tipInfoView: NSView!
+    @IBOutlet var tipInfoImage: NSImageView!
     
     
     @IBOutlet var buyBox: NSBox!
     @IBOutlet var buyButton: KMButton!
     @IBOutlet var laterInfoLabel: NSTextField!
     
+    deinit {
+        print("KMCouponDueWindowController deInit")
+    }
     
     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.
         
+        self.window?.contentView?.wantsLayer = true
         
+        self.titleLabel.font = NSFont.SFProTextBoldFont(21)
+        self.subTitleLabel.font = NSFont.SFProTextRegularFont(14)
+        self.buyButton.font = NSFont.SFProTextSemiboldFont(16)
+        self.laterInfoLabel.font = NSFont.SFProTextRegularFont(12)
         
         self.buyBox.cornerRadius = CGRectGetHeight(self.buyBox.frame)/2
         self.buyBox.fillColor = NSColor(red: 255/255, green: 158/255, blue: 42/255, alpha: 1)
-        self.buyButton.mouseMoveCallback = {[unowned self] mouseEntered in
+        self.buyButton.mouseMoveCallback = {[weak self] mouseEntered in
             if mouseEntered {
-                self.buyBox.fillColor = NSColor(red: 255/255, green: 139/255, blue: 0, alpha: 1)
+                self?.buyBox.fillColor = NSColor(red: 255/255, green: 139/255, blue: 0, alpha: 1)
             } else {
-                self.buyBox.fillColor = NSColor(red: 255/255, green: 158/255, blue: 42/255, alpha: 1)
+                self?.buyBox.fillColor = NSColor(red: 255/255, green: 158/255, blue: 42/255, alpha: 1)
             }
         }
         self.buyButton.setTitleColor(NSColor.white)
         
     }
     
+    func refreshUI() {
+        if KMAppearance.isDarkMode() {
+            self.window?.contentView?.layer?.backgroundColor = NSColor(red: 24/255, green: 22/255, blue: 31/255, alpha: 1).cgColor
+            self.titleLabel.textColor = KMAppearance.KMColor_Layout_L0()
+            self.subTitleLabel.textColor = KMAppearance.KMColor_Layout_L0()
+            self.laterInfoLabel.textColor = KMAppearance.KMColor_Layout_L0()
+            
+        } else {
+            self.window?.contentView?.layer?.backgroundColor = NSColor(red: 245/255, green: 249/255, blue: 255/255, alpha: 1).cgColor
+            self.titleLabel.textColor = NSColor(red: 0, green: 33/255, blue: 67/255, alpha: 1)
+            self.subTitleLabel.textColor = NSColor(red: 14/255, green: 17/255, blue: 20/255, alpha: 1)
+            self.laterInfoLabel.textColor = NSColor(red: 0, green: 33/255, blue: 67/255, alpha: 1)
+        }
+        self.buyButton.setTitleColor(NSColor.white)
+        
+    }
+    
+    func reloadData() {
+        self.titleLabel.stringValue = KMAdsInfoManager.shareInstance.couponInfo?.title ?? ""
+        self.subTitleLabel.stringValue = KMAdsInfoManager.shareInstance.couponInfo?.subTitle ?? ""
+        self.laterInfoLabel.stringValue = KMAdsInfoManager.shareInstance.couponInfo?.laterInfoString ?? ""
+        self.buyButton.title = KMAdsInfoManager.shareInstance.couponInfo?.buyBtnTitle ?? ""
+        
+        self.refreshUI()
+    }
+    
+    //MARK: IBAction
+    @IBAction func buyBtnClicked(_ sender: KMButton) {
+        guard let string = KMAdsInfoManager.shareInstance.couponInfo?.adsURLLink else {
+            return
+        }
+        
+        let newURL = NSURL(string: string)
+
+        NSWorkspace.shared.open(newURL! as URL)
+        
+        FMTrackEventManager.defaultManager.trackEvent(event: "PUW", withProperties: ["PUW_Btn" : "Btn_PUW_TrialExpireOffer_Buy"])
+    }
+    
 }

+ 21 - 116
PDF Office/PDF Master/Class/GuideInfo/KMCouponDueWindowController.xib

@@ -12,9 +12,11 @@
                 <outlet property="buyBox" destination="FYA-2d-xuI" id="u4E-0G-PJU"/>
                 <outlet property="buyButton" destination="Vji-vi-gbH" id="hbM-et-gc8"/>
                 <outlet property="contendBox" destination="bzV-Gq-pe9" id="dYI-Qe-kL5"/>
+                <outlet property="contendImage" destination="x8W-tS-Xhe" id="iJT-E2-Fxz"/>
                 <outlet property="laterInfoLabel" destination="VRY-Yk-fAD" id="V3J-01-cXd"/>
                 <outlet property="subTitleLabel" destination="jjn-yZ-D7c" id="X8B-q2-JDe"/>
-                <outlet property="tipInfoView" destination="9Wf-wa-Uet" id="v0C-oZ-RRu"/>
+                <outlet property="tipInfoImage" destination="GkG-tR-cLY" id="Oe9-x1-7YF"/>
+                <outlet property="tipInfoView" destination="f1m-ug-ENL" id="gor-we-zNF"/>
                 <outlet property="titleLabel" destination="mL0-nw-nO3" id="uPj-4g-B9V"/>
                 <outlet property="window" destination="F0z-JX-Cv5" id="gIp-Ho-8D9"/>
             </connections>
@@ -22,20 +24,20 @@
         <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" titlebarAppearsTransparent="YES" titleVisibility="hidden" id="F0z-JX-Cv5">
-            <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
+            <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="660" height="418"/>
+            <rect key="contentRect" x="196" y="240" width="660" height="443"/>
             <rect key="screenRect" x="0.0" y="0.0" width="1920" height="1055"/>
-            <value key="minSize" type="size" width="660" height="418"/>
-            <value key="maxSize" type="size" width="660" height="418"/>
+            <value key="minSize" type="size" width="660" height="443"/>
+            <value key="maxSize" type="size" width="660" height="443"/>
             <view key="contentView" id="se5-gp-TjO">
-                <rect key="frame" x="0.0" y="0.0" width="660" height="418"/>
+                <rect key="frame" x="0.0" y="0.0" width="660" height="443"/>
                 <autoresizingMask key="autoresizingMask"/>
                 <subviews>
-                    <box boxType="custom" cornerRadius="4" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="bzV-Gq-pe9">
+                    <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="bzV-Gq-pe9">
                         <rect key="frame" x="29" y="27" width="602" height="380"/>
                         <view key="contentView" id="VA0-92-LSU">
-                            <rect key="frame" x="1" y="1" width="600" height="378"/>
+                            <rect key="frame" x="0.0" y="0.0" width="602" height="380"/>
                             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                             <subviews>
                                 <customView translatesAutoresizingMaskIntoConstraints="NO" id="4n1-ck-aYe">
@@ -43,7 +45,7 @@
                                     <subviews>
                                         <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="x8W-tS-Xhe">
                                             <rect key="frame" x="0.0" y="0.0" width="300" height="380"/>
-                                            <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" id="UDr-qh-Sdk"/>
+                                            <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="cnLight" id="UDr-qh-Sdk"/>
                                         </imageView>
                                     </subviews>
                                     <constraints>
@@ -56,7 +58,7 @@
                                     </constraints>
                                 </customView>
                                 <customView translatesAutoresizingMaskIntoConstraints="NO" id="IRn-Nx-1SH">
-                                    <rect key="frame" x="334" y="21" width="266" height="338"/>
+                                    <rect key="frame" x="336" y="21" width="266" height="338"/>
                                     <subviews>
                                         <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="mL0-nw-nO3">
                                             <rect key="frame" x="-2" y="313" width="172" height="25"/>
@@ -80,115 +82,14 @@
                                         <customView translatesAutoresizingMaskIntoConstraints="NO" id="f1m-ug-ENL">
                                             <rect key="frame" x="0.0" y="126" width="266" height="100"/>
                                             <subviews>
-                                                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="9Wf-wa-Uet">
-                                                    <rect key="frame" x="-2" y="83" width="110" height="17"/>
-                                                    <textFieldCell key="cell" alignment="left" title="Upgrade Benefit" id="4Pr-r2-TrM">
-                                                        <font key="font" metaFont="system" size="14"/>
-                                                        <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
-                                                        <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
-                                                    </textFieldCell>
-                                                </textField>
-                                                <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="Bme-fS-3EY">
-                                                    <rect key="frame" x="4" y="56" width="20" height="20"/>
-                                                    <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="vipSecondDark" id="rGM-ol-t7E"/>
+                                                <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="GkG-tR-cLY">
+                                                    <rect key="frame" x="0.0" y="0.0" width="266" height="100"/>
+                                                    <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+                                                    <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="detailCnDark" id="erh-zg-aUs"/>
                                                 </imageView>
-                                                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="zR1-bk-RuE">
-                                                    <rect key="frame" x="26" y="59" width="119" height="14"/>
-                                                    <textFieldCell key="cell" alignment="left" title="Edit text and images" id="XIP-5o-jEu">
-                                                        <font key="font" size="12" name="SFProText-Regular"/>
-                                                        <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
-                                                        <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
-                                                    </textFieldCell>
-                                                </textField>
-                                                <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="q7O-KT-2ls">
-                                                    <rect key="frame" x="151" y="56" width="20" height="20"/>
-                                                    <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="vipSecondDark" id="DvS-d5-tGp"/>
-                                                </imageView>
-                                                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="RSv-kH-wsv">
-                                                    <rect key="frame" x="173" y="59" width="88" height="14"/>
-                                                    <textFieldCell key="cell" alignment="left" title="Compress PDF" id="9cX-Mc-xi3">
-                                                        <font key="font" size="12" name="SFProText-Regular"/>
-                                                        <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
-                                                        <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
-                                                    </textFieldCell>
-                                                </textField>
-                                                <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="UgL-bs-1XS">
-                                                    <rect key="frame" x="4" y="28" width="20" height="20"/>
-                                                    <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="vipSecondDark" id="dXn-OK-2oi"/>
-                                                </imageView>
-                                                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Z0D-Np-RgN">
-                                                    <rect key="frame" x="26" y="31" width="93" height="14"/>
-                                                    <textFieldCell key="cell" alignment="left" title="Organize pages" id="agi-VD-OQo">
-                                                        <font key="font" size="12" name="SFProText-Regular"/>
-                                                        <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
-                                                        <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
-                                                    </textFieldCell>
-                                                </textField>
-                                                <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="WcM-Zs-R1b">
-                                                    <rect key="frame" x="151" y="28" width="20" height="20"/>
-                                                    <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="vipSecondDark" id="kkf-4Q-4Fn"/>
-                                                </imageView>
-                                                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="RmR-C0-8l7">
-                                                    <rect key="frame" x="173" y="31" width="76" height="14"/>
-                                                    <textFieldCell key="cell" alignment="left" title="Convert PDF" id="lDb-i3-7Ub">
-                                                        <font key="font" size="12" name="SFProText-Regular"/>
-                                                        <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
-                                                        <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
-                                                    </textFieldCell>
-                                                </textField>
-                                                <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="qLv-pt-Ikt">
-                                                    <rect key="frame" x="4" y="0.0" width="20" height="20"/>
-                                                    <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="vipSecondDark" id="cUk-ic-NiY"/>
-                                                </imageView>
-                                                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="i6B-6f-HEm">
-                                                    <rect key="frame" x="26" y="3" width="80" height="15"/>
-                                                    <textFieldCell key="cell" alignment="left" title="Form &amp; Sign" id="Yh2-G3-AFR">
-                                                        <font key="font" size="13" name="SFProText-Regular"/>
-                                                        <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
-                                                        <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
-                                                    </textFieldCell>
-                                                </textField>
-                                                <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="ker-im-aJw">
-                                                    <rect key="frame" x="151" y="0.0" width="20" height="20"/>
-                                                    <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="vipSecondDark" id="utf-xL-ZhC"/>
-                                                </imageView>
-                                                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="wy0-VO-0ec">
-                                                    <rect key="frame" x="173" y="3" width="71" height="14"/>
-                                                    <textFieldCell key="cell" alignment="left" title="Secure PDF" id="KQe-Md-c9U">
-                                                        <font key="font" size="12" name="SFProText-Regular"/>
-                                                        <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
-                                                        <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
-                                                    </textFieldCell>
-                                                </textField>
                                             </subviews>
                                             <constraints>
-                                                <constraint firstItem="qLv-pt-Ikt" firstAttribute="leading" secondItem="f1m-ug-ENL" secondAttribute="leading" constant="4" id="4R2-bs-kKI"/>
-                                                <constraint firstItem="zR1-bk-RuE" firstAttribute="centerY" secondItem="Bme-fS-3EY" secondAttribute="centerY" id="5iY-dW-O5h"/>
-                                                <constraint firstItem="RSv-kH-wsv" firstAttribute="centerY" secondItem="q7O-KT-2ls" secondAttribute="centerY" id="9yX-5d-p3b"/>
-                                                <constraint firstItem="wy0-VO-0ec" firstAttribute="centerY" secondItem="ker-im-aJw" secondAttribute="centerY" id="BTs-sG-JzA"/>
-                                                <constraint firstItem="zR1-bk-RuE" firstAttribute="leading" secondItem="f1m-ug-ENL" secondAttribute="leading" constant="28" id="I2d-XM-mEy"/>
-                                                <constraint firstItem="ker-im-aJw" firstAttribute="leading" secondItem="f1m-ug-ENL" secondAttribute="leading" constant="151" id="L3O-Wi-ddt"/>
-                                                <constraint firstItem="9Wf-wa-Uet" firstAttribute="leading" secondItem="f1m-ug-ENL" secondAttribute="leading" id="O7f-ju-25u"/>
-                                                <constraint firstItem="RmR-C0-8l7" firstAttribute="leading" secondItem="WcM-Zs-R1b" secondAttribute="trailing" constant="4" id="P3j-bo-uXM"/>
-                                                <constraint firstItem="9Wf-wa-Uet" firstAttribute="top" secondItem="f1m-ug-ENL" secondAttribute="top" id="RWJ-5e-ghT"/>
-                                                <constraint firstItem="wy0-VO-0ec" firstAttribute="leading" secondItem="ker-im-aJw" secondAttribute="trailing" constant="4" id="RsP-Pc-5qh"/>
                                                 <constraint firstAttribute="height" constant="100" id="TLT-K4-KS3"/>
-                                                <constraint firstItem="UgL-bs-1XS" firstAttribute="top" secondItem="Bme-fS-3EY" secondAttribute="bottom" constant="8" id="TfS-uf-uEI"/>
-                                                <constraint firstItem="qLv-pt-Ikt" firstAttribute="top" secondItem="UgL-bs-1XS" secondAttribute="bottom" constant="8" id="Vxm-bf-nOT"/>
-                                                <constraint firstItem="q7O-KT-2ls" firstAttribute="top" secondItem="f1m-ug-ENL" secondAttribute="top" constant="24" id="ZRo-NJ-fwd"/>
-                                                <constraint firstItem="Z0D-Np-RgN" firstAttribute="centerY" secondItem="UgL-bs-1XS" secondAttribute="centerY" id="av5-dA-jIc"/>
-                                                <constraint firstItem="WcM-Zs-R1b" firstAttribute="centerY" secondItem="RmR-C0-8l7" secondAttribute="centerY" id="bID-pK-ESY"/>
-                                                <constraint firstItem="i6B-6f-HEm" firstAttribute="leading" secondItem="qLv-pt-Ikt" secondAttribute="trailing" constant="4" id="bwD-1F-4H8"/>
-                                                <constraint firstItem="Bme-fS-3EY" firstAttribute="leading" secondItem="f1m-ug-ENL" secondAttribute="leading" constant="4" id="ct9-gs-0l7"/>
-                                                <constraint firstItem="RSv-kH-wsv" firstAttribute="leading" secondItem="q7O-KT-2ls" secondAttribute="trailing" constant="4" id="cwm-xc-pJt"/>
-                                                <constraint firstItem="UgL-bs-1XS" firstAttribute="leading" secondItem="f1m-ug-ENL" secondAttribute="leading" constant="4" id="dM8-Be-qIP"/>
-                                                <constraint firstItem="q7O-KT-2ls" firstAttribute="leading" secondItem="f1m-ug-ENL" secondAttribute="leading" constant="151" id="hQ1-L4-iqT"/>
-                                                <constraint firstItem="WcM-Zs-R1b" firstAttribute="top" secondItem="q7O-KT-2ls" secondAttribute="bottom" constant="8" id="hY2-Ui-Dwh"/>
-                                                <constraint firstItem="WcM-Zs-R1b" firstAttribute="leading" secondItem="f1m-ug-ENL" secondAttribute="leading" constant="151" id="jnA-uI-idl"/>
-                                                <constraint firstItem="i6B-6f-HEm" firstAttribute="centerY" secondItem="qLv-pt-Ikt" secondAttribute="centerY" id="kUb-4o-WFK"/>
-                                                <constraint firstItem="ker-im-aJw" firstAttribute="top" secondItem="WcM-Zs-R1b" secondAttribute="bottom" constant="8" id="p4b-re-6DP"/>
-                                                <constraint firstItem="Bme-fS-3EY" firstAttribute="top" secondItem="f1m-ug-ENL" secondAttribute="top" constant="24" id="qyv-Xb-hEJ"/>
-                                                <constraint firstItem="Z0D-Np-RgN" firstAttribute="leading" secondItem="UgL-bs-1XS" secondAttribute="trailing" constant="4" id="xsG-8t-YPu"/>
                                             </constraints>
                                         </customView>
                                         <box boxType="custom" borderType="none" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="FYA-2d-xuI">
@@ -205,6 +106,9 @@
                                                             <font key="font" metaFont="system" size="15"/>
                                                         </buttonCell>
                                                         <color key="contentTintColor" name="Color"/>
+                                                        <connections>
+                                                            <action selector="buyBtnClicked:" target="-2" id="zsV-Mv-Qqr"/>
+                                                        </connections>
                                                     </button>
                                                 </subviews>
                                             </view>
@@ -265,7 +169,8 @@
         </window>
     </objects>
     <resources>
-        <image name="vipSecondDark" width="20" height="20"/>
+        <image name="cnLight" width="300" height="380"/>
+        <image name="detailCnDark" width="266" height="100"/>
         <namedColor name="Color">
             <color red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
         </namedColor>

+ 21 - 3
PDF Office/PDF Master/Class/Home/ViewController/KMHomeViewController.swift

@@ -103,6 +103,7 @@ import Cocoa
     var didTrialExpiredLoad: Bool = false
     var repeatTrialAlertLoad: Bool = false
     
+    var showCoupon: Bool = true
     var couponDueWindowVC: KMCouponDueWindowController!
     
     @IBOutlet weak var rightBottonHeight: NSLayoutConstraint!
@@ -182,7 +183,6 @@ import Cocoa
         NotificationCenter.default.addObserver(self, selector: #selector(importFromScanner), name: Notification.Name("kDeviceScannerMenuItemNotification"), object: nil)
         self.loadFunctionGuide()
         
-        self.checkTrialEndCouponInfo()
     }
     
     override func viewDidAppear() {
@@ -233,6 +233,20 @@ import Cocoa
                         }
                         KMAdsInfoManager.shareInstance.adsInfoArrM = arrM
                     }
+                    
+                    if let couponInfo = KMAdvertisementManager.manager.infoDict["couponContent"] {
+                        let infoDict: NSDictionary = KMAdvertisementManager.manager.infoDict["couponContent"] as! NSDictionary
+                        let array: [[String: Any]] = infoDict["content"] as! [[String : Any]]
+                        if array.isEmpty == false {
+                            let dict = array[0]
+                            let adsInfo = KMCouponInfo.init()
+                            let mutableDictionary = NSMutableDictionary(dictionary: dict)
+                            adsInfo.infoDict = mutableDictionary
+                            KMAdsInfoManager.shareInstance.couponInfo = adsInfo
+                            
+                            self.checkTrialEndCouponInfo()
+                        }
+                    }
                 }
             }
         }
@@ -971,13 +985,17 @@ extension KMHomeViewController {
     //MARK: 试用到期优惠券弹窗
     func checkTrialEndCouponInfo() {
         
-//        self.showCouponInfoWindow()
+//        if self.showCoupon {
+//            self.showCouponInfoWindow()
+//            self.showCoupon = false
+//        }
     }
     
     func showCouponInfoWindow() {
         self.couponDueWindowVC = KMCouponDueWindowController(windowNibName: "KMCouponDueWindowController")
-        
         self.couponDueWindowVC.showWindow(nil)
+        self.couponDueWindowVC.reloadData()
+        
     }
     
     // MARK: - Noti Actions

+ 112 - 0
PDF Office/PDF Master/Class/Purchase/DMG/Verification/VerificationManager/KMAdsInfo.swift

@@ -13,6 +13,8 @@ import Cocoa
     
     public var adsInfoArrM: NSMutableArray = NSMutableArray()
     
+    var couponInfo: KMCouponInfo?
+    
     override init() {
         super.init()
         
@@ -131,3 +133,113 @@ import Cocoa
     
     
 }
+
+
+@objcMembers class KMCouponInfo: NSObject {
+
+    var infoDict: NSMutableDictionary!
+     
+    
+    var adsImage: NSImage {
+        get {
+            
+            let imageDict: [String: Any] = self.infoDict["image"] as! [String : Any]
+            let imageURLString = imageDict[self.languageKey] as! NSString
+            
+            var imageName = self.versionKey
+            imageName.append(String(format: "_%@.%@", self.languageKey, imageURLString.lastPathComponent))
+ 
+            let kImageCacheFilePath: String = NSTemporaryDirectory() + "Advertisement/ImageCache"
+            let imgSavePath = kImageCacheFilePath + "/" + imageName
+            if FileManager.default.fileExists(atPath: imgSavePath) {
+                return NSImage(contentsOfFile: imgSavePath)!
+            }
+             
+            DispatchQueue.global().async {
+                if let url = URL(string: imageURLString as String),
+                   let imageData = try? Data(contentsOf: url) {
+                    if imageData.isEmpty == false {
+                        DispatchQueue.main.async {
+                            try?imageData.write(to: URL(fileURLWithPath: imgSavePath))
+                            NotificationCenter.default.post(name: Notification.Name(rawValue: "KMRecommondInfoUpdateNoti"), object: ["unique":self.versionKey])
+                        }
+                    }
+                }
+            }
+             
+            return NSImage(named: "ComPDFKit_EN")!
+        }
+    }
+    
+    var adsDetailImage: NSImage {
+        get {
+            
+            let imageDict: [String: Any] = self.infoDict["detailImage"] as! [String : Any]
+            let imageURLString = imageDict[self.languageKey] as! NSString
+            
+            var imageName = self.versionKey
+            imageName.append(String(format: "_%@.%@", self.languageKey, imageURLString.lastPathComponent))
+ 
+            let kImageCacheFilePath: String = NSTemporaryDirectory() + "Advertisement/ImageCache"
+            let imgSavePath = kImageCacheFilePath + "/" + imageName
+            if FileManager.default.fileExists(atPath: imgSavePath) {
+                return NSImage(contentsOfFile: imgSavePath)!
+            }
+             
+            DispatchQueue.global().async {
+                if let url = URL(string: imageURLString as String),
+                   let imageData = try? Data(contentsOf: url) {
+                    if imageData.isEmpty == false {
+                        DispatchQueue.main.async {
+                            try?imageData.write(to: URL(fileURLWithPath: imgSavePath))
+                            NotificationCenter.default.post(name: Notification.Name(rawValue: "KMRecommondInfoUpdateNoti"), object: ["unique":self.versionKey])
+                        }
+                    }
+                }
+            }
+             
+            return NSImage(named: "ComPDFKit_EN")!
+        }
+    }
+    
+    var adsURLLink: String {
+        get {
+            let linkDict: [String: Any] = self.infoDict["linkURL"] as! [String : Any]
+            return linkDict[self.languageKey] as! String
+        }
+    }
+    
+    var languageKey: String {
+        let language = Bundle.main.preferredLocalizations[0]
+        if language == "zh_CN" {
+            return "zh_CN"
+        } else if language == "zh_TW" {
+            return "zh_TW"
+        }
+        return "en"
+    }
+    
+    var versionKey: String {
+        return self.infoDict["version"] as! String
+    }
+    
+    var title: String {
+        let titleDict: [String: Any] = self.infoDict["title"] as! [String : Any]
+        return titleDict[self.languageKey] as! String
+    }
+    
+    var subTitle: String {
+        let titleDict: [String: Any] = self.infoDict["subTitle"] as! [String : Any]
+        return titleDict[self.languageKey] as! String
+    }
+    
+    var buyBtnTitle: String {
+        let titleDict: [String: Any] = self.infoDict["buyBtnTitle"] as! [String : Any]
+        return titleDict[self.languageKey] as! String
+    }
+    
+    var laterInfoString: String {
+        let titleDict: [String: Any] = self.infoDict["laterInfoString"] as! [String : Any]
+        return titleDict[self.languageKey] as! String
+    }
+}