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 {
|
sealed class HomeActivityViewEvents : VectorViewEvents {
|
||||||
data class AskPasswordToInitCrossSigning(val userItem: MatrixItem.UserItem?) : HomeActivityViewEvents()
|
data class AskPasswordToInitCrossSigning(val userItem: MatrixItem.UserItem?) : HomeActivityViewEvents()
|
||||||
data class OnNewSession(val userItem: MatrixItem.UserItem?, val waitForIncomingRequest: Boolean = true) : 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()
|
object PromptToEnableSessionPush : HomeActivityViewEvents()
|
||||||
}
|
}
|
||||||
|
@ -78,29 +78,30 @@ class HomeActivityViewModel @AssistedInject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun observeCrossSigningReset() {
|
private fun observeCrossSigningReset() {
|
||||||
val safeActiveSession = activeSessionHolder.getSafeActiveSession()
|
val safeActiveSession = activeSessionHolder.getSafeActiveSession() ?: return
|
||||||
val crossSigningService = safeActiveSession
|
|
||||||
?.cryptoService()
|
onceTrusted = safeActiveSession
|
||||||
?.crossSigningService()
|
.cryptoService()
|
||||||
onceTrusted = crossSigningService
|
.crossSigningService().allPrivateKeysKnown()
|
||||||
?.allPrivateKeysKnown() ?: false
|
|
||||||
|
|
||||||
safeActiveSession
|
safeActiveSession
|
||||||
?.rx()
|
.rx()
|
||||||
?.liveCrossSigningInfo(safeActiveSession.myUserId)
|
.liveCrossSigningInfo(safeActiveSession.myUserId)
|
||||||
?.subscribe {
|
.subscribe {
|
||||||
val isVerified = it.getOrNull()?.isTrusted() ?: false
|
val isVerified = it.getOrNull()?.isTrusted() ?: false
|
||||||
if (!isVerified && onceTrusted) {
|
if (!isVerified && onceTrusted) {
|
||||||
// cross signing keys have been reset
|
// cross signing keys have been reset
|
||||||
// Tigger a popup to re-verify
|
// Tigger a popup to re-verify
|
||||||
_viewEvents.post(
|
// Note: user can be null in case of logout
|
||||||
HomeActivityViewEvents.OnCrossSignedInvalidated(
|
safeActiveSession.getUser(safeActiveSession.myUserId)
|
||||||
safeActiveSession.getUser(safeActiveSession.myUserId)?.toMatrixItem()
|
?.toMatrixItem()
|
||||||
)
|
?.let { user ->
|
||||||
)
|
_viewEvents.post(HomeActivityViewEvents.OnCrossSignedInvalidated(user))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
onceTrusted = isVerified
|
onceTrusted = isVerified
|
||||||
}?.disposeOnClear()
|
}
|
||||||
|
.disposeOnClear()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun observeInitialSync() {
|
private fun observeInitialSync() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user