fix(iap): open external app for payment (#2465)

This commit is contained in:
Huang Xin 2025-11-18 16:37:43 +05:30 committed by GitHub
parent bfac67d3f0
commit 6d5b16ea8b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 179 additions and 4 deletions

View file

@ -75,6 +75,11 @@ class SetScreenBrightnessRequestArgs {
var brightness: Double? = null // 0.0 to 1.0
}
@InvokeArg
class OpenExternalUrlArgs {
var url: String? = null
}
@InvokeArg
class FetchProductsRequestArgs {
val productIds: List<String>? = null
@ -660,4 +665,21 @@ class NativeBridgePlugin(private val activity: Activity): Plugin(activity) {
}
}
}
@Command
fun open_external_url(invoke: Invoke) {
val args = invoke.parseArgs(OpenExternalUrlArgs::class.java)
val url = args.url ?: ""
try {
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url))
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
activity.startActivity(intent)
val ret = JSObject()
ret.put("success", true)
invoke.resolve(ret)
} catch (e: Exception) {
invoke.reject("Failed to open URL: ${e.message}")
}
}
}