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>
This commit is contained in:
Josh Soref 2022-11-09 13:33:48 -05:00 committed by GitHub
parent 1fb58a9116
commit a9c6f69561
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -1113,8 +1113,15 @@ class ComposeActivity :
val contentText = binding.composeEditField.text.toString() val contentText = binding.composeEditField.text.toString()
val contentWarning = binding.composeContentWarningField.text.toString() val contentWarning = binding.composeContentWarningField.text.toString()
if (viewModel.didChange(contentText, contentWarning)) { 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) AlertDialog.Builder(this)
.setMessage(R.string.compose_save_draft) .setMessage(warning)
.setPositiveButton(R.string.action_save) { _, _ -> .setPositiveButton(R.string.action_save) { _, _ ->
saveDraftAndFinish(contentText, contentWarning) saveDraftAndFinish(contentText, contentWarning)
} }

View File

@ -420,6 +420,7 @@
<string name="lock_account_label">Lock account</string> <string name="lock_account_label">Lock account</string>
<string name="lock_account_label_description">Requires you to manually approve followers</string> <string name="lock_account_label_description">Requires you to manually approve followers</string>
<string name="compose_save_draft">Save draft?</string> <string name="compose_save_draft">Save draft?</string>
<string name="compose_save_draft_loses_media">Save draft? (Attachments will be uploaded again when you restore the draft.)</string>
<string name="send_post_notification_title">Sending post…</string> <string name="send_post_notification_title">Sending post…</string>
<string name="send_post_notification_error_title">Error sending post</string> <string name="send_post_notification_error_title">Error sending post</string>
<string name="send_post_notification_channel_name">Sending Posts</string> <string name="send_post_notification_channel_name">Sending Posts</string>