Browse Source

综合-合并代码

tangchao 1 year ago
parent
commit
6ef0914ef6

+ 15 - 2
PDF Office/PDF Master/Class/KMLightMember/Controller/ComparativeTable/KMComparativeTableViewController.swift

@@ -13,10 +13,23 @@ typealias KMComparativeTableViewControllerSignUpAction = (_ controller: KMCompar
 var comparativeController: KMComparativeTableViewController?
 var comparativeMainWindow: NSWindow?
 
+enum KMComparativeInputType: Int {
+    case unknown = 0
+    case login = 1 //登录界面
+    case register = 2 //注册界面
+    case resetPassword = 3 //重置密码
+    case verificationCode = 4 //验证码
+    case registerSuccess = 5 //注册成功
+    case loginInputPassword = 6 //登录密码输入
+    case accountInfo = 7 //用户信息
+    
+    //后续添加
+}
+
 class KMComparativeTableViewController: NSWindowController {
 
     @IBOutlet weak var comparativeTableView: KMComparativeTableView!
-    var inputType: DataNavigationViewButtonActionType?
+    var inputType: KMComparativeInputType?
     
     var loginAction: KMComparativeTableViewControllerLoginAction?
     var signUpAction: KMComparativeTableViewControllerSignUpAction?
@@ -31,7 +44,7 @@ class KMComparativeTableViewController: NSWindowController {
      @param window 弹出window
      @param type 从什么页面跳转到比较表 默认batch
      */
-    static func show(window: NSWindow, _ type: DataNavigationViewButtonActionType = .Batch) -> KMComparativeTableViewController {
+    static func show(window: NSWindow, _ type: KMComparativeInputType = .unknown) -> KMComparativeTableViewController {
         let controller: KMComparativeTableViewController = KMComparativeTableViewController.init(windowNibName: "KMComparativeTableViewController")
         controller.inputType = type
 

+ 22 - 0
PDF Office/PDF Master/Class/KMLightMember/Controller/ComparativeTable/View/ComparativeView/KMComparativeOutlineView.swift

@@ -121,6 +121,28 @@ extension KMComparativeOutlineView : NSOutlineViewDataSource,NSOutlineViewDelega
         return false
     }
     
+    func outlineView(_ outlineView: NSOutlineView, shouldExpandItem item: Any) -> Bool {
+        if let item = item as? KMComparativeModelSection {
+            if !item.select! {
+                item.select = true
+                outlineView.animator().expandItem(item, expandChildren: true)
+                return false
+            }
+        }
+        return true
+    }
+
+    func outlineView(_ outlineView: NSOutlineView, shouldCollapseItem item: Any) -> Bool {
+        if let item = item as? KMComparativeModelSection {
+            if item.select! {
+                item.select = false
+                outlineView.animator().collapseItem(item, collapseChildren: true)
+                return false
+            }
+        }
+        return true
+    }
+    
     func outlineView(_ outlineView: NSOutlineView, viewFor tableColumn: NSTableColumn?, item: Any) -> NSView? {
         if item is KMComparativeModelItem {
             let cell : KMComparativeOutlineCell = KMComparativeOutlineCell.init()

+ 2 - 2
PDF Office/PDF Master/Class/KMLightMember/Controller/ComparativeTable/View/ComparativeView/KMComparativeOutlineView.xib

@@ -5,7 +5,7 @@
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
-        <customObject id="-2" userLabel="File's Owner" customClass="KMComparativeOutlineView" customModule="PDF_Office" customModuleProvider="target">
+        <customObject id="-2" userLabel="File's Owner" customClass="KMComparativeOutlineView" customModule="PDF_Master" customModuleProvider="target">
             <connections>
                 <outlet property="optionTitleLabel" destination="v3A-gL-7XA" id="1nW-Vc-r0G"/>
                 <outlet property="optionTitleLabel2" destination="1Wx-Ri-paS" id="h5t-tN-Lsg"/>
@@ -26,7 +26,7 @@
                         <rect key="frame" x="0.0" y="0.0" width="788" height="393"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <subviews>
-                            <outlineView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" tableStyle="fullWidth" multipleSelection="NO" autosaveColumns="NO" rowSizeStyle="automatic" viewBased="YES" indentationPerLevel="13" outlineTableColumn="vYw-qT-E7W" id="Sw7-bL-PDy" customClass="KMOutlineView" customModule="PDF_Office" customModuleProvider="target">
+                            <outlineView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" tableStyle="fullWidth" multipleSelection="NO" autosaveColumns="NO" rowSizeStyle="automatic" viewBased="YES" indentationPerLevel="13" outlineTableColumn="vYw-qT-E7W" id="Sw7-bL-PDy" customClass="KMOutlineView" customModule="PDF_Master" customModuleProvider="target">
                                 <rect key="frame" x="0.0" y="0.0" width="788" height="393"/>
                                 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                 <size key="intercellSpacing" width="17" height="0.0"/>

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

@@ -12,6 +12,7 @@ struct KMComparativeModelOptions: OptionSet, Codable {
     static let none = KMComparativeModelOptions(rawValue: 1 << 0) //无
     static let unregistered = KMComparativeModelOptions(rawValue: 1 << 1) //未注册
     static let registered = KMComparativeModelOptions(rawValue: 1 << 2) //注册
+    static let subscribed = KMComparativeModelOptions(rawValue: 1 << 3) //已订阅
 
     static let all: KMComparativeModelOptions = [.unregistered, .registered]
 }

+ 6 - 0
PDF Office/PDF Master/Class/KMLightMember/Controller/ComparativeTable/View/ComparativeView/View/KMComparativeOutlineCell.swift

@@ -14,6 +14,7 @@ class KMComparativeOutlineCell: NSTableCellView {
     
     @IBOutlet weak var optionImage: NSImageView!
     @IBOutlet weak var optionImage2: NSImageView!
+    @IBOutlet weak var optionImage3: NSImageView!
     
     var model: KMComparativeModelItem? {
         didSet {
@@ -60,12 +61,17 @@ class KMComparativeOutlineCell: NSTableCellView {
         
         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")
         }
         if data.state!.contains(.registered) {
             self.optionImage2.image = NSImage(named: "icon_comparative_hook")
         }
+        
+        if data.state!.contains(.subscribed) {
+            self.optionImage3.image = NSImage(named: "icon_comparative_hook")
+        }
     }
     
     func updateUI() {

+ 32 - 11
PDF Office/PDF Master/Class/KMLightMember/Controller/ComparativeTable/View/ComparativeView/View/KMComparativeOutlineCell.xib

@@ -1,27 +1,27 @@
 <?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="21701" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
     <dependencies>
-        <deployment identifier="macosx"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21507"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21701"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
-        <customObject id="-2" userLabel="File's Owner" customClass="KMComparativeOutlineCell" customModule="PDF_Office" customModuleProvider="target">
+        <customObject id="-2" userLabel="File's Owner" customClass="KMComparativeOutlineCell" customModule="PDF_Master" customModuleProvider="target">
             <connections>
                 <outlet property="contentView" destination="c22-O7-iKe" id="0Tg-hb-xgN"/>
                 <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="titleLabel" destination="u22-yU-gpo" id="PfH-Qt-hB3"/>
             </connections>
         </customObject>
         <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
         <customObject id="-3" userLabel="Application" customClass="NSObject"/>
         <customView id="c22-O7-iKe">
-            <rect key="frame" x="0.0" y="0.0" width="734" height="46"/>
+            <rect key="frame" x="0.0" y="0.0" width="784" height="44"/>
             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
             <subviews>
                 <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="u22-yU-gpo">
-                    <rect key="frame" x="6" y="15" width="454" height="16"/>
+                    <rect key="frame" x="6" y="14" width="394" height="16"/>
                     <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="Oah-fo-Tas">
                         <font key="font" usesAppearanceFont="YES"/>
                         <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
@@ -29,7 +29,7 @@
                     </textFieldCell>
                 </textField>
                 <customView translatesAutoresizingMaskIntoConstraints="NO" id="MZK-3R-AFq">
-                    <rect key="frame" x="600" y="0.0" width="126" height="46"/>
+                    <rect key="frame" x="532" y="-1" width="126" height="46"/>
                     <subviews>
                         <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="9Ol-6a-0R8">
                             <rect key="frame" x="54" y="14" width="18" height="18"/>
@@ -48,7 +48,7 @@
                     </constraints>
                 </customView>
                 <customView translatesAutoresizingMaskIntoConstraints="NO" id="Lxu-5r-sY9">
-                    <rect key="frame" x="474" y="0.0" width="126" height="46"/>
+                    <rect key="frame" x="406" y="-1" width="126" height="46"/>
                     <subviews>
                         <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="lqb-EW-MkO">
                             <rect key="frame" x="54" y="14" width="18" height="18"/>
@@ -66,17 +66,38 @@
                         <constraint firstAttribute="height" constant="46" id="u57-nJ-USg"/>
                     </constraints>
                 </customView>
+                <customView translatesAutoresizingMaskIntoConstraints="NO" id="v52-Tq-tui">
+                    <rect key="frame" x="658" y="-1" width="126" height="46"/>
+                    <subviews>
+                        <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="t5Q-5X-AdQ">
+                            <rect key="frame" x="54" y="14" width="18" height="18"/>
+                            <constraints>
+                                <constraint firstAttribute="width" constant="18" id="JyY-gH-j3e"/>
+                                <constraint firstAttribute="height" constant="18" id="MAP-bJ-tEk"/>
+                            </constraints>
+                            <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="icon_comparative_hook" id="IYc-dA-3hY"/>
+                        </imageView>
+                    </subviews>
+                    <constraints>
+                        <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="t5Q-5X-AdQ" firstAttribute="centerY" secondItem="v52-Tq-tui" secondAttribute="centerY" id="TMJ-6q-VoI"/>
+                        <constraint firstAttribute="height" constant="46" id="tb5-pI-YiU"/>
+                    </constraints>
+                </customView>
             </subviews>
             <constraints>
                 <constraint firstItem="u22-yU-gpo" firstAttribute="leading" secondItem="c22-O7-iKe" secondAttribute="leading" constant="8" id="3xU-aP-ezl"/>
-                <constraint firstItem="Lxu-5r-sY9" firstAttribute="leading" secondItem="u22-yU-gpo" secondAttribute="trailing" constant="16" id="97C-P1-bZv"/>
                 <constraint firstItem="MZK-3R-AFq" firstAttribute="leading" secondItem="Lxu-5r-sY9" secondAttribute="trailing" id="JNF-ww-vEg"/>
+                <constraint firstAttribute="trailing" secondItem="v52-Tq-tui" secondAttribute="trailing" id="N2h-A6-vS1"/>
                 <constraint firstItem="MZK-3R-AFq" firstAttribute="centerY" secondItem="c22-O7-iKe" secondAttribute="centerY" id="QjN-FH-ZkA"/>
                 <constraint firstItem="Lxu-5r-sY9" firstAttribute="centerY" secondItem="c22-O7-iKe" secondAttribute="centerY" id="Wed-Ko-ACz"/>
-                <constraint firstAttribute="trailing" secondItem="MZK-3R-AFq" secondAttribute="trailing" constant="8" id="bcB-uA-Sxh"/>
+                <constraint firstItem="Lxu-5r-sY9" firstAttribute="leading" secondItem="u22-yU-gpo" secondAttribute="trailing" constant="8" id="XVq-B0-Dxl"/>
                 <constraint firstItem="u22-yU-gpo" firstAttribute="centerY" secondItem="c22-O7-iKe" secondAttribute="centerY" id="fhC-tT-JkD"/>
+                <constraint firstItem="v52-Tq-tui" firstAttribute="centerY" secondItem="c22-O7-iKe" secondAttribute="centerY" id="wpu-0S-b1q"/>
+                <constraint firstItem="v52-Tq-tui" firstAttribute="leading" secondItem="MZK-3R-AFq" secondAttribute="trailing" id="wsx-eu-GJ6"/>
             </constraints>
-            <point key="canvasLocation" x="221" y="119"/>
+            <point key="canvasLocation" x="95" y="232"/>
         </customView>
     </objects>
     <resources>

+ 3 - 4
PDF Office/PDF Master/Class/KMLightMember/Controller/ComparativeTable/View/ComparativeView/View/KMComparativeOutlineSectionCell.xib

@@ -1,12 +1,11 @@
 <?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="21701" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
     <dependencies>
-        <deployment identifier="macosx"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21507"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21701"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
-        <customObject id="-2" userLabel="File's Owner" customClass="KMComparativeOutlineSectionCell" customModule="PDF_Office" customModuleProvider="target">
+        <customObject id="-2" userLabel="File's Owner" customClass="KMComparativeOutlineSectionCell" customModule="PDF_Master" customModuleProvider="target">
             <connections>
                 <outlet property="contentBackgroundView" destination="aem-7E-JBQ" id="3Y0-bk-4zw"/>
                 <outlet property="contentView" destination="c22-O7-iKe" id="vpl-xz-be2"/>

+ 1 - 0
PDF Office/PDF Master/Class/KMLightMember/Controller/Login&Register/View/KMLoginLeftImageView.swift

@@ -8,6 +8,7 @@
 import Cocoa
 
 typealias KMLoginLeftImageViewCancelAction = (_ view: KMLoginLeftImageView) -> Void
+typealias KMLoginLeftImageViewSubscriptionAction = (_ view: KMLoginLeftImageView) -> Void
 class KMLoginLeftImageView: KMBaseXibView {
 
     @IBOutlet weak var closeButton: NSButton!

+ 14 - 0
PDF Office/PDF Master/Class/KMLightMember/Controller/Login&Register/View/KMLoginLeftImageView.xib

@@ -24,11 +24,25 @@
                             <rect key="frame" x="0.0" y="0.0" width="282" height="460"/>
                             <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="image_login" id="ZVR-ob-TIM"/>
                         </imageView>
+                        <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="XyW-Vk-S88">
+                            <rect key="frame" x="186" y="16" width="80" height="80"/>
+                            <constraints>
+                                <constraint firstAttribute="height" constant="80" id="T3p-Vf-5dM"/>
+                                <constraint firstAttribute="width" constant="80" id="TZN-Md-Uu8"/>
+                            </constraints>
+                            <buttonCell key="cell" type="square" title="订阅" bezelStyle="shadowlessSquare" alignment="center" imageScaling="proportionallyDown" inset="2" id="jSq-9I-9tm">
+                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                <font key="font" size="13" name=".PingFangSC-Regular"/>
+                            </buttonCell>
+                            <color key="contentTintColor" name="systemRedColor" catalog="System" colorSpace="catalog"/>
+                        </button>
                     </subviews>
                     <constraints>
                         <constraint firstItem="MOY-Rt-B5e" firstAttribute="top" secondItem="7xs-D0-Xel" secondAttribute="top" id="LJI-lq-UcP"/>
                         <constraint firstItem="MOY-Rt-B5e" firstAttribute="leading" secondItem="7xs-D0-Xel" secondAttribute="leading" id="WME-XU-0Qa"/>
                         <constraint firstAttribute="trailing" secondItem="MOY-Rt-B5e" secondAttribute="trailing" id="bfV-RG-OZR"/>
+                        <constraint firstAttribute="trailing" secondItem="XyW-Vk-S88" secondAttribute="trailing" constant="16" id="epI-3h-t7y"/>
+                        <constraint firstAttribute="bottom" secondItem="XyW-Vk-S88" secondAttribute="bottom" constant="16" id="mTL-v1-5zT"/>
                         <constraint firstAttribute="bottom" secondItem="MOY-Rt-B5e" secondAttribute="bottom" id="u4a-Af-t9S"/>
                     </constraints>
                 </customView>

+ 4 - 2
PDF Office/PDF Master/Class/KMLightMember/Manager/KMSubscriptionManager.swift

@@ -9,8 +9,10 @@ import Cocoa
 
 enum KMSubscriptionState: String, CaseIterable {
     case unknow = "unknow"
-    case advanced = "advanced"
-    
+    case trial = "Trial"
+    case trialExpired = "Trial Expired"
+    case subscription = "Subscription"
+    case subscriptionExpired = "Subscription Expired"
 }
 
 class KMSubscriptionManager: NSObject {