mirror of
https://github.com/ev-map/EVMap.git
synced 2026-04-20 22:28:21 -04:00
fix crash when trying to rename a filter profile to a name that already exists
This commit is contained in:
@@ -188,9 +188,17 @@ class FilterProfilesFragment : Fragment() {
|
||||
|
||||
dialog.setTitle(R.string.rename)
|
||||
.setMessage(R.string.save_profile_enter_name)
|
||||
}, {
|
||||
}, { newName ->
|
||||
lifecycleScope.launch {
|
||||
vm.update(fp.copy(name = it))
|
||||
if (vm.filterProfiles.value?.find { it.name == newName } != null) {
|
||||
Snackbar.make(
|
||||
view,
|
||||
R.string.filterprofile_name_not_unique,
|
||||
Snackbar.LENGTH_LONG
|
||||
).show()
|
||||
} else {
|
||||
vm.update(fp.copy(name = newName))
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
@@ -152,6 +152,7 @@
|
||||
<string name="delete">Löschen</string>
|
||||
<string name="save_as_profile">Als Profil speichern</string>
|
||||
<string name="save_profile_enter_name">Gib den Namen des Filterprofils ein:</string>
|
||||
<string name="filterprofile_name_not_unique">Ein Filterprofil mit diesem Namen existiert bereits</string>
|
||||
<string name="filterprofiles_empty_state">Du hast keine Filterprofile gespeichert</string>
|
||||
<string name="welcome_to_evmap">Willkommen bei EVMap</string>
|
||||
<string name="welcome_1">Finde Ladestationen für Elektroautos in deiner Nähe</string>
|
||||
|
||||
@@ -152,6 +152,7 @@
|
||||
<string name="delete">Delete</string>
|
||||
<string name="save_as_profile">Save as profile</string>
|
||||
<string name="save_profile_enter_name">Enter the name of the filter profile:</string>
|
||||
<string name="filterprofile_name_not_unique">There is already a filter profile with that name</string>
|
||||
<string name="filterprofiles_empty_state">You have no filter profiles saved</string>
|
||||
<string name="welcome_to_evmap">Welcome to EVMap</string>
|
||||
<string name="welcome_1">Find electric vehicle chargers around you</string>
|
||||
|
||||
Reference in New Issue
Block a user