summaryrefslogtreecommitdiffhomepage
path: root/android
diff options
context:
space:
mode:
Diffstat (limited to 'android')
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/SelectLocationScreen.kt13
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/SelectLocationUiState.kt2
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/SelectLocationViewModel.kt9
-rw-r--r--android/lib/resource/src/main/res/values/strings.xml2
4 files changed, 18 insertions, 8 deletions
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/SelectLocationScreen.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/SelectLocationScreen.kt
index e96fc66221..1b82861e76 100644
--- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/SelectLocationScreen.kt
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/SelectLocationScreen.kt
@@ -92,7 +92,9 @@ import net.mullvad.mullvadvpn.compose.transitions.SelectLocationTransition
import net.mullvad.mullvadvpn.compose.util.CollectSideEffectWithLifecycle
import net.mullvad.mullvadvpn.compose.util.RunOnKeyChange
import net.mullvad.mullvadvpn.compose.util.showSnackbarImmediately
+import net.mullvad.mullvadvpn.lib.model.CustomList
import net.mullvad.mullvadvpn.lib.model.CustomListId
+import net.mullvad.mullvadvpn.lib.model.CustomListName
import net.mullvad.mullvadvpn.lib.model.RelayItem
import net.mullvad.mullvadvpn.lib.model.RelayItemId
import net.mullvad.mullvadvpn.lib.theme.AppTheme
@@ -365,6 +367,7 @@ fun SelectLocationScreen(
bottomSheetState =
ShowCustomListsEntryBottomSheet(
listItem.parentId,
+ listItem.parentName,
listItem.item
)
}
@@ -589,7 +592,8 @@ private fun BottomSheets(
CustomListEntryBottomSheet(
sheetState = sheetState,
onBackgroundColor = onBackgroundColor,
- customListId = bottomSheetState.parentId,
+ customListId = bottomSheetState.customListId,
+ customListName = bottomSheetState.customListName,
item = bottomSheetState.item,
onRemoveLocationFromList = onRemoveLocationFromList,
closeBottomSheet = onCloseBottomSheet
@@ -784,6 +788,7 @@ private fun CustomListEntryBottomSheet(
onBackgroundColor: Color,
sheetState: SheetState,
customListId: CustomListId,
+ customListName: CustomListName,
item: RelayItem.Location,
onRemoveLocationFromList: (location: RelayItem.Location, customListId: CustomListId) -> Unit,
closeBottomSheet: (animate: Boolean) -> Unit
@@ -794,7 +799,8 @@ private fun CustomListEntryBottomSheet(
modifier = Modifier.testTag(SELECT_LOCATION_LOCATION_BOTTOM_SHEET_TEST_TAG)
) {
HeaderCell(
- text = stringResource(id = R.string.remove_location_from_list, item.name),
+ text =
+ stringResource(id = R.string.remove_location_from_list, item.name, customListName),
background = Color.Unspecified
)
HorizontalDivider(color = onBackgroundColor)
@@ -902,7 +908,8 @@ sealed interface BottomSheetState {
data class ShowCustomListsBottomSheet(val editListEnabled: Boolean) : BottomSheetState
data class ShowCustomListsEntryBottomSheet(
- val parentId: CustomListId,
+ val customListId: CustomListId,
+ val customListName: CustomListName,
val item: RelayItem.Location
) : BottomSheetState
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/SelectLocationUiState.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/SelectLocationUiState.kt
index 5d6b683116..88d557c532 100644
--- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/SelectLocationUiState.kt
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/SelectLocationUiState.kt
@@ -1,6 +1,7 @@
package net.mullvad.mullvadvpn.compose.state
import net.mullvad.mullvadvpn.lib.model.CustomListId
+import net.mullvad.mullvadvpn.lib.model.CustomListName
import net.mullvad.mullvadvpn.lib.model.RelayItem
typealias ModelOwnership = net.mullvad.mullvadvpn.lib.model.Ownership
@@ -60,6 +61,7 @@ sealed interface RelayListItem {
data class CustomListEntryItem(
val parentId: CustomListId,
+ val parentName: CustomListName,
val item: RelayItem.Location,
override val expanded: Boolean,
override val depth: Int = 0
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/SelectLocationViewModel.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/SelectLocationViewModel.kt
index a219bb976b..1cd17b9ba1 100644
--- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/SelectLocationViewModel.kt
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/SelectLocationViewModel.kt
@@ -214,7 +214,7 @@ class SelectLocationViewModel(
if (expanded) {
addAll(
customList.locations.flatMap {
- createCustomListEntry(parent = customList.id, item = it, 1, isExpanded)
+ createCustomListEntry(parent = customList, item = it, 1, isExpanded)
}
)
}
@@ -240,15 +240,16 @@ class SelectLocationViewModel(
}
private fun createCustomListEntry(
- parent: CustomListId,
+ parent: RelayItem.CustomList,
item: RelayItem.Location,
depth: Int = 1,
isExpanded: (String) -> Boolean,
): List<RelayListItem.CustomListEntryItem> = buildList {
- val expanded = isExpanded(item.id.expandKey(parent))
+ val expanded = isExpanded(item.id.expandKey(parent.id))
add(
RelayListItem.CustomListEntryItem(
- parentId = parent,
+ parentId = parent.id,
+ parentName = parent.customList.name,
item = item,
expanded = expanded,
depth
diff --git a/android/lib/resource/src/main/res/values/strings.xml b/android/lib/resource/src/main/res/values/strings.xml
index 531a9b046b..c5b884b745 100644
--- a/android/lib/resource/src/main/res/values/strings.xml
+++ b/android/lib/resource/src/main/res/values/strings.xml
@@ -310,7 +310,7 @@
<string name="discard_changes">Discard changes?</string>
<string name="discard">Discard</string>
<string name="add_location_to_list">Add %s to list</string>
- <string name="remove_location_from_list">Remove %s from list</string>
+ <string name="remove_location_from_list">Remove %s from %s</string>
<string name="location_was_added_to_list">%s was added to \"%s\"</string>
<string name="location_added">%s (added)</string>
<string name="edit_name">Edit name</string>