Cancel media uploads when closing ComposeActivity #838 (#1189)

* Cancel media uploads on remove the draft message

* Fix formatting
main
pandasoft0 6 years ago committed by Konrad Pozniak
parent 7ffb06675c
commit 3247cc6f35
  1. 10
      app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java

@ -1539,13 +1539,21 @@ public final class ComposeActivity
new AlertDialog.Builder(this)
.setMessage(R.string.compose_save_draft)
.setPositiveButton(R.string.action_save, (d, w) -> saveDraftAndFinish())
.setNegativeButton(R.string.action_delete, (d, w) -> finishWithoutSlideOutAnimation())
.setNegativeButton(R.string.action_delete, (d, w) -> deleteDraftAndFinish())
.show();
} else {
finishWithoutSlideOutAnimation();
}
}
private void deleteDraftAndFinish() {
for (QueuedMedia media : mediaQueued) {
if (media.uploadRequest != null)
media.uploadRequest.cancel();
}
finishWithoutSlideOutAnimation();
}
private void saveDraftAndFinish() {
ArrayList<String> mediaUris = new ArrayList<>();
ArrayList<String> mediaDescriptions = new ArrayList<>();

Loading…
Cancel
Save