Initial scaffold: context-aware notes app for iOS + macOS
XcodeGen project (Notes / NotesMac / NotesTests), Swift 6 strict concurrency, iCloud-document storage via IndieSync with a SwiftData cache, automatic capture context (location, place, time zone, device) on every note, context-based relevance ranking with a 'Right here, right now' shelf, tags, search, and the square.and.pencil-on-red app icon.
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
import SwiftUI
|
||||
|
||||
struct SettingsView: View {
|
||||
@Environment(SyncEngine.self) private var syncEngine
|
||||
@Environment(ContextService.self) private var contextService
|
||||
|
||||
var body: some View {
|
||||
NavigationStack {
|
||||
Form {
|
||||
Section("iCloud") {
|
||||
HStack {
|
||||
Text("Status")
|
||||
Spacer()
|
||||
switch syncEngine.iCloudStatus {
|
||||
case .checking:
|
||||
Text("Checking…").foregroundStyle(.secondary)
|
||||
case .available:
|
||||
Label("Connected", systemImage: "checkmark.icloud")
|
||||
.foregroundStyle(.green)
|
||||
case .unavailable:
|
||||
Label("Unavailable", systemImage: "xmark.icloud")
|
||||
.foregroundStyle(.red)
|
||||
}
|
||||
}
|
||||
if let error = syncEngine.lastSyncError {
|
||||
Text(error)
|
||||
.font(.footnote)
|
||||
.foregroundStyle(.red)
|
||||
}
|
||||
Button("Rebuild Local Cache") {
|
||||
Task { await syncEngine.rebuildCache() }
|
||||
}
|
||||
.disabled(syncEngine.iCloudStatus != .available || syncEngine.isSyncing)
|
||||
}
|
||||
|
||||
Section("Context") {
|
||||
ContextSummaryRow(
|
||||
context: contextService.current,
|
||||
isRefreshing: contextService.isRefreshing
|
||||
)
|
||||
if contextService.authorizationDenied {
|
||||
Text("Location access is off. Notes can still be taken, but they won't resurface by place. Enable location for Notes in Settings.")
|
||||
.font(.footnote)
|
||||
.foregroundStyle(.secondary)
|
||||
}
|
||||
Button("Refresh Context") {
|
||||
Task { await contextService.refresh() }
|
||||
}
|
||||
.disabled(contextService.isRefreshing)
|
||||
}
|
||||
}
|
||||
.formStyle(.grouped)
|
||||
.navigationTitle("Settings")
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user