Ver Fonte

【保存】数字签名、合并等需要保存文档的地方,概率性出现卡在保存过程中的情况,只能强制退出APP

liujiajie há 6 meses atrás
pai
commit
9955637f5c

+ 1 - 0
PDF Office/PDF Master/Class/AutoSave/Tools/AutoSaveManager.swift

@@ -31,6 +31,7 @@ public let KAutoSaveTimeValueChangedNoti = "KAutoSaveTimeValueChangedNoti"
     var autoSaveDidEndAction = false
     // /当前是否正在保存
     var isSaving = false
+    var isSaveNoti = false
     
     private var _autoSaveFolder: String = ""
     var autoSaveFolder: String {

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

@@ -2410,6 +2410,7 @@ extension KMMainViewController {
         if AutoSaveManager.manager.isSaving{
             return
         }
+        AutoSaveManager.manager.isSaveNoti = true
         var num = 0
         if self.listView.document != nil{
             num = Int(self.listView.document.pageCount)
@@ -2424,9 +2425,10 @@ extension KMMainViewController {
     }
     
     func pdfSaveFinishAlertView(_ sender: NSNotification) {
-        if AutoSaveManager.manager.isSaving{
+        if !AutoSaveManager.manager.isSaveNoti{
             return
         }
+        AutoSaveManager.manager.isSaveNoti = false
         if Thread.current.isMainThread {
             self.dismissProgressSheet()
         } else {

+ 3 - 4
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController.swift

@@ -1504,13 +1504,12 @@ import Cocoa
             DispatchQueue.main.asyncAfter(deadline: .now()+0.1) {
                 // 隐藏进度
                 self.hiddenProgressWindow()
-                
+                DispatchQueue.main.asyncAfter(deadline: .now()+1) {
+                    AutoSaveManager.manager.isSaving = false
+                }
                 // 回调
                 callback()
             }
-            DispatchQueue.main.asyncAfter(deadline: .now()+1) {
-                AutoSaveManager.manager.isSaving = false
-            }
         }
     }
     func SaveTempPDFDocumentToURLPath(tempPath: String) {