Przeglądaj źródła

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

tangchao 1 rok temu
rodzic
commit
5998f43d90

+ 32 - 0
PDF Office/PDF Master.xcodeproj/xcuserdata/lizhe.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -3355,5 +3355,37 @@
             </Locations>
          </BreakpointContent>
       </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "E762A439-6492-41A7-9B74-8CB8611C1347"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/KMLightMember/Controller/VerificationCode/View/KMVerificationCodeView.swift"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "312"
+            endingLineNumber = "312"
+            landmarkName = "updateNetworkingState(complete:codeIsTure:)"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "2A96EFBC-25B9-487F-8B58-B1E762D20471"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/KMLightMember/Controller/VerificationCode/View/KMVerificationCodeView.swift"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "451"
+            endingLineNumber = "451"
+            landmarkName = "controlTextDidEndEditing(_:)"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
    </Breakpoints>
 </Bucket>

+ 1 - 1
PDF Office/PDF Master/Class/KMLightMember/Controller/AccountInfo/KMAccountInfoWindowController.swift

@@ -40,7 +40,7 @@ class KMAccountInfoWindowController: NSWindowController {
             let controller: KMAccountInfoWindowController = KMAccountInfoWindowController.init(windowNibName: "KMAccountInfoWindowController")
             controller.inputType = type
             controller.cancellAtionAction = { controller in
-                KMVerficationCodeWindowController.show(window: (accountInfoController?.window)!)
+                KMVerficationCodeWindowController.show(window: controller.window!)
             }
             window.beginSheet(controller.window!)
             accountInfoController = controller

+ 22 - 3
PDF Office/PDF Master/Class/KMLightMember/Controller/VerificationCode/View/KMLightMemberAlertView.swift

@@ -12,6 +12,8 @@ class KMLightMemberAlertView: KMBaseXibView {
     @IBOutlet weak var titleLabel: NSTextField!
     @IBOutlet weak var titleContentView: NSView!
     
+    var timer: DispatchSourceTimer?
+    
     var result: Result = Result() {
         didSet {
             self.alphaValue = 1.0
@@ -49,9 +51,26 @@ class KMLightMemberAlertView: KMBaseXibView {
         
         self.titleLabel.stringValue = NSLocalizedString(KMRequestServerErrorCodeType.typeOfMessage(type: KMRequestServerErrorCodeType(rawValue: result.code)), comment: "")
         
-//        DispatchQueue.main.asyncAfter(deadline: .now() + 2.0) { [weak self] in
-//            self?.fadeOut()
-//        }
+        self.callMethodWithDelay()
+    }
+    
+    func callMethodWithDelay() {
+        // 取消之前的计时器
+        timer?.cancel()
+
+        // 创建一个新的计时器,延迟 2 秒
+        timer = DispatchSource.makeTimerSource()
+        timer?.schedule(deadline: .now() + 2, leeway: .milliseconds(10))
+        timer?.setEventHandler(handler: { [unowned self] in
+            // 2 秒后执行的代码
+            methodToExecuteAfterDelay()
+        })
+        timer?.resume()
+    }
+
+    func methodToExecuteAfterDelay() {
+        // 执行的代码
+        self.fadeOut()
     }
     
     func fadeOut() {

+ 1 - 1
PDF Office/PDF Master/Class/KMLightMember/Controller/VerificationCode/View/KMLightMemberAlertView.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="KMLightMemberAlertView" customModule="PDF_Office" customModuleProvider="target">
+        <customObject id="-2" userLabel="File's Owner" customClass="KMLightMemberAlertView" customModule="PDF_Master" customModuleProvider="target">
             <connections>
                 <outlet property="titleContentView" destination="q25-bk-4KL" id="T9w-aX-Y37"/>
                 <outlet property="titleLabel" destination="5Vu-nI-SlI" id="2ij-nc-hSR"/>

+ 34 - 10
PDF Office/PDF Master/Class/KMLightMember/Controller/VerificationCode/View/KMVerificationCodeView.swift

@@ -128,16 +128,20 @@ class KMVerificationCodeView: KMBaseXibView {
                 textField?.model.isCanNull = true
                 textField?.textField.tag = i + 10
                 textField!.textField.alignment = .center
-                textField?.superview?.border(NSColor(hex: "#DFE1E5"), 1, 4)
-                textField?.textField.onFocus = {
-                    textField?.superview?.border(NSColor(hex: "#1770F4"), 1, 4)
+                textField?.superview?.border(NSColor(hex: "#DFE1E5"), 1, 2)
+                textField?.textField.onFocus = { [unowned self] in
+                    self.cancelAllTextFieldFouce()
+                    textField?.superview?.border(NSColor(hex: "#1770F4"), 1, 2)
                 }
                 
                 textField?.textDidEndEditing = { [unowned self] string in
-                    textField?.superview?.border(NSColor(hex: "#DFE1E5"), 1, 4)
+                    textField?.superview?.border(NSColor(hex: "#DFE1E5"), 1, 2)
                 }
                 
                 textField?.textDidChange = { [unowned self] string in
+                    //自动验证验证码
+                    self.autoVerificationCode()
+                    
                     var isNext = true
                     if string == "" {
                         isNext = false
@@ -148,25 +152,24 @@ class KMVerificationCodeView: KMBaseXibView {
                         if !isNext {
                             tag = t!.tag - 1
                         }
+                        tag = max(10, tag)
                         if item?.textField.tag == tag {
                             item?.textField.becomeFirstResponder()
+                            item?.superview?.border(NSColor(hex: "#1770F4"), 1, 2)
                             break
                         }
                     }
-                    
-                    //自动验证验证码
-                    self.autoVerificationCode()
-                    self.reloadData()
                 }
                 
                 textField?.textDeleteAction = { [unowned self] string in
                     if string == "" {
                         for item in textFieldArray {
                             let t = textField?.textField
-                            let tag = t!.tag - 1
+                            let tag = max(10, t!.tag - 1)
 
                             if item?.textField.tag == tag {
                                 item?.textField.becomeFirstResponder()
+                                item?.superview?.border(NSColor(hex: "#1770F4"), 1, 2)
                                 break
                             }
                         }
@@ -295,7 +298,10 @@ class KMVerificationCodeView: KMBaseXibView {
         for item in textFieldArray {
             item?.stringValue = ""
             item?.textField.resignFirstResponder()
-            item?.superview?.border(NSColor(hex: "#DFE1E5"), 1, 4)
+            
+            if item != self.code1TextField {
+                item?.superview?.border(NSColor(hex: "#DFE1E5"), 1, 2)
+            }
         }
         self.model.verifyCode = ""
     }
@@ -398,12 +404,30 @@ extension KMVerificationCodeView: KMVerificationCodeViewAction {
     func showAlert(result: Result?) {
         if result != nil {
             self.alertView.result = result!
+            
+            if result?.code != 0 && result?.code != 200 {
+                self.textFieldAlert()
+            }
         }
     }
     
     func changeDoneButtonState(enable: Bool) {
         self.cancellationButtonVC.enabled = enable
     }
+    
+    func cancelAllTextFieldFouce() {
+        let textFieldArray = [self.code1TextField,self.code2TextField,self.code3TextField,self.code4TextField,self.code5TextField,self.code6TextField]
+        for item in textFieldArray {
+            item?.superview?.border(NSColor(hex: "#DFE1E5"), 1, 2)
+        }
+    }
+    
+    func textFieldAlert() {
+        let textFieldArray = [self.code1TextField,self.code2TextField,self.code3TextField,self.code4TextField,self.code5TextField,self.code6TextField]
+        for item in textFieldArray {
+            item?.superview?.border(NSColor.red, 1, 2)
+        }
+    }
 }
 
 extension KMVerificationCodeView: NSTextViewDelegate {

+ 13 - 13
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/BookMarks/KMBookMarkViewController.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="KMBookMarkViewController" customModule="PDF_Office" customModuleProvider="target">
+        <customObject id="-2" userLabel="File's Owner" customClass="KMBookMarkViewController" customModule="PDF_Master" customModuleProvider="target">
             <connections>
                 <outlet property="addBookButton" destination="3yQ-un-hNE" id="kxu-QV-1AM"/>
                 <outlet property="bigTipLabel" destination="BO0-hw-zv2" id="hvD-cO-67N"/>
@@ -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="419"/>
+                            <rect key="frame" x="0.0" y="0.0" width="260" height="417"/>
                             <subviews>
                                 <view translatesAutoresizingMaskIntoConstraints="NO" id="bIK-U7-Zqf">
-                                    <rect key="frame" x="0.0" y="371" width="260" height="48"/>
+                                    <rect key="frame" x="0.0" y="369" 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="371"/>
+                            <rect key="frame" x="0.0" y="0.0" width="260" height="369"/>
                             <view key="contentView" id="5Km-Gq-7Y6">
-                                <rect key="frame" x="0.0" y="0.0" width="260" height="371"/>
+                                <rect key="frame" x="0.0" y="0.0" width="260" height="369"/>
                                 <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="369"/>
+                                        <rect key="frame" x="0.0" y="2" width="260" height="367"/>
                                         <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="369"/>
+                                            <rect key="frame" x="0.0" y="0.0" width="260" height="367"/>
                                             <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="369"/>
+                                                    <rect key="frame" x="0.0" y="0.0" width="260" height="367"/>
                                                     <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"/>
@@ -122,7 +122,7 @@ Gw
                                                             </textFieldCell>
                                                             <tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
                                                             <prototypeCellViews>
-                                                                <tableCellView identifier="KMBookCellView" id="qIV-zJ-BTn" customClass="KMBookCellView" customModule="PDF_Office" customModuleProvider="target">
+                                                                <tableCellView identifier="KMBookCellView" id="qIV-zJ-BTn" customClass="KMBookCellView" customModule="PDF_Master" customModuleProvider="target">
                                                                     <rect key="frame" x="8" y="0.0" width="243" height="35"/>
                                                                     <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                                                     <subviews>
@@ -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="371"/>
+                            <rect key="frame" x="0.0" y="0.0" width="260" height="369"/>
                             <subviews>
                                 <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="8R5-DW-bXb">
-                                    <rect key="frame" x="64" y="92" width="132" height="128"/>
+                                    <rect key="frame" x="64" y="90" 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="62" width="136" height="17"/>
+                                    <rect key="frame" x="62" y="60" 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="47" width="194" height="15"/>
+                                    <rect key="frame" x="33" y="45" 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"/>

+ 8 - 5
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Outline/KMOutlineViewController.swift

@@ -808,7 +808,10 @@ extension KMOutlineViewController {
         NSApp.mainWindow?.makeFirstResponder(self.BOTAOutlineView)
         let tempOutlineView = self.BOTAOutlineView!
         
-        for outlineItem in outlineItems {
+        var tempOutlineItems: [KMBOTAOutlineItem] = outlineItems
+        tempOutlineItems.sort(){$0.toIndex > $1.toIndex}
+        
+        for outlineItem in tempOutlineItems {
             outlineItem.outline.removeFromParent()
             let index = outlineItem.parent?.children.firstIndex(of: outlineItem)
             outlineItem.toIndex = index!
@@ -816,7 +819,7 @@ extension KMOutlineViewController {
         }
         
         //展开
-        for outlineItem in outlineItems {
+        for outlineItem in tempOutlineItems {
             outlineItem.parent?.isItemExpanded = true
             tempOutlineView.outlineView.expandItem(outlineItem.parent)
         }
@@ -828,7 +831,7 @@ extension KMOutlineViewController {
         //刷新nil数据
         self.updateExtempViewState()
         self.listView.undoManager?.registerUndo(withTarget: self) { [unowned self] targetType in
-            self.addOutline(outlineItems: outlineItems)
+            self.addOutline(outlineItems: tempOutlineItems)
         }
     }
     
@@ -860,7 +863,7 @@ extension KMOutlineViewController {
         }
         
         //展开
-        DispatchQueue.main.async {
+//        DispatchQueue.main.async {
             for outlineItem in tempOutlineItems {
                 var tempParent = outlineItem
                 while tempParent.parent != nil {
@@ -870,7 +873,7 @@ extension KMOutlineViewController {
                 }
                 tempOutlineView.outlineView.expandItem(tempParent.parent)
             }
-        }
+//        }
         
         self.updateExtempViewState()
         self.listView.undoManager?.registerUndo(withTarget: self) { [unowned self] targetType in

+ 2 - 3
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Outline/OutlineView/View/KMBOTAOutlineCellView.xib

@@ -1,12 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <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="21701"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
-        <customObject id="-2" userLabel="File's Owner" customClass="KMBOTAOutlineCellView" customModule="PDF_Office" customModuleProvider="target">
+        <customObject id="-2" userLabel="File's Owner" customClass="KMBOTAOutlineCellView" customModule="PDF_Master" customModuleProvider="target">
             <connections>
                 <outlet property="contentView" destination="c22-O7-iKe" id="RjV-fa-1Ne"/>
                 <outlet property="iconImageView" destination="ro3-FU-Blg" id="12F-r0-Osb"/>
@@ -30,7 +29,7 @@
                 </imageView>
                 <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="qgr-rq-q7D">
                     <rect key="frame" x="22" y="12" width="444" height="16"/>
-                    <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="GUU-ti-yMJ">
+                    <textFieldCell key="cell" lineBreakMode="truncatingTail" title="Label" id="GUU-ti-yMJ">
                         <font key="font" metaFont="system"/>
                         <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
                         <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>