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