notify subscriptions after refresh #630
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.
Overview
Related to #591 #557
I've experienced problems with useNetInfo and location permissions. I'm using Android 11 and my app only has location permissions when the app is in foreground.
If the network changes while the app is in background bssid and ssid values are not being reported (or obfuscated). When the app comes back to foreground, no events are being triggered.
To handle that case, I've triggered
NetInfo.refresh()
when the appState becomes active again. However, this doesn't update the useNetInfo state. To force the update, I've added the event dispatch after updating _lastState.Test Plan
Run on a phone with Android 11 (10 I think is the same thing).
Add this code to see updates to netInfo.
Go to settings and change to another wifi network and wait around 10 seconds.
Net info ssid is updated with null
Go back to the app: No changes are triggered.
Add:
With this code and my changes after coming back to the app, the ssid and bssid are updated.
Details
"@react-native-community/netinfo@": "9.3.2"
react-native: 0.67.3
SO Android 11.