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

[Device management] Add lab flag for matrix client info account data event (PSG-800) #7352

Merged
merged 11 commits into from
Oct 14, 2022

Conversation

mnaturel
Copy link
Contributor

@mnaturel mnaturel commented Oct 13, 2022

Type of change

  • Feature
  • Bugfix
  • Technical
  • Other :

Content

Adding a lab flag to toggle the client info recording used to provide Application info in the session details screen.

Motivation and context

Closes #7344

Screenshots / GIFs

Tests

  • Sign-in to synapse-prefill.lab.element.dev
  • Go to Settings -> Labs
  • Enable the new session manager
  • Check the "Enable client info recording" flag
  • Go to Settings -> Show all sessions
  • Go to the session details screen of the current session
  • Check the Application section is displayed
  • Go to Settings -> Labs
  • Uncheck the "Enable client info recording" flag
  • Go to Settings -> Security & Privacy -> Show all sessions
  • Go to the session details screen of the current session
  • Check the Application section is not displayed

Tested devices

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

Checklist

@mnaturel mnaturel added the Z-NextRelease For issues and PRs which should be included in the NextRelease. label Oct 13, 2022
@mnaturel mnaturel marked this pull request as ready for review October 13, 2022 08:02
@mnaturel mnaturel requested review from a team and ganfra and removed request for a team October 13, 2022 08:02
@bmarty bmarty requested review from bmarty and removed request for ganfra October 14, 2022 07:58
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.

LGTM, just some minor remarks.

@@ -42,6 +42,7 @@
<bool name="settings_labs_thread_messages_default">false</bool>
<bool name="settings_labs_new_app_layout_default">true</bool>
<bool name="settings_labs_new_session_manager_default">false</bool>
<bool name="settings_labs_client_info_recording_default">false</bool>
Copy link
Member

Choose a reason for hiding this comment

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

You could also create a settings_labs_client_info_recording_visible to toggle the visibility of this lab flag. Can be useful for other forks. See the doc at the top of the file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, I see. I will update. I will add one also for the lab flag of new session manager as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 8613221

private fun configureEnableClientInfoRecordingPreference() {
findPreference<VectorSwitchPreference>(VectorPreferences.SETTINGS_LABS_CLIENT_INFO_RECORDING_KEY)?.onPreferenceChangeListener =
OnPreferenceChangeListener { _, newValue ->
when {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe change to when (newValue as? Boolean)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated in 189e772

import im.vector.app.core.session.clientinfo.UpdateMatrixClientInfoUseCase
import kotlinx.coroutines.launch

class VectorSettingsLabsViewModel @AssistedInject constructor(
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for introducing a ViewModel here!


private fun handleDeleteRecordedClientInfo() {
viewModelScope.launch {
deleteMatrixClientInfoUseCase.execute()
Copy link
Member

Choose a reason for hiding this comment

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

For parity it's strange that updateMatrixClientInfoUseCase takes a session as param and deleteMatrixClientInfoUseCase doesn't.
Maybe change the Former (updateMatrixClientInfoUseCase)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In fact, for that I was constrained by the fact updateMatrixClientInfoUseCase is indirectly injected in ActiveSessionHolder. To avoid cyclic dependency, I had to make the session as a parameter. I would like to avoid adding the session as parameter to deleteMatrixClientInfoUseCase unless you really think we should align the parameters.

Copy link
Member

Choose a reason for hiding this comment

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

OK, no this is fine, thanks for explaining.

@mnaturel mnaturel requested a review from bmarty October 14, 2022 11:48
@sonarqubecloud
Copy link

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

50.0% 50.0% Coverage
0.0% 0.0% Duplication

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.

Thanks for the update!

@mnaturel mnaturel merged commit ec5964b into develop Oct 14, 2022
@mnaturel mnaturel deleted the feature/mna/device-manager-lab-flag-account-data branch October 14, 2022 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Z-NextRelease For issues and PRs which should be included in the NextRelease.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Device management] Add lab flag for matrix client info account data event
2 participants