AppDelegate.swift 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. //
  2. // AppDelegate.swift
  3. // PDF Reader Pro DMG
  4. //
  5. // Created by Niehaoyu on 2022/9/23.
  6. //
  7. import Cocoa
  8. @main
  9. class AppDelegate: NSObject, NSApplicationDelegate {
  10. func applicationWillFinishLaunching(_ notification: Notification) {
  11. ComPDFUIConfig.initializeUIConfig();
  12. }
  13. func applicationDidFinishLaunching(_ aNotification: Notification) {
  14. // Insert code here to initialize your application
  15. }
  16. func applicationWillTerminate(_ aNotification: Notification) {
  17. // Insert code here to tear down your application
  18. }
  19. func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool {
  20. return true
  21. }
  22. }
  23. extension AppDelegate : NSMenuDelegate,NSMenuItemValidation {
  24. func validateMenuItem(_ menuItem: NSMenuItem) -> Bool {
  25. let action = menuItem.action
  26. if action == #selector(manageAcctounMenuAction) {
  27. return KMLightMemberManager.manager.isLogin()
  28. }
  29. if action == #selector(loginMenuItemAction) {
  30. return !KMLightMemberManager.manager.isLogin()
  31. }
  32. return true
  33. }
  34. }