-
Notifications
You must be signed in to change notification settings - Fork 336
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
Improve DnsDialogViewModel nav arguments #7053
base: main
Are you sure you want to change the base?
Conversation
ea8d6d9
to
98375f9
Compare
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.
Reviewed 4 of 4 files at r1, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved
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.
Reviewed 4 of 4 files at r1.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @kl)
android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/DnsDialogViewModel.kt
line 81 at r1 (raw file):
viewModelScope, SharingStarted.Lazily, createViewState(emptyList(), null, false, EMPTY_STRING),
I'm a bit torn of this, I think it would be nicer if we directly show the correct state.
Right now if you click on an existing entry we would incorrectly show EMPTY_STRING
first. Maybe it is necessary to introduce a loading state?
Some other remarks that I think we can do better:
- We should review if we can make
MutableStateFlow<Settings?>
more clear. It doesn't seem to add much in it current form ( except as acting like a cache for the first Settings object we saw to avoid an update as we press save.) - _ipAddressInput being nullable feels wrong, it looks like the user can input a "null" but that wouldn't be valid input from a user. (It is a backing field and
onDnsInputChange
only accepts String, but it gets a bit confusing. Maybelateinit
until we get firstSettings
? - The following line does a lot of heavy lifting and isn't very readable:
val input =
inputAddress
?: navArgs.index?.let { index -> dnsList[index].addressString() }
?: EMPTY_STRING
E.g that if navArgs.index
would either be always null or always a value.
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.
Reviewed all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @kl)
98375f9
to
4d4111d
Compare
This change is