1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2025-01-01 12:44:42 +00:00

Reduce transaction time

This commit is contained in:
M66B 2020-11-16 19:06:55 +01:00
parent 45db66b4f7
commit 04f75e1eca
2 changed files with 10 additions and 4 deletions

View file

@ -534,6 +534,9 @@ public class ServiceSend extends ServiceBase implements SharedPreferences.OnShar
if (plain != null && plain)
body = body.replace("<div x-plain=\"true\">", "<div>");
String language = HtmlHelper.getLanguage(this, body);
String preview = HtmlHelper.getPreview(body);
try {
db.beginTransaction();
@ -557,9 +560,9 @@ public class ServiceSend extends ServiceBase implements SharedPreferences.OnShar
Helper.writeText(file, body);
db.message().setMessageContent(message.id,
true,
HtmlHelper.getLanguage(this, body),
language,
parts.isPlainOnly(),
HtmlHelper.getPreview(body),
preview,
parts.getWarnings(message.warning));
EntityAttachment.copy(this, id, message.id);

View file

@ -288,6 +288,9 @@ public class ServiceUI extends IntentService {
if (body != null)
body = "<p>" + body.replaceAll("\\r?\\n", "<br>") + "</p>";
String language = HtmlHelper.getLanguage(this, body);
String preview = HtmlHelper.getPreview(body);
DB db = DB.getInstance(this);
try {
db.beginTransaction();
@ -330,9 +333,9 @@ public class ServiceUI extends IntentService {
db.message().setMessageContent(reply.id,
true,
HtmlHelper.getLanguage(this, body),
language,
plain_only || ref.plain_only,
HtmlHelper.getPreview(body),
preview,
null);
EntityOperation.queue(this, reply, EntityOperation.SEND);