@trycourier/courier-react-native 5.5.4 → 5.5.5
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.
|
@@ -15,7 +15,7 @@ import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
|
15
15
|
import com.google.gson.GsonBuilder
|
|
16
16
|
|
|
17
17
|
internal object Utils {
|
|
18
|
-
val COURIER_AGENT = CourierAgent.ReactNativeAndroid(version = "5.5.
|
|
18
|
+
val COURIER_AGENT = CourierAgent.ReactNativeAndroid(version = "5.5.5")
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
internal fun ReactContext.sendEvent(eventName: String, value: Any?) {
|
|
@@ -25,7 +25,7 @@ static NSString *const CourierForegroundOptionsDidChangeNotification = @"iosFore
|
|
|
25
25
|
|
|
26
26
|
if (self) {
|
|
27
27
|
// Set the user agent
|
|
28
|
-
Courier.agent = [CourierAgent reactNativeIOS:@"5.5.
|
|
28
|
+
Courier.agent = [CourierAgent reactNativeIOS:@"5.5.5"];
|
|
29
29
|
|
|
30
30
|
// Register for remote notifications
|
|
31
31
|
UIApplication *app = [UIApplication sharedApplication];
|
|
@@ -46,6 +46,14 @@ static NSString *const CourierForegroundOptionsDidChangeNotification = @"iosFore
|
|
|
46
46
|
return self;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
+
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
|
50
|
+
{
|
|
51
|
+
// Killed-state launch support
|
|
52
|
+
[self handleNotificationLaunchFromKilledState:launchOptions];
|
|
53
|
+
|
|
54
|
+
return YES;
|
|
55
|
+
}
|
|
56
|
+
|
|
49
57
|
- (void)notificationPresentationOptionsUpdate:(NSNotification *)notification
|
|
50
58
|
{
|
|
51
59
|
if ([[notification name] isEqualToString:CourierForegroundOptionsDidChangeNotification])
|
|
@@ -55,6 +63,30 @@ static NSString *const CourierForegroundOptionsDidChangeNotification = @"iosFore
|
|
|
55
63
|
}
|
|
56
64
|
}
|
|
57
65
|
|
|
66
|
+
/// Handles notification taps when the app launches from a killed state.
|
|
67
|
+
/// Call this from AppDelegate's didFinishLaunchingWithOptions using UIApplicationLaunchOptionsRemoteNotificationKey.
|
|
68
|
+
- (void)handleNotificationLaunchFromKilledState:(NSDictionary *)launchOptions
|
|
69
|
+
{
|
|
70
|
+
NSDictionary *userInfo = launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey];
|
|
71
|
+
if (userInfo) {
|
|
72
|
+
// Track event
|
|
73
|
+
[userInfo trackMessageWithEvent:CourierTrackingEventClicked completion:^(NSError * _Nullable error) {
|
|
74
|
+
if (error) {
|
|
75
|
+
NSLog(@"[Courier] Failed to track message click on cold start: %@", error.localizedDescription);
|
|
76
|
+
}
|
|
77
|
+
}];
|
|
78
|
+
|
|
79
|
+
// Create temporary content for formatting
|
|
80
|
+
UNMutableNotificationContent *content = [[UNMutableNotificationContent alloc] init];
|
|
81
|
+
content.userInfo = userInfo;
|
|
82
|
+
|
|
83
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
84
|
+
NSDictionary *formatted = [Courier formatPushNotificationWithContent:content];
|
|
85
|
+
[[NSNotificationCenter defaultCenter] postNotificationName:@"pushNotificationClicked" object:nil userInfo:formatted];
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
58
90
|
- (void)userNotificationCenter:(UNUserNotificationCenter *)center
|
|
59
91
|
willPresentNotification:(UNNotification *)notification
|
|
60
92
|
withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler
|
|
@@ -14,7 +14,7 @@ internal class CourierReactNativeEventEmitter: RCTEventEmitter {
|
|
|
14
14
|
|
|
15
15
|
// Set the user agent
|
|
16
16
|
// Used to know the platform performing requests
|
|
17
|
-
Courier.agent = CourierAgent.reactNativeIOS("5.5.
|
|
17
|
+
Courier.agent = CourierAgent.reactNativeIOS("5.5.5")
|
|
18
18
|
|
|
19
19
|
}
|
|
20
20
|
|