-
Notifications
You must be signed in to change notification settings - Fork 357
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
Migrate SelectLocationView to use items for each relay item #6488
Migrate SelectLocationView to use items for each relay item #6488
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.
Reviewable status: 0 of 25 files reviewed, 1 unresolved discussion
android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/data/DummyRelayItems.kt
line 90 at r2 (raw file):
customList = CustomList( name = CustomListName.fromString("Empty List list"),
Fixed
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 6 of 14 files at r1, 15 of 19 files at r2, 4 of 4 files at r3, all commit messages.
Reviewable status: all files reviewed, 14 unresolved discussions (waiting on @Rawa)
android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/FilterCell.kt
line 36 at r3 (raw file):
@Composable fun FilterRow(
Name of file should be changed to FilterRow
android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/RelayLocationCell.kt
line 106 at r3 (raw file):
when { isSelected -> MaterialTheme.colorScheme.selected // item is RelayItem.CustomList && !relayItem.active
If we have an empty custom list I think we should have a different background
android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/SelectLocationScreen.kt
line 267 at r3 (raw file):
{ _, _ -> }, onRemoveLocationFromList: (location: RelayItem.Location, customList: CustomListId) -> Unit =
Nit: customList
should be called customListId
android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/SelectLocationScreen.kt
line 302 at r3 (raw file):
val filterChips = (state as? SelectLocationUiState.Content)?.filterChips?.toList() ?: emptyList()
Could this be made into a function in the ui state?
android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/SelectLocationScreen.kt
line 337 at r3 (raw file):
items = state.relayListItems, key = { index: Int, item: RelayListItem -> item.key }, contentType = { _, _ -> null },
I think we could get some performance improvement here by using content type? Just an idea, not sure how much it matters in actuality.
android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/SelectLocationScreen.kt
line 432 at r3 (raw file):
location, relayItem.isSelected, { onSelectRelay() },
Does this makes it clickable even when it should not be? Like if a relay is down?
android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/SelectLocationScreen.kt
line 451 at r3 (raw file):
customListItem, itemState.isSelected, { onSelectRelay(customListItem) },
Same as above, maybe I missed that code?
android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/SelectLocationScreen.kt
line 615 at r3 (raw file):
private fun SelectLocationUiState.indexOfSelectedRelayItem(): Int = if (this is SelectLocationUiState.Content) { relayListItems.indexOfFirst {
Nice ⭐
android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/SelectLocationScreen.kt
line 797 at r3 (raw file):
customListId: CustomListId, item: RelayItem.Location, onRemoveLocationFromList: (location: RelayItem.Location, customList: CustomListId) -> Unit,
Nit: Could be changed to customListId
android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/SelectLocationScreen.kt
line 882 at r3 (raw file):
} private const val EXTRA_ITEMS_LOCATION =
🎉
android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/SelectLocationUiState.kt
line 19 at r3 (raw file):
sealed interface FilterChip { data class Ownership(val ownership: net.mullvad.mullvadvpn.lib.model.Ownership) : FilterChip
Import alias.
android/app/src/main/kotlin/net/mullvad/mullvadvpn/usecase/customlists/CustomListsRelayItemUseCase.kt
line 27 at r3 (raw file):
} class FilterCustomListsRelayItemUseCase(
File should renamed
android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/SelectLocationViewModel.kt
line 90 at r3 (raw file):
uiState .map { it is Content } .filter { it }
What does this do?
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 3 of 6 files at r4, 5 of 5 files at r5, all commit messages.
Reviewable status: all files reviewed, 14 unresolved discussions (waiting on @Rawa)
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.
Reviewable status: 24 of 27 files reviewed, 11 unresolved discussions (waiting on @Pururun)
android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/RelayLocationCell.kt
line 106 at r3 (raw file):
Previously, Pururun (Jonatan Rhodin) wrote…
If we have an empty custom list I think we should have a different background
Fixed
android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/SelectLocationScreen.kt
line 267 at r3 (raw file):
Previously, Pururun (Jonatan Rhodin) wrote…
Nit:
customList
should be calledcustomListId
Fixed
android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/SelectLocationScreen.kt
line 302 at r3 (raw file):
Previously, Pururun (Jonatan Rhodin) wrote…
Could this be made into a function in the ui state?
Made it a more clean if statement. I was toying around with animating this, but decided against it since it would of added more changes to this PR.
android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/SelectLocationScreen.kt
line 337 at r3 (raw file):
Previously, Pururun (Jonatan Rhodin) wrote…
I think we could get some performance improvement here by using content type? Just an idea, not sure how much it matters in actuality.
Added content type
android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/SelectLocationScreen.kt
line 432 at r3 (raw file):
Previously, Pururun (Jonatan Rhodin) wrote…
Does this makes it clickable even when it should not be? Like if a relay is down?
It should not be since we set the enabled flag in the combinedClickable:
https://github.com/mullvad/mullvadvpn-app/pull/6488/files#diff-118e999c59f062ccd4e5d1e7f5d16543381e1badcb902f315d5ebc7bba753c91R141
android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/SelectLocationScreen.kt
line 451 at r3 (raw file):
Previously, Pururun (Jonatan Rhodin) wrote…
Same as above, maybe I missed that code?
See above.
android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/SelectLocationScreen.kt
line 797 at r3 (raw file):
Previously, Pururun (Jonatan Rhodin) wrote…
Nit: Could be changed to
customListId
Fixed
android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/SelectLocationUiState.kt
line 19 at r3 (raw file):
Previously, Pururun (Jonatan Rhodin) wrote…
Import alias.
Fixed
android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/SelectLocationViewModel.kt
line 90 at r3 (raw file):
Previously, Pururun (Jonatan Rhodin) wrote…
What does this do?
It was triggering the center on item, I've refactored it now to make it more clear.
android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/FilterCell.kt
line 36 at r3 (raw file):
Previously, Pururun (Jonatan Rhodin) wrote…
Name of file should be changed to
FilterRow
Fixed!
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.
Reviewable status: 24 of 27 files reviewed, 11 unresolved discussions (waiting on @Pururun)
android/app/src/main/kotlin/net/mullvad/mullvadvpn/usecase/customlists/CustomListsRelayItemUseCase.kt
line 27 at r3 (raw file):
Previously, Pururun (Jonatan Rhodin) wrote…
File should renamed
Moved out to seperate file
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 3 of 3 files at r6, 2 of 2 files at r7, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion
android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/SelectLocationScreen.kt
line 337 at r3 (raw file):
Previously, Rawa (David Göransson) wrote…
Added content type
Nice
android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/SelectLocationScreen.kt
line 432 at r3 (raw file):
Previously, Rawa (David Göransson) wrote…
It should not be since we set the enabled flag in the combinedClickable:
https://github.com/mullvad/mullvadvpn-app/pull/6488/files#diff-118e999c59f062ccd4e5d1e7f5d16543381e1badcb902f315d5ebc7bba753c91R141
👍
android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/SelectLocationScreen.kt
line 451 at r3 (raw file):
Previously, Rawa (David Göransson) wrote…
See above.
👍
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 8 of 8 files at r8, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion
d07b27f
to
ea30c86
Compare
ea30c86
to
087b5f0
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 9 of 11 files at r9, 2 of 2 files at r10, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved
This change is