diff --git a/CHANGELOG.md b/CHANGELOG.md index 52bb99220..dc7cdb3f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ * Show more recent added stickers at the top of the sticker picker * Allow to open links in messages via actions in TalkBack menu * Allow to open map if user clicks "Location streaming enabled" system message +* Allow to disable incoming calls notifications * Fix: do not accidentally set draft in chats that don't allow sending messages ## v2.49.0 diff --git a/src/main/java/org/thoughtcrime/securesms/preferences/NotificationsPreferenceFragment.java b/src/main/java/org/thoughtcrime/securesms/preferences/NotificationsPreferenceFragment.java index 68d0f599f..17dfd06c2 100644 --- a/src/main/java/org/thoughtcrime/securesms/preferences/NotificationsPreferenceFragment.java +++ b/src/main/java/org/thoughtcrime/securesms/preferences/NotificationsPreferenceFragment.java @@ -39,6 +39,7 @@ public class NotificationsPreferenceFragment extends ListSummaryPreferenceFragme private CheckBoxPreference ignoreBattery; private CheckBoxPreference notificationsEnabled; private CheckBoxPreference mentionNotifEnabled; + private CheckBoxPreference notifyCalls; private CheckBoxPreference reliableService; private ActivityResultLauncher ringtonePickerLauncher; @@ -137,6 +138,16 @@ public class NotificationsPreferenceFragment extends ListSummaryPreferenceFragme return true; }); } + + notifyCalls = this.findPreference("pref_notify_calls"); + if (notifyCalls != null) { + notifyCalls.setOnPreferenceChangeListener( + (preference, newValue) -> { + boolean enabled = (Boolean) newValue; + dcContext.setConfig("who_can_call_me", enabled ? "1" : "2"); + return true; + }); + } } @Override @@ -156,6 +167,7 @@ public class NotificationsPreferenceFragment extends ListSummaryPreferenceFragme notificationsEnabled.setChecked(!dcContext.isMuted()); notificationsEnabled.setSummary(getSummary(getContext(), false)); mentionNotifEnabled.setChecked(dcContext.isMentionsEnabled()); + notifyCalls.setChecked(dcContext.getConfig("who_can_call_me") != "2"); // set without altering "unset" state of the preference reliableService.setOnPreferenceChangeListener(null); diff --git a/src/main/res/xml/preferences_notifications.xml b/src/main/res/xml/preferences_notifications.xml index 603b5ed28..23964b49a 100644 --- a/src/main/res/xml/preferences_notifications.xml +++ b/src/main/res/xml/preferences_notifications.xml @@ -56,6 +56,12 @@ android:title="@string/pref_in_chat_sounds" android:defaultValue="true" /> + +