aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/thedevstack/conversationsplus/services/NotificationService.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus/services/NotificationService.java')
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/services/NotificationService.java16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/services/NotificationService.java b/src/main/java/de/thedevstack/conversationsplus/services/NotificationService.java
index c21c90d1..c5ada873 100644
--- a/src/main/java/de/thedevstack/conversationsplus/services/NotificationService.java
+++ b/src/main/java/de/thedevstack/conversationsplus/services/NotificationService.java
@@ -29,9 +29,12 @@ import java.util.List;
import de.thedevstack.conversationsplus.ConversationsPlusApplication;
import de.thedevstack.conversationsplus.ConversationsPlusColors;
import de.thedevstack.conversationsplus.ConversationsPlusPreferences;
+import de.thedevstack.conversationsplus.enums.MessageDirection;
import de.thedevstack.conversationsplus.services.avatar.AvatarCache;
import de.thedevstack.conversationsplus.utils.ImageUtil;
import de.thedevstack.conversationsplus.utils.MessageUtil;
+import de.thedevstack.conversationsplus.utils.XmppSendUtil;
+import de.thedevstack.conversationsplus.xmpp.stanzas.MessagePacket;
import de.tzur.conversations.Settings;
import de.thedevstack.conversationsplus.Config;
import de.thedevstack.conversationsplus.R;
@@ -62,7 +65,7 @@ public class NotificationService {
}
public boolean notify(final Message message) {
- return (message.getStatus() == Message.STATUS_RECEIVED)
+ return MessageUtil.isIncomingMessage(message)
&& !message.isRead()
&& ConversationsPlusPreferences.showNotification()
&& !message.getConversation().isMuted()
@@ -133,9 +136,10 @@ public class NotificationService {
}
public void push(final Message message) {
- if (!notify(message)) {
+ if (message.isMamReceived()) {
return;
}
+ if (notify(message)) {
mXmppConnectionService.updateUnreadCountBadge();
final boolean isScreenOn = mXmppConnectionService.isInteractive();
if (this.mIsInForeground && isScreenOn && this.mOpenConversation == message.getConversation()) {
@@ -154,6 +158,8 @@ public class NotificationService {
}
}
+ }
+
public void clear() {
synchronized (notifications) {
notifications.clear();
@@ -354,11 +360,9 @@ public class NotificationService {
private Message getImage(final Iterable<Message> messages) {
for (final Message message : messages) {
- if (message.getType() != Message.TYPE_TEXT
- && message.getTransferable() == null
+ if (message.getTransferable() == null
&& message.getEncryption() != Message.ENCRYPTION_PGP
- && message.getFileParams() != null
- && message.getFileParams().getHeight() > 0) { // TODO Use FileParams.getMimeType()
+ && MessageUtil.isAttachedFileAnImage(message)) { // TODO Use FileParams.getMimeType()
return message;
}
}