Jelajahi Sumber

[保存] - 保存动画优化

liujiajie 6 bulan lalu
induk
melakukan
eae7a03a14

+ 4 - 2
PDF Office/PDF Master/Class/Document/KMMainDocument.swift

@@ -978,9 +978,9 @@ typealias KMMainDocumentCloudUploadHanddler = (@escaping(Bool, String)->()) -> (
             return
         }
         var success = true
-        NotificationCenter.default.post(name: Notification.Name(rawValue: "kCPDFDocumentDidBeginWriteNotification"), object: self)
         if !self.isHome {
             if mainViewController != nil {
+                mainViewController?.savePdfAlertView()
                 if mainViewController?.document != nil {
                     self.mainViewController?.commitEditingIfNeed()
                     
@@ -1019,7 +1019,9 @@ typealias KMMainDocumentCloudUploadHanddler = (@escaping(Bool, String)->()) -> (
         if success && isNewCreated && NSDocument.SaveOperationType.saveAsOperation == saveOperation {
             isNewCreated = false
         }
-        NotificationCenter.default.post(name: Notification.Name(rawValue: "kCPDFDocumentDidEndWriteNotification"), object: self)
+        if mainViewController != nil {
+            mainViewController?.savePdfFinishAlertView()
+        }
     }
     
     private func _km_saveForWatermark(openAccessoryView: Bool = true, subscribeDidClick: (()->Void)? = nil, callback:@escaping (_ needSave: Bool, _ param: Any...)->Void) {

+ 2 - 2
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+Action.swift

@@ -2406,7 +2406,7 @@ extension KMMainViewController {
         }
     }
     
-    func pdfSaveAlertView(_ sender: NSNotification) {
+    func savePdfAlertView() {
         if AutoSaveManager.manager.isSaving ||  AutoSaveManager.manager.isSaveNoti{
             return
         }
@@ -2424,7 +2424,7 @@ extension KMMainViewController {
         }
     }
     
-    func pdfSaveFinishAlertView(_ sender: NSNotification) {
+    func savePdfFinishAlertView() {
         if !AutoSaveManager.manager.isSaveNoti{
             return
         }

+ 0 - 2
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController.swift

@@ -410,8 +410,6 @@ import Cocoa
         NotificationCenter.default.addObserver(self, selector: #selector(didShowFullScreenNotification), name: NSWindow.didShowFullScreenNotification, object: nil)
         NotificationCenter.default.addObserver(self, selector: #selector(didAddContentViewNotification), name: NSWindow.didAddContentViewNotification, object: nil)
         NotificationCenter.default.addObserver(self, selector: #selector(addAutoSaveEvent), name: AutoSaveManager.kTimeValueChangedNotificationName, object: nil)
-        NotificationCenter.default.addObserver(self, selector: #selector(pdfSaveAlertView(_:)), name: Notification.Name("kCPDFDocumentDidBeginWriteNotification"), object: nil)
-        NotificationCenter.default.addObserver(self, selector: #selector(pdfSaveFinishAlertView(_:)), name: Notification.Name("kCPDFDocumentDidEndWriteNotification"), object: nil)
         
         Task {
             self.addAutoSaveEvent()