fix: only fire APP_OPENED on background → active transition#27463
fix: only fire APP_OPENED on background → active transition#27463vinnyhoward wants to merge 10 commits intomainfrom
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
…mcu-256-inaccurate-app-opens-qr-scanner
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #27463 +/- ##
========================================
Coverage 82.63% 82.64%
========================================
Files 4854 4859 +5
Lines 125092 125393 +301
Branches 27919 28069 +150
========================================
+ Hits 103376 103637 +261
+ Misses 14600 14594 -6
- Partials 7116 7162 +46 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
✅ E2E Fixture Validation — Schema is up to date |
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
Why no E2E tags are needed:
Risk assessment: Low - well-tested unit-level fix that corrects analytics event firing logic without changing any user-visible behavior or E2E-testable flows. Performance Test Selection: |
|




Description
When the QR scanner on iPhone prompts the user to grant camera access, iOS transitions the app to inactive (not background). If the user taps "Cancel" on the permission dialog, the app returns to active, which was incorrectly triggering the
App Openedanalytics event.The fix tightens the condition in
AppStateEventListenerto only fireAPP_OPENEDwhen transitioning from background → active, which represents the user genuinely re-opening the app. Transitions from inactive → active (system dialogs, incoming calls, etc.) are now correctly ignored.Changelog
CHANGELOG entry:null
Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/TMCU-256
Manual testing steps
Screenshots/Recordings
Screen.Recording.2026-03-30.at.11.08.20.AM.mov
Before
Observe that the app opened event fires after pressing cancel
Screen.Recording.2026-03-30.at.11.08.20.AM.mov
After
Observe that the app opened event does not fire after pressing cancel
Screen.Recording.2026-03-30.at.11.22.19.AM.mov
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Low Risk
Low risk: narrows when the
APP_OPENEDanalytics event is emitted and adds targeted tests, with no changes to auth, funds, or persistence logic.Overview
Prevents false-positive
APP_OPENEDanalytics by only triggering the event when the app transitions frombackgroundtoactive, ignoringinactive → activetransitions (e.g., iOS permission dialogs/calls).Updates app-state tracking to preserve
backgroundacross the iOS intermediateinactivestate so the subsequentactivetransition still counts as an app open. Tests are adjusted to include explicitbackgroundsetup and new cases coveringbackground → inactive → active, repeatedactive, andinactive → activenot firing.Written by Cursor Bugbot for commit 302c59c. This will update automatically on new commits. Configure here.