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

CHNL-17243: Handle lifecycle events from JS #270

Merged
merged 11 commits into from
Feb 11, 2025

Conversation

belleklaviyo
Copy link
Contributor

@belleklaviyo belleklaviyo commented Feb 6, 2025

Description

Calls presentIAF() when receiving formWillAppear and created new method dismissIAF() for receiving theformDisappeared case.

Check List

  • Are you changing anything with the public API?
  • Have you tested this change on real device?
  • Are your changes backwards compatible with previous SDK Versions?
  • Have you added unit test coverage for your changes?
  • Have you verified that your changes are compatible with all the operating system version this SDK currently supports?

Manual Test Plan

In this mini demo I added some print statements to see when the different messages were being received. You can also tell the webview is dismissed when the form is dismissed as the rest of the app is interactable again/you can navigate away -- as well as reopen the form, etc.

lifecycle.events.mov

Supporting Materials

@ajaysubra
Copy link
Contributor

I'm seeing the PR for this is merged. Are you able to get the events over the JS bridge?

@ajaysubra
Copy link
Contributor

I'm seeing the PR for this is merged. Are you able to get the events over the JS bridge?

nvm I'm seeing the demo now and it does look like you are indeed receiving those! Nice

@belleklaviyo belleklaviyo marked this pull request as ready for review February 7, 2025 18:40
@belleklaviyo belleklaviyo requested a review from a team as a code owner February 7, 2025 18:40
Copy link
Contributor

@ajaysubra ajaysubra left a comment

Choose a reason for hiding this comment

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

Nice.

Sources/KlaviyoUI/InAppForms/IAFPresentationManager.swift Outdated Show resolved Hide resolved
@belleklaviyo
Copy link
Contributor Author

At this moment, while testing, the SDK is still receiving the outdated formAppeared and not the updated formWillAppear -- so it does not actually successfully decode into the event (unless you change back all instances to formAppeared) but going ahead and keeping this in as I imagine the naming on the sending side will be updated soon

@ajaysubra
Copy link
Contributor

At this moment, while testing, the SDK is still receiving the outdated formAppeared and not the updated formWillAppear -- so it does not actually successfully decode into the event (unless you change back all instances to formAppeared) but going ahead and keeping this in as I imagine the naming on the sending side will be updated soon

@timstephens-k is there a branch with the changed event names that Belle can use to test locally? Is it this?

@belleklaviyo
Copy link
Contributor Author

belleklaviyo commented Feb 11, 2025

found this branch to test on and confirmed it is working with formWillAppear -- also tested with two live forms and only one appeared in app, so double display seems to already be prevented by the time the SDK receives the events EDIT: nvm it is still receiving two popups simultaneously but won't add anything to guard this as this will be handled on the fender side if at all

@belleklaviyo belleklaviyo requested a review from ab1470 February 11, 2025 15:44
Copy link
Contributor

@ab1470 ab1470 left a comment

Choose a reason for hiding this comment

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

Nice!

@belleklaviyo belleklaviyo merged commit d03afdf into master Feb 11, 2025
14 checks passed
@belleklaviyo belleklaviyo deleted the bl/IAF-js-lifecycle-events branch February 11, 2025 19:55
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.

3 participants