1import { ProxyNativeModule } from 'expo-modules-core'; 2 3import { NotificationRequest, NotificationContentInput } from './Notifications.types'; 4 5export interface NotificationSchedulerModule extends ProxyNativeModule { 6 getAllScheduledNotificationsAsync?: () => Promise<NotificationRequest[]>; 7 scheduleNotificationAsync?: ( 8 identifier: string, 9 notificationContent: NotificationContentInput, 10 trigger: NotificationTriggerInput 11 ) => Promise<string>; 12 cancelScheduledNotificationAsync?: (identifier: string) => Promise<void>; 13 cancelAllScheduledNotificationsAsync?: () => Promise<void>; 14 getNextTriggerDateAsync?: (trigger: NotificationTriggerInput) => Promise<number>; 15} 16 17export interface ChannelAwareTriggerInput { 18 type: 'channel'; 19 channelId?: string; 20} 21 22// ISO8601 calendar pattern-matching 23export interface CalendarTriggerInput { 24 type: 'calendar'; 25 channelId?: string; 26 repeats?: boolean; 27 value: { 28 timezone?: string; 29 30 year?: number; 31 month?: number; 32 weekday?: number; 33 weekOfMonth?: number; 34 weekOfYear?: number; 35 weekdayOrdinal?: number; 36 day?: number; 37 38 hour?: number; 39 minute?: number; 40 second?: number; 41 }; 42} 43 44export interface TimeIntervalTriggerInput { 45 type: 'timeInterval'; 46 channelId?: string; 47 repeats: boolean; 48 seconds: number; 49} 50 51export interface DailyTriggerInput { 52 type: 'daily'; 53 channelId?: string; 54 hour: number; 55 minute: number; 56} 57 58export interface WeeklyTriggerInput { 59 type: 'weekly'; 60 channelId?: string; 61 weekday: number; 62 hour: number; 63 minute: number; 64} 65 66export interface YearlyTriggerInput { 67 type: 'yearly'; 68 channelId?: string; 69 day: number; 70 month: number; 71 hour: number; 72 minute: number; 73} 74 75export interface DateTriggerInput { 76 type: 'date'; 77 channelId?: string; 78 timestamp: number; // seconds since 1970 79} 80 81export type NotificationTriggerInput = 82 | null 83 | ChannelAwareTriggerInput 84 | DateTriggerInput 85 | CalendarTriggerInput 86 | TimeIntervalTriggerInput 87 | DailyTriggerInput 88 | WeeklyTriggerInput 89 | YearlyTriggerInput; 90