diff --git a/app/schemas/eu.faircode.email.DB/1.json b/app/schemas/eu.faircode.email.DB/1.json index 57b2db602d..9a486f8317 100644 --- a/app/schemas/eu.faircode.email.DB/1.json +++ b/app/schemas/eu.faircode.email.DB/1.json @@ -2,7 +2,7 @@ "formatVersion": 1, "database": { "version": 1, - "identityHash": "23016f9b3ae09175ada077c837687ab6", + "identityHash": "cd3cf378d6f71c13ba8beb38a8bf58cf", "entities": [ { "tableName": "identity", @@ -313,7 +313,7 @@ }, { "tableName": "message", - "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `account` INTEGER, `folder` INTEGER NOT NULL, `identity` INTEGER, `replying` INTEGER, `uid` INTEGER, `msgid` TEXT, `references` TEXT, `inreplyto` TEXT, `thread` TEXT, `from` TEXT, `to` TEXT, `cc` TEXT, `bcc` TEXT, `reply` TEXT, `subject` TEXT, `body` TEXT, `sent` INTEGER, `received` INTEGER NOT NULL, `stored` INTEGER NOT NULL, `seen` INTEGER NOT NULL, `ui_seen` INTEGER NOT NULL, `ui_hide` INTEGER NOT NULL, `error` TEXT, FOREIGN KEY(`account`) REFERENCES `account`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`folder`) REFERENCES `folder`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`identity`) REFERENCES `identity`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`replying`) REFERENCES `message`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `account` INTEGER, `folder` INTEGER NOT NULL, `identity` INTEGER, `replying` INTEGER, `uid` INTEGER, `msgid` TEXT, `references` TEXT, `inreplyto` TEXT, `thread` TEXT, `from` TEXT, `to` TEXT, `cc` TEXT, `bcc` TEXT, `reply` TEXT, `subject` TEXT, `sent` INTEGER, `received` INTEGER NOT NULL, `stored` INTEGER NOT NULL, `seen` INTEGER NOT NULL, `ui_seen` INTEGER NOT NULL, `ui_hide` INTEGER NOT NULL, `error` TEXT, FOREIGN KEY(`account`) REFERENCES `account`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`folder`) REFERENCES `folder`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`identity`) REFERENCES `identity`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`replying`) REFERENCES `message`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )", "fields": [ { "fieldPath": "id", @@ -411,12 +411,6 @@ "affinity": "TEXT", "notNull": false }, - { - "fieldPath": "body", - "columnName": "body", - "affinity": "TEXT", - "notNull": false - }, { "fieldPath": "sent", "columnName": "sent", @@ -599,7 +593,7 @@ }, { "tableName": "attachment", - "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `message` INTEGER NOT NULL, `sequence` INTEGER NOT NULL, `name` TEXT, `type` TEXT NOT NULL, `size` INTEGER, `progress` INTEGER, `filename` TEXT, FOREIGN KEY(`message`) REFERENCES `message`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `message` INTEGER NOT NULL, `sequence` INTEGER NOT NULL, `name` TEXT, `type` TEXT NOT NULL, `size` INTEGER, `progress` INTEGER, `available` INTEGER NOT NULL, FOREIGN KEY(`message`) REFERENCES `message`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )", "fields": [ { "fieldPath": "id", @@ -644,10 +638,10 @@ "notNull": false }, { - "fieldPath": "filename", - "columnName": "filename", - "affinity": "TEXT", - "notNull": false + "fieldPath": "available", + "columnName": "available", + "affinity": "INTEGER", + "notNull": true } ], "primaryKey": { @@ -782,7 +776,7 @@ ], "setupQueries": [ "CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)", - "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, \"23016f9b3ae09175ada077c837687ab6\")" + "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, \"cd3cf378d6f71c13ba8beb38a8bf58cf\")" ] } } \ No newline at end of file diff --git a/app/src/main/java/eu/faircode/email/ActivityView.java b/app/src/main/java/eu/faircode/email/ActivityView.java index 542cab7746..94c3f4f1a4 100644 --- a/app/src/main/java/eu/faircode/email/ActivityView.java +++ b/app/src/main/java/eu/faircode/email/ActivityView.java @@ -225,6 +225,8 @@ public class ActivityView extends ActivityBase implements FragmentManager.OnBack file.delete(); + String body = "
" + sb.toString().replaceAll("\\r?\\n", "
") + "";
+
EntityMessage draft = null;
DB db = DB.getInstance(context);
@@ -239,12 +241,12 @@ public class ActivityView extends ActivityBase implements FragmentManager.OnBack
draft.msgid = EntityMessage.generateMessageId();
draft.to = new Address[]{Helper.myAddress()};
draft.subject = context.getString(R.string.app_name) + " crash log";
- draft.body = "" + sb.toString().replaceAll("\\r?\\n", "
") + "";
draft.received = new Date().getTime();
draft.seen = false;
draft.ui_seen = false;
draft.ui_hide = false;
draft.id = db.message().insertMessage(draft);
+ draft.write(context, body);
}
EntityOperation.queue(db, draft, EntityOperation.ADD);
diff --git a/app/src/main/java/eu/faircode/email/AdapterAttachment.java b/app/src/main/java/eu/faircode/email/AdapterAttachment.java
index 394e66ec6c..5cdecd5170 100644
--- a/app/src/main/java/eu/faircode/email/AdapterAttachment.java
+++ b/app/src/main/java/eu/faircode/email/AdapterAttachment.java
@@ -64,7 +64,6 @@ public class AdapterAttachment extends RecyclerView.Adapter" + sb.toString().replaceAll("\\r?\\n", "
") + "";
draft.received = new Date().getTime();
draft.seen = false;
draft.ui_seen = false;
draft.ui_hide = false;
draft.id = db.message().insertMessage(draft);
+ draft.write(context, body);
EntityOperation.queue(db, draft, EntityOperation.ADD);
db.setTransactionSuccessful();
+ } catch (IOException ex) {
+ Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
+ return null;
} finally {
db.endTransaction();
}
@@ -118,9 +125,10 @@ public class FragmentAbout extends FragmentEx {
@Override
protected void onLoaded(Bundle args, Long id) {
btnDebugInfo.setEnabled(true);
- startActivity(new Intent(getContext(), ActivityCompose.class)
- .putExtra("action", "edit")
- .putExtra("id", id));
+ if (id != null)
+ startActivity(new Intent(getContext(), ActivityCompose.class)
+ .putExtra("action", "edit")
+ .putExtra("id", id));
}
@Override
diff --git a/app/src/main/java/eu/faircode/email/FragmentCompose.java b/app/src/main/java/eu/faircode/email/FragmentCompose.java
index 80da6041d7..0bb8e31d2e 100644
--- a/app/src/main/java/eu/faircode/email/FragmentCompose.java
+++ b/app/src/main/java/eu/faircode/email/FragmentCompose.java
@@ -30,6 +30,7 @@ import android.os.Handler;
import android.provider.ContactsContract;
import android.provider.OpenableColumns;
import android.text.Html;
+import android.text.Spanned;
import android.text.TextUtils;
import android.util.Log;
import android.view.KeyEvent;
@@ -516,7 +517,7 @@ public class FragmentCompose extends FragmentEx {
attachment.size = size;
attachment.progress = null;
- attachment.filename = file.getName();
+ attachment.available = true;
db.attachment().updateAttachment(attachment);
} finally {
try {
@@ -530,7 +531,6 @@ public class FragmentCompose extends FragmentEx {
} catch (Throwable ex) {
// Reset progress on failure
attachment.progress = null;
- attachment.filename = null;
db.attachment().updateAttachment(attachment);
throw ex;
}
@@ -571,7 +571,7 @@ public class FragmentCompose extends FragmentEx {
private SimpleTask" + body.replaceAll("\\r?\\n", "
") + "";
draft.received = new Date().getTime();
+ body = "" + body.replaceAll("\\r?\\n", "
") + "";
+
// Execute action
if (action == R.id.action_trash) {
draft.ui_seen = true;
draft.ui_hide = true;
db.message().updateMessage(draft);
+ draft.write(context, body);
EntityOperation.queue(db, draft, EntityOperation.SEEN, true);
@@ -857,11 +877,13 @@ public class FragmentCompose extends FragmentEx {
return null;
db.message().updateMessage(draft);
+ draft.write(context, body);
EntityOperation.queue(db, draft, EntityOperation.ADD);
} else if (action == R.id.action_send) {
db.message().updateMessage(draft);
+ draft.write(context, body);
// Check data
if (draft.identity == null)
@@ -876,7 +898,7 @@ public class FragmentCompose extends FragmentEx {
// Save attachments
List