From 814e74db2d10bfff02c987fbf7a06d731e867724 Mon Sep 17 00:00:00 2001 From: M66B Date: Thu, 26 Oct 2023 12:49:59 +0200 Subject: [PATCH] Revert "Refactoring" This reverts commit b91575031df24527b7893755782647f744b92850. --- .../eu/faircode/email/CalendarHelper.java | 19 ------------------- .../java/eu/faircode/email/MessageHelper.java | 15 ++++++++++++++- 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/CalendarHelper.java b/app/src/main/java/eu/faircode/email/CalendarHelper.java index 44eff2ef65..6e7557a83e 100644 --- a/app/src/main/java/eu/faircode/email/CalendarHelper.java +++ b/app/src/main/java/eu/faircode/email/CalendarHelper.java @@ -31,8 +31,6 @@ import android.text.TextUtils; import androidx.preference.PreferenceManager; -import org.json.JSONObject; - import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Arrays; @@ -106,23 +104,6 @@ public class CalendarHelper { } } - static Long insert(Context context, ICalendar icalendar, VEvent event, int status, - EntityAccount account, EntityMessage message) { - String selectedAccount; - String selectedName; - try { - JSONObject jselected = new JSONObject(account.calendar); - selectedAccount = jselected.getString("account"); - selectedName = jselected.optString("name", null); - } catch (Throwable ex) { - Log.i(ex); - selectedAccount = account.calendar; - selectedName = null; - } - - return insert(context, icalendar, event, status, selectedAccount, selectedName, message); - } - static Long insert(Context context, ICalendar icalendar, VEvent event, int status, String selectedAccount, String selectedName, EntityMessage message) { Long existId = null; diff --git a/app/src/main/java/eu/faircode/email/MessageHelper.java b/app/src/main/java/eu/faircode/email/MessageHelper.java index 970cc1aed1..a355f3ffcb 100644 --- a/app/src/main/java/eu/faircode/email/MessageHelper.java +++ b/app/src/main/java/eu/faircode/email/MessageHelper.java @@ -71,6 +71,7 @@ import org.bouncycastle.asn1.x509.AlgorithmIdentifier; import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo; import org.commonmark.parser.Parser; import org.commonmark.renderer.html.HtmlRenderer; +import org.json.JSONObject; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.nodes.Node; @@ -4466,7 +4467,19 @@ public class MessageHelper { return; } - CalendarHelper.insert(context, icalendar, event, status, account, message); + String selectedAccount; + String selectedName; + try { + JSONObject jselected = new JSONObject(account.calendar); + selectedAccount = jselected.getString("account"); + selectedName = jselected.optString("name", null); + } catch (Throwable ex) { + Log.i(ex); + selectedAccount = account.calendar; + selectedName = null; + } + + CalendarHelper.insert(context, icalendar, event, status, selectedAccount, selectedName, message); } else EntityLog.log(context, "Unknown event method=" + method.getValue()); } catch (Throwable ex) {