Browse Source

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

tangchao 1 năm trước cách đây
mục cha
commit
4a86e963e6

+ 2 - 2
PDF Office/PDF Master.xcodeproj/project.pbxproj

@@ -1071,7 +1071,6 @@
 		AD015FB929AB484400A57062 /* KMLightMemberConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD015FB629AB484400A57062 /* KMLightMemberConfig.swift */; };
 		AD0E8AB02A31B76300DBFD3C /* KMInAppPurchaseManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD0E8AAF2A31B76300DBFD3C /* KMInAppPurchaseManager.swift */; };
 		AD0E8AB12A31B76300DBFD3C /* KMInAppPurchaseManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD0E8AAF2A31B76300DBFD3C /* KMInAppPurchaseManager.swift */; };
-		AD0E8AB22A31B76300DBFD3C /* KMInAppPurchaseManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD0E8AAF2A31B76300DBFD3C /* KMInAppPurchaseManager.swift */; };
 		AD0E8AB42A31B78900DBFD3C /* KMDMGPurchaseManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD0E8AB32A31B78900DBFD3C /* KMDMGPurchaseManager.swift */; };
 		AD0E8AB52A31B78900DBFD3C /* KMDMGPurchaseManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD0E8AB32A31B78900DBFD3C /* KMDMGPurchaseManager.swift */; };
 		AD0E8AB62A31B78900DBFD3C /* KMDMGPurchaseManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD0E8AB32A31B78900DBFD3C /* KMDMGPurchaseManager.swift */; };
@@ -1438,6 +1437,7 @@
 		ADB2D6FD294882B70029D2B3 /* KMTextFieldStepperView.xib in Resources */ = {isa = PBXBuildFile; fileRef = ADB2D6FC294882B70029D2B3 /* KMTextFieldStepperView.xib */; };
 		ADB2D6FE294882B70029D2B3 /* KMTextFieldStepperView.xib in Resources */ = {isa = PBXBuildFile; fileRef = ADB2D6FC294882B70029D2B3 /* KMTextFieldStepperView.xib */; };
 		ADB2D6FF294882B70029D2B3 /* KMTextFieldStepperView.xib in Resources */ = {isa = PBXBuildFile; fileRef = ADB2D6FC294882B70029D2B3 /* KMTextFieldStepperView.xib */; };
+		ADB5E50E2A3703E6007110A8 /* KMInAppPurchaseManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD0E8AAF2A31B76300DBFD3C /* KMInAppPurchaseManager.swift */; };
 		ADBA0464292CB90B00BF9184 /* KMBatchProcessingTableRowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADBA0463292CB90B00BF9184 /* KMBatchProcessingTableRowView.swift */; };
 		ADBA0465292CB90B00BF9184 /* KMBatchProcessingTableRowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADBA0463292CB90B00BF9184 /* KMBatchProcessingTableRowView.swift */; };
 		ADBA0466292CB90B00BF9184 /* KMBatchProcessingTableRowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADBA0463292CB90B00BF9184 /* KMBatchProcessingTableRowView.swift */; };
@@ -12266,6 +12266,7 @@
 				9F78EFBD28F7C1CC001E66F4 /* KMHomeViewController.swift in Sources */,
 				BBC745EC295F067B0072C2ED /* KMCropSettingWindowController.swift in Sources */,
 				ADE8BC2729F7CCA600570F89 /* KMPageNumberDisplayView.swift in Sources */,
+				ADB5E50E2A3703E6007110A8 /* KMInAppPurchaseManager.swift in Sources */,
 				89316848296E436B0073EA59 /* KMPDFSignatureImageView.m in Sources */,
 				ADD1B6C92942E83000C3FFF7 /* KMPrintBottomView.swift in Sources */,
 				ADD1B7042946C8AD00C3FFF7 /* KMBaseTextField.swift in Sources */,
@@ -12402,7 +12403,6 @@
 				BBEC00A6295BD42D00A26C98 /* KMHeaderFooterPageInfoView.swift in Sources */,
 				BBC348552958465C008D2CD1 /* KMBackgroundFilePropertyInfoController.swift in Sources */,
 				AD867F9E29D9853200F00440 /* KMBOTAOutlineRowView.swift in Sources */,
-				AD0E8AB22A31B76300DBFD3C /* KMInAppPurchaseManager.swift in Sources */,
 				BBC3482B29559B22008D2CD1 /* KMBackgroundListCell.swift in Sources */,
 				F34BF93729530708002C25A2 /* NSImage+PDFListView.m in Sources */,
 				9FAAA32C290BD01D0046FFCE /* KMHomeHistoryFileViewController.swift in Sources */,

+ 13 - 0
PDF Office/PDF Master/Class/KMLightMember/Controller/ComparativeTable/KMComparativeTableViewController.swift

