From 3fa74d95dfca098ceff3090c3772dc917b67af64 Mon Sep 17 00:00:00 2001 From: M66B Date: Thu, 12 Jun 2025 10:09:30 +0200 Subject: [PATCH] Added option to store email address of attendees --- .../eu/faircode/email/CalendarHelper.java | 8 ++++++-- .../faircode/email/FragmentOptionsMisc.java | 19 +++++++++++++++---- .../main/res/layout/fragment_options_misc.xml | 18 +++++++++++++++--- app/src/main/res/values/strings.xml | 1 + 4 files changed, 37 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/CalendarHelper.java b/app/src/main/java/eu/faircode/email/CalendarHelper.java index 93d8b00960..e6c348047b 100644 --- a/app/src/main/java/eu/faircode/email/CalendarHelper.java +++ b/app/src/main/java/eu/faircode/email/CalendarHelper.java @@ -323,6 +323,9 @@ public class CalendarHelper { eventId = existId; } + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); + boolean ical_email = prefs.getBoolean("ical_email", false); + for (Attendee a : event.getAttendees()) try { String email = a.getEmail(); @@ -334,8 +337,9 @@ public class CalendarHelper { ContentValues avalues = new ContentValues(); - //if (!TextUtils.isEmpty(email)) - // avalues.put(CalendarContract.Attendees.ATTENDEE_EMAIL, email); + if (!TextUtils.isEmpty(email) && ical_email) + avalues.put(CalendarContract.Attendees.ATTENDEE_EMAIL, email); + if (TextUtils.isEmpty(name)) name = email; if (!TextUtils.isEmpty(name)) diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java b/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java index 9fea8cacf1..a5a516fc8f 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java @@ -114,7 +114,8 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc private SwitchCompat swExternalAnswer; private SwitchCompat swShortcuts; private SwitchCompat swICalTentative; - private ImageButton ibICalTentative; + private SwitchCompat swICalEmail; + private ImageButton ibICal; private SwitchCompat swFts; private ImageButton ibFts; private TextView tvFtsIndexed; @@ -287,7 +288,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc private static final long MIN_FILE_SIZE = 1024 * 1024L; final static List RESET_OPTIONS = Collections.unmodifiableList(Arrays.asList( - "sort_answers", "shortcuts", "ical_tentative", "fts", + "sort_answers", "shortcuts", "ical_tentative", "ical_email", "fts", "classification", "class_min_probability", "class_min_difference", "show_filtered", "haptic_feedback", "haptic_feedback_swipe", "language", @@ -383,7 +384,8 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc swExternalAnswer = view.findViewById(R.id.swExternalAnswer); swShortcuts = view.findViewById(R.id.swShortcuts); swICalTentative = view.findViewById(R.id.swICalTentative); - ibICalTentative = view.findViewById(R.id.ibICalTentative); + swICalEmail = view.findViewById(R.id.swICalEmail); + ibICal = view.findViewById(R.id.ibICal); swFts = view.findViewById(R.id.swFts); ibFts = view.findViewById(R.id.ibFts); tvFtsIndexed = view.findViewById(R.id.tvFtsIndexed); @@ -614,7 +616,15 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc } }); - ibICalTentative.setOnClickListener(new View.OnClickListener() { + swICalEmail.setVisibility(BuildConfig.PLAY_STORE_RELEASE ? View.GONE : View.VISIBLE); + swICalEmail.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { + prefs.edit().putBoolean("ical_email", checked).apply(); + } + }); + + ibICal.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Helper.viewFAQ(v.getContext(), 186); @@ -2473,6 +2483,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc swShortcuts.setChecked(prefs.getBoolean("shortcuts", true)); swICalTentative.setChecked(prefs.getBoolean("ical_tentative", true)); swFts.setChecked(prefs.getBoolean("fts", false)); + swICalEmail.setChecked(prefs.getBoolean("ical_email", false)); swClassification.setChecked(prefs.getBoolean("classification", false)); diff --git a/app/src/main/res/layout/fragment_options_misc.xml b/app/src/main/res/layout/fragment_options_misc.xml index 8e7a64667d..34d52b89b1 100644 --- a/app/src/main/res/layout/fragment_options_misc.xml +++ b/app/src/main/res/layout/fragment_options_misc.xml @@ -168,8 +168,20 @@ app:layout_constraintTop_toBottomOf="@id/tvShortcutsHint" app:switchPadding="12dp" /> + + Provide reply templates to other apps Show frequently used contacts in Android share menu Store received invitations as tentative + Store email address of attendees Build search index %1$d / %2$d messages indexed (%3$s) Classify messages