1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | export interface PushNotificationPermissions {
|
11 | alert?: boolean | undefined;
|
12 | badge?: boolean | undefined;
|
13 | sound?: boolean | undefined;
|
14 | }
|
15 |
|
16 | export interface PushNotification {
|
17 | |
18 |
|
19 |
|
20 | getMessage(): string | Object;
|
21 |
|
22 | |
23 |
|
24 |
|
25 | getSound(): string;
|
26 |
|
27 | |
28 |
|
29 |
|
30 | getCategory(): string;
|
31 |
|
32 | |
33 |
|
34 |
|
35 | getAlert(): string | Object;
|
36 |
|
37 | |
38 |
|
39 |
|
40 | getContentAvailable(): number;
|
41 |
|
42 | |
43 |
|
44 |
|
45 | getBadgeCount(): number;
|
46 |
|
47 | |
48 |
|
49 |
|
50 | getData(): Object;
|
51 |
|
52 | |
53 |
|
54 |
|
55 | getThreadId(): string;
|
56 |
|
57 | |
58 |
|
59 |
|
60 |
|
61 | finish(result: string): void;
|
62 | }
|
63 |
|
64 | type PresentLocalNotificationDetails = {
|
65 | alertBody: string;
|
66 | alertAction: string;
|
67 | alertTitle?: string | undefined;
|
68 | soundName?: string | undefined;
|
69 | category?: string | undefined;
|
70 | userInfo?: Object | undefined;
|
71 | applicationIconBadgeNumber?: number | undefined;
|
72 | };
|
73 |
|
74 | type ScheduleLocalNotificationDetails = {
|
75 | alertAction?: string | undefined;
|
76 | alertBody?: string | undefined;
|
77 | alertTitle?: string | undefined;
|
78 | applicationIconBadgeNumber?: number | undefined;
|
79 | category?: string | undefined;
|
80 | fireDate?: number | string | undefined;
|
81 | isSilent?: boolean | undefined;
|
82 | repeatInterval?:
|
83 | | 'year'
|
84 | | 'month'
|
85 | | 'week'
|
86 | | 'day'
|
87 | | 'hour'
|
88 | | 'minute'
|
89 | | undefined;
|
90 | soundName?: string | undefined;
|
91 | userInfo?: Object | undefined;
|
92 | };
|
93 |
|
94 | export type PushNotificationEventName =
|
95 | | 'notification'
|
96 | | 'localNotification'
|
97 | | 'register'
|
98 | | 'registrationError';
|
99 |
|
100 | type FetchResult = {
|
101 | NewData: 'UIBackgroundFetchResultNewData';
|
102 | NoData: 'UIBackgroundFetchResultNoData';
|
103 | ResultFailed: 'UIBackgroundFetchResultFailed';
|
104 | };
|
105 |
|
106 |
|
107 |
|
108 |
|
109 |
|
110 |
|
111 |
|
112 | export interface PushNotificationIOSStatic {
|
113 | |
114 |
|
115 |
|
116 |
|
117 |
|
118 |
|
119 |
|
120 |
|
121 |
|
122 |
|
123 | presentLocalNotification(details: PresentLocalNotificationDetails): void;
|
124 |
|
125 | |
126 |
|
127 |
|
128 |
|
129 |
|
130 |
|
131 |
|
132 |
|
133 |
|
134 |
|
135 |
|
136 | scheduleLocalNotification(details: ScheduleLocalNotificationDetails): void;
|
137 |
|
138 | |
139 |
|
140 |
|
141 | cancelAllLocalNotifications(): void;
|
142 |
|
143 | |
144 |
|
145 |
|
146 | removeAllDeliveredNotifications(): void;
|
147 |
|
148 | |
149 |
|
150 |
|
151 | getDeliveredNotifications(callback: (notifications: Object[]) => void): void;
|
152 |
|
153 | |
154 |
|
155 |
|
156 | removeDeliveredNotifications(identifiers: string[]): void;
|
157 |
|
158 | |
159 |
|
160 |
|
161 |
|
162 | cancelLocalNotifications(userInfo: Object): void;
|
163 |
|
164 | |
165 |
|
166 |
|
167 | setApplicationIconBadgeNumber(number: number): void;
|
168 |
|
169 | |
170 |
|
171 |
|
172 | getApplicationIconBadgeNumber(callback: (badge: number) => void): void;
|
173 |
|
174 | |
175 |
|
176 |
|
177 | getScheduledLocalNotifications(
|
178 | callback: (notifications: ScheduleLocalNotificationDetails[]) => void,
|
179 | ): void;
|
180 |
|
181 | |
182 |
|
183 |
|
184 |
|
185 |
|
186 |
|
187 |
|
188 |
|
189 | addEventListener(
|
190 | type: 'notification' | 'localNotification',
|
191 | handler: (notification: PushNotification) => void,
|
192 | ): void;
|
193 |
|
194 | |
195 |
|
196 |
|
197 |
|
198 |
|
199 |
|
200 |
|
201 | addEventListener(
|
202 | type: 'register',
|
203 | handler: (deviceToken: string) => void,
|
204 | ): void;
|
205 |
|
206 | |
207 |
|
208 |
|
209 |
|
210 |
|
211 |
|
212 |
|
213 |
|
214 | addEventListener(
|
215 | type: 'registrationError',
|
216 | handler: (error: {message: string; code: number; details: any}) => void,
|
217 | ): void;
|
218 |
|
219 | |
220 |
|
221 |
|
222 |
|
223 | removeEventListener(
|
224 | type: PushNotificationEventName,
|
225 | handler:
|
226 | | ((notification: PushNotification) => void)
|
227 | | ((deviceToken: string) => void)
|
228 | | ((error: {message: string; code: number; details: any}) => void),
|
229 | ): void;
|
230 |
|
231 | /**
|
232 | * Requests all notification permissions from iOS, prompting the user's
|
233 | * dialog box.
|
234 | */
|
235 | requestPermissions(permissions?: PushNotificationPermissions[]): void;
|
236 |
|
237 | /**
|
238 | * Requests all notification permissions from iOS, prompting the user's
|
239 | * dialog box.
|
240 | */
|
241 | requestPermissions(
|
242 | permissions?: PushNotificationPermissions,
|
243 | ): Promise<PushNotificationPermissions>;
|
244 |
|
245 | /**
|
246 | * Unregister for all remote notifications received via Apple Push
|
247 | * Notification service.
|
248 | * You should call this method in rare circumstances only, such as when
|
249 | * a new version of the app removes support for all types of remote
|
250 | * notifications. Users can temporarily prevent apps from receiving
|
251 | * remote notifications through the Notifications section of the
|
252 | * Settings app. Apps unregistered through this method can always
|
253 | * re-register.
|
254 | */
|
255 | abandonPermissions(): void;
|
256 |
|
257 | /**
|
258 | * See what push permissions are currently enabled. `callback` will be
|
259 | * invoked with a `permissions` object:
|
260 | *
|
261 | * - `alert` :boolean
|
262 | * - `badge` :boolean
|
263 | * - `sound` :boolean
|
264 | */
|
265 | checkPermissions(
|
266 | callback: (permissions: PushNotificationPermissions) => void,
|
267 | ): void;
|
268 |
|
269 | /**
|
270 | * This method returns a promise that resolves to either the notification
|
271 | * object if the app was launched by a push notification, or `null` otherwise.
|
272 | */
|
273 | getInitialNotification(): Promise<PushNotification | null>;
|
274 |
|
275 | /**
|
276 | * iOS fetch results that best describe the result of a finished remote notification handler.
|
277 | * For a list of possible values, see `PushNotificationIOS.FetchResult`.
|
278 | */
|
279 | FetchResult: FetchResult;
|
280 | }
|
281 |
|
282 | /**
|
283 | * PushNotificationIOS has been extracted from react-native core and will be removed in a future release.
|
284 | * It can now be installed and imported from `@react-native-community/push-notification-ios` instead of 'react-native'.
|
285 | * @see https://github.com/react-native-community/react-native-push-notification-ios
|
286 | * @deprecated
|
287 | */
|
288 | export const PushNotificationIOS: PushNotificationIOSStatic;
|
289 | /**
|
290 | * PushNotificationIOS has been extracted from react-native core and will be removed in a future release.
|
291 | * It can now be installed and imported from `@react-native-community/push-notification-ios` instead of 'react-native'.
|
292 | * @see https://github.com/react-native-community/react-native-push-notification-ios
|
293 | * @deprecated
|
294 | */
|
295 | export type PushNotificationIOS = PushNotificationIOSStatic;
|
296 |
|
\ | No newline at end of file |