Login: should fix case after logout...

This commit is contained in:
ganfra 2022-11-22 12:22:52 +01:00
parent 3abedbdc1a
commit 6f9c7463fc
2 changed files with 3 additions and 9 deletions

View file

@ -24,9 +24,7 @@ class LoginViewModel(initialState: LoginViewState) :
suspend { suspend {
val state = awaitState() val state = awaitState()
// Ensure the server is provided to the Rust SDK // Ensure the server is provided to the Rust SDK
if (matrix.getHomeserver() == null) { matrix.setHomeserver(state.homeserver)
matrix.setHomeserver(state.homeserver)
}
matrix.login(state.login.trim(), state.password.trim()) matrix.login(state.login.trim(), state.password.trim())
matrix.activeClient().startSync() matrix.activeClient().startSync()
}.execute { }.execute {

View file

@ -1,6 +1,5 @@
package io.element.android.x.features.login.changeserver package io.element.android.x.features.login.changeserver
import com.airbnb.mvrx.Loading
import com.airbnb.mvrx.MavericksViewModel import com.airbnb.mvrx.MavericksViewModel
import io.element.android.x.matrix.MatrixInstance import io.element.android.x.matrix.MatrixInstance
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
@ -24,13 +23,10 @@ class ChangeServerViewModel(initialState: ChangeServerViewState) :
} }
} }
fun setServerSubmit() = withState { state -> fun setServerSubmit() {
setState {
copy(changeServerAction = Loading())
}
viewModelScope.launch { viewModelScope.launch {
suspend { suspend {
val state = awaitState()
matrix.setHomeserver(state.homeserver) matrix.setHomeserver(state.homeserver)
}.execute { it -> }.execute { it ->
copy(changeServerAction = it) copy(changeServerAction = it)