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

[MC-1886] Do not handle push on launch if Leanplum library #371

Merged
merged 1 commit into from
Sep 5, 2024

Conversation

nzagorchev
Copy link
Contributor

@nzagorchev nzagorchev commented Aug 30, 2024

JIRA MC-1886

Overview

CleverTap push notification open action is handled twice when using Leanplum SDK. The notification is handled by the application:didFinishLaunchingWithOptions: in CleverTap and also handled from UNUserNotificationCenterDelegate didReceive method.
If the notification is not handled by Leanplum, there are cases where it is not handled at all. This happens when the application already became active and CleverTap does not handle the deeplink since app is in foreground. The method _appEnteredForegroundWithLaunchingOptions calls _handlePushNotification with the launch options which passes openDeepLinksInForeground:NO.

Implementation

Check if the library is Leanplum. Do not handle the notification in this case, and log a message.

Testing

Manual QA

Copy link
Contributor

@nishant-clevertap nishant-clevertap left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes LGTM.

We can put found push notification at launch logs in else block if we don't want two consecutive logs printed for if condition.
Also verify the hybrid wrapper SDKs once if this is working fine.

@nzagorchev
Copy link
Contributor Author

@nishant-clevertap
I have tested on Leanplum React-Native and Unity. On both, the onDidFinishLaunchingNotification is called before the CleverTap instance is created so CleverTap will not handle the notification. The notification is only handled once even without the fix in this PR.
Leanplum overrides the library on react-native (it is set to "React-Native" from the CleverTap ReactNative SDK). On Unity, the CleverTap Unity SDK sets it to "Unity" but when the notification is handled, it is "Leanplum".

@nzagorchev nzagorchev merged commit 8c5a95b into develop Sep 5, 2024
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants