ソースを参照

【综合】处理编译器警告代码

tangchao 11 ヶ月 前
コミット
6c543231ae

+ 13 - 48
PDF Office/PDF Master/AppDelegate.swift

@@ -167,7 +167,6 @@ class AppDelegate: NSObject, NSApplicationDelegate, iRateDelegate{
         
 #if VERSION_DMG
         VerificationManager.default()
-        
 #else
         self.initiVersionData()
         IAPProductsManager.default().initIAP()
@@ -239,15 +238,15 @@ class AppDelegate: NSObject, NSApplicationDelegate, iRateDelegate{
                 if urlString.contains("open=expired") {
                     KMPrint("刷新用户信息")
                     if !KMLightMemberManager.manager.isLogin() && NSApp.mainWindow != nil {
-                        KMLoginWindowController.show(window: NSApp.mainWindow!)
+                        _ = KMLoginWindowController.show(window: NSApp.mainWindow!)
                     } else {
                         if NSApp.mainWindow != nil && KMLightMemberManager.manager.isLogin() {
-                            KMAccountInfoWindowController.show(window: NSApp.mainWindow!)
+                            _ = KMAccountInfoWindowController.show(window: NSApp.mainWindow!)
                         }
                     }
                 } else if urlString.contains("open=success") {
                     if !KMLightMemberManager.manager.isLogin() && NSApp.mainWindow != nil {
-                        KMLoginWindowController.show(window: NSApp.mainWindow!)
+                        _ = KMLoginWindowController.show(window: NSApp.mainWindow!)
                     } else {
                         KMPurchaseManager.manager.restorePurchases { isSuccess, error  in
                             if isSuccess {
@@ -265,7 +264,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, iRateDelegate{
             // 执行相应的操作
             if url.scheme == "subscriptionSchemes" {
                 //刷新用户信息
-                KMRequestServerManager.manager.getUserInfo { [weak self] success, data, error, isLocal in
+                KMRequestServerManager.manager.getUserInfo { success, data, error, isLocal in
 
                 }
                 
@@ -399,9 +398,9 @@ class AppDelegate: NSObject, NSApplicationDelegate, iRateDelegate{
     
     //MARK: - iVersion
     func initiVersionData() -> Void{
-    #if VERSION_DMG
-        return
-    #endif
+#if VERSION_DMG
+        
+#else
         let tVersion = iVersion.sharedInstance()
         tVersion?.applicationBundleID = Bundle.main.bundleIdentifier
 
@@ -432,7 +431,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, iRateDelegate{
         tStr = "LATER";
         tVersion!.remindButtonLabel = tVersion?.localizedString(forKey: tStr, withDefault: tStr)
         tVersion!.ignoreButtonLabel = ""
-         
+#endif
     }
     
     // MARK: - Menu
@@ -459,7 +458,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, iRateDelegate{
         
         let PDFOfficeMenu = mainMenu?.item(at: 0)?.submenu
 #if VERSION_DMG
-        PDFOfficeMenu?.insertItem(withTitle: NSLocalizedString("Check for Updates", comment: ""), action: #selector(checkForUpdates), target: self, at: 1)
+        _ = PDFOfficeMenu?.insertItem(withTitle: NSLocalizedString("Check for Updates", comment: ""), action: #selector(checkForUpdates), target: self, at: 1)
         let accountRefreshItem = PDFOfficeMenu?.insertItem(withTitle: NSLocalizedString("Account Refresh", comment: ""), action: #selector(accountRefreshAction), target: self, at: 8)
         accountRefreshItem?.tag = kKMMainMenuAccountRefreshItemTag
 #endif
@@ -535,42 +534,8 @@ class AppDelegate: NSObject, NSApplicationDelegate, iRateDelegate{
             return
         }
 
-        // 有使用付费功能
-        Task { @MainActor in
-            if await (KMLightMemberManager.manager.canPayFunction() == false) {
-                let _ = KMSubscribeWaterMarkWindowController.show(window: NSApp.mainWindow!, isContinue: true) { isSubscribeSuccess, isWaterMarkExport, isClose in
-                    if (isClose) {
-                        return
-                    }
-                    if (isSubscribeSuccess) {
-                        let represent : NSSharingService = sender.representedObject as! NSSharingService
-                        represent.perform(withItems: [document.fileURL as Any])
-                        return
-                    }
-                    if (isWaterMarkExport) {
-                        let doucumentURL = document.fileURL
-                        let docDir = NSTemporaryDirectory()
-                        let documentName : String = doucumentURL!.path.lastPathComponent
-                        let path = docDir.stringByAppendingPathComponent(documentName)
-            
-                        let data = KMTools.saveWatermarkDocument(document: document.mainViewController!.document!, to: URL(fileURLWithPath: path), secureOptions: document.mainViewController!.secureOptions, removePWD: document.mainViewController!.removeSecureFlag)
-                        let writeSuccess = data != nil
-                        if writeSuccess == false {
-                            __NSBeep()
-                            return;
-                        }
-                        
-                        let represent : NSSharingService = sender.representedObject as! NSSharingService
-                        represent.perform(withItems: [data as Any])
-                        return
-                    }
-                }
-                return
-            }
-            
-            let represent : NSSharingService = sender.representedObject as! NSSharingService
-            represent.perform(withItems: [document.fileURL as Any])
-        }
+        let represent : NSSharingService = sender.representedObject as! NSSharingService
+        represent.perform(withItems: [document.fileURL as Any])
     }
     @objc func deviceCameraMenuItemAciton(sender: NSMenuItem) {
         KMPrint("deviceCameraMenuItemAciton")
@@ -587,7 +552,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, iRateDelegate{
     
     @objc @IBAction func manageAcctounMenuAction(_ sender: Any) {
         if KMLightMemberManager.manager.isLogin() {
-            KMAccountInfoWindowController.show(window: NSApp.mainWindow!)
+            _ = KMAccountInfoWindowController.show(window: NSApp.mainWindow!)
         }
     }
     
@@ -596,7 +561,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, iRateDelegate{
         if KMLightMemberManager.manager.isLogin() {
             
         } else {
-            KMLoginWindowController.show(window: NSApp.mainWindow!)
+            _ = KMLoginWindowController.show(window: NSApp.mainWindow!)
         }
     }
     

+ 1 - 1
PDF Office/PDF Master/Class/Common/Category/NSUserDefaultsController+KMExtension.swift

@@ -41,7 +41,7 @@ extension NSUserDefaultsController {
 }
 
 extension UserDefaults {
-    open func sync_setValue(_ value: Any?, forKey key: String) {
+    public func sync_setValue(_ value: Any?, forKey key: String) {
         self.setValue(value, forKey: key)
         self.synchronize()
     }

+ 2 - 2
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/Table/KMTableAnnotation.swift

@@ -90,9 +90,9 @@ class KMTableAnnotation: CPDFInkAnnotation, NSTextViewDelegate {
     }
 
     override func drawSelectionHighlightForView(_ pdfView: CPDFListView, inContext context: CGContext, isHover: Bool) {
-        if context != nil {
+//        if context != nil {
             NSGraphicsContext.current = NSGraphicsContext(cgContext: context, flipped: false)
-        }
+//        }
         
         let drawRect = self.drawRect
         let abounds = self.bounds

+ 2 - 2
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFListViewExtension/CPDFListView+Extension.m

@@ -390,7 +390,7 @@ CGFloat DEFAULT_SNAPSHOT_HEIGHT = 200.0;
     
     if (page != nil) {
         BOOL isInitial = NSEqualSizes(bounds.size, NSZeroSize) && selection == nil;
-        NSRect pageBounds = [page boundsForBox:kPDFDisplayBoxMediaBox];
+        NSRect pageBounds = [page boundsForBox:CPDFDisplayMediaBox];
 
         // new note added by note tool mode, don't add actual zero sized notes
         if (isInitial)
@@ -963,7 +963,7 @@ CGFloat DEFAULT_SNAPSHOT_HEIGHT = 200.0;
 
 - (NSArray *)displayedPages {
     NSMutableArray *displayedPages = [NSMutableArray array];
-    PDFDocument *pdfDoc = [self document];
+    CPDFDocument *pdfDoc = [self document];
     NSRange range = [self displayedPageIndexRange];
     NSUInteger i;
     for (i = range.location; i < NSMaxRange(range); i++)

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

@@ -756,9 +756,6 @@ extension KMMainViewController {
             pages.append("\(i)")
         }
         sheet.callback =  { [weak self] stringValue in
-            if (stringValue == nil) {
-                return
-            }
             guard let index = Int(stringValue) else {
                 return
             }