Distributed Notifications

This commit is contained in:
Hariharan Mudaliar 2026-03-20 19:54:22 +05:30
commit a2d18cda49
No known key found for this signature in database
GPG key ID: 025583EB0BE5640E
2 changed files with 40 additions and 0 deletions

View file

@ -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()

View file

@ -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"
}
}