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 d259eb6634
commit 7a7a5a68b9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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)