mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-22 01:15:54 +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.flow.flow
|
||||
import org.matrix.android.sdk.flow.unwrap
|
||||
import timber.log.Timber
|
||||
import java.io.File
|
||||
import java.net.URL
|
||||
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.
|
||||
it.isEnabled = false
|
||||
lifecycleScope.launch {
|
||||
try {
|
||||
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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue