git » sdk » commit f5281b6

Update UI when going in/out of sync

author Stephen Paul Weber
2024-07-10 19:00:09 UTC
committer Stephen Paul Weber
2024-07-10 19:00:09 UTC
parent b6b046072583933a7dbfbc4a06b2e94952416eac

Update UI when going in/out of sync

snikket/Chat.hx +3 -2

diff --git a/snikket/Chat.hx b/snikket/Chat.hx
index 38eb0de..ec76b7b 100644
--- a/snikket/Chat.hx
+++ b/snikket/Chat.hx
@@ -681,6 +681,7 @@ class Channel extends Chat {
 					(shouldRefreshDisco ? refreshDisco : (cb)->cb())(() -> {
 						presence = []; // About to ask for a fresh set
 						inSync = false;
+						client.trigger("chats/update", [this]);
 						final desiredFullJid = JID.parse(chatId).withResource(client.displayName());
 						client.sendPresence(
 							desiredFullJid.asString(),
@@ -751,8 +752,8 @@ class Channel extends Chat {
 				if (lastFromSync != null && (lastMessageTimestamp() == null || Reflect.compare(lastFromSync.timestamp, lastMessageTimestamp()) > 0)) {
 					setLastMessage(lastFromSync);
 					client.sortChats();
-					client.trigger("chats/update", [this]);
 				}
+				client.trigger("chats/update", [this]);
 			}
 		});
 		sync.onError((stanza) -> {
@@ -796,7 +797,7 @@ class Channel extends Chat {
 	}
 
 	override public function syncing() {
-		return !inSync && livePresence();
+		return !inSync || !livePresence();
 	}
 
 	private function nickInUse() {