tauri-plugin-widgets 0.3.0

A Tauri plugin to interact with App Widgets on Android, iOS, and macOS (WidgetKit). On Windows/Linux a desktop-widget window approach is supported.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
package git.s00d.widgets

object WidgetSanitizer {
    private val allowed = Regex("[^A-Za-z0-9._-]")

    fun sanitizeGroup(group: String, fallback: String): String {
        val clean = group.trim().replace(allowed, "_")
        return if (clean.isNotEmpty()) clean else fallback
    }

    fun sanitizeKey(key: String): String {
        val clean = key.trim().replace(allowed, "_")
        return clean.ifEmpty { "_" }
    }
}