@@ -10,6 +10,7 @@ import Cocoa
 typealias KMComparativeTableViewControllerLoginAction = (_ controller: KMComparativeTableViewController) -> Void
 typealias KMComparativeTableViewControllerSignUpAction = (_ controller: KMComparativeTableViewController) -> Void
 typealias KMComparativeTableViewControllerSubscriptionAction = (_ controller: KMComparativeTableViewController) -> Void
+typealias KMComparativeTableViewControllerRestoreAction = (_ controller: KMComparativeTableViewController) -> Void
 
 var comparativeController: KMComparativeTableViewController?
 var comparativeMainWindow: NSWindow?
@@ -35,6 +36,7 @@ class KMComparativeTableViewController: NSWindowController {
     var loginAction: KMComparativeTableViewControllerLoginAction?
     var signUpAction: KMComparativeTableViewControllerSignUpAction?
     var subscriptionAction: KMComparativeTableViewControllerSubscriptionAction?
+    var restoreAction: KMComparativeTableViewControllerRestoreAction?
     
     deinit {
         print("KMComparativeTableViewController 释放")
@@ -74,6 +76,10 @@ class KMComparativeTableViewController: NSWindowController {
             }
         }
         
+        controller.restoreAction = { controller in
+            KMPurchaseManager.manager.restorePurchases()
+        }
+        
         window.beginSheet(controller.window!)
         comparativeController = controller
         comparativeMainWindow = window
@@ -117,6 +123,13 @@ class KMComparativeTableViewController: NSWindowController {
 
             callBack(self!)
         }
+        
+        self.comparativeTableView.restoreAction = { [weak self] view in
+            print("订阅")
+            guard let callBack = self?.restoreAction else { return }
+
+            callBack(self!)
+        }
     }
     
 }

+ 153 - 0
PDF Office/PDF Master/Class/KMLightMember/Controller/ComparativeTable/Source/KMComparative.plist

@@ -22,12 +22,30 @@
 					<string>Create PDF from Microsoft Word, PowerPoint, Excel, Text, and image</string>
 					<key>state</key>
 					<integer>6</integer>
+					<key>content</key>
+					<dict>
+						<key>title1</key>
+						<string>1111</string>
+						<key>title2</key>
+						<string>2222</string>
+						<key>title3</key>
+						<string>3333</string>
+					</dict>
 				</dict>
 				<dict>
 					<key>title</key>
 					<string>Create PDF from scanner</string>
 					<key>state</key>
 					<integer>6</integer>
+					<key>content</key>
+					<dict>
+						<key>title1</key>
+						<string>11111111111111111112</string>
+						<key>title2</key>
+						<string>22222222222222222223</string>
+						<key>title3</key>
+						<string>33333333333333333334</string>
+					</dict>
 				</dict>
 			</array>
 		</dict>
@@ -41,12 +59,30 @@
 					<string>Convert PDF to Microsoft Word, Excel, PPT, Text, and image</string>
 					<key>state</key>
 					<integer>4</integer>
+					<key>content</key>
+					<dict>
+						<key>title1</key>
+						<string></string>
+						<key>title2</key>
+						<string></string>
+						<key>title3</key>
+						<string></string>
+					</dict>
 				</dict>
 				<dict>
 					<key>title</key>
 					<string>Turn PDF to RTF, HTML, CSV</string>
 					<key>state</key>
 					<integer>4</integer>
+					<key>content</key>
+					<dict>
+						<key>title1</key>
+						<string></string>
+						<key>title2</key>
+						<string>2222</string>
+						<key>title3</key>
+						<string>3333</string>
+					</dict>
 				</dict>
 			</array>
 		</dict>
@@ -60,42 +96,105 @@
 					<string>Edit PDF text and images</string>
 					<key>state</key>
 					<integer>4</integer>
+					<key>content</key>
+					<dict>
+						<key>title1</key>
+						<string></string>
+						<key>title2</key>
+						<string></string>
+						<key>title3</key>
+						<string></string>
+					</dict>
 				</dict>
 				<dict>
 					<key>title</key>
 					<string>Extract texts from image-based or scanned PDF with OCR</string>
 					<key>state</key>
 					<integer>4</integer>
+					<key>content</key>
+					<dict>
+						<key>title1</key>
+						<string></string>
+						<key>title2</key>
+						<string></string>
+						<key>title3</key>
+						<string></string>
+					</dict>
 				</dict>
 				<dict>
 					<key>title</key>
 					<string>Compress PDF</string>
 					<key>state</key>
 					<integer>4</integer>
+					<key>content</key>
+					<dict>
+						<key>title1</key>
+						<string></string>
+						<key>title2</key>
+						<string></string>
+						<key>title3</key>
+						<string></string>
+					</dict>
 				</dict>
 				<dict>
 					<key>title</key>
 					<string>Merge multiple PDFs</string>
 					<key>state</key>
 					<integer>4</integer>
