@revrag-ai/embed-react-native
Version:
A powerful React Native library for integrating AI-powered voice agents into mobile applications. Features real-time voice communication, intelligent speech processing, customizable UI components, and comprehensive event handling for building conversation
35 lines (34 loc) • 1.04 kB
JavaScript
;
import AsyncStorage from '@react-native-async-storage/async-storage';
const STORAGE_KEY = '@user_data';
export const setAgentData = async (data, key = STORAGE_KEY) => {
try {
const jsonString = JSON.stringify(data);
await AsyncStorage.setItem(key, jsonString);
} catch (error) {
console.error('Storage save error:', error);
throw error; // Re-throw to allow caller to handle
}
};
export const getAgentData = async (key = STORAGE_KEY) => {
try {
const jsonString = await AsyncStorage.getItem(key);
if (!jsonString) {
return null;
}
const data = JSON.parse(jsonString);
return data;
} catch (error) {
console.error('Storage fetch error:', error);
throw error; // Re-throw to allow caller to handle
}
};
export const deleteFromDetail = async key => {
try {
await AsyncStorage.removeItem(key);
} catch (error) {
console.error('Storage reset error:', error);
throw error; // Re-throw to allow caller to handle
}
};
//# sourceMappingURL=store.key.js.map