Bläddra i källkod

【2025】【综合】
1、网络提示移除
2、页眉页脚,贝茨码空状态完善

niehaoyu 1 dag sedan
förälder
incheckning
549c92bb40

+ 39 - 39
PDF Office/PDF Master/Class/KMResourceDownload/KMResourceDownloadManager.swift

@@ -53,45 +53,45 @@ class KMResourceDownloadManager: NSObject {
         self.progressBlock = progress
         self.downloadResultBlock = result
         
-        KMRequestServer.requestServer.reachabilityStatusChange { [weak self] status in
-            if status == .notReachable {
-                KMPrint("无网络")
-                self?.downloadTask?.cancel()
-                self?.downloadTask = nil
-                self?.downloadResultBlock?(false, .none)
-                DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.2, execute: { [weak self] in
-                    if self?.reachabilityAlert == nil {
-                        self?.reachabilityAlert = NSAlert()
-                        self?.reachabilityAlert?.messageText = KMLocalizedString("Network Disconnected", comment: "")
-                        self?.reachabilityAlert?.informativeText = KMLocalizedString("Please connect to the internet and download again.", comment: "")
-                        self?.reachabilityAlert?.addButton(withTitle: KMLocalizedString("Retry", comment: ""))
-                        self?.reachabilityAlert?.addButton(withTitle: KMLocalizedString("Cancel", comment: ""))
-                        var window = NSWindow.currentWindow()
-                        if window != nil {
-                            self?.reachabilityAlert?.beginSheetModal(for: window) { result in
-                                if (result == .alertSecondButtonReturn) {
-                                    self?.reachabilityAlert = nil
-
-                                    self?.cancelDownload()
-                                } else if result == .alertFirstButtonReturn {
-                                    self?.reachabilityAlert = nil
-                                    self?.downloadResultBlock?(false, .retry)
-                                    self?.cancelDownload()
-                                    return
-                                }
-                                self?.reachabilityAlert = nil
-                            }
-                        } else {
-                            self?.reachabilityAlert = nil
-                        }
-                    } else {
-                        self?.reachabilityAlert = nil
-                    }
-                })
-            } else {
-                KMPrint("有网络")
-            }
-        }
+//        KMRequestServer.requestServer.reachabilityStatusChange { [weak self] status in
+//            if status == .notReachable {
+//                KMPrint("无网络")
+//                self?.downloadTask?.cancel()
+//                self?.downloadTask = nil
+//                self?.downloadResultBlock?(false, .none)
+//                DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.2, execute: { [weak self] in
+//                    if self?.reachabilityAlert == nil {
+//                        self?.reachabilityAlert = NSAlert()
+//                        self?.reachabilityAlert?.messageText = KMLocalizedString("Network Disconnected", comment: "")
+//                        self?.reachabilityAlert?.informativeText = KMLocalizedString("Please connect to the internet and download again.", comment: "")
+//                        self?.reachabilityAlert?.addButton(withTitle: KMLocalizedString("Retry", comment: ""))
+//                        self?.reachabilityAlert?.addButton(withTitle: KMLocalizedString("Cancel", comment: ""))
+//                        var window = NSWindow.currentWindow()
+//                        if window != nil {
+//                            self?.reachabilityAlert?.beginSheetModal(for: window) { result in
+//                                if (result == .alertSecondButtonReturn) {
+//                                    self?.reachabilityAlert = nil
+//
+//                                    self?.cancelDownload()
+//                                } else if result == .alertFirstButtonReturn {
+//                                    self?.reachabilityAlert = nil
+//                                    self?.downloadResultBlock?(false, .retry)
+//                                    self?.cancelDownload()
+//                                    return
+//                                }
+//                                self?.reachabilityAlert = nil
+//                            }
+//                        } else {
+//                            self?.reachabilityAlert = nil
+//                        }
+//                    } else {
+//                        self?.reachabilityAlert = nil
+//                    }
+//                })
+//            } else {
+//                KMPrint("有网络")
+//            }
+//        }
         
         if self.downloadTask == nil {
             self.downloadXML { [unowned self] content in

+ 27 - 25
PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/Bates/Views/KMBatesTemplateController.swift

@@ -280,32 +280,34 @@ extension KMBatesTemplateController: NSCollectionViewDelegate, NSCollectionViewD
     public func collectionView(_ collectionView: NSCollectionView, layout collectionViewLayout: NSCollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> NSSize {
         var itemHeight = 56
 
-        let dataModel = KMBatesManager.defaultManager.datas[indexPath.item]
-        if dataModel.topLeftString.count > 0 {
-            itemHeight += 24
-            itemHeight += 8
-        }
-        if dataModel.topCenterString.count > 0 {
-            itemHeight += 24
-            itemHeight += 8
-        }
-        if dataModel.topRightString.count > 0 {
-            itemHeight += 24
-            itemHeight += 8
-        }
-        if dataModel.bottomLeftString.count > 0 {
-            itemHeight += 24
-            itemHeight += 8
-        }
-        if dataModel.bottomCenterString.count > 0 {
-            itemHeight += 24
-            itemHeight += 8
-        }
-        if dataModel.bottomRightString.count > 0 {
-            itemHeight += 24
-            itemHeight += 8
+        if indexPath.item < KMBatesManager.defaultManager.datas.count {
+            let dataModel = KMBatesManager.defaultManager.datas[indexPath.item]
+            if dataModel.topLeftString.count > 0 {
+                itemHeight += 24
+                itemHeight += 8
+            }
+            if dataModel.topCenterString.count > 0 {
+                itemHeight += 24
+                itemHeight += 8
+            }
+            if dataModel.topRightString.count > 0 {
+                itemHeight += 24
+                itemHeight += 8
+            }
+            if dataModel.bottomLeftString.count > 0 {
+                itemHeight += 24
+                itemHeight += 8
+            }
+            if dataModel.bottomCenterString.count > 0 {
+                itemHeight += 24
+                itemHeight += 8
+            }
+            if dataModel.bottomRightString.count > 0 {
+                itemHeight += 24
+                itemHeight += 8
+            }
+            itemHeight -= 8
         }
-        itemHeight -= 8
 
         return CGSize(width: 232, height: itemHeight)
     }

+ 27 - 24
PDF Office/PDF Master/KMClass/KMPDFViewController/HeaderFooter/Views/KMHFTemplateController.swift

@@ -276,31 +276,34 @@ extension KMHFTemplateController: NSCollectionViewDelegate, NSCollectionViewData
         var itemHeight = 56
         
         let dataModel = KMHeaderFooterManager.defaultManager.headFooterObjects[indexPath.item]
-        if dataModel.topLeftString.count > 0 {
-            itemHeight += 24
-            itemHeight += 8
-        }
-        if dataModel.topCenterString.count > 0 {
-            itemHeight += 24
-            itemHeight += 8
-        }
-        if dataModel.topRightString.count > 0 {
-            itemHeight += 24
-            itemHeight += 8
-        }
-        if dataModel.bottomLeftString.count > 0 {
-            itemHeight += 24
-            itemHeight += 8
-        }
-        if dataModel.bottomCenterString.count > 0 {
-            itemHeight += 24
-            itemHeight += 8
-        }
-        if dataModel.bottomRightString.count > 0 {
-            itemHeight += 24
-            itemHeight += 8
+        if indexPath.item < KMHeaderFooterManager.defaultManager.headFooterObjects.count {
+            
+            if dataModel.topLeftString.count > 0 {
+                itemHeight += 24
+                itemHeight += 8
+            }
+            if dataModel.topCenterString.count > 0 {
+                itemHeight += 24
+                itemHeight += 8
+            }
+            if dataModel.topRightString.count > 0 {
+                itemHeight += 24
+                itemHeight += 8
+            }
+            if dataModel.bottomLeftString.count > 0 {
+                itemHeight += 24
+                itemHeight += 8
+            }
+            if dataModel.bottomCenterString.count > 0 {
+                itemHeight += 24
+                itemHeight += 8
+            }
+            if dataModel.bottomRightString.count > 0 {
+                itemHeight += 24
+                itemHeight += 8
+            }
+            itemHeight -= 8
         }
-        itemHeight -= 8
         
         return CGSize(width: 232, height: itemHeight)
     }