Improve warning message

Improve wording and add channel name to the default psk warning

Co-authored-by: Andre K <andrekir@pm.me>
This commit is contained in:
Tom
2022-08-23 10:44:34 +00:00
committed by GitHub
parent 7c940d209a
commit f8cec34862
2 changed files with 10 additions and 8 deletions

View File

@@ -338,16 +338,18 @@ class ChannelFragment : ScreenFragment("Channel"), Logging {
.setRegion(model.region)
.setModemPreset(newModemPreset)
val humanName = Channel(newSettings.build(), newLoRaConfig.build()).humanName
binding.channelNameEdit.setText(humanName)
val message = buildString {
append(getString(R.string.are_you_sure_channel))
if (!shouldUseRandomKey)
append("\n\n" + getString(R.string.warning_default_psk).format(humanName))
}
MaterialAlertDialogBuilder(requireContext())
.setTitle(R.string.change_channel)
.setMessage(buildString {
append(getString(R.string.are_you_sure_channel))
if (!shouldUseRandomKey) {
append("\n\n")
append(getString(R.string.warning_default_channel))
}
})
.setMessage(message)
.setNeutralButton(R.string.cancel) { _, _ ->
setGUIfromModel()
}