Push empty convos to bottom and hide thread date when unknown

This commit is contained in:
Andrew 2024-02-27 10:36:13 +10:30
parent 1a81c7278a
commit 1c38fc000a
2 changed files with 3 additions and 3 deletions

View File

@ -496,7 +496,7 @@ open class Storage(
// create note to self thread if needed (?) // create note to self thread if needed (?)
val address = recipient.address val address = recipient.address
val ourThread = getThreadId(address) ?: getOrCreateThreadIdFor(address).also { val ourThread = getThreadId(address) ?: getOrCreateThreadIdFor(address).also {
setThreadDate(it, SnodeAPI.nowWithOffset - 14.days.inWholeMilliseconds) setThreadDate(it, 0)
} }
DatabaseComponent.get(context).threadDatabase().setHasSent(ourThread, true) DatabaseComponent.get(context).threadDatabase().setHasSent(ourThread, true)
setPinned(ourThread, userProfile.getNtsPriority() > 0) setPinned(ourThread, userProfile.getNtsPriority() > 0)
@ -1188,7 +1188,7 @@ open class Storage(
} else { } else {
( (
getThreadId(address) ?: getOrCreateThreadIdFor(address).also { getThreadId(address) ?: getOrCreateThreadIdFor(address).also {
setThreadDate(it, SnodeAPI.nowWithOffset - 14.days.inWholeMilliseconds) setThreadDate(it, 0)
} }
).also { setPinned(it, contact.priority == PRIORITY_PINNED) } ).also { setPinned(it, contact.priority == PRIORITY_PINNED) }
} }

View File

@ -92,7 +92,7 @@ class ConversationView : LinearLayout {
val senderDisplayName = getUserDisplayName(thread.recipient) val senderDisplayName = getUserDisplayName(thread.recipient)
?: thread.recipient.address.toString() ?: thread.recipient.address.toString()
binding.conversationViewDisplayNameTextView.text = senderDisplayName binding.conversationViewDisplayNameTextView.text = senderDisplayName
binding.timestampTextView.text = DateUtils.getDisplayFormattedTimeSpanString(context, Locale.getDefault(), thread.date) binding.timestampTextView.text = thread.date.takeIf { it != 0L }?.let { DateUtils.getDisplayFormattedTimeSpanString(context, Locale.getDefault(), it) }
val recipient = thread.recipient val recipient = thread.recipient
binding.muteIndicatorImageView.isVisible = recipient.isMuted || recipient.notifyType != NOTIFY_TYPE_ALL binding.muteIndicatorImageView.isVisible = recipient.isMuted || recipient.notifyType != NOTIFY_TYPE_ALL
val drawableRes = if (recipient.isMuted || recipient.notifyType == NOTIFY_TYPE_NONE) { val drawableRes = if (recipient.isMuted || recipient.notifyType == NOTIFY_TYPE_NONE) {