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

This commit is contained in:
Matt Bruce 2026-01-27 08:29:51 -06:00
parent 30ef5f13ed
commit 9e6ba26f5f
3 changed files with 25 additions and 5 deletions

View File

@ -6,6 +6,15 @@ import Bedrock
@Observable
final class SettingsStore: CloudSyncable {
@ObservationIgnored private let cloudSync = CloudSyncManager<AppSettingsData>()
/// Observable copy of last sync date, updated when sync completes.
private(set) var lastSyncDate: Date?
/// Observable copy of sync status, updated when sync state changes.
private(set) var syncStatus: String = ""
/// Observable copy of initial sync state.
private(set) var hasCompletedInitialSync: Bool = false
var hapticsEnabled: Bool {
get { cloudSync.data.hapticsEnabled }
@ -24,22 +33,33 @@ final class SettingsStore: CloudSyncable {
set { cloudSync.iCloudEnabled = newValue }
}
var lastSyncDate: Date? { cloudSync.lastSyncDate }
var syncStatus: String { cloudSync.syncStatus }
var hasCompletedInitialSync: Bool { cloudSync.hasCompletedInitialSync }
init() {
// Initialize observable properties from cloudSync
refreshSyncState()
}
func forceSync() {
cloudSync.sync()
refreshSyncState()
}
func refresh() {
cloudSync.sync()
refreshSyncState()
}
private func update(_ transform: (inout AppSettingsData) -> Void) {
cloudSync.update { data in
transform(&data)
}
refreshSyncState()
}
/// Copies sync state from CloudSyncManager to observable properties.
private func refreshSyncState() {
lastSyncDate = cloudSync.lastSyncDate
syncStatus = cloudSync.syncStatus
hasCompletedInitialSync = cloudSync.hasCompletedInitialSync
}
}

View File

@ -38,7 +38,7 @@ struct RitualMilestonesView: View {
.frame(width: AppMetrics.Size.milestoneIcon, height: AppMetrics.Size.milestoneIcon)
Image(systemName: milestone.symbolName)
.font(.system(size: Design.BaseFontSize.caption))
.font(.caption)
.foregroundStyle(milestone.isAchieved ? AppStatus.success : AppTextColors.tertiary)
}

View File

@ -200,7 +200,7 @@ struct RitualDetailView: View {
private var headerSection: some View {
HStack(spacing: Design.Spacing.medium) {
Image(systemName: ritual.iconName)
.font(.system(size: Design.BaseFontSize.largeTitle))
.font(.largeTitle)
.foregroundStyle(ritual.hasActiveArc ? AppAccent.primary : AppTextColors.secondary)
.frame(width: 56, height: 56)
.background((ritual.hasActiveArc ? AppAccent.primary : AppTextColors.secondary).opacity(0.1))