1import { CodedError, uuidv4 } from 'expo-modules-core'; 2const INSTALLATION_ID_KEY = 'EXPO_NOTIFICATIONS_INSTALLATION_ID'; 3const REGISTRATION_INFO_KEY = 'EXPO_NOTIFICATIONS_REGISTRATION_INFO'; 4// Lazy fallback installationId per session initializer 5let getFallbackInstallationId = () => { 6 const sessionInstallationId = uuidv4(); 7 getFallbackInstallationId = () => sessionInstallationId; 8}; 9export default { 10 getInstallationIdAsync: async () => { 11 let installationId; 12 try { 13 installationId = localStorage.getItem(INSTALLATION_ID_KEY); 14 if (!installationId || typeof installationId !== 'string') { 15 installationId = uuidv4(); 16 localStorage.setItem(INSTALLATION_ID_KEY, installationId); 17 } 18 } 19 catch { 20 installationId = getFallbackInstallationId(); 21 } 22 return installationId; 23 }, 24 getRegistrationInfoAsync: async () => { 25 return localStorage.getItem(REGISTRATION_INFO_KEY); 26 }, 27 setRegistrationInfoAsync: async (registrationInfo) => { 28 try { 29 if (registrationInfo) { 30 localStorage.setItem(REGISTRATION_INFO_KEY, registrationInfo); 31 } 32 else { 33 localStorage.removeItem(REGISTRATION_INFO_KEY); 34 } 35 } 36 catch (error) { 37 throw new CodedError('ERR_NOTIFICATIONS_STORAGE_ERROR', `Could not modify localStorage to persist auto-registration information: ${error}`); 38 } 39 }, 40 // mock implementations 41 addListener: () => { }, 42 removeListeners: () => { }, 43}; 44//# sourceMappingURL=ServerRegistrationModule.web.js.map