From a9c6f69561c71ca2942410a385827d65dc1bdb8a Mon Sep 17 00:00:00 2001 From: Josh Soref <2119212+jsoref@users.noreply.github.com> Date: Wed, 9 Nov 2022 13:33:48 -0500 Subject: [PATCH] Warn about losing media (#2784) Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> --- .../tusky/components/compose/ComposeActivity.kt | 9 ++++++++- app/src/main/res/values/strings.xml | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeActivity.kt b/app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeActivity.kt index d8b1c204b..70f9d94dd 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeActivity.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeActivity.kt @@ -1113,8 +1113,15 @@ class ComposeActivity : val contentText = binding.composeEditField.text.toString() val contentWarning = binding.composeContentWarningField.text.toString() if (viewModel.didChange(contentText, contentWarning)) { + + val warning = if (!viewModel.media.value.isEmpty()) { + R.string.compose_save_draft_loses_media + } else { + R.string.compose_save_draft + } + AlertDialog.Builder(this) - .setMessage(R.string.compose_save_draft) + .setMessage(warning) .setPositiveButton(R.string.action_save) { _, _ -> saveDraftAndFinish(contentText, contentWarning) } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 7387bec18..d27a95145 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -420,6 +420,7 @@ Lock account Requires you to manually approve followers Save draft? + Save draft? (Attachments will be uploaded again when you restore the draft.) Sending post… Error sending post Sending Posts