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:
parent
d259eb6634
commit
7a7a5a68b9
3 changed files with 7 additions and 12 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -80,6 +80,9 @@ class DefaultSyncPendingNotificationsRequestBuilderTest {
|
|||
sessionId = A_SESSION_ID,
|
||||
sdkVersion = 33,
|
||||
isInAirGapEnvironment = false,
|
||||
featureFlagService = FakeFeatureFlagService(initialState = mapOf(
|
||||
FeatureFlags.ValidateNetworkWhenSchedulingNotificationFetching.key to true
|
||||
)),
|
||||
)
|
||||
|
||||
val results = request.build()
|
||||
|
|
@ -100,6 +103,9 @@ class DefaultSyncPendingNotificationsRequestBuilderTest {
|
|||
sessionId = A_SESSION_ID,
|
||||
sdkVersion = 33,
|
||||
isInAirGapEnvironment = true,
|
||||
featureFlagService = FakeFeatureFlagService(initialState = mapOf(
|
||||
FeatureFlags.ValidateNetworkWhenSchedulingNotificationFetching.key to true
|
||||
)),
|
||||
)
|
||||
|
||||
val results = request.build()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue