Prechádzať zdrojové kódy

Merge branch 'develop_PDFReaderProNew' of git.kdan.cc:Mac_PDF/PDF_Office into develop_PDFReaderProNew

tangchao 1 rok pred
rodič
commit
10bf9f481c

+ 1 - 1
PDF Office/PDF Master/AppDelegate.swift

@@ -45,7 +45,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
 
 
         //        MARK: 广告数据初始化
         //        MARK: 广告数据初始化
         KMAdvertisementManager.manager.initConfig(appName: .PDFReaderProMac,
         KMAdvertisementManager.manager.initConfig(appName: .PDFReaderProMac,
-                                                  subscribeType: .unsubscribed,
+                                                  subscribeType: .unknow,
                                                   platform: .Mac)
                                                   platform: .Mac)
         //        测试模式,默认false
         //        测试模式,默认false
         KMAdvertisementManager.manager.debug = true
         KMAdvertisementManager.manager.debug = true

+ 29 - 2
PDF Office/PDF Master/Class/Home/View/HomeContentView/KMHomeContentView.swift

@@ -27,8 +27,8 @@ class KMHomeContentView: KMBaseXibView {
     
     
     @IBOutlet weak var recentlyLabel: NSTextField!
     @IBOutlet weak var recentlyLabel: NSTextField!
     @IBOutlet weak var historyListView: KMHomeHistoryListView!
     @IBOutlet weak var historyListView: KMHomeHistoryListView!
-    @IBOutlet weak var horizontalButton: NSButton!
-    @IBOutlet weak var verticalButton: NSButton!
+    @IBOutlet weak var horizontalButton: KMButton!
+    @IBOutlet weak var verticalButton: KMButton!
     @IBOutlet weak var cleanButton: KMButton!
     @IBOutlet weak var cleanButton: KMButton!
     
     
     var historyDidSelect: KMHomeContentViewHistoryDidSelect?
     var historyDidSelect: KMHomeContentViewHistoryDidSelect?
@@ -85,15 +85,40 @@ class KMHomeContentView: KMBaseXibView {
             callBack(self, item)
             callBack(self, item)
         }
         }
         
         
+        cleanButton.mouseMoveCallback = { [unowned self] enter in
+            if enter {
+                self.cleanButton.image = NSImage(named: "KMImageNameHomeDeletHor")
+            } else {
+                self.cleanButton.image = NSImage(named: "KMImageNameHomeDeletNor")
+            }
+        }
         
         
+        moreButton.mouseMoveCallback = { [unowned self] enter in
+            if enter {
+                self.moreButton.image = NSImage(named: "KMImageNameUXIconHomeMorePre")
+            } else {
+                self.moreButton.image = NSImage(named: "KMImageNameUXIconHomeMoreNor")
+            }
+        }
         
         
         self.updatePageLabel()
         self.updatePageLabel()
+        self.updateRecentlyListState()
     }
     }
     
     
     func updatePageLabel() {
     func updatePageLabel() {
         self.pageLabel.stringValue = "\(qucikToolsView.currentPage()) / \(qucikToolsView.pageCount())"
         self.pageLabel.stringValue = "\(qucikToolsView.currentPage()) / \(qucikToolsView.pageCount())"
     }
     }
     
     
+    func updateRecentlyListState() {
+        let showType = self.historyListView.showType
+        if showType == .horizontal {
+            verticalButton.image = NSImage(named: "KMImageNameUXIconHomeViewthumbnailNor")
+            horizontalButton.image = NSImage(named: "KMImageNameUXIconHomeViewlistPre")
+        } else if showType == .vertical {
+            verticalButton.image = NSImage(named: "KMImageNameUXIconHomeViewthumbnailPre")
+            horizontalButton.image = NSImage(named: "KMImageNameUXIconHomeViewlistNor")
+        }
+    }
 }
 }
 
 
 //MARK: Action
 //MARK: Action
