mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-20 12:09:45 +01:00
parent
820b1897be
commit
bae7eaea09
@ -84,7 +84,6 @@ import com.nextcloud.talk.utils.bundle.BundleKeys;
|
||||
import com.nextcloud.talk.utils.database.arbitrarystorage.ArbitraryStorageUtils;
|
||||
import com.nextcloud.talk.utils.preferences.AppPreferences;
|
||||
import com.nextcloud.talk.utils.singletons.ApplicationWideCurrentRoomHolder;
|
||||
import com.vanniktech.emoji.emoji.Emoji;
|
||||
|
||||
import org.parceler.Parcels;
|
||||
|
||||
@ -154,6 +153,12 @@ public class NotificationWorker extends Worker {
|
||||
}
|
||||
|
||||
|
||||
if (DoNotDisturbUtils.INSTANCE.isDnDActive()) {
|
||||
if (!DoNotDisturbUtils.INSTANCE.isInDoNotDisturbWithPriority() || !importantConversation || muteCall) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ncApi.getRoom(credentials, ApiUtils.getRoom(userEntity.getBaseUrl(),
|
||||
intent.getExtras().getString(BundleKeys.INSTANCE.getKEY_ROOM_TOKEN())))
|
||||
.blockingSubscribe(new Observer<RoomOverall>() {
|
||||
@ -474,7 +479,7 @@ public class NotificationWorker extends Worker {
|
||||
notificationManager.notify(notificationId, notification);
|
||||
|
||||
|
||||
if (!notification.category.equals(Notification.CATEGORY_CALL) || !muteCall) {
|
||||
if (!notification.category.equals(Notification.CATEGORY_CALL)) {
|
||||
String ringtonePreferencesString;
|
||||
Uri soundUri;
|
||||
|
||||
|
@ -28,6 +28,37 @@ import android.os.Vibrator
|
||||
import com.nextcloud.talk.application.NextcloudTalkApplication
|
||||
|
||||
object DoNotDisturbUtils {
|
||||
fun isDnDActive() : Boolean {
|
||||
val context = NextcloudTalkApplication.sharedApplication?.applicationContext
|
||||
|
||||
val notificationManager = context?.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
if (notificationManager.currentInterruptionFilter == NotificationManager
|
||||
.INTERRUPTION_FILTER_NONE || notificationManager
|
||||
.currentInterruptionFilter == NotificationManager
|
||||
.INTERRUPTION_FILTER_ALARMS || notificationManager
|
||||
.currentInterruptionFilter == NotificationManager.INTERRUPTION_FILTER_PRIORITY) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
|
||||
}
|
||||
|
||||
fun isInDoNotDisturbWithPriority(): Boolean {
|
||||
val context = NextcloudTalkApplication.sharedApplication?.applicationContext
|
||||
|
||||
val notificationManager = context?.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
if (notificationManager.currentInterruptionFilter == NotificationManager.INTERRUPTION_FILTER_PRIORITY) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
fun shouldPlaySound(): Boolean {
|
||||
val context = NextcloudTalkApplication.sharedApplication?.applicationContext
|
||||
|
||||
|
@ -201,10 +201,9 @@
|
||||
<string name="nc_notify_me_mention">Notify when mentioned</string>
|
||||
<string name="nc_notify_me_never">Never notify</string>
|
||||
<string name="nc_mute_calls">Mute calls</string>
|
||||
<string name="nc_mute_calls_desc">Incoming calls will be silenced</string>
|
||||
<string name="nc_mute_calls_desc">Incoming calls will be ignored</string>
|
||||
<string name="nc_important_conversation">Important conversation</string>
|
||||
<string name="nc_important_conversation_desc">Notifications in this conversation will override
|
||||
Do Not Disturb settings</string>
|
||||
<string name="nc_important_conversation_desc">Calls and message notifications will be shown even while in Do not disturb mode (follows system "Allow priority interruptions only" configuration)</string>
|
||||
|
||||
<!-- Bottom sheet menu -->
|
||||
<string name="nc_failed_to_perform_operation">Sorry, something went wrong!</string>
|
||||
@ -298,5 +297,5 @@
|
||||
<string name="nc_lobby_waiting">You are currently waiting in the lobby.</string>
|
||||
<string name="nc_lobby_waiting_with_date">You are currently waiting in the lobby.\n This
|
||||
meeting is scheduled for %1$s.</string>
|
||||
<string name="nc_manual">Manual</string>
|
||||
<string name="nc_manual">Not set</string>
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user