mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-03-31 14:06:05 +00:00
remove non-total methods
This commit is contained in:
@@ -474,14 +474,17 @@ object ChatModel {
|
||||
}
|
||||
|
||||
fun removeLastChatItems() {
|
||||
val removed: Triple<Long, Int, Boolean>
|
||||
val remIndex: Int
|
||||
val rem: ChatItem?
|
||||
chatItems.value = SnapshotStateList<ChatItem>().apply {
|
||||
addAll(chatItems.value)
|
||||
val remIndex = lastIndex
|
||||
val rem = removeLast()
|
||||
removed = Triple(rem.id, remIndex, rem.isRcvNew)
|
||||
remIndex = lastIndex
|
||||
rem = removeLastOrNull()
|
||||
}
|
||||
if (rem != null) {
|
||||
val removed = Triple(rem.id, remIndex, rem.isRcvNew)
|
||||
chatState.itemsRemoved(listOf(removed), chatItems.value)
|
||||
}
|
||||
chatState.itemsRemoved(listOf(removed), chatItems.value)
|
||||
}
|
||||
|
||||
suspend fun addChatItem(rhId: Long?, chatInfo: ChatInfo, cItem: ChatItem) {
|
||||
|
||||
@@ -32,7 +32,7 @@ val databaseBackend: String = if (appPlatform == AppPlatform.ANDROID) "sqlite" e
|
||||
|
||||
class FifoQueue<E>(private var capacity: Int) : LinkedList<E>() {
|
||||
override fun add(element: E): Boolean {
|
||||
if(size > capacity) removeFirst()
|
||||
if (size > capacity) removeFirstOrNull()
|
||||
return super.add(element)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user