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

Fix DnsDialog shortly showing error after adding new DNS entry #6309

Conversation

Rawa
Copy link
Contributor

@Rawa Rawa commented Jun 3, 2024

Blocked by other PR, up for opinions about how we solve the prevention of the Error appearing on re-rendering with new data.


This change is Reviewable

@Rawa Rawa self-assigned this Jun 3, 2024
Copy link

linear bot commented Jun 3, 2024

@Rawa Rawa added the Android Issues related to Android label Jun 3, 2024
@Rawa Rawa changed the title Simplify ViewModel and take settings once Simplify DnsViewModel and take settings once Jun 3, 2024
@Rawa Rawa marked this pull request as draft June 3, 2024 08:35
Copy link
Contributor

@Pururun Pururun left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 3 files at r1, 1 of 1 files at r2, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @Rawa)


android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/DnsDialogViewModel.kt line 33 at r2 (raw file):

data class DnsDialogViewState(
    val ipAddress: String,
    val validationResult: ValidationError?,

Probaby clearer if this is called validationError?


android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/DnsDialogViewModel.kt line 59 at r2 (raw file):

    val uiState: StateFlow<DnsDialogViewState> =
        combine(_ipAddressInput, repository.settingsUpdates.filterNotNull().take(1)) {

I wonder if this should be outside of this view model since it is probably something that we will use somewhere else? Like a latestSettings function somewhere?


android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/DnsDialogViewModel.kt line 87 at r2 (raw file):

    }

    private fun String.validateDnsEntry(

Looks really nice 👍

@Rawa Rawa force-pushed the dns-already-added-appears-quickly-when-adding-a-custom-dns-droid-1029 branch from 276082b to f2cd00c Compare June 3, 2024 13:34
Copy link
Contributor Author

@Rawa Rawa left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 4 files reviewed, 2 unresolved discussions (waiting on @Pururun)


android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/DnsDialogViewModel.kt line 33 at r2 (raw file):

Previously, Pururun (Jonatan Rhodin) wrote…

Probaby clearer if this is called validationError?

Yes, fixed!


android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/DnsDialogViewModel.kt line 59 at r2 (raw file):

Previously, Pururun (Jonatan Rhodin) wrote…

I wonder if this should be outside of this view model since it is probably something that we will use somewhere else? Like a latestSettings function somewhere?

Fixed, this by changing the logic of addCustomDns. Now we get back the index, and then update that when it was returned.

@Rawa Rawa marked this pull request as ready for review June 3, 2024 13:35
@Rawa Rawa changed the title Simplify DnsViewModel and take settings once Fix DnsDialog shortly showing error after adding new DNS entry Jun 3, 2024
Copy link
Contributor

@Pururun Pururun left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 4 of 4 files at r3, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@Rawa Rawa force-pushed the dns-already-added-appears-quickly-when-adding-a-custom-dns-droid-1029 branch from f2cd00c to 125fc8c Compare June 4, 2024 06:28
@Rawa Rawa merged commit c923459 into main Jun 4, 2024
21 of 22 checks passed
@Rawa Rawa deleted the dns-already-added-appears-quickly-when-adding-a-custom-dns-droid-1029 branch June 4, 2024 06:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Android Issues related to Android
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants