Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CleverTap Push fixes #569

Merged
merged 2 commits into from
Jul 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions LeanplumSDK/LeanplumSDK/Classes/Internal/Leanplum.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Leanplum
//
// Created by Andrew First on 4/30/12.
// Copyright (c) 2022 Leanplum, Inc. All rights reserved.
// Copyright (c) 2023 Leanplum, Inc. All rights reserved.
//
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
Expand Down Expand Up @@ -1625,7 +1625,8 @@ + (void)setShouldOpenNotificationHandler:(LeanplumShouldHandleNotificationBlock)
+ (void)setCleverTapOpenDeepLinksInForeground:(BOOL)openDeepLinksInForeground
{
LPCTNotificationsManager *manager = (LPCTNotificationsManager *)[Leanplum notificationsManager];
[manager setOpenDeepLinksInForeground:openDeepLinksInForeground];
NSNumber *value = [NSNumber numberWithBool:openDeepLinksInForeground];
[manager setOpenDeepLinksInForeground:value];
}

+ (void)setHandleCleverTapNotification:(_Nullable LeanplumHandleCleverTapNotificationBlock)block
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
// LeanplumSDK
//
// Created by Nikola Zagorchev on 12.10.22.
// Copyright © 2022 Leanplum. All rights reserved.
// Copyright © 2023 Leanplum. All rights reserved.

import Foundation
// Use @_implementationOnly to *not* expose CleverTapSDK to the Leanplum-Swift header
@_implementationOnly import CleverTapSDK

@objc public class LPCTNotificationsManager: NotificationsManager {
@objc public var openDeepLinksInForeground = false
// Using NSNumber since Optional Bool cannot be represented in Objective-C
@objc public var openDeepLinksInForeground: NSNumber?
@objc public var handleCleverTapNotificationBlock: LeanplumHandleCleverTapNotificationBlock?


Expand Down Expand Up @@ -74,7 +75,8 @@ import Foundation
return
}

handleNotification(openDeepLinksInForeground)
// If `openDeepLinksInForeground` is not set explicitly, use `true` for notification Opens.
handleNotification(openDeepLinksInForeground?.boolValue ?? (event == .opened))
}

@objc public func handleWithCleverTapInstance(action: @escaping () -> ()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// LeanplumSDK
//
// Created by Nikola Zagorchev on 23.12.21.
// Copyright © 2021 Leanplum. All rights reserved.
// Copyright © 2023 Leanplum. All rights reserved.

import Foundation

Expand All @@ -13,7 +13,8 @@ extension NotificationsProxy {
if let fromStart = notificationHandledFromStart {
let idA = Leanplum.notificationsManager().getNotificationId(fromStart)
let idB = Leanplum.notificationsManager().getNotificationId(userInfo)
return idA == idB
// CleverTap notifications do not have notification Id
return idA == idB && idA != "-1"
}
return false
}
Expand Down