Skip to content
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

Improve session recovery screens #2657

Merged
merged 12 commits into from
Apr 9, 2024

Conversation

jmartinesp
Copy link
Contributor

@jmartinesp jmartinesp commented Apr 4, 2024

Type of change

  • Feature
  • Bugfix
  • Technical
  • Other :

Content

  • Update the UI and texts for the 'enter recovery key' screen.
  • Add new 'create new recovery key' info screen that can be displayed when there are no other active sessions for the current account.

Motivation and context

Closes #2579, also takes care of https://github.com/element-hq/element-internal/issues/583.

Screenshots / GIFs

In the PR.

Tests

  • Log into an account with no other active sessions, or modify VerifySelfSessionPresenter so isLastDevice is true.
  • Check the 'create new recovery key' button appears after logging in.
  • Verify the new 'create new recovery key' screen is displayed properly.

Tested devices

  • Physical
  • Emulator
  • OS version(s): 14

Checklist

@jmartinesp jmartinesp requested a review from a team as a code owner April 4, 2024 11:56
@jmartinesp jmartinesp requested review from bmarty and removed request for a team April 4, 2024 11:56
@ElementBot
Copy link
Collaborator

ElementBot commented Apr 4, 2024

Warnings
⚠️

features/roomdetails/impl/src/main/res/values-cs/translations.xml#L67 - For locale "cs" (Czech) the following quantity should also be defined: many (e.g. "10.0 dne")

⚠️

features/roomdetails/impl/src/main/res/values-sk/translations.xml#L67 - For locale "sk" (Slovak) the following quantity should also be defined: many (e.g. "10.0 dňa")

⚠️

libraries/ui-strings/src/main/res/values-cs/translations.xml#L4 - For locale "cs" (Czech) the following quantity should also be defined: many (e.g. "10.0 dne")

⚠️

libraries/ui-strings/src/main/res/values-cs/translations.xml#L22 - For locale "cs" (Czech) the following quantity should also be defined: many (e.g. "10.0 dne")

⚠️

libraries/ui-strings/src/main/res/values-cs/translations.xml#L152 - For locale "cs" (Czech) the following quantity should also be defined: many (e.g. "10.0 dne")

⚠️

libraries/ui-strings/src/main/res/values-cs/translations.xml#L174 - For locale "cs" (Czech) the following quantity should also be defined: many (e.g. "10.0 dne")

⚠️

libraries/ui-strings/src/main/res/values-sk/translations.xml#L4 - For locale "sk" (Slovak) the following quantity should also be defined: many (e.g. "10.0 dňa")

⚠️

libraries/ui-strings/src/main/res/values-sk/translations.xml#L22 - For locale "sk" (Slovak) the following quantity should also be defined: many (e.g. "10.0 dňa")

⚠️

libraries/ui-strings/src/main/res/values-sk/translations.xml#L151 - For locale "sk" (Slovak) the following quantity should also be defined: many (e.g. "10.0 dňa")

⚠️

libraries/ui-strings/src/main/res/values-sk/translations.xml#L173 - For locale "sk" (Slovak) the following quantity should also be defined: many (e.g. "10.0 dňa")

Generated by 🚫 dangerJS against 3c90bb4

Copy link
Contributor

github-actions bot commented Apr 4, 2024

📱 Scan the QR code below to install the build (arm64 only) for this PR.
QR code
If you can't scan the QR code you can install the build via this link: https://i.diawi.com/PRMVRE

Copy link

codecov bot commented Apr 4, 2024

Codecov Report

Attention: Patch coverage is 76.76768% with 23 lines in your changes are missing coverage. Please review.

Project coverage is 73.58%. Comparing base (ecd2974) to head (3c90bb4).
Report is 1 commits behind head on develop.

Files Patch % Lines
...aries/designsystem/modifiers/SquareSizeModifier.kt 62.50% 8 Missing and 4 partials ⚠️
...ebackup/impl/createkey/CreateNewRecoveryKeyView.kt 76.92% 1 Missing and 8 partials ⚠️
...eatures/securebackup/api/SecureBackupEntryPoint.kt 0.00% 1 Missing ⚠️
...kup/impl/enter/SecureBackupEnterRecoveryKeyView.kt 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2657      +/-   ##
===========================================
- Coverage    73.58%   73.58%   -0.01%     
===========================================
  Files         1458     1460       +2     
  Lines        35256    35338      +82     
  Branches      6775     6793      +18     
