Fixes crash when pasting an invalid NIP-47 uri into the zap settings

This commit is contained in:
Vitor Pamplona
2025-08-28 10:41:22 -04:00
parent 4be1a143e6
commit da5816a6c6
2 changed files with 12 additions and 1 deletions

View File

@@ -341,7 +341,14 @@ fun UpdateZapAmountContent(
IconButton(
onClick = {
clipboardManager.getText()?.let { postViewModel.copyFromClipboard(it.text) }
val uri = clipboardManager.getText()?.text
try {
uri?.let {
postViewModel.copyFromClipboard(it)
}
} catch (e: IllegalArgumentException) {
accountViewModel.toastManager.toast(R.string.invalid_nip47_uri_title, R.string.invalid_nip47_uri_description)
}
},
) {
Icon(

View File

@@ -787,6 +787,10 @@
<string name="paste_from_clipboard">Paste from clipboard</string>
<string name="invalid_nip47_uri_title">Invalid NIP-47 URI</string>
<string name="invalid_nip47_uri_description">The URI %1$s is not a valid NIP-47 login URI.</string>
<string name="language_description">For the App\'s Interface</string>
<string name="theme_description">Dark, Light or System theme</string>
<string name="automatically_load_images_gifs_description">Automatically load images and GIFs</string>