+					<key>content</key>
+					<dict>
+						<key>title1</key>
+						<string></string>
+						<key>title2</key>
+						<string></string>
+						<key>title3</key>
+						<string></string>
+					</dict>
 				</dict>
 				<dict>
 					<key>title</key>
 					<string>Fill &amp; sign forms</string>
 					<key>state</key>
 					<integer>4</integer>
+					<key>content</key>
+					<dict>
+						<key>title1</key>
+						<string></string>
+						<key>title2</key>
+						<string></string>
+						<key>title3</key>
+						<string></string>
+					</dict>
 				</dict>
 				<dict>
 					<key>title</key>
 					<string>Crop pages</string>
 					<key>state</key>
 					<integer>4</integer>
+					<key>content</key>
+					<dict>
+						<key>title1</key>
+						<string></string>
+						<key>title2</key>
+						<string></string>
+						<key>title3</key>
+						<string></string>
+					</dict>
 				</dict>
 				<dict>
 					<key>title</key>
 					<string>Rotate, delete, paste, copy, cut pages</string>
 					<key>state</key>
 					<integer>4</integer>
+					<key>content</key>
+					<dict>
+						<key>title1</key>
+						<string></string>
+						<key>title2</key>
+						<string></string>
+						<key>title3</key>
+						<string></string>
+					</dict>
 				</dict>
 			</array>
 		</dict>
@@ -109,24 +208,60 @@
 					<string>Basic markup tools</string>
 					<key>state</key>
 					<integer>6</integer>
+					<key>content</key>
+					<dict>
+						<key>title1</key>
+						<string></string>
+						<key>title2</key>
+						<string></string>
+						<key>title3</key>
+						<string></string>
+					</dict>
 				</dict>
 				<dict>
 					<key>title</key>
 					<string>Hyperlink</string>
 					<key>state</key>
 					<integer>4</integer>
+					<key>content</key>
+					<dict>
+						<key>title1</key>
+						<string></string>
+						<key>title2</key>
+						<string></string>
+						<key>title3</key>
+						<string></string>
+					</dict>
 				</dict>
 				<dict>
 					<key>title</key>
 					<string>Stamp</string>
 					<key>state</key>
 					<integer>4</integer>
+					<key>content</key>
+					<dict>
+						<key>title1</key>
+						<string></string>
+						<key>title2</key>
+						<string></string>
+						<key>title3</key>
+						<string></string>
+					</dict>
 				</dict>
 				<dict>
 					<key>title</key>
 					<string>Signature</string>
 					<key>state</key>
 					<integer>4</integer>
+					<key>content</key>
+					<dict>
+						<key>title1</key>
+						<string></string>
+						<key>title2</key>
+						<string></string>
+						<key>title3</key>
+						<string></string>
+					</dict>
 				</dict>
 			</array>
 		</dict>
@@ -140,12 +275,30 @@
 					<string>Add password and permission</string>
 					<key>state</key>
 					<integer>4</integer>
+					<key>content</key>
+					<dict>
+						<key>title1</key>
+						<string></string>
+						<key>title2</key>
+						<string></string>
+						<key>title3</key>
+						<string></string>
+					</dict>
 				</dict>
 				<dict>
 					<key>title</key>
 					<string>Remove password</string>
 					<key>state</key>
 					<integer>4</integer>
+					<key>content</key>
+					<dict>
+						<key>title1</key>
+						<string></string>
+						<key>title2</key>
+						<string></string>
+						<key>title3</key>
+						<string></string>
+					</dict>
 				</dict>
 			</array>
 		</dict>

+ 7 - 0
PDF Office/PDF Master/Class/KMLightMember/Controller/ComparativeTable/View/ComparativeView/Model/KMComparativeModel.swift

