提交 58eeebf9 authored 作者: Charley's avatar Charley

主动拉取extMsg

上级 60a79cc6
......@@ -21,6 +21,8 @@ class FluwxPlugin : FlutterPlugin, MethodCallHandler, ActivityAware {
companion object {
var callingChannel:MethodChannel? = null
// 主动获取的启动参数
var extMsg:String? = null
@JvmStatic
fun registerWith(registrar: PluginRegistry.Registrar) {
......@@ -66,6 +68,7 @@ class FluwxPlugin : FlutterPlugin, MethodCallHandler, ActivityAware {
call.method == "openWXApp" -> openWXApp(result)
call.method.startsWith("share") -> shareHandler?.share(call, result)
call.method == "isWeChatInstalled" -> WXAPiHandler.checkWeChatInstallation(result)
call.method == "getExtMsg" -> getExtMsg(result)
else -> result.notImplemented()
}
}
......@@ -92,6 +95,10 @@ class FluwxPlugin : FlutterPlugin, MethodCallHandler, ActivityAware {
}
private fun getExtMsg(result: MethodChannel.Result) {
result.success(extMsg)
}
private fun pay(call: MethodCall, result: MethodChannel.Result) {
if (WXAPiHandler.wxApi == null) {
......
......@@ -53,6 +53,7 @@ object FluwxRequestHandler {
val result = mapOf(
"extMsg" to req.message.messageExt
)
FluwxPlugin.extMsg = req.message.messageExt;
FluwxPlugin.callingChannel?.invokeMethod("onWXShowMessageFromWX", result)
}
......
......@@ -75,6 +75,15 @@ class ShareSelectorPage extends StatelessWidget {
return Center(
child: new ListView(
children: <Widget>[
Padding(
padding: const EdgeInsets.all(8.0),
child: new OutlineButton(
onPressed: () async {
String extMsg = await getExtMsg();
print("extMsg:$extMsg\n");
},
child: const Text("Get ExtMessage")),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: new OutlineButton(
......
......@@ -73,7 +73,7 @@ packages:
path: ".."
relative: true
source: path
version: "2.4.2"
version: "2.6.3"
matcher:
dependency: transitive
description:
......
......@@ -80,6 +80,11 @@ Future<bool> registerWxApi(
});
}
// get ext Message
Future<String> getExtMsg() async {
return await _channel.invokeMethod("getExtMsg");
}
///Share your requests to WeChat.
///This depends on the actual type of [model].
///see [_shareModelMethodMapper] for detail.
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论