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

[Session manager] Multi-session signout (PSG-857) #7456

Merged
merged 25 commits into from
Nov 8, 2022

Conversation

mnaturel
Copy link
Contributor

@mnaturel mnaturel commented Oct 26, 2022

Type of change

  • Feature
  • Bugfix
  • Technical
  • Other :

Content

Adding capability to signout several sessions at once. On SDK side, adding new delete_devices endpoint.

Motivation and context

Closes #7418

Screenshots / GIFs

Tests

  • Enable the new session manager labs setting
  • Go to Settings -> Security & Privacy -> Show all sessions
  • In the other sessions section check you have the action to signout all other sessions in the overflow menu
  • Press view All button (you need more than 5 other sessions)
  • Check you have the signout all sessions action in the overflow menu
  • Go into select mode
  • Check there is the signout button outside the overflow menu when there is at least one selected session
  • Select several sessions
  • Press the signout button
  • Confirm the action
  • Check the selected session disappear from the list
  • Check the select mode is left

Tested devices

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

Checklist

@mnaturel mnaturel marked this pull request as ready for review October 26, 2022 13:18
@mnaturel mnaturel requested review from a team and ericdecanini and removed request for a team October 26, 2022 13:18
@mnaturel mnaturel force-pushed the feature/mna/session_manager_multi_signout branch 2 times, most recently from 4c3ba34 to 0e66d13 Compare November 2, 2022 08:38
@mnaturel mnaturel requested review from a team and Florian14 and removed request for ericdecanini and a team November 2, 2022 08:38
@mnaturel mnaturel force-pushed the feature/mna/session_manager_multi_signout branch from 0e66d13 to ef8c0a5 Compare November 4, 2022 08:29
Copy link
Contributor

@Florian14 Florian14 left a comment

Choose a reason for hiding this comment

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

Tested ok, code seems good.

Just a small thing, there is a lot of duplicated code between fragments and ViewModels, would it be possible to have a new ViewModel used by both fragments?

@mnaturel
Copy link
Contributor Author

mnaturel commented Nov 7, 2022

Tested ok, code seems good.

Just a small thing, there is a lot of duplicated code between fragments and ViewModels, would it be possible to have a new ViewModel used by both fragments?

Thanks for the review, yes I agree the duplicated code is annoying. I could not find a best way to solve this but I didn't think of having a dedicated ViewModel for the signout part. In my mind, I was limiting one ViewModel per Fragment. Let me try your suggestion.

@mnaturel mnaturel force-pushed the feature/mna/session_manager_multi_signout branch from ef8c0a5 to 1b940e8 Compare November 7, 2022 10:43
@mnaturel mnaturel force-pushed the feature/mna/session_manager_multi_signout branch from 1b940e8 to 45050e8 Compare November 7, 2022 10:45
@mnaturel
Copy link
Contributor Author

mnaturel commented Nov 7, 2022

Tested ok, code seems good.
Just a small thing, there is a lot of duplicated code between fragments and ViewModels, would it be possible to have a new ViewModel used by both fragments?

Thanks for the review, yes I agree the duplicated code is annoying. I could not find a best way to solve this but I didn't think of having a dedicated ViewModel for the signout part. In my mind, I was limiting one ViewModel per Fragment. Let me try your suggestion.

Eventually, I have reworked a little the use case into a single one for signout of sessions. See 6d26208. I haven't created a new ViewModel since we update the ViewState during the process and we have a single viewState for the whole Fragment. Duplication is only about ViewEvents and ViewState which I think is reasonable.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Nov 7, 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 0 Code Smells

60.5% 60.5% Coverage
1.5% 1.5% Duplication

@mnaturel mnaturel merged commit fc24bea into develop Nov 8, 2022
@mnaturel mnaturel deleted the feature/mna/session_manager_multi_signout branch November 8, 2022 13:21
}

deleteDevices(deviceIds, authInterceptor)
Timber.d("end execute")
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you want to keep these logs?

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 indeed I wanted to keep these logs. Maybe I could have put the verbose tag instead.

Copy link
Contributor

@Florian14 Florian14 left a comment

Choose a reason for hiding this comment

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

Thanks for the update!

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.

[Session manager] Multi-session signout
2 participants