Persist selected QR code color theme in invite friends dialog (#10892)
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import {device, useStorage} from '#/storage'
|
||||
import {INVITE_THEMES, type InviteThemeKey} from '../themes'
|
||||
|
||||
/**
|
||||
* Persisted color theme for the Invite Friends QR card (APP-2409). Falls back
|
||||
* to 'day' when nothing is stored or the stored key is no longer a valid
|
||||
* theme.
|
||||
*/
|
||||
export function useInviteThemeKey() {
|
||||
const [stored, setThemeKey] = useStorage(device, ['inviteFriendsThemeKey'])
|
||||
const themeKey: InviteThemeKey =
|
||||
stored && stored in INVITE_THEMES ? stored : 'day'
|
||||
return [themeKey, setThemeKey] as const
|
||||
}
|
||||
Reference in New Issue
Block a user