From dc8243fd19e4b275e4c62e6d8916079b6e81728b Mon Sep 17 00:00:00 2001 From: Thomas Date: Wed, 5 Oct 2022 11:46:10 +0200 Subject: [PATCH] Fix issue when sending messages with images --- .../java/app/fedilab/android/activities/ComposeActivity.java | 1 + .../app/fedilab/android/client/entities/app/StatusDraft.java | 5 ++++- .../main/java/app/fedilab/android/jobs/ComposeWorker.java | 1 - 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/app/fedilab/android/activities/ComposeActivity.java b/app/src/main/java/app/fedilab/android/activities/ComposeActivity.java index 217037624..115a7ad5b 100644 --- a/app/src/main/java/app/fedilab/android/activities/ComposeActivity.java +++ b/app/src/main/java/app/fedilab/android/activities/ComposeActivity.java @@ -848,6 +848,7 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana .setExpedited(OutOfQuotaPolicy.RUN_AS_NON_EXPEDITED_WORK_REQUEST) .build(); WorkManager.getInstance(ComposeActivity.this).enqueue(request); + } else { new ThreadMessageService(ComposeActivity.this, instance, account.user_id, token, statusDraft, scheduledDate); } diff --git a/app/src/main/java/app/fedilab/android/client/entities/app/StatusDraft.java b/app/src/main/java/app/fedilab/android/client/entities/app/StatusDraft.java index fd915a581..83e760751 100644 --- a/app/src/main/java/app/fedilab/android/client/entities/app/StatusDraft.java +++ b/app/src/main/java/app/fedilab/android/client/entities/app/StatusDraft.java @@ -346,7 +346,10 @@ public class StatusDraft implements Serializable { } try { Cursor c = db.query(Sqlite.TABLE_STATUS_DRAFT, null, Sqlite.COL_ID + " = '" + draftId + "'", null, null, null, null, "1"); - return convertCursorToStatusDraft(c); + c.moveToFirst(); + StatusDraft statusDraft = convertCursorToStatusDraft(c); + c.close(); + return statusDraft; } catch (Exception e) { return null; } diff --git a/app/src/main/java/app/fedilab/android/jobs/ComposeWorker.java b/app/src/main/java/app/fedilab/android/jobs/ComposeWorker.java index 1c86b72c4..532565d12 100644 --- a/app/src/main/java/app/fedilab/android/jobs/ComposeWorker.java +++ b/app/src/main/java/app/fedilab/android/jobs/ComposeWorker.java @@ -400,7 +400,6 @@ public class ComposeWorker extends Worker { @NonNull private ForegroundInfo createForegroundInfo() { // Build a notification using bytesRead and contentLength - Context context = getApplicationContext(); // This PendingIntent can be used to cancel the worker PendingIntent intent = WorkManager.getInstance(context)