pushwoosh-react-native-plugin 6.1.59 → 6.1.60

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pushwoosh-react-native-plugin",
3
- "version": "6.1.59",
3
+ "version": "6.1.60",
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.59"
3
+ s.version = "6.1.60"
4
4
  s.summary = "React Native Pushwoosh Push Notifications module"
5
5
  s.requires_arc = true
6
6
  s.author = 'Pushwoosh'
@@ -15,6 +15,6 @@ Pod::Spec.new do |s|
15
15
  s.static_framework = true
16
16
 
17
17
  s.dependency 'React'
18
- s.dependency 'PushwooshXCFramework', '7.2.3'
18
+ s.dependency 'PushwooshXCFramework', '7.2.5'
19
19
  s.dependency 'PushwooshInboxUIXCFramework'
20
20
  end
@@ -37,7 +37,7 @@ android {
37
37
  }
38
38
 
39
39
  ext {
40
- pushwoosh = "6.10.2"
40
+ pushwoosh = "6.11.1"
41
41
  }
42
42
 
43
43
  dependencies {
@@ -1,6 +1,6 @@
1
1
  # Add project specific ProGuard rules here.
2
2
  # By default, the flags in this file are appended to flags specified
3
- # in /Users/arellomobile/Library/Android/sdk/tools/proguard/proguard-android.txt
3
+ # in $HOME/Library/Android/sdk/tools/proguard/proguard-android.txt
4
4
  # You can edit the include path and order by changing the proguardFiles
5
5
  # directive in build.gradle.
6
6
  #
@@ -78,6 +78,27 @@ static NSString * const kPushOpenEvent = @"PWPushOpen";
78
78
  static NSString * const kPushOpenJSEvent = @"pushOpened";
79
79
  static NSString * const kPushReceivedJSEvent = @"pushReceived";
80
80
 
81
+ /// Returns the push link only when it is a deep link this app can route itself, otherwise nil.
82
+ ///
83
+ /// http/https links are left to the native SDK: it checks the host's apple-app-site-association
84
+ /// and either hands the link to the app's Universal Links handler (own domain) or opens the
85
+ /// browser (anyone else's). Handing those to RCTLinking too made every external link land in JS
86
+ /// as if it were an in-app destination.
87
+ static NSURL * pwplugin_deepLinkURLFromPushLink(id link) {
88
+ if (![link isKindOfClass:[NSString class]] || [link length] == 0) {
89
+ return nil;
90
+ }
91
+
92
+ NSURL *url = [NSURL URLWithString:link];
93
+ NSString *scheme = url.scheme.lowercaseString;
94
+
95
+ if (scheme.length == 0 || [scheme isEqualToString:@"http"] || [scheme isEqualToString:@"https"]) {
96
+ return nil;
97
+ }
98
+
99
+ return url;
100
+ }
101
+
81
102
  @interface PushwooshPlugin (InnerPushwooshPlugin)
82
103
 
83
104
  - (void) application:(UIApplication *)application pwplugin_didRegisterWithDeviceToken:(NSData *)deviceToken;
@@ -212,12 +233,12 @@ RCT_EXPORT_METHOD(init:(NSDictionary*)config success:(RCTResponseSenderBlock)suc
212
233
  }
213
234
 
214
235
  if (gStartPushData) {
215
- NSString *link = gStartPushData[@"l"];
216
-
236
+ NSURL *deepLink = pwplugin_deepLinkURLFromPushLink(gStartPushData[@"l"]);
237
+
217
238
  //get deeplink from the payload and write it to the launchOptions for proper RCTLinking behavior
218
- if (link) {
239
+ if (deepLink) {
219
240
  NSMutableDictionary *launchOptions = self.bridge.launchOptions.mutableCopy;
220
- launchOptions[UIApplicationLaunchOptionsURLKey] = [NSURL URLWithString:link];
241
+ launchOptions[UIApplicationLaunchOptionsURLKey] = deepLink;
221
242
  [self.bridge setValue:launchOptions forKey:@"launchOptions"];
222
243
  }
223
244
 
@@ -1001,9 +1022,9 @@ RCT_EXPORT_METHOD(getRichMediaType:(RCTResponseSenderBlock)callback) {
1001
1022
  if (onStart) {
1002
1023
  gStartPushData = pushNotification;
1003
1024
  // Save deep link URL for New Architecture (Linking.getInitialURL support)
1004
- NSString *link = pushNotification[@"l"];
1005
- if (link) {
1006
- gPushDeepLinkURL = [NSURL URLWithString:link];
1025
+ NSURL *deepLink = pwplugin_deepLinkURLFromPushLink(pushNotification[@"l"]);
1026
+ if (deepLink) {
1027
+ gPushDeepLinkURL = deepLink;
1007
1028
  }
1008
1029
  }
1009
1030
  }
@@ -1011,9 +1032,9 @@ RCT_EXPORT_METHOD(getRichMediaType:(RCTResponseSenderBlock)callback) {
1011
1032
  if (onStart) {
1012
1033
  gStartPushData = pushNotification;
1013
1034
  // Save deep link URL for New Architecture (Linking.getInitialURL support)
1014
- NSString *link = pushNotification[@"l"];
1015
- if (link) {
1016
- gPushDeepLinkURL = [NSURL URLWithString:link];
1035
+ NSURL *deepLink = pwplugin_deepLinkURLFromPushLink(pushNotification[@"l"]);
1036
+ if (deepLink) {
1037
+ gPushDeepLinkURL = deepLink;
1017
1038
  }
1018
1039
  }
1019
1040
  }
@@ -1040,9 +1061,9 @@ didReceiveNotificationResponse:(UNNotificationResponse *)response
1040
1061
  // Capture deep link from push notification on cold start
1041
1062
  if ([response.notification.request.trigger isKindOfClass:[UNPushNotificationTrigger class]]) {
1042
1063
  NSDictionary *userInfo = response.notification.request.content.userInfo;
1043
- NSString *link = userInfo[@"l"];
1044
- if (link) {
1045
- gPushDeepLinkURL = [NSURL URLWithString:link];
1064
+ NSURL *deepLink = pwplugin_deepLinkURLFromPushLink(userInfo[@"l"]);
1065
+ if (deepLink) {
1066
+ gPushDeepLinkURL = deepLink;
1046
1067
  }
1047
1068
  }
1048
1069
 
@@ -1101,9 +1122,9 @@ static PWEarlyNotificationDelegate *gEarlyDelegate = nil;
1101
1122
  NSDictionary *launchOptions = notification.userInfo;
1102
1123
  NSDictionary *remoteNotification = launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey];
1103
1124
  if (remoteNotification) {
1104
- NSString *link = remoteNotification[@"l"];
1105
- if (link && !gPushDeepLinkURL) {
1106
- gPushDeepLinkURL = [NSURL URLWithString:link];
1125
+ NSURL *deepLink = pwplugin_deepLinkURLFromPushLink(remoteNotification[@"l"]);
1126
+ if (deepLink && !gPushDeepLinkURL) {
1127
+ gPushDeepLinkURL = deepLink;
1107
1128
  }
1108
1129
  }
1109
1130
  }];
File without changes
File without changes