From 389a7f775186d1aaef49c9922fd4dde897dd6f68 Mon Sep 17 00:00:00 2001 From: Trey t Date: Mon, 24 Jan 2022 10:35:26 -0600 Subject: [PATCH] add view in settings that shows current i cloud status --- Shared/views/SettingsView.swift | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Shared/views/SettingsView.swift b/Shared/views/SettingsView.swift index 4a648f8..4753ff5 100644 --- a/Shared/views/SettingsView.swift +++ b/Shared/views/SettingsView.swift @@ -6,6 +6,7 @@ // import SwiftUI +import CloudKitSyncMonitor struct SettingsView: View { @Environment(\.dismiss) var dismiss @@ -17,6 +18,7 @@ struct SettingsView: View { @State private var showSpecialThanks = false @State private var showWhyBGMode = false + @ObservedObject var syncMonitor = SyncMonitor.shared var body: some View { ZStack { @@ -31,6 +33,7 @@ struct SettingsView: View { showOnboardingButton whyBackgroundMode specialThanksCell + cloudKitStatus Spacer() } .padding() @@ -188,6 +191,20 @@ struct SettingsView: View { .fixedSize(horizontal: false, vertical: true) .clipShape(RoundedRectangle(cornerRadius: 25, style: .continuous)) } + + private var cloudKitStatus: some View { + ZStack { + Color(UIColor.systemBackground) + VStack { + Image(systemName: syncMonitor.syncStateSummary.symbolName) + .foregroundColor(syncMonitor.syncStateSummary.symbolColor) + Text( syncMonitor.syncStateSummary.isBroken ? "cloudkit is broken" : "cloudkit is good") + } + .padding() + } + .fixedSize(horizontal: false, vertical: true) + .clipShape(RoundedRectangle(cornerRadius: 25, style: .continuous)) + } } struct SettingsView_Previews: PreviewProvider {