@@ -118,10 +143,12 @@ extension KMHomeContentView {
     
     
     @IBAction func horizontalButtonAction(_ sender: Any) {
     @IBAction func horizontalButtonAction(_ sender: Any) {
         self.historyListView.showType = .horizontal
         self.historyListView.showType = .horizontal
+        self.updateRecentlyListState()
     }
     }
     
     
     @IBAction func verticalButtonAction(_ sender: Any) {
     @IBAction func verticalButtonAction(_ sender: Any) {
         self.historyListView.showType = .vertical
         self.historyListView.showType = .vertical
+        self.updateRecentlyListState()
     }
     }
     
     
     @IBAction func cleanButtonAction(_ sender: Any) {
     @IBAction func cleanButtonAction(_ sender: Any) {

+ 6 - 6
PDF Office/PDF Master/Class/Home/View/HomeContentView/KMHomeContentView.xib

@@ -10,7 +10,7 @@
             <connections>
             <connections>
                 <outlet property="cleanButton" destination="2pe-eQ-jim" id="NzZ-si-Lah"/>
                 <outlet property="cleanButton" destination="2pe-eQ-jim" id="NzZ-si-Lah"/>
                 <outlet property="historyListView" destination="wMw-AS-5yG" id="HHc-lb-Uau"/>
                 <outlet property="historyListView" destination="wMw-AS-5yG" id="HHc-lb-Uau"/>
-                <outlet property="horizontalButton" destination="f8L-dW-OV5" id="2bQ-AH-t3U"/>
+                <outlet property="horizontalButton" destination="f8L-dW-OV5" id="cCu-bD-LVA"/>
                 <outlet property="leftButton" destination="WXY-wn-hPk" id="hp6-fa-w4J"/>
                 <outlet property="leftButton" destination="WXY-wn-hPk" id="hp6-fa-w4J"/>
                 <outlet property="moreButton" destination="YVh-aT-yWA" id="M54-rm-tnw"/>
                 <outlet property="moreButton" destination="YVh-aT-yWA" id="M54-rm-tnw"/>
                 <outlet property="pageLabel" destination="AZq-VF-EUc" id="CCP-bH-lFT"/>
                 <outlet property="pageLabel" destination="AZq-VF-EUc" id="CCP-bH-lFT"/>
@@ -18,7 +18,7 @@
                 <outlet property="qucikToolsView" destination="ynU-RA-kWD" id="t4n-b1-mpf"/>
                 <outlet property="qucikToolsView" destination="ynU-RA-kWD" id="t4n-b1-mpf"/>
                 <outlet property="recentlyLabel" destination="Jq6-Hl-amd" id="cL6-5Q-9jC"/>
                 <outlet property="recentlyLabel" destination="Jq6-Hl-amd" id="cL6-5Q-9jC"/>
                 <outlet property="rightButton" destination="34n-6o-x3z" id="qKh-a6-NQL"/>
                 <outlet property="rightButton" destination="34n-6o-x3z" id="qKh-a6-NQL"/>
-                <outlet property="verticalButton" destination="oce-zR-GCX" id="DXr-S4-r67"/>
+                <outlet property="verticalButton" destination="oce-zR-GCX" id="DQn-7c-OlF"/>
             </connections>
             </connections>
         </customObject>
         </customObject>
         <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
         <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
@@ -51,7 +51,7 @@
                                                             <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                                                             <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                                                         </textFieldCell>
                                                         </textFieldCell>
                                                     </textField>
                                                     </textField>
-                                                    <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="YVh-aT-yWA" customClass="KMButton">
+                                                    <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="YVh-aT-yWA" customClass="KMButton" customModule="PDF_Master" customModuleProvider="target">
                                                         <rect key="frame" x="589" y="2" width="20" height="20"/>
                                                         <rect key="frame" x="589" y="2" width="20" height="20"/>
                                                         <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="KMImageNameUXIconHomeMoreNor" imagePosition="only" alignment="center" imageScaling="proportionallyUpOrDown" inset="2" id="H4M-FQ-wtf">
                                                         <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="KMImageNameUXIconHomeMoreNor" imagePosition="only" alignment="center" imageScaling="proportionallyUpOrDown" inset="2" id="H4M-FQ-wtf">
                                                             <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                                             <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
@@ -144,7 +144,7 @@
                                                             <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                                                             <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                                                         </textFieldCell>
                                                         </textFieldCell>
                                                     </textField>
                                                     </textField>
-                                                    <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="2pe-eQ-jim" customClass="KMButton">
+                                                    <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="2pe-eQ-jim" customClass="KMButton" customModule="PDF_Master" customModuleProvider="target">
                                                         <rect key="frame" x="589" y="2" width="20" height="20"/>
                                                         <rect key="frame" x="589" y="2" width="20" height="20"/>
                                                         <buttonCell key="cell" type="square" title="Button" bezelStyle="shadowlessSquare" image="KMImageNameHomeDeletNor" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="unN-7z-cUu">
                                                         <buttonCell key="cell" type="square" title="Button" bezelStyle="shadowlessSquare" image="KMImageNameHomeDeletNor" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="unN-7z-cUu">
                                                             <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                                             <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
@@ -165,7 +165,7 @@
                                                             <constraint firstAttribute="height" constant="20" id="kQu-ie-pMw"/>
                                                             <constraint firstAttribute="height" constant="20" id="kQu-ie-pMw"/>
                                                         </constraints>
                                                         </constraints>
                                                     </box>
                                                     </box>
-                                                    <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="oce-zR-GCX">
+                                                    <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="oce-zR-GCX" customClass="KMButton" customModule="PDF_Master" customModuleProvider="target">
                                                         <rect key="frame" x="529" y="2" width="20" height="20"/>
                                                         <rect key="frame" x="529" y="2" width="20" height="20"/>
                                                         <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="KMImageNameUXIconHomeViewthumbnailNor" imagePosition="overlaps" alignment="center" imageScaling="proportionallyDown" inset="2" id="0s5-A7-lRz">
                                                         <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="KMImageNameUXIconHomeViewthumbnailNor" imagePosition="overlaps" alignment="center" imageScaling="proportionallyDown" inset="2" id="0s5-A7-lRz">
                                                             <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                                             <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
@@ -179,7 +179,7 @@
                                                             <action selector="verticalButtonAction:" target="-2" id="Tsa-n6-92q"/>
                                                             <action selector="verticalButtonAction:" target="-2" id="Tsa-n6-92q"/>
                                                         </connections>
                                                         </connections>
                                                     </button>
                                                     </button>
-                                                    <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="f8L-dW-OV5">
+                                                    <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="f8L-dW-OV5" customClass="KMButton" customModule="PDF_Master" customModuleProvider="target">
                                                         <rect key="frame" x="493" y="2" width="20" height="20"/>
                                                         <rect key="frame" x="493" y="2" width="20" height="20"/>
                                                         <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="KMImageNameUXIconHomeViewlistNor" imagePosition="overlaps" alignment="center" imageScaling="proportionallyDown" inset="2" id="fSg-GB-X16">
                                                         <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="KMImageNameUXIconHomeViewlistNor" imagePosition="overlaps" alignment="center" imageScaling="proportionallyDown" inset="2" id="fSg-GB-X16">
                                                             <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                                             <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>

+ 9 - 9
PDF Office/PDF Master/Class/Home/View/HomeContentView/QucikTools/KMQucikToolsView.swift

@@ -60,15 +60,15 @@ class KMQucikToolsView: KMBaseXibView {
 //Notification
 //Notification
 extension KMQucikToolsView  {
 extension KMQucikToolsView  {
     @objc func scrollViewDidScroll(notification: Notification) {
     @objc func scrollViewDidScroll(notification: Notification) {
-        // 处理滚动事件
-        if let scrollView = notification.object as? NSScrollView {
-            print("NSScrollView did scroll.")
-            // 获取滚动位置等信息
-            let contentOffset = scrollView.contentView.bounds.origin
-            print("Content Offset: \(contentOffset)")
-            
-        }
-        
+//        // 处理滚动事件
+//        if let scrollView = notification.object as? NSScrollView {
+//            print("NSScrollView did scroll.")
+//            // 获取滚动位置等信息
+//            let contentOffset = scrollView.contentView.bounds.origin
+//            print("Content Offset: \(contentOffset)")
+//            
+//        }
+//        
         guard let callBack = pageChange else { return }
         guard let callBack = pageChange else { return }
         callBack(self)
         callBack(self)
     }
     }

+ 2 - 2
PDF Office/PDF Master/Class/Home/ViewController/KMHomePopViewController.xib

@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22146" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22155" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
     <dependencies>
     <dependencies>
         <deployment identifier="macosx"/>
         <deployment identifier="macosx"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22146"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22155"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     </dependencies>
     <objects>
     <objects>

+ 1 - 0
PDF Office/PDF Master/Class/Home/ViewController/KMHomeViewController+Action.swift

@@ -82,6 +82,7 @@ extension KMHomeViewController {
     }
     }
     
     
     func fastToolItemAction(_ type: DataNavigationViewButtonActionType) {
     func fastToolItemAction(_ type: DataNavigationViewButtonActionType) {
+        print("fastToolItemAction + \(type.rawValue)")
         switch type {
         switch type {
         case .Batch:
         case .Batch:
             fastTool_Batch()
             fastTool_Batch()

+ 7 - 7
PDF Office/PDF Master/Class/Home/ViewController/KMHomeViewController.xib

@@ -238,10 +238,10 @@ Gw
                                         </constraints>
                                         </constraints>
                                     </customView>
                                     </customView>
                                     <customView translatesAutoresizingMaskIntoConstraints="NO" id="eZs-02-dfp">
                                     <customView translatesAutoresizingMaskIntoConstraints="NO" id="eZs-02-dfp">
-                                        <rect key="frame" x="16" y="0.0" width="238" height="652"/>
+                                        <rect key="frame" x="16" y="0.0" width="238" height="644"/>
                                         <subviews>
                                         <subviews>
                                             <customView translatesAutoresizingMaskIntoConstraints="NO" id="fnz-k9-XjO" customClass="KMAdvertisementTableView" customModule="PDF_Master" customModuleProvider="target">
                                             <customView translatesAutoresizingMaskIntoConstraints="NO" id="fnz-k9-XjO" customClass="KMAdvertisementTableView" customModule="PDF_Master" customModuleProvider="target">
-                                                <rect key="frame" x="0.0" y="152" width="238" height="500"/>
+                                                <rect key="frame" x="0.0" y="144" width="238" height="500"/>
                                                 <constraints>
                                                 <constraints>
                                                     <constraint firstAttribute="height" constant="500" id="Tot-Bo-gOe"/>
                                                     <constraint firstAttribute="height" constant="500" id="Tot-Bo-gOe"/>
                                                 </constraints>
                                                 </constraints>
@@ -258,27 +258,27 @@ Gw
                                             <constraint firstAttribute="trailing" secondItem="fnz-k9-XjO" secondAttribute="trailing" id="Ea6-4t-JOh"/>
                                             <constraint firstAttribute="trailing" secondItem="fnz-k9-XjO" secondAttribute="trailing" id="Ea6-4t-JOh"/>
                                             <constraint firstItem="SYM-SV-gBY" firstAttribute="leading" secondItem="eZs-02-dfp" secondAttribute="leading" id="I02-eo-zxb"/>
                                             <constraint firstItem="SYM-SV-gBY" firstAttribute="leading" secondItem="eZs-02-dfp" secondAttribute="leading" id="I02-eo-zxb"/>
                                             <constraint firstItem="fnz-k9-XjO" firstAttribute="top" secondItem="eZs-02-dfp" secondAttribute="top" id="SNd-w5-4mI"/>
                                             <constraint firstItem="fnz-k9-XjO" firstAttribute="top" secondItem="eZs-02-dfp" secondAttribute="top" id="SNd-w5-4mI"/>
-                                            <constraint firstItem="SYM-SV-gBY" firstAttribute="top" secondItem="fnz-k9-XjO" secondAttribute="bottom" constant="16" id="k1P-NP-gcR"/>
                                             <constraint firstAttribute="trailing" secondItem="SYM-SV-gBY" secondAttribute="trailing" id="qLr-RD-68z"/>
                                             <constraint firstAttribute="trailing" secondItem="SYM-SV-gBY" secondAttribute="trailing" id="qLr-RD-68z"/>
+                                            <constraint firstAttribute="bottom" secondItem="SYM-SV-gBY" secondAttribute="bottom" constant="16" id="vXu-8W-zAc"/>
                                         </constraints>
                                         </constraints>
                                     </customView>
                                     </customView>
                                     <customView translatesAutoresizingMaskIntoConstraints="NO" id="xMk-8H-B64" customClass="KMCreatPDFView" customModule="PDF_Master" customModuleProvider="target">
                                     <customView translatesAutoresizingMaskIntoConstraints="NO" id="xMk-8H-B64" customClass="KMCreatPDFView" customModule="PDF_Master" customModuleProvider="target">
-                                        <rect key="frame" x="16" y="668" width="238" height="112"/>
+                                        <rect key="frame" x="24" y="668" width="222" height="112"/>
                                         <constraints>
                                         <constraints>
                                             <constraint firstAttribute="height" constant="112" id="b2w-2J-Q98"/>
                                             <constraint firstAttribute="height" constant="112" id="b2w-2J-Q98"/>
                                         </constraints>
                                         </constraints>
                                     </customView>
                                     </customView>
                                 </subviews>
                                 </subviews>
                                 <constraints>
                                 <constraints>
-                                    <constraint firstAttribute="trailing" secondItem="xMk-8H-B64" secondAttribute="trailing" constant="16" id="0Y5-Y0-JAP"/>
+                                    <constraint firstAttribute="trailing" secondItem="xMk-8H-B64" secondAttribute="trailing" constant="24" id="0Y5-Y0-JAP"/>
                                     <constraint firstAttribute="bottom" secondItem="3io-Hj-Kiz" secondAttribute="bottom" id="8hH-Nz-14P"/>
                                     <constraint firstAttribute="bottom" secondItem="3io-Hj-Kiz" secondAttribute="bottom" id="8hH-Nz-14P"/>
                                     <constraint firstItem="xMk-8H-B64" firstAttribute="top" secondItem="2gJ-MM-ZrB" secondAttribute="top" constant="40" id="BmM-pK-ELG"/>
                                     <constraint firstItem="xMk-8H-B64" firstAttribute="top" secondItem="2gJ-MM-ZrB" secondAttribute="top" constant="40" id="BmM-pK-ELG"/>
-                                    <constraint firstItem="eZs-02-dfp" firstAttribute="top" secondItem="xMk-8H-B64" secondAttribute="bottom" constant="16" id="BoC-48-m5e"/>
+                                    <constraint firstItem="eZs-02-dfp" firstAttribute="top" secondItem="xMk-8H-B64" secondAttribute="bottom" constant="24" id="BoC-48-m5e"/>
                                     <constraint firstItem="3io-Hj-Kiz" firstAttribute="top" secondItem="2gJ-MM-ZrB" secondAttribute="top" id="OUk-vQ-edJ"/>
                                     <constraint firstItem="3io-Hj-Kiz" firstAttribute="top" secondItem="2gJ-MM-ZrB" secondAttribute="top" id="OUk-vQ-edJ"/>
                                     <constraint firstItem="3io-Hj-Kiz" firstAttribute="leading" secondItem="2gJ-MM-ZrB" secondAttribute="leading" id="eTW-ob-qK1"/>
                                     <constraint firstItem="3io-Hj-Kiz" firstAttribute="leading" secondItem="2gJ-MM-ZrB" secondAttribute="leading" id="eTW-ob-qK1"/>
                                     <constraint firstAttribute="bottom" secondItem="eZs-02-dfp" secondAttribute="bottom" id="hKB-Xy-3r7"/>
                                     <constraint firstAttribute="bottom" secondItem="eZs-02-dfp" secondAttribute="bottom" id="hKB-Xy-3r7"/>
                                     <constraint firstAttribute="trailing" secondItem="3io-Hj-Kiz" secondAttribute="trailing" id="kZa-Sb-BLN"/>
                                     <constraint firstAttribute="trailing" secondItem="3io-Hj-Kiz" secondAttribute="trailing" id="kZa-Sb-BLN"/>
-                                    <constraint firstItem="xMk-8H-B64" firstAttribute="leading" secondItem="2gJ-MM-ZrB" secondAttribute="leading" constant="16" id="llZ-cI-Lb3"/>
+                                    <constraint firstItem="xMk-8H-B64" firstAttribute="leading" secondItem="2gJ-MM-ZrB" secondAttribute="leading" constant="24" id="llZ-cI-Lb3"/>
                                     <constraint firstAttribute="trailing" secondItem="eZs-02-dfp" secondAttribute="trailing" constant="16" id="pwm-0C-e6W"/>
                                     <constraint firstAttribute="trailing" secondItem="eZs-02-dfp" secondAttribute="trailing" constant="16" id="pwm-0C-e6W"/>
                                     <constraint firstItem="eZs-02-dfp" firstAttribute="leading" secondItem="2gJ-MM-ZrB" secondAttribute="leading" constant="16" id="s35-fX-Hao"/>
                                     <constraint firstItem="eZs-02-dfp" firstAttribute="leading" secondItem="2gJ-MM-ZrB" secondAttribute="leading" constant="16" id="s35-fX-Hao"/>
                                 </constraints>
                                 </constraints>

+ 8 - 8
PDF Office/PDF Master/Class/Home/ViewController/KMProductPromotionViewController.xib

@@ -1,12 +1,12 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21507" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22155" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
     <dependencies>
     <dependencies>
         <deployment identifier="macosx"/>
         <deployment identifier="macosx"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21507"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22155"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     </dependencies>
     <objects>
     <objects>
-        <customObject id="-2" userLabel="File's Owner" customClass="KMProductPromotionViewController" customModule="PDF_Office" customModuleProvider="target">
+        <customObject id="-2" userLabel="File's Owner" customClass="KMProductPromotionViewController" customModule="PDF_Master" customModuleProvider="target">
             <connections>
             <connections>
                 <outlet property="activitiesBox" destination="CxY-O0-Cyh" id="Tbm-K1-BO2"/>
                 <outlet property="activitiesBox" destination="CxY-O0-Cyh" id="Tbm-K1-BO2"/>
                 <outlet property="activitiesCloseButton" destination="Qju-Te-5th" id="eV6-mm-onD"/>
                 <outlet property="activitiesCloseButton" destination="Qju-Te-5th" id="eV6-mm-onD"/>
@@ -20,7 +20,7 @@
             <rect key="frame" x="0.0" y="0.0" width="612" height="188"/>
             <rect key="frame" x="0.0" y="0.0" width="612" height="188"/>
             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
             <subviews>
             <subviews>
-                <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="CxY-O0-Cyh" customClass="KMBox" customModule="PDF_Office" customModuleProvider="target">
+                <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="CxY-O0-Cyh" customClass="KMBox" customModule="PDF_Master" customModuleProvider="target">
                     <rect key="frame" x="0.0" y="0.0" width="612" height="188"/>
                     <rect key="frame" x="0.0" y="0.0" width="612" height="188"/>
                     <view key="contentView" id="Cbo-eS-eTf">
                     <view key="contentView" id="Cbo-eS-eTf">
                         <rect key="frame" x="0.0" y="0.0" width="612" height="188"/>
                         <rect key="frame" x="0.0" y="0.0" width="612" height="188"/>
@@ -32,14 +32,14 @@
                             </imageView>
                             </imageView>
                             <button translatesAutoresizingMaskIntoConstraints="NO" id="Qju-Te-5th">
                             <button translatesAutoresizingMaskIntoConstraints="NO" id="Qju-Te-5th">
                                 <rect key="frame" x="577" y="151.5" width="30.5" height="34"/>
                                 <rect key="frame" x="577" y="151.5" width="30.5" height="34"/>
-                                <constraints>
-                                    <constraint firstAttribute="width" constant="30" id="3nJ-qp-c0X"/>
-                                    <constraint firstAttribute="height" constant="30" id="dQs-eI-ACu"/>
-                                </constraints>
                                 <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="NSStopProgressTemplate" imagePosition="only" alignment="center" imageScaling="proportionallyUpOrDown" inset="2" id="svV-sJ-Rzg">
                                 <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="NSStopProgressTemplate" imagePosition="only" alignment="center" imageScaling="proportionallyUpOrDown" inset="2" id="svV-sJ-Rzg">
                                     <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                     <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                     <font key="font" metaFont="system"/>
                                     <font key="font" metaFont="system"/>
                                 </buttonCell>
                                 </buttonCell>
+                                <constraints>
+                                    <constraint firstAttribute="width" constant="30" id="3nJ-qp-c0X"/>
+                                    <constraint firstAttribute="height" constant="30" id="dQs-eI-ACu"/>
+                                </constraints>
                                 <connections>
                                 <connections>
                                     <action selector="activitiesCloseButtonAction:" target="-2" id="0SA-cU-MfX"/>
                                     <action selector="activitiesCloseButtonAction:" target="-2" id="0SA-cU-MfX"/>
                                 </connections>
                                 </connections>

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

@@ -76,12 +76,19 @@
     case iOS //
     case iOS //
 }
 }
 
 
-//订阅状态
+////订阅状态
+//@objc public enum KMAdvertisementSubscribeType: Int, Codable {
+//    case unknow = 0
+//    case unsubscribed = 1 //未订阅
+//    case subscribed = 2 //已订阅
+//    case all = 3 //无限制
+//}
+
 @objc public enum KMAdvertisementSubscribeType: Int, Codable {
 @objc public enum KMAdvertisementSubscribeType: Int, Codable {
     case unknow = 0
     case unknow = 0
-    case unsubscribed = 1 //未订阅
-    case subscribed = 2 //已订阅
-    case all = 3 //无限制
+    case all //免费版跟付费版都需要显示
+    case pro //只有付费用户显示
+    case lite //只有免费用户显示
 }
 }
 
 
 //点击视图后跳转选项
 //点击视图后跳转选项
@@ -99,18 +106,11 @@
     case zhTW //
     case zhTW //
 }
 }
 
 
-//显示样式
-@objc public enum KMRecommondShowType: Int, Codable {
-    case unknow = 0
-    case URL = 1 //链接
-    case comparative = 2 //比价表
-}
-
 @objcMembers open class KMAdvertisementConfig: NSObject {
 @objcMembers open class KMAdvertisementConfig: NSObject {
     var isDebug: Bool = false
     var isDebug: Bool = false
     var appName: KMAdvertisementAppNameType = .PDFReaderProMacPro
     var appName: KMAdvertisementAppNameType = .PDFReaderProMacPro
     var platform: KMAdvertisementPlatformType = .Mac
     var platform: KMAdvertisementPlatformType = .Mac
-    public var subscribeType: KMAdvertisementSubscribeType = .unsubscribed
+    public var subscribeType: KMAdvertisementSubscribeType = .unknow
     public var language: KMAdvertisementLanguageType = .unknow
     public var language: KMAdvertisementLanguageType = .unknow
     
     
     func activityBaseURL() -> String {
     func activityBaseURL() -> String {

+ 95 - 30
PDF Office/PDF Master/Class/KMAdvertisement/Manager/KMAdvertisementManager.swift

@@ -114,7 +114,7 @@ extension KMAdvertisementManager {
      @param data 传入参数 NSDictionary
      @param data 传入参数 NSDictionary
      @param isNeedLocalComparison 是否需要对比本地版本,如果不一样将会刷新
      @param isNeedLocalComparison 是否需要对比本地版本,如果不一样将会刷新
      @return KMAdvertisementModel
      @return KMAdvertisementModel
-      */
+     */
     public func parseData(data: [NSDictionary], isNeedLocalComparison: Bool ,completion:(_ result: [KMAdvertisementInfo]) -> Void) -> Void {
     public func parseData(data: [NSDictionary], isNeedLocalComparison: Bool ,completion:(_ result: [KMAdvertisementInfo]) -> Void) -> Void {
         //获取缓存数据
         //获取缓存数据
         var isNeedSave = false
         var isNeedSave = false
@@ -128,19 +128,19 @@ extension KMAdvertisementManager {
                     let jsonData: Data = jsonString.data(using: .utf8)!
                     let jsonData: Data = jsonString.data(using: .utf8)!
                     let dict = try?JSONSerialization.jsonObject(with: jsonData)
                     let dict = try?JSONSerialization.jsonObject(with: jsonData)
                     let decoder = JSONDecoder()
                     let decoder = JSONDecoder()
-    //                decoder.dataDecodingStrategy = .base64
-    //                decoder.keyDecodingStrategy = .convertFromSnakeCase //带下划线命名
-
+                    //                decoder.dataDecodingStrategy = .base64
+                    //                decoder.keyDecodingStrategy = .convertFromSnakeCase //带下划线命名
+                    
                     decoder.nonConformingFloatDecodingStrategy = .convertFromString(positiveInfinity: "+∞", negativeInfinity: "-∞", nan: "NaN")
                     decoder.nonConformingFloatDecodingStrategy = .convertFromString(positiveInfinity: "+∞", negativeInfinity: "-∞", nan: "NaN")
-    #if DEBUG
+#if DEBUG
                     //MARK: 测试使用
                     //MARK: 测试使用
                     var advertisementModel = try! decoder.decode(KMAdvertisementInfo.self, from: jsonData)
                     var advertisementModel = try! decoder.decode(KMAdvertisementInfo.self, from: jsonData)
                     if (self.allowLoadContentData(data: advertisementModel)) {
                     if (self.allowLoadContentData(data: advertisementModel)) {
                         resultArray.append(self.allowLoadItemData(advertisementModel))
                         resultArray.append(self.allowLoadItemData(advertisementModel))
                         isNeedSave = true
                         isNeedSave = true
                     }
                     }
-    #else
-    //            MARK: 此处try 使用 ? ,如果数据出问题 advertisementModel将无参数, 测试时使用!
+#else
+                    //            MARK: 此处try 使用 ? ,如果数据出问题 advertisementModel将无参数, 测试时使用!
                     var advertisementModel = try? decoder.decode(KMAdvertisementInfo.self, from: jsonData)
                     var advertisementModel = try? decoder.decode(KMAdvertisementInfo.self, from: jsonData)
                     if (advertisementModel != nil) {
                     if (advertisementModel != nil) {
                         if (self.allowLoadContentData(data: advertisementModel!)) {
                         if (self.allowLoadContentData(data: advertisementModel!)) {
@@ -148,7 +148,7 @@ extension KMAdvertisementManager {
                             isNeedSave = true
                             isNeedSave = true
                         }
                         }
                     }
                     }
-    #endif
+#endif
                 }
                 }
             }
             }
         }
         }
@@ -182,34 +182,99 @@ extension KMAdvertisementManager {
         return result
         return result
     }
     }
     
     
-//    func allowLoadContentData(data: KMAdvertisementModel) -> Bool {
-//        var result = false
-//        
-//        let time: NSInteger = NSInteger(KMAdvertisementTimeStampConversion.getCurrentTimeInterval())!
-//        let startTime: NSInteger = NSInteger(data.startTime!)!
-//        let endTime: NSInteger = NSInteger(data.endTime!)!
-//        let platform = configuration.platform
-//        let subscribeType = configuration.subscribeType
-//        let version = data.version ?? "1.0"
-//        let localVersion = self.getLocalVersion()
-//        let hidden = data.hidden ?? false
-//        
-//        if (time >= startTime &&
-//            time <= endTime &&
-//            platform == data.platform &&
-//            self.compareVersion(nowVersion:localVersion, newVersion: version) &&
-//            (subscribeType == data.subscribeType || data.subscribeType == .all) &&
-//            !hidden) {
-//            result = true
-//        }
-//        return result
-//    }
+    //    func allowLoadContentData(data: KMAdvertisementModel) -> Bool {
+    //        var result = false
+    //
+    //        let time: NSInteger = NSInteger(KMAdvertisementTimeStampConversion.getCurrentTimeInterval())!
+    //        let startTime: NSInteger = NSInteger(data.startTime!)!
+    //        let endTime: NSInteger = NSInteger(data.endTime!)!
+    //        let platform = configuration.platform
+    //        let subscribeType = configuration.subscribeType
+    //        let version = data.version ?? "1.0"
+    //        let localVersion = self.getLocalVersion()
+    //        let hidden = data.hidden ?? false
+    //
+    //        if (time >= startTime &&
+    //            time <= endTime &&
+    //            platform == data.platform &&
+    //            self.compareVersion(nowVersion:localVersion, newVersion: version) &&
+    //            (subscribeType == data.subscribeType || data.subscribeType == .all) &&
+    //            !hidden) {
+    //            result = true
+    //        }
+    //        return result
+    //    }
     
     
     //过滤item是否显示
     //过滤item是否显示
     func allowLoadItemData(_ data: KMAdvertisementInfo) -> KMAdvertisementInfo {
     func allowLoadItemData(_ data: KMAdvertisementInfo) -> KMAdvertisementInfo {
+        let advertisement = data.advertisement
+        advertisement?.content = self.canShow(data: (advertisement?.content)!)
+        data.advertisement = advertisement
+        
+        let recommondContent = data.recommondContent
+        let recommondContentOther = recommondContent?.recommondContentOther
+        let recommondContentPDFPro = recommondContent?.recommondContentPDFPro
+        
+        recommondContentOther?.content = self.canShow(data: (recommondContentOther?.content)!)
+        recommondContentPDFPro?.content = self.canShow(data: (recommondContentPDFPro?.content)!)
+        
+        recommondContent?.recommondContentOther = recommondContentOther
+        recommondContent?.recommondContentPDFPro = recommondContentPDFPro
+        data.recommondContent = recommondContent
+        
         return data;
         return data;
     }
     }
     
     
+    func canShow(data: [KMAdvertisementItemInfo]) -> [KMAdvertisementItemInfo] {
+        var dataArray: [KMAdvertisementItemInfo] = []
+        for item in data {
+            let currentTime = Int(NSDate.init().timeIntervalSince1970 * 1000)
+            if item.show == "1" &&
+                currentTime > Int(item.startTime ?? "0") ?? currentTime &&
+                currentTime < Int(item.endTime ?? "0") ?? currentTime {
+                
+                var canAdd = true
+                if item.subscriptionType == "1" {
+                    if KMPurchaseManager.manager.state == .subscription {
+                        canAdd = false
+                    }
+                } else if item.subscriptionType == "2" {
+                    if KMPurchaseManager.manager.state != .subscription {
+                        canAdd = false
+                    }
+                }
+            
+                if canAdd {
+                    dataArray.append(item)
+                }
+            }
+        }
+        
+        return dataArray
+    }
+    
+//    + (BOOL)checkAdvertisementValid:(KMRecommondInfo *)info {
+//    #if DEBUG
+//        [[NSUserDefaults standardUserDefaults] removeObjectForKey:info.versionKey];
+//    #endif
+//        if ([[NSUserDefaults standardUserDefaults] objectForKey:info.versionKey]) {
+//            return NO;
+//        }
+//        if (!info.show) {
+//            return NO;
+//        }
+//        if (info.showType == KMRecommondShowType_Lite) {
+//            if ([[IAPProductsManager defaultManager] isAvailableAllFunction]) {
+//                return NO;
+//            }
+//        } else if (info.showType == KMRecommondShowType_Pro) {
+//            if (![[IAPProductsManager defaultManager] isAvailableAllFunction]) {
+//                return NO;
+//            }
+//        }
+//        return YES;
+//    }
+    
 //    func allowLoadItemData(_ data: KMAdvertisementModel) -> KMAdvertisementModel {
 //    func allowLoadItemData(_ data: KMAdvertisementModel) -> KMAdvertisementModel {
 //        //获取缓存数据
 //        //获取缓存数据
 //        if (UserDefaults.standard.object(forKey: "KMAdvertisementShowScroll_iOS") == nil) {
 //        if (UserDefaults.standard.object(forKey: "KMAdvertisementShowScroll_iOS") == nil) {

+ 9 - 3
PDF Office/PDF Master/Class/KMAdvertisement/Model/KMAdvertisementModel.swift

@@ -10,6 +10,7 @@
 @objcMembers public class KMAdvertisementInfo: NSObject, Codable {
 @objcMembers public class KMAdvertisementInfo: NSObject, Codable {
     public var recommondContent: KMAdvertisementContent?
     public var recommondContent: KMAdvertisementContent?
     public var advertisement: KMAdvertisementItem?
     public var advertisement: KMAdvertisementItem?
+    public var remoteControl: KMAdvertisementRemoteControl?
 }
 }
 
 
 @objcMembers public class KMAdvertisementContent: NSObject, Codable {
 @objcMembers public class KMAdvertisementContent: NSObject, Codable {
@@ -23,12 +24,17 @@
     public var content: [KMAdvertisementItemInfo]?
     public var content: [KMAdvertisementItemInfo]?
 }
 }
 
 
+@objcMembers public class KMAdvertisementRemoteControl: NSObject, Codable {
+    var showMenuHelpInfo: String?
+}
+
 @objcMembers public class KMAdvertisementItemInfo: NSObject, Codable {
 @objcMembers public class KMAdvertisementItemInfo: NSObject, Codable {
     var index: Int?
     var index: Int?
     var show: String? //是否显示,内部有做了时间区间判断
     var show: String? //是否显示,内部有做了时间区间判断
-    var showType: KMRecommondShowType?
-    var startDate: String?
-    var endDate: String?
+    var subscriptionType: String? //类型
+    var showType: KMAdvertisementShowType?
+    var startTime: String?
+    var endTime: String?
     var versionKey: String? //版本号,唯一标识符
     var versionKey: String? //版本号,唯一标识符
     var showCloseBtn: String? //是否显示关闭按钮,(左下角广告需要)
     var showCloseBtn: String? //是否显示关闭按钮,(左下角广告需要)
     var image: Image? //APP互推,常规状态下的图片
     var image: Image? //APP互推,常规状态下的图片

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

@@ -31,7 +31,7 @@ class KMAdvertisementCollectionViewItem: NSCollectionViewItem {
         self.titleLabel.stringValue = KMAdvertisementModelTransition.transitionLanguage(langeuage: model?.name)
         self.titleLabel.stringValue = KMAdvertisementModelTransition.transitionLanguage(langeuage: model?.name)
 //        self.titleLabel.font = NSFont.init(name: model?.title?.font?.name ?? "AppleSystemUIFont", size: CGFloat(model?.title?.font?.size ?? 13))
 //        self.titleLabel.font = NSFont.init(name: model?.title?.font?.name ?? "AppleSystemUIFont", size: CGFloat(model?.title?.font?.size ?? 13))
         self.contentView.toolTip = KMAdvertisementModelTransition.transitionLanguage(langeuage: model?.tooltip)
         self.contentView.toolTip = KMAdvertisementModelTransition.transitionLanguage(langeuage: model?.tooltip)
-        self.contentView.layer?.cornerRadius = 8
+        self.contentView.layer?.cornerRadius = 4
         self.updateColor(false)
         self.updateColor(false)
     }
     }
     
     

+ 2 - 1
PDF Office/PDF Master/Class/KMAdvertisement/View/Tableview/KMAdvertisementTableView.swift

@@ -163,7 +163,8 @@ extension KMAdvertisementTableView: NSCollectionViewDataSource {
 extension KMAdvertisementTableView: NSCollectionViewDelegateFlowLayout {
 extension KMAdvertisementTableView: NSCollectionViewDelegateFlowLayout {
     
     
     public func collectionView(_ collectionView: NSCollectionView, layout collectionViewLayout: NSCollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> NSSize {
     public func collectionView(_ collectionView: NSCollectionView, layout collectionViewLayout: NSCollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> NSSize {
-        return NSSize(width: self.contentView.bounds.width, height: 32)
+//        return NSSize(width: self.contentView.bounds.width, height: 32)
+        return NSSize(width: 238, height: 32)
     }
     }
     
     
     public func collectionView(_ collectionView: NSCollectionView, layout collectionViewLayout: NSCollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> NSSize {
     public func collectionView(_ collectionView: NSCollectionView, layout collectionViewLayout: NSCollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> NSSize {

+ 2 - 2
PDF Office/PDF Master/Class/PDFTools/PageEdit/View/KMPageEditThumbnailItem.xib

@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22146" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22155" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
     <dependencies>
     <dependencies>
         <deployment identifier="macosx"/>
         <deployment identifier="macosx"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22146"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22155"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     </dependencies>
     <objects>
     <objects>