Browse Source

综合-dmg更新icon

tangchao 1 year ago
parent
commit
4c8d1f7a4c

+ 3 - 5
PDF Office/PDF Master.xcodeproj/project.pbxproj

@@ -2117,6 +2117,7 @@
 		BB3AD6F929935483004FC1AE /* Reachability.m in Sources */ = {isa = PBXBuildFile; fileRef = BB3AD6F729935483004FC1AE /* Reachability.m */; };
 		BB3AD6FA29935483004FC1AE /* Reachability.m in Sources */ = {isa = PBXBuildFile; fileRef = BB3AD6F729935483004FC1AE /* Reachability.m */; };
 		BB3AD6FB29935483004FC1AE /* Reachability.m in Sources */ = {isa = PBXBuildFile; fileRef = BB3AD6F729935483004FC1AE /* Reachability.m */; };
+		BB3BA9082A13684A00623C08 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BBFBE6C128DD7B98008B2335 /* Assets.xcassets */; };
 		BB3EAEAD293E3D6000D92407 /* KMConvertBaseWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB3EAEAB293E3D6000D92407 /* KMConvertBaseWindowController.swift */; };
 		BB3EAEAE293E3D6000D92407 /* KMConvertBaseWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB3EAEAB293E3D6000D92407 /* KMConvertBaseWindowController.swift */; };
 		BB3EAEAF293E3D6000D92407 /* KMConvertBaseWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB3EAEAB293E3D6000D92407 /* KMConvertBaseWindowController.swift */; };
@@ -9590,6 +9591,7 @@
 				9FF94F1629A7476000B1EF69 /* KMDesignPropertySelector.xib in Resources */,
 				ADE8BC3529F9261900570F89 /* KMSearchCellView.xib in Resources */,
 				ADC075DF29876622006C752F /* KMBatchConverPDFPPTView.xib in Resources */,
+				BB3BA9082A13684A00623C08 /* Assets.xcassets in Resources */,
 				AD0FA51829A9FA8F00EDEB50 /* KMResetPasswordView.xib in Resources */,
 				ADE3C1E929A5ABC200793B13 /* KMLoginWindowController.xib in Resources */,
 				ADC075C629866B05006C752F /* KMBatchTextRecognitionView.xib in Resources */,
@@ -12832,7 +12834,6 @@
 					"DEBUG=1",
 					"$(inherited)",
 					"VERSION_DMG=1",
-					"VERSION_FREE=1",
 				);
 				GENERATE_INFOPLIST_FILE = YES;
 				INFOPLIST_FILE = "PDF-Master-DMG-Info.plist";
@@ -12937,10 +12938,7 @@
 					"$(PROJECT_DIR)/PDF\\ Master/Third\\ Pard\\ Library",
 					"$(PROJECT_DIR)/PDF\\ Master/Third\\ Pard\\ Library",
 				);
-				GCC_PREPROCESSOR_DEFINITIONS = (
-					"VERSION_DMG=1",
-					"VERSION_FREE=1",
-				);
+				GCC_PREPROCESSOR_DEFINITIONS = "VERSION_DMG=1";
 				GENERATE_INFOPLIST_FILE = YES;
 				INFOPLIST_FILE = "PDF-Master-DMG-Info.plist";
 				INFOPLIST_KEY_NSHumanReadableCopyright = "";

+ 9 - 55
PDF Office/PDF Master/AppDelegate.swift

@@ -162,12 +162,10 @@ class AppDelegate: NSObject, NSApplicationDelegate {
         }
         
         let PDFOfficeMenu = mainMenu?.item(at: 0)?.submenu