===========================================
+ Hits         25942    26002      +60     
- Misses        5786     5796      +10     
- Partials      3528     3540      +12     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jmartinesp jmartinesp force-pushed the misc/jme/2579-move-session-recovery-to-ftue branch from 3ecdda1 to c7ec591 Compare April 9, 2024 09:42
@jmartinesp jmartinesp changed the title Move session recovery to the login flow Improve session recovery screens Apr 9, 2024

@PreviewsDayNight
@Composable
internal fun ItemNumberPreview() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you rename this function to CreateNewRecoveryKeyViewPreview please?

@Composable
private fun Content() {
Column(modifier = Modifier.padding(horizontal = 16.dp), verticalArrangement = Arrangement.spacedBy(24.dp)) {
Item(index = 1, text = AnnotatedString(stringResource(R.string.screen_create_new_recovery_key_list_item_1)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Element should not be hard-coded in the string.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean the index? What should we use instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I just realised you meant the name of the app. Sorry.

it.onDone()
}
}
private val callback = plugins<VerifySessionEntryPoint.Callback>().first()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know that we will have only one plugin for the callback, but the current practice is to invoke the method on all the Callback in the plugin list.

onPositiveButtonClicked = onEnterRecoveryKey,
negativeButtonTitle = stringResource(R.string.screen_identity_confirmation_create_new_recovery_key),
onNegativeButtonClicked = onCreateNewRecoveryKey,
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think that it is a good idea to display the Create a new recovery key action only if this is the last device.
Users may have ghost sessions (i.e. not logged out sessions but not accessible anymore, for instance after uninstalling the application without signing out).
Giving such feedback in the PR is not great, and maybe this has been discussed internally. Sorry if it's the case.

Copy link
Contributor Author

@jmartinesp jmartinesp Apr 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we always included it we'd have 3 buttons for 'use another device', 'use recovery key' or 'reset recovery key', which seems like a bit too much. The flows were designed this way, but maybe we can revisit them in the future and add it either on the root view or in the enter recovery key one.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@@ -119,6 +123,7 @@ class VerifySelfSessionViewTest {
eventSink = eventsRecorder
),
onEnterRecoveryKey = EnsureNeverCalled(),
onCreateNewRecoveryKey = EnsureNeverCalled(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should introduce an extension <R : TestRule> AndroidComposeTestRule<R, ComponentActivity>.setVerifySelfSessionView to avoid touching all the tests when a new callback is added.

@jmartinesp jmartinesp added the Run-Maestro Starts a Maestro Cloud session to run integration tests label Apr 9, 2024
@github-actions github-actions bot removed the Run-Maestro Starts a Maestro Cloud session to run integration tests label Apr 9, 2024
@jmartinesp jmartinesp added the Run-Maestro Starts a Maestro Cloud session to run integration tests label Apr 9, 2024
@github-actions github-actions bot removed the Run-Maestro Starts a Maestro Cloud session to run integration tests label Apr 9, 2024
@jmartinesp jmartinesp added the Record-Screenshots Runs the 'Record Screenshots' CI job and adds a commit with any new screenshots found. label Apr 9, 2024
@github-actions github-actions bot removed the Record-Screenshots Runs the 'Record Screenshots' CI job and adds a commit with any new screenshots found. label Apr 9, 2024
@jmartinesp jmartinesp added the Run-Maestro Starts a Maestro Cloud session to run integration tests label Apr 9, 2024
@github-actions github-actions bot removed the Run-Maestro Starts a Maestro Cloud session to run integration tests label Apr 9, 2024
Copy link

sonarcloud bot commented Apr 9, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@jmartinesp jmartinesp enabled auto-merge (squash) April 9, 2024 17:01
@jmartinesp jmartinesp merged commit cf072fa into develop Apr 9, 2024
19 checks passed
@jmartinesp jmartinesp deleted the misc/jme/2579-move-session-recovery-to-ftue branch April 9, 2024 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Task] FTUE - Move session recovery to the login flow
3 participants