Няма описание

AppDelegate.swift 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. //
  2. // AppDelegate.swift
  3. // App for Indeed
  4. //
  5. // Created by Mql Mac 2 on 11/05/2026.
  6. //
  7. import Cocoa
  8. @main
  9. class AppDelegate: NSObject, NSApplicationDelegate {
  10. private let minimumWindowSize = NSSize(width: 1120, height: 700)
  11. func applicationWillFinishLaunching(_ notification: Notification) {
  12. // Dashboard is light-themed; without this, a Dark Mode Mac paints a dark title bar.
  13. NSApp.appearance = NSAppearance(named: .aqua)
  14. }
  15. func applicationDidFinishLaunching(_ aNotification: Notification) {
  16. Task { @MainActor in
  17. await SubscriptionStore.shared.refreshEntitlements()
  18. NotificationCenter.default.post(name: .subscriptionStatusDidChange, object: nil)
  19. }
  20. NSApp.activate(ignoringOtherApps: true)
  21. DispatchQueue.main.async { [weak self] in
  22. guard
  23. let self,
  24. let window = NSApp.windows.first
  25. else { return }
  26. window.minSize = self.minimumWindowSize
  27. window.setContentSize(self.minimumWindowSize)
  28. window.title = "App for Indeed"
  29. window.styleMask.insert(.fullSizeContentView)
  30. window.titlebarAppearsTransparent = true
  31. window.titleVisibility = .hidden
  32. window.isMovableByWindowBackground = true
  33. window.center()
  34. window.makeKeyAndOrderFront(nil)
  35. }
  36. }
  37. func applicationWillTerminate(_ aNotification: Notification) {
  38. // Insert code here to tear down your application
  39. }
  40. func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool {
  41. return true
  42. }
  43. }