aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/services/NotificationService.java
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-03-09 20:32:19 +0100
committerChristian Schneppe <christian@pix-art.de>2017-03-09 20:32:19 +0100
commit2764f04c14bdc19ee1d267e43bafbffb29257c64 (patch)
tree51e9095f0f7b74daae77003564f79a2c5edf7c07 /src/main/java/de/pixart/messenger/services/NotificationService.java
parent297870eed0559ac7aec0dfd977dc9a8e381dcd3b (diff)
do not notify for messages from strangers by default
Diffstat (limited to '')
-rw-r--r--src/main/java/de/pixart/messenger/services/NotificationService.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/main/java/de/pixart/messenger/services/NotificationService.java b/src/main/java/de/pixart/messenger/services/NotificationService.java
index 3a29275ea..e042d76db 100644
--- a/src/main/java/de/pixart/messenger/services/NotificationService.java
+++ b/src/main/java/de/pixart/messenger/services/NotificationService.java
@@ -65,10 +65,11 @@ public class NotificationService {
}
public boolean notify(final Message message) {
- return (message.getStatus() == Message.STATUS_RECEIVED)
+ return message.getStatus() == Message.STATUS_RECEIVED
&& notificationsEnabled()
&& !message.getConversation().isMuted()
- && (message.getConversation().alwaysNotify() || wasHighlightedOrPrivate(message)
+ && (message.getConversation().alwaysNotify() || wasHighlightedOrPrivate(message))
+ && (!message.getConversation().isWithStranger() || notificationsFromStrangers()
);
}
@@ -76,6 +77,11 @@ public class NotificationService {
return mXmppConnectionService.getPreferences().getBoolean("show_notification", true);
}
+ private boolean notificationsFromStrangers() {
+ return mXmppConnectionService.getPreferences().getBoolean("notifications_from_strangers",
+ mXmppConnectionService.getResources().getBoolean(R.bool.notifications_from_strangers));
+ }
+
public boolean isQuietHours() {
if (!mXmppConnectionService.getPreferences().getBoolean("enable_quiet_hours", false)) {
return false;