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

Triggering lifecycle events with CLI and browser extension does not match casing #145

Open
mkatenolan opened this issue Oct 23, 2023 · 1 comment

Comments

@mkatenolan
Copy link

I have been trying to use the CLI and browser extension to trigger lifecycle events in an app with listeners set up using Lifecycle.listen as described in SDK docs.

I was making use of the example events in the CLI folder and kept getting the NO-EVENT-HANDLER-REGISTERED error code even though the server was registering listeners with messages like:
Registered event listener mapping: 12345:lifecycle.onbackground

If I change the example event method (eg. here) from camelcase to lowercase, the event get triggered correctly. Eg.

{
  "method": "lifecycle.onForeground", // Does NOT trigger event
  "result": {
    "state": "foreground",
    "previous": "background"
  }
}
{
  "method": "lifecycle.onforeground", // Correctly triggers event
  "result": {
    "state": "foreground",
    "previous": "background"
  }
}

Similarly in the browser extension: eg.

async function sendFireboltLifecycleEvent_Inactive(cb) {
  return await _sendFireboltLifecycleEvent('lifecycle.onInactive', { state: 'inactive' }, cb); // Does NOT trigger event
}
async function sendFireboltLifecycleEvent_Inactive(cb) {
  return await _sendFireboltLifecycleEvent('lifecycle.oninactive', { state: 'inactive' }, cb); // Correctly triggers event
}

It seems that either the examples are incorrect or the server is not parsing the events correctly. It would be ideal if we could use the examples out the box rather than having to update them.

@kschrief
Copy link
Contributor

kschrief commented Nov 2, 2023

Hi Martha.

I did an investigation. The bug is valid and the PR properly addresses the issue. Thanks for bringing this up! I'm going to approve the PR but we won't be able to merge it in unless you sign the Contributor Agreement. Once that's done everything else should be good to go.

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

No branches or pull requests

2 participants