Whyfi-eSIM/buildSrc/src/main/kotlin/im/angry/openeuicc/build/RelatedApps.kt
septs a75478dd31 feat: assets statements (#304)
see https://developer.chrome.com/docs/capabilities/get-installed-related-apps?hl=en

Reviewed-on: PeterCxy/OpenEUICC#304
Co-authored-by: septs <github@septs.pw>
Co-committed-by: septs <github@septs.pw>
2026-02-24 00:22:23 +01:00

18 lines
662 B
Kotlin

package im.angry.openeuicc.build
import com.android.build.api.dsl.VariantDimension
import groovy.json.JsonOutput
import groovy.json.StringEscapeUtils
/**
* https://web.dev/get-installed-related-apps/?hl=en
*/
fun VariantDimension.emitAssetStatements(vararg sites: String) {
val relation = listOf("delegate_permission/common.handle_all_urls")
val statements = sites.map {
val target = mapOf("namespace" to "web", "site" to it)
mapOf("relation" to relation, "target" to target)
}
val output = JsonOutput.toJson(statements)
resValue(type = "string", name = "asset_statements", value = StringEscapeUtils.escapeJava(output))
}