@@ -34,4 +34,11 @@ class KMComparativeModelSection: Codable {
 class KMComparativeModelItem: Codable {
     var title: String?
     var state: KMComparativeModelOptions?
+    var content: KMComparativeModelItemContent?
+}
+
+class KMComparativeModelItemContent: Codable {
+    var title1: String
+    var title2: String
+    var title3: String
 }

+ 35 - 4
PDF Office/PDF Master/Class/KMLightMember/Controller/ComparativeTable/View/ComparativeView/View/KMComparativeOutlineCell.swift

@@ -12,8 +12,13 @@ class KMComparativeOutlineCell: NSTableCellView {
     @IBOutlet weak var titleLabel: NSTextField!
     @IBOutlet var contentView: NSView!
     
+    @IBOutlet weak var optionLabel: NSTextField!
     @IBOutlet weak var optionImage: NSImageView!
+    
+    @IBOutlet weak var optionLabel2: NSTextField!
     @IBOutlet weak var optionImage2: NSImageView!
+    
+    @IBOutlet weak var optionLabel3: NSTextField!
     @IBOutlet weak var optionImage3: NSImageView!
     
     var model: KMComparativeModelItem? {
@@ -57,20 +62,46 @@ class KMComparativeOutlineCell: NSTableCellView {
     func reloadData() {
         guard let data = self.model else { return }
         
-        self.titleLabel.stringValue = self.model?.title ?? ""
+        self.titleLabel.stringValue = data.title ?? ""
+
+        self.optionLabel.stringValue = data.content?.title1 ?? ""
+        self.optionLabel2.stringValue = data.content?.title2 ?? ""
+        self.optionLabel3.stringValue = data.content?.title3 ?? ""
         
         self.optionImage.image = NSImage(named: "icon_comparative_fork")
         self.optionImage2.image = NSImage(named: "icon_comparative_fork")
         self.optionImage3.image = NSImage(named: "icon_comparative_fork")
         if data.state!.contains(.unregistered) {
-            self.optionImage.image = NSImage(named: "icon_comparative_hook")
+            let string = self.optionLabel.stringValue
+            if string.count > 0 {
+                self.optionImage.image = NSImage()
+            } else {
+                self.optionImage.image = NSImage(named: "icon_comparative_hook")
+            }
+        } else {
+            self.optionLabel.stringValue = ""
         }
+        
         if data.state!.contains(.registered) {
-            self.optionImage2.image = NSImage(named: "icon_comparative_hook")
+            let string = self.optionLabel2.stringValue
+            if string.count > 0 {
+                self.optionImage2.image = NSImage()
+            } else {
+                self.optionImage2.image = NSImage(named: "icon_comparative_hook")
+            }
+        } else {
+            self.optionLabel2.stringValue = ""
         }
         
         if data.state!.contains(.subscribed) {
-            self.optionImage3.image = NSImage(named: "icon_comparative_hook")
+            let string = self.optionLabel3.stringValue
+            if string.count > 0 {
+                self.optionImage3.image = NSImage()
+            } else {
+                self.optionImage3.image = NSImage(named: "icon_comparative_hook")
+            }
+        } else {
+            self.optionLabel3.stringValue = ""
         }
     }
     

+ 39 - 0
PDF Office/PDF Master/Class/KMLightMember/Controller/ComparativeTable/View/ComparativeView/View/KMComparativeOutlineCell.xib

@@ -11,6 +11,9 @@
                 <outlet property="optionImage" destination="lqb-EW-MkO" id="E7M-RC-3fd"/>
                 <outlet property="optionImage2" destination="9Ol-6a-0R8" id="7ta-Kj-CZF"/>
                 <outlet property="optionImage3" destination="t5Q-5X-AdQ" id="wKO-ja-y7F"/>
+                <outlet property="optionLabel" destination="Jzd-Mg-rfa" id="Cbu-n5-TKN"/>
+                <outlet property="optionLabel2" destination="NrT-Ja-To6" id="rG5-1u-6g5"/>
+                <outlet property="optionLabel3" destination="kLh-ev-nDz" id="Jqg-9Q-bDK"/>
                 <outlet property="titleLabel" destination="u22-yU-gpo" id="PfH-Qt-hB3"/>
             </connections>
         </customObject>
@@ -39,11 +42,23 @@
                             </constraints>
                             <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="icon_comparative_hook" id="gbd-gH-Kp4"/>
                         </imageView>
+                        <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="NrT-Ja-To6">
+                            <rect key="frame" x="6" y="15" width="114" height="16"/>
+                            <textFieldCell key="cell" lineBreakMode="clipping" alignment="center" title="Label" id="rII-xy-11h">
+                                <font key="font" metaFont="system"/>
+                                <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                            </textFieldCell>
+                        </textField>
                     </subviews>
                     <constraints>
+                        <constraint firstItem="NrT-Ja-To6" firstAttribute="centerY" secondItem="MZK-3R-AFq" secondAttribute="centerY" id="2Cq-bn-nzq"/>
+                        <constraint firstItem="NrT-Ja-To6" firstAttribute="centerX" secondItem="MZK-3R-AFq" secondAttribute="centerX" id="GMc-Lt-h21"/>
+                        <constraint firstAttribute="trailing" secondItem="NrT-Ja-To6" secondAttribute="trailing" constant="8" id="UwS-8f-Bvp"/>
                         <constraint firstAttribute="width" constant="126" id="ajR-e5-BhX"/>
                         <constraint firstItem="9Ol-6a-0R8" firstAttribute="centerX" secondItem="MZK-3R-AFq" secondAttribute="centerX" id="da5-N1-NcV"/>
                         <constraint firstAttribute="height" constant="46" id="ec9-Pj-Um8"/>
+                        <constraint firstItem="NrT-Ja-To6" firstAttribute="leading" secondItem="MZK-3R-AFq" secondAttribute="leading" constant="8" id="jpy-mf-XMT"/>
                         <constraint firstItem="9Ol-6a-0R8" firstAttribute="centerY" secondItem="MZK-3R-AFq" secondAttribute="centerY" id="sXe-Ns-XKE"/>
                     </constraints>
                 </customView>
@@ -58,12 +73,24 @@
                             </constraints>
                             <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="icon_comparative_hook" id="zYa-4Q-cE2"/>
                         </imageView>
+                        <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Jzd-Mg-rfa">
+                            <rect key="frame" x="6" y="15" width="114" height="16"/>
+                            <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" alignment="center" title="Label" id="46S-yl-Zwl">
+                                <font key="font" metaFont="system"/>
+                                <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                            </textFieldCell>
+                        </textField>
                     </subviews>
                     <constraints>
+                        <constraint firstItem="Jzd-Mg-rfa" firstAttribute="centerX" secondItem="Lxu-5r-sY9" secondAttribute="centerX" id="MCh-HM-oUp"/>
                         <constraint firstAttribute="width" constant="126" id="Mmh-Ng-bHq"/>
+                        <constraint firstAttribute="trailing" secondItem="Jzd-Mg-rfa" secondAttribute="trailing" constant="8" id="Vcy-Uh-qxp"/>
+                        <constraint firstItem="Jzd-Mg-rfa" firstAttribute="leading" secondItem="Lxu-5r-sY9" secondAttribute="leading" constant="8" id="YBb-Og-2i2"/>
                         <constraint firstItem="lqb-EW-MkO" firstAttribute="centerY" secondItem="Lxu-5r-sY9" secondAttribute="centerY" id="lpL-7p-oqN"/>
                         <constraint firstItem="lqb-EW-MkO" firstAttribute="centerX" secondItem="Lxu-5r-sY9" secondAttribute="centerX" id="oFI-8W-RcF"/>
                         <constraint firstAttribute="height" constant="46" id="u57-nJ-USg"/>
+                        <constraint firstItem="Jzd-Mg-rfa" firstAttribute="centerY" secondItem="Lxu-5r-sY9" secondAttribute="centerY" id="ydy-AK-0vk"/>
                     </constraints>
                 </customView>
                 <customView translatesAutoresizingMaskIntoConstraints="NO" id="v52-Tq-tui">
@@ -77,12 +104,24 @@
                             </constraints>
                             <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="icon_comparative_hook" id="IYc-dA-3hY"/>
                         </imageView>
+                        <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="kLh-ev-nDz">
+                            <rect key="frame" x="6" y="15" width="114" height="16"/>
+                            <textFieldCell key="cell" lineBreakMode="clipping" alignment="center" title="Label" id="oTb-sT-L9u">
+                                <font key="font" metaFont="system"/>
+                                <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                            </textFieldCell>
+                        </textField>
                     </subviews>
                     <constraints>
+                        <constraint firstItem="kLh-ev-nDz" firstAttribute="leading" secondItem="v52-Tq-tui" secondAttribute="leading" constant="8" id="8NN-F7-iJG"/>
                         <constraint firstItem="t5Q-5X-AdQ" firstAttribute="centerX" secondItem="v52-Tq-tui" secondAttribute="centerX" id="CPB-Ui-O56"/>
                         <constraint firstAttribute="width" constant="126" id="FQa-iL-BZX"/>
+                        <constraint firstItem="kLh-ev-nDz" firstAttribute="centerY" secondItem="v52-Tq-tui" secondAttribute="centerY" id="Hkt-CV-tgF"/>
                         <constraint firstItem="t5Q-5X-AdQ" firstAttribute="centerY" secondItem="v52-Tq-tui" secondAttribute="centerY" id="TMJ-6q-VoI"/>
                         <constraint firstAttribute="height" constant="46" id="tb5-pI-YiU"/>
+                        <constraint firstAttribute="trailing" secondItem="kLh-ev-nDz" secondAttribute="trailing" constant="8" id="vX1-hd-Yqg"/>
+                        <constraint firstItem="kLh-ev-nDz" firstAttribute="centerX" secondItem="v52-Tq-tui" secondAttribute="centerX" id="xfW-Ln-DC0"/>
                     </constraints>
                 </customView>
             </subviews>

+ 13 - 0
PDF Office/PDF Master/Class/KMLightMember/Controller/ComparativeTable/View/KMComparativeTableView.swift

@@ -11,6 +11,7 @@ typealias KMComparativeTableViewCloseAction = (_ view: KMComparativeTableView) -
 typealias KMComparativeTableViewLoginAction = (_ view: KMComparativeTableView) -> Void
 typealias KMComparativeTableViewSignUpAction = (_ view: KMComparativeTableView) -> Void
 typealias KMComparativeTableViewSubscriptionAction = (_ view: KMComparativeTableView) -> Void
+typealias KMComparativeTableViewRestoreAction = (_ view: KMComparativeTableView) -> Void
 
 class KMComparativeTableView: KMBaseXibView {
 
@@ -19,11 +20,13 @@ class KMComparativeTableView: KMBaseXibView {
     @IBOutlet weak var signUpButton: NSButton!
     @IBOutlet weak var loginButton: NSButton!
     @IBOutlet weak var outlineView: KMComparativeOutlineView!
+    @IBOutlet weak var restoreButton: NSButton!
     
     var closeAction: KMComparativeTableViewCloseAction?
     var loginAction: KMComparativeTableViewLoginAction?
     var signUpAction: KMComparativeTableViewSignUpAction?
     var subscriptionAction: KMComparativeTableViewSubscriptionAction?
+    var restoreAction: KMComparativeTableViewRestoreAction?
     
     override func draw(_ dirtyRect: NSRect) {
         super.draw(dirtyRect)
@@ -46,6 +49,10 @@ class KMComparativeTableView: KMBaseXibView {
     override func updateUI() {
         super.updateUI()
         
+        #if VERSION_FREE
+        self.restoreButton.isHidden = false
+        #endif
+        
         self.backgroundColor(NSColor(hex: "#F2F9FF"))
         
         self.loginButton.backgroundColor(NSColor(hex: "#1770F4"))
@@ -93,4 +100,10 @@ extension KMComparativeTableView: KMComparativeTableViewAction {
         
         callBack(self)
     }
+    
+    @IBAction func restoreButtonAction(_ sender: Any) {
+        guard let callBack = restoreAction else { return }
+        
+        callBack(self)
+    }
 }

+ 18 - 0
PDF Office/PDF Master/Class/KMLightMember/Controller/ComparativeTable/View/KMComparativeTableView.xib

@@ -11,6 +11,8 @@
                 <outlet property="closeButton" destination="mcR-xz-9a9" id="gSm-yL-iMe"/>
                 <outlet property="loginButton" destination="fi1-h8-mNt" id="eeV-Kv-xJB"/>
                 <outlet property="outlineView" destination="250-TH-Pzl" id="WmQ-q5-EBr"/>
+                <outlet property="restoreButton" destination="rf9-Sg-aXn" id="rpk-vX-SYw"/>
+                <outlet property="restoreButtonAction" destination="GMX-4d-zo7" id="Kep-bj-VFm"/>
                 <outlet property="signUpButton" destination="hvx-14-OVC" id="mdc-AX-SMX"/>
             </connections>
         </customObject>
@@ -116,9 +118,24 @@
                                 <action selector="subscriptionButtonAction:" target="-2" id="pih-Pt-3Qj"/>
                             </connections>
                         </button>
+                        <button hidden="YES" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="rf9-Sg-aXn">
+                            <rect key="frame" x="16" y="48" width="47" height="24"/>
+                            <constraints>
+                                <constraint firstAttribute="height" constant="24" id="5ab-Xu-37e"/>
+                            </constraints>
+                            <buttonCell key="cell" type="bevel" title="restore" bezelStyle="rounded" alignment="center" imageScaling="proportionallyDown" inset="2" id="ZbB-oU-XZq">
+                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                <font key="font" metaFont="system"/>
+                            </buttonCell>
+                            <color key="contentTintColor" name="systemRedColor" catalog="System" colorSpace="catalog"/>
+                            <connections>
+                                <action selector="restoreButtonAction:" target="-2" id="6gU-Py-cTE"/>
+                            </connections>
+                        </button>
                     </subviews>
                     <constraints>
                         <constraint firstAttribute="bottom" secondItem="hvx-14-OVC" secondAttribute="bottom" constant="22" id="EXk-h2-DK8"/>
+                        <constraint firstItem="rf9-Sg-aXn" firstAttribute="centerY" secondItem="uVY-kS-Rql" secondAttribute="centerY" id="GMX-4d-zo7"/>
                         <constraint firstAttribute="bottom" secondItem="adY-Q0-Zuk" secondAttribute="bottom" id="HC8-xU-IlX"/>
                         <constraint firstAttribute="trailing" secondItem="adY-Q0-Zuk" secondAttribute="trailing" id="IKa-1o-bn5"/>
                         <constraint firstItem="adY-Q0-Zuk" firstAttribute="top" secondItem="uVY-kS-Rql" secondAttribute="top" id="ORU-WH-Sm0"/>
@@ -127,6 +144,7 @@
                         <constraint firstItem="adY-Q0-Zuk" firstAttribute="leading" secondItem="uVY-kS-Rql" secondAttribute="leading" id="UoO-9M-ij4"/>
                         <constraint firstItem="hvx-14-OVC" firstAttribute="top" secondItem="fi1-h8-mNt" secondAttribute="bottom" constant="8" id="WDd-cy-gRk"/>
                         <constraint firstItem="fi1-h8-mNt" firstAttribute="centerX" secondItem="uVY-kS-Rql" secondAttribute="centerX" id="lek-Ly-yJ3"/>
+                        <constraint firstItem="rf9-Sg-aXn" firstAttribute="leading" secondItem="uVY-kS-Rql" secondAttribute="leading" constant="16" id="nI7-V3-u76"/>
                         <constraint firstItem="Cip-dW-2mZ" firstAttribute="centerY" secondItem="uVY-kS-Rql" secondAttribute="centerY" id="qur-XV-XlU"/>
                         <constraint firstAttribute="trailing" secondItem="Cip-dW-2mZ" secondAttribute="trailing" constant="16" id="znD-2V-jLI"/>
                     </constraints>

+ 28 - 1
PDF Office/PDF Master/Class/KMLightMember/InAppPurchase/Appstore/KMInAppPurchaseManager.swift

@@ -20,7 +20,24 @@ let kItunesServer = "https://buy.itunes.apple.com/verifyReceipt";
 
 let kStoreLiteKitSecret = "905532d3f55449a9b7a96161e7a2d538";
 let kStoreKitSecret = "20f0129197a34439a2130358172984bb";
+#endif
+
+#if VERSION_DMG
+let PRODUCT_1 = "com.pdfreaderpro.free.member.all_access_pack_permanent_license.001"
+let PRODUCT_2 = "com.pdfreaderpro.member.pdf_to_office_pack_permanent_license.001"
+let kPRODUCTS: Set<String> = [PRODUCT_1, PRODUCT_2]
 
+let kSandboxServer = "https://sandbox.itunes.apple.com/verifyReceipt";
+let kItunesServer = "https://buy.itunes.apple.com/verifyReceipt";
+
+let kStoreLiteKitSecret = "905532d3f55449a9b7a96161e7a2d538";
+let kStoreKitSecret = "20f0129197a34439a2130358172984bb";
+#endif
+
+#if isDEBUG
+    let kServerURL = "https://sandbox.itunes.apple.com/verifyReceipt"
+#else
+    let kServerURL = "https://buy.itunes.apple.com/verifyReceipt"
 #endif
 
 let keychainAccessGroup = "your.keychain.access.group"
@@ -32,6 +49,11 @@ class KMInAppPurchaseManager: NSObject {
     var fetchProductCompletion: KMPurchaseFetchProductCompletion?
     var availableProducts: [SKProduct] = []
     var request: SKProductsRequest?
+    
+    deinit {
+        SKPaymentQueue.default().remove(self)
+    }
+    
     override init() {
         super.init()
         
@@ -109,6 +131,10 @@ class KMInAppPurchaseManager: NSObject {
             print("用户无法进行内购")
         }
     }
+    
+    func restorePurchases() {
+        SKPaymentQueue.default().restoreCompletedTransactions()
+    }
 }
 
 extension KMInAppPurchaseManager: SKProductsRequestDelegate {
@@ -137,6 +163,7 @@ extension KMInAppPurchaseManager: SKPaymentTransactionObserver {
     }
     
     func paymentQueue(_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction]) {
+        print("服务器返回数据")
         for transaction in transactions {
             switch transaction.transactionState {
             case .purchased:
@@ -203,7 +230,7 @@ extension KMInAppPurchaseManager: SKPaymentTransactionObserver {
             return
         }
         
-        let url = URL(string: "https://sandbox.itunes.apple.com/verifyReceipt")!
+        let url = URL(string: kServerURL)!
         var request = URLRequest(url: url)
         request.httpMethod = "POST"
         request.httpBody = requestData

+ 1 - 1
PDF Office/PDF Master/Class/KMLightMember/InAppPurchase/DMG/KMDMGPurchaseManager.swift

@@ -14,7 +14,7 @@ class KMDMGPurchaseManager: NSObject {
     var availableProducts: [KMProduct] = []
     
     func purchaseProduct(productIdentifier: String, completion: KMPurchaseCompletion) {
-
+        NSWorkspace.shared.open(URL(string: "https://www.pdfreaderpro.com/store")!)
     }
     
     func fetchProducts(completion: @escaping KMPurchaseFetchProductCompletion) {

+ 13 - 0
PDF Office/PDF Master/Class/KMLightMember/InAppPurchase/KMPurchaseManager.swift

@@ -63,6 +63,19 @@ class KMPurchaseManager: NSObject {
 #if VERSION_DMG
         print("正在订阅中DMG")
         KMDMGPurchaseManager.manager.purchaseProduct(productIdentifier: productIdentifier, completion: completion)
+#endif
+    }
+    
+    func restorePurchases() {
+        print("准备restore")
+#if VERSION_FREE
+        print("正在restore")
+        KMInAppPurchaseManager.manager.restorePurchases()
+#endif
+        
+#if VERSION_DMG
+        print("正在restore DMG")
+
 #endif
     }
 }

+ 11 - 11
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/BookMarks/KMBookMarkViewController.xib

@@ -28,10 +28,10 @@
                     <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                     <subviews>
                         <customView translatesAutoresizingMaskIntoConstraints="NO" id="ZOC-6Y-3av">
-                            <rect key="frame" x="0.0" y="0.0" width="260" height="417"/>
+                            <rect key="frame" x="0.0" y="0.0" width="260" height="415"/>
                             <subviews>
                                 <view translatesAutoresizingMaskIntoConstraints="NO" id="bIK-U7-Zqf">
-                                    <rect key="frame" x="0.0" y="369" width="260" height="48"/>
+                                    <rect key="frame" x="0.0" y="367" width="260" height="48"/>
                                     <subviews>
                                         <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="3oi-0L-gXH">
                                             <rect key="frame" x="14" y="16" width="35" height="16"/>
@@ -91,20 +91,20 @@ Gw
                             </constraints>
                         </customView>
                         <box borderType="none" title="Box" titlePosition="noTitle" translatesAutoresizingMaskIntoConstraints="NO" id="QXl-f3-0nT">
-                            <rect key="frame" x="0.0" y="0.0" width="260" height="369"/>
+                            <rect key="frame" x="0.0" y="0.0" width="260" height="367"/>
                             <view key="contentView" id="5Km-Gq-7Y6">
-                                <rect key="frame" x="0.0" y="0.0" width="260" height="369"/>
+                                <rect key="frame" x="0.0" y="0.0" width="260" height="367"/>
                                 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                 <subviews>
                                     <scrollView fixedFrame="YES" borderType="none" autohidesScrollers="YES" horizontalLineScroll="35" horizontalPageScroll="10" verticalLineScroll="35" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="P2v-Ak-LWO">
-                                        <rect key="frame" x="0.0" y="2" width="260" height="367"/>
+                                        <rect key="frame" x="0.0" y="2" width="260" height="365"/>
                                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                         <clipView key="contentView" drawsBackground="NO" id="KFG-R9-2uc">
-                                            <rect key="frame" x="0.0" y="0.0" width="260" height="367"/>
+                                            <rect key="frame" x="0.0" y="0.0" width="260" height="365"/>
                                             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                             <subviews>
                                                 <tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" tableStyle="plain" multipleSelection="NO" autosaveColumns="NO" rowHeight="35" rowSizeStyle="automatic" viewBased="YES" id="jMm-Al-ZqF">
-                                                    <rect key="frame" x="0.0" y="0.0" width="260" height="367"/>
+                                                    <rect key="frame" x="0.0" y="0.0" width="260" height="365"/>
                                                     <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                                     <size key="intercellSpacing" width="17" height="0.0"/>
                                                     <color key="backgroundColor" red="1" green="0.99843658089999998" blue="0.99619259260000004" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
@@ -190,14 +190,14 @@ Gw
                             </view>
                         </box>
                         <customView translatesAutoresizingMaskIntoConstraints="NO" id="H5X-YQ-dvn">
-                            <rect key="frame" x="0.0" y="0.0" width="260" height="369"/>
+                            <rect key="frame" x="0.0" y="0.0" width="260" height="367"/>
                             <subviews>
                                 <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="8R5-DW-bXb">
-                                    <rect key="frame" x="64" y="90" width="132" height="128"/>
+                                    <rect key="frame" x="64" y="88" width="132" height="128"/>
                                     <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="KMImageNameBookMarkEmpty" id="6Kl-9F-c8Y"/>
                                 </imageView>
                                 <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="BO0-hw-zv2">
-                                    <rect key="frame" x="62" y="60" width="136" height="17"/>
+                                    <rect key="frame" x="62" y="58" width="136" height="17"/>
                                     <textFieldCell key="cell" lineBreakMode="clipping" alignment="center" title="No bookmark found" id="6Wq-yY-yuD">
                                         <font key="font" metaFont="system" size="14"/>
                                         <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
@@ -205,7 +205,7 @@ Gw
                                     </textFieldCell>
                                 </textField>
                                 <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Msu-u0-gPn">
-                                    <rect key="frame" x="33" y="45" width="194" height="15"/>
+                                    <rect key="frame" x="33" y="43" width="194" height="15"/>
                                     <textFieldCell key="cell" alignment="center" id="bpF-T2-SUC">
                                         <font key="font" metaFont="cellTitle"/>
                                         <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>