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()
}

View File

@@ -155,5 +155,5 @@
<string name="message">Message</string>
<string name="mode_append">Append to message</string>
<string name="mode_instant">Instantly send</string>
<string name="warning_default_channel">As you have not changed the channel name you are using the default encryption key (any Meshtastic user can read your messages).</string>
<string name="warning_default_psk">Empty channel names use the default encryption key (any device on %s can read your messages).</string>
</resources>