Signed-off-by: Matt Bruce <mbrucedogs@gmail.com>

This commit is contained in:
Matt Bruce 2026-01-16 16:56:36 -06:00
parent d97f7e8b91
commit c18f134ce2

View File

@ -76,14 +76,14 @@ struct PlatformSyncDemo: View {
}
}
.disabled(isLoading)
Button(action: testPlatformError) {
HStack {
Image(systemName: "exclamationmark.triangle")
Text("Test Platform Restriction")
Text("Test Current Availability")
}
}
.foregroundStyle(.orange)
.foregroundStyle(Color.Status.warning)
.disabled(isLoading)
}
@ -98,8 +98,8 @@ struct PlatformSyncDemo: View {
Section {
Text(statusMessage)
.font(.caption)
.foregroundStyle(statusMessage.contains("Error") ? .red :
statusMessage.contains("") ? .orange : .green)
.foregroundStyle(statusMessage.contains("Error") ? Color.Status.error :
statusMessage.contains("") ? Color.Status.warning : Color.Status.success)
}
}
@ -114,6 +114,7 @@ struct PlatformSyncDemo: View {
LabeledContent("Platform", value: selectedPlatform.displayName)
LabeledContent("Sync", value: selectedSync.displayName)
LabeledContent("Max Auto-Sync Size", value: "50 KB")
LabeledContent("Key Name", value: StorageKeys.SyncableSettingKey().name)
}
Section("Watch Notes") {
@ -182,12 +183,17 @@ struct PlatformSyncDemo: View {
private func testPlatformError() {
isLoading = true
Task {
let key = StorageKeys.WatchVibrationKey()
do {
let key = StorageKeys.SyncableSettingKey(
availability: selectedPlatform,
syncPolicy: selectedSync
)
_ = try await StorageRouter.shared.get(key)
statusMessage = "⚠ Accessed successfully (running on Watch?)"
statusMessage = "✓ Current availability allows iPhone access"
} catch StorageError.watchOnlyKeyAccessedOnPhone(let name) {
statusMessage = "⚠ Expected Error: Key '\(name)' is watchOnly, accessed from iPhone"
} catch StorageError.notFound {
statusMessage = "⚠ No stored value. Availability allows access."
} catch {
statusMessage = "Error: \(error.localizedDescription)"
}