Browse Source

Fixed debug/crash info

main
M66B 6 years ago
parent
commit
7ea6ba1762
5 changed files with 21 additions and 18 deletions
  1. +1
    -1
      app/src/main/java/eu/faircode/email/ApplicationEx.java
  2. +17
    -0
      app/src/main/java/eu/faircode/email/EntityFolder.java
  3. +1
    -1
      app/src/main/java/eu/faircode/email/FragmentAbout.java
  4. +1
    -11
      app/src/main/java/eu/faircode/email/FragmentCompose.java
  5. +1
    -5
      app/src/main/java/eu/faircode/email/FragmentMessage.java

+ 1
- 1
app/src/main/java/eu/faircode/email/ApplicationEx.java View File

@ -44,7 +44,7 @@ public class ApplicationEx extends Application {
DB db = null; DB db = null;
try { try {
db = DB.getBlockingInstance(ApplicationEx.this); db = DB.getBlockingInstance(ApplicationEx.this);
EntityFolder drafts = db.folder().getLocalDrafts();
EntityFolder drafts = EntityFolder.getDrafts(ApplicationEx.this, db, -1);
if (drafts != null) { if (drafts != null) {
Address to = new InternetAddress("marcel+email@faircode.eu", "FairCode"); Address to = new InternetAddress("marcel+email@faircode.eu", "FairCode");


+ 17
- 0
app/src/main/java/eu/faircode/email/EntityFolder.java View File

@ -19,6 +19,8 @@ package eu.faircode.email;
Copyright 2018 by Marcel Bokhorst (M66B) Copyright 2018 by Marcel Bokhorst (M66B)
*/ */
import android.content.Context;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@ -103,6 +105,21 @@ public class EntityFolder {
@NonNull @NonNull
public Integer after; // days 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 @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj instanceof EntityFolder) { if (obj instanceof EntityFolder) {


+ 1
- 1
app/src/main/java/eu/faircode/email/FragmentAbout.java View File

@ -61,7 +61,7 @@ public class FragmentAbout extends FragmentEx {
public void run() { public void run() {
try { try {
DB db = DB.getInstance(getContext()); DB db = DB.getInstance(getContext());
EntityFolder drafts = db.folder().getLocalDrafts();
EntityFolder drafts = EntityFolder.getDrafts(getContext(), db, -1);
if (drafts != null) { if (drafts != null) {
StringBuilder info = Helper.getDebugInfo(); StringBuilder info = Helper.getDebugInfo();
info.insert(0, getString(R.string.title_debug_info_remark) + "\n\n\n\n"); info.insert(0, getString(R.string.title_debug_info_remark) + "\n\n\n\n");


+ 1
- 11
app/src/main/java/eu/faircode/email/FragmentCompose.java View File

@ -517,17 +517,7 @@ public class FragmentCompose extends FragmentEx {
if (ident == null) if (ident == null)
throw new IllegalArgumentException(getContext().getString(R.string.title_from_missing)); 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); long rid = args.getLong("rid", -1);
String thread = args.getString("thread"); String thread = args.getString("thread");


+ 1
- 5
app/src/main/java/eu/faircode/email/FragmentMessage.java View File

@ -408,11 +408,7 @@ public class FragmentMessage extends FragmentEx {
try { try {
DB db = DB.getInstance(getContext()); DB db = DB.getInstance(getContext());
EntityMessage draft = db.message().getMessage(id); 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.id = null;
draft.folder = drafts.id; draft.folder = drafts.id;
draft.id = db.message().insertMessage(draft); draft.id = db.message().insertMessage(draft);


Loading…
Cancel
Save