export { default } from "./ExpoNotificationServiceExtensionModule"; export * from "./ExpoNotificationServiceExtension.types"; import NativeModule from "./ExpoNotificationServiceExtensionModule"; import type { NotificationExtensionConfig, ValidationResult, } from "./ExpoNotificationServiceExtension.types"; /** * Configure the Notification Service Extension with payload key mappings. * Must be called at least once before push notifications can be enhanced. * Writes the config to the shared App Group container. */ export function configureNotificationExtension( config: NotificationExtensionConfig ): void { NativeModule.configureNotificationExtension(JSON.stringify(config)); } /** * Pre-download and cache an avatar image in the shared App Group container. * The NSE will use the cached version instead of downloading at notification time. * * @param url - The avatar image URL. * @param id - A stable identifier for the sender or group (used as cache key). */ export function prefetchAvatar(url: string, id: string): Promise { return NativeModule.prefetchAvatar(url, id); } /** * Delete all cached avatar images from the App Group container. */ export function clearAvatarCache(): Promise { return NativeModule.clearAvatarCache(); } /** * Run diagnostics to verify the extension is correctly configured. * Optionally pass a sample push payload to dry-run key extraction. * * @param samplePayload - Optional sample push payload object to test key mapping. */ export async function validateSetup( samplePayload?: Record ): Promise { const json = samplePayload ? JSON.stringify(samplePayload) : undefined; const resultJson = await NativeModule.validateSetup(json); return JSON.parse(resultJson) as ValidationResult; }