Fix isInAirGappedEnvironment check for older APIs (#6573)

* Fix `isInAirGappedEnvironment` check for older APIs: use `networkCapabilities.hasCapability` instead of `networkCapabilities.capabilities.contains`, which only works on Android 12 and newer versions

* Check for air-gapped env in the FOSS app too: this unifies the notification behaviour on EXA and Element Pro
This commit is contained in:
Jorge Martin Espinosa 2026-04-14 15:52:41 +02:00 committed by GitHub
parent 7a9260905e
commit 8b0f3b92da
3 changed files with 7 additions and 12 deletions

View file

@ -76,7 +76,6 @@ class DefaultSyncPendingNotificationsRequestBuilder(
.removeCapability(NetworkCapabilities.NET_CAPABILITY_NOT_VPN)
// If we're in an air-gapped environment, we shouldn't validate internet connectivity, as the checker will fail and the worker won't run at all.
// Note this will always be false for FOSS, since the feature is only enabled in Element Pro.
if (networkMonitor.isInAirGappedEnvironment.first()) {
Timber.d("In an air-gapped environment, not adding NET_CAPABILITY_VALIDATED to the network request")
networkRequestBuilder.removeCapability(NetworkCapabilities.NET_CAPABILITY_VALIDATED)