Fix bunch of issues around login/logout and introduces messages feature

This commit is contained in:
ganfra 2022-11-04 14:50:30 +01:00
parent b5e4ef9637
commit d04d847521
19 changed files with 314 additions and 89 deletions

View file

@ -2,11 +2,16 @@ package io.element.android.x
import androidx.lifecycle.ViewModel
import io.element.android.x.matrix.MatrixInstance
import kotlinx.coroutines.flow.first
class MainViewModel : ViewModel() {
private val matrix = MatrixInstance.getInstance()
suspend fun hasSession(): Boolean {
return matrix.restoreSession() != null
suspend fun isLoggedIn(): Boolean {
return matrix.isLoggedIn().first()
}
suspend fun restoreSession() {
matrix.restoreSession()
}
}