mirror of
https://github.com/maxgoedjen/secretive.git
synced 2026-03-10 19:47:24 +01:00
Move some updater stuff to being an actor
This commit is contained in:
@@ -16,6 +16,7 @@ struct Secretive: App {
|
||||
}()
|
||||
private let agentStatusChecker = AgentStatusChecker()
|
||||
private let justUpdatedChecker = JustUpdatedChecker()
|
||||
private let updater = Updater()
|
||||
|
||||
@AppStorage("defaultsHasRunSetup") var hasRunSetup = false
|
||||
@State private var showingSetup = false
|
||||
@@ -25,11 +26,15 @@ struct Secretive: App {
|
||||
WindowGroup {
|
||||
ContentView<Updater, AgentStatusChecker>(showingCreation: $showingCreation, runningSetup: $showingSetup, hasRunSetup: $hasRunSetup)
|
||||
.environmentObject(storeList)
|
||||
.environmentObject(Updater(checkOnLaunch: hasRunSetup))
|
||||
.environmentObject(updater)
|
||||
.environmentObject(agentStatusChecker)
|
||||
.onAppear {
|
||||
if !hasRunSetup {
|
||||
showingSetup = true
|
||||
} else {
|
||||
Task { [updater] in
|
||||
await updater.checkForUpdates()
|
||||
}
|
||||
}
|
||||
}
|
||||
.onReceive(NotificationCenter.default.publisher(for: NSApplication.didBecomeActiveNotification)) { _ in
|
||||
|
||||
@@ -18,7 +18,9 @@ struct UpdateDetailView<UpdaterType: Updater>: View {
|
||||
HStack {
|
||||
if !update.critical {
|
||||
Button("Ignore") {
|
||||
updater.ignore(release: update)
|
||||
Task { [updater, update] in
|
||||
await updater.ignore(release: update)
|
||||
}
|
||||
}
|
||||
Spacer()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user