From 380abd52982cd41c784cc0f56f7fb732f16bed8a Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 18 Jan 2019 19:32:44 +0000 Subject: [PATCH] Select identity for debug info --- app/src/main/java/eu/faircode/email/Helper.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/src/main/java/eu/faircode/email/Helper.java b/app/src/main/java/eu/faircode/email/Helper.java index 568bb206d4..3cd3e84703 100644 --- a/app/src/main/java/eu/faircode/email/Helper.java +++ b/app/src/main/java/eu/faircode/email/Helper.java @@ -309,9 +309,20 @@ public class Helper { if (drafts == null) throw new IllegalArgumentException(context.getString(R.string.title_no_primary_drafts)); + List identities = db.identity().getIdentities(drafts.account); + EntityIdentity primary = null; + for (EntityIdentity identity : identities) { + if (identity.primary) { + primary = identity; + break; + } else if (primary == null) + primary = identity; + } + draft = new EntityMessage(); draft.account = drafts.account; draft.folder = drafts.id; + draft.identity = (primary == null ? null : primary.id); draft.msgid = EntityMessage.generateMessageId(); draft.to = new Address[]{Helper.myAddress()}; draft.subject = context.getString(R.string.app_name) + " " + BuildConfig.VERSION_NAME + " debug info";