-
Notifications
You must be signed in to change notification settings - Fork 760
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] Rename a session (PSG-747) #7189
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor comment, other than that it LGTM.
if (renameEditTextInitialized.not()) { | ||
views.renameSessionEditText.setText(state.editedDeviceName) | ||
views.renameSessionEditText.setSelection(views.renameSessionEditText.length()) | ||
renameEditTextInitialized = true | ||
} | ||
views.renameSessionSave.isEnabled = state.editedDeviceName.isNotEmpty() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks a bit weird. If it's a one time event, shouldn't it be done through a ViewEvent
? Or if it needs to be part of the state, could we check the contents of renameSessionEditText
before applying these changes instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me it should be in the ViewState
. The reason is that we should be able to reconstruct the view at any moment using the ViewState
. So for the enable status of the save button, we should use info from the ViewState
. Like you said ViewEvent
is a one time event and so not persisted, meaning we will lose the enable status of the button.
But I don't understand the last part of your comment:
could we check the contents of renameSessionEditText before applying these changes instead?
Can you add more details about your suggestion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was suggesting to either add a RenameSessionViewEvent.Initialized(val deviceName: String)
that can be consumed once, or maybe checking if (views.renameSessionEditText.text.isNullOrEmpty())
before applying the state here instead of adding the renameEditTextInitialized
variable for that, since it seems like you only want to set the view contents when this data is first loaded, I guess because otherwise keyboard input and state updates would clash on the EditText.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh sorry I got it! I will try to improve. I completely misunderstood your suggestion at first...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have done an update: see a8d7723. It adds more complexity to the ViewModel
but I think it is more logical this way. Let me know what you think about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the changes. LGTM!
55b8a60
to
5399ef6
Compare
|
5399ef6
to
7a4bf83
Compare
SonarCloud Quality Gate failed. |
Type of change
Content
Adding a new screen to rename a given session. It can be reached from the session overview screen using the overflow menu.
Motivation and context
Closes #7158
Screenshots / GIFs
Tests
Tested devices
Checklist