-        // VERSION_DMG=1
-        // VERSION_FREE=1
-        // VERSION_PRO=1
-        #if VERSION_DMG
-        PDFOfficeMenu?.insertItem(withTitle: NSLocalizedString("Check for Updates", comment: ""), action: #selector(checkForUpdates), target: self, at: 1)
-        #endif
+        let appTarget = KMTools_OC.getAppTarget()
+        if (appTarget == .DMG) {
+            PDFOfficeMenu?.insertItem(withTitle: NSLocalizedString("Check for Updates", comment: ""), action: #selector(checkForUpdates), target: self, at: 1)
+        }
         
         let fileMenu = mainMenu?.item(at: 1)?.submenu
         let shareItem: NSMenuItem = NSMenuItem(title: NSLocalizedString("Share", comment: ""), action: nil, target: nil)
@@ -214,51 +212,6 @@ class AppDelegate: NSObject, NSApplicationDelegate {
         represent.perform(withItems: [document.fileURL as Any])
     }
     
-    func updateAccountMenus() {
-        let mainMenu = NSApp.mainMenu
-        let PDFOfficeMenu: NSMenu = (mainMenu?.item(at: 0)?.submenu)!
-        
-        var index: Int = 4
-#if VERSION_DMG
-        index = 5
-#endif
-        
-        let isLogin = false
-        if (isLogin) {
-            PDFOfficeMenu.insertItem(withTitle: NSLocalizedString("user@mobile.com", comment: ""), action: #selector(showAccount), target: self, at: index)
-            let manageAcctounItem = PDFOfficeMenu.item(at: index+1)
-            manageAcctounItem?.title = NSLocalizedString("View my account", comment: "")
-            
-            PDFOfficeMenu.insertItem(withTitle: NSLocalizedString("Resume purchase", comment: ""), action: #selector(resumePurchase), target: self, at: index+2)
-            let loginItem = PDFOfficeMenu.item(at: index+3)
-            loginItem?.title = NSLocalizedString("Logout", comment: "")
-        } else {
-            var hasLoginItems = false
-            for item in PDFOfficeMenu.items {
-                if (item.action == #selector(showAccount) ||
-                    item.action == #selector(resumePurchase)) {
-                    hasLoginItems = true
-                    break
-                }
-            }
-            
-            if (hasLoginItems) {
-                let loginItem = PDFOfficeMenu.item(at: index+3)
-                loginItem?.title = NSLocalizedString("Log In", comment: "")
-                PDFOfficeMenu.removeItem(at: index+2)
-                
-                let manageAcctounItem = PDFOfficeMenu.item(at: index+1)
-                manageAcctounItem?.title = NSLocalizedString("Manage my account", comment: "")
-                PDFOfficeMenu.removeItem(at: index)
-            } else {
-                let manageAcctounItem = PDFOfficeMenu.item(at: index+1)
-                manageAcctounItem?.title = NSLocalizedString("Manage my account", comment: "")
-                let loginItem = PDFOfficeMenu.item(at: index+2)
-                loginItem?.title = NSLocalizedString("Log In", comment: "")
-            }
-        }
-    }
-    
     // MARK: PDF Master Menu
     @IBAction func openPreferenceWindow(_ sender: Any) {
         KMPreferenceWindowController.shared.showWindow(nil)
@@ -332,13 +285,14 @@ class AppDelegate: NSObject, NSApplicationDelegate {
         
     }
     
-    // MARK: DMG
-    #if VERSION_DMG
+    // MARK:-  DMG
     @objc func checkForUpdates(_ sender: NSMenuItem) {
+        let appTarget = KMTools_OC.getAppTarget()
+        if (appTarget != .DMG) {
+            return
+        }
         
     }
-    
-    #endif
 }
 
 extension AppDelegate : NSMenuDelegate,NSMenuItemValidation {

+ 8 - 0
PDF Office/PDF Master/Class/Common/OC/Tools/KMTools_OC.h

@@ -7,6 +7,12 @@
 
 #import <Foundation/Foundation.h>
 
+typedef NS_ENUM(NSUInteger, KMAppTarget) {
+    KMAppTargetFree = 0,
+    KMAppTargetPro = 1,
+    KMAppTargetDMG = 2
+};
+
 NS_ASSUME_NONNULL_BEGIN
 
 @interface KMTools_OC : NSObject
@@ -15,6 +21,8 @@ NS_ASSUME_NONNULL_BEGIN
 + (BOOL) setPreviewAsDefaultApplicationForFileExtension:(NSString *) fileExtension;
 + (BOOL)setMyselfAsDefaultApplicationForFileExtension:(NSString *) fileExtension;
 
++ (KMAppTarget)getAppTarget;
+
 @end
 
 @interface KMPageSizeTool : NSObject

+ 16 - 0
PDF Office/PDF Master/Class/Common/OC/Tools/KMTools_OC.m

@@ -50,6 +50,22 @@
     return UTIString;
 }
 
++ (KMAppTarget)getAppTarget {
+    // VERSION_DMG=1
+    // VERSION_FREE=1
+    // VERSION_PRO=1
+#if VERSION_FREE
+    return KMAppTargetFree;
+#endif
+#if VERSION_PRO
+    return KMAppTargetPro;
+#endif
+#if VERSION_DMG
+    return KMAppTargetDMG;
+#endif
+    return KMAppTargetFree;
+}
+
 @end
 
 @implementation KMPageSizeTool