pushwoosh-react-native-plugin 1.2.5 → 2.2.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.yml +135 -0
  2. package/.github/ISSUE_TEMPLATE/feature_request.yml +31 -0
  3. package/.github/ISSUE_TEMPLATE/question.yml +28 -0
  4. package/InlineInApp.js +71 -0
  5. package/README.md +35 -85
  6. package/docs/README.md +230 -11
  7. package/index.d.ts +91 -0
  8. package/index.js +536 -154
  9. package/package.json +12 -1
  10. package/pushwoosh-react-native-plugin.podspec +20 -0
  11. package/react-native.config.js +9 -0
  12. package/scripts/add_inbox_ios_resources.js +42 -0
  13. package/src/android/build.gradle +40 -10
  14. package/src/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  15. package/src/android/gradle/wrapper/gradle-wrapper.properties +6 -0
  16. package/src/android/gradlew +160 -0
  17. package/src/android/gradlew.bat +90 -0
  18. package/src/android/src/main/AndroidManifest.xml +19 -54
  19. package/src/android/src/main/java/com/pushwoosh/reactnativeplugin/ConversionUtil.java +214 -148
  20. package/src/android/src/main/java/com/pushwoosh/reactnativeplugin/CustomFirebaseMessagingService.java +29 -0
  21. package/src/android/src/main/java/com/pushwoosh/reactnativeplugin/EventDispatcher.java +10 -2
  22. package/src/android/src/main/java/com/pushwoosh/reactnativeplugin/InboxUiStyleManager.java +162 -0
  23. package/src/android/src/main/java/com/pushwoosh/reactnativeplugin/InlineInAppManager.java +48 -0
  24. package/src/android/src/main/java/com/pushwoosh/reactnativeplugin/PushwooshNotificationServiceExtension.java +44 -0
  25. package/src/android/src/main/java/com/pushwoosh/reactnativeplugin/PushwooshPackage.java +4 -2
  26. package/src/android/src/main/java/com/pushwoosh/reactnativeplugin/PushwooshPlugin.java +608 -297
  27. package/src/android/src/main/java/com/pushwoosh/reactnativeplugin/RCTInlineInAppView.java +75 -0
  28. package/src/android/src/main/java/com/pushwoosh/reactnativeplugin/internal/ReactNativePluginProvider.java +15 -0
  29. package/src/ios/PWAppDelegate.h +20 -0
  30. package/src/ios/PWGDPRManager.h +46 -0
  31. package/src/ios/PWIInboxStyle.h +122 -0
  32. package/src/ios/PWIInboxUI.h +39 -0
  33. package/src/ios/PWInAppManager.h +176 -0
  34. package/src/ios/PWInbox.h +147 -0
  35. package/src/ios/PWInlineInAppView.h +26 -0
  36. package/src/ios/PWLog.h +23 -0
  37. package/src/ios/PWMessaging.h +20 -0
  38. package/src/ios/PWNotificationExtensionManager.h +46 -0
  39. package/src/ios/PWRichMediaManager.h +123 -0
  40. package/src/ios/PWRichMediaStyle.h +122 -0
  41. package/src/ios/PushNotificationManager.h +234 -111
  42. package/src/ios/Pushwoosh.h +623 -0
  43. package/src/ios/PushwooshInboxBundle.bundle/Info.plist +0 -0
  44. package/src/ios/PushwooshInboxBundle.bundle/PWIInboxAttachmentViewController.nib +0 -0
  45. package/src/ios/PushwooshInboxBundle.bundle/PWIInboxMessageViewCell.nib +0 -0
  46. package/src/ios/PushwooshInboxBundle.bundle/PWIInboxViewController.nib +0 -0
  47. package/src/ios/PushwooshInboxBundle.bundle/errorMessage@2x.png +0 -0
  48. package/src/ios/PushwooshInboxBundle.bundle/inbox_icon.png +0 -0
  49. package/src/ios/PushwooshInboxBundle.bundle/noMessage@2x.png +0 -0
  50. package/src/ios/PushwooshInboxBundle.bundle/unread.png +0 -0
  51. package/src/ios/PushwooshInboxUI.h +19 -0
  52. package/src/ios/PushwooshPlugin/PWEventDispatcher.h +1 -1
  53. package/src/ios/PushwooshPlugin/PWInlineInAppManager.h +17 -0
  54. package/src/ios/PushwooshPlugin/PWInlineInAppManager.m +54 -0
  55. package/src/ios/PushwooshPlugin/Pushwoosh.h +19 -2
  56. package/src/ios/PushwooshPlugin/Pushwoosh.m +552 -75
  57. package/src/ios/PushwooshPlugin.xcodeproj/project.pbxproj +27 -6
  58. package/src/ios/libPushwoosh.a +0 -0
  59. package/src/ios/libPushwooshInboxUI.a +0 -0
  60. package/.npmignore +0 -3
  61. package/src/android/.npmignore +0 -1
  62. package/src/android/pushwooshplugin.iml +0 -145
  63. package/src/android/src/main/java/com/pushwoosh/reactnativeplugin/NotificationReceiver.java +0 -42
  64. package/src/android/src/main/java/com/pushwoosh/reactnativeplugin/PostEventActivity.java +0 -45
  65. package/src/ios/Pushwoosh.a +0 -0
  66. package/src/ios/PushwooshPlugin.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
package/index.js CHANGED
@@ -2,182 +2,564 @@
2
2
 
3
3
  import { NativeModules } from 'react-native';
4
4
 
5
- var PushwooshModule = NativeModules.Pushwoosh;
5
+ const PushwooshModule = NativeModules.Pushwoosh;
6
6
 
7
- function PushNotification() {}
8
-
9
- //Function: init
10
- //Call this first thing with your Pushwoosh App ID (pw_appid parameter) and Google Project ID for Android (projectid parameter)
7
+ //Class: PushNotification
8
+ //Use `PushNotification` to register device for push notifications on Pushwoosh and customize notification appearance.
11
9
  //
12
10
  //Example:
13
11
  //(start code)
14
- // //initialize Pushwoosh with projectid: "GOOGLE_PROJECT_ID", appid : "PUSHWOOSH_APP_ID". This will trigger all pending push notifications on start.
15
- // Pushwoosh.init({ projectid: "XXXXXXXXXXXXXXX", pw_appid : "XXXXX-XXXXX" });
12
+ //DeviceEventEmitter.addListener('pushOpened', (e: Event) => {
13
+ // console.warn("pushOpened: " + JSON.stringify(e));
14
+ // alert(JSON.stringify(e));
15
+ //});
16
+ //
17
+ //const Pushwoosh = require('pushwoosh-react-native-plugin');
18
+ //
19
+ //Pushwoosh.init({ "pw_appid" : "XXXX-XXXX", "project_number" : "XXXXXXXXXXXXX", "reverse_proxy_url" : "your_url_proxy" });
20
+ //
21
+ //Pushwoosh.register(
22
+ // (token) => {
23
+ // console.warn("Registered for pushes: " + token);
24
+ // },
25
+ // (error) => {
26
+ // console.warn("Failed to register: " + error);
27
+ // }
28
+ //);
16
29
  //(end)
