Closed yousif-bugsnag closed 2 months ago
NPM build
Package | |
---|---|
Before | 193.47 kB |
After | 193.47 kB |
± | No change |
CDN build
Unminified | Minfied | Minified + gzipped | |
---|---|---|---|
Before | 96.91 kB |
36.36 kB |
10.97 kB |
After | 96.91 kB |
36.36 kB |
10.97 kB |
± | No change | No change | No change |
Ok | File (✨=New File) | Lines | Branches | Functions | Statements |
---|---|---|---|---|---|
🔴 | /home/runner/work/bugsnag-js-performance/bugsnag-js-performance/packages/platforms/react-native/lib/backgrounding-listener.ts | 100% (+0%) |
85.71% (-14.29%) |
100% (+0%) |
100% (+0%) |
Total:
Lines | Branches | Functions | Statements |
---|---|---|---|
86.74%(+0%) | 77.18%(-0.21%) | 87.84%(+0%) | 83.54%(+0%) |
Generated against 4cd5ca7d97fee59ddd07e4fa206e9af3cdc7fa67 on 20 August 2024 at 08:27:13 UTC
Goal
In React Native 0.74+, when an iOS app launches the initial
AppStateStatus
changed fromunknown
toinactive
. This wasn't being accounted for in the backgrounding listener, so the initial background state was incorrectly being set toin-background
.This PR updates the React Native backgrounding listener so that the app is considered in foreground on launch unless the initial app state is
background
.Design
When the backgrounding listener is created the initial app state is now only set to
in-background
if the initial app state status is explicitlybackground
- any other initial state (active
,inactive
, orunknown
) is consideredin-foreground
until an app state change event occurs.Testing
Covered by unit tests and manual testing.
The current structure of the end-to-end test fixture means that we can't test this effectively since the app state status is always 'active' when the scenario runs. This will be addressed in a later PR.