Jelajahi Sumber

【综合】引导优化

niehaoyu 10 bulan lalu
induk
melakukan
5f6b236b1e

+ 0 - 1
PDF Office/PDF Master/Class/AD/KMAdsWebView.swift

@@ -318,7 +318,6 @@ class KMAdsWebView: NSView, WKNavigationDelegate, CAAnimationDelegate {
             timer?.invalidate()
         }
 
-        closeButton.alphaValue = 0
     }
 
     func animationDidStop(_ anim: CAAnimation, finished flag: Bool) {

+ 19 - 17
PDF Office/PDF Master/Class/GuideInfo/KMGuideInfoWindowController.swift

@@ -85,24 +85,20 @@ class KMGuideInfoWindowController: NSWindowController {
         }
     }
     
+    static var currentWindowController: KMGuideInfoWindowController!
+    
     @objc static func currentWC() -> KMGuideInfoWindowController {
-        if let controller: KMGuideInfoWindowController = KMGuideInfoWindowController.fetchSampleController() {
-            return controller
+        if currentWindowController != nil {
+            return currentWindowController
         } else {
             let guideInfoWC: KMGuideInfoWindowController = KMGuideInfoWindowController.init(windowNibName: "KMGuideInfoWindowController")
+            currentWindowController = guideInfoWC;
             return guideInfoWC
         }
     }
     
-    static func fetchSampleController() -> KMGuideInfoWindowController? {
-        for window in NSApp.windows {
-            let controller = window.windowController
-            if controller is KMGuideInfoWindowController {
-                return controller as? KMGuideInfoWindowController
-            }
-        }
-        
-        return nil
+    deinit {
+        print("deinit Action")
     }
     
     //MARK: SystemMethod
@@ -199,7 +195,8 @@ class KMGuideInfoWindowController: NSWindowController {
                 }
                 self.openFileGuidePanel.frame = self.coverView.bounds
                 self.openFileGuidePanel.autoresizingMask = [.width, .height]
-                self.openFileGuidePanel.clickHandle = {[unowned self] view, actionType in
+                self.openFileGuidePanel.clickHandle = {[weak self] view, actionType in
+                    guard let self = self else { return }
                     if actionType == .skip {
                         //Skip->数字签名
                         //Skip->
@@ -244,7 +241,8 @@ class KMGuideInfoWindowController: NSWindowController {
                 }
                 self.openFileGuideProperty.frame = self.coverView.bounds
                 self.openFileGuideProperty.autoresizingMask = [.width, .height]
-                self.openFileGuideProperty.clickHandle = {[unowned self] view, actionType in
+                self.openFileGuideProperty.clickHandle = {[weak self] view, actionType in
+                    guard let self = self else { return }
                     if actionType == .skip {
                         //Skip->数字签名
                         //Skip->
@@ -297,7 +295,8 @@ class KMGuideInfoWindowController: NSWindowController {
                 }
                 self.openFileGuideToolbar.frame = self.coverView.bounds
                 self.openFileGuideToolbar.autoresizingMask = [.width, .height]
-                self.openFileGuideToolbar.clickHandle = {[unowned self] view, actionType in
+                self.openFileGuideToolbar.clickHandle = {[weak self] view, actionType in
+                    guard let self = self else { return }
                     if actionType == .skip {
                         //Skip->数字签名
                         //Skip->
@@ -360,7 +359,8 @@ class KMGuideInfoWindowController: NSWindowController {
                 self.openFileFunctionView.frame = self.coverView.bounds
                 self.openFileFunctionView.autoresizingMask = [.width, .height]
                 self.openFileFunctionView.type =  self.type
-                self.openFileFunctionView.clickHandle = {[unowned self] view, actionType in
+                self.openFileFunctionView.clickHandle = {[weak self] view, actionType in
+                    guard let self = self else { return }
                     if self.type == .digitalSignGuide {
                         guard let callBack = self.finishHandle else {
                             return
@@ -383,7 +383,8 @@ class KMGuideInfoWindowController: NSWindowController {
                 }
                 self.convertGuideView.frame = self.coverView.bounds
                 self.convertGuideView.autoresizingMask = [.width, .height]
-                self.convertGuideView.clickHandle = {[unowned self] view, actionType in
+                self.convertGuideView.clickHandle = {[weak self] view, actionType in
+                    guard let self = self else { return }
                     if actionType == .skip {
                         self.closeAction()
                     } else if actionType == .purchase {
@@ -419,7 +420,8 @@ class KMGuideInfoWindowController: NSWindowController {
                 }
                 self.aiIconGuideView.frame = self.coverView.bounds
                 self.aiIconGuideView.autoresizingMask = [.width, .height]
-                self.aiIconGuideView.clickHandle = {[unowned self] view, actionType in
+                self.aiIconGuideView.clickHandle = {[weak self] view, actionType in
+                    guard let self = self else { return }
                     if actionType == .getIt {
                         self.closeAction()
                     }