interface PermissionAlertOptions { title: string; message: string; } type ShowPermissionAlertFunction = (options: PermissionAlertOptions) => Promise; let showPermissionAlertRef: ShowPermissionAlertFunction | null = null; export const PermissionService = { set: (fn: ShowPermissionAlertFunction) => { showPermissionAlertRef = fn; }, show: (options: PermissionAlertOptions): Promise => { if (!showPermissionAlertRef) { console.error("PermissionAlert has not been set. Please ensure PermissionProvider is used at the root of your app."); return Promise.resolve(false); } return showPermissionAlertRef(options); }, };