mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-27 15:14:33 +00:00
Distributed Notifications
This commit is contained in:
parent
aa20aa51f4
commit
a2d18cda49
2 changed files with 40 additions and 0 deletions
|
|
@ -156,6 +156,16 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
||||||
}
|
}
|
||||||
|
|
||||||
func applicationWillTerminate(_ notification: Notification) {
|
func applicationWillTerminate(_ notification: Notification) {
|
||||||
|
let userInfo: [String: Any] = [
|
||||||
|
AtollDistributedNotifications.UserInfoKey.sourcePID: NSNumber(value: ProcessInfo.processInfo.processIdentifier)
|
||||||
|
]
|
||||||
|
DistributedNotificationCenter.default().postNotificationName(
|
||||||
|
AtollDistributedNotifications.didBecomeIdle,
|
||||||
|
object: nil,
|
||||||
|
userInfo: userInfo,
|
||||||
|
deliverImmediately: true
|
||||||
|
)
|
||||||
|
|
||||||
// Cancel any pending window size updates
|
// Cancel any pending window size updates
|
||||||
windowSizeUpdateWorkItem?.cancel()
|
windowSizeUpdateWorkItem?.cancel()
|
||||||
NotificationCenter.default.removeObserver(self)
|
NotificationCenter.default.removeObserver(self)
|
||||||
|
|
@ -393,6 +403,16 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
||||||
}
|
}
|
||||||
|
|
||||||
func applicationDidFinishLaunching(_ notification: Notification) {
|
func applicationDidFinishLaunching(_ notification: Notification) {
|
||||||
|
let userInfo: [String: Any] = [
|
||||||
|
AtollDistributedNotifications.UserInfoKey.sourcePID: NSNumber(value: ProcessInfo.processInfo.processIdentifier)
|
||||||
|
]
|
||||||
|
DistributedNotificationCenter.default().postNotificationName(
|
||||||
|
AtollDistributedNotifications.didBecomeActive,
|
||||||
|
object: nil,
|
||||||
|
userInfo: userInfo,
|
||||||
|
deliverImmediately: true
|
||||||
|
)
|
||||||
|
|
||||||
LockScreenLiveActivityWindowManager.shared.configure(viewModel: vm)
|
LockScreenLiveActivityWindowManager.shared.configure(viewModel: vm)
|
||||||
LockScreenManager.shared.configure(viewModel: vm)
|
LockScreenManager.shared.configure(viewModel: vm)
|
||||||
extensionXPCServiceHost.start()
|
extensionXPCServiceHost.start()
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
/*
|
||||||
|
* Atoll (DynamicIsland)
|
||||||
|
* Copyright (C) 2024-2026 Atoll Contributors
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
enum AtollDistributedNotifications {
|
||||||
|
static let didBecomeActive = Notification.Name("com.ebullioscopic.Atoll.lifecycle.didBecomeActive")
|
||||||
|
static let didBecomeIdle = Notification.Name("com.ebullioscopic.Atoll.lifecycle.didBecomeIdle")
|
||||||
|
|
||||||
|
enum UserInfoKey {
|
||||||
|
static let sourcePID = "sourcePID"
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue