mirror of
https://codeberg.org/tom79/Fedilab.git
synced 2024-12-22 16:50:04 +02:00
Fix #41 - Delete & Redraft cannot be sent
This commit is contained in:
parent
97c926e8dc
commit
ac7dd0484d
4 changed files with 27 additions and 21 deletions
|
@ -172,9 +172,11 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
|
|||
statusDraftList.add(status);
|
||||
|
||||
//Restore a draft with all messages
|
||||
if (statusDraft != null && statusDraft.statusReplyList != null) {
|
||||
if (statusDraft != null) {
|
||||
new Thread(() -> {
|
||||
statusDraft.statusReplyList = SpannableHelper.convertStatus(getApplication().getApplicationContext(), statusDraft.statusReplyList);
|
||||
if (statusDraft.statusReplyList != null) {
|
||||
statusDraft.statusReplyList = SpannableHelper.convertStatus(getApplication().getApplicationContext(), statusDraft.statusReplyList);
|
||||
}
|
||||
Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||
Runnable myRunnable = () -> {
|
||||
if (statusDraft.statusReplyList != null) {
|
||||
|
|
|
@ -208,27 +208,32 @@ public class PostMessageService extends IntentService {
|
|||
if (statuses.get(i).media_attachments != null && statuses.get(i).media_attachments.size() > 0) {
|
||||
attachmentIds = new ArrayList<>();
|
||||
for (Attachment attachment : statuses.get(i).media_attachments) {
|
||||
MultipartBody.Part fileMultipartBody;
|
||||
if (watermark && attachment.mimeType.contains("image")) {
|
||||
fileMultipartBody = Helper.getMultipartBodyWithWM(PostMessageService.this, watermarkText, "file", attachment);
|
||||
if (attachment.id != null) {
|
||||
attachmentIds.add(attachment.id);
|
||||
} else {
|
||||
fileMultipartBody = Helper.getMultipartBody("file", attachment);
|
||||
}
|
||||
Call<Attachment> attachmentCall = mastodonStatusesService.postMedia(token, fileMultipartBody, null, attachment.description, null);
|
||||
if (attachmentCall != null) {
|
||||
try {
|
||||
Response<Attachment> attachmentResponse = attachmentCall.execute();
|
||||
if (attachmentResponse.isSuccessful()) {
|
||||
Attachment attachmentReply = attachmentResponse.body();
|
||||
if (attachmentReply != null) {
|
||||
attachmentIds.add(attachmentReply.id);
|
||||
MultipartBody.Part fileMultipartBody;
|
||||
if (watermark && attachment.mimeType.contains("image")) {
|
||||
fileMultipartBody = Helper.getMultipartBodyWithWM(PostMessageService.this, watermarkText, "file", attachment);
|
||||
} else {
|
||||
fileMultipartBody = Helper.getMultipartBody("file", attachment);
|
||||
}
|
||||
Call<Attachment> attachmentCall = mastodonStatusesService.postMedia(token, fileMultipartBody, null, attachment.description, null);
|
||||
if (attachmentCall != null) {
|
||||
try {
|
||||
Response<Attachment> attachmentResponse = attachmentCall.execute();
|
||||
if (attachmentResponse.isSuccessful()) {
|
||||
Attachment attachmentReply = attachmentResponse.body();
|
||||
if (attachmentReply != null) {
|
||||
attachmentIds.add(attachmentReply.id);
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
error = true;
|
||||
e.printStackTrace();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
error = true;
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
List<String> poll_options = null;
|
||||
|
|
|
@ -1181,9 +1181,7 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
|
|||
ImageViewCompat.setImageTintList(holder.binding.buttonPoll, null);
|
||||
}
|
||||
|
||||
holder.binding.buttonPost.setOnClickListener(v -> {
|
||||
manageDrafts.onSubmit(prepareDraft(statusList, this, account.instance, account.user_id));
|
||||
});
|
||||
holder.binding.buttonPost.setOnClickListener(v -> manageDrafts.onSubmit(prepareDraft(statusList, this, account.instance, account.user_id)));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1201,6 +1201,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
|||
StatusDraft statusDraft = new StatusDraft();
|
||||
statusDraft.statusDraftList = new ArrayList<>();
|
||||
statusDraft.statusReplyList = new ArrayList<>();
|
||||
statusDeleted.id = null;
|
||||
statusDraft.statusDraftList.add(statusDeleted);
|
||||
intent.putExtra(Helper.ARG_STATUS_DRAFT, statusDraft);
|
||||
context.startActivity(intent);
|
||||
|
|
Loading…
Reference in a new issue