17
- PushNotification.prototype.init = function(config, success, fail) {
18
- if (!success) {
19
- success = function() {};
30
+ class PushNotification {
31
+
32
+ //Function: init
33
+ //Call this first thing with your Pushwoosh App ID (pw_appid parameter) and Google Project ID for Android (projectid parameter)
34
+ //
35
+ //Example:
36
+ //(start code)
37
+ // //initialize Pushwoosh with projectid: "GOOGLE_PROJECT_ID", appid : "PUSHWOOSH_APP_ID". This will trigger all pending push notifications on start.
38
+ // Pushwoosh.init({ projectid: "XXXXXXXXXXXXXXX", pw_appid : "XXXXX-XXXXX" });
39
+ //(end)
40
+ init(config: Object, success: ?Function, fail: ?Function) {
41
+ if (!success) {
42
+ success = function() {};
43
+ }
44
+ if (!fail) {
45
+ fail = function(error) {};
46
+ }
47
+ PushwooshModule.init(config, success, fail);
20
48
  }
21
- if (!fail) {
22
- fail = function(error) {};
49
+
50
+ //Function: createLocalNotification
51
+ //Creates a local notification with a specified message, delay and custom data
52
+ //
53
+ //Example:
54
+ //(start code)
55
+ // //creates a local notification with "message" content, 5 seconds delay and passes {"somedata":"optional"} object in payload
56
+ // Pushwoosh.createLocalNotification({msg:"message", seconds:5, userData:{"somedata":"optional"}});
57
+ //(end)
58
+
59
+ createLocalNotification(data: Object){
60
+ PushwooshModule.createLocalNotification(data);
23
61
  }
24
- PushwooshModule.init(config, success, fail);
25
- };
26
62
 
27
- //Function: register
28
- //Call this to register for push notifications and retreive a push Token
29
- //
30
- //Example:
31
- //(start code)
32
- // Pushwoosh.registerDevice(
33
- // function(token)
34
- // {
35
- // alert(token);
36
- // },
37
- // function(status)
38
- // {
39
- // alert("failed to register: " + status);
40
- // }
41
- // );
42
- //(end)
43
- PushNotification.prototype.register = function(success, fail) {
44
- if (!success) {
45
- success = function(token) {};
63
+ //Function: clearLocalNotification
64
+ //Clears all existing and cancels all pending local notifications
65
+ //
66
+ //Example:
67
+ //(start code)
68
+ // Pushwoosh.clearLocalNotification();
69
+ //(end)
70
+
71
+ clearLocalNotification(){
72
+ PushwooshModule.clearLocalNotification();
46
73
  }
47
- if (!fail) {
48
- fail = function(error) {};
74
+
75
+ //Function: clearNotificationCenter
76
+ //Clears all existing and cancels all pending notifications
77
+ //
78
+ //Example:
79
+ //(start code)
80
+ // Pushwoosh.clearNotificationCenter();
81
+ //(end)
82
+ clearNotificationCenter(){
83
+ PushwooshModule.clearNotificationCenter();
49
84
  }
50
- PushwooshModule.register(success, fail);
51
- };
52
85
 
53
- //Function: unregister
54
- //Unregisters device from push notifications
55
- PushNotification.prototype.unregister = function(success, fail) {
56
- if (!success) {
57
- success = function(token) {};
86
+ //Function: register
87
+ //Call this to register for push notifications and retreive a push Token
88
+ //
89
+ //Example:
90
+ //(start code)
91
+ // Pushwoosh.registerDevice(
92
+ // function(token)
93
+ // {
94
+ // alert(token);
95
+ // },
96
+ // function(status)
97
+ // {
98
+ // alert("failed to register: " + status);
99
+ // }
100
+ // );
101
+ //(end)
102
+ register(success: ?Function, fail: ?Function) {
103
+ if (!success) {
104
+ success = function(token) {};
105
+ }
106
+ if (!fail) {
107
+ fail = function(error) {};
108
+ }
109
+ PushwooshModule.register(success, fail);
58
110
  }
59
- if (!fail) {
60
- fail = function(error) {};
111
+
112
+ //Function: unregister
113
+ //Unregisters device from push notifications
114
+ unregister(success: ?Function, fail: ?Function) {
115
+ if (!success) {
116
+ success = function(token) {};
117
+ }
118
+ if (!fail) {
119
+ fail = function(error) {};
120
+ }
121
+ PushwooshModule.unregister(success, fail);
61
122
  }
62
- PushwooshModule.unregister(success, fail);
63
- };
64
123
 
65
- //Function: unregister
66
- //Unregisters device from push notifications
67
- PushNotification.prototype.onPushOpen = function(callback) {
68
- PushwooshModule.onPushOpen(callback);
69
- };
124
+ //Function: onPushOpen
125
+ //Deprecated - use DeviceEventEmitter.addListener('pushOpened', callback) instead
126
+ onPushOpen(callback: Function) {
127
+ PushwooshModule.onPushOpen(callback);
128
+ }
70
129
 
71
- //Function: setTags
72
- //Call this to set tags for the device
73
- //
74
- //Example:
75
- //sets the following tags: "deviceName" with value "hello" and "deviceId" with value 10
76
- //(start code)
77
- // Pushwoosh.setTags({deviceName:"hello", deviceId:10},
78
- // function(status) {
79
- // console.warn('setTags success');
80
- // },
81
- // function(status) {
82
- // console.warn('setTags failed');
83
- // }
84
- // );
85
- //
86
- // //setings list tags "MyTag" with values (array) "hello", "world"
87
- // pushNotification.setTags({"MyTag":["hello", "world"]});
88
- //(end)
89
- PushNotification.prototype.setTags = function(tags, success, fail) {
90
- if (!success) {
91
- success = function() {};
130
+ //Function: setTags
131
+ //Call this to set tags for the device
132
+ //
133
+ //Example:
134
+ //sets the following tags: "deviceName" with value "hello" and "deviceId" with value 10
135
+ //(start code)
136
+ // Pushwoosh.setTags({deviceName:"hello", deviceId:10},
137
+ // function(status) {
138
+ // console.warn('setTags success');
139
+ // },
140
+ // function(status) {
141
+ // console.warn('setTags failed');
142
+ // }
143
+ // );
144
+ //
145
+ // //settings list tags "MyTag" with values (array) "hello", "world"
146
+ // pushNotification.setTags({"MyTag":["hello", "world"]});
147
+ //(end)
148
+ setTags(tags: Object, success: ?Function, fail: ?Function) {
149
+ if (!success) {
150
+ success = function() {};
151
+ }
152
+ if (!fail) {
153
+ fail = function(error) {};
154
+ }
155
+ PushwooshModule.setTags(tags, success, fail);
92
156
  }
93
- if (!fail) {
94
- fail = function(error) {};
157
+
158
+ //Function: getTags
159
+ //Call this to get tags for the device
160
+ //
161
+ //Example:
162
+ //(start code)
163
+ // Pushwoosh.getTags(
164
+ // function(tags)
165
+ // {
166
+ // console.warn('tags for the device: ' + JSON.stringify(tags));
167
+ // },
168
+ // function(error)
169
+ // {
170
+ // console.warn('get tags error: ' + JSON.stringify(error));
171
+ // }
172
+ // );
173
+ //(end)
174
+ getTags(success: Function, fail: ?Function) {
175
+ if (!fail) {
176
+ fail = function(error) {};
177
+ }
178
+ PushwooshModule.getTags(success, fail);
95
179
  }
96
- PushwooshModule.setTags(tags, success, fail);
97
- };
98
180
 
99
- //Function: getTags
100
- //Call this to get tags for the device
101
- //
102
- //Example:
103
- //(start code)
104
- // Pushwoosh.getTags(
105
- // function(tags)
106
- // {
107
- // console.warn('tags for the device: ' + JSON.stringify(tags));
108
- // },
109
- // function(error)
110
- // {
111
- // console.warn('get tags error: ' + JSON.stringify(error));
112
- // }
113
- // );
114
- //(end)
115
- PushNotification.prototype.getTags = function(success, fail) {
116
- if (!fail) {
117
- fail = function(error) {};
181
+ //Function: setShowPushnotificationAlert
182
+ //Set push notifications alert when push notification is received while the app is running, default is `true`
183
+ //
184
+ //Example:
185
+ //(start code)
186
+ // Pushwoosh.setShowPushnotificationAlert(false);
187
+ //(end)
188
+ setShowPushnotificationAlert(showPushnotificationAlert: boolean) {
189
+ PushwooshModule.setShowPushnotificationAlert(showPushnotificationAlert);
190
+ }
191
+
192
+ //Function: getShowPushnotificationAlert
193
+ //Show push notifications alert when push notification is received while the app is running, default is `true`
194
+ //
195
+ //Example:
196
+ //(start code)
197
+ // Pushwoosh.getShowPushnotificationAlert((showPushnotificationAlert) => {
198
+ // console.warn("showPushnotificationAlert = " + showPushnotificationAlert);
199
+ // });
200
+ //(end)
201
+ getShowPushnotificationAlert(callback: Function) {
202
+ PushwooshModule.getShowPushnotificationAlert(callback);
203
+ }
204
+
205
+ //Function: getPushToken
206
+ //Call this to get push token if it is available. Note the token also comes in registerDevice function callback.
207
+ //
208
+ //Example:
209
+ //(start code)
210
+ // Pushwoosh.getPushToken(
211
+ // function(token)
212
+ // {
213
+ // console.warn('push token: ' + token);
214
+ // }
215
+ // );
216
+ //(end)
217
+ getPushToken(success: Function) {
218
+ PushwooshModule.getPushToken(success);
118
219
  }
119
- PushwooshModule.getTags(success, fail);
120
- };
121
220
 
122
- //Function: getPushToken
123
- //Call this to get push token if it is available. Note the token also comes in registerDevice function callback.
124
- //
125
- //Example:
126
- //(start code)
127
- // Pushwoosh.getPushToken(
128
- // function(token)
129
- // {
130
- // console.warn('push token: ' + token);
131
- // }
132
- // );
133
- //(end)
134
- PushNotification.prototype.getPushToken = function(success) {
135
- PushwooshModule.getPushToken(success);
136
- };
221
+ //Function: getHwid
222
+ //Call this to get Pushwoosh HWID used for communications with Pushwoosh API
223
+ //
224
+ //Example:
225
+ //(start code)
226
+ // Pushwoosh.getHwid(
227
+ // function(token) {
228
+ // console.warn('Pushwoosh HWID: ' + token);
229
+ // }
230
+ // );
231
+ //(end)
232
+ getHwid(success: Function) {
233
+ PushwooshModule.getHwid(success);
234
+ }
137
235
 
138
- //Function: getHwid
139
- //Call this to get Pushwoosh HWID used for communications with Pushwoosh API
140
- //
141
- //Example:
142
- //(start code)
143
- // Pushwoosh.getHwid(
144
- // function(token) {
145
- // console.warn('Pushwoosh HWID: ' + token);
146
- // }
147
- // );
148
- //(end)
149
- PushNotification.prototype.getHwid = function(success) {
150
- PushwooshModule.getHwid(success);
151
- };
236
+ //Function: setUserId
237
+ //[android, ios] Set User indentifier. This could be Facebook ID, username or email, or any other user ID.
238
+ //This allows data and events to be matched across multiple user devices.
239
+ //
240
+ //Parameters:
241
+ // "userId" - user string identifier
242
+ //
243
+ setUserId(userId: string) {
244
+ PushwooshModule.setUserId(userId);
245
+ }
152
246
 
153
- //Function: setUserId
154
- //[android, ios] Set User indentifier. This could be Facebook ID, username or email, or any other user ID.
155
- //This allows data and events to be matched across multiple user devices.
156
- //
157
- //Parameters:
158
- // "userId" - user string identifier
159
- //
160
- PushNotification.prototype.setUserId = function(userId) {
161
- PushwooshModule.setUserId(userId);
162
- };
247
+ //Function: setUserId: completion:
248
+ //[android, ios] Set User indetifier. This could be Facebook ID, username or email, or any other user ID.
249
+ //This allows data and events to be matched across multiple user devices.
250
+ //If setUserId succeeds competion is called with nil argument. If setUserId fails completion is called with error.
251
+ //Parameters:
252
+ // "userId" - user string identifier
253
+ setUserId(userId: string, success: ?Function, fail: ?Function) {
254
+ if (!success) {
255
+ success = function() {};
256
+ }
257
+ if (!fail) {
258
+ fail = function(error) {};
259
+ }
260
+ PushwooshModule.setUserId(userId, success, fail);
261
+ }
163
262
 
164
- //Function: postEvent
165
- //[android, ios] Post events for In-App Messages. This can trigger In-App message display as specified in Pushwoosh Control Panel.
166
- //
167
- //Parameters:
168
- // "event" - event to trigger
169
- // "attributes" - object with additional event attributes
170
- //
171
- // Example:
172
- //(start code)
173
- // Pushwoosh.setUserId("XXXXXX");
174
- // Pushwoosh.postEvent("buttonPressed", { "buttonNumber" : 4, "buttonLabel" : "banner" });
175
- //(end)
176
- PushNotification.prototype.postEvent = function(event, attributes) {
177
- if (!attributes) {
178
- attributes = {};
263
+ //Function: postEvent
264
+ //[android, ios] Post events for In-App Messages. This can trigger In-App message display as specified in Pushwoosh Control Panel.
265
+ //
266
+ //Parameters:
267
+ // "event" - event to trigger
268
+ // "attributes" - object with additional event attributes
269
+ //
270
+ // Example:
271
+ //(start code)
272
+ // Pushwoosh.setUserId("XXXXXX");
273
+ // Pushwoosh.postEvent("buttonPressed", { "buttonNumber" : 4, "buttonLabel" : "banner" });
274
+ //(end)
275
+ postEvent(event: string, attributes: ?Object) {
276
+ if (!attributes) {
277
+ attributes = {};
278
+ }
279
+ PushwooshModule.postEvent(event, attributes);
280
+ }
281
+
282
+ //Function: setApplicationIconBadgeNumber
283
+ //[android, ios, wp8, windows] Set the application icon badge number
284
+ //
285
+ //Parameters:
286
+ // "badgeNumber" - icon badge number
287
+ //
288
+ setApplicationIconBadgeNumber(badgeNumber: number) {
289
+ PushwooshModule.setApplicationIconBadgeNumber(badgeNumber);
290
+ }
291
+
292
+ //Function: getApplicationIconBadgeNumber
293
+ //[android, ios] Returns the application icon badge number
294
+ //
295
+ //Parameters:
296
+ // "callback" - success callback
297
+ //
298
+ //Example:
299
+ //(start code)
300
+ // Pushwoosh.getApplicationIconBadgeNumber(function(badge){ alert(badge);} );
301
+ //(end)
302
+ getApplicationIconBadgeNumber(callback: Function) {
303
+ PushwooshModule.getApplicationIconBadgeNumber(callback);
304
+ }
305
+
306
+ //Function: addToApplicationIconBadgeNumber
307
+ //[android, ios] Adds value to the application icon badge
308
+ //
309
+ //Parameters:
310
+ // "badgeNumber" - incremental icon badge number
311
+ //
312
+ //Example:
313
+ //(start code)
314
+ // Pushwoosh.addToApplicationIconBadgeNumber(5);
315
+ // Pushwoosh.addToApplicationIconBadgeNumber(-5);
316
+ //(end)
317
+ addToApplicationIconBadgeNumber(badgeNumber: number) {
318
+ PushwooshModule.addToApplicationIconBadgeNumber(badgeNumber);
319
+ }
320
+
321
+ //Function: setMultiNotificationMode
322
+ //[android] Allows multiple notifications to be displayed in the Android Notification Center
323
+ setMultiNotificationMode(on: boolean) {
324
+ PushwooshModule.setMultiNotificationMode(on);
325
+ }
326
+
327
+ //Function: setLightScreenOnNotification
328
+ //[android] Turns the screen on if notification arrives
329
+ //
330
+ //Parameters:
331
+ // "on" - enable/disable screen unlock (is disabled by default)
332
+ //
333
+ setLightScreenOnNotification(on: boolean) {
334
+ PushwooshModule.setLightScreenOnNotification(on);
335
+ }
336
+
337
+ //Function: setEnableLED
338
+ //[android] Enables led blinking when notification arrives and display is off
339
+ //
340
+ //Parameters:
341
+ // "on" - enable/disable led blink (is disabled by default)
342
+ //
343
+ setEnableLED(on: boolean) {
344
+ PushwooshModule.setEnableLED(on);
345
+ }
346
+
347
+ //Function: setEnableLED
348
+ //[android] Set led color. Use with <setEnableLED>
349
+ //
350
+ //Parameters:
351
+ // "color" - led color in ARGB integer format
352
+ //
353
+ setColorLED(color: number) {
354
+ PushwooshModule.setColorLED(color);
355
+ }
356
+
357
+ //Function: setSoundType
358
+ //[android] Sets default sound to play when push notification arrive.
359
+ //
360
+ //Parameters:
361
+ // "type" - Sound type (0 - default, 1 - no sound, 2 - always)
362
+ //
363
+ setSoundType(type: number) {
364
+ PushwooshModule.setSoundType(type);
365
+ }
366
+
367
+ //Function: setVibrateType
368
+ //[android] Sets default vibration mode when push notification arrive.
369
+ //
370
+ //Parameters:
371
+ // "type" - Vibration type (0 - default, 1 - no vibration, 2 - always)
372
+ //
373
+ setVibrateType(type: number) {
374
+ PushwooshModule.setVibrateType(type);
375
+ }
376
+
377
+ //Function: presentInboxUI
378
+ //[android, ios] Opens Inbox screen.
379
+ //
380
+ // Supported style keys:
381
+ //
382
+ // Customizes the date formatting
383
+ // "dateFormat"
384
+ //
385
+ // The default icon in the cell next to the message; if not specified, the app icon is used
386
+ // "defaultImageIcon"
387
+ //
388
+ // The appearance of the unread messages mark (iOS only)
389
+ // "unreadImage"
390
+ //
391
+ // The image which is displayed if an error occurs and the list of inbox messages is empty
392
+ // "listErrorImage"
393
+ //
394
+ // The image which is displayed if the list of inbox messages is empty
395
+ // "listEmptyImage"
396
+ //
397
+ // The error text which is displayed when an error occurs; cannot be localized
398
+ // "listErrorMessage"
399
+ //
400
+ // The text which is displayed if the list of inbox messages is empty; cannot be localized
401
+ // "listEmptyMessage"
402
+ //
403
+ // The default text color (iOS only)
404
+ // "defaultTextColor"
405
+ //
406
+ // The accent color
407
+ // "accentColor"
408
+ //
409
+ // The default background color
410
+ // "backgroundColor"
411
+ //
412
+ // The default selection color
413
+ // "highlightColor"
414
+ //
415
+ // The color of message titles
416
+ // "titleColor"
417
+ //
418
+ // The color of message titles if message was readed (Android only)
419
+ // "readTitleColor"
420
+ //
421
+ // The color of messages descriptions
422
+ // "descriptionColor"
423
+ //
424
+ // The color of messages descriptions if message was readed (Android only)
425
+ // "readDescriptionColor"
426
+ //
427
+ // The color of message dates
428
+ // "dateColor"
429
+ //
430
+ // The color of message dates if message was readed (Android only)
431
+ // "readDateColor"
432
+ //
433
+ // The color of the separator
434
+ // "dividerColor"
435
+ //
436
+ //Example:
437
+ //(start code)
438
+ // Pushwoosh.presentInboxUI({
439
+ // "dateFormat" : "dd.MMMM.YYYY",
440
+ // "defaultImageIcon" : Image.resolveAssetSource(require('./icon.png')),
441
+ // "listErrorImage" : Image.resolveAssetSource(require('./error.png')),
442
+ // "listEmptyImage" : Image.resolveAssetSource(require('./empty.png')),
443
+ // "listErrorMessage" : "Error message1",
444
+ // "listEmptyMessage" : "Error message2",
445
+ // "accentColor" : processColor('#ff00ff'),
446
+ // "highlightColor" : processColor('yellow'),
447
+ // "dateColor" : processColor('blue'),
448
+ // "titleColor" : processColor('#ff00ff'),
449
+ // "dividerColor" : processColor('#ff00ff'),
450
+ // "descriptionColor" : processColor('green'),
451
+ // "backgroundColor" : processColor('rgba(255, 100, 30, 1.0)'),
452
+ // "barBackgroundColor" : processColor('#ffffff'),
453
+ // "barAccentColor" : processColor('#ffd700'),
454
+ // "barTextColor" : processColor('#282828')
455
+ // });
456
+ //(end)
457
+
458
+ presentInboxUI(style: ?Object) {
459
+ PushwooshModule.presentInboxUI(style);
460
+ }
461
+
462
+ messagesWithNoActionPerformedCount(result: Function) {
463
+ PushwooshModule.messagesWithNoActionPerformedCount(result);
464
+ }
465
+
466
+ unreadMessagesCount(result: Function) {
467
+ PushwooshModule.unreadMessagesCount(result);
468
+ }
469
+
470
+ messagesCount(result: Function) {
471
+ PushwooshModule.messagesCount(result);
472
+ }
473
+
474
+ loadMessages(success: Function, fail: ?Function) {
475
+ if (!fail) {
476
+ fail = function() {};
477
+ }
478
+ PushwooshModule.loadMessages(success, fail);
479
+ }
480
+
481
+ readMessage(id: string) {
482
+ PushwooshModule.readMessage(id);
483
+ }
484
+
485
+ readMessages(ids: Array) {
486
+ PushwooshModule.readMessages(ids);
487
+ }
488
+
489
+ deleteMessage(id: string) {
490
+ PushwooshModule.deleteMessage(id);
491
+ }
492
+
493
+ deleteMessages(ids: Array) {
494
+ PushwooshModule.deleteMessages(ids);
495
+ }
496
+
497
+ performAction(id: string) {
498
+ PushwooshModule.performAction(id);
499
+ }
500
+
501
+ // Show inApp for change setting Enable/disable all communication with Pushwoosh
502
+ showGDPRConsentUI(){
503
+ PushwooshModule.showGDPRConsentUI();
504
+ }
505
+
506
+ // Show inApp for all device data from Pushwoosh and stops all interactions and communication permanently.
507
+ showGDPRDeletionUI(){
508
+ PushwooshModule.showGDPRDeletionUI();
509
+ }
510
+
511
+ isDeviceDataRemoved(success: Function){
512
+ PushwooshModule.isDeviceDataRemoved(success);
513
+ }
514
+
515
+ // Return flag is enable communication with server
516
+ isCommunicationEnabled(success: Function){
517
+ PushwooshModule.isCommunicationEnabled(success);
518
+ }
519
+
520
+ // Return flag is enabled GDPR on server
521
+ isAvailableGDPR(success: Function){
522
+ PushwooshModule.isAvailableGDPR(success);
523
+ }
524
+
525
+ // Enable/disable all communication with Pushwoosh. Enabled by default.
526
+ setCommunicationEnabled(enable: boolean, success: ?Function, fail: ?Function) {
527
+ if (!success) {
528
+ success = function() {};
529
+ }
530
+ if (!fail) {
531
+ fail = function(error) {};
532
+ }
533
+ PushwooshModule.setCommunicationEnabled(enable, success, fail);
534
+ }
535
+
536
+ // Removes all device data from Pushwoosh and stops all interactions and communication permanently.
537
+ removeAllDeviceData( success: ?Function, fail: ?Function) {
538
+ if (!success) {
539
+ success = function() {};
540
+ }
541
+ if (!fail) {
542
+ fail = function(error) {};
543
+ }
544
+ PushwooshModule.removeAllDeviceData(success, fail);
545
+ }
546
+
547
+ // Set notification icon background color
548
+ setNotificationIconBackgroundColor(color: string) {
549
+ PushwooshModule.setNotificationIconBackgroundColor(color);
550
+ }
551
+
552
+ // Set custom application language. Must be a lowercase two-letter code according to ISO-639-1 standard ("en", "de", "fr", etc.).
553
+ // Device language used by default.
554
+ // Set to null if you want to use device language again.
555
+ setLanguage(language: string) {
556
+ PushwooshModule.setLanguage(language);
557
+ }
558
+
559
+ // Enables Huawei push messaging
560
+ enableHuaweiPushNotifications() {
561
+ PushwooshModule.enableHuaweiPushNotifications();
179
562
  }
180
- PushwooshModule.postEvent(event, attributes);
181
- };
563
+ }
182
564
 
183
- module.exports = new PushNotification();
565
+ module.exports = new PushNotification();