From 96c160eb62fd1cf85fb3fab4637bc4ffcc33cacd Mon Sep 17 00:00:00 2001 From: M66B Date: Mon, 12 Apr 2021 10:30:49 +0200 Subject: [PATCH] Link to message thread --- .../main/java/eu/faircode/email/ActivityMain.java | 12 +++++++++--- .../main/java/eu/faircode/email/AdapterMessage.java | 4 +--- .../main/java/eu/faircode/email/EntityMessage.java | 5 +++++ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/ActivityMain.java b/app/src/main/java/eu/faircode/email/ActivityMain.java index 8882e7941b..7fc71b6dcc 100644 --- a/app/src/main/java/eu/faircode/email/ActivityMain.java +++ b/app/src/main/java/eu/faircode/email/ActivityMain.java @@ -66,12 +66,18 @@ public class ActivityMain extends ActivityBase implements FragmentManager.OnBack if (path == null) return null; String[] parts = path.split("/"); - if (parts.length < 1) + if (parts.length < 3) return null; - long id = Long.parseLong(parts[1]); + + long account = Long.parseLong(parts[1]); + String msgid = parts[2]; DB db = DB.getInstance(context); - return db.message().getMessage(id); + List messages = db.message().getMessagesByMsgId(account, msgid); + if (messages == null || messages.size() == 0) + return null; + + return messages.get(0); } @Override diff --git a/app/src/main/java/eu/faircode/email/AdapterMessage.java b/app/src/main/java/eu/faircode/email/AdapterMessage.java index 5a21d4fc50..2aec4fd688 100644 --- a/app/src/main/java/eu/faircode/email/AdapterMessage.java +++ b/app/src/main/java/eu/faircode/email/AdapterMessage.java @@ -4825,13 +4825,11 @@ public class AdapterMessage extends RecyclerView.Adapter'; } + String getLink() { + return "message://" + BuildConfig.APPLICATION_ID + "/" + this.account + "/" + Uri.encode(this.msgid); + } + boolean replySelf(List identities, long account) { Address[] senders = (reply == null || reply.length == 0 ? from : reply); if (identities != null && senders != null)