import { Platform } from 'react-native'; import { requireOptionalNativeModule } from 'expo-modules-core'; interface BbpNotifyNative { /** Post/replace an ongoing notification with a native chronometer counting down to endTimeMillis. */ showCountdown(title: string, body: string, endTimeMillis: number): Promise; /** Remove the countdown notification. */ clear(): Promise; } // Android-only, and only present in a build that includes the native module // (returns null in Expo Go / other platforms — callers degrade gracefully). const native = Platform.OS === 'android' ? (requireOptionalNativeModule('BbpNotify') as BbpNotifyNative | null) : null; /** True when the native ticking-countdown module is available. */ export const hasNativeCountdown = native != null; export async function showCountdown( title: string, body: string, endTimeMillis: number, ): Promise { await native?.showCountdown(title, body, endTimeMillis); } export async function clearCountdown(): Promise { await native?.clear(); }