Skip to content

Commit

Permalink
Fix loading initial theme
Browse files Browse the repository at this point in the history
  • Loading branch information
GianniCarlo committed May 23, 2023
1 parent 6f24b9d commit e7782f2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion BookPlayer/Coordinators/MainCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ class MainCoordinator: Coordinator {
tabBarController.modalTransitionStyle = .crossDissolve
presentingViewController = tabBarController

if let currentTheme = libraryService.getLibraryCurrentTheme() {
if var currentTheme = libraryService.getLibraryCurrentTheme() {
currentTheme.useDarkVariant = ThemeManager.shared.useDarkVariant
ThemeManager.shared.currentTheme = currentTheme
}

Expand Down
5 changes: 4 additions & 1 deletion BookPlayer/Settings/Themes Screen/ThemeManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,10 @@ final class ThemeManager: ThemeProvider {
guard
let sceneDelegate = AppDelegate.shared?.activeSceneDelegate,
let window = sceneDelegate.window
else { return }
else {
self.theme.value = newTheme
return
}

let newTheme = SimpleTheme(with: newTheme, useDarkVariant: self.useDarkVariant)
UIView.transition(with: window,
Expand Down

0 comments on commit e7782f2

Please sign in to comment.