pushwoosh-react-native-plugin 6.1.32 → 6.1.34

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 (33) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.yml +1 -0
  2. package/package.json +1 -1
  3. package/pushwoosh-react-native-plugin.podspec +2 -2
  4. package/src/android/build.gradle +1 -1
  5. package/src/android/src/main/java/com/pushwoosh/reactnativeplugin/PushwooshNotificationServiceExtension.java +1 -1
  6. package/src/ios/PushwooshPlugin/Pushwoosh.h +7 -7
  7. package/src/ios/PushwooshPlugin/Pushwoosh.m +113 -45
  8. package/src/ios/PWAppDelegate.h +0 -20
  9. package/src/ios/PWGDPRManager.h +0 -46
  10. package/src/ios/PWIInboxStyle.h +0 -122
  11. package/src/ios/PWIInboxUI.h +0 -39
  12. package/src/ios/PWInAppManager.h +0 -176
  13. package/src/ios/PWInbox.h +0 -147
  14. package/src/ios/PWInlineInAppView.h +0 -26
  15. package/src/ios/PWLog.h +0 -23
  16. package/src/ios/PWMessaging.h +0 -20
  17. package/src/ios/PWNotificationExtensionManager.h +0 -49
  18. package/src/ios/PWRichMediaManager.h +0 -123
  19. package/src/ios/PWRichMediaStyle.h +0 -122
  20. package/src/ios/PushNotificationManager.h +0 -596
  21. package/src/ios/Pushwoosh.h +0 -684
  22. package/src/ios/PushwooshInboxBundle.bundle/Info.plist +0 -0
  23. package/src/ios/PushwooshInboxBundle.bundle/PWIInboxAttachmentViewController.nib +0 -0
  24. package/src/ios/PushwooshInboxBundle.bundle/PWIInboxMessageViewCell.nib +0 -0
  25. package/src/ios/PushwooshInboxBundle.bundle/PWIInboxViewController.nib +0 -0
  26. package/src/ios/PushwooshInboxBundle.bundle/errorMessage@2x.png +0 -0
  27. package/src/ios/PushwooshInboxBundle.bundle/inbox_icon.png +0 -0
  28. package/src/ios/PushwooshInboxBundle.bundle/noMessage@2x.png +0 -0
  29. package/src/ios/PushwooshInboxBundle.bundle/unread.png +0 -0
  30. package/src/ios/PushwooshInboxUI.h +0 -19
  31. package/src/ios/PushwooshPlugin.xcodeproj/project.pbxproj +0 -305
  32. package/src/ios/libPushwoosh.a +0 -0
  33. package/src/ios/libPushwooshInboxUI.a +0 -0
