mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 12:07:28 +00:00
Add network constraints for fetching notifications with WorkManager (#6305)
* Add `isNetworkBlocked` and `isInAirGappedEnvironment` to `NetworkMonitor`. * Improve the DI of `SyncPendingNotificationsRequestBuilder` to simplify its usage. * Only update `isInAirGappedEnvironment` in `DefaultNetworkManager` if the current build is an enterprise one. * Add network constraints to `DefaultSyncPendingNotificationsRequestBuilder` based on the air-gapped status. * Add a feature flag to disable the new check, in case it doesn't work as expected.
This commit is contained in:
committed by
GitHub
parent
1e85c02a59
commit
912b9168fd
+10
-2
@@ -14,8 +14,16 @@ import kotlinx.coroutines.flow.MutableStateFlow
|
||||
|
||||
class FakeNetworkMonitor(
|
||||
initialStatus: NetworkStatus = NetworkStatus.Connected,
|
||||
private val isNetworkBlockedLambda: () -> Boolean = { false },
|
||||
) : NetworkMonitor {
|
||||
override val connectivity = MutableStateFlow(initialStatus)
|
||||
override fun isNetworkBlocked(): Boolean = isNetworkBlockedLambda()
|
||||
override val isNetworkBlocked = MutableStateFlow(false)
|
||||
override val isInAirGappedEnvironment = MutableStateFlow(false)
|
||||
|
||||
fun givenNetworkBlocked(isBlocked: Boolean) {
|
||||
isNetworkBlocked.value = isBlocked
|
||||
}
|
||||
|
||||
fun givenIsInAirGappedEnvironment(isInAirGapped: Boolean) {
|
||||
isInAirGappedEnvironment.value = isInAirGapped
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user