ente icon indicating copy to clipboard operation
ente copied to clipboard

[auth][mob] Format longer codes with length > 6

Open AbhishekSharma55 opened this issue 11 months ago • 2 comments

Description

This modification adds a space after every third character in the PinPut widget, making the 8-digit code visually separated into blocks of 3 characters. Additionally, it adjusts the verification logic to remove spaces from the code before verifying it.

Tests

fixes #475

AbhishekSharma55 avatar Mar 11 '24 08:03 AbhishekSharma55

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Mar 11 '24 08:03 CLAassistant

Hello,

The change needs to be made on the screen where we display code for various screen. This is method that we should modify.

https://github.com/ente-io/ente/blob/main/auth/lib/ui/code_widget.dart#L448 If the code is between [7,9] digits, let's keep the middle group small. 123 4 567 123 45 678 123 456 789

If it's larger than 9, let's just divide it in group of 3, with smallest group in the end.

123 456 789 1 123 456 789 12 123 456 789 123

Let's add a method in totp_util that will return the formatted code. It will be great if you can add a test + screenshot for the screen to see how it looks visually.

String getGroupedCode(code) {

}

Thanks!

ua741 avatar Mar 11 '24 09:03 ua741

Hey @AbhishekSharma55 ,

As this PR anyways contain redundant change, we will close it. Please feel free to create a fresh PR with the suggested changes as mentioned in https://github.com/ente-io/ente/pull/1005#issuecomment-1987923730

Thanks

ua741 avatar Mar 16 '24 18:03 ua741