@@ -1,684 +0,0 @@
1
- //
2
- // Pushwoosh.h
3
- // Pushwoosh SDK
4
- // (c) Pushwoosh 2020
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.5.13"
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 YES if this message is recieved from Pushwoosh.
168
- */
169
- + (BOOL)isPushwooshMessage:(NSDictionary *_Nonnull)userInfo;
170
-
171
- @end
172
-
173
-
174
- /**
175
- `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.
176
- */
177
- @interface Pushwoosh : NSObject
178
-
179
- /**
180
- Pushwoosh Application ID. Usually retrieved automatically from Info.plist parameter `Pushwoosh_APPID`
181
- */
182
- @property (nonatomic, copy, readonly) NSString * _Nonnull applicationCode;
183
-
184
- /**
185
- `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.
186
- Pushwoosh Runtime sets it to ApplicationDelegate by default
187
- */
188
- @property (nonatomic, weak) NSObject<PWMessagingDelegate> * _Nullable delegate;
189
-
190
- /**
191
- `PushPurchaseDelegate` protocol delegate that would receive the information about events related to purchasing InApp products from rich medias
192
- */
193
- @property (nonatomic, weak) NSObject<PWPurchaseDelegate> * _Nullable purchaseDelegate;
194
-
195
- #if TARGET_OS_IOS || TARGET_OS_WATCH
196
-
197
- /**
198
- Show push notifications alert when push notification is received while the app is running, default is `YES`
199
- */
200
- @property (nonatomic, assign) BOOL showPushnotificationAlert;
201
-
202
- /**
203
- Authorization options in addition to UNAuthorizationOptionBadge | UNAuthorizationOptionSound | UNAuthorizationOptionAlert | UNAuthorizationOptionCarPlay.
204
- */
205
- @property (nonatomic) UNAuthorizationOptions additionalAuthorizationOptions __IOS_AVAILABLE(12.0);
206
-
207
- #endif
208
-
209
- /**
210
- Returns push notification payload if the app was started in response to push notification or null otherwise
211
- */
212
- @property (nonatomic, copy, readonly) NSDictionary * _Nullable launchNotification;
213
-
214
- /**
215
- Proxy contains UNUserNotificationCenterDelegate objects.
216
- */
217
- @property (nonatomic, readonly) PWNotificationCenterDelegateProxy * _Nullable notificationCenterDelegateProxy;
218
-
219
- /**
220
- Set custom application language. Must be a lowercase two-letter code according to ISO-639-1 standard ("en", "de", "fr", etc.).
221
- Device language used by default.
222
- Set to nil if you want to use device language again.
223
- */
224
- @property (nonatomic) NSString * _Nonnull language;
225
-
226
- /**
227
- Initializes Pushwoosh.
228
- @param appCode Pushwoosh App ID.
229
- */
230
- + (void)initializeWithAppCode:(NSString *_Nonnull)appCode;
231
-
232
- /**
233
- Returns an object representing the current push manager.
234
-
235
- @return A singleton object that represents the push manager.
236
- */
237
- + (instancetype _Nonnull )sharedInstance;
238
-
239
- /**
240
- Registers for push notifications. By default registeres for "UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert" flags.
241
- Automatically detects if you have "newsstand-content" in "UIBackgroundModes" and adds "UIRemoteNotificationTypeNewsstandContentAvailability" flag.
242
- */
243
- - (void)registerForPushNotifications;
244
- - (void)registerForPushNotificationsWithCompletion:(PushwooshRegistrationHandler _Nullable )completion;
245
-
246
- /**
247
- Registers for push notifications with custom tags. By default registeres for "UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert" flags.
248
- Automatically detects if you have "newsstand-content" in "UIBackgroundModes" and adds "UIRemoteNotificationTypeNewsstandContentAvailability" flag.
249
- */
250
- - (void)registerForPushNotificationsWith:(NSDictionary * _Nonnull)tags;
251
- - (void)registerForPushNotificationsWith:(NSDictionary * _Nonnull)tags completion:(PushwooshRegistrationHandler _Nullable )completion;
252
-
253
- /**
254
- Unregisters from push notifications.
255
- */
256
- - (void)unregisterForPushNotifications;
257
- - (void)unregisterForPushNotificationsWithCompletion:(void (^_Nullable)(NSError * _Nullable error))completion;
258
-
259
- /**
260
- Handle registration to remote notifications.
261
- */
262
- - (void)handlePushRegistration:(NSData * _Nonnull)devToken;
263
- - (void)handlePushRegistrationFailure:(NSError * _Nonnull)error;
264
-
265
- /**
266
- Handle received push notification.
267
- */
268
- - (BOOL)handlePushReceived:(NSDictionary * _Nonnull)userInfo;
269
-
270
- /**
271
- * Change default base url to reverse proxy url
272
- * @param url - reverse proxy url
273
- */
274
- - (void)setReverseProxy:(NSString * _Nonnull)url;
275
-
276
- /**
277
- * Disables reverse proxy
278
- */
279
- - (void)disableReverseProxy;
280
-
281
- /**
282
- 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).
283
-
284
- Example:
285
- @code
286
- NSDictionary *tags = @{ @"Alias" : aliasField.text,
287
- @"FavNumber" : @([favNumField.text intValue]),
288
- @"price" : [PWTags incrementalTagWithInteger:5],
289
- @"List" : @[ @"Item1", @"Item2", @"Item3" ]
290
- };
291
-
292
- [[PushNotificationManager pushManager] setTags:tags];
293
- @endcode
294
-
295
- @param tags Dictionary representation of tags to send.
296
- */
297
- - (void)setTags:(NSDictionary * _Nonnull)tags;
298
-
299
- /**
300
- Send tags to server with completion block. If setTags succeeds competion is called with nil argument. If setTags fails completion is called with error.
301
- */
302
- - (void)setTags:(NSDictionary * _Nonnull)tags completion:(void (^_Nullable)(NSError * _Nullable error))completion;
303
-
304
- - (void)setEmailTags:(NSDictionary * _Nonnull)tags forEmail:(NSString * _Nonnull)email;
305
-
306
- - (void)setEmailTags:(NSDictionary * _Nonnull)tags forEmail:(NSString * _Nonnull)email completion:(void(^ _Nullable)(NSError * _Nullable error))completion;
307
-
308
- /**
309
- Get tags from server. Calls delegate method if exists and handler (block).
310
-
311
- @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.
312
- Example of the dictionary representation of the received tags:
313
- {
314
- Country = ru;
315
- Language = ru;
316
- }
317
- @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.
318
- */
319
- - (void)getTags:(PushwooshGetTagsHandler _Nullable)successHandler onFailure:(PushwooshErrorHandler _Nullable)errorHandler;
320
-
321
- /**
322
- 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.
323
- This way Pushwoosh server can know what current badge value is set for the application.
324
-
325
- @param badge Current badge value.
326
- */
327
- - (void)sendBadges:(NSInteger)badge __API_AVAILABLE(macos(10.10), ios(8.0));
328
-
329
- /**
330
- Pushwoosh SDK version.
331
- */
332
- + (NSString * _Nonnull)version;
333
-
334
- #if TARGET_OS_IOS
335
- /**
336
- Sends in-app purchases to Pushwoosh. Use in paymentQueue:updatedTransactions: payment queue method (see example).
337
-
338
- Example:
339
- @code
340
- - (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions {
341
- [[PushNotificationManager pushManager] sendSKPaymentTransactions:transactions];
342
- }
343
- @endcode
344
-
345
- @param transactions Array of SKPaymentTransaction items as received in the payment queue.
346
- */
347
- - (void)sendSKPaymentTransactions:(NSArray * _Nonnull)transactions;
348
-
349
- /**
350
- Tracks individual in-app purchase. See recommended `sendSKPaymentTransactions:` method.
351
-
352
- @param productIdentifier purchased product ID
353
- @param price price for the product
354
- @param currencyCode currency of the price (ex: @"USD")
355
- @param date time of the purchase (ex: [NSDate now])
356
- */
357
- - (void)sendPurchase:(NSString * _Nonnull)productIdentifier withPrice:(NSDecimalNumber * _Nonnull)price currencyCode:(NSString * _Nonnull)currencyCode andDate:(NSDate * _Nonnull)date;
358
-
359
- #endif
360
- /**
361
- Gets current push token.
362
-
363
- @return Current push token. May be nil if no push token is available yet.
364
- */
365
- - (NSString * _Nullable)getPushToken;
366
-
367
- /**
368
- Gets HWID. Unique device identifier that used in all API calls with Pushwoosh.
369
- This is identifierForVendor for iOS >= 7.
370
-
371
- @return Unique device identifier.
372
- */
373
- - (NSString * _Nonnull)getHWID;
374
-
375
- /**
376
- Gets UserId.
377
-
378
- @return userId. If the userId hasn't been set previously, then the userId is assigned the HWID.
379
- */
380
- - (NSString * _Nonnull)getUserId;
381
-
382
- /**
383
- Returns dictionary with enabled remove notificaton types.
384
-
385
- Example enabled push:
386
- @code
387
- {
388
- enabled = 1;
389
- pushAlert = 1;
390
- pushBadge = 1;
391
- pushSound = 1;
392
- type = 7;
393
- }
394
- @endcode
395
- where "type" field is UIUserNotificationType
396
-
397
- Disabled push:
398
- @code
399
- {
400
- enabled = 1;
401
- pushAlert = 0;
402
- pushBadge = 0;
403
- pushSound = 0;
404
- type = 0;
405
- }
406
- @endcode
407
-
408
- Note: In the latter example "enabled" field means that device can receive push notification but could not display alerts (ex: silent push)
409
- */
410
- + (NSMutableDictionary * _Nullable)getRemoteNotificationStatus;
411
-
412
- /**
413
- Clears the notifications from the notification center.
414
- */
415
- + (void)clearNotificationCenter;
416
-
417
- /**
418
- Set User indentifier. This could be Facebook ID, username or email, or any other user ID.
419
- This allows data and events to be matched across multiple user devices.
420
- If setUserId succeeds competion is called with nil argument. If setUserId fails completion is called with error.
421
-
422
- @param userId user identifier
423
- */
424
- - (void)setUserId:(NSString * _Nonnull)userId completion:(void(^ _Nullable)(NSError * _Nullable error))completion;
425
-
426
- /**
427
- Set User indentifier. This could be Facebook ID, username or email, or any other user ID.
428
- This allows data and events to be matched across multiple user devices.
429
-
430
- @param userId user identifier
431
- */
432
- - (void)setUserId:(NSString * _Nonnull)userId;
433
-
434
- /**
435
- Set User indentifier. This could be Facebook ID, username or email, or any other user ID.
436
- This allows data and events to be matched across multiple user devices.
437
- If setUser succeeds competion is called with nil argument. If setUser fails completion is called with error.
438
-
439
- @param userId user identifier
440
- @param emails user's emails array
441
- */
442
- - (void)setUser:(NSString * _Nonnull)userId emails:(NSArray * _Nonnull)emails completion:(void(^ _Nullable)(NSError * _Nullable error))completion;
443
-
444
-
445
- /**
446
- Set User indentifier. This could be Facebook ID, username or email, or any other user ID.
447
- This allows data and events to be matched across multiple user devices.
448
-
449
- @param userId user identifier
450
- @param emails user's emails array
451
- */
452
- - (void)setUser:(NSString * _Nonnull)userId emails:(NSArray * _Nonnull)emails;
453
-
454
- /**
455
- Set User indentifier. This could be Facebook ID, username or email, or any other user ID.
456
- This allows data and events to be matched across multiple user devices.
457
- If setUser succeeds competion is called with nil argument. If setUser fails completion is called with error.
458
-
459
- @param userId user identifier
460
- @param email user's email string
461
- */
462
- - (void)setUser:(NSString * _Nonnull)userId email:(NSString * _Nonnull)email completion:(void(^ _Nullable)(NSError * _Nullable error))completion;
463
-
464
- /**
465
- Register emails list associated to the current user.
466
- If setEmails succeeds competion is called with nil argument. If setEmails fails completion is called with error.
467
-
468
- @param emails user's emails array
469
- */
470
- - (void)setEmails:(NSArray * _Nonnull)emails completion:(void(^ _Nullable)(NSError * _Nullable error))completion;
471
-
472
- /**
473
- Register emails list associated to the current user.
474
-
475
- @param emails user's emails array
476
- */
477
- - (void)setEmails:(NSArray * _Nonnull)emails;
478
-
479
- /**
480
- Register email associated to the current user. Email should be a string and could not be null or empty.
481
- If setEmail succeeds competion is called with nil argument. If setEmail fails completion is called with error.
482
-
483
- @param email user's email string
484
- */
485
- - (void)setEmail:(NSString * _Nonnull)email completion:(void(^ _Nullable)(NSError * _Nullable error))completion;
486
-
487
- /**
488
- Register email associated to the current user. Email should be a string and could not be null or empty.
489
-
490
- @param email user's email string
491
- */
492
- - (void)setEmail:(NSString * _Nonnull)email;
493
-
494
- /**
495
- Move all events from oldUserId to newUserId if doMerge is true. If doMerge is false all events for oldUserId are removed.
496
-
497
- @param oldUserId source user
498
- @param newUserId destination user
499
- @param doMerge if false all events for oldUserId are removed, if true all events for oldUserId are moved to newUserId
500
- @param completion callback
501
- */
502
- - (void)mergeUserId:(NSString * _Nonnull)oldUserId to:(NSString * _Nonnull)newUserId doMerge:(BOOL)doMerge completion:(void (^ _Nullable)(NSError * _Nullable error))completion;
503
-
504
- /**
505
- Starts communication with Pushwoosh server.
506
- */
507
- - (void)startServerCommunication;
508
-
509
- /**
510
- Stops communication with Pushwoosh server.
511
- */
512
- - (void)stopServerCommunication;
513
-
514
- /**
515
- Process URL of some deep link. Primarly used for register test devices.
516
-
517
- @param url Deep Link URL
518
- */
519
- #if TARGET_OS_IOS || TARGET_OS_WATCH
520
- - (BOOL)handleOpenURL:(NSURL * _Nonnull)url;
521
- #endif
522
-
523
- /**
524
- Sends push to start live activity token to the server.
525
- Call this method when you want to initiate live activity via push notification
526
-
527
- Example:
528
- @code
529
-
530
- if #available(iOS 17.2, *) {
531
- Task {
532
- for await data in Activity<LiveActivityAttributes>.pushToStartTokenUpdates {
533
- let token = data.map { String(format: "%02x", $0) }.joined()
534
- do {
535
- try await Pushwoosh.sharedInstance().sendPush(toStartLiveActivityToken: token)
536
- } catch {
537
- print("Error sending push to start live activity: \(error)")
538
- }
539
- }
540
- }
541
- }
542
-
543
- @endcode
544
- */
545
-
546
- - (void)sendPushToStartLiveActivityToken:(NSString *_Nullable)token;
547
- - (void)sendPushToStartLiveActivityToken:(NSString *_Nullable)token completion:(void (^ _Nullable)(NSError * _Nullable))completion;
548
-
549
- /**
550
- Sends live activity token to the server.
551
- Call this method when you create a live activity.
552
-
553
- Example:
554
- @code
555
- do {
556
- let activity = try Activity<PushwooshAppAttributes>.request(
557
- attributes: attributes,
558
- contentState: contentState,
559
- pushType: .token)
560
- for await data in activity.pushTokenUpdates {
561
- let token = data.map {String(format: "%02x", $0)}.joined()
562
- try await Pushwoosh.sharedInstance().startLiveActivity(withToken: token)
563
- return token
564
- }
565
- } catch (let error) {
566
- print(error.localizedDescription)
567
- return nil
568
- }
569
- @endcode
570
- */
571
- - (void)startLiveActivityWithToken:(NSString * _Nonnull)token;
572
- - (void)startLiveActivityWithToken:(NSString * _Nonnull)token completion:(void (^ _Nullable)(NSError * _Nullable error))completion;
573
-
574
- /**
575
- Call this method when you finish working with the live activity.
576
-
577
- Example:
578
- @code
579
- func end(activity: Activity<PushwooshAppAttributes>) {
580
- Task {
581
- await activity.end(dismissalPolicy: .immediate)
582
- try await Pushwoosh.sharedInstance().stopLiveActivity()
583
- }
584
- }
585
- @endcode
586
- */
587
- - (void)stopLiveActivity;
588
- - (void)stopLiveActivityWithCompletion:(void (^ _Nullable)(NSError * _Nullable error))completion;
589
-
590
- @end
591
-
592
- /**
593
- `PWNotificationCenterDelegateProxy` class handles notifications on iOS 10 and forwards methods of UNUserNotificationCenterDelegate to all added delegates.
594
- */
595
- #if TARGET_OS_IOS || TARGET_OS_WATCH
596
- @interface PWNotificationCenterDelegateProxy : NSObject <UNUserNotificationCenterDelegate>
597
- #elif TARGET_OS_OSX
598
- @interface PWNotificationCenterDelegateProxy : NSObject <NSUserNotificationCenterDelegate>
599
- #endif
600
- /**
601
- Returns UNUserNotificationCenterDelegate that handles foreground push notifications on iOS10
602
- */
603
- #if TARGET_OS_IOS || TARGET_OS_WATCH
604
- @property (nonatomic, strong, readonly) id<UNUserNotificationCenterDelegate> _Nonnull defaultNotificationCenterDelegate;
605
- #elif TARGET_OS_OSX
606
- @property (nonatomic, strong, readonly) id<NSUserNotificationCenterDelegate> defaultNotificationCenterDelegate;
607
- #endif
608
-
609
- /**
610
- Adds extra UNUserNotificationCenterDelegate that handles foreground push notifications on iOS10.
611
- */
612
- #if TARGET_OS_IOS || TARGET_OS_WATCH
613
- - (void)addNotificationCenterDelegate:(id<UNUserNotificationCenterDelegate> _Nonnull)delegate;
614
- #endif
615
- @end
616
-
617
-
618
- /**
619
- `PWTagsBuilder` class encapsulates the methods for creating tags parameters for sending them to the server.
620
- */
621
- @interface PWTagsBuilder : NSObject
622
- /**
623
- Creates a dictionary for incrementing/decrementing a numeric tag on the server.
624
-
625
- Example:
626
- @code
627
- NSDictionary *tags = @{
628
- @"Alias" : aliasField.text,
629
- @"FavNumber" : @([favNumField.text intValue]),
630
- @"price": [PWTags incrementalTagWithInteger:5],
631
- };
632
-
633
- [[PushNotificationManager pushManager] setTags:tags];
634
- @endcode
635
-
636
- @param delta Difference that needs to be applied to the tag's counter.
637
-
638
- @return Dictionary, that needs to be sent as the value for the tag
639
- */
640
- + (NSDictionary * _Nullable)incrementalTagWithInteger:(NSInteger)delta;
641
-
642
- /**
643
- Creates a dictionary for extending Tag’s values list with additional values
644
-
645
- Example:
646
-
647
- @code
648
- NSDictionary *tags = @{
649
- @"Alias" : aliasField.text,
650
- @"FavNumber" : @([favNumField.text intValue]),
651
- @"List" : [PWTags appendValuesToListTag:@[ @"Item1" ]]
652
- };
653
-
654
- [[PushNotificationManager pushManager] setTags:tags];
655
- @endcode
656
-
657
- @param array Array of values to be added to the tag.
658
-
659
- @return Dictionary to be sent as the value for the tag
660
- */
661
- + (NSDictionary * _Nullable)appendValuesToListTag:(NSArray<NSString *> * _Nonnull)array;
662
-
663
- /**
664
- Creates a dictionary for removing Tag’s values from existing values list
665
-
666
- Example:
667
-
668
- @code
669
- NSDictionary *tags = @{
670
- @"Alias" : aliasField.text,
671
- @"FavNumber" : @([favNumField.text intValue]),
672
- @"List" : [PWTags removeValuesFromListTag:@[ @"Item1" ]]
673
- };
674
-
675
- [[PushNotificationManager pushManager] setTags:tags];
676
- @endcode
677
-
678
- @param array Array of values to be removed from the tag.
679
-
680
- @return Dictionary to be sent as the value for the tag
681
- */
682
- + (NSDictionary * _Nullable)removeValuesFromListTag:(NSArray<NSString *> * _Nonnull)array;
683
-
684
- @end