Tweak iCloud status appearance in advanced prefs

This commit is contained in:
Shadowfacts 2024-04-15 00:12:34 -04:00
parent c32181818a
commit ee7bf5138c
1 changed files with 22 additions and 16 deletions

View File

@ -83,6 +83,23 @@ struct AdvancedPrefsView : View {
HStack {
Text("iCloud Status")
Spacer()
cloudKitStatusLabel
.foregroundStyle(.secondary)
}
}
.appGroupedListRowBackground()
.task {
do {
let status = try await CKContainer.default().accountStatus()
self.cloudKitStatus = status
} catch {
Logging.general.error("Unable to get CloudKit status: \(String(describing: error))")
}
}
}
@ViewBuilder
private var cloudKitStatusLabel: some View {
switch cloudKitStatus {
case nil:
EmptyView()
@ -100,17 +117,6 @@ struct AdvancedPrefsView : View {
Text(String(describing: cloudKitStatus!))
}
}
}
.appGroupedListRowBackground()
.task {
do {
let status = try await CKContainer.default().accountStatus()
self.cloudKitStatus = status
} catch {
Logging.general.error("Unable to get CloudKit status: \(String(describing: error))")
}
}
}
var errorReportingSection: some View {
Section {