Fix swipe-back triggering unwanted draft deletion signing

When swiping back on a DM screen with an empty message, the BackHandler
was calling sendDraftSync() which checks if the message is blank and then
calls deleteDraftIgnoreErrors(). This creates and signs a NIP-09 DeletionEvent,
prompting the external signer to sign a deletion event.

The fix adds a check to only call sendDraftSync() when there's actual
content in the message, avoiding the unnecessary signing prompt.
This commit is contained in:
Nathan Day
2026-03-16 10:32:18 +00:00
parent 78ffd5ec6b
commit 1c663cb26b
@@ -88,10 +88,12 @@ fun PrivateMessageEditFieldRow(
nav: INav,
) {
BackHandler {
accountViewModel.launchSigner {
channelScreenModel.sendDraftSync()
channelScreenModel.cancel()
if (channelScreenModel.message.text.isNotBlank()) {
accountViewModel.launchSigner {
channelScreenModel.sendDraftSync()
}
}
channelScreenModel.cancel()
nav.popBack()
}