pushwoosh-react-native-plugin 7.0.2 → 7.0.4
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
|
Pod::Spec.new do |s|
|
|
2
2
|
s.name = "pushwoosh-react-native-plugin"
|
|
3
|
-
s.version = "7.0.
|
|
3
|
+
s.version = "7.0.4"
|
|
4
4
|
s.summary = "React Native Pushwoosh Push Notifications module"
|
|
5
5
|
s.requires_arc = true
|
|
6
6
|
s.author = 'Pushwoosh'
|
|
@@ -19,6 +19,6 @@ Pod::Spec.new do |s|
|
|
|
19
19
|
s.dependency "React-Core"
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
-
s.dependency 'PushwooshXCFramework', '7.2.
|
|
22
|
+
s.dependency 'PushwooshXCFramework', '7.2.8'
|
|
23
23
|
s.dependency 'PushwooshInboxUIXCFramework', '7.0.42'
|
|
24
24
|
end
|
package/src/android/build.gradle
CHANGED
|
@@ -3,18 +3,11 @@ package com.pushwoosh.reactnativeplugin.internal;
|
|
|
3
3
|
import com.pushwoosh.internal.PluginProvider;
|
|
4
4
|
|
|
5
5
|
public class ReactNativePluginProvider implements PluginProvider {
|
|
6
|
-
private static final String PLUGIN_VERSION = "7.0.2";
|
|
7
|
-
|
|
8
6
|
@Override
|
|
9
7
|
public String getPluginType() {
|
|
10
8
|
return "React Native";
|
|
11
9
|
}
|
|
12
10
|
|
|
13
|
-
// No @Override: getPluginVersion() lands in PluginProvider only in the next Android SDK release.
|
|
14
|
-
public String getPluginVersion() {
|
|
15
|
-
return PLUGIN_VERSION;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
11
|
@Override
|
|
19
12
|
public int richMediaStartDelay() {
|
|
20
13
|
return DEFAULT_RICH_MEDIA_START_DELAY;
|
|
@@ -75,14 +75,12 @@ static NSString * gEarlyHandledHash = nil; // Last push hash the cold-start del
|
|
|
75
75
|
static NSString * gPendingWebLaunchLink = nil; // http(s) link of the launch push, until the SDK hands it to RCTLinkingManager
|
|
76
76
|
static NSUInteger gPendingWebLaunchLinkGeneration = 0; // Bumped on every arm, so a stale delivery timeout leaves a newer link alone
|
|
77
77
|
static NSString * gLastArmedWebLaunchLink = nil; // Survives delivery, so re-arming the same push is recognised
|
|
78
|
+
static NSTimeInterval gWebLaunchLinkDeadline = 0; // System uptime at which the window gLastArmedWebLaunchLink first opened ends
|
|
78
79
|
static BOOL gInitialURLAnswered = NO; // JS called getInitialURL() since gLastArmedWebLaunchLink was first armed
|
|
79
80
|
static BOOL gPluginInitialized = NO; // init: ran, so JS is up and a tapped push is no longer a launch push
|
|
80
81
|
static NSMutableArray<void (^)(NSString *)> * gInitialURLWaiters = nil; // getInitialURL() calls held for the pending link
|
|
81
|
-
static NSUInteger gInitialURLHoldGeneration = 0; // Bumped on every settle, so a stale hold timeout leaves a newer hold alone
|
|
82
82
|
// The SDK waits 0.2 s after accepting the push, then fetches apple-app-site-association with a 5 s timeout.
|
|
83
83
|
static NSTimeInterval const kPWWebLaunchLinkDeliveryTimeout = 6.0;
|
|
84
|
-
// Covers the SDK's delay and a cached or quick verdict without stalling an app whose link never reaches RN.
|
|
85
|
-
static NSTimeInterval const kPWInitialURLHoldTimeout = 1.0;
|
|
86
84
|
static NSString * const kRegistrationSuccesEvent = @"PWRegistrationSuccess";
|
|
87
85
|
static NSString * const kRegistrationErrorEvent = @"PWRegistrationError";
|
|
88
86
|
static NSString * const kPushReceivedEvent = @"PWPushReceived";
|
|
@@ -91,25 +89,6 @@ static NSString * const kPushOpenEvent = @"PWPushOpen";
|
|
|
91
89
|
static NSString * const kPushOpenJSEvent = @"pushOpened";
|
|
92
90
|
static NSString * const kPushReceivedJSEvent = @"pushReceived";
|
|
93
91
|
|
|
94
|
-
static NSString * const kPWFrameworkType = @"React Native";
|
|
95
|
-
static NSString * const kPWFrameworkVersion = @"7.0.2";
|
|
96
|
-
|
|
97
|
-
/// Reports the framework type and the plugin version to the native core, on the cores that take them.
|
|
98
|
-
/// Dispatched by selector name: setFrameworkType:version: lands in a core newer than the pinned one.
|
|
99
|
-
static void pwplugin_setFrameworkTelemetry(NSString *type, NSString *version) {
|
|
100
|
-
Class configuration = [Pushwoosh configure];
|
|
101
|
-
SEL selector = NSSelectorFromString(@"setFrameworkType:version:");
|
|
102
|
-
|
|
103
|
-
if (![configuration respondsToSelector:selector]) {
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
#pragma clang diagnostic push
|
|
108
|
-
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
|
|
109
|
-
[configuration performSelector:selector withObject:type withObject:version];
|
|
110
|
-
#pragma clang diagnostic pop
|
|
111
|
-
}
|
|
112
|
-
|
|
113
92
|
/// Returns the push link only when it is a deep link this app can route itself, otherwise nil.
|
|
114
93
|
///
|
|
115
94
|
/// http/https links are left to the native SDK: it checks the host's apple-app-site-association
|
|
@@ -151,7 +130,6 @@ static NSString * pwplugin_webLinkFromPushLink(id link) {
|
|
|
151
130
|
static void pwplugin_settleInitialURLWaiters(NSString *url) {
|
|
152
131
|
NSArray<void (^)(NSString *)> *waiters = gInitialURLWaiters;
|
|
153
132
|
gInitialURLWaiters = nil;
|
|
154
|
-
gInitialURLHoldGeneration++;
|
|
155
133
|
gInitialURLAnswered = YES;
|
|
156
134
|
for (void (^waiter)(NSString *) in waiters) {
|
|
157
135
|
waiter(url);
|
|
@@ -162,12 +140,21 @@ static void pwplugin_settleInitialURLWaiters(NSString *url) {
|
|
|
162
140
|
/// A push without a web link disarms it, so a later Safari open of the same URL is not caught.
|
|
163
141
|
static void pwplugin_rememberWebLaunchLink(NSDictionary *push) {
|
|
164
142
|
NSString *link = pwplugin_webLinkFromPushLink(push[@"l"]);
|
|
143
|
+
NSTimeInterval now = [NSProcessInfo processInfo].systemUptime;
|
|
144
|
+
|
|
165
145
|
// The SDK accepts the same launch push at init() again, possibly after JS read getInitialURL().
|
|
166
|
-
|
|
167
|
-
|
|
146
|
+
// The window stays the one the tap opened: neither extended nor opened again once it ended.
|
|
147
|
+
if (link && [link isEqualToString:gLastArmedWebLaunchLink]) {
|
|
148
|
+
if (now < gWebLaunchLinkDeadline) {
|
|
149
|
+
gPendingWebLaunchLink = link;
|
|
150
|
+
}
|
|
151
|
+
return;
|
|
168
152
|
}
|
|
153
|
+
|
|
154
|
+
gInitialURLAnswered = NO;
|
|
169
155
|
gLastArmedWebLaunchLink = link;
|
|
170
156
|
gPendingWebLaunchLink = link;
|
|
157
|
+
gWebLaunchLinkDeadline = now + kPWWebLaunchLinkDeliveryTimeout;
|
|
171
158
|
NSUInteger generation = ++gPendingWebLaunchLinkGeneration;
|
|
172
159
|
|
|
173
160
|
if (!link) {
|
|
@@ -248,15 +235,11 @@ static void pwplugin_getInitialURL(id self, SEL _cmd, RCTPromiseResolveBlock res
|
|
|
248
235
|
return;
|
|
249
236
|
}
|
|
250
237
|
|
|
238
|
+
// Held until the link arrives or its delivery window ends: the SDK may still be checking the
|
|
239
|
+
// host's apple-app-site-association, which takes seconds on a network round trip.
|
|
251
240
|
if (gPendingWebLaunchLink && !gInitialURLAnswered) {
|
|
252
241
|
if (!gInitialURLWaiters) {
|
|
253
242
|
gInitialURLWaiters = [NSMutableArray array];
|
|
254
|
-
NSUInteger hold = gInitialURLHoldGeneration;
|
|
255
|
-
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(kPWInitialURLHoldTimeout * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
256
|
-
if (hold == gInitialURLHoldGeneration) {
|
|
257
|
-
pwplugin_settleInitialURLWaiters(nil);
|
|
258
|
-
}
|
|
259
|
-
});
|
|
260
243
|
}
|
|
261
244
|
[gInitialURLWaiters addObject:[^(NSString *url) {
|
|
262
245
|
if (url) {
|
|
@@ -339,7 +322,6 @@ RCT_EXPORT_METHOD(init:(NSDictionary*)config success:(RCTResponseSenderBlock)suc
|
|
|
339
322
|
|
|
340
323
|
gPluginInitialized = YES;
|
|
341
324
|
[PushNotificationManager initializeWithAppCode:appCode appName:nil];
|
|
342
|
-
pwplugin_setFrameworkTelemetry(kPWFrameworkType, kPWFrameworkVersion);
|
|
343
325
|
[[PushNotificationManager pushManager] sendAppOpen];
|
|
344
326
|
[PushNotificationManager pushManager].delegate = self;
|
|
345
327
|
|