Merge pull request #4408 from deltachat/adb/issue-4152

add a setting to enable/disable calls notification
This commit is contained in:
adb
2026-05-07 18:19:27 +02:00
committed by GitHub
3 changed files with 19 additions and 0 deletions
@@ -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<Intent> 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);