From b25ac7621d1a7a2bbdf19588d855da531a185c55 Mon Sep 17 00:00:00 2001 From: Christian Cleberg Date: Sat, 11 Apr 2026 19:55:28 -0500 Subject: fix: respect contribution graphs toggle in widget 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. --- Shared/ContributionWidgetContext.swift | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'Shared/ContributionWidgetContext.swift') 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() -- cgit v1.2.3