Skip to content

Commit 331b50b

Browse files
authored
Merge pull request #866 from Iterable/MOB-10104-Fix-launchOptions-wakey-notification-tracking
[MOB-10104] Fix wakey notification tracking event on did finish launch with options
2 parents 86f01d7 + 755b5d5 commit 331b50b

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

swift-sdk/Constants.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ enum Const {
9595
static let location = "Location"
9696
static let setCookie = "Set-Cookie"
9797
}
98+
99+
enum RemoteNotification {
100+
static let aps = "aps"
101+
static let contentAvailable = "content-available"
102+
}
98103
}
99104

100105
enum JsonKey {

swift-sdk/Internal/InternalIterableAPI.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,16 @@ final class InternalIterableAPI: NSObject, PushTrackerProtocol, AuthProvider {
706706
guard let launchOptions = launchOptions else {
707707
return
708708
}
709+
709710
if let remoteNotificationPayload = launchOptions[UIApplication.LaunchOptionsKey.remoteNotification] as? [AnyHashable: Any] {
711+
712+
if let aps = remoteNotificationPayload[Const.RemoteNotification.aps] as? [String: Any],
713+
let contentAvailable = aps[Const.RemoteNotification.contentAvailable] as? Int,
714+
contentAvailable == 1 {
715+
ITBInfo("Received push notification with wakey content-available flag")
716+
return
717+
}
718+
710719
if let _ = IterableUtil.rootViewController {
711720
// we are ready
712721
IterableAppIntegration.implementation?.performDefaultNotificationAction(remoteNotificationPayload)

0 commit comments

Comments
 (0)