Skip to content

Commit

Permalink
Use Local Storage Abstraction
Browse files Browse the repository at this point in the history
  • Loading branch information
say25 committed Nov 2, 2018
1 parent be317bd commit 18c0abe
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions app/src/ui/lib/application-theme.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { assertNever } from '../../lib/fatal-error'

import { getBoolean, setBoolean } from '../../lib/local-storage'
/**
* A set of the user-selectable appearances (aka themes)
*/
Expand Down Expand Up @@ -65,15 +65,12 @@ const automaticallySwitchApplicationThemeKey = 'autoSwitchTheme'
* theme will be returned.
*/
export function getAutoSwitchPersistedTheme(): boolean {
return localStorage.getItem(automaticallySwitchApplicationThemeKey) === 'true'
return getBoolean(automaticallySwitchApplicationThemeKey, false)
}

/**
* Store whether or not the user wishes to automatically switch the selected theme in the persistent store (localStorage).
*/
export function setAutoSwitchPersistedTheme(autoSwitchTheme: boolean) {
localStorage.setItem(
automaticallySwitchApplicationThemeKey,
autoSwitchTheme ? 'true' : 'false'
)
setBoolean(automaticallySwitchApplicationThemeKey, autoSwitchTheme)
}

0 comments on commit 18c0abe

Please sign in to comment.