-
Notifications
You must be signed in to change notification settings - Fork 1
/
Braze_SDK-Read-Cached-Remote-Launch-Notification.patch
62 lines (57 loc) · 2.37 KB
/
Braze_SDK-Read-Cached-Remote-Launch-Notification.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
From 0defbf715ab717d4aadb2fbaad06897bad41d636 Mon Sep 17 00:00:00 2001
From: Darryl Davis <darryl@bitwisealchemy.com>
Date: Thu, 17 Sep 2020 17:08:16 -0500
Subject: [PATCH] Read cached remote launch notification on init
---
.../Source/Braze/Private/IOS/BrazeIOS.cpp | 22 ++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/BrazeSample/Plugins/Braze/Source/Braze/Private/IOS/BrazeIOS.cpp b/BrazeSample/Plugins/Braze/Source/Braze/Private/IOS/BrazeIOS.cpp
index 07025e3..18c6ac7 100644
--- a/BrazeSample/Plugins/Braze/Source/Braze/Private/IOS/BrazeIOS.cpp
+++ b/BrazeSample/Plugins/Braze/Source/Braze/Private/IOS/BrazeIOS.cpp
@@ -46,28 +46,40 @@ bool UBrazeIOS::Init(const UBrazeConfig& Config)
// Enable Push Notifications
FCoreDelegates::ApplicationRegisteredForRemoteNotificationsDelegate.AddUObject(this, &UBrazeIOS::ApplicationRegisteredForRemoteNotifications);
+
dispatch_sync(dispatch_get_main_queue(), ^ {
UNAuthorizationOptions options = UNAuthorizationOptionAlert | UNAuthorizationOptionSound | UNAuthorizationOptionBadge;
-
+
if (@available(iOS 12.0,*)) {
options = options | UNAuthorizationOptionProvisional;
}
-
+
UNUserNotificationCenter* Center = [UNUserNotificationCenter currentNotificationCenter];
-
+
if (Config.bEnableIOSPushDelegate)
{
BrazeNotificationDelegate* NotificationDelegate = [BrazeNotificationDelegate SharedInstance];
Center.delegate = NotificationDelegate;
NotificationDelegate.ShowPushNotificationsWhenAppInForeground = Config.bShowPushWhenAppInForeground;
}
-
+
+ if (FAppEntry::gLaunchRemoteNotification != nullptr)
+ {
+ [[Appboy sharedInstance] userNotificationCenter: Center
+ didReceiveNotificationResponse: FAppEntry::gLaunchRemoteNotification
+ withCompletionHandler: FAppEntry::gLaunchRemoteNotificationCompletionHandler];
+
+ [FAppEntry::gLaunchRemoteNotificationCompletionHandler release];
+ FAppEntry::gLaunchRemoteNotification = nullptr;
+ FAppEntry::gLaunchRemoteNotificationCompletionHandler = nullptr;
+ }
+
[Center requestAuthorizationWithOptions: options
completionHandler: ^(BOOL granted, NSError * _Nullable error)
{
[[Appboy sharedInstance] pushAuthorizationFromUserNotificationCenter: granted];
}];
-
+
[[UIApplication sharedApplication] registerForRemoteNotifications];
});
--
2.24.3 (Apple Git-128)