mirror of https://github.com/M66B/FairEmail.git
Fixed debug/crash info
This commit is contained in:
parent
3cfaeaa5fe
commit
7ea6ba1762
|
@ -44,7 +44,7 @@ public class ApplicationEx extends Application {
|
|||
DB db = null;
|
||||
try {
|
||||
db = DB.getBlockingInstance(ApplicationEx.this);
|
||||
EntityFolder drafts = db.folder().getLocalDrafts();
|
||||
EntityFolder drafts = EntityFolder.getDrafts(ApplicationEx.this, db, -1);
|
||||
if (drafts != null) {
|
||||
Address to = new InternetAddress("marcel+email@faircode.eu", "FairCode");
|
||||
|
||||
|
|
|
@ -19,6 +19,8 @@ package eu.faircode.email;
|
|||
Copyright 2018 by Marcel Bokhorst (M66B)
|
||||
*/
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -103,6 +105,21 @@ public class EntityFolder {
|
|||
@NonNull
|
||||
public Integer after; // days
|
||||
|
||||
static EntityFolder getDrafts(Context context, DB db, long account) {
|
||||
EntityFolder drafts = db.folder().getFolderByType(account, EntityFolder.TYPE_DRAFTS);
|
||||
if (drafts == null)
|
||||
drafts = db.folder().getLocalDrafts();
|
||||
if (drafts == null) {
|
||||
drafts = new EntityFolder();
|
||||
drafts.name = context.getString(R.string.title_folder_local_drafts);
|
||||
drafts.type = EntityFolder.TYPE_DRAFTS;
|
||||
drafts.synchronize = false;
|
||||
drafts.after = 0;
|
||||
drafts.id = db.folder().insertFolder(drafts);
|
||||
}
|
||||
return drafts;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof EntityFolder) {
|
||||
|
|
|
@ -61,7 +61,7 @@ public class FragmentAbout extends FragmentEx {
|
|||
public void run() {
|
||||
try {
|
||||
DB db = DB.getInstance(getContext());
|
||||
EntityFolder drafts = db.folder().getLocalDrafts();
|
||||
EntityFolder drafts = EntityFolder.getDrafts(getContext(), db, -1);
|
||||
if (drafts != null) {
|
||||
StringBuilder info = Helper.getDebugInfo();
|
||||
info.insert(0, getString(R.string.title_debug_info_remark) + "\n\n\n\n");
|
||||
|
|
|
@ -517,17 +517,7 @@ public class FragmentCompose extends FragmentEx {
|
|||
if (ident == null)
|
||||
throw new IllegalArgumentException(getContext().getString(R.string.title_from_missing));
|
||||
|
||||
EntityFolder drafts = db.folder().getFolderByType(ident.account, EntityFolder.TYPE_DRAFTS);
|
||||
if (drafts == null)
|
||||
drafts = db.folder().getLocalDrafts();
|
||||
if (drafts == null) {
|
||||
drafts = new EntityFolder();
|
||||
drafts.name = getContext().getString(R.string.title_folder_local_drafts);
|
||||
drafts.type = EntityFolder.TYPE_DRAFTS;
|
||||
drafts.synchronize = false;
|
||||
drafts.after = 0;
|
||||
db.folder().insertFolder(drafts);
|
||||
}
|
||||
EntityFolder drafts = EntityFolder.getDrafts(getContext(), db, ident.account);
|
||||
|
||||
long rid = args.getLong("rid", -1);
|
||||
String thread = args.getString("thread");
|
||||
|
|
|
@ -408,11 +408,7 @@ public class FragmentMessage extends FragmentEx {
|
|||
try {
|
||||
DB db = DB.getInstance(getContext());
|
||||
EntityMessage draft = db.message().getMessage(id);
|
||||
EntityFolder drafts = db.folder().getFolderByType(draft.account, EntityFolder.TYPE_DRAFTS);
|
||||
if (drafts == null)
|
||||
drafts = db.folder().getLocalDrafts();
|
||||
if (drafts == null)
|
||||
return;
|
||||
EntityFolder drafts = EntityFolder.getDrafts(getContext(), db, draft.account);
|
||||
draft.id = null;
|
||||
draft.folder = drafts.id;
|
||||
draft.id = db.message().insertMessage(draft);
|
||||
|
|
Loading…
Reference in New Issue