Fix bunch of issues around login/logout and introduces messages feature
This commit is contained in:
parent
b5e4ef9637
commit
d04d847521
19 changed files with 314 additions and 89 deletions
|
|
@ -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()
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue