diff options
author | Christian Schneppe <christian@pix-art.de> | 2017-05-31 21:12:47 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2017-05-31 21:12:47 +0200 |
commit | a63146118140e6d2cad0d35ce00a105b8dfe72c0 (patch) | |
tree | a66ae4d8b69f4af05bfa87d3a849125e4d7b7b3c /src/main/java/de/pixart/messenger/xmpp | |
parent | f6c5da6d56a07867169db2ff68a52cbf9621cf9b (diff) |
synchronize on dedicated lock for catchup instead of account
Diffstat (limited to 'src/main/java/de/pixart/messenger/xmpp')
-rw-r--r-- | src/main/java/de/pixart/messenger/xmpp/XmppConnection.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java b/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java index cfb6751f4..7a4aa15fd 100644 --- a/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java +++ b/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java @@ -65,6 +65,7 @@ import de.pixart.messenger.entities.Account; import de.pixart.messenger.entities.Message; import de.pixart.messenger.entities.ServiceDiscoveryResult; import de.pixart.messenger.generator.IqGenerator; +import de.pixart.messenger.services.NotificationService; import de.pixart.messenger.services.XmppConnectionService; import de.pixart.messenger.ui.EditAccountActivity; import de.pixart.messenger.utils.DNSHelper; @@ -648,15 +649,20 @@ public class XmppConnection implements Runnable { final AckPacket ack = new AckPacket(this.stanzasReceived, smVersion); tagWriter.writeStanzaAsync(ack); } else if (nextTag.isStart("a")) { - synchronized (account) { + boolean accountUiNeedsRefresh = false; + synchronized (NotificationService.CATCHUP_LOCK) { if (mWaitingForSmCatchup.compareAndSet(true, false)) { int count = mSmCatchupMessageCounter.get(); Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": SM catchup complete (" + count + ")"); + accountUiNeedsRefresh = true; if (count > 0) { mXmppConnectionService.getNotificationService().finishBacklog(true, account); } } } + if (accountUiNeedsRefresh) { + mXmppConnectionService.updateAccountUi(); + } final Element ack = tagReader.readElement(nextTag); lastPacketReceived = SystemClock.elapsedRealtime(); try { |