Browse Source

【综合】启动偶发crash修复(UX提的bug)

tangchao 1 year ago
parent
commit
29310d9624

+ 25 - 32
PDF Office/PDF Master/Class/Document/KMMainDocument.swift

@@ -185,36 +185,34 @@ typealias KMMainDocumentCloudUploadHanddler = (@escaping(Bool, String)->()) -> (
         
         self.view = mainViewController?.view
         
-        if currentWindowController != nil {
-            if currentWindowController?.browser != nil {
+        if let currentBrowser = currentWindowController?.browser {
 //                currentWindowController?.browser.add(self, at: Int32()-1, inForeground: true)
 //                self.addWindowController(currentWindowController!)
 //                mainViewController.browserWindowController = currentWindowController
 
-                let activeBrowser = (currentWindowController?.browser.activeTabContents())! as CTTabContents
-                let activeIndex = Int((currentWindowController?.browser.activeTabIndex())!)
-                self.addWindowController(currentWindowController!)
-                self.mainViewController?.browserWindowController = currentWindowController
+            let activeBrowser = currentBrowser.activeTabContents()
+            let activeIndex = currentBrowser.activeTabIndex()
+            self.addWindowController(currentWindowController!)
+            self.mainViewController?.browserWindowController = currentWindowController
 
-                let ishome = activeBrowser.isHome as Bool
-                let isfirstTab = (activeIndex == 0)
-                if ishome && !isfirstTab {
-                    // 替换 document
-                    currentWindowController?.browser.replaceTabContents(at: Int32(activeIndex), with: self)
-                    // 刷新标签
-                    currentWindowController?.browser.updateTabState(at: Int32(activeIndex))
-                    
-                    // 刷新 home icon
-                    if let tabStripController = currentWindowController?.tabStripController {
-                        if let view = tabStripController.view(at: UInt(activeIndex)) as? CTTabView {
-                            view.controller().isHome = self.isHome
-                            view.controller().isNewTab = self.isNewTab
-                            view.controller().updateUI()
-                        }
+            let ishome = activeBrowser?.isHome ?? false
+            let isfirstTab = (activeIndex == 0)
+            if ishome && !isfirstTab {
+                // 替换 document
+                currentWindowController?.browser.replaceTabContents(at: Int32(activeIndex), with: self)
+                // 刷新标签
+                currentWindowController?.browser.updateTabState(at: Int32(activeIndex))
+                
+                // 刷新 home icon
+                if let tabStripController = currentWindowController?.tabStripController {
+                    if let view = tabStripController.view(at: UInt(activeIndex)) as? CTTabView {
+                        view.controller().isHome = self.isHome
+                        view.controller().isNewTab = self.isNewTab
+                        view.controller().updateUI()
                     }
-                } else {
-                    currentWindowController?.browser.add(self, at: Int32()-1, inForeground: true)
                 }
+            } else {
+                currentWindowController?.browser.add(self, at: Int32()-1, inForeground: true)
             }
         }
     }
@@ -503,15 +501,10 @@ typealias KMMainDocumentCloudUploadHanddler = (@escaping(Bool, String)->()) -> (
                 }
             }
         }
-        if currentWindowController != nil {
-            if currentWindowController?.browser != nil {
-
-                let activeBrowser = (currentWindowController?.browser.activeTabContents())! as CTTabContents
-                let activeIndex = Int((currentWindowController?.browser.activeTabIndex())!)
-                if self == activeBrowser {
-                    super.updateChangeCount(change)
-                    return
-                }
+        if let currentBroser = currentWindowController?.browser {
+            if self.isEqual(to: currentBroser.activeTabContents()) {
+                super.updateChangeCount(change)
+                return
             }
         }
 

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

@@ -169,7 +169,6 @@ import Cocoa
         self.loadFunctionGuide()
         
         self.loadAIIconView()
-        
     }
     
     override func viewDidAppear() {

+ 13 - 13
PDF Office/PDF Master/Class/Purchase/DMG/KMPurchaseCompareDMGWindowController.xib

@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22505" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21507" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
     <dependencies>
         <deployment identifier="macosx"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22505"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21507"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
@@ -61,7 +61,7 @@
             <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES" fullSizeContentView="YES"/>
             <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
             <rect key="contentRect" x="160" y="33" width="932" height="610"/>
-            <rect key="screenRect" x="0.0" y="0.0" width="1920" height="1055"/>
+            <rect key="screenRect" x="0.0" y="0.0" width="1440" height="875"/>
             <value key="minSize" type="size" width="932" height="610"/>
             <value key="maxSize" type="size" width="932" height="1110"/>
             <view key="contentView" wantsLayer="YES" id="se5-gp-TjO">
@@ -343,7 +343,7 @@
                                                     <rect key="frame" x="1" y="1" width="160" height="38"/>
                                                     <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                                     <subviews>
-                                                        <button focusRingType="none" allowsExpansionToolTips="YES" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="4fI-f7-Qnp" customClass="KMButton" customModule="PDF_Reader_Pro" customModuleProvider="target">
+                                                        <button focusRingType="none" verticalHuggingPriority="750" fixedFrame="YES" allowsExpansionToolTips="YES" translatesAutoresizingMaskIntoConstraints="NO" id="4fI-f7-Qnp" customClass="KMButton" customModule="PDF_Reader_Pro" customModuleProvider="target">
                                                             <rect key="frame" x="0.0" y="0.0" width="162" height="40"/>
                                                             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                                             <buttonCell key="cell" type="square" title="Free Trial" bezelStyle="shadowlessSquare" alignment="center" lineBreakMode="truncatingMiddle" focusRingType="none" imageScaling="proportionallyDown" inset="2" id="OUe-aZ-jdt">
@@ -529,14 +529,14 @@
                                             </customView>
                                             <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="0S4-Y8-qlW" customClass="KMButton" customModule="PDF_Reader_Pro" customModuleProvider="target">
                                                 <rect key="frame" x="0.0" y="0.0" width="200" height="40"/>
-                                                <buttonCell key="cell" type="bevel" bezelStyle="rounded" imagePosition="overlaps" alignment="center" lineBreakMode="charWrapping" imageScaling="axesIndependently" inset="2" id="nfY-Ib-pyH">
-                                                    <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
-                                                    <font key="font" metaFont="smallSystem"/>
-                                                </buttonCell>
                                                 <constraints>
                                                     <constraint firstAttribute="height" constant="40" id="gtc-cl-Yxg"/>
                                                     <constraint firstAttribute="width" constant="200" id="rJW-IL-6Pp"/>
                                                 </constraints>
+                                                <buttonCell key="cell" type="bevel" bezelStyle="rounded" imagePosition="overlaps" alignment="center" lineBreakMode="charWrapping" imageScaling="axesIndependently" inset="2" id="nfY-Ib-pyH">
+                                                    <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                                    <font key="font" metaFont="smallSystem"/>
+                                                </buttonCell>
                                                 <connections>
                                                     <action selector="aiPurchaseButtonClick:" target="-2" id="1LH-Br-IFZ"/>
                                                 </connections>
@@ -648,16 +648,16 @@
                                                 <rect key="frame" x="101" y="196" width="20" height="20"/>
                                                 <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="ic_Tooltip" id="g1R-8J-uDu"/>
                                             </imageView>
-                                            <button translatesAutoresizingMaskIntoConstraints="NO" id="3mX-DM-Ssw" customClass="KMButton">
+                                            <button translatesAutoresizingMaskIntoConstraints="NO" id="3mX-DM-Ssw" customClass="KMButton" customModule="PDF_Reader_Pro" customModuleProvider="target">
                                                 <rect key="frame" x="101" y="196" width="20" height="20"/>
-                                                <buttonCell key="cell" type="roundRect" bezelStyle="roundedRect" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="kWd-ga-hI9">
-                                                    <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
-                                                    <font key="font" metaFont="cellTitle"/>
-                                                </buttonCell>
                                                 <constraints>
                                                     <constraint firstAttribute="height" constant="20" id="DQB-Bc-Hea"/>
                                                     <constraint firstAttribute="width" constant="20" id="rlY-sN-tsh"/>
                                                 </constraints>
+                                                <buttonCell key="cell" type="roundRect" bezelStyle="roundedRect" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="kWd-ga-hI9">
+                                                    <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                                    <font key="font" metaFont="cellTitle"/>
+                                                </buttonCell>
                                             </button>
                                             <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="Xkj-ZO-il5">
                                                 <rect key="frame" x="0.0" y="168" width="20" height="20"/>

+ 2 - 18
PDF Office/PDF Reader Pro.xcodeproj/xcuserdata/kdanmobile.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -48,8 +48,8 @@
             endingColumnNumber = "9223372036854775807"
             startingLineNumber = "1793"
             endingLineNumber = "1793"
-            landmarkName = "KMBrowserWindowController"
-            landmarkType = "21">
+            landmarkName = "menuItemAction_annotation(_:)"
+            landmarkType = "7">
          </BreakpointContent>
       </BreakpointProxy>
       <BreakpointProxy
@@ -643,21 +643,5 @@
             landmarkType = "7">
          </BreakpointContent>
       </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            uuid = "8D0F00DF-24EC-4ED1-B41F-8D21D09756B2"
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "PDF Master/Class/Purchase/DMG/Verification/KMVerificationMessageViewController.m"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "381"
-            endingLineNumber = "381"
-            landmarkName = "-buttonAction:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
    </Breakpoints>
 </Bucket>