diff options
author | Christian Schneppe <christian@pix-art.de> | 2019-07-01 08:42:54 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2019-07-01 08:42:54 +0200 |
commit | 037932dc02ff27cd452cd37378aa66d0bfcd5d7f (patch) | |
tree | 4bb9f580df46f1b2f3520a58d470d9849cec555e /src/standardPush/java/de/pixart/messenger | |
parent | 66a57e01292d576dc7df6480ad8f3fa9090094d5 (diff) |
attempt to unregister when receiving push for channel no longer joined
when receiving a FCM push message for a channel the user is no longer in (this can happen when the disable command failed) an attempt will be made to explicitly unregister from the app server (which in turn will then send item-not-found on next push)
Diffstat (limited to '')
-rw-r--r-- | src/standardPush/java/de/pixart/messenger/services/PushManagementService.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/standardPush/java/de/pixart/messenger/services/PushManagementService.java b/src/standardPush/java/de/pixart/messenger/services/PushManagementService.java index bc41ef1e6..13251ce6a 100644 --- a/src/standardPush/java/de/pixart/messenger/services/PushManagementService.java +++ b/src/standardPush/java/de/pixart/messenger/services/PushManagementService.java @@ -62,6 +62,19 @@ public class PushManagementService { }); } + public void unregisterChannel(final Account account, final String channel) { + final String androidId = PhoneHelper.getAndroidId(mXmppConnectionService); + final Jid appServer = getAppServer(); + final IqPacket packet = mXmppConnectionService.getIqGenerator().unregisterChannelOnAppServer(appServer, androidId, channel); + mXmppConnectionService.sendIqPacket(account, packet, (a, response) -> { + if (response.getType() == IqPacket.TYPE.RESULT) { + Log.d(Config.LOGTAG, a.getJid().asBareJid() + ": successfully unregistered channel"); + } else if (response.getType() == IqPacket.TYPE.ERROR) { + Log.d(Config.LOGTAG, a.getJid().asBareJid() + ": unable to unregister channel with hash " + channel); + } + }); + } + void registerPushTokenOnServer(final Conversation conversation) { Log.d(Config.LOGTAG, conversation.getAccount().getJid().asBareJid() + ": room " + conversation.getJid().asBareJid() + " has push support"); retrieveFcmInstanceToken(token -> { |