Seperate ring from strangers option

This commit is contained in:
Stephen Paul Weber 2024-11-20 07:11:35 +01:00 committed by Arne
parent 22dbc22393
commit 5b069f5245
4 changed files with 21 additions and 2 deletions

View file

@ -256,9 +256,10 @@ public class JingleConnectionManager extends AbstractConnectionManager {
}
private boolean isWithStrangerAndStrangerNotificationsAreOff(final Account account, Jid with) {
final var chatRequestsPref = mXmppConnectionService.getStringPreference("chat_requests", R.string.default_chat_requests);
final var ringFromStrangers = mXmppConnectionService.getBooleanPreference("ring_from_strangers", R.bool.notifications_from_strangers);
if (ringFromStrangers) return false;
final var conversation = mXmppConnectionService.findOrCreateConversation(account, with, false, true);
return conversation.isChatRequest(chatRequestsPref);
return conversation.isWithStranger();
}
ScheduledFuture<?> schedule(

View file

@ -1343,4 +1343,6 @@
<string name="pref_export_summary">Export data useful for importing into another app. Not a full backup.</string>
<string name="request_to_speak_send">Your request has been sent to the moderators</string>
<string name="pref_create_backup_warning">Full backups are meant for restore after a device loss, or for migrating to a new device. You cannot restore a backup to another app while still being connected with this one!</string>
<string name="pref_ring_from_strangers">Ring calls from strangers</string>
<string name="pref_ring_from_strangers_summary">A stranger is someone not in your contacts to whom you have never sent a message</string>
</resources>

View file

@ -74,6 +74,12 @@
android:key="chat_requests"
android:title="@string/pref_chat_requests"
app:useSimpleSummaryProvider="true" />
<SwitchPreferenceCompat
android:icon="@drawable/ring_volume_24dp"
android:defaultValue="@bool/notifications_from_strangers"
android:key="ring_from_strangers"
android:summary="@string/pref_ring_from_strangers_summary"
android:title="@string/pref_ring_from_strangers" />
<SwitchPreferenceCompat
android:defaultValue="@bool/enable_foreground_service"

View file

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M136,816L44,726Q32,714 32,698Q32,682 44,670Q132,575 247,527.5Q362,480 480,480Q598,480 712.5,527.5Q827,575 916,670Q928,682 928,698Q928,714 916,726L824,816Q813,827 798.5,828Q784,829 772,820L656,732Q648,726 644,718Q640,710 640,700L640,586Q602,574 562,567Q522,560 480,560Q438,560 398,567Q358,574 320,586L320,700Q320,710 316,718Q312,726 304,732L188,820Q176,829 161.5,828Q147,827 136,816ZM440,280L440,80L520,80L520,280L440,280ZM704,394L648,336L790,194L846,252L704,394ZM256,394L114,252L170,194L312,336L256,394Z"/>
</vector>