mirror of
https://github.com/element-hq/element-android
synced 2024-11-27 03:48:12 +03:00
Update the NetworkConstraint handling in WorkManager config
This commit is contained in:
parent
64a7de5326
commit
3aa5f34ee7
1 changed files with 8 additions and 5 deletions
|
@ -26,13 +26,16 @@ internal class DefaultWorkManagerConfig @Inject constructor(
|
||||||
private val homeServerCapabilitiesDataSource: HomeServerCapabilitiesDataSource,
|
private val homeServerCapabilitiesDataSource: HomeServerCapabilitiesDataSource,
|
||||||
) : WorkManagerConfig {
|
) : WorkManagerConfig {
|
||||||
override fun withNetworkConstraint(): Boolean {
|
override fun withNetworkConstraint(): Boolean {
|
||||||
return if (credentials.discoveryInformation?.disableNetworkConstraint == true) {
|
val disableNetworkConstraint = homeServerCapabilitiesDataSource.getHomeServerCapabilities()?.disableNetworkConstraint
|
||||||
|
return if (disableNetworkConstraint != null) {
|
||||||
|
// Boolean `io.element.disable_network_constraint` explicitly set in the .well-known file
|
||||||
|
disableNetworkConstraint.not()
|
||||||
|
}
|
||||||
|
else if (credentials.discoveryInformation?.disableNetworkConstraint == true) {
|
||||||
// Boolean `io.element.disable_network_constraint` explicitly set to `true` in the login response
|
// Boolean `io.element.disable_network_constraint` explicitly set to `true` in the login response
|
||||||
false
|
false
|
||||||
} else if (homeServerCapabilitiesDataSource.getHomeServerCapabilities()?.disableNetworkConstraint == true) {
|
}
|
||||||
// Boolean `io.element.disable_network_constraint` explicitly set to `true` in the .well-known file
|
else {
|
||||||
false
|
|
||||||
} else {
|
|
||||||
// Default, use the Network constraint
|
// Default, use the Network constraint
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue