Browse Source

[保存] - 保存动画优化

liujiajie 6 tháng trước cách đây
mục cha
commit
eae7a03a14

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

@@ -978,9 +978,9 @@ typealias KMMainDocumentCloudUploadHanddler = (@escaping(Bool, String)->()) -> (
             return
             return
         }
         }
         var success = true
         var success = true
-        NotificationCenter.default.post(name: Notification.Name(rawValue: "kCPDFDocumentDidBeginWriteNotification"), object: self)
         if !self.isHome {
         if !self.isHome {
             if mainViewController != nil {
             if mainViewController != nil {
+                mainViewController?.savePdfAlertView()
                 if mainViewController?.document != nil {
                 if mainViewController?.document != nil {
                     self.mainViewController?.commitEditingIfNeed()
                     self.mainViewController?.commitEditingIfNeed()
                     
                     
@@ -1019,7 +1019,9 @@ typealias KMMainDocumentCloudUploadHanddler = (@escaping(Bool, String)->()) -> (
         if success && isNewCreated && NSDocument.SaveOperationType.saveAsOperation == saveOperation {
         if success && isNewCreated && NSDocument.SaveOperationType.saveAsOperation == saveOperation {
             isNewCreated = false
             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) {
     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{
         if AutoSaveManager.manager.isSaving ||  AutoSaveManager.manager.isSaveNoti{
             return
             return
         }
         }
@@ -2424,7 +2424,7 @@ extension KMMainViewController {
         }
         }
     }
     }
     
     
-    func pdfSaveFinishAlertView(_ sender: NSNotification) {
+    func savePdfFinishAlertView() {
         if !AutoSaveManager.manager.isSaveNoti{
         if !AutoSaveManager.manager.isSaveNoti{
             return
             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(didShowFullScreenNotification), name: NSWindow.didShowFullScreenNotification, object: nil)
         NotificationCenter.default.addObserver(self, selector: #selector(didAddContentViewNotification), name: NSWindow.didAddContentViewNotification, 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(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 {
         Task {
             self.addAutoSaveEvent()
             self.addAutoSaveEvent()