feat: lifecycle event emitter [rn] (2/4)#35
Open
choudlet wants to merge 2 commits into
Open
Conversation
Adds the `LifecycleEmitter` class — a thin wrapper that maps the four
lifecycle events to the standard `track()` shape with snake_case
properties matching the iOS / Android wire format exactly:
- Application Installed {version, build}
- Application Updated {version, build, previous_version, previous_build}
- Application Opened {from_background, version, build, url?, referring_application?}
- Application Backgrounded {}
The emitter holds the `enabled` flag (mirrors `trackLifecycleEvents`)
so every emit is a no-op when the feature is disabled — callers do not
need to gate at every call site.
Property names use snake_case while event names use Title Case to match
the cross-platform SDK contract; the `UNKNOWN_PREVIOUS` sentinel is
used for the SDK-upgrade case (existing user, no prior lifecycle
storage) where the previous version is genuinely unknown rather than
the literal string the host shipped.
Slice 2 of 4 in the RN lifecycle stack (sc-36800).
This was referenced Apr 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
LifecycleEmitterclass — thin wrapper mapping the four lifecycle events to the standardtrack()shape with the cross-platform wire format.Wire format (parity with iOS / Android)
Application Installedversion,buildApplication Updatedversion,build,previous_version,previous_buildApplication Openedfrom_background,version,build, optionalurl, optionalreferring_applicationApplication BackgroundedTitle Case event names, snake_case property names — matches the iOS
LifecycleEventEmitterand Android equivalent exactly so cross-platform pipelines see one shape.Notes
enabledflag (mirrorstrackLifecycleEvents) so every emit is a no-op when the feature is off — slice 3 callers don't have to gate at every call site.UNKNOWN_PREVIOUS = "unknown"sentinel is used for the SDK-upgrade case (existing user, no prior lifecycle storage), distinguishing it from the literal string a host might ship.MetaRouterAnalyticsClient.Stack
Test plan