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

[user model] Fix notification click listener not firing on cold start #1567

Merged
merged 3 commits into from
Sep 27, 2023

Conversation

nan-li
Copy link
Contributor

@nan-li nan-li commented Sep 26, 2023

Description

One Line Summary

Fix iOS notifications clicked event not firing when clicking a notification to open the app from a cold start.

Details

Motivation

Fixes iOS bug where notification click listener is set but not firing when clicking the notification from a cold start.

Scope

In the iOS bridge, the setLaunchOptions has been updated to call initialize:nil withLaunchOptions:launchOptions so that the SDK can be initialized in order to get the cold start notification click event. This will result in the iOS SDK reading the appId from cache when nil is passed.

Testing

Manual testing

Tested the following scenarios on an iPhone 13 Pro with iOS 16.6:

  1. Add click listener on app start. Kill app and and click notification to open from cold start. Alert is shown via visual logging.
  2. Click on notification from cold start, app opens, then add the click listener from a button. Click event for previously-clicked notification successfully fires.

Affected code checklist

  • Notifications
    • Display
    • Open
    • Push Processing
    • Confirm Deliveries
  • Outcomes
  • Sessions
  • In-App Messaging
  • REST API requests
  • Public API changes

Checklist

Overview

  • I have filled out all REQUIRED sections above
  • PR does one thing
  • Any Public API changes are explained in the PR details and conform to existing APIs

Testing

  • I have included test coverage for these changes, or explained why they are not needed
  • All automated tests pass, or I explained why that is not possible
  • I have personally tested this on my device, or explained why that is not possible

Final pass

  • Code is as readable as possible.
  • I have reviewed this PR myself, ensuring it meets each checklist item

This change is Reviewable

In order to fire cold start notification click listeners, it was not enough to set the launch options only, we needed to initialize the SDK.
@nan-li nan-li changed the title Fix/notification click listener Fix notification click listener not firing on cold start Sep 26, 2023
@nan-li nan-li changed the title Fix notification click listener not firing on cold start [user model] Fix notification click listener not firing on cold start Sep 26, 2023
@nan-li nan-li changed the base branch from migration_guide_fixes_post_5.0.0_release to major_release_5.0.0 September 27, 2023 21:47
@nan-li nan-li merged commit 145c254 into major_release_5.0.0 Sep 27, 2023
2 checks passed
@nan-li nan-li mentioned this pull request Sep 27, 2023
@nan-li nan-li deleted the fix/notification_click_listener branch March 16, 2024 01:46
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