[Persisted] Fork web and native, make it synchronous on the web (#4872)

* Delete logic for legacy storage

* Delete superfluous tests

At this point these tests aren't testing anything useful, let's just get rid of them.

* Inline store.ts methods into persisted/index.ts

* Fork persisted/index.ts into index.web.ts

* Remove non-essential code and comments from both forks

* Remove async/await from web fork of persisted/index.ts

* Remove unused return

* Enforce that forked types match
This commit is contained in:
dan 2024-08-06 00:30:58 +01:00 committed by GitHub
parent 74b0318d89
commit 5bf7f3769d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 187 additions and 516 deletions

View file

@ -20,8 +20,7 @@ import {useQueryClient} from '@tanstack/react-query'
import {isNative} from '#/platform/detection'
import {useModalControls} from '#/state/modals'
import {clearLegacyStorage} from '#/state/persisted/legacy'
import {clear as clearStorage} from '#/state/persisted/store'
import {clearStorage} from '#/state/persisted'
import {
useInAppBrowser,
useSetInAppBrowser,
@ -299,10 +298,6 @@ export function SettingsScreen({}: Props) {
await clearStorage()
Toast.show(_(msg`Storage cleared, you need to restart the app now.`))
}, [_])
const clearAllLegacyStorage = React.useCallback(async () => {
await clearLegacyStorage()
Toast.show(_(msg`Legacy storage cleared, you need to restart the app now.`))
}, [_])
const deactivateAccountControl = useDialogControl()
const onPressDeactivateAccount = React.useCallback(() => {
@ -863,18 +858,6 @@ export function SettingsScreen({}: Props) {
<Trans>Reset onboarding state</Trans>
</Text>
</TouchableOpacity>
<TouchableOpacity
style={[pal.view, styles.linkCardNoIcon]}
onPress={clearAllLegacyStorage}
accessibilityRole="button"
accessibilityLabel={_(msg`Clear all legacy storage data`)}
accessibilityHint={_(msg`Clears all legacy storage data`)}>
<Text type="lg" style={pal.text}>
<Trans>
Clear all legacy storage data (restart after this)
</Trans>
</Text>
</TouchableOpacity>
<TouchableOpacity
style={[pal.view, styles.linkCardNoIcon]}
onPress={clearAllStorage}