jvmMain.tech.skot.core.components.SKComponentViewMock.kt Maven / Gradle / Ivy
package tech.skot.core.components
import tech.skot.core.view.SKPermission
import tech.skot.core.view.Style
abstract class SKComponentViewMock : SKComponentVC {
override var style: Style? = null
var closeKeyBoardCounter = 0
override fun closeKeyboard() {
closeKeyBoardCounter++
}
val displayMessageMessages: MutableList = mutableListOf()
override fun displayMessage(message: SKComponentVC.Message) {
displayMessageMessages.add(message)
}
@Deprecated("Use displayMessageMessages and filter on type SKComponentVC.Message.Error")
val displayErrorMessages: List
get() = displayMessageMessages.filterIsInstance().map { it.content }
override fun displayErrorMessage(message: String) {
displayMessageMessages.add(SKComponentVC.Message.Error(message))
}
var permissionsOk = emptyList()
override fun requestPermissions(
permissions: List,
onResult: (permissionsOk: List) -> Unit
) {
onResult(permissions.filter { permissionsOk.contains(it) })
}
override fun hasPermission(vararg permission: SKPermission): Boolean {
return permission.all {
permissionsOk.contains(it)
}
}
var removed = false
override fun onRemove() {
removed = true
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy