remove mmkv storage in debug btn
This commit is contained in:
@@ -3,11 +3,12 @@ import AsyncStorage from '@react-native-async-storage/async-storage'
|
|||||||
import {logger} from '#/logger'
|
import {logger} from '#/logger'
|
||||||
import {
|
import {
|
||||||
defaults,
|
defaults,
|
||||||
Schema,
|
type Schema,
|
||||||
tryParse,
|
tryParse,
|
||||||
tryStringify,
|
tryStringify,
|
||||||
} from '#/state/persisted/schema'
|
} from '#/state/persisted/schema'
|
||||||
import {PersistedApi} from './types'
|
import {device} from '#/storage'
|
||||||
|
import {type PersistedApi} from './types'
|
||||||
import {normalizeData} from './util'
|
import {normalizeData} from './util'
|
||||||
|
|
||||||
export type {PersistedAccount, Schema} from '#/state/persisted/schema'
|
export type {PersistedAccount, Schema} from '#/state/persisted/schema'
|
||||||
@@ -53,6 +54,7 @@ onUpdate satisfies PersistedApi['onUpdate']
|
|||||||
export async function clearStorage() {
|
export async function clearStorage() {
|
||||||
try {
|
try {
|
||||||
await AsyncStorage.removeItem(BSKY_STORAGE)
|
await AsyncStorage.removeItem(BSKY_STORAGE)
|
||||||
|
device.removeAll()
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
logger.error(`persisted store: failed to clear`, {message: e.toString()})
|
logger.error(`persisted store: failed to clear`, {message: e.toString()})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,6 +66,13 @@ export class Storage<Scopes extends unknown[], Schema> {
|
|||||||
keys.forEach(key => this.remove([...scopes, key]))
|
keys.forEach(key => this.remove([...scopes, key]))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For debugging purposes
|
||||||
|
*/
|
||||||
|
removeAll() {
|
||||||
|
this.store.clearAll()
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fires a callback when the storage associated with a given key changes
|
* Fires a callback when the storage associated with a given key changes
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -40,10 +40,10 @@ import {Onboarding} from '#/screens/Onboarding'
|
|||||||
import {SignupQueued} from '#/screens/SignupQueued'
|
import {SignupQueued} from '#/screens/SignupQueued'
|
||||||
import {Takendown} from '#/screens/Takendown'
|
import {Takendown} from '#/screens/Takendown'
|
||||||
import {atoms as a, useLayoutBreakpoints} from '#/alf'
|
import {atoms as a, useLayoutBreakpoints} from '#/alf'
|
||||||
|
import {BlockingAnnouncements} from '#/components/dialogs/BlockingAnnouncements'
|
||||||
import {BottomBarWeb} from './bottom-bar/BottomBarWeb'
|
import {BottomBarWeb} from './bottom-bar/BottomBarWeb'
|
||||||
import {DesktopLeftNav} from './desktop/LeftNav'
|
import {DesktopLeftNav} from './desktop/LeftNav'
|
||||||
import {DesktopRightNav} from './desktop/RightNav'
|
import {DesktopRightNav} from './desktop/RightNav'
|
||||||
import {BlockingAnnouncements} from '#/components/dialogs/BlockingAnnouncements'
|
|
||||||
|
|
||||||
type NativeStackNavigationOptionsWithAuth = NativeStackNavigationOptions & {
|
type NativeStackNavigationOptionsWithAuth = NativeStackNavigationOptions & {
|
||||||
requireAuth?: boolean
|
requireAuth?: boolean
|
||||||
|
|||||||
Reference in New Issue
Block a user