New updates
This commit is contained in:
@@ -8,6 +8,7 @@ struct RsyncStudioApp: App {
|
||||
let startupStorageError: String?
|
||||
@StateObject private var runner: RsyncRunner
|
||||
@StateObject private var automation: BackgroundSyncCoordinator
|
||||
@StateObject private var licensing: LicensingManager
|
||||
|
||||
init() {
|
||||
let schema = Schema([
|
||||
@@ -16,6 +17,7 @@ struct RsyncStudioApp: App {
|
||||
])
|
||||
let configuration = ModelConfiguration(schema: schema, isStoredInMemoryOnly: false)
|
||||
KeychainStore.delete("defaultSSHPassword")
|
||||
_licensing = StateObject(wrappedValue: LicensingManager())
|
||||
|
||||
do {
|
||||
let container = try ModelContainer(for: schema, configurations: [configuration])
|
||||
@@ -45,7 +47,14 @@ struct RsyncStudioApp: App {
|
||||
.frame(minWidth: 1040, minHeight: 680)
|
||||
.environmentObject(runner)
|
||||
.environmentObject(automation)
|
||||
.onAppear { automation.start() }
|
||||
.environmentObject(licensing)
|
||||
.onAppear {
|
||||
licensing.refresh()
|
||||
if licensing.canUseApp { automation.start() } else { automation.stop() }
|
||||
}
|
||||
.onChange(of: licensing.canUseApp) { _, allowed in
|
||||
if allowed { automation.start() } else { automation.stop() }
|
||||
}
|
||||
}
|
||||
.modelContainer(sharedModelContainer)
|
||||
.commands {
|
||||
@@ -60,6 +69,7 @@ struct RsyncStudioApp: App {
|
||||
Settings {
|
||||
SettingsView()
|
||||
.environmentObject(automation)
|
||||
.environmentObject(licensing)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user