diff options
| author | Christian Cleberg <[email protected]> | 2026-04-11 19:55:28 -0500 |
|---|---|---|
| committer | Christian Cleberg <[email protected]> | 2026-04-11 19:55:28 -0500 |
| commit | b25ac7621d1a7a2bbdf19588d855da531a185c55 (patch) | |
| tree | f48e93644369d76d301265a4f7f3c3cdc54aeef6 /Shared | |
| parent | ba773aaa9da5798a458ee58f7ce37db070ada7d8 (diff) | |
| download | hutch-2.12.1.tar.gz hutch-2.12.1.tar.bz2 hutch-2.12.1.zip | |
fix: respect contribution graphs toggle in widgetv2.12.1
Mirror the contributionGraphsEnabled setting to shared app group
defaults so the widget extension can read it. Show a descriptive
message when contributions are disabled instead of placeholder data.
Diffstat (limited to 'Shared')
| -rw-r--r-- | Shared/ContributionWidgetContext.swift | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Shared/ContributionWidgetContext.swift b/Shared/ContributionWidgetContext.swift index 3fadc8a..2404698 100644 --- a/Shared/ContributionWidgetContext.swift +++ b/Shared/ContributionWidgetContext.swift @@ -9,11 +9,21 @@ enum ContributionGraphWidgetConfiguration { enum ContributionWidgetContextStore { private static let actorKey = "contributionWidget.actor" + private static let enabledKey = "contributionWidget.enabled" static func loadActor(defaults: UserDefaults? = sharedDefaults()) -> String? { defaults?.string(forKey: actorKey) } + static func isEnabled(defaults: UserDefaults? = sharedDefaults()) -> Bool { + defaults?.object(forKey: enabledKey) == nil ? true : defaults?.bool(forKey: enabledKey) ?? true + } + + static func setEnabled(_ enabled: Bool, defaults: UserDefaults? = sharedDefaults()) { + defaults?.set(enabled, forKey: enabledKey) + reloadWidgetTimelines() + } + static func saveActor(_ actor: String, defaults: UserDefaults? = sharedDefaults()) { defaults?.set(actor, forKey: actorKey) reloadWidgetTimelines() |
