From 6a1a144ca34563e9b4af65ba70dba9c888edff95 Mon Sep 17 00:00:00 2001 From: Thomas Date: Thu, 9 Mar 2023 17:31:41 +0100 Subject: [PATCH] extend media description warning to cross boost --- .../mastodon/ui/drawer/StatusAdapter.java | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/StatusAdapter.java b/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/StatusAdapter.java index e6edbc3a9..3cea4c187 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/StatusAdapter.java +++ b/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/StatusAdapter.java @@ -985,7 +985,27 @@ public class StatusAdapter extends RecyclerView.Adapter if (statusToDeal.visibility.equals("direct") || (statusToDeal.visibility.equals("private"))) { return true; } - CrossActionHelper.doCrossAction(context, CrossActionHelper.TypeOfCrossAction.REBLOG_ACTION, null, statusToDeal); + boolean needToWarnForMissingDescription = false; + if (warnNoMedia && statusToDeal.media_attachments != null && statusToDeal.media_attachments.size() > 0) { + for (Attachment attachment : statusToDeal.media_attachments) { + if (attachment.description == null || attachment.description.trim().length() == 0) { + needToWarnForMissingDescription = true; + break; + } + } + } + if (needToWarnForMissingDescription) { + AlertDialog.Builder alt_bld = new MaterialAlertDialogBuilder(context); + alt_bld.setMessage(context.getString(R.string.reblog_missing_description)); + alt_bld.setPositiveButton(R.string.yes, (dialog, id) -> { + CrossActionHelper.doCrossAction(context, CrossActionHelper.TypeOfCrossAction.REBLOG_ACTION, null, statusToDeal); + }); + alt_bld.setNegativeButton(R.string.cancel, (dialog, id) -> dialog.dismiss()); + AlertDialog alert = alt_bld.create(); + alert.show(); + } else { + CrossActionHelper.doCrossAction(context, CrossActionHelper.TypeOfCrossAction.REBLOG_ACTION, null, statusToDeal); + } return true; }); holder.binding.actionButtonBoost.setOnClickListener(v -> {