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
@@ -5,12 +5,25 @@
5
5
  //
6
6
 
7
7
  #import <Foundation/Foundation.h>
8
+
9
+ #if TARGET_OS_IOS
10
+
8
11
  #import <UIKit/UIKit.h>
9
12
  #import <StoreKit/StoreKit.h>
10
13
 
14
+ #endif
15
+
16
+
11
17
  @class PushNotificationManager;
18
+
19
+ #if TARGET_OS_IOS || TARGET_OS_WATCH
20
+
21
+ #import <UserNotifications/UserNotifications.h>
22
+
12
23
  @class CLLocation;
13
24
 
25
+ #endif
26
+
14
27
  typedef void (^PushwooshGetTagsHandler)(NSDictionary *tags);
15
28
  typedef void (^PushwooshErrorHandler)(NSError *error);
16
29
 
@@ -18,6 +31,8 @@ typedef void (^PushwooshErrorHandler)(NSError *error);
18
31
  `PushNotificationDelegate` protocol defines the methods that can be implemented in the delegate of the `PushNotificationManager` class' singleton object.
19
32
  These methods provide information about the key events for push notification manager such as registering with APS services, receiving push notifications or working with the received notification.
20
33
  These methods implementation allows to react on these events properly.
34
+
35
+ Deprecated. Use PWMessagingDelegate instead.
21
36
  */
22
37
  @protocol PushNotificationDelegate
23
38
 
@@ -39,12 +54,10 @@ typedef void (^PushwooshErrorHandler)(NSError *error);
39
54
  /**
40
55
  Tells the delegate that the push manager has received a remote notification.
41
56
 
42
- If this method is implemented `onPushAccepted:withNotification:` will not be called, internal message boxes will not be displayed.
43
-
44
57
  @param pushManager The push manager that received the remote notification.
45
58
  @param pushNotification A dictionary that contains information referring to the remote notification, potentially including a badge number for the application icon, an alert sound, an alert message to display to the user, a notification identifier, and custom data.
46
59
  The provider originates it as a JSON-defined dictionary that iOS converts to an NSDictionary object; the dictionary may contain only property-list objects plus NSNull.
47
- @param onStart If the application was not active when the push notification was received, the application will be launched with this parameter equal to `YES`, otherwise the parameter will be `NO`.
60
+ @param onStart If the application was not foreground when the push notification was received, the application will be opened with this parameter equal to `YES`, otherwise the parameter will be `NO`.
48
61
  */
49
62
  - (void)onPushReceived:(PushNotificationManager *)pushManager withNotification:(NSDictionary *)pushNotification onStart:(BOOL)onStart;
50
63
 
@@ -56,35 +69,44 @@ typedef void (^PushwooshErrorHandler)(NSError *error);
56
69
  @param pushNotification A dictionary that contains information referring to the remote notification, potentially including a badge number for the application icon, an alert sound, an alert message to display to the user, a notification identifier, and custom data.
57
70
  The provider originates it as a JSON-defined dictionary that iOS converts to an NSDictionary object; the dictionary may contain only property-list objects plus NSNull.
58
71
  Push dictionary sample:
59
-
60
- {
61
- aps = {
62
- alert = "Some text.";
63
- sound = default;
64
- };
65
- p = 1pb;
66
- }
67
-
72
+ @code
73
+ {
74
+ aps = {
75
+ alert = "Some text.";
76
+ sound = default;
77
+ };
78
+ p = 1pb;
79
+ }
80
+ @endcode
68
81
  */
69
- - (void)onPushAccepted:(PushNotificationManager *)pushManager withNotification:(NSDictionary *)pushNotification;
82
+ - (void)onPushAccepted:(PushNotificationManager *)pushManager withNotification:(NSDictionary *)pushNotification DEPRECATED_ATTRIBUTE;
70
83
 
