Merge pull request #18

feat(compose/publish): Add warning dialog when no image description is provided
This commit is contained in:
LucasGGamerM
2023-01-02 12:33:10 -03:00
committed by GitHub
2 changed files with 15 additions and 1 deletions

View File

@@ -917,7 +917,18 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr
}
private void onPublishClick(View v){
publish();
if (!attachments.isEmpty()
&& statusVisibility != StatusPrivacy.DIRECT
&& !attachments.stream().allMatch(attachment -> attachment.description != null && !attachment.description.isBlank())) {
new M3AlertDialogBuilder(getActivity())
.setTitle(R.string.sk_no_image_desc_title)
.setMessage(R.string.sk_no_image_desc)
.setNegativeButton(R.string.cancel, null)
.setPositiveButton(R.string.publish, (dialog, i)-> publish())
.show();
} else {
publish();
}
}
private void publishErrorCallback(ErrorResponse error) {
@@ -1030,6 +1041,7 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr
}
};
if(editingStatus!=null && !redraftStatus){
new EditStatus(req, editingStatus.id)
.setCallback(resCallback)

View File

@@ -131,4 +131,6 @@
<string name="sk_compose_no_draft">Dont draft</string>
<string name="sk_settings_reduce_motion">Reduce motion in animations</string>
<string name="sk_bot_account">This is a bot account</string>
<string name="sk_no_image_desc_title">No Image description</string>
<string name="sk_no_image_desc">The included images have no description. Please consider adding one, to allow visually impaired people to participate.</string>
</resources>