[PLAT-5204] Fix recording of foregroundDuration #839
Merged
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.
Goal
This changes the tracking of
foregroundDuration
to include bothUIApplicationStateActive
andUIApplicationStateInactive
which are both described as "foreground" states in Apple documentation.Previously only
UIApplicationStateActive
was being counted towards this total duration.Design
This simplifies the logic behind duration tracking and makes our APIs more consistent and in line with Apple's documentation.
Changeset
BSG_KSCrash_State
now only observes whether the app is in a foreground or background state. Code related to tracking active vs inactive has been removed.activeDuration...
struct fields have been renamed toforegroundDuration...
for clarityTest cases that only varied the active vs inactive state have been removed.
Testing
Manually verified that the
duration
anddurationInForeground
values increment as expected in payloads sent to the back-end.Unit tests and e2e tests passing.