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

share response

上级 4b29996a
...@@ -8,7 +8,7 @@ package com.jarvan.fluwx.constant; ...@@ -8,7 +8,7 @@ package com.jarvan.fluwx.constant;
public class WeChatPluginMethods { public class WeChatPluginMethods {
public static final String REGISTER_APP = "registerApp"; public static final String REGISTER_APP = "registerApp";
public static final String UNREGISTER_APP = "unregisterApp"; public static final String UNREGISTER_APP = "unregisterApp";
public static final String WE_CHAT_RESPONSE = "onWeChatResponse"; public static final String WE_CHAT_SHARE_RESPONSE = "onShareResponse";
public static final String SHARE_TEXT = "shareText"; public static final String SHARE_TEXT = "shareText";
public static final String SHARE_IMAGE = "shareImage"; public static final String SHARE_IMAGE = "shareImage";
......
...@@ -335,7 +335,7 @@ object FluwxShareHandler { ...@@ -335,7 +335,7 @@ object FluwxShareHandler {
WechatPluginKeys.PLATFORM to "android" WechatPluginKeys.PLATFORM to "android"
) )
channel?.invokeMethod(WeChatPluginMethods.WE_CHAT_RESPONSE, result) channel?.invokeMethod(WeChatPluginMethods.WE_CHAT_SHARE_RESPONSE, result)
} }
......
...@@ -17,10 +17,10 @@ class Fluwx { ...@@ -17,10 +17,10 @@ class Fluwx {
static const MethodChannel _channel = const MethodChannel('fluwx'); static const MethodChannel _channel = const MethodChannel('fluwx');
StreamController<Map> _responseStreamController = StreamController<Map> _responseFromShareController =
new StreamController.broadcast(); new StreamController.broadcast();
Stream<Map> get weChatResponseUpdate => _responseStreamController.stream; Stream<Map> get responseFromShare => _responseFromShareController.stream;
///the [model] should not be null ///the [model] should not be null
static Future registerApp(RegisterModel model) async { static Future registerApp(RegisterModel model) async {
...@@ -35,9 +35,14 @@ class Fluwx { ...@@ -35,9 +35,14 @@ class Fluwx {
_channel.setMethodCallHandler(_handler); _channel.setMethodCallHandler(_handler);
} }
void dispose() { void disposeAll() {
_responseStreamController.close(); _responseFromShareController.close();
} }
void disposeResponseFromShare(){
_responseFromShareController.close();
}
///the [model] can not be null ///the [model] can not be null
///see [WeChatShareWebPageModel] ///see [WeChatShareWebPageModel]
/// [WeChatShareTextModel] /// [WeChatShareTextModel]
...@@ -54,8 +59,8 @@ class Fluwx { ...@@ -54,8 +59,8 @@ class Fluwx {
} }
Future<dynamic> _handler(MethodCall methodCall) { Future<dynamic> _handler(MethodCall methodCall) {
if ("onWeChatResponse" == methodCall.method) { if ("onShareResponse" == methodCall.method) {
_responseStreamController.add(methodCall.arguments); _responseFromShareController.add(methodCall.arguments);
} }
return Future.value(true); return Future.value(true);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论