handle saving draft when attachment not uploaded
closes sk22#402
This commit is contained in:
parent
dae347a29f
commit
12558c3c18
|
@ -1248,7 +1248,14 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr
|
||||||
}
|
}
|
||||||
|
|
||||||
private void confirmDiscardDraftAndFinish(){
|
private void confirmDiscardDraftAndFinish(){
|
||||||
new M3AlertDialogBuilder(getActivity())
|
boolean attachmentsPending = attachments.stream().anyMatch(att -> att.state != AttachmentUploadState.DONE);
|
||||||
|
if (attachmentsPending) new M3AlertDialogBuilder(getActivity())
|
||||||
|
.setTitle(R.string.sk_unfinished_attachments)
|
||||||
|
.setMessage(R.string.sk_unfinished_attachments_message)
|
||||||
|
.setPositiveButton(R.string.edit, (d, w) -> {})
|
||||||
|
.setNegativeButton(R.string.discard, (d, w) -> Nav.finish(this))
|
||||||
|
.show();
|
||||||
|
else new M3AlertDialogBuilder(getActivity())
|
||||||
.setTitle(editingStatus != null ? R.string.sk_confirm_save_changes : R.string.sk_confirm_save_draft)
|
.setTitle(editingStatus != null ? R.string.sk_confirm_save_changes : R.string.sk_confirm_save_draft)
|
||||||
.setPositiveButton(R.string.save, (d, w) -> {
|
.setPositiveButton(R.string.save, (d, w) -> {
|
||||||
updateScheduledAt(scheduledAt == null ? getDraftInstant() : scheduledAt);
|
updateScheduledAt(scheduledAt == null ? getDraftInstant() : scheduledAt);
|
||||||
|
|
|
@ -256,4 +256,6 @@
|
||||||
<string name="sk_expand">Expand</string>
|
<string name="sk_expand">Expand</string>
|
||||||
<string name="sk_collapse">Collapse</string>
|
<string name="sk_collapse">Collapse</string>
|
||||||
<string name="sk_settings_collapse_long_posts">Collapse very long posts</string>
|
<string name="sk_settings_collapse_long_posts">Collapse very long posts</string>
|
||||||
|
<string name="sk_unfinished_attachments">Fix attachments?</string>
|
||||||
|
<string name="sk_unfinished_attachments_message">Some attachments haven’t finished uploading.</string>
|
||||||
</resources>
|
</resources>
|
Loading…
Reference in New Issue