include argus workflow

This commit is contained in:
joyzhuo
2026-03-29 06:29:18 -04:00
parent 275a53ab40
commit 56673078f5
23 changed files with 3098 additions and 307 deletions

View File

@@ -2,8 +2,24 @@
import SwiftUI
// MARK: - AppDelegate (subprocess cleanup on quit)
final class AppDelegate: NSObject, NSApplicationDelegate {
/// Called for normal quits (Cmd+Q), window close, and SIGTERM.
/// Ensures the argus subprocess is killed before the process exits.
func applicationWillTerminate(_ notification: Notification) {
// applicationWillTerminate runs on the main thread, so we can safely
// call @MainActor methods synchronously via assumeIsolated.
MainActor.assumeIsolated {
SessionManager.shared.stopMonitoring()
}
}
}
@main
struct LockInBroApp: App {
@NSApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
@State private var auth = AuthManager.shared
@State private var session = SessionManager.shared
@@ -13,9 +29,11 @@ struct LockInBroApp: App {
ContentView()
.environment(auth)
.environment(session)
.onChange(of: session.isSessionActive) { _, isActive in
if isActive {
.onChange(of: auth.isLoggedIn, initial: true) { _, loggedIn in
if loggedIn {
// Show HUD and start always-on monitoring as soon as user logs in
FloatingPanelController.shared.show(session: session)
Task { await session.startMonitoring() }
} else {
FloatingPanelController.shared.close()
}