Session database: use the new count API.
This commit is contained in:
@@ -349,7 +349,7 @@ class RootFlowNode(
|
||||
} else {
|
||||
// wait for the current session to be restored
|
||||
val loggedInFlowNode = attachSession(latestSessionId)
|
||||
if (sessionStore.getAllSessions().size > 1) {
|
||||
if (sessionStore.numberOfSessions() > 1) {
|
||||
// Several accounts, let the user choose which one to use
|
||||
backstack.push(
|
||||
NavTarget.AccountSelect(
|
||||
@@ -379,7 +379,7 @@ class RootFlowNode(
|
||||
is PermalinkData.FallbackLink -> Unit
|
||||
is PermalinkData.RoomEmailInviteLink -> Unit
|
||||
else -> {
|
||||
if (sessionStore.getAllSessions().size > 1) {
|
||||
if (sessionStore.numberOfSessions() > 1) {
|
||||
// Several accounts, let the user choose which one to use
|
||||
backstack.push(
|
||||
NavTarget.AccountSelect(
|
||||
|
||||
@@ -90,7 +90,7 @@ class OnBoardingPresenter(
|
||||
}
|
||||
val isAddingAccount by produceState(initialValue = false) {
|
||||
// We are adding an account if there is at least one session already stored
|
||||
value = sessionStore.getAllSessions().isNotEmpty()
|
||||
value = sessionStore.numberOfSessions() > 0
|
||||
}
|
||||
|
||||
val loginMode by loginHelper.collectLoginMode()
|
||||
|
||||
@@ -165,7 +165,7 @@ class DefaultBugReporter(
|
||||
}
|
||||
}
|
||||
val sessionData = sessionStore.getLatestSession()
|
||||
val numberOfAccounts = sessionStore.getAllSessions().size
|
||||
val numberOfAccounts = sessionStore.numberOfSessions()
|
||||
val deviceId = sessionData?.deviceId ?: "undefined"
|
||||
val userId = sessionData?.userId?.let { UserId(it) }
|
||||
// build the multi part request
|
||||
|
||||
@@ -58,9 +58,11 @@ class SignedOutPresenterTest {
|
||||
val initialState = awaitItem()
|
||||
assertThat(initialState.signedOutSession).isEqualTo(aSessionData)
|
||||
assertThat(sessionStore.getAllSessions()).isNotEmpty()
|
||||
assertThat(sessionStore.numberOfSessions()).isEqualTo(1)
|
||||
initialState.eventSink(SignedOutEvents.SignInAgain)
|
||||
assertThat(awaitItem().signedOutSession).isNull()
|
||||
assertThat(sessionStore.getAllSessions()).isEmpty()
|
||||
assertThat(sessionStore.numberOfSessions()).isEqualTo(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user