Updated on 2026-08-14
This commit is contained in:
commit
0c80ff00d0
2 changed files with 9 additions and 2 deletions
|
|
@ -8,4 +8,10 @@ fun <T> List<T>.containsAny(list: List<T>): Boolean {
|
|||
list.forEach { if (it == mainItem) return true }
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
fun <T> MutableList<T>.removeBy(predicate: (T) -> Boolean): Boolean {
|
||||
val toRemove = this.filter(predicate)
|
||||
this.removeAll(toRemove)
|
||||
return toRemove.isNotEmpty()
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@ package com.tangem.tap.domain.configurable.warningMessage
|
|||
import com.tangem.blockchain.common.Blockchain
|
||||
import com.tangem.tangem_sdk_new.ui.animation.VoidCallback
|
||||
import com.tangem.tap.common.extensions.containsAny
|
||||
import com.tangem.tap.common.extensions.removeBy
|
||||
import com.tangem.wallet.R
|
||||
|
||||
/**
|
||||
|
|
@ -61,12 +62,12 @@ class WarningMessagesManager(
|
|||
}
|
||||
|
||||
fun removeWarnings(origin: WarningMessage.Origin) {
|
||||
warningsList.removeIf { it.origin == origin }
|
||||
warningsList.removeBy { it.origin == origin }
|
||||
sortByPriority()
|
||||
}
|
||||
|
||||
fun removeWarnings(messageRes: Int) {
|
||||
warningsList.removeIf { it.messageResId == messageRes }
|
||||
warningsList.removeBy { it.messageResId == messageRes }
|
||||
}
|
||||
|
||||
private fun sortByPriority() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue