jsbridge源码 https://github.com/lzyzsd/JsBridge
1.基于jsbridge,处理外部设置WebViewClient导致jsbridge失效的问题
2.隔离jsbridge的实现
interface WebApi {
@H5ToNative(methodName = "submitFromWeb")
fun submitFromWeb(@Field returnData: String, @CallBack h5CallBack: H5CallBack)
@NativeToH5(methodName = "functionInJs")
fun functionInJs(@Field responseData: String, @CallBack h5CallBack: H5CallBack)
}
val webApi = H5Retrofit.getInstance(commonFragment?.getWebView()).create(WebApi::class.java)
webApi?.functionInJs(Gson().toJson(user),object :H5CallBack{
override fun callBack(data: String) {
Log.e("德玛","h5返回数据$data")
}
})
webApi?.submitFromWeb("submitFromWeb exe, response data 中文 from Java",object :H5CallBack{
override fun callBack(data: String) {
Log.e("德玛","h5返回参数$data")
}
})