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

Show all locations for custom lists in edit locations and detail view #6135

Merged
merged 3 commits into from
Apr 17, 2024

Conversation

Pururun
Copy link
Contributor

@Pururun Pururun commented Apr 16, 2024

This is to avoid unexpected behavior. The locations are not shown in the select location screen, to align ux with desktop.


This change is Reviewable

@Pururun Pururun requested review from Rawa and albin-mullvad April 16, 2024 12:18
Copy link

linear bot commented Apr 16, 2024

@Pururun Pururun added the Android Issues related to Android label Apr 16, 2024
@Pururun Pururun self-assigned this Apr 16, 2024
@Pururun Pururun force-pushed the edit-list-view-gets-affected-by-filters-droid-903 branch from 74e5f8d to 51e25e5 Compare April 16, 2024 12:34
Copy link
Collaborator

@albin-mullvad albin-mullvad left a comment

Choose a reason for hiding this comment

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

Reviewed 8 of 14 files at r1, all commit messages.
Reviewable status: 8 of 14 files reviewed, 1 unresolved discussion (waiting on @Pururun)


android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/CustomListLocationsViewModel.kt line 40 at r1 (raw file):

    val uiState =
        combine(relayListUseCase.relatListAll(), _searchTerm, _selectedLocations) {

Typo?

Code quote:

relat

Copy link
Collaborator

@albin-mullvad albin-mullvad left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 14 files at r1.
Reviewable status: 9 of 14 files reviewed, 3 unresolved discussions (waiting on @Pururun)


android/app/src/main/kotlin/net/mullvad/mullvadvpn/usecase/RelayListUseCase.kt line 61 at r1 (raw file):

    fun selectedRelayItem(): Flow<RelayItem?> = relayListWithSelection().map { it.selectedItem }

    fun relayListFiltered(): Flow<List<RelayItem.Country>> =

I suggest: filteredRelayList

Code quote:

relayListFiltered

android/app/src/main/kotlin/net/mullvad/mullvadvpn/usecase/RelayListUseCase.kt line 64 at r1 (raw file):

        relayListWithSelection().map { it.filteredCountries }

    fun relatListAll(): Flow<List<RelayItem.Country>> =

I suggest something like: unfilteredRelayList or fullRelayList

Code quote:

relatListAll

Copy link
Collaborator

@albin-mullvad albin-mullvad left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 14 files at r1.
Reviewable status: 10 of 14 files reviewed, 3 unresolved discussions (waiting on @Pururun)

Copy link
Contributor

@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.

Reviewed 10 of 14 files at r1, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @albin-mullvad and @Pururun)


android/app/src/main/kotlin/net/mullvad/mullvadvpn/usecase/RelayListUseCase.kt line 64 at r1 (raw file):

Previously, albin-mullvad wrote…

I suggest something like: unfilteredRelayList or fullRelayList

I agree the naming can be better, personally I think relayList and filteredRelayList would be clear enough.

Copy link
Collaborator

@albin-mullvad albin-mullvad 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: all files reviewed, 3 unresolved discussions (waiting on @Pururun)


android/app/src/main/kotlin/net/mullvad/mullvadvpn/usecase/RelayListUseCase.kt line 64 at r1 (raw file):

Previously, Rawa (David Göransson) wrote…

I agree the naming can be better, personally I think relayList and filteredRelayList would be clear enough.

Yeah, that also works! Was thinking of suggesting that but got the impression that @Pururun might see value in being more explicit. I'm fine either way!

Copy link
Collaborator

@albin-mullvad albin-mullvad left a comment

Choose a reason for hiding this comment

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

Reviewed 4 of 14 files at r1.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @Pururun)


android/app/src/main/kotlin/net/mullvad/mullvadvpn/relaylist/RelayListExtensions.kt line 183 at r1 (raw file):

    providers: Constraint<Providers>
): List<RelayItem.Country> =
    this.filter {

nit: not needed, right?

Code quote:

this.

android/app/src/main/kotlin/net/mullvad/mullvadvpn/relaylist/RelayListExtensions.kt line 195 at r1 (raw file):

    (ownership.toNullableOwnership() == null || ownership.toNullableOwnership() == it.ownership) &&
        (providers is Constraint.Any ||
            (providers is Constraint.Only && providers.value.providers.contains(it.providerName)))

Can the readability be improved? Quite hard to follow. Maybe using some helper function or local variable 🤔

Code quote:

    (ownership.toNullableOwnership() == null || ownership.toNullableOwnership() == it.ownership) &&
        (providers is Constraint.Any ||
            (providers is Constraint.Only && providers.value.providers.contains(it.providerName)))

@Pururun Pururun force-pushed the edit-list-view-gets-affected-by-filters-droid-903 branch from 51e25e5 to ae2e60f Compare April 16, 2024 21:44
Copy link
Contributor Author

@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.

Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @albin-mullvad and @Rawa)


