mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at switch-session-failure 27 lines 773 B view raw
1import AsyncStorage from '@react-native-async-storage/async-storage' 2 3import {Schema, schema} from '#/state/persisted/schema' 4import {logger} from '#/logger' 5 6const BSKY_STORAGE = 'BSKY_STORAGE' 7 8export async function write(value: Schema) { 9 schema.parse(value) 10 await AsyncStorage.setItem(BSKY_STORAGE, JSON.stringify(value)) 11} 12 13export async function read(): Promise<Schema | undefined> { 14 const rawData = await AsyncStorage.getItem(BSKY_STORAGE) 15 const objData = rawData ? JSON.parse(rawData) : undefined 16 if (schema.safeParse(objData).success) { 17 return objData 18 } 19} 20 21export async function clear() { 22 try { 23 await AsyncStorage.removeItem(BSKY_STORAGE) 24 } catch (e: any) { 25 logger.error(`persisted store: failed to clear`, {message: e.toString()}) 26 } 27}