Fix issue of verification banner displayed after logout
This commit is contained in:
parent
a37af307f4
commit
8f78c4a0fb
@ -22,6 +22,6 @@ import org.matrix.android.sdk.api.util.MatrixItem
|
||||
sealed class HomeActivityViewEvents : VectorViewEvents {
|
||||
data class AskPasswordToInitCrossSigning(val userItem: MatrixItem.UserItem?) : HomeActivityViewEvents()
|
||||
data class OnNewSession(val userItem: MatrixItem.UserItem?, val waitForIncomingRequest: Boolean = true) : HomeActivityViewEvents()
|
||||
data class OnCrossSignedInvalidated(val userItem: MatrixItem.UserItem?) : HomeActivityViewEvents()
|
||||
data class OnCrossSignedInvalidated(val userItem: MatrixItem.UserItem) : HomeActivityViewEvents()
|
||||
object PromptToEnableSessionPush : HomeActivityViewEvents()
|
||||
}
|
||||
|
@ -78,29 +78,30 @@ class HomeActivityViewModel @AssistedInject constructor(
|
||||
}
|
||||
|
||||
private fun observeCrossSigningReset() {
|
||||
val safeActiveSession = activeSessionHolder.getSafeActiveSession()
|
||||
val crossSigningService = safeActiveSession
|
||||
?.cryptoService()
|
||||
?.crossSigningService()
|
||||
onceTrusted = crossSigningService
|
||||
?.allPrivateKeysKnown() ?: false
|
||||
val safeActiveSession = activeSessionHolder.getSafeActiveSession() ?: return
|
||||
|
||||
onceTrusted = safeActiveSession
|
||||
.cryptoService()
|
||||
.crossSigningService().allPrivateKeysKnown()
|
||||
|
||||
safeActiveSession
|
||||
?.rx()
|
||||
?.liveCrossSigningInfo(safeActiveSession.myUserId)
|
||||
?.subscribe {
|
||||
.rx()
|
||||
.liveCrossSigningInfo(safeActiveSession.myUserId)
|
||||
.subscribe {
|
||||
val isVerified = it.getOrNull()?.isTrusted() ?: false
|
||||
if (!isVerified && onceTrusted) {
|
||||
// cross signing keys have been reset
|
||||
// Tigger a popup to re-verify
|
||||
_viewEvents.post(
|
||||
HomeActivityViewEvents.OnCrossSignedInvalidated(
|
||||
safeActiveSession.getUser(safeActiveSession.myUserId)?.toMatrixItem()
|
||||
)
|
||||
)
|
||||
// Note: user can be null in case of logout
|
||||
safeActiveSession.getUser(safeActiveSession.myUserId)
|
||||
?.toMatrixItem()
|
||||
?.let { user ->
|
||||
_viewEvents.post(HomeActivityViewEvents.OnCrossSignedInvalidated(user))
|
||||
}
|
||||
}
|
||||
onceTrusted = isVerified
|
||||
}?.disposeOnClear()
|
||||
}
|
||||
.disposeOnClear()
|
||||
}
|
||||
|
||||
private fun observeInitialSync() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user