Fix offline detection and logging #6523
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.
Fixes APP-2495
What changed (plus any additional context for devs)
useIsOnline
hook intouseIsOffline
. Fixes the analytics logging logic that was incorrectly logging offline when the status was not offline and adds optional debouncing interval so that intermittent offline states can be ignored. Also does not log if offline state is detected while app is not in active state.useIsOffline
hook logs an analytic, it should only be used in one place in the app. It was previously used inOfflineToast
andTestnetToast
. For just getting the offline status the network status hook from the netinfo library should be used directly.analyticsv2
with new analytic names.Offline / Lost connect
->network_status.offline
Reconnected after Offline
->network_status.reconnected
@react-native-community/netinfo
, which includes a fix for duplicate internet reachability requests.