pushwoosh-react-native-plugin 6.1.31 → 6.1.33

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.
@@ -58,8 +58,12 @@ body:
58
58
  label: Your Pushwoosh React Native Plugin version
59
59
  description: Your React Native Plugin version which was integrated to the app. You may find it on the [releases page](https://github.com/Pushwoosh/pushwoosh-react-native-plugin/releases)
60
60
  options:
61
+ - 6.1.32
62
+ - 6.1.31
61
63
  - 6.1.30
64
+ - 6.1.29
62
65
  - 6.1.28
66
+ - 6.1.27
63
67
  - 6.1.26
64
68
  - 6.1.25
65
69
  - 6.1.23
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pushwoosh-react-native-plugin",
3
- "version": "6.1.31",
3
+ "version": "6.1.33",
4
4
  "description": "This plugin allows you to send and receive push notifications. Powered by Pushwoosh (www.pushwoosh.com).",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -1,6 +1,6 @@
1
1
  Pod::Spec.new do |s|
2
2
  s.name = "pushwoosh-react-native-plugin"
3
- s.version = "6.1.31"
3
+ s.version = "6.1.33"
4
4
  s.summary = "React Native Pushwoosh Push Notifications module"
5
5
  s.requires_arc = true
6
6
  s.author = 'Pushwoosh'
@@ -37,7 +37,7 @@ android {
37
37
  }
38
38
 
39
39
  ext {
40
- pushwoosh = "6.7.8"
40
+ pushwoosh = "6.7.12"
41
41
  }
42
42
 
43
43
  dependencies {
@@ -17,7 +17,7 @@ public class PushwooshNotificationServiceExtension extends NotificationServiceEx
17
17
  ApplicationInfo ai = getApplicationContext().getPackageManager().getApplicationInfo(packageName, PackageManager.GET_META_DATA);
18
18
 
19
19
  if (ai.metaData != null) {
20
- showForegroundPush = ai.metaData.getBoolean("PW_BROADCAST_PUSH", false) || ai.metaData.getBoolean("com.pushwoosh.foreground_push", false);
20
+ showForegroundPush = ai.metaData.getBoolean("PW_BROADCAST_PUSH", true) || ai.metaData.getBoolean("com.pushwoosh.foreground_push", true);
21
21
  }
22
22
  } catch (Exception e) {
23
23
  PWLog.exception(e);
@@ -275,11 +275,6 @@ public class PushwooshPlugin extends ReactContextBaseJavaModule implements Lifec
275
275
  callback.invoke(Pushwoosh.getInstance().getUserId());
276
276
  }
277
277
 
278
- @ReactMethod
279
- public void setUserId(String userId) {
280
- PushwooshInApp.getInstance().setUserId(userId);
281
- }
282
-
283
278
  @ReactMethod
284
279
  public void setUserId(String userId, final Callback success, final Callback error) {
285
280
  Pushwoosh.getInstance().setUserId(userId, new com.pushwoosh.function.Callback<Boolean, SetUserIdException>() {
@@ -1,11 +1,11 @@
1
1
  //
2
- // Pushwoosh.h
2
+ // PushwooshFramework.h
3
3
  // Pushwoosh SDK
4
- // (c) Pushwoosh 2016
4
+ // (c) Pushwoosh 2024
5
5
  //
6
6
 
7
7
  #import "PushNotificationManager.h"
8
- #import "Pushwoosh.h"
8
+ #import "PushwooshFramework.h"
9
9
  #import "PWInAppManager.h"
10
10
  #import "PWLog.h"
11
11
  #import "PWGDPRManager.h"
@@ -18,7 +18,7 @@
18
18
 
19
19
  #endif
20
20
 
21
- #define PUSHWOOSH_VERSION @"6.5.11"
21
+ #define PUSHWOOSH_VERSION @"6.5.13"
22
22
 
23
23
 
24
24
  @class Pushwoosh, PWMessage, PWNotificationCenterDelegateProxy;
@@ -0,0 +1,705 @@
1
+ //
2
+ // PushwooshFramework.h
3
+ // Pushwoosh SDK
4
+ // (c) Pushwoosh 2024
5
+ //
6
+
7
+ #import <Foundation/Foundation.h>
8
+
9
+ #if TARGET_OS_IOS || TARGET_OS_WATCH
10
+
11
+ #import <UserNotifications/UserNotifications.h>
12
+
13
+ #endif
14
+
15
+ #if TARGET_OS_IOS
16
+
17
+ #import <StoreKit/StoreKit.h>
18
+
19
+ #endif
20
+
21
+ #define PUSHWOOSH_VERSION @"6.7.4"
22
+
23
+
24
+ @class Pushwoosh, PWMessage, PWNotificationCenterDelegateProxy;
25
+
26
+
27
+ typedef void (^PushwooshRegistrationHandler)(NSString * _Nullable token, NSError * _Nullable error);
28
+ typedef void (^PushwooshGetTagsHandler)(NSDictionary * _Nullable tags);
29
+ typedef void (^PushwooshErrorHandler)(NSError * _Nullable error);
30
+
31
+
32
+ /**
33
+ `PWMessagingDelegate` protocol defines the methods that can be implemented in the delegate of the `Pushwoosh` class' singleton object.
34
+ These methods provide information about the key events for push notification manager such as, receiving push notifications and opening the received notification.
35
+ These methods implementation allows to react on these events properly.
36
+ */
37
+ @protocol PWMessagingDelegate <NSObject>
38
+
39
+ @optional
40
+ /**
41
+ Tells the delegate that the application has received a remote notification.
42
+
43
+ @param pushwoosh The push manager that received the remote notification.
44
+ @param message A PWMessage object 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.
45
+ */
46
+ - (void)pushwoosh:(Pushwoosh * _Nonnull)pushwoosh onMessageReceived:(PWMessage * _Nonnull)message;
47
+
48
+ /**
49
+ Tells the delegate that the user has pressed on the push notification banner.
50
+
51
+ @param pushwoosh The push manager that received the remote notification.
52
+ @param message A PWMessage object 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.
53
+ */
54
+ - (void)pushwoosh:(Pushwoosh * _Nonnull)pushwoosh onMessageOpened:(PWMessage * _Nonnull)message;
55
+
56
+ @end
57
+
58
+ /**
59
+ `PWPurchaseDelegate` protocol defines the methods that can be implemented in the delegate of the `Pushwoosh` class' singleton object.
60
+ These methods provide callbacks for events related to purchasing In-App products from rich medias, such as successful purchase event, failed payment, etc.
61
+ These methods implementation allows to react on such events properly.
62
+ */
63
+
64
+ @protocol PWPurchaseDelegate <NSObject>
65
+
66
+ @optional
67
+ /**
68
+ Tells the delegate that the application received the array of products
69
+
70
+ @param products Array of SKProduct instances.
71
+ */
72
+ - (void)onPWInAppPurchaseHelperProducts:(NSArray<SKProduct *>* _Nullable)products;
73
+
74
+ /**
75
+ Tells the delegate that the transaction is in queue, user has been charged.
76
+
77
+ @param identifier Identifier agreed upon with the store.
78
+ */
79
+ - (void)onPWInAppPurchaseHelperPaymentComplete:(NSString* _Nullable)identifier;
80
+
81
+ /**
82
+ Tells the delegate that the transaction was cancelled or failed before being added to the server queue.
83
+
84
+ @param identifier The unique server-provided identifier.
85
+ @param error The transaction failed.
86
+ */
87
+ - (void)onPWInAppPurchaseHelperPaymentFailedProductIdentifier:(NSString* _Nullable)identifier error:(NSError* _Nullable)error;
88
+
89
+ /**
90
+ Tells the delegate that a user initiates an IAP buy from the App Store
91
+
92
+ @param identifier Product identifier
93
+ */
94
+ - (void)onPWInAppPurchaseHelperCallPromotedPurchase:(NSString* _Nullable)identifier;
95
+
96
+ /**
97
+ Tells the delegate that an error occurred while restoring transactions.
98
+
99
+ @param error Error transaction.
100
+ */
101
+ - (void)onPWInAppPurchaseHelperRestoreCompletedTransactionsFailed:(NSError * _Nullable)error;
102
+
103
+ @end
104
+
105
+
106
+ /**
107
+ Message from Pushwoosh.
108
+ */
109
+ @interface PWMessage : NSObject
110
+
111
+ /**
112
+ Title of the push message.
113
+ */
114
+ @property (nonatomic, readonly) NSString * _Nullable title;
115
+
116
+ /**
117
+ Subtitle of the push message.
118
+ */
119
+ @property (nonatomic, readonly) NSString * _Nullable subTitle;
120
+
121
+ /**
122
+ Body of the push message.
123
+ */
124
+ @property (nonatomic, readonly) NSString * _Nullable message;
125
+
126
+ /**
127
+ Badge number of the push message.
128
+ */
129
+ @property (nonatomic, readonly) NSUInteger badge;
130
+
131
+ /**
132
+ Extension badge number of the push message.
133
+ */
134
+ @property (nonatomic, readonly) NSUInteger badgeExtension;
135
+
136
+ /**
137
+ Remote URL or deeplink from the push message.
138
+ */
139
+ @property (nonatomic, readonly) NSString * _Nullable link;
140
+
141
+ /**
142
+ Returns YES if this message received/opened then the app is in foreground state.
143
+ */
144
+ @property (nonatomic, readonly, getter=isForegroundMessage) BOOL foregroundMessage;
145
+
146
+ /**
147
+ Returns YES if this message contains 'content-available' key (silent or newsstand push).
148
+ */
149
+ @property (nonatomic, readonly, getter=isContentAvailable) BOOL contentAvailable;
150
+
151
+ /**
152
+ Returns YES if this is inbox message.
153
+ */
154
+ @property (nonatomic, readonly, getter=isInboxMessage) BOOL inboxMessage;
155
+
156
+ /**
157
+ Gets custom JSON data from push notifications dictionary as specified in Pushwoosh Control Panel.
158
+ */
159
+ @property (nonatomic, readonly) NSDictionary * _Nullable customData;
160
+
161
+ /**
162
+ Original payload of the message.
163
+ */
164
+ @property (nonatomic, readonly) NSDictionary * _Nullable payload;
165
+
166
+ /**
167
+ Returns actionIdentifier of the button pressed
168
+ */
169
+ @property (nonatomic, readonly) NSString * _Nullable actionIdentifier;
170
+
171
+ /**
172
+ Returns YES if this message is recieved from Pushwoosh.
173
+ */
174
+ + (BOOL)isPushwooshMessage:(NSDictionary *_Nonnull)userInfo;
175
+
176
+ @end
177
+
178
+
179
+ /**
180
+ `Pushwoosh` 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.
181
+ */
182
+ @interface Pushwoosh : NSObject
183
+
184
+ /**
185
+ Pushwoosh Application ID. Usually retrieved automatically from Info.plist parameter `Pushwoosh_APPID`
186
+ */
187
+ @property (nonatomic, copy, readonly) NSString * _Nonnull applicationCode;
188
+
189
+ /**
190
+ `PushNotificationDelegate` protocol delegate that would receive the information about events for push notification manager such as registering with APS services, receiving push notifications or working with the received notification.
191
+ Pushwoosh Runtime sets it to ApplicationDelegate by default
192
+ */
193
+ @property (nonatomic, weak) NSObject<PWMessagingDelegate> * _Nullable delegate;
194
+
195
+ /**
196
+ `PushPurchaseDelegate` protocol delegate that would receive the information about events related to purchasing InApp products from rich medias
197
+ */
198
+ @property (nonatomic, weak) NSObject<PWPurchaseDelegate> * _Nullable purchaseDelegate;
199
+
200
+ #if TARGET_OS_IOS || TARGET_OS_WATCH
201
+
202
+ /**
203
+ Show push notifications alert when push notification is received while the app is running, default is `YES`
204
+ */
205
+ @property (nonatomic, assign) BOOL showPushnotificationAlert;
206
+
207
+ /**
208
+ Authorization options in addition to UNAuthorizationOptionBadge | UNAuthorizationOptionSound | UNAuthorizationOptionAlert | UNAuthorizationOptionCarPlay.
209
+ */
210
+ @property (nonatomic) UNAuthorizationOptions additionalAuthorizationOptions __IOS_AVAILABLE(12.0);
211
+
212
+ #endif
213
+
214
+ /**
215
+ Returns push notification payload if the app was started in response to push notification or null otherwise
216
+ */
217
+ @property (nonatomic, copy, readonly) NSDictionary * _Nullable launchNotification;
218
+
219
+ /**
220
+ Proxy contains UNUserNotificationCenterDelegate objects.
221
+ */
222
+ @property (nonatomic, readonly) PWNotificationCenterDelegateProxy * _Nullable notificationCenterDelegateProxy;
223
+
224
+ /**
225
+ Set custom application language. Must be a lowercase two-letter code according to ISO-639-1 standard ("en", "de", "fr", etc.).
226
+ Device language used by default.
227
+ Set to nil if you want to use device language again.
228
+ */
229
+ @property (nonatomic) NSString * _Nonnull language;
230
+
231
+ /**
232
+ Initializes Pushwoosh.
233
+ @param appCode Pushwoosh App ID.
234
+ */
235
+ + (void)initializeWithAppCode:(NSString *_Nonnull)appCode;
236
+
237
+ /**
238
+ Returns an object representing the current push manager.
239
+
240
+ @return A singleton object that represents the push manager.
241
+ */
242
+ + (instancetype _Nonnull )sharedInstance;
243
+
244
+ /**
245
+ Registers for push notifications. By default registeres for "UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert" flags.
246
+ Automatically detects if you have "newsstand-content" in "UIBackgroundModes" and adds "UIRemoteNotificationTypeNewsstandContentAvailability" flag.
247
+ */
248
+ - (void)registerForPushNotifications;
249
+ - (void)registerForPushNotificationsWithCompletion:(PushwooshRegistrationHandler _Nullable )completion;
250
+
251
+ /**
252
+ Registers for push notifications with custom tags. By default registeres for "UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert" flags.
253
+ Automatically detects if you have "newsstand-content" in "UIBackgroundModes" and adds "UIRemoteNotificationTypeNewsstandContentAvailability" flag.
254
+ */
255
+ - (void)registerForPushNotificationsWith:(NSDictionary * _Nonnull)tags;
256
+ - (void)registerForPushNotificationsWith:(NSDictionary * _Nonnull)tags completion:(PushwooshRegistrationHandler _Nullable )completion;
257
+
258
+ /**
259
+ Unregisters from push notifications.
260
+ */
261
+ - (void)unregisterForPushNotifications;
262
+ - (void)unregisterForPushNotificationsWithCompletion:(void (^_Nullable)(NSError * _Nullable error))completion;
263
+
264
+ /**
265
+ Handle registration to remote notifications.
266
+ */
267
+ - (void)handlePushRegistration:(NSData * _Nonnull)devToken;
268
+ - (void)handlePushRegistrationFailure:(NSError * _Nonnull)error;
269
+
270
+ /**
271
+ Handle received push notification.
272
+ */
273
+ - (BOOL)handlePushReceived:(NSDictionary * _Nonnull)userInfo;
274
+
275
+ /**
276
+ * Change default base url to reverse proxy url
277
+ * @param url - reverse proxy url
278
+ */
279
+ - (void)setReverseProxy:(NSString * _Nonnull)url;
280
+
281
+ /**
282
+ * Disables reverse proxy
283
+ */
284
+ - (void)disableReverseProxy;
285
+
286
+ /**
287
+ 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).
288
+
289
+ Example:
290
+ @code
291
+ NSDictionary *tags = @{ @"Alias" : aliasField.text,
292
+ @"FavNumber" : @([favNumField.text intValue]),
293
+ @"price" : [PWTags incrementalTagWithInteger:5],
294
+ @"List" : @[ @"Item1", @"Item2", @"Item3" ]
295
+ };
296
+
297
+ [[PushNotificationManager pushManager] setTags:tags];
298
+ @endcode
299
+
300
+ @param tags Dictionary representation of tags to send.
301
+ */
302
+ - (void)setTags:(NSDictionary * _Nonnull)tags;
303
+
304
+ /**
305
+ Send tags to server with completion block. If setTags succeeds competion is called with nil argument. If setTags fails completion is called with error.
306
+ */
307
+ - (void)setTags:(NSDictionary * _Nonnull)tags completion:(void (^_Nullable)(NSError * _Nullable error))completion;
308
+
309
+ - (void)setEmailTags:(NSDictionary * _Nonnull)tags forEmail:(NSString * _Nonnull)email;
310
+
311
+ - (void)setEmailTags:(NSDictionary * _Nonnull)tags forEmail:(NSString * _Nonnull)email completion:(void(^ _Nullable)(NSError * _Nullable error))completion;
312
+
313
+ /**
314
+ Get tags from server. Calls delegate method if exists and handler (block).
315
+
316
+ @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.
317
+ Example of the dictionary representation of the received tags:
318
+ {
319
+ Country = ru;
320
+ Language = ru;
321
+ }
322
+ @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.
323
+ */
324
+ - (void)getTags:(PushwooshGetTagsHandler _Nullable)successHandler onFailure:(PushwooshErrorHandler _Nullable)errorHandler;
325
+
326
+ /**
327
+ 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.
328
+ This way Pushwoosh server can know what current badge value is set for the application.
329
+
330
+ @param badge Current badge value.
331
+ */
332
+ - (void)sendBadges:(NSInteger)badge __API_AVAILABLE(macos(10.10), ios(8.0));
333
+
334
+ /**
335
+ Pushwoosh SDK version.
336
+ */
337
+ + (NSString * _Nonnull)version;
338
+
339
+ #if TARGET_OS_IOS
340
+ /**
341
+ Sends in-app purchases to Pushwoosh. Use in paymentQueue:updatedTransactions: payment queue method (see example).
342
+
343
+ Example:
344
+ @code
345
+ - (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions {
346
+ [[PushNotificationManager pushManager] sendSKPaymentTransactions:transactions];
347
+ }
348
+ @endcode
349
+
350
+ @param transactions Array of SKPaymentTransaction items as received in the payment queue.
351
+ */
352
+ - (void)sendSKPaymentTransactions:(NSArray * _Nonnull)transactions;
353
+
354
+ /**
355
+ Tracks individual in-app purchase. See recommended `sendSKPaymentTransactions:` method.
356
+
357
+ @param productIdentifier purchased product ID
358
+ @param price price for the product
359
+ @param currencyCode currency of the price (ex: @"USD")
360
+ @param date time of the purchase (ex: [NSDate now])
361
+ */
362
+ - (void)sendPurchase:(NSString * _Nonnull)productIdentifier withPrice:(NSDecimalNumber * _Nonnull)price currencyCode:(NSString * _Nonnull)currencyCode andDate:(NSDate * _Nonnull)date;
363
+
364
+ #endif
365
+ /**
366
+ Gets current push token.
367
+
368
+ @return Current push token. May be nil if no push token is available yet.
369
+ */
370
+ - (NSString * _Nullable)getPushToken;
371
+
372
+ /**
373
+ Gets HWID. Unique device identifier that used in all API calls with Pushwoosh.
374
+ This is identifierForVendor for iOS >= 7.
375
+
376
+ @return Unique device identifier.
377
+ */
378
+ - (NSString * _Nonnull)getHWID;
379
+
380
+ /**
381
+ Gets UserId.
382
+
383
+ @return userId. If the userId hasn't been set previously, then the userId is assigned the HWID.
384
+ */
385
+ - (NSString * _Nonnull)getUserId;
386
+
387
+ /**
388
+ Returns dictionary with enabled remove notificaton types.
389
+
390
+ Example enabled push:
391
+ @code
392
+ {
393
+ enabled = 1;
394
+ pushAlert = 1;
395
+ pushBadge = 1;
396
+ pushSound = 1;
397
+ type = 7;
398
+ }
399
+ @endcode
400
+ where "type" field is UIUserNotificationType
401
+
402
+ Disabled push:
403
+ @code
404
+ {
405
+ enabled = 1;
406
+ pushAlert = 0;
407
+ pushBadge = 0;
408
+ pushSound = 0;
409
+ type = 0;
410
+ }
411
+ @endcode
412
+
413
+ Note: In the latter example "enabled" field means that device can receive push notification but could not display alerts (ex: silent push)
414
+ */
415
+ + (NSMutableDictionary * _Nullable)getRemoteNotificationStatus;
416
+
417
+ /**
418
+ Clears the notifications from the notification center.
419
+ */
420
+ + (void)clearNotificationCenter;
421
+
422
+ /**
423
+ Set User indentifier. This could be Facebook ID, username or email, or any other user ID.
424
+ This allows data and events to be matched across multiple user devices.
425
+ If setUserId succeeds competion is called with nil argument. If setUserId fails completion is called with error.
426
+
427
+ @param userId user identifier
428
+ */
429
+ - (void)setUserId:(NSString * _Nonnull)userId completion:(void(^ _Nullable)(NSError * _Nullable error))completion;
430
+
431
+ /**
432
+ Set User indentifier. This could be Facebook ID, username or email, or any other user ID.
433
+ This allows data and events to be matched across multiple user devices.
434
+
435
+ @param userId user identifier
436
+ */
437
+ - (void)setUserId:(NSString * _Nonnull)userId;
438
+
439
+ /**
440
+ Set User indentifier. This could be Facebook ID, username or email, or any other user ID.
441
+ This allows data and events to be matched across multiple user devices.
442
+ If setUser succeeds competion is called with nil argument. If setUser fails completion is called with error.
443
+
444
+ @param userId user identifier
445
+ @param emails user's emails array
446
+ */
447
+ - (void)setUser:(NSString * _Nonnull)userId emails:(NSArray * _Nonnull)emails completion:(void(^ _Nullable)(NSError * _Nullable error))completion;
448
+
449
+
450
+ /**
451
+ Set User indentifier. This could be Facebook ID, username or email, or any other user ID.
452
+ This allows data and events to be matched across multiple user devices.
453
+
454
+ @param userId user identifier
455
+ @param emails user's emails array
456
+ */
457
+ - (void)setUser:(NSString * _Nonnull)userId emails:(NSArray * _Nonnull)emails;
458
+
459
+ /**
460
+ Set User indentifier. This could be Facebook ID, username or email, or any other user ID.
461
+ This allows data and events to be matched across multiple user devices.
462
+ If setUser succeeds competion is called with nil argument. If setUser fails completion is called with error.
463
+
464
+ @param userId user identifier
465
+ @param email user's email string
466
+ */
467
+ - (void)setUser:(NSString * _Nonnull)userId email:(NSString * _Nonnull)email completion:(void(^ _Nullable)(NSError * _Nullable error))completion;
468
+
469
+ /**
470
+ Register emails list associated to the current user.
471
+ If setEmails succeeds competion is called with nil argument. If setEmails fails completion is called with error.
472
+
473
+ @param emails user's emails array
474
+ */
475
+ - (void)setEmails:(NSArray * _Nonnull)emails completion:(void(^ _Nullable)(NSError * _Nullable error))completion;
476
+
477
+ /**
478
+ Register emails list associated to the current user.
479
+
480
+ @param emails user's emails array
481
+ */
482
+ - (void)setEmails:(NSArray * _Nonnull)emails;
483
+
484
+ /**
485
+ Register email associated to the current user. Email should be a string and could not be null or empty.
486
+ If setEmail succeeds competion is called with nil argument. If setEmail fails completion is called with error.
487
+
488
+ @param email user's email string
489
+ */
490
+ - (void)setEmail:(NSString * _Nonnull)email completion:(void(^ _Nullable)(NSError * _Nullable error))completion;
491
+
492
+ /**
493
+ Register email associated to the current user. Email should be a string and could not be null or empty.
494
+
495
+ @param email user's email string
496
+ */
497
+ - (void)setEmail:(NSString * _Nonnull)email;
498
+
499
+ /**
500
+ Move all events from oldUserId to newUserId if doMerge is true. If doMerge is false all events for oldUserId are removed.
501
+
502
+ @param oldUserId source user
503
+ @param newUserId destination user
504
+ @param doMerge if false all events for oldUserId are removed, if true all events for oldUserId are moved to newUserId
505
+ @param completion callback
506
+ */
507
+ - (void)mergeUserId:(NSString * _Nonnull)oldUserId to:(NSString * _Nonnull)newUserId doMerge:(BOOL)doMerge completion:(void (^ _Nullable)(NSError * _Nullable error))completion;
508
+
509
+ /**
510
+ Starts communication with Pushwoosh server.
511
+ */
512
+ - (void)startServerCommunication;
513
+
514
+ /**
515
+ Stops communication with Pushwoosh server.
516
+ */
517
+ - (void)stopServerCommunication;
518
+
519
+ /**
520
+ Process URL of some deep link. Primarly used for register test devices.
521
+
522
+ @param url Deep Link URL
523
+ */
524
+ #if TARGET_OS_IOS || TARGET_OS_WATCH
525
+ - (BOOL)handleOpenURL:(NSURL * _Nonnull)url;
526
+ #endif
527
+
528
+ /**
529
+ Sends push to start live activity token to the server.
530
+ Call this method when you want to initiate live activity via push notification
531
+
532
+ Example:
533
+ @code
534
+
535
+ if #available(iOS 17.2, *) {
536
+ Task {
537
+ for await data in Activity<LiveActivityAttributes>.pushToStartTokenUpdates {
538
+ let token = data.map { String(format: "%02x", $0) }.joined()
539
+ do {
540
+ try await Pushwoosh.sharedInstance().sendPush(toStartLiveActivityToken: token)
541
+ } catch {
542
+ print("Error sending push to start live activity: \(error)")
543
+ }
544
+ }
545
+ }
546
+ }
547
+
548
+ @endcode
549
+ */
550
+
551
+ - (void)sendPushToStartLiveActivityToken:(NSString *_Nullable)token;
552
+ - (void)sendPushToStartLiveActivityToken:(NSString *_Nullable)token completion:(void (^ _Nullable)(NSError * _Nullable))completion;
553
+
554
+ /**
555
+ Sends live activity token to the server.
556
+ Call this method when you create a live activity.
557
+
558
+ Example:
559
+ @code
560
+ do {
561
+ let activity = try Activity<PushwooshAppAttributes>.request(
562
+ attributes: attributes,
563
+ contentState: contentState,
564
+ pushType: .token)
565
+
566
+ for await data in activity.pushTokenUpdates {
567
+ guard let token = data.map { String(format: "%02x", $0) }.joined(separator: "") else {
568
+ continue
569
+ }
570
+
571
+ do {
572
+ try await Pushwoosh.sharedInstance().startLiveActivity(withToken: token)
573
+ return token
574
+ } catch {
575
+ print("Failed to start live activity with token \(token): \(error.localizedDescription)")
576
+ return nil
577
+ }
578
+ }
579
+ return nil
580
+ } catch {
581
+ print("Error requesting activity: \(error.localizedDescription)")
582
+ return nil
583
+ }
584
+ @endcode
585
+
586
+ @param token Activity token
587
+ @param activityId Activity ID for updating Live Activities by segments
588
+ */
589
+ - (void)startLiveActivityWithToken:(NSString * _Nonnull)token activityId:(NSString * _Nullable)activityId;
590
+ - (void)startLiveActivityWithToken:(NSString * _Nonnull)token activityId:(NSString * _Nullable)activityId completion:(void (^ _Nullable)(NSError * _Nullable error))completion;
591
+
592
+ /**
593
+ Call this method when you finish working with the live activity.
594
+
595
+ Example:
596
+ @code
597
+ func end(activity: Activity<PushwooshAppAttributes>) {
598
+ Task {
599
+ await activity.end(dismissalPolicy: .immediate)
600
+ try await Pushwoosh.sharedInstance().stopLiveActivity()
601
+ }
602
+ }
603
+ @endcode
604
+ */
605
+ - (void)stopLiveActivity;
606
+ - (void)stopLiveActivityWithCompletion:(void (^ _Nullable)(NSError * _Nullable error))completion;
607
+
608
+ - (void)stopLiveActivityWith:(NSString *_Nullable)activityId;
609
+ - (void)stopLiveActivityWith:(NSString *_Nullable)activityId completion:(void (^ _Nullable)(NSError * _Nullable error))completion;
610
+
611
+ @end
612
+
613
+ /**
614
+ `PWNotificationCenterDelegateProxy` class handles notifications on iOS 10 and forwards methods of UNUserNotificationCenterDelegate to all added delegates.
615
+ */
616
+ #if TARGET_OS_IOS || TARGET_OS_WATCH
617
+ @interface PWNotificationCenterDelegateProxy : NSObject <UNUserNotificationCenterDelegate>
618
+ #elif TARGET_OS_OSX
619
+ @interface PWNotificationCenterDelegateProxy : NSObject <NSUserNotificationCenterDelegate>
620
+ #endif
621
+ /**
622
+ Returns UNUserNotificationCenterDelegate that handles foreground push notifications on iOS10
623
+ */
624
+ #if TARGET_OS_IOS || TARGET_OS_WATCH
625
+ @property (nonatomic, strong, readonly) id<UNUserNotificationCenterDelegate> _Nonnull defaultNotificationCenterDelegate;
626
+ #elif TARGET_OS_OSX
627
+ @property (nonatomic, strong, readonly) id<NSUserNotificationCenterDelegate> defaultNotificationCenterDelegate;
628
+ #endif
629
+
630
+ /**
631
+ Adds extra UNUserNotificationCenterDelegate that handles foreground push notifications on iOS10.
632
+ */
633
+ #if TARGET_OS_IOS || TARGET_OS_WATCH
634
+ - (void)addNotificationCenterDelegate:(id<UNUserNotificationCenterDelegate> _Nonnull)delegate;
635
+ #endif
636
+ @end
637
+
638
+
639
+ /**
640
+ `PWTagsBuilder` class encapsulates the methods for creating tags parameters for sending them to the server.
641
+ */
642
+ @interface PWTagsBuilder : NSObject
643
+ /**
644
+ Creates a dictionary for incrementing/decrementing a numeric tag on the server.
645
+
646
+ Example:
647
+ @code
648
+ NSDictionary *tags = @{
649
+ @"Alias" : aliasField.text,
650
+ @"FavNumber" : @([favNumField.text intValue]),
651
+ @"price": [PWTags incrementalTagWithInteger:5],
652
+ };
653
+
654
+ [[PushNotificationManager pushManager] setTags:tags];
655
+ @endcode
656
+
657
+ @param delta Difference that needs to be applied to the tag's counter.
658
+
659
+ @return Dictionary, that needs to be sent as the value for the tag
660
+ */
661
+ + (NSDictionary * _Nullable)incrementalTagWithInteger:(NSInteger)delta;
662
+
663
+ /**
664
+ Creates a dictionary for extending Tag’s values list with additional values
665
+
666
+ Example:
667
+
668
+ @code
669
+ NSDictionary *tags = @{
670
+ @"Alias" : aliasField.text,
671
+ @"FavNumber" : @([favNumField.text intValue]),
672
+ @"List" : [PWTags appendValuesToListTag:@[ @"Item1" ]]
673
+ };
674
+
675
+ [[PushNotificationManager pushManager] setTags:tags];
676
+ @endcode
677
+
678
+ @param array Array of values to be added to the tag.
679
+
680
+ @return Dictionary to be sent as the value for the tag
681
+ */
682
+ + (NSDictionary * _Nullable)appendValuesToListTag:(NSArray<NSString *> * _Nonnull)array;
683
+
684
+ /**
685
+ Creates a dictionary for removing Tag’s values from existing values list
686
+
687
+ Example:
688
+
689
+ @code
690
+ NSDictionary *tags = @{
691
+ @"Alias" : aliasField.text,
692
+ @"FavNumber" : @([favNumField.text intValue]),
693
+ @"List" : [PWTags removeValuesFromListTag:@[ @"Item1" ]]
694
+ };
695
+
696
+ [[PushNotificationManager pushManager] setTags:tags];
697
+ @endcode
698
+
699
+ @param array Array of values to be removed from the tag.
700
+
701
+ @return Dictionary to be sent as the value for the tag
702
+ */
703
+ + (NSDictionary * _Nullable)removeValuesFromListTag:(NSArray<NSString *> * _Nonnull)array;
704
+
705
+ @end
@@ -8,15 +8,15 @@
8
8
 
9
9
  #import <React/RCTBridgeModule.h>
10
10
  #import <React/RCTEventEmitter.h>
11
- #import <Pushwoosh/Pushwoosh.h>
11
+ #import <PushwooshFramework/PushwooshFramework.h>
12
12
 
13
- #if __has_include(<Pushwoosh/PushNotificationManager.h>)
14
- #import <Pushwoosh/PushNotificationManager.h>
15
- #import <Pushwoosh/PWInAppManager.h>
13
+ #if __has_include(<PushwooshFramework/PushNotificationManager.h>)
14
+ #import <PushwooshFramework/PushNotificationManager.h>
15
+ #import <PushwooshFramework/PWInAppManager.h>
16
16
  #import <PushwooshInboxUI/PushwooshInboxUI.h>
17
- #import <Pushwoosh/PWGDPRManager.h>
18
- #import <Pushwoosh/PWInlineInAppView.h>
19
- #import <Pushwoosh/PWInbox.h>
17
+ #import <PushwooshFramework/PWGDPRManager.h>
18
+ #import <PushwooshFramework/PWInlineInAppView.h>
19
+ #import <PushwooshFramework/PWInbox.h>
20
20
  #else
21
21
  #import "PushNotificationManager.h"
22
22
  #import "PWInAppManager.h"
@@ -13,7 +13,7 @@
13
13
  #import <React/RCTConvert.h>
14
14
 
15
15
  #import <UserNotifications/UserNotifications.h>
16
- #import <Pushwoosh/PushNotificationManager.h>
16
+ #import <PushwooshFramework/PushNotificationManager.h>
17
17
 
18
18
  #import <objc/runtime.h>
19
19
 
@@ -278,10 +278,6 @@ RCT_EXPORT_METHOD(getShowPushnotificationAlert:(RCTResponseSenderBlock)callback)
278
278
  }
279
279
  }
280
280
 
281
- RCT_EXPORT_METHOD(setUserId:(NSString*)userId) {
282
- [[PWInAppManager sharedManager] setUserId:userId];
283
- }
284
-
285
281
  RCT_EXPORT_METHOD(setUserId:(NSString*)userId success:(RCTResponseSenderBlock)successCallback error:(RCTResponseSenderBlock)errorCallback) {
286
282
 
287
283
  [[PWInAppManager sharedManager] setUserId:userId completion:^(NSError *error) {
Binary file
Binary file