From 95ee8459b8d6b9a6d62576c0f439c070999ab72c Mon Sep 17 00:00:00 2001 From: kosyak Date: Mon, 2 Sep 2024 22:16:05 +0200 Subject: [PATCH] don't use jabber last seen in status calculations --- .../eu/siacs/conversations/ui/ConversationsActivity.java | 8 ++++---- .../eu/siacs/conversations/ui/widget/PresenceIndicator.kt | 8 ++------ 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java index 5d7762488..79c70d46b 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java @@ -775,10 +775,10 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio handler.postDelayed(refreshTitleRunnable, 5000L); } else if (conversation.getMode() == Conversation.MODE_SINGLE) { Contact contact = conversation.getContact(); - if (showLastSeen - && contact.getLastseen() > 0 - && contact.getPresences().allOrNonSupport(Namespace.IDLE)) { - actionBar.setSubtitle(UIHelper.lastseen(getApplicationContext(), contact.isActive(), contact.getLastseen(), true)); + List statuses = contact.getPresences().getStatusMessages(); + if (!statuses.isEmpty() && !statuses.get(0).isBlank()) { + actionBar.setSubtitle(statuses.get(0)); + handler.postDelayed(refreshTitleRunnable, 5000L); } else { actionBar.setSubtitle(""); handler.removeCallbacks(refreshTitleRunnable); diff --git a/src/main/java/eu/siacs/conversations/ui/widget/PresenceIndicator.kt b/src/main/java/eu/siacs/conversations/ui/widget/PresenceIndicator.kt index 55ab27809..f4ecaf21e 100644 --- a/src/main/java/eu/siacs/conversations/ui/widget/PresenceIndicator.kt +++ b/src/main/java/eu/siacs/conversations/ui/widget/PresenceIndicator.kt @@ -49,14 +49,10 @@ class PresenceIndicator : View { fun setStatus(contact: Contact?) { val status = contact?.shownStatus - if ((status == Presence.Status.ONLINE || status == Presence.Status.CHAT) && - (contact.lastseen <= 0 || !contact.presences.allOrNonSupport(Namespace.IDLE) || ((System.currentTimeMillis() - contact.lastseen) / 1000) > 60)) { - this.status = null - } else { + if (status != this.status) { this.status = status + invalidate() } - - invalidate() } override fun onDraw(canvas: Canvas) {