71
84
  /**
72
- Tells the delegate that the user has pressed OK on the push notification.
85
+ Tells the delegate that a custom action was triggered when opening a notification.
86
+
87
+ @param identifier NSString containing an ID of a clicked button. This ID is set by a user when creating a category in the Pushwoosh Control Panel
88
+ @param notification NSDictionary with push payload.
89
+ */
90
+ - (void)onActionIdentifierReceived:(NSString *)identifier withNotification:(NSDictionary *)notification;
91
+
92
+ /**
93
+ Tells the delegate that the user has pressed on the push notification banner.
73
94
 
74
95
  @param pushManager The push manager that received the remote notification.
75
96
  @param pushNotification A dictionary that contains information about the remote notification, potentially including a badge number for the application icon, an alert sound, an alert message to display to the user, a notification identifier, and custom data.
76
97
  The provider originates it as a JSON-defined dictionary that iOS converts to an NSDictionary object; the dictionary may contain only property-list objects plus NSNull.
77
98
  Push dictionary sample:
99
+ @code
100
+ {
101
+ aps = {
102
+ alert = "Some text.";
103
+ sound = default;
104
+ };
105
+ p = 1pb;
106
+ }
107
+ @endcode
78
108
 
79
- {
80
- aps = {
81
- alert = "Some text.";
82
- sound = default;
83
- };
84
- p = 1pb;
85
- }
86
-
87
- @param onStart If the application was not active when the push notification was received, the application will be launched with this parameter equal to `YES`, otherwise the parameter will be `NO`.
109
+ @param onStart If the application was not foreground when the push notification was received, the application will be opened with this parameter equal to `YES`, otherwise the parameter will be `NO`.
88
110
  */
89
111
  - (void)onPushAccepted:(PushNotificationManager *)pushManager withNotification:(NSDictionary *)pushNotification onStart:(BOOL)onStart;
90
112
 
@@ -93,12 +115,12 @@ typedef void (^PushwooshErrorHandler)(NSError *error);
93
115
 
94
116
  @param tags Dictionary representation of received tags.
95
117
  Dictionary example:
96
-
97
- {
98
- Country = ru;
99
- Language = ru;
100
- }
101
-
118
+ @code
119
+ {
120
+ Country = ru;
121
+ Language = ru;
122
+ }
123
+ @endcode
102
124
  */
103
125
  - (void)onTagsReceived:(NSDictionary *)tags;
104
126
 
@@ -114,19 +136,33 @@ typedef void (^PushwooshErrorHandler)(NSError *error);
114
136
 
115
137
  @param code In-App code
116
138
  */
117
- - (void)onInAppClosed:(NSString *)code;
139
+ - (void)onInAppClosed:(NSString *)code __attribute__((deprecated("Use PWRichMediaPresentingDelegate protocol from PWRichMediaManager.h")));
118
140
 
119
141
  /**
120
142
  Tells the delegate that In-App with specified code has been displayed
121
143
 
122
144
  @param code In-App code
123
145
  */
124
- - (void)onInAppDisplayed:(NSString *)code;
146
+ - (void)onInAppDisplayed:(NSString *)code __attribute__((deprecated("Use PWRichMediaPresentingDelegate protocol from PWRichMediaManager.h")));
147
+
148
+
149
+ #if TARGET_OS_IOS || TARGET_OS_WATCH
150
+ /**
151
+ The method will be called on the delegate when the application is launched in response to the user's request to view in-app notification settings.
152
+ Add UNAuthorizationOptionProvidesAppNotificationSettings as an option in [PushNotificationManager pushManager].additionalAuthorizationOptions to add a button to inline notification settings view and the notification settings view in Settings.
153
+ The notification will be nil when opened from Settings.
154
+
155
+ @param pushManager PushNotificationManager instance
156
+ @param notification Source notification
157
+ */
158
+ - (void)pushManager:(PushNotificationManager *)pushManager openSettingsForNotification:(UNNotification *)notification __IOS_AVAILABLE(12.0);
159
+
160
+ #endif
125
161
 
126
162
  @end
127
163
 
128
164
  /**
129
- `PWTags` class encapsulates the methods for creating tags parameters for sending them to the server.
165
+ `PWTags` class encapsulates the methods for creating tags parameters for sending them to the server.
130
166
  */
