-
Notifications
You must be signed in to change notification settings - Fork 187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Last session recovery #2421
Last session recovery #2421
Conversation
📱 Scan the QR code below to install the build (arm64 only) for this PR. |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## develop #2421 +/- ##
==========================================
Coverage ? 72.44%
==========================================
Files ? 1357
Lines ? 32261
Branches ? 6259
==========================================
Hits ? 23373
Misses ? 5658
Partials ? 3230 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not a new issue but the word Enter...
on this screenshot looks off
2cfa5a5
to
0642820
Compare
Also get the sessionVerificationService from the matrixClient, instead of injecting it separately.
…ecovery key banner.
…ner which ask the user to do so.
…nd so the listeners are stopped.
…lue change. The session can become verified when the user enters their recovery key, and in this case the callback `didFinish` is not invoked.
db09349
to
d3d76dd
Compare
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 remarks, otherwise LGTM
@Composable | ||
override fun View(modifier: Modifier) { | ||
val state = presenter.present() | ||
VerifySelfSessionView( | ||
state = state, | ||
modifier = modifier, | ||
onEnterRecoveryKey = { onEnterRecoveryKey() }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use method reference here?
fun start() { | ||
service.backupStateListener(object : BackupStateListener { | ||
backupStateListenerTaskHandle = service.backupStateListener(object : BackupStateListener { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use mxCallbackFlow
instead, so we can remove this start
function. Maybe create extension methods on Encryption
so you can reuse them.
private val backupStateFlow = mxCallbackFlow {
val listener = object : BackupStateListener {
override fun onUpdate(status: RustBackupState) {
trySend(backupStateMapper.map(status))
}
}
service.backupStateListener(listener)
}.stateIn(sessionCoroutineScope, SharingStarted.Eagerly, service.backupState().let(backupStateMapper::map))
private val recoveryStateFlow = mxCallbackFlow {
val listener = object : RecoveryStateListener {
override fun onUpdate(status: org.matrix.rustcomponents.sdk.RecoveryState) {
trySend(recoveryStateMapper.map(status))
}
}
service.recoveryStateListener(listener)
}.stateIn(sessionCoroutineScope, SharingStarted.Eagerly, service.recoveryState().let(recoveryStateMapper::map))
@ganfra thanks for your review. I'll handle your remarks in a dedicated PR. I also want to add some Maestro test which will enter recovery key. |
Type of change
Content
Add a way to let the user enter a recovery key when there is no other sessions available.
Also update the UI flow, when clicking on the verification banner : either directly open the verification screens (instead of opening the settings), or directly open the "enter recovery key" screen (instead of opening the verification screens, which is non-sense since there are no other sessions).
isLastDevice
is now aStateFlow
, to help having more dynamic UI.FeatureFlags.SecureStorage
is removed.Motivation and context
Closes #2400
Screenshots / GIFs
Tests
When verifying a session, it's also possible to choose to enter a recovery key instead.
See the recorded screenshot for more details.
Tested devices
Checklist