From 10f279675ae1e8440d1c7610ff7c160b5585a81d Mon Sep 17 00:00:00 2001 From: Max Goedjen Date: Thu, 14 Aug 2025 20:16:34 -0700 Subject: [PATCH] Cleanup. --- Sources/Secretive/App.swift | 12 ++---------- .../Secretive/Controllers/AgentStatusChecker.swift | 1 + .../Preview Content/PreviewAgentStatusChecker.swift | 3 +++ 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/Sources/Secretive/App.swift b/Sources/Secretive/App.swift index 18dad10..0c3ba5f 100644 --- a/Sources/Secretive/App.swift +++ b/Sources/Secretive/App.swift @@ -19,15 +19,8 @@ extension EnvironmentValues { @main struct Secretive: App { - private let storeList: SecretStoreList = { - let list = SecretStoreList() - list.add(store: SecureEnclave.Store()) - list.add(store: SmartCard.Store()) - return list - }() - private let agentStatusChecker = AgentStatusChecker() private let justUpdatedChecker = JustUpdatedChecker() - + @Environment(\.agentStatusChecker) var agentStatusChecker @AppStorage("defaultsHasRunSetup") var hasRunSetup = false @State private var showingSetup = false @State private var showingCreation = false @@ -35,9 +28,8 @@ struct Secretive: App { @SceneBuilder var body: some Scene { WindowGroup { ContentView(showingCreation: $showingCreation, runningSetup: $showingSetup, hasRunSetup: $hasRunSetup) - .environment(storeList) + // This one is explicitly injected via environment to support hasRunSetup. .environment(Updater(checkOnLaunch: hasRunSetup)) - .environment(agentStatusChecker) .onAppear { if !hasRunSetup { showingSetup = true diff --git a/Sources/Secretive/Controllers/AgentStatusChecker.swift b/Sources/Secretive/Controllers/AgentStatusChecker.swift index daad478..acbe4ad 100644 --- a/Sources/Secretive/Controllers/AgentStatusChecker.swift +++ b/Sources/Secretive/Controllers/AgentStatusChecker.swift @@ -7,6 +7,7 @@ import Observation protocol AgentStatusCheckerProtocol: Observable { var running: Bool { get } var developmentBuild: Bool { get } + func check() } @Observable class AgentStatusChecker: AgentStatusCheckerProtocol { diff --git a/Sources/Secretive/Preview Content/PreviewAgentStatusChecker.swift b/Sources/Secretive/Preview Content/PreviewAgentStatusChecker.swift index e893155..5fce50d 100644 --- a/Sources/Secretive/Preview Content/PreviewAgentStatusChecker.swift +++ b/Sources/Secretive/Preview Content/PreviewAgentStatusChecker.swift @@ -10,4 +10,7 @@ class PreviewAgentStatusChecker: AgentStatusCheckerProtocol { self.running = running } + func check() { + } + }