blob: 331825c48f72b90678769b58cab1e6d00c78b460 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
import {device, useStorage} from '#/storage'
export function useDevMode() {
const [devMode = false, setDevMode] = useStorage(device, ['devMode'])
return [devMode, setDevMode] as const
}
let cachedIsDevMode: boolean | undefined
/**
* Does not update when toggling dev mode on or off. This util simply retrieves
* the value and caches in memory indefinitely. So after an update, you'll need
* to reload the app so it can pull a fresh value from storage.
*/
export function isDevMode() {
if (__DEV__) return true
if (cachedIsDevMode === undefined) {
cachedIsDevMode = device.get(['devMode']) ?? false
}
return cachedIsDevMode
}
|