131
167
  @interface PWTags : NSObject
132
168
 
@@ -134,14 +170,15 @@ typedef void (^PushwooshErrorHandler)(NSError *error);
134
170
  Creates a dictionary for incrementing/decrementing a numeric tag on the server.
135
171
 
136
172
  Example:
173
+ @code
174
+ NSDictionary *tags = @{
175
+ @"Alias" : aliasField.text,
176
+ @"FavNumber" : @([favNumField.text intValue]),
177
+ @"price": [PWTags incrementalTagWithInteger:5],
178
+ };
137
179
 
138
- NSDictionary *tags = [NSDictionary dictionaryWithObjectsAndKeys:
139
- aliasField.text, @"Alias",
140
- [NSNumber numberWithInt:[favNumField.text intValue]], @"FavNumber",
141
- [PWTags incrementalTagWithInteger:5], @"price",
142
- nil];
143
-
144
- [[PushNotificationManager pushManager] setTags:tags];
180
+ [[PushNotificationManager pushManager] setTags:tags];
181
+ @endcode
145
182
 
146
183
  @param delta Difference that needs to be applied to the tag's counter.
147
184
 
@@ -149,10 +186,33 @@ typedef void (^PushwooshErrorHandler)(NSError *error);
149
186
  */
150
187
  + (NSDictionary *)incrementalTagWithInteger:(NSInteger)delta;
151
188
 
189
+ /**
190
+ Creates a dictionary for extending Tag’s values list with additional values
191
+
192
+ Example:
193
+
194
+ @code
195
+ NSDictionary *tags = @{
196
+ @"Alias" : aliasField.text,
197
+ @"FavNumber" : @([favNumField.text intValue]),
198
+ @"List" : [PWTags appendValuesToListTag:@[ @"Item1" ]]
199
+ };
200
+
201
+ [[PushNotificationManager pushManager] setTags:tags];
202
+ @endcode
203
+
204
+ @param array Array of values to be added to the tag.
205
+
206
+ @return Dictionary to be sent as the value for the tag
207
+ */
208
+ + (NSDictionary *)appendValuesToListTag:(NSArray<NSString *> *)array;
209
+
152
210
  @end
153
211
 
154
212
  /**
155
- `PushNotificationManager` class offers access to the singletone-instance of the push manager responsible for registering the device with the APS servers, receiving and processing push notifications.
213
+ `PushNotificationManager` class offers access to the singleton-instance of the push manager responsible for registering the device with the APS servers, receiving and processing push notifications.
214
+
215
+ Deprecated. Use Pushwoosh class instead.
156
216
  */
157
217
  @interface PushNotificationManager : NSObject {
158
218
  }
@@ -173,19 +233,48 @@ typedef void (^PushwooshErrorHandler)(NSError *error);
173
233
  */
174
234
  @property (nonatomic, weak) NSObject<PushNotificationDelegate> *delegate;
175
235
 
236
+ #if TARGET_OS_IOS || TARGET_OS_WATCH
237
+
176
238
  /**
177
239
  Show push notifications alert when push notification is received while the app is running, default is `YES`
178
240
  */
179
241
  @property (nonatomic, assign) BOOL showPushnotificationAlert;
180
242
 
243
+ /**
244
+ Authorization options in addition to UNAuthorizationOptionBadge | UNAuthorizationOptionSound | UNAuthorizationOptionAlert | UNAuthorizationOptionCarPlay.
245
+ */
246
+ @property (nonatomic) UNAuthorizationOptions additionalAuthorizationOptions __IOS_AVAILABLE(12.0);
247
+
248
+ #endif
249
+
181
250
  /**
182
251
  Returns push notification payload if the app was started in response to push notification or null otherwise
183
252
  */
184
253
  @property (nonatomic, copy, readonly) NSDictionary *launchNotification;
185
254
 
