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

主动拉取extMsg

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