Copy attachments to sent folder

This commit is contained in:
M66B
2019-01-22 18:02:30 +00:00
parent 5d8ad7ef9c
commit ee7771dedd
3 changed files with 25 additions and 18 deletions

View File

@@ -27,7 +27,6 @@ import org.json.JSONException;
import java.io.IOException;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import androidx.annotation.NonNull;
import androidx.room.Entity;
@@ -184,23 +183,7 @@ public class EntityOperation {
db.message().setMessageContent(newid, false, null);
}
List<EntityAttachment> attachments = db.attachment().getAttachments(message.id);
for (EntityAttachment attachment : attachments) {
long aid = attachment.id;
attachment.id = null;
attachment.message = newid;
attachment.progress = null;
attachment.id = db.attachment().insertAttachment(attachment);
if (attachment.available)
try {
Helper.copy(
EntityAttachment.getFile(context, aid),
EntityAttachment.getFile(context, attachment.id));
} catch (IOException ex) {
Log.e(ex);
db.attachment().setProgress(attachment.id, null);
}
}
EntityAttachment.copy(context, db, message.id, newid);
}
} else if (DELETE.equals(name))