android/app/src/main/kotlin/net/mullvad/mullvadvpn/relaylist/RelayListExtensions.kt line 183 at r1 (raw file):

Previously, albin-mullvad wrote…

nit: not needed, right?

Yeah, redid a little bit though since I realized my implementation would include empty cities.


android/app/src/main/kotlin/net/mullvad/mullvadvpn/relaylist/RelayListExtensions.kt line 195 at r1 (raw file):

Previously, albin-mullvad wrote…

Can the readability be improved? Quite hard to follow. Maybe using some helper function or local variable 🤔

I made it like that to not filter twice, but the previous implementation did also filter twice and was much more readable so I just changed it to use that one instead.


android/app/src/main/kotlin/net/mullvad/mullvadvpn/usecase/RelayListUseCase.kt line 61 at r1 (raw file):

Previously, albin-mullvad wrote…

I suggest: filteredRelayList

It was not needed so I just removed it.


android/app/src/main/kotlin/net/mullvad/mullvadvpn/usecase/RelayListUseCase.kt line 64 at r1 (raw file):

Previously, albin-mullvad wrote…

Yeah, that also works! Was thinking of suggesting that but got the impression that @Pururun might see value in being more explicit. I'm fine either way!

I would say I prefer fullRelayList


android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/CustomListLocationsViewModel.kt line 40 at r1 (raw file):

Previously, albin-mullvad wrote…

Typo?

Wonder what happened there 🤔 Fixed.

@Pururun Pururun force-pushed the edit-list-view-gets-affected-by-filters-droid-903 branch from ae2e60f to 1c5b803 Compare April 17, 2024 05:41
Copy link
Contributor Author

@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.

Reviewable status: 7 of 14 files reviewed, 3 unresolved discussions (waiting on @albin-mullvad and @Rawa)


android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/SelectLocationViewModel.kt line 38 at r3 (raw file):

    private val _searchTerm = MutableStateFlow(EMPTY_SEARCH_TERM)

    @Suppress("DestructuringDeclarationWithTooManyEntries")

Added this since I think that it is better to use a destructuring declaration and we only add an entry here that we don't use anyway.

Copy link
Contributor Author

@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.

Reviewable status: 7 of 14 files reviewed, 3 unresolved discussions (waiting on @albin-mullvad and @Rawa)


android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/SelectLocationViewModel.kt line 38 at r3 (raw file):

Previously, Pururun (Jonatan Rhodin) wrote…

Added this since I think that it is better to use a destructuring declaration and we only add an entry here that we don't use anyway.

It should be noted that this is completely rewritten in the gRPC branch so hopefully this will not be in the code base for long.

@albin-mullvad albin-mullvad requested a review from Rawa April 17, 2024 06:13
Copy link
Collaborator

@albin-mullvad albin-mullvad left a comment

Choose a reason for hiding this comment

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

Reviewed 3 of 4 files at r2, 3 of 3 files at r3, all commit messages.
Reviewable status: 13 of 14 files reviewed, all discussions resolved (waiting on @Rawa)

Copy link
Contributor

@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.

Reviewed 1 of 4 files at r2, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @Pururun)


android/app/src/main/kotlin/net/mullvad/mullvadvpn/relaylist/RelayListExtensions.kt line 187 at r3 (raw file):

                    val relays =
                        city.relays.filterRelayByOwnershipAndProviders(ownership, providers).map {
                            it.copy()

Unnecessary copy?

Copy link
Collaborator

@albin-mullvad albin-mullvad 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: all files reviewed, 1 unresolved discussion (waiting on @Pururun)


android/app/src/main/kotlin/net/mullvad/mullvadvpn/relaylist/RelayListExtensions.kt line 183 at r1 (raw file):

Previously, Pururun (Jonatan Rhodin) wrote…

Yeah, redid a little bit though since I realized my implementation would include empty cities.

Still has the this keyword though? But I guess that's fine if you believe that it improves readability

@Pururun Pururun force-pushed the edit-list-view-gets-affected-by-filters-droid-903 branch from 1c5b803 to b168471 Compare April 17, 2024 08:18
Copy link
Contributor

@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.

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

Copy link
Contributor

@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.

:lgtm:

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

Copy link
Collaborator

@albin-mullvad albin-mullvad 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 1 of 1 files at r4, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

Copy link
Contributor

@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: :shipit: complete! all files reviewed, all discussions resolved

Pururun added 3 commits April 17, 2024 13:04
With the exception of the select location screen list
@Pururun Pururun force-pushed the edit-list-view-gets-affected-by-filters-droid-903 branch from b168471 to 9a33575 Compare April 17, 2024 11:04
@Pururun Pururun merged commit 0a2f49c into main Apr 17, 2024
26 checks passed
@Pururun Pururun deleted the edit-list-view-gets-affected-by-filters-droid-903 branch April 17, 2024 11:14
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.

3 participants