Skip to content

Commit 8cd2df0

Browse files
committed
fix: add missing type definitions
1 parent db0b5ce commit 8cd2df0

File tree

1 file changed

+78
-9
lines changed

1 file changed

+78
-9
lines changed

index.d.ts

Lines changed: 78 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,24 +52,93 @@ export interface PushNotification {
5252
}
5353

5454
export interface PresentLocalNotificationDetails {
55+
/**
56+
* The "action" displayed beneath an actionable notification. Defaults to "view";
57+
*/
58+
alertAction?: string;
59+
/**
60+
* The message displayed in the notification alert.
61+
*/
5562
alertBody: string;
56-
alertAction: string;
57-
soundName?: string;
63+
/**
64+
* The text displayed as the title of the notification alert.
65+
*/
66+
alertTitle?: string;
67+
/**
68+
* The number to display as the app's icon badge. Setting the number to 0 removes the icon badge. (optional)
69+
*/
70+
applicationIconBadgeNumber?: number;
71+
/**
72+
* The category of this notification, required for actionable notifications. (optional)
73+
*/
5874
category?: string;
75+
/**
76+
* The sound played when the notification is fired (optional).
77+
*/
78+
soundName?: string;
79+
/**
80+
* If true, the notification will appear without sound (optional).
81+
*/
82+
isSilent?: boolean;
83+
/**
84+
* An object containing additional notification data (optional).
85+
*/
5986
userInfo?: Record<string, any>;
60-
applicationIconBadgeNumber?: number;
6187
}
6288

6389
export interface ScheduleLocalNotificationDetails {
64-
fireDate: string; // Use Date.toISOString() to convert to the expected format
90+
/**
91+
* The "action" displayed beneath an actionable notification. Defaults to "view";
92+
*/
93+
alertAction?: string;
94+
/**
95+
* The message displayed in the notification alert.
96+
*/
6597
alertBody: string;
66-
alertAction: string;
67-
soundName?: string;
98+
/**
99+
* The text displayed as the title of the notification alert.
100+
*/
101+
alertTitle?: string;
102+
/**
103+
* The number to display as the app's icon badge. Setting the number to 0 removes the icon badge. (optional)
104+
*/
105+
applicationIconBadgeNumber?: number;
106+
/**
107+
* The category of this notification, required for actionable notifications. (optional)
108+
*/
68109
category?: string;
110+
/**
111+
* The date and time when the system should deliver the notification.
112+
* Use Date.toISOString() to convert to the expected format
113+
*/
114+
fireDate: string;
115+
/**
116+
* The sound played when the notification is fired (optional).
117+
*/
118+
soundName?: string;
119+
/**
120+
* If true, the notification will appear without sound (optional).
121+
*/
122+
isSilent?: boolean;
123+
/**
124+
* An object containing additional notification data (optional).
125+
*/
69126
userInfo?: Record<string, any>;
70-
applicationIconBadgeNumber?: number;
127+
/**
128+
* The interval to repeat as a string. Possible values: minute, hour, day, week, month, year.
129+
*/
130+
repeatInterval?: 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';
71131
}
72132

133+
export type DeliveredNotification = {
134+
identifier: string;
135+
title: string;
136+
body: string;
137+
category?: string;
138+
userInfo?: Record<string, any>;
139+
'thread-id'?: string;
140+
};
141+
73142
export interface PushNotificationPermissions {
74143
alert?: boolean;
75144
badge?: boolean;
@@ -138,7 +207,7 @@ export interface PushNotificationIOSStatic {
138207
*/
139208
getDeliveredNotifications(
140209
callback: (notifications: Record<string, any>[]) => void,
141-
): void;
210+
): DeliveredNotification;
142211

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

262331
declare const PushNotificationIOS: PushNotificationIOSStatic;

0 commit comments

Comments
 (0)