pushwoosh-react-native-plugin 6.1.29 → 6.1.31
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.
- package/.github/ISSUE_TEMPLATE/bug_report.yml +1 -0
- package/index.d.ts +4 -0
- package/package.json +1 -1
- package/pushwoosh-react-native-plugin.podspec +1 -1
- package/src/android/build.gradle +1 -1
- package/src/android/src/main/java/com/pushwoosh/reactnativeplugin/PushwooshPlugin.java +2 -0
- package/src/ios/PWMessaging.h +1 -1
- package/src/ios/PWNotificationExtensionManager.h +6 -3
- package/src/ios/PushNotificationManager.h +22 -0
- package/src/ios/Pushwoosh.h +55 -1
- package/src/ios/PushwooshPlugin/Pushwoosh.h +1 -1
- package/src/ios/PushwooshPlugin/Pushwoosh.m +113 -47
- package/src/ios/libPushwoosh.a +0 -0
|
@@ -58,6 +58,7 @@ 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.30
|
|
61
62
|
- 6.1.28
|
|
62
63
|
- 6.1.26
|
|
63
64
|
- 6.1.25
|
package/index.d.ts
CHANGED
|
@@ -45,10 +45,14 @@ declare module 'pushwoosh-react-native-plugin' {
|
|
|
45
45
|
getShowPushnotificationAlert(callback: (willShow: boolean) => void): void;
|
|
46
46
|
getPushToken(success?: (token: string) => void): void;
|
|
47
47
|
getHwid(success: (hwid: string) => void): void;
|
|
48
|
+
getUserId(success: (userId: string) => void): void;
|
|
48
49
|
setUserId(userId: string, success?: ()=> void, fail?: (error: Error) => void): void;
|
|
49
50
|
postEvent(event: string, attributes?: Record<string, string>): void;
|
|
50
51
|
enableHuaweiPushNotifications(): void;
|
|
51
52
|
|
|
53
|
+
//email methods
|
|
54
|
+
setUserEmails(userId: string, emails: (string | string[]), success?: () => void, fail?: (error: Error) => void): void;
|
|
55
|
+
setEmails(emails: (string | string[]), success?: () => void, fail?: (error: Error) => void): void;
|
|
52
56
|
//badge methods
|
|
53
57
|
setApplicationIconBadgeNumber(badgeNumber: number): void;
|
|
54
58
|
getApplicationIconBadgeNumber(callback: (badge: number) => void): void;
|
package/package.json
CHANGED
package/src/android/build.gradle
CHANGED
|
@@ -24,6 +24,8 @@ import com.pushwoosh.RegisterForPushNotificationsResultData;
|
|
|
24
24
|
import com.pushwoosh.badge.PushwooshBadge;
|
|
25
25
|
import com.pushwoosh.exception.GetTagsException;
|
|
26
26
|
import com.pushwoosh.exception.PushwooshException;
|
|
27
|
+
import com.pushwoosh.exception.SetEmailException;
|
|
28
|
+
import com.pushwoosh.exception.SetUserException;
|
|
27
29
|
import com.pushwoosh.exception.SetUserIdException;
|
|
28
30
|
import com.pushwoosh.exception.RegisterForPushNotificationsException;
|
|
29
31
|
import com.pushwoosh.exception.UnregisterForPushNotificationException;
|
package/src/ios/PWMessaging.h
CHANGED
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
|
|
13
13
|
#if TARGET_OS_IOS
|
|
14
14
|
#import "PWAppDelegate.h"
|
|
15
|
+
#import "PWNotificationExtensionManager.h"
|
|
15
16
|
#import "PWRichMediaManager.h"
|
|
16
17
|
#import "PWRichMediaStyle.h"
|
|
17
18
|
#import "PWInbox.h"
|
|
18
19
|
#import "PWInlineInAppView.h"
|
|
19
|
-
#import "PWNotificationExtensionManager.h"
|
|
20
20
|
#endif
|
|
@@ -35,12 +35,15 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
35
35
|
self.contentHandler = contentHandler;
|
|
36
36
|
self.bestAttemptContent = [request.content mutableCopy];
|
|
37
37
|
|
|
38
|
-
[[PWNotificationExtensionManager sharedManager] handleNotificationRequest:request
|
|
38
|
+
[[PWNotificationExtensionManager sharedManager] handleNotificationRequest:request
|
|
39
|
+
withAppGroups:@"group.com.example_domain.example_app_name"
|
|
40
|
+
contentHandler:contentHandler];
|
|
39
41
|
}
|
|
40
42
|
@endcode
|
|
41
43
|
*/
|
|
42
|
-
- (void)handleNotificationRequest:(UNNotificationRequest *)request
|
|
43
|
-
|
|
44
|
+
- (void)handleNotificationRequest:(UNNotificationRequest *)request
|
|
45
|
+
withAppGroups:(NSString * _Nonnull)appGroupsName
|
|
46
|
+
contentHandler:(void (^ _Nonnull)(UNNotificationContent * _Nonnull))contentHandler;
|
|
44
47
|
@end
|
|
45
48
|
|
|
46
49
|
NS_ASSUME_NONNULL_END
|
|
@@ -207,6 +207,28 @@ typedef void (^PushwooshErrorHandler)(NSError *error);
|
|
|
207
207
|
*/
|
|
208
208
|
+ (NSDictionary *)appendValuesToListTag:(NSArray<NSString *> *)array;
|
|
209
209
|
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
Creates a dictionary for removing Tag’s values from existing values list
|
|
213
|
+
|
|
214
|
+
Example:
|
|
215
|
+
|
|
216
|
+
@code
|
|
217
|
+
NSDictionary *tags = @{
|
|
218
|
+
@"Alias" : aliasField.text,
|
|
219
|
+
@"FavNumber" : @([favNumField.text intValue]),
|
|
220
|
+
@"List" : [PWTags removeValuesFromListTag:@[ @"Item1" ]]
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
[[PushNotificationManager pushManager] setTags:tags];
|
|
224
|
+
@endcode
|
|
225
|
+
|
|
226
|
+
@param array Array of values to be removed from the tag.
|
|
227
|
+
|
|
228
|
+
@return Dictionary to be sent as the value for the tag
|
|
229
|
+
*/
|
|
230
|
+
+ (NSDictionary *)removeValuesFromListTag:(NSArray<NSString *> *)array;
|
|
231
|
+
|
|
210
232
|
@end
|
|
211
233
|
|
|
212
234
|
/**
|
package/src/ios/Pushwoosh.h
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
#endif
|
|
20
20
|
|
|
21
|
-
#define PUSHWOOSH_VERSION @"6.5.
|
|
21
|
+
#define PUSHWOOSH_VERSION @"6.5.11"
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
@class Pushwoosh, PWMessage, PWNotificationCenterDelegateProxy;
|
|
@@ -243,6 +243,13 @@ Tells the delegate that the user has pressed on the push notification banner.
|
|
|
243
243
|
- (void)registerForPushNotifications;
|
|
244
244
|
- (void)registerForPushNotificationsWithCompletion:(PushwooshRegistrationHandler _Nullable )completion;
|
|
245
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
|
+
|
|
246
253
|
/**
|
|
247
254
|
Unregisters from push notifications.
|
|
248
255
|
*/
|
|
@@ -513,6 +520,32 @@ Unregisters from push notifications.
|
|
|
513
520
|
- (BOOL)handleOpenURL:(NSURL * _Nonnull)url;
|
|
514
521
|
#endif
|
|
515
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
|
+
|
|
516
549
|
/**
|
|
517
550
|
Sends live activity token to the server.
|
|
518
551
|
Call this method when you create a live activity.
|
|
@@ -627,4 +660,25 @@ Unregisters from push notifications.
|
|
|
627
660
|
*/
|
|
628
661
|
+ (NSDictionary * _Nullable)appendValuesToListTag:(NSArray<NSString *> * _Nonnull)array;
|
|
629
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
|
+
|
|
630
684
|
@end
|
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
#import <UserNotifications/UserNotifications.h>
|
|
16
16
|
#import <Pushwoosh/PushNotificationManager.h>
|
|
17
17
|
|
|
18
|
+
#import <objc/runtime.h>
|
|
19
|
+
|
|
18
20
|
static id objectOrNull(id object) {
|
|
19
21
|
if (object) {
|
|
20
22
|
return object;
|
|
@@ -32,6 +34,28 @@ static NSString * const kPushOpenEvent = @"PWPushOpen";
|
|
|
32
34
|
static NSString * const kPushOpenJSEvent = @"pushOpened";
|
|
33
35
|
static NSString * const kPushReceivedJSEvent = @"pushReceived";
|
|
34
36
|
|
|
37
|
+
@interface PushwooshPlugin (InnerPushwooshPlugin)
|
|
38
|
+
|
|
39
|
+
- (void) application:(UIApplication *)application pwplugin_didRegisterWithDeviceToken:(NSData *)deviceToken;
|
|
40
|
+
- (void) application:(UIApplication *)application pwplugin_didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler;
|
|
41
|
+
- (void) application:(UIApplication *)application pwplugin_didFailToRegisterForRemoteNotificationsWithError:(NSError *)error;
|
|
42
|
+
|
|
43
|
+
@end
|
|
44
|
+
|
|
45
|
+
void pushwoosh_swizzle(Class class, SEL fromChange, SEL toChange, IMP impl, const char * signature) {
|
|
46
|
+
Method method = nil;
|
|
47
|
+
method = class_getInstanceMethod(class, fromChange);
|
|
48
|
+
|
|
49
|
+
if (method) {
|
|
50
|
+
//method exists add a new method and swap with original
|
|
51
|
+
class_addMethod(class, toChange, impl, signature);
|
|
52
|
+
method_exchangeImplementations(class_getInstanceMethod(class, fromChange), class_getInstanceMethod(class, toChange));
|
|
53
|
+
} else {
|
|
54
|
+
//just add as orignal method
|
|
55
|
+
class_addMethod(class, fromChange, impl, signature);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
35
59
|
@implementation PushwooshPlugin
|
|
36
60
|
|
|
37
61
|
API_AVAILABLE(ios(10))
|
|
@@ -71,15 +95,23 @@ RCT_EXPORT_METHOD(init:(NSDictionary*)config success:(RCTResponseSenderBlock)suc
|
|
|
71
95
|
[PushNotificationManager initializeWithAppCode:appCode appName:nil];
|
|
72
96
|
[[PushNotificationManager pushManager] sendAppOpen];
|
|
73
97
|
[PushNotificationManager pushManager].delegate = self;
|
|
74
|
-
|
|
98
|
+
|
|
99
|
+
[PushwooshPlugin swizzleNotificationSettingsHandler];
|
|
75
100
|
|
|
76
101
|
// We set Pushwoosh UNUserNotificationCenter delegate unless CUSTOM is specified in the config
|
|
77
102
|
if(![notificationHandling isEqualToString:@"CUSTOM"]) {
|
|
78
103
|
if (@available(iOS 10, *)) {
|
|
104
|
+
BOOL shouldReplaceDelegate = YES;
|
|
79
105
|
|
|
80
106
|
UNUserNotificationCenter *notificationCenter = [UNUserNotificationCenter currentNotificationCenter];
|
|
107
|
+
|
|
108
|
+
#if !TARGET_OS_OSX
|
|
109
|
+
if ([notificationCenter.delegate conformsToProtocol:@protocol(PushNotificationDelegate)]) {
|
|
110
|
+
shouldReplaceDelegate = NO;
|
|
111
|
+
}
|
|
112
|
+
#endif
|
|
81
113
|
|
|
82
|
-
if (notificationCenter.delegate != nil) {
|
|
114
|
+
if (notificationCenter.delegate != nil && shouldReplaceDelegate) {
|
|
83
115
|
_originalNotificationCenterDelegate = notificationCenter.delegate;
|
|
84
116
|
_originalNotificationCenterDelegateResponds.openSettingsForNotification =
|
|
85
117
|
(unsigned int)[_originalNotificationCenterDelegate
|
|
@@ -94,8 +126,10 @@ RCT_EXPORT_METHOD(init:(NSDictionary*)config success:(RCTResponseSenderBlock)suc
|
|
|
94
126
|
didReceiveNotificationResponse:withCompletionHandler:)];
|
|
95
127
|
}
|
|
96
128
|
|
|
97
|
-
|
|
98
|
-
|
|
129
|
+
if (shouldReplaceDelegate) {
|
|
130
|
+
__strong PushwooshPlugin<UNUserNotificationCenterDelegate> *strongSelf = (PushwooshPlugin<UNUserNotificationCenterDelegate> *)self;
|
|
131
|
+
notificationCenter.delegate = (id<UNUserNotificationCenterDelegate>)strongSelf;
|
|
132
|
+
}
|
|
99
133
|
}
|
|
100
134
|
}
|
|
101
135
|
|
|
@@ -179,27 +213,35 @@ RCT_EXPORT_METHOD(getPushToken:(RCTResponseSenderBlock)callback) {
|
|
|
179
213
|
}
|
|
180
214
|
|
|
181
215
|
RCT_EXPORT_METHOD(setEmails:(NSArray *)emails success:(RCTResponseSenderBlock)successCallback error:(RCTResponseSenderBlock)errorCallback) {
|
|
216
|
+
__block NSError* gError = nil;
|
|
182
217
|
[[Pushwoosh sharedInstance] setEmails:emails completion:^(NSError * _Nullable error) {
|
|
183
|
-
if (
|
|
184
|
-
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
if (error && errorCallback) {
|
|
188
|
-
errorCallback(@[ objectOrNull([error localizedDescription]) ]);
|
|
218
|
+
if (error) {
|
|
219
|
+
gError = error;
|
|
189
220
|
}
|
|
190
221
|
}];
|
|
222
|
+
if (!gError && successCallback) {
|
|
223
|
+
successCallback(@[]);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
if (gError && errorCallback) {
|
|
227
|
+
errorCallback(@[ objectOrNull([gError localizedDescription]) ]);
|
|
228
|
+
}
|
|
191
229
|
}
|
|
192
230
|
|
|
193
231
|
RCT_EXPORT_METHOD(setUserEmails:(NSString*)userId emails:(NSArray *)emails success:(RCTResponseSenderBlock)successCallback error:(RCTResponseSenderBlock)errorCallback) {
|
|
232
|
+
__block NSError* gError = nil;
|
|
194
233
|
[[Pushwoosh sharedInstance] setUser:userId emails:emails completion:^(NSError * _Nullable error) {
|
|
195
|
-
if (
|
|
196
|
-
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
if (error && errorCallback) {
|
|
200
|
-
errorCallback(@[ objectOrNull([error localizedDescription]) ]);
|
|
234
|
+
if (error) {
|
|
235
|
+
gError = error;
|
|
201
236
|
}
|
|
202
237
|
}];
|
|
238
|
+
if (!gError && successCallback) {
|
|
239
|
+
successCallback(@[]);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
if (gError && errorCallback) {
|
|
243
|
+
errorCallback(@[ objectOrNull([gError localizedDescription]) ]);
|
|
244
|
+
}
|
|
203
245
|
}
|
|
204
246
|
|
|
205
247
|
RCT_EXPORT_METHOD(setTags:(NSDictionary*)tags success:(RCTResponseSenderBlock)successCallback error:(RCTResponseSenderBlock)errorCallback) {
|
|
@@ -362,19 +404,55 @@ RCT_EXPORT_METHOD(performAction:(NSString*)code) {
|
|
|
362
404
|
[PWInbox performActionForMessageWithCode:code];
|
|
363
405
|
}
|
|
364
406
|
|
|
365
|
-
#pragma mark - UIApplicationDelegate Methods
|
|
366
407
|
#pragma mark -
|
|
408
|
+
#pragma mark - Swizzling
|
|
367
409
|
|
|
368
|
-
|
|
369
|
-
[
|
|
410
|
+
+ (void)swizzleNotificationSettingsHandler {
|
|
411
|
+
if ([UIApplication sharedApplication].delegate == nil) {
|
|
412
|
+
return;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
if ([[[UIDevice currentDevice] systemVersion] floatValue] < 8.0) {
|
|
416
|
+
return;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
static Class appDelegateClass = nil;
|
|
420
|
+
|
|
421
|
+
//do not swizzle the same class twice
|
|
422
|
+
id delegate = [UIApplication sharedApplication].delegate;
|
|
423
|
+
if(appDelegateClass == [delegate class]) {
|
|
424
|
+
return;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
appDelegateClass = [delegate class];
|
|
428
|
+
|
|
429
|
+
pushwoosh_swizzle([delegate class], @selector(application:didRegisterForRemoteNotificationsWithDeviceToken:), @selector(application:pwplugin_didRegisterWithDeviceToken:), (IMP)pwplugin_didRegisterWithDeviceToken, "v@:::");
|
|
430
|
+
pushwoosh_swizzle([delegate class], @selector(application:didFailToRegisterForRemoteNotificationsWithError:), @selector(application:pwplugin_didFailToRegisterForRemoteNotificationsWithError:), (IMP)pwplugin_didFailToRegisterForRemoteNotificationsWithError, "v@:::");
|
|
431
|
+
pushwoosh_swizzle([delegate class], @selector(application:didReceiveRemoteNotification:fetchCompletionHandler:), @selector(application:pwplugin_didReceiveRemoteNotification:fetchCompletionHandler:), (IMP)pwplugin_didReceiveRemoteNotification, "v@::::");
|
|
370
432
|
}
|
|
371
433
|
|
|
372
|
-
|
|
373
|
-
[
|
|
434
|
+
void pwplugin_didReceiveRemoteNotification(id self, SEL _cmd, UIApplication * application, NSDictionary * userInfo, void (^completionHandler)(UIBackgroundFetchResult)) {
|
|
435
|
+
if ([self respondsToSelector:@selector(application:pwplugin_didReceiveRemoteNotification:fetchCompletionHandler:)]) {
|
|
436
|
+
[self application:application pwplugin_didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
[[Pushwoosh sharedInstance] handlePushReceived:userInfo];
|
|
374
440
|
}
|
|
375
441
|
|
|
376
|
-
|
|
377
|
-
[
|
|
442
|
+
void pwplugin_didRegisterWithDeviceToken(id self, SEL _cmd, id application, NSData *deviceToken) {
|
|
443
|
+
if ([self respondsToSelector:@selector(application: pwplugin_didRegisterWithDeviceToken:)]) {
|
|
444
|
+
[self application:application pwplugin_didRegisterWithDeviceToken:deviceToken];
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
[[Pushwoosh sharedInstance] handlePushRegistration:deviceToken];
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
void pwplugin_didFailToRegisterForRemoteNotificationsWithError(id self, SEL _cmd, UIApplication *application, NSError *error) {
|
|
451
|
+
if ([self respondsToSelector:@selector(application:pwplugin_didFailToRegisterForRemoteNotificationsWithError:)]) {
|
|
452
|
+
[self application:application pwplugin_didFailToRegisterForRemoteNotificationsWithError:error];
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
[[Pushwoosh sharedInstance] handlePushRegistrationFailure:error];
|
|
378
456
|
}
|
|
379
457
|
|
|
380
458
|
#pragma mark - UNUserNotificationCenter Delegate Methods
|
|
@@ -387,20 +465,6 @@ RCT_EXPORT_METHOD(performAction:(NSString*)code) {
|
|
|
387
465
|
API_AVAILABLE(ios(10.0)) {
|
|
388
466
|
|
|
389
467
|
if ([self isRemoteNotification:notification] && [PWMessage isPushwooshMessage:notification.request.content.userInfo]) {
|
|
390
|
-
UNMutableNotificationContent *content = notification.request.content.mutableCopy;
|
|
391
|
-
|
|
392
|
-
NSMutableDictionary *userInfo = content.userInfo.mutableCopy;
|
|
393
|
-
userInfo[@"pw_push"] = @(YES);
|
|
394
|
-
|
|
395
|
-
content.userInfo = userInfo;
|
|
396
|
-
|
|
397
|
-
//newsstand push
|
|
398
|
-
if (![self isContentAvailablePush:userInfo]) {
|
|
399
|
-
[[PWEventDispatcher sharedDispatcher] dispatchEvent:kPushReceivedEvent withArgs:@[ objectOrNull(userInfo) ]];
|
|
400
|
-
|
|
401
|
-
[self sendJSEvent:kPushReceivedJSEvent withArgs:userInfo];
|
|
402
|
-
}
|
|
403
|
-
|
|
404
468
|
completionHandler(UNNotificationPresentationOptionNone);
|
|
405
469
|
} else if ([PushNotificationManager pushManager].showPushnotificationAlert || [notification.request.content.userInfo objectForKey:@"pw_push"] == nil) {
|
|
406
470
|
completionHandler(UNNotificationPresentationOptionBadge | UNNotificationPresentationOptionAlert | UNNotificationPresentationOptionSound);
|
|
@@ -438,20 +502,10 @@ API_AVAILABLE(ios(10.0)) {
|
|
|
438
502
|
if (![response.actionIdentifier isEqualToString:UNNotificationDefaultActionIdentifier] && [[PushNotificationManager pushManager].delegate respondsToSelector:@selector(onActionIdentifierReceived:withNotification:)]) {
|
|
439
503
|
[[PushNotificationManager pushManager].delegate onActionIdentifierReceived:response.actionIdentifier withNotification:[self pushPayloadFromContent:response.notification.request.content]];
|
|
440
504
|
}
|
|
441
|
-
|
|
442
|
-
[[PWEventDispatcher sharedDispatcher] dispatchEvent:kPushOpenEvent withArgs:@[ objectOrNull(response.notification.request.content.userInfo) ]];
|
|
443
|
-
|
|
444
|
-
[self sendJSEvent:kPushOpenJSEvent withArgs:response.notification.request.content.userInfo];
|
|
445
505
|
}
|
|
446
506
|
};
|
|
447
507
|
|
|
448
508
|
if ([self isRemoteNotification:response.notification] && [PWMessage isPushwooshMessage:response.notification.request.content.userInfo]) {
|
|
449
|
-
if (![self isContentAvailablePush:response.notification.request.content.userInfo]) {
|
|
450
|
-
[[PWEventDispatcher sharedDispatcher] dispatchEvent:kPushOpenEvent withArgs:@[ objectOrNull(response.notification.request.content.userInfo) ]];
|
|
451
|
-
|
|
452
|
-
[self sendJSEvent:kPushOpenJSEvent withArgs:response.notification.request.content.userInfo];
|
|
453
|
-
}
|
|
454
|
-
|
|
455
509
|
handlePushAcceptanceBlock();
|
|
456
510
|
} else if ([response.notification.request.content.userInfo objectForKey:@"pw_push"]) {
|
|
457
511
|
handlePushAcceptanceBlock();
|
|
@@ -768,6 +822,18 @@ RCT_EXPORT_METHOD(enableHuaweiPushNotifications) {
|
|
|
768
822
|
[[PWEventDispatcher sharedDispatcher] dispatchEvent:kRegistrationErrorEvent withArgs:@[ objectOrNull([error localizedDescription]) ]];
|
|
769
823
|
}
|
|
770
824
|
|
|
825
|
+
- (void)onPushReceived:(PushNotificationManager *)pushManager withNotification:(NSDictionary *)pushNotification onStart:(BOOL)onStart {
|
|
826
|
+
[[PWEventDispatcher sharedDispatcher] dispatchEvent:kPushReceivedEvent withArgs:@[ objectOrNull(pushNotification) ]];
|
|
827
|
+
|
|
828
|
+
[self sendJSEvent:kPushReceivedJSEvent withArgs:pushNotification];
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
- (void)onPushAccepted:(PushNotificationManager *)manager withNotification:(NSDictionary *)pushNotification onStart:(BOOL)onStart {
|
|
832
|
+
[[PWEventDispatcher sharedDispatcher] dispatchEvent:kPushOpenEvent withArgs:@[ objectOrNull(pushNotification) ]];
|
|
833
|
+
|
|
834
|
+
[self sendJSEvent:kPushOpenJSEvent withArgs:pushNotification];
|
|
835
|
+
}
|
|
836
|
+
|
|
771
837
|
#pragma mark - RCTEventEmitter
|
|
772
838
|
|
|
773
839
|
- (void)sendJSEvent:(NSString*)event withArgs:(NSDictionary*)args {
|
package/src/ios/libPushwoosh.a
CHANGED
|
Binary file
|