mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2026-12-05 19:57:31 +00:00
🚑️ Fix #4938 - Theme persistence
When setting a new theme, these three functions need to run in sequence.
AppDefaults.shared.currentThemeName = newValue
updateThemeNames()
updateCurrentTheme()
Within updateThemeNames() there is a `Task { @MainActor in }` that allows `updateCurrentTheme()` to complete before `updateThemeNames()`. In this scenario, when `updateCurrentTheme() is run the app hasnt got an itinerary of installed themes, so it sets the current them back to Default.
Removing the `Task` fixes the persistence issue.
This commit is contained in:
1 file changed
+2
-4
@@ -160,10 +160,8 @@ private extension ArticleThemesManager {
|
||||
let allThemeNames = appThemeNames.union(installedThemeNames)
|
||||
|
||||
let sortedThemeNames = allThemeNames.sorted(by: { $0.compare($1, options: .caseInsensitive) == .orderedAscending })
|
||||
Task { @MainActor in
|
||||
if sortedThemeNames != themeNames {
|
||||
themeNames = sortedThemeNames
|
||||
}
|
||||
if sortedThemeNames != themeNames {
|
||||
themeNames = sortedThemeNames
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user