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

[Devices Management] Refactor some code to improve testability (PSG-701) #7044

Merged
merged 14 commits into from
Sep 8, 2022

Conversation

mnaturel
Copy link
Contributor

@mnaturel mnaturel commented Sep 6, 2022

Type of change

  • Feature
  • Bugfix
  • Technical
  • Other :

Content

Creating a new clean and tested DevicesViewModel inside the V2 package. Domain layer code has been encapsulated inside UseCases with unit tests.
All the code related to the new device management version has been move inside the V2 package.

Motivation and context

Closes #7043

Screenshots / GIFs

Tests

  • Enable the feature flag for new device management
  • Go to Settings -> Security&Privacy -> Show all Sessions (V2, WIP)
  • Navigate into the different related screens
  • Check there is no issue about the displayed info

Tested devices

  • Physical
  • Emulator
  • OS version(s): Android 11

Checklist

@mnaturel mnaturel changed the title [Devices Management] Refactor some code to improve testability [Devices Management] Refactor some code to improve testability (PSG-701) Sep 6, 2022
@mnaturel mnaturel force-pushed the feature/mna/clean-vm-for-dm-v2 branch from 0ed1673 to b91def8 Compare September 6, 2022 15:44
@mnaturel mnaturel force-pushed the feature/mna/session-overview-screen branch from eb59a53 to 682905d Compare September 7, 2022 07:40
@mnaturel mnaturel force-pushed the feature/mna/clean-vm-for-dm-v2 branch from b91def8 to 2592bc3 Compare September 7, 2022 07:52
@mnaturel mnaturel marked this pull request as ready for review September 7, 2022 07:52
@mnaturel mnaturel requested review from a team, ericdecanini, yostyle and onurays and removed request for a team and ericdecanini September 7, 2022 07:53
}

private fun removeVerificationListener() {
activeSessionHolder.getSafeActiveSession()
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice to see getSafeActiveSession() here.

return CurrentSessionCrossSigningInfo(
deviceId = deviceId,
isCrossSigningInitialized = mxCrossSigningInfo.getOrNull() != null,
isCrossSigningVerified = mxCrossSigningInfo.getOrNull()?.isTrusted() == true
Copy link
Contributor

Choose a reason for hiding this comment

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

I like to use mxCrossSigningInfo.getOrNull()?.isTrusted().orFalse() but of course this is ok too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the suggestion. I have done the update, I prefer also using the extension method. Updated in 98ca432

Copy link
Contributor

@onurays onurays left a comment

Choose a reason for hiding this comment

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

LGTM! Nice cleanup and happy to see lots of tests.

@mnaturel mnaturel force-pushed the feature/mna/clean-vm-for-dm-v2 branch from 2592bc3 to 98ca432 Compare September 7, 2022 15:14
Base automatically changed from feature/mna/session-overview-screen to develop September 8, 2022 07:18
@mnaturel mnaturel force-pushed the feature/mna/clean-vm-for-dm-v2 branch from 9c49ff9 to 45b138e Compare September 8, 2022 07:53
@sonarcloud
Copy link

sonarcloud bot commented Sep 8, 2022

SonarCloud Quality Gate failed.    Quality Gate failed

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

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@mnaturel mnaturel merged commit 62dbab9 into develop Sep 8, 2022
@mnaturel mnaturel deleted the feature/mna/clean-vm-for-dm-v2 branch September 8, 2022 09:44
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.

[Devices Management] Refactor some code to improve testability
2 participants