From ac3926cfbf29c6e1ca62a66f318efad666d17a19 Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Mon, 21 May 2018 20:55:52 +0200 Subject: make fcm receiver ignore messages when all accounts are disabled --- .../java/de/pixart/messenger/services/PushMessageReceiver.java | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/standardPush') diff --git a/src/standardPush/java/de/pixart/messenger/services/PushMessageReceiver.java b/src/standardPush/java/de/pixart/messenger/services/PushMessageReceiver.java index ffbb93425..d45ded454 100644 --- a/src/standardPush/java/de/pixart/messenger/services/PushMessageReceiver.java +++ b/src/standardPush/java/de/pixart/messenger/services/PushMessageReceiver.java @@ -1,13 +1,20 @@ package de.pixart.messenger.services; import android.content.Intent; +import android.util.Log; import java.util.Map; +import de.pixart.messenger.Config; + public class PushMessageReceiver extends FirebaseMessagingService { @Override public void onMessageReceived(RemoteMessage message) { + if (!EventReceiver.hasEnabledAccounts(this)) { + Log.d(Config.LOGTAG, "PushMessageReceiver ignored message because no accounts are enabled"); + return; + } Map data = message.getData(); Intent intent = new Intent(this, XmppConnectionService.class); intent.setAction(XmppConnectionService.ACTION_FCM_MESSAGE_RECEIVED); -- cgit v1.2.3