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 the name of the custom list in remove location bottom sheet #6589

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -365,6 +367,7 @@ fun SelectLocationScreen(
bottomSheetState =
ShowCustomListsEntryBottomSheet(
listItem.parentId,
listItem.parentName,
listItem.item
)
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
)
}
Expand All @@ -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
Expand Down
1 change: 0 additions & 1 deletion android/lib/resource/src/main/res/values-da/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,6 @@
<string name="redeem">Indløs</string>
<string name="redeem_voucher">Indløs kupon</string>
<string name="remove_button">Fjern</string>
<string name="remove_location_from_list">Fjern %1$s fra listen</string>
<string name="rented">Lejet</string>
<string name="rented_only">Kun lejet</string>
<string name="report_a_problem">Rapporter et problem</string>
Expand Down
1 change: 0 additions & 1 deletion android/lib/resource/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,6 @@
<string name="redeem">Einlösen</string>
<string name="redeem_voucher">Gutschein einlösen</string>
<string name="remove_button">Entfernen</string>
<string name="remove_location_from_list">%1$s aus Liste entfernen</string>
<string name="rented">Gemietet</string>
<string name="rented_only">Nur gemietet</string>
<string name="report_a_problem">Problem melden</string>
Expand Down
1 change: 0 additions & 1 deletion android/lib/resource/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,6 @@
<string name="redeem">Canjear</string>
<string name="redeem_voucher">Canjear cupón</string>
<string name="remove_button">Quitar</string>
<string name="remove_location_from_list">Quitar %1$s de la lista</string>
<string name="rented">Alquilados</string>
<string name="rented_only">Solo alquilados</string>
<string name="report_a_problem">Informar de un problema</string>
Expand Down
1 change: 0 additions & 1 deletion android/lib/resource/src/main/res/values-fi/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,6 @@
<string name="redeem">Lunasta</string>
<string name="redeem_voucher">Lunasta kuponki</string>
<string name="remove_button">Poista</string>
<string name="remove_location_from_list">Poista %1$s luettelosta</string>
<string name="rented">Vuokrattu</string>
<string name="rented_only">Vain vuokratut</string>
<string name="report_a_problem">Raportoi ongelma</string>
Expand Down
1 change: 0 additions & 1 deletion android/lib/resource/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,6 @@
<string name="redeem">Échanger</string>
<string name="redeem_voucher">Échanger un bon</string>
<string name="remove_button">Supprimer</string>
<string name="remove_location_from_list">Supprimer %1$s de la liste</string>
<string name="rented">Loué</string>
<string name="rented_only">Loués uniquement</string>
<string name="report_a_problem">Signaler un problème</string>
Expand Down
1 change: 0 additions & 1 deletion android/lib/resource/src/main/res/values-it/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,6 @@
<string name="redeem">Riscatta</string>
<string name="redeem_voucher">Riscatta voucher</string>
<string name="remove_button">Rimuovi</string>
<string name="remove_location_from_list">Rimuovi %1$s dall\'elenco</string>
<string name="rented">Noleggiato</string>
<string name="rented_only">Solo noleggiati</string>
<string name="report_a_problem">Segnala un problema</string>
Expand Down
1 change: 0 additions & 1 deletion android/lib/resource/src/main/res/values-ja/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,6 @@
<string name="redeem">使用する</string>
<string name="redeem_voucher">バウチャーを使用する</string>
<string name="remove_button">削除</string>
<string name="remove_location_from_list">%1$s をリストから削除する</string>
<string name="rented">レンタルサーバー</string>
<string name="rented_only">レンタルサーバーのみ</string>
<string name="report_a_problem">問題を報告する</string>
Expand Down
1 change: 0 additions & 1 deletion android/lib/resource/src/main/res/values-ko/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,6 @@
<string name="redeem">사용</string>
<string name="redeem_voucher">바우처 사용</string>
<string name="remove_button">제거</string>
<string name="remove_location_from_list">목록에서 %1$s 제거</string>
<string name="rented">대여</string>
<string name="rented_only">대여만</string>
<string name="report_a_problem">문제 신고</string>
Expand Down
1 change: 0 additions & 1 deletion android/lib/resource/src/main/res/values-my/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,6 @@
<string name="redeem">လဲယူရန်</string>
<string name="redeem_voucher">ဘောက်ချာဖြင့် လဲယူရန်</string>
<string name="remove_button">ဖယ်ရှားရန်</string>
<string name="remove_location_from_list">%1$s ကို စာရင်းမှ ဖယ်ရှားပါ</string>
<string name="rented">အငှား</string>
<string name="rented_only">အငှားသီးသန့်</string>
<string name="report_a_problem">ပြဿနာ ရီပို့တ်လုပ်ရန်</string>
Expand Down
1 change: 0 additions & 1 deletion android/lib/resource/src/main/res/values-nb/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,6 @@
<string name="redeem">Løs inn</string>
<string name="redeem_voucher">Løs inn kupong</string>
<string name="remove_button">Fjern</string>
<string name="remove_location_from_list">Fjern %1$s fra listen</string>
<string name="rented">Leid</string>
<string name="rented_only">Kun leid</string>
<string name="report_a_problem">Rapporter et problem</string>
Expand Down
1 change: 0 additions & 1 deletion android/lib/resource/src/main/res/values-nl/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,6 @@
<string name="redeem">Inwisselen</string>
<string name="redeem_voucher">Voucher inwisselen</string>
<string name="remove_button">Verwijderen</string>
<string name="remove_location_from_list">%1$s verwijderen uit lijst</string>
<string name="rented">Gehuurd</string>
<string name="rented_only">Alleen gehuurde</string>
<string name="report_a_problem">Een probleem rapporteren</string>
Expand Down
1 change: 0 additions & 1 deletion android/lib/resource/src/main/res/values-pl/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,6 @@
<string name="redeem">Zrealizuj</string>
<string name="redeem_voucher">Zrealizuj kupon</string>
<string name="remove_button">Usuń</string>
<string name="remove_location_from_list">Usuń lokalizację %1$s z listy</string>
<string name="rented">Wynajmowane</string>
<string name="rented_only">Wyłącznie wynajmowane</string>
<string name="report_a_problem">Zgłoś problem</string>
Expand Down
1 change: 0 additions & 1 deletion android/lib/resource/src/main/res/values-pt/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,6 @@
<string name="redeem">Reclamar</string>
<string name="redeem_voucher">Reclamar voucher</string>
<string name="remove_button">Remover</string>
<string name="remove_location_from_list">Remover %1$s da lista</string>
<string name="rented">Alugado</string>
<string name="rented_only">Apenas alugado</string>
<string name="report_a_problem">Reportar um problema</string>
Expand Down
1 change: 0 additions & 1 deletion android/lib/resource/src/main/res/values-ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,6 @@
<string name="redeem">Погасить</string>
<string name="redeem_voucher">Погасить ваучер</string>
<string name="remove_button">Удалить</string>
<string name="remove_location_from_list">Удалить местоположение %1$s из списка</string>
<string name="rented">Арендованные</string>
<string name="rented_only">Только арендованные</string>
<string name="report_a_problem">Сообщение о проблеме</string>
Expand Down
1 change: 0 additions & 1 deletion android/lib/resource/src/main/res/values-sv/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,6 @@
<string name="redeem">Lös in</string>
<string name="redeem_voucher">Lös in kupong</string>
<string name="remove_button">Ta bort</string>
<string name="remove_location_from_list">Ta bort %1$s från listan</string>
<string name="rented">Hyrd</string>
<string name="rented_only">Endast hyrd</string>
<string name="report_a_problem">Rapportera ett problem</string>
Expand Down
1 change: 0 additions & 1 deletion android/lib/resource/src/main/res/values-th/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,6 @@
<string name="redeem">แลกรับ</string>
<string name="redeem_voucher">แลกบัตรกำนัล</string>
<string name="remove_button">ลบ</string>
<string name="remove_location_from_list">ลบ %1$s ออกจากรายการ</string>
<string name="rented">เช่า</string>
<string name="rented_only">เช่าเท่านั้น</string>
<string name="report_a_problem">รายงานปัญหา</string>
Expand Down
1 change: 0 additions & 1 deletion android/lib/resource/src/main/res/values-tr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,6 @@
<string name="redeem">Kullan</string>
<string name="redeem_voucher">Kuponu kullan</string>
<string name="remove_button">Kaldır</string>
<string name="remove_location_from_list">%1$s konumunu listeden kaldır</string>
<string name="rented">Kiralananlar</string>
<string name="rented_only">Sadece kiralananlar</string>
<string name="report_a_problem">Bir sorun bildir</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,6 @@
<string name="redeem">兑换</string>
<string name="redeem_voucher">兑换优惠券</string>
<string name="remove_button">移除</string>
<string name="remove_location_from_list">从列表中移除%1$s</string>
<string name="rented">租用</string>
<string name="rented_only">仅租用</string>
<string name="report_a_problem">报告问题</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,6 @@
<string name="redeem">兌換</string>
<string name="redeem_voucher">兌換憑證</string>
<string name="remove_button">移除</string>
<string name="remove_location_from_list">從清單中移除 %1$s</string>
<string name="rented">租用</string>
<string name="rented_only">僅租用</string>
<string name="report_a_problem">回報問題</string>
Expand Down
2 changes: 1 addition & 1 deletion android/lib/resource/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion gui/locales/messages.pot
Original file line number Diff line number Diff line change
Expand Up @@ -2405,7 +2405,7 @@ msgstr ""
msgid "Remove"
msgstr ""

msgid "Remove %s from list"
msgid "Remove %s from %s"
msgstr ""

msgid "Remove custom port"
Expand Down
Loading