Implement priority filtering, rename package, preset URL, update remotes
Some checks failed
Build / Check (push) Has been cancelled

This commit is contained in:
kdusek
2025-11-28 20:06:33 +01:00
parent 547d9fd943
commit afcf93087c
42 changed files with 194 additions and 170 deletions

View File

@@ -0,0 +1,38 @@
package com.github.gotifycustom.messages
import com.github.gotify.client.model.Message
internal object Extras {
fun useMarkdown(message: Message): Boolean = useMarkdown(message.extras)
fun useMarkdown(extras: Map<String, Any>?): Boolean {
if (extras == null) {
return false
}
val display: Any? = extras["client::display"]
if (display !is Map<*, *>) {
return false
}
return "text/markdown" == display["contentType"]
}
fun <T> getNestedValue(clazz: Class<T>, extras: Map<String, Any>?, vararg keys: String): T? {
var value: Any? = extras
keys.forEach { key ->
if (value == null) {
return null
}
value = (value as Map<*, *>)[key]
}
if (!clazz.isInstance(value)) {
return null
}
return clazz.cast(value)
}
}