255
+ #if TARGET_OS_IOS || TARGET_OS_WATCH
256
+
257
+ /**
258
+ Returns UNUserNotificationCenterDelegate that handles foreground push notifications on iOS10
259
+ */
260
+ @property (nonatomic, strong, readonly) id<UNUserNotificationCenterDelegate> notificationCenterDelegate;
261
+
262
+ #elif TARGET_OS_OSX
263
+
264
+ @property (nonatomic, strong, readonly) id<NSUserNotificationCenterDelegate> notificationCenterDelegate;
265
+
266
+ #endif
267
+
268
+ /**
269
+ Set custom application language. Must be a lowercase two-letter code according to ISO-639-1 standard ("en", "de", "fr", etc.).
270
+ Device language used by default.
271
+ Set to nil if you want to use device language again.
272
+ */
273
+ @property (nonatomic) NSString *language;
274
+
186
275
  /**
187
276
  Initializes PushNotificationManager. Usually called by Pushwoosh Runtime internally.
188
- @param appcCode Pushwoosh App ID.
277
+ @param appCode Pushwoosh App ID.
189
278
  @param appName Application name.
190
279
  */
191
280
  + (void)initializeWithAppCode:(NSString *)appCode appName:(NSString *)appName;
@@ -204,44 +293,65 @@ typedef void (^PushwooshErrorHandler)(NSError *error);
204
293
  - (void)registerForPushNotifications;
205
294
 
206
295
  /**
207
- Unregisters from push notifications. You should call this method in rare circumstances only, such as when a new version of the app drops support for remote notifications. Users can temporarily prevent apps from receiving remote notifications through the Notifications section of the Settings app. Apps unregistered through this method can always re-register.
296
+ Unregisters from push notifications.
208
297
  */
209
- - (void)unregisterForPushNotifications;
298
+ - (void)unregisterForPushNotificationsWithCompletion:(void (^)(NSError *error))completion;
210
299
 
211
- - (instancetype)initWithApplicationCode:(NSString *)appCode appName:(NSString *)appName;
212
- - (id)initWithApplicationCode:(NSString *)appCode navController:(UIViewController *)navController appName:(NSString *)appName __attribute__((deprecated));
300
+ /**
301
+ Deprecated. Use unregisterForPushNotificationsWithCompletion: method instead
302
+ */
303
+ - (void)unregisterForPushNotifications __attribute__((deprecated));
213
304
 
214
305
  /**
215
- Sends geolocation to the server for GeoFencing push technology. Called internally, please use `startLocationTracking` and `stopLocationTracking` functions.
216
-
217
- @param location Location to be sent.
306
+ Deprecated. Use initializeWithAppCode:appName: method instead
307
+ */
308
+ - (instancetype)initWithApplicationCode:(NSString *)appCode appName:(NSString *)appName __attribute__((deprecated));
309
+
310
+ #if TARGET_OS_IOS
311
+
312
+ /**
313
+ Deprecated. Use initializeWithAppCode:appName: method instead
218
314
  */
219
- - (void)sendLocation:(CLLocation *)location;
315
+ - (id)initWithApplicationCode:(NSString *)appCode navController:(UIViewController *)navController appName:(NSString *)appName __attribute__((deprecated));
220
316
 
221
317
  /**
222
318
  Start location tracking.
319
+
320
+ Deprecated. Use PushwooshGeozones framework.
223
321
  */
224
- - (void)startLocationTracking;
322
+ - (void)startLocationTracking __attribute__((deprecated("Use PushwooshGeozones framework")));
225
323
 
226
324
  /**
227
325
  Stops location tracking
326
+
327
+ Deprecated. Use PushwooshGeozones framework.
228
328
  */
229
- - (void)stopLocationTracking;
329
+ - (void)stopLocationTracking __attribute__((deprecated("Use PushwooshGeozones framework")));
230
330
 
331
+ /**
332
+ Explicitly sends geolocation to the server for GeoFencing push technology. Also called internally, please use `startLocationTracking` and `stopLocationTracking` functions.
333
+
334
+ @param location Location to be sent.
335
+
336
+ Deprecated. Use PushwooshGeozones framework.
337
+ */
338
+ - (void)sendLocation:(CLLocation *)location __attribute__((deprecated("Use PushwooshGeozones framework")));
339
+
340
+ #endif
231
341
 
232
342
  /**
233
343
  Send tags to server. Tag names have to be created in the Pushwoosh Control Panel. Possible tag types: Integer, String, Incremental (integer only), List tags (array of values).
234
344
 
235
345
  Example:
236
-
237
- NSDictionary *tags = [NSDictionary dictionaryWithObjectsAndKeys:
238
- aliasField.text, @"Alias",
239
- [NSNumber numberWithInt:[favNumField.text intValue]], @"FavNumber",
240
- [PWTags incrementalTagWithInteger:5], @"price",
241
- [NSArray arrayWithObjects:@"Item1", @"Item2", @"Item3", nil], @"List",
242
- nil];
346
+ @code
347
+ NSDictionary *tags = @{ @"Alias" : aliasField.text,
348
+ @"FavNumber" : @([favNumField.text intValue]),
349
+ @"price" : [PWTags incrementalTagWithInteger:5],
350
+ @"List" : @[ @"Item1", @"Item2", @"Item3" ]
351
+ };
243
352
 
244
- [[PushNotificationManager pushManager] setTags:tags];
353
+ [[PushNotificationManager pushManager] setTags:tags];
354
+ @endcode
245
355
 
246
356
  @param tags Dictionary representation of tags to send.
247
357
  */
@@ -262,12 +372,10 @@ typedef void (^PushwooshErrorHandler)(NSError *error);
262
372
 
263
373
  @param successHandler The block is executed on the successful completion of the request. This block has no return value and takes one argument: the dictionary representation of the recieved tags.
264
374
  Example of the dictionary representation of the received tags:
265
-
266
- {
267
- Country = ru;
268
- Language = ru;
269
- }
270
-
375
+ {
376
+ Country = ru;
377
+ Language = ru;
378
+ }
271
379
  @param errorHandler The block is executed on the unsuccessful completion of the request. This block has no return value and takes one argument: the error that occurred during the request.
272
380
  */
273
381
  - (void)loadTags:(PushwooshGetTagsHandler)successHandler error:(PushwooshErrorHandler)errorHandler;
@@ -277,27 +385,24 @@ typedef void (^PushwooshErrorHandler)(NSError *error);
277
385
  */
278
386
  - (void)sendAppOpen;
279
387
 
280
- /**
281
- Sends current badge value to server. Called internally by SDK Runtime when `UIApplication` `setApplicationBadgeNumber:` is set. This function is used for "auto-incremeting" badges to work.
282
- This way Pushwoosh server can know what current badge value is set for the application.
283
-
284
- @param badge Current badge value.
285
- */
286
- - (void)sendBadges:(NSInteger)badge;
388
+ + (NSString *)pushwooshVersion;
287
389
 
390
+ #if TARGET_OS_IOS
288
391
  /**
289
392
  Sends in-app purchases to Pushwoosh. Use in paymentQueue:updatedTransactions: payment queue method (see example).
290
393
 
291
394
  Example:
292
-
293
- - (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions {
294
- [[PushNotificationManager pushManager] sendSKPaymentTransactions:transactions];
295
- }
395
+ @code
396
+ - (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions {
397
+ [[PushNotificationManager pushManager] sendSKPaymentTransactions:transactions];
398
+ }
399
+ @endcode
296
400
 
297
401
  @param transactions Array of SKPaymentTransaction items as received in the payment queue.
298
402
  */
299
403
  - (void)sendSKPaymentTransactions:(NSArray *)transactions;
300
404
 
405
+
301
406
  /**
302
407
  Tracks individual in-app purchase. See recommended `sendSKPaymentTransactions:` method.
303
408
 
@@ -308,6 +413,7 @@ typedef void (^PushwooshErrorHandler)(NSError *error);
308
413
  */
309
414
  - (void)sendPurchase:(NSString *)productIdentifier withPrice:(NSDecimalNumber *)price currencyCode:(NSString *)currencyCode andDate:(NSDate *)date;
310
415
 
416
+ #endif
311
417
  /**
312
418
  Gets current push token.
313
419
 
@@ -326,39 +432,40 @@ typedef void (^PushwooshErrorHandler)(NSError *error);
326
432
  - (void)handlePushRegistration:(NSData *)devToken;
327
433
  - (void)handlePushRegistrationString:(NSString *)deviceID;
328
434
 
329
- //internal
330
435
  - (void)handlePushRegistrationFailure:(NSError *)error;
331
436
 
332
- //if the push is received while the app is running. internal
437
+ //If the push is received while the app is running. Call it only for iOS version < 10. For iOS 10 and higher use notificationCenterDelegate.
333
438
  - (BOOL)handlePushReceived:(NSDictionary *)userInfo;
334
439
 
335
440
  /**
336
441
  Gets APN payload from push notifications dictionary.
337
442
 
338
443
  Example:
444
+ @code
445
+ - (void)onPushAccepted:(PushNotificationManager *)pushManager withNotification:(NSDictionary *)pushNotification onStart:(BOOL)onStart {
446
+ NSDictionary * apnPayload = [[PushNotificationsManager pushManager] getApnPayload:pushNotification];
447
+ NSLog(@"%@", apnPayload);
448
+ }
449
+ @endcode
339
450
 
340
- - (void) onPushAccepted:(PushNotificationManager *)pushManager withNotification:(NSDictionary *)pushNotification onStart:(BOOL)onStart {
341
- NSDictionary * apnPayload = [[PushNotificationsManager pushManager] getApnPayload:pushNotification];
342
- NSLog(@"%@", apnPayload);
343
- }
344
-
345
451
  For Push dictionary sample:
452
+ @code
453
+ {
454
+ aps = {
455
+ alert = "Some text.";
456
+ sound = default;
457
+ };
458
+ p = 1pb;
459
+ }
460
+ @endcode
346
461
 
347
- {
348
- aps = {
349
- alert = "Some text.";
350
- sound = default;
351
- };
352
- p = 1pb;
353
- }
354
-
355
462
  Result is:
356
-
357
- {
358
- alert = "Some text.";
359
- sound = default;
360
- };
361
-
463
+ @code
464
+ {
465
+ alert = "Some text.";
466
+ sound = default;
467
+ };
468
+ @endcode
362
469
  @param pushNotification Push notifications dictionary as received in `onPushAccepted: withNotification: onStart:`
363
470
  */
364
471
  - (NSDictionary *)getApnPayload:(NSDictionary *)pushNotification;
@@ -367,11 +474,12 @@ typedef void (^PushwooshErrorHandler)(NSError *error);
367
474
  Gets custom JSON string data from push notifications dictionary as specified in Pushwoosh Control Panel.
368
475
 
369
476
  Example:
370
-
371
- - (void) onPushAccepted:(PushNotificationManager *)pushManager withNotification:(NSDictionary *)pushNotification onStart:(BOOL)onStart {
372
- NSString * customData = [[PushNotificationsManager pushManager] getCustomPushData:pushNotification];
373
- NSLog(@"%@", customData);
374
- }
477
+ @code
478
+ - (void)onPushAccepted:(PushNotificationManager *)pushManager withNotification:(NSDictionary *)pushNotification onStart:(BOOL)onStart {
479
+ NSString * customData = [[PushNotificationsManager pushManager] getCustomPushData:pushNotification];
480
+ NSLog(@"%@", customData);
481
+ }
482
+ @endcode
375
483
 
376
484
  @param pushNotification Push notifications dictionary as received in `onPushAccepted: withNotification: onStart:`
377
485
  */
@@ -384,7 +492,9 @@ typedef void (^PushwooshErrorHandler)(NSError *error);
384
492
 
385
493
  /**
386
494
  Returns dictionary with enabled remove notificaton types.
495
+
387
496
  Example enabled push:
497
+ @code
388
498
  {
389
499
  enabled = 1;
390
500
  pushAlert = 1;
@@ -392,10 +502,11 @@ typedef void (^PushwooshErrorHandler)(NSError *error);
392
502
  pushSound = 1;
393
503
  type = 7;
394
504
  }
395
-
505
+ @endcode
396
506
  where "type" field is UIUserNotificationType
397
507
 
398
508
  Disabled push:
509
+ @code
399
510
  {
400
511
  enabled = 1;
401
512
  pushAlert = 0;
@@ -403,6 +514,7 @@ typedef void (^PushwooshErrorHandler)(NSError *error);
403
514
  pushSound = 0;
404
515
  type = 0;
405
516
  }
517
+ @endcode
406
518
 
407
519
  Note: In the latter example "enabled" field means that device can receive push notification but could not display alerts (ex: silent push)
408
520
  */
@@ -416,8 +528,10 @@ typedef void (^PushwooshErrorHandler)(NSError *error);
416
528
  /**
417
529
  Set User indentifier. This could be Facebook ID, username or email, or any other user ID.
418
530
  This allows data and events to be matched across multiple user devices.
531
+
532
+ Deprecated. Use PWInAppManager setUserId method instead
419
533
  */
420
- - (void)setUserId:(NSString *)userId;
534
+ - (void)setUserId:(NSString *)userId __attribute__ ((deprecated));;
421
535
 
422
536
  /**
423
537
  Move all events from oldUserId to newUserId if doMerge is true. If doMerge is false all events for oldUserId are removed.
@@ -425,27 +539,36 @@ typedef void (^PushwooshErrorHandler)(NSError *error);
425
539
  @param oldUserId source user
426
540
  @param newUserId destination user
427
541
  @param doMerge if false all events for oldUserId are removed, if true all events for oldUserId are moved to newUserId
428
- @param completeion callback
542
+ @param completion callback
543
+
544
+ Deprecated. Use PWInAppManager mergeUserId method instead
429
545
  */
430
- - (void)mergeUserId:(NSString *)oldUserId to:(NSString *)newUserId doMerge:(BOOL)doMerge completion:(void (^)(NSError *error))completion;
546
+ - (void)mergeUserId:(NSString *)oldUserId to:(NSString *)newUserId doMerge:(BOOL)doMerge completion:(void (^)(NSError *error))completion __attribute__ ((deprecated));
431
547
 
432
548
  /**
433
549
  Post events for In-App Messages. This can trigger In-App message display as specified in Pushwoosh Control Panel.
434
550
 
435
551
  Example:
552
+ @code
553
+ [[PushNotificationManager pushManager] setUserId:@"96da2f590cd7246bbde0051047b0d6f7"];
554
+ [[PushNotificationManager pushManager] postEvent:@"buttonPressed" withAttributes:@{ @"buttonNumber" : @"4", @"buttonLabel" : @"Banner" } completion:nil];
555
+ @endcode
436
556
 
437
- [[PushNotificationManager pushManager] setUserId:@"96da2f590cd7246bbde0051047b0d6f7"];
438
- [[PushNotificationManager pushManager] postEvent:@"buttonPressed" withAttributes:@{ @"buttonNumber" : @"4", @"buttonLabel" : @"Banner" } completion:nil];
439
-
440
557
  @param event name of the event
441
558
  @param attributes NSDictionary of event attributes
442
559
  @param completion function to call after posting event
560
+
561
+ Deprecated. Use PWInAppManager postEvent method instead
443
562
  */
444
- - (void)postEvent:(NSString *)event withAttributes:(NSDictionary *)attributes completion:(void (^)(NSError *error))completion;
563
+ - (void)postEvent:(NSString *)event withAttributes:(NSDictionary *)attributes completion:(void (^)(NSError *error))completion __attribute__ ((deprecated));
445
564
 
446
565
  /**
447
566
  See `postEvent:withAttributes:completion:`
567
+
568
+ Deprecated. Use PWInAppManager postEvent method instead
448
569
  */
449
- - (void)postEvent:(NSString *)event withAttributes:(NSDictionary *)attributes;
570
+ - (void)postEvent:(NSString *)event withAttributes:(NSDictionary *)attributes __attribute__ ((deprecated));
571
+
572
+ + (BOOL)isPushwooshMessage:(NSDictionary *)userInfo;
450
573
 
451
574
  @end