Major update for stability
This commit is contained in:
@@ -2,12 +2,18 @@ import SwiftUI
|
||||
import SwiftData
|
||||
|
||||
struct ContentView: View {
|
||||
let startupStorageError: String?
|
||||
@EnvironmentObject private var automation: BackgroundSyncManager
|
||||
@Environment(\.openWindow) private var openWindow
|
||||
@State private var selectedJob: SyncJob?
|
||||
@State private var section: AppSection = .jobs
|
||||
@State private var showingNewJob = false
|
||||
@State private var showingSplash = true
|
||||
@State private var showingStorageAlert = false
|
||||
|
||||
init(startupStorageError: String? = nil) {
|
||||
self.startupStorageError = startupStorageError
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
ZStack {
|
||||
@@ -21,6 +27,12 @@ struct ContentView: View {
|
||||
}
|
||||
}
|
||||
.sheet(isPresented: $showingNewJob) { JobEditorView() }
|
||||
.alert("Storage Recovery Mode", isPresented: $showingStorageAlert) {
|
||||
Button("OK", role: .cancel) {}
|
||||
} message: {
|
||||
Text(startupStorageError ?? "Rsync Manager is using temporary storage.")
|
||||
}
|
||||
.onAppear { showingStorageAlert = startupStorageError != nil }
|
||||
.task {
|
||||
guard showingSplash else { return }
|
||||
try? await Task.sleep(for: .seconds(1.0))
|
||||
@@ -124,6 +136,13 @@ struct ContentView: View {
|
||||
.background(.thinMaterial, in: Capsule())
|
||||
}
|
||||
|
||||
if let serviceError = automation.lastError {
|
||||
Image(systemName: "exclamationmark.triangle.fill")
|
||||
.foregroundStyle(Color.orange)
|
||||
.help(serviceError)
|
||||
.accessibilityLabel("Background service error")
|
||||
}
|
||||
|
||||
Picker("Section", selection: $section) {
|
||||
Label("Jobs", systemImage: "rectangle.stack").tag(AppSection.jobs)
|
||||
Label("Calendar", systemImage: "calendar").tag(AppSection.calendar)
|
||||
|
||||
Reference in New Issue
Block a user