tangled
alpha
login
or
join now
bas.sh
/
witchsky.app
forked from
jollywhoppers.com/witchsky.app
0
fork
atom
Bluesky app fork with some witchin' additions 💫
0
fork
atom
overview
issues
pulls
pipelines
add demo storage
authored by
samuel.fm
and committed by
Eric Bailey
10 months ago
c34c67e4
70dbc947
+37
-2
3 changed files
expand all
collapse all
unified
split
src
screens
Settings
AboutSettings.tsx
storage
hooks
demo-mode.ts
schema.ts
+29
-2
src/screens/Settings/AboutSettings.tsx
···
12
12
import {appVersion, BUNDLE_DATE, bundleInfo} from '#/lib/app-info'
13
13
import {STATUS_PAGE_URL} from '#/lib/constants'
14
14
import {type CommonNavigatorParams} from '#/lib/routes/types'
15
15
-
import {isAndroid, isNative} from '#/platform/detection'
15
15
+
import {isAndroid, isIOS, isNative} from '#/platform/detection'
16
16
import * as Toast from '#/view/com/util/Toast'
17
17
import * as SettingsList from '#/screens/Settings/components/SettingsList'
18
18
+
import {Atom_Stroke2_Corner0_Rounded as AtomIcon} from '#/components/icons/Atom'
18
19
import {BroomSparkle_Stroke2_Corner2_Rounded as BroomSparkleIcon} from '#/components/icons/BroomSparkle'
19
20
import {CodeLines_Stroke2_Corner2_Rounded as CodeLinesIcon} from '#/components/icons/CodeLines'
20
21
import {Globe_Stroke2_Corner0_Rounded as GlobeIcon} from '#/components/icons/Globe'
···
22
23
import {Wrench_Stroke2_Corner2_Rounded as WrenchIcon} from '#/components/icons/Wrench'
23
24
import * as Layout from '#/components/Layout'
24
25
import {Loader} from '#/components/Loader'
26
26
+
import {useDemoMode} from '#/storage/hooks/demo-mode'
25
27
import {useDevMode} from '#/storage/hooks/dev-mode'
26
28
import {OTAInfo} from './components/OTAInfo'
27
29
···
29
31
export function AboutSettingsScreen({}: Props) {
30
32
const {_, i18n} = useLingui()
31
33
const [devModeEnabled, setDevModeEnabled] = useDevMode()
34
34
+
const [demoModeEnabled, setDemoModeEnabled] = useDemoMode()
32
35
const stableID = useMemo(() => Statsig.getStableID(), [])
33
36
34
37
const {mutate: onClearImageCache, isPending: isClearingImageCache} =
···
153
156
</SettingsList.ItemText>
154
157
<SettingsList.BadgeText>{bundleInfo}</SettingsList.BadgeText>
155
158
</SettingsList.PressableItem>
156
156
-
{devModeEnabled && <OTAInfo />}
159
159
+
{devModeEnabled && (
160
160
+
<>
161
161
+
<OTAInfo />
162
162
+
{isIOS && (
163
163
+
<SettingsList.PressableItem
164
164
+
onPress={() => {
165
165
+
const newDemoModeEnabled = !demoModeEnabled
166
166
+
setDemoModeEnabled(newDemoModeEnabled)
167
167
+
Toast.show(
168
168
+
'Demo mode ' +
169
169
+
(newDemoModeEnabled ? 'enabled' : 'disabled'),
170
170
+
)
171
171
+
}}
172
172
+
label={
173
173
+
demoModeEnabled ? 'Disable demo mode' : 'Enable demo mode'
174
174
+
}
175
175
+
disabled={isClearingImageCache}>
176
176
+
<SettingsList.ItemIcon icon={AtomIcon} />
177
177
+
<SettingsList.ItemText>
178
178
+
{demoModeEnabled ? 'Disable demo mode' : 'Enable demo mode'}
179
179
+
</SettingsList.ItemText>
180
180
+
</SettingsList.PressableItem>
181
181
+
)}
182
182
+
</>
183
183
+
)}
157
184
</SettingsList.Container>
158
185
</Layout.Content>
159
186
</Layout.Screen>
+7
src/storage/hooks/demo-mode.ts
···
1
1
+
import {device, useStorage} from '#/storage'
2
2
+
3
3
+
export function useDemoMode() {
4
4
+
const [demoMode = false, setDemoMode] = useStorage(device, ['demoMode'])
5
5
+
6
6
+
return [demoMode, setDemoMode] as const
7
7
+
}
+1
src/storage/schema.ts
···
10
10
}
11
11
trendingBetaEnabled: boolean
12
12
devMode: boolean
13
13
+
demoMode: boolean
13
14
}
14
15
15
16
export type Account = {