Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 78 additions & 9 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,24 +52,93 @@ export interface PushNotification {
}

export interface PresentLocalNotificationDetails {
/**
* The "action" displayed beneath an actionable notification. Defaults to "view";
*/
alertAction?: string;
/**
* The message displayed in the notification alert.
*/
alertBody: string;
alertAction: string;
soundName?: string;
/**
* The text displayed as the title of the notification alert.
*/
alertTitle?: string;
/**
* The number to display as the app's icon badge. Setting the number to 0 removes the icon badge. (optional)
*/
applicationIconBadgeNumber?: number;
/**
* The category of this notification, required for actionable notifications. (optional)
*/
category?: string;
/**
* The sound played when the notification is fired (optional).
*/
soundName?: string;
/**
* If true, the notification will appear without sound (optional).
*/
isSilent?: boolean;
/**
* An object containing additional notification data (optional).
*/
userInfo?: Record<string, any>;
applicationIconBadgeNumber?: number;
}

export interface ScheduleLocalNotificationDetails {
fireDate: string; // Use Date.toISOString() to convert to the expected format
/**
* The "action" displayed beneath an actionable notification. Defaults to "view";
*/
alertAction?: string;
/**
* The message displayed in the notification alert.
*/
alertBody: string;
alertAction: string;
soundName?: string;
/**
* The text displayed as the title of the notification alert.
*/
alertTitle?: string;
/**
* The number to display as the app's icon badge. Setting the number to 0 removes the icon badge. (optional)
*/
applicationIconBadgeNumber?: number;
/**
* The category of this notification, required for actionable notifications. (optional)
*/
category?: string;
/**
* The date and time when the system should deliver the notification.
* Use Date.toISOString() to convert to the expected format
*/
fireDate: string;
/**
* The sound played when the notification is fired (optional).
*/
soundName?: string;
/**
* If true, the notification will appear without sound (optional).
*/
isSilent?: boolean;
/**
* An object containing additional notification data (optional).
*/
userInfo?: Record<string, any>;
applicationIconBadgeNumber?: number;
/**
* The interval to repeat as a string. Possible values: minute, hour, day, week, month, year.
*/
repeatInterval?: 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';
}

export type DeliveredNotification = {
identifier: string;
title: string;
body: string;
category?: string;
userInfo?: Record<string, any>;
'thread-id'?: string;
};

export interface PushNotificationPermissions {
alert?: boolean;
badge?: boolean;
Expand Down Expand Up @@ -138,7 +207,7 @@ export interface PushNotificationIOSStatic {
*/
getDeliveredNotifications(
callback: (notifications: Record<string, any>[]) => void,
): void;
): DeliveredNotification;

/**
* Removes the specified notifications from Notification Center
Expand Down Expand Up @@ -256,7 +325,7 @@ export interface PushNotificationIOSStatic {
* This method returns a promise that resolves to either the notification
* object if the app was launched by a push notification, or `null` otherwise.
*/
getInitialNotification(): Promise<PushNotification>;
getInitialNotification(): Promise<PushNotification | null>;
}

declare const PushNotificationIOS: PushNotificationIOSStatic;
Expand Down