// // AppDelegate.swift // PDF Reader Pro Pro // // Created by Niehaoyu on 2022/9/23. // import Cocoa @main class AppDelegate: NSObject, NSApplicationDelegate { func applicationWillFinishLaunching(_ notification: Notification) { ComPDFUIConfig.initializeUIConfig(); } func applicationDidFinishLaunching(_ aNotification: Notification) { // Insert code here to initialize your application // MARK: 广告数据初始化 KMAdvertisementManager.manager.initConfig(appName: .PDFReaderProMac, subscribeType: .unsubscribed, platform: .Mac) // 测试模式,默认false KMAdvertisementManager.manager.debug = true } func applicationWillTerminate(_ aNotification: Notification) { // Insert code here to tear down your application } func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool { return true } } extension AppDelegate : NSMenuDelegate,NSMenuItemValidation { func validateMenuItem(_ menuItem: NSMenuItem) -> Bool { let action = menuItem.action if action == #selector(manageAcctounMenuAction) { return KMLightMemberManager.manager.isLogin() } if action == #selector(loginMenuItemAction) { return !KMLightMemberManager.manager.isLogin() } return true } }