提交 e4b1d4d6 authored 作者: JarvanMo's avatar JarvanMo

Merge branch 'master' of github.com:JarvanMo/fluwx

...@@ -30,6 +30,7 @@ class FluwxPlugin(private val registrar: Registrar, channel: MethodChannel) : Me ...@@ -30,6 +30,7 @@ class FluwxPlugin(private val registrar: Registrar, channel: MethodChannel) : Me
fun registerWith(registrar: Registrar): Unit { fun registerWith(registrar: Registrar): Unit {
val channel = MethodChannel(registrar.messenger(), "com.jarvanmo/fluwx") val channel = MethodChannel(registrar.messenger(), "com.jarvanmo/fluwx")
WXAPiHandler.setRegistrar(registrar) WXAPiHandler.setRegistrar(registrar)
FluwxRequestHandler.setRegistrar(registrar)
FluwxResponseHandler.setMethodChannel(channel) FluwxResponseHandler.setMethodChannel(channel)
channel.setMethodCallHandler(FluwxPlugin(registrar, channel)) channel.setMethodCallHandler(FluwxPlugin(registrar, channel))
} }
......
/*
* Copyright (C) 2018 The OpenFlutter Organization
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jarvan.fluwx.handler
import io.flutter.plugin.common.PluginRegistry
object FluwxRequestHandler {
private var registrar: PluginRegistry.Registrar? = null
fun setRegistrar(reg: PluginRegistry.Registrar) {
registrar = reg
}
fun getRegistrar():PluginRegistry.Registrar?{
return registrar;
}
}
\ No newline at end of file
...@@ -58,7 +58,14 @@ open class FluwxWXEntryActivity : Activity(), IWXAPIEventHandler { ...@@ -58,7 +58,14 @@ open class FluwxWXEntryActivity : Activity(), IWXAPIEventHandler {
override fun onReq(baseReq: BaseReq) { override fun onReq(baseReq: BaseReq) {
// FIXME: 可能是官方的Bug,从微信拉起APP的Intent类型不对,无法跳转回Flutter Activity
// 稳定复现场景:微信版本为7.0.5,小程序SDK为2.7.7
val activity = FluwxRequestHandler.getRegistrar()?.activity();
if (baseReq.type == 4 && activity is Activity){
// com.tencent.mm.opensdk.constants.ConstantsAPI.COMMAND_SHOWMESSAGE_FROM_WX = 4
startActivity(Intent(this, activity::class.java))
finish()
}
} }
// 第三方应用发送到微信的请求处理后的响应结果,会回调到该方法 // 第三方应用发送到微信的请求处理后的响应结果,会回调到该方法
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论