mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-25 10:55:55 +03:00
Fix crash in the setting when enabling/disabling integration manager and there is no network.
This commit is contained in:
parent
8433e222ad
commit
ae52d4cd3c
1 changed files with 12 additions and 1 deletions
|
@ -71,6 +71,7 @@ import org.matrix.android.sdk.api.session.integrationmanager.IntegrationManagerC
|
||||||
import org.matrix.android.sdk.api.session.integrationmanager.IntegrationManagerService
|
import org.matrix.android.sdk.api.session.integrationmanager.IntegrationManagerService
|
||||||
import org.matrix.android.sdk.flow.flow
|
import org.matrix.android.sdk.flow.flow
|
||||||
import org.matrix.android.sdk.flow.unwrap
|
import org.matrix.android.sdk.flow.unwrap
|
||||||
|
import timber.log.Timber
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.net.URL
|
import java.net.URL
|
||||||
import java.util.UUID
|
import java.util.UUID
|
||||||
|
@ -265,7 +266,17 @@ class VectorSettingsGeneralFragment :
|
||||||
// Disable it while updating the state, will be re-enabled by the account data listener.
|
// Disable it while updating the state, will be re-enabled by the account data listener.
|
||||||
it.isEnabled = false
|
it.isEnabled = false
|
||||||
lifecycleScope.launch {
|
lifecycleScope.launch {
|
||||||
|
try {
|
||||||
session.integrationManagerService().setIntegrationEnabled(newValue as Boolean)
|
session.integrationManagerService().setIntegrationEnabled(newValue as Boolean)
|
||||||
|
} catch (failure: Throwable) {
|
||||||
|
Timber.e(failure, "Failed to update integration manager state")
|
||||||
|
activity?.let { activity ->
|
||||||
|
Toast.makeText(activity, errorFormatter.toHumanReadable(failure), Toast.LENGTH_SHORT).show()
|
||||||
|
}
|
||||||
|
// Restore the previous state
|
||||||
|
it.isChecked = !it.isChecked
|
||||||
|
it.isEnabled = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue