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

PIN : unlock screen ui #1624

Merged
merged 23 commits into from
Oct 23, 2023
Merged

PIN : unlock screen ui #1624

merged 23 commits into from
Oct 23, 2023

Conversation

ganfra
Copy link
Contributor

@ganfra ganfra commented Oct 23, 2023

@github-actions
Copy link
Contributor

github-actions bot commented Oct 23, 2023

📱 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/1UoM2m

@ganfra ganfra marked this pull request as ready for review October 23, 2023 09:07
@ganfra ganfra requested a review from a team as a code owner October 23, 2023 09:07
@ganfra ganfra requested review from bmarty and removed request for a team October 23, 2023 09:07
@codecov
Copy link

codecov bot commented Oct 23, 2023

Codecov Report

Attention: 133 lines in your changes are missing coverage. Please review.

Comparison is base (8aa706e) 58.98% compared to head (f8512d3) 59.14%.
Report is 6 commits behind head on develop.

❗ Current head f8512d3 differs from pull request most recent head 20eed4f. Consider uploading reports for the commit 20eed4f to get more accurate results

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1624      +/-   ##
===========================================
+ Coverage    58.98%   59.14%   +0.15%     
===========================================
  Files         1225     1228       +3     
  Lines        31619    31868     +249     
  Branches      6493     6557      +64     
===========================================
+ Hits         18652    18849     +197     
- Misses       10143    10164      +21     
- Partials      2824     2855      +31     
Files Coverage Δ
...oid/features/lockscreen/impl/pin/model/PinDigit.kt 100.00% <ø> (ø)
...d/features/lockscreen/impl/setup/SetupPinEvents.kt 100.00% <100.00%> (ø)
...id/features/lockscreen/impl/setup/SetupPinState.kt 100.00% <100.00%> (ø)
...res/lockscreen/impl/setup/SetupPinStateProvider.kt 96.29% <100.00%> (ø)
...s/lockscreen/impl/setup/validation/PinValidator.kt 100.00% <100.00%> (ø)
...ockscreen/impl/setup/validation/SetupPinFailure.kt 100.00% <100.00%> (ø)
...screen/impl/state/DefaultLockScreenStateService.kt 50.00% <ø> (+50.00%) ⬆️
...features/lockscreen/impl/unlock/PinUnlockEvents.kt 100.00% <100.00%> (ø)
.../features/lockscreen/impl/unlock/PinUnlockState.kt 100.00% <100.00%> (ø)
...es/lockscreen/impl/unlock/numpad/PinKeypadModel.kt 100.00% <100.00%> (ø)
... and 11 more

... and 2 files with indirect coverage changes

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

…ontain `ElementTheme` composable, and fix existing issues.
Copy link
Member

@bmarty bmarty left a comment

Choose a reason for hiding this comment

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

Nice work!
Some remarks, that may be handed later.
Also I pushed 2 commits and triggered a record screenshot action.

@@ -50,14 +50,36 @@ data class PinEntry(
return copy(digits = newDigits.toPersistentList())
}

fun deleteLast(): PinEntry {
Copy link
Member

Choose a reason for hiding this comment

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

Not from this PR, but for clarity, maybe rename the fun fun empty(size: Int) in the companion to create, or createEmpty?

}
return copy(digits = newDigits.toPersistentList())
}

Copy link
Member

Choose a reason for hiding this comment

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

I think the method below clear() is not correct (but it's not used).
It should return PinEntry.empty(size)

Maybe adding unit test to cover PinEntry behavior could help.

@Composable
override fun present(): PinUnlockState {
var pinEntry by remember {
mutableStateOf(PinEntry.empty(4))
Copy link
Member

Choose a reason for hiding this comment

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

Use PIN_SIZE instead of hard-coded 4?

Copy link
Member

Choose a reason for hiding this comment

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

Note that is the number of digit is "dynamic" (for instance config server side), we should store the size of the pin code when it has been setup, or the user will be stuck if the config change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The size will be loaded dynamically when I'll branch the logic

mutableStateOf(PinEntry.empty(4))
}
var remainingAttempts by rememberSaveable {
mutableIntStateOf(3)
Copy link
Member

Choose a reason for hiding this comment

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

I think remainingAttempts has to be saved on disk. You will do it later?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We have all the methods, I just need to branch the logic, but it's part of another PR

is PinUnlockEvents.OnPinKeypadPressed -> {
pinEntry = pinEntry.process(event.pinKeypadModel)
if (pinEntry.isComplete()) {
coroutineScope.launch { pinStateService.unlock() }
Copy link
Member

Choose a reason for hiding this comment

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

Also to do later, (just adding a reminder): compare with the correct PIN code.
Maybe safer to add TODOs in the code...

private val maxSizePinKey = 80.dp

@Composable
fun PinKeypad(
Copy link
Member

Choose a reason for hiding this comment

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

numpad (as the package name) or keypad? Maybe keep only one single name.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes will change the package

@ganfra ganfra enabled auto-merge October 23, 2023 14:03
@sonarcloud
Copy link

sonarcloud bot commented Oct 23, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@ganfra ganfra merged commit 005e5cc into develop Oct 23, 2023
13 checks passed
@ganfra ganfra deleted the feature/fga/pin_auth_ui branch October 23, 2023 14:35
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.

None yet

3 participants