Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
clx-fluwx
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
openSourceLibrary
clx-fluwx
Commits
29305aa2
提交
29305aa2
authored
8月 18, 2018
作者:
JarvanMo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1.initWechat reanmed to registerApp,2.add unregisterApp Channel
上级
30186a5e
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
86 行增加
和
48 行删除
+86
-48
FluwxPlugin.kt
android/src/main/kotlin/com/jarvan/fluwx/FluwxPlugin.kt
+7
-8
WeChatPluginMethods.java
...kotlin/com/jarvan/fluwx/constant/WeChatPluginMethods.java
+2
-1
WeChatPluginHandler.kt
...in/kotlin/com/jarvan/fluwx/handler/WeChatPluginHandler.kt
+52
-29
main.dart
example/lib/main.dart
+1
-1
FluwxPlugin.m
ios/Classes/FluwxPlugin.m
+15
-4
FluwxMethods.h
ios/Classes/constants/FluwxMethods.h
+2
-1
FluwxMethods.m
ios/Classes/constants/FluwxMethods.m
+2
-1
fluwx.dart
lib/src/fluwx.dart
+5
-3
没有找到文件。
android/src/main/kotlin/com/jarvan/fluwx/FluwxPlugin.kt
浏览文件 @
29305aa2
package
com.jarvan.fluwx
package
com.jarvan.fluwx
import
android.util.Log
import
com.jarvan.fluwx.constant.CallResult
import
com.jarvan.fluwx.constant.CallResult
import
com.jarvan.fluwx.constant.WeChatPluginMethods
import
com.jarvan.fluwx.constant.WeChatPluginMethods
import
com.jarvan.fluwx.handler.WeChatPluginHandler
import
com.jarvan.fluwx.handler.WeChatPluginHandler
...
@@ -23,19 +22,19 @@ class FluwxPlugin(private var registrar: Registrar) : MethodCallHandler {
...
@@ -23,19 +22,19 @@ class FluwxPlugin(private var registrar: Registrar) : MethodCallHandler {
}
}
override
fun
onMethodCall
(
call
:
MethodCall
,
result
:
Result
):
Unit
{
override
fun
onMethodCall
(
call
:
MethodCall
,
result
:
Result
):
Unit
{
Log
.
e
(
"---"
,
call
.
method
)
if
(
call
.
method
==
WeChatPluginMethods
.
REGISTER_APP
){
if
(
call
.
method
==
WeChatPluginMethods
.
INIT
){
WeChatPluginHandler
.
registerApp
(
call
,
result
)
val
api
=
WXAPIFactory
.
createWXAPI
(
registrar
.
context
().
applicationContext
,
call
.
arguments
as
String
?)
api
.
registerApp
(
call
.
arguments
as
String
)
WeChatPluginHandler
.
setWxApi
(
api
)
return
return
}
}
if
(
WeChatPluginHandler
.
apiIsNull
()){
result
.
error
(
CallResult
.
RESULT_API_NULL
,
"please config wxapi first"
,
null
)
if
(
call
.
method
==
WeChatPluginMethods
.
UNREGISTER_APP
){
WeChatPluginHandler
.
unregisterApp
()
result
.
success
(
true
)
return
return
}
}
if
(
call
.
method
.
startsWith
(
"share"
)){
if
(
call
.
method
.
startsWith
(
"share"
)){
WeChatPluginHandler
.
handle
(
call
,
result
)
WeChatPluginHandler
.
handle
(
call
,
result
)
}
else
{
}
else
{
...
...
android/src/main/kotlin/com/jarvan/fluwx/constant/WeChatPluginMethods.java
浏览文件 @
29305aa2
...
@@ -6,7 +6,8 @@ package com.jarvan.fluwx.constant;
...
@@ -6,7 +6,8 @@ package com.jarvan.fluwx.constant;
* 万里飞雪,将穹苍作烘炉,熔万物为白银。
* 万里飞雪,将穹苍作烘炉,熔万物为白银。
**/
**/
public
class
WeChatPluginMethods
{
public
class
WeChatPluginMethods
{
public
static
final
String
INIT
=
"initWeChat"
;
public
static
final
String
REGISTER_APP
=
"registerApp"
;
public
static
final
String
UNREGISTER_APP
=
"unregisterApp"
;
public
static
final
String
WE_CHAT_RESPONSE
=
"onWeChatResponse"
;
public
static
final
String
WE_CHAT_RESPONSE
=
"onWeChatResponse"
;
public
static
final
String
SHARE_TEXT
=
"shareText"
;
public
static
final
String
SHARE_TEXT
=
"shareText"
;
...
...
android/src/main/kotlin/com/jarvan/fluwx/handler/WeChatPluginHandler.kt
浏览文件 @
29305aa2
package
com.jarvan.fluwx.handler
package
com.jarvan.fluwx.handler
import
android.graphics.BitmapFactory
import
android.util.Log
import
android.util.Log
import
com.jarvan.fluwx.R
import
com.jarvan.fluwx.constant.CallResult
import
com.jarvan.fluwx.constant.CallResult
import
com.jarvan.fluwx.constant.WeChatPluginMethods
import
com.jarvan.fluwx.constant.WeChatPluginMethods
import
com.jarvan.fluwx.constant.WechatPluginKeys
import
com.jarvan.fluwx.constant.WechatPluginKeys
...
@@ -12,6 +10,7 @@ import com.jarvan.fluwx.utils.WeChatThumbnailUtil
...
@@ -12,6 +10,7 @@ import com.jarvan.fluwx.utils.WeChatThumbnailUtil
import
com.tencent.mm.opensdk.modelbase.BaseResp
import
com.tencent.mm.opensdk.modelbase.BaseResp
import
com.tencent.mm.opensdk.modelmsg.*
import
com.tencent.mm.opensdk.modelmsg.*
import
com.tencent.mm.opensdk.openapi.IWXAPI
import
com.tencent.mm.opensdk.openapi.IWXAPI
import
com.tencent.mm.opensdk.openapi.WXAPIFactory
import
io.flutter.plugin.common.MethodCall
import
io.flutter.plugin.common.MethodCall
import
io.flutter.plugin.common.MethodChannel
import
io.flutter.plugin.common.MethodChannel
import
io.flutter.plugin.common.PluginRegistry
import
io.flutter.plugin.common.PluginRegistry
...
@@ -34,14 +33,32 @@ object WeChatPluginHandler {
...
@@ -34,14 +33,32 @@ object WeChatPluginHandler {
private
var
registrar
:
PluginRegistry
.
Registrar
?
=
null
private
var
registrar
:
PluginRegistry
.
Registrar
?
=
null
fun
apiIsNull
()
=
wxApi
==
null
fun
setMethodChannel
(
channel
:
MethodChannel
)
{
fun
setMethodChannel
(
channel
:
MethodChannel
)
{
WeChatPluginHandler
.
channel
=
channel
WeChatPluginHandler
.
channel
=
channel
}
}
fun
setWxApi
(
wxApi
:
IWXAPI
)
{
WeChatPluginHandler
.
wxApi
=
wxApi
fun
registerApp
(
call
:
MethodCall
,
result
:
MethodChannel
.
Result
)
{
if
(
wxApi
!=
null
)
{
result
.
success
(
true
)
return
}
val
appId
=
call
.
arguments
as
String
?
if
(
appId
.
isNullOrBlank
())
{
result
.
error
(
"invalid app id"
,
"are you sure your app id is correct ?"
,
appId
)
return
}
val
api
=
WXAPIFactory
.
createWXAPI
(
registrar
!!
.
context
().
applicationContext
,
appId
)
val
registered
=
api
.
registerApp
(
appId
)
wxApi
=
api
result
.
success
(
registered
)
}
fun
unregisterApp
()
{
wxApi
?.
unregisterApp
()
wxApi
=
null
}
}
fun
setRegistrar
(
registrar
:
PluginRegistry
.
Registrar
)
{
fun
setRegistrar
(
registrar
:
PluginRegistry
.
Registrar
)
{
...
@@ -50,6 +67,11 @@ object WeChatPluginHandler {
...
@@ -50,6 +67,11 @@ object WeChatPluginHandler {
fun
handle
(
call
:
MethodCall
,
result
:
MethodChannel
.
Result
)
{
fun
handle
(
call
:
MethodCall
,
result
:
MethodChannel
.
Result
)
{
if
(
wxApi
==
null
)
{
result
.
error
(
CallResult
.
RESULT_API_NULL
,
"please config wxapi first"
,
null
)
return
}
if
(!
wxApi
!!
.
isWXAppInstalled
)
{
if
(!
wxApi
!!
.
isWXAppInstalled
)
{
result
.
error
(
CallResult
.
RESULT_WE_CHAT_NOT_INSTALLED
,
CallResult
.
RESULT_WE_CHAT_NOT_INSTALLED
,
null
)
result
.
error
(
CallResult
.
RESULT_WE_CHAT_NOT_INSTALLED
,
CallResult
.
RESULT_WE_CHAT_NOT_INSTALLED
,
null
)
return
return
...
@@ -104,7 +126,7 @@ object WeChatPluginHandler {
...
@@ -104,7 +126,7 @@ object WeChatPluginHandler {
if
(
thumbnail
.
isNullOrBlank
())
{
if
(
thumbnail
.
isNullOrBlank
())
{
msg
.
thumbData
=
null
msg
.
thumbData
=
null
}
else
{
}
else
{
msg
.
thumbData
=
getThumbnailByteArrayMiniProgram
(
registrar
,
thumbnail
!!
)
msg
.
thumbData
=
getThumbnailByteArrayMiniProgram
(
registrar
,
thumbnail
!!
)
}
}
val
req
=
SendMessageToWX
.
Req
()
val
req
=
SendMessageToWX
.
Req
()
setCommonArguments
(
call
,
req
,
msg
)
setCommonArguments
(
call
,
req
,
msg
)
...
@@ -116,33 +138,34 @@ object WeChatPluginHandler {
...
@@ -116,33 +138,34 @@ object WeChatPluginHandler {
}
}
private
suspend
fun
getThumbnailByteArrayMiniProgram
(
registrar
:
PluginRegistry
.
Registrar
?,
thumbnail
:
String
):
ByteArray
{
private
suspend
fun
getThumbnailByteArrayMiniProgram
(
registrar
:
PluginRegistry
.
Registrar
?,
thumbnail
:
String
):
ByteArray
{
return
async
(
CommonPool
)
{
return
async
(
CommonPool
)
{
val
result
=
WeChatThumbnailUtil
.
thumbnailForMiniProgram
(
thumbnail
,
registrar
)
val
result
=
WeChatThumbnailUtil
.
thumbnailForMiniProgram
(
thumbnail
,
registrar
)
result
?:
byteArrayOf
()
result
?:
byteArrayOf
()
}.
await
()
}.
await
()
}
}
private
suspend
fun
getImageByteArrayCommon
(
registrar
:
PluginRegistry
.
Registrar
?,
imagePath
:
String
):
ByteArray
{
private
suspend
fun
getImageByteArrayCommon
(
registrar
:
PluginRegistry
.
Registrar
?,
imagePath
:
String
):
ByteArray
{
return
async
(
CommonPool
){
return
async
(
CommonPool
)
{
val
result
=
ShareImageUtil
.
getImageData
(
registrar
,
imagePath
)
val
result
=
ShareImageUtil
.
getImageData
(
registrar
,
imagePath
)
result
?:
byteArrayOf
()
result
?:
byteArrayOf
()
}.
await
()
}.
await
()
}
}
private
suspend
fun
getThumbnailByteArrayCommon
(
registrar
:
PluginRegistry
.
Registrar
?,
thumbnail
:
String
):
ByteArray
{
private
suspend
fun
getThumbnailByteArrayCommon
(
registrar
:
PluginRegistry
.
Registrar
?,
thumbnail
:
String
):
ByteArray
{
return
async
(
CommonPool
){
return
async
(
CommonPool
)
{
val
result
=
WeChatThumbnailUtil
.
thumbnailForCommon
(
thumbnail
,
registrar
)
val
result
=
WeChatThumbnailUtil
.
thumbnailForCommon
(
thumbnail
,
registrar
)
result
?:
byteArrayOf
()
result
?:
byteArrayOf
()
}.
await
()
}.
await
()
}
}
private
fun
shareImage
(
call
:
MethodCall
,
result
:
MethodChannel
.
Result
)
{
private
fun
shareImage
(
call
:
MethodCall
,
result
:
MethodChannel
.
Result
)
{
val
imagePath
=
call
.
argument
<
String
>(
WechatPluginKeys
.
IMAGE
)
val
imagePath
=
call
.
argument
<
String
>(
WechatPluginKeys
.
IMAGE
)
launch
(
UI
){
launch
(
UI
)
{
val
byteArray
:
ByteArray
?
=
getImageByteArrayCommon
(
registrar
,
imagePath
)
val
byteArray
:
ByteArray
?
=
getImageByteArrayCommon
(
registrar
,
imagePath
)
val
imgObj
=
if
(
byteArray
!=
null
&&
byteArray
.
isNotEmpty
())
{
val
imgObj
=
if
(
byteArray
!=
null
&&
byteArray
.
isNotEmpty
())
{
WXImageObject
(
byteArray
)
WXImageObject
(
byteArray
)
...
@@ -155,27 +178,27 @@ object WeChatPluginHandler {
...
@@ -155,27 +178,27 @@ object WeChatPluginHandler {
return
@launch
return
@launch
}
}
var
thumbnail
:
String
?
=
call
.
argument
(
WechatPluginKeys
.
THUMBNAIL
)
var
thumbnail
:
String
?
=
call
.
argument
(
WechatPluginKeys
.
THUMBNAIL
)
if
(
thumbnail
.
isNullOrBlank
()){
if
(
thumbnail
.
isNullOrBlank
())
{
thumbnail
=
imagePath
thumbnail
=
imagePath
}
}
val
thumbnailData
=
getThumbnailByteArrayCommon
(
registrar
,
thumbnail
!!
)
val
thumbnailData
=
getThumbnailByteArrayCommon
(
registrar
,
thumbnail
!!
)
// val thumbnailData = Util.bmpToByteArray(bitmap,true)
// val thumbnailData = Util.bmpToByteArray(bitmap,true)
handleShareImage
(
imgObj
,
call
,
thumbnailData
,
result
)
handleShareImage
(
imgObj
,
call
,
thumbnailData
,
result
)
}
}
}
}
private
fun
handleShareImage
(
imgObj
:
WXImageObject
,
call
:
MethodCall
,
thumbnailData
:
ByteArray
?,
result
:
MethodChannel
.
Result
)
{
private
fun
handleShareImage
(
imgObj
:
WXImageObject
,
call
:
MethodCall
,
thumbnailData
:
ByteArray
?,
result
:
MethodChannel
.
Result
)
{
val
msg
=
WXMediaMessage
()
val
msg
=
WXMediaMessage
()
msg
.
mediaObject
=
imgObj
msg
.
mediaObject
=
imgObj
if
(
thumbnailData
==
null
||
thumbnailData
.
isEmpty
())
{
if
(
thumbnailData
==
null
||
thumbnailData
.
isEmpty
())
{
msg
.
thumbData
=
null
msg
.
thumbData
=
null
}
else
{
}
else
{
msg
.
thumbData
=
thumbnailData
msg
.
thumbData
=
thumbnailData
}
}
...
@@ -197,7 +220,7 @@ object WeChatPluginHandler {
...
@@ -197,7 +220,7 @@ object WeChatPluginHandler {
music
.
musicDataUrl
=
call
.
argument
(
"musicDataUrl"
)
music
.
musicDataUrl
=
call
.
argument
(
"musicDataUrl"
)
}
else
{
}
else
{
music
.
musicLowBandUrl
=
musicLowBandUrl
music
.
musicLowBandUrl
=
musicLowBandUrl
music
.
musicLowBandDataUrl
=
call
.
argument
(
"musicLowBandDataUrl"
)
music
.
musicLowBandDataUrl
=
call
.
argument
(
"musicLowBandDataUrl"
)
}
}
val
msg
=
WXMediaMessage
()
val
msg
=
WXMediaMessage
()
msg
.
mediaObject
=
music
msg
.
mediaObject
=
music
...
@@ -205,9 +228,9 @@ object WeChatPluginHandler {
...
@@ -205,9 +228,9 @@ object WeChatPluginHandler {
msg
.
description
=
call
.
argument
(
"description"
)
msg
.
description
=
call
.
argument
(
"description"
)
val
thumbnail
:
String
?
=
call
.
argument
(
"thumbnail"
)
val
thumbnail
:
String
?
=
call
.
argument
(
"thumbnail"
)
launch
(
UI
){
launch
(
UI
)
{
if
(
thumbnail
!=
null
&&
thumbnail
.
isNotBlank
())
{
if
(
thumbnail
!=
null
&&
thumbnail
.
isNotBlank
())
{
msg
.
thumbData
=
getThumbnailByteArrayCommon
(
registrar
,
thumbnail
)
msg
.
thumbData
=
getThumbnailByteArrayCommon
(
registrar
,
thumbnail
)
}
}
val
req
=
SendMessageToWX
.
Req
()
val
req
=
SendMessageToWX
.
Req
()
...
@@ -234,9 +257,9 @@ object WeChatPluginHandler {
...
@@ -234,9 +257,9 @@ object WeChatPluginHandler {
msg
.
description
=
call
.
argument
(
WechatPluginKeys
.
DESCRIPTION
)
msg
.
description
=
call
.
argument
(
WechatPluginKeys
.
DESCRIPTION
)
val
thumbnail
:
String
?
=
call
.
argument
(
WechatPluginKeys
.
THUMBNAIL
)
val
thumbnail
:
String
?
=
call
.
argument
(
WechatPluginKeys
.
THUMBNAIL
)
launch
(
UI
){
launch
(
UI
)
{
if
(
thumbnail
!=
null
&&
thumbnail
.
isNotBlank
())
{
if
(
thumbnail
!=
null
&&
thumbnail
.
isNotBlank
())
{
msg
.
thumbData
=
getThumbnailByteArrayCommon
(
registrar
,
thumbnail
)
msg
.
thumbData
=
getThumbnailByteArrayCommon
(
registrar
,
thumbnail
)
}
}
val
req
=
SendMessageToWX
.
Req
()
val
req
=
SendMessageToWX
.
Req
()
setCommonArguments
(
call
,
req
,
msg
)
setCommonArguments
(
call
,
req
,
msg
)
...
@@ -253,7 +276,7 @@ object WeChatPluginHandler {
...
@@ -253,7 +276,7 @@ object WeChatPluginHandler {
webPage
.
webpageUrl
=
call
.
argument
(
"webPage"
)
webPage
.
webpageUrl
=
call
.
argument
(
"webPage"
)
val
msg
=
WXMediaMessage
()
val
msg
=
WXMediaMessage
()
Log
.
e
(
"tag"
,
"share web"
)
Log
.
e
(
"tag"
,
"share web"
)
msg
.
mediaObject
=
webPage
msg
.
mediaObject
=
webPage
msg
.
title
=
call
.
argument
(
WechatPluginKeys
.
TITLE
)
msg
.
title
=
call
.
argument
(
WechatPluginKeys
.
TITLE
)
msg
.
description
=
call
.
argument
(
WechatPluginKeys
.
DESCRIPTION
)
msg
.
description
=
call
.
argument
(
WechatPluginKeys
.
DESCRIPTION
)
...
...
example/lib/main.dart
浏览文件 @
29305aa2
...
@@ -16,7 +16,7 @@ class _MyAppState extends State<MyApp> {
...
@@ -16,7 +16,7 @@ class _MyAppState extends State<MyApp> {
void
initState
()
{
void
initState
()
{
super
.
initState
();
super
.
initState
();
// initPlatformState();
// initPlatformState();
Fluwx
.
init
(
"wxd930ea5d5a258f4f"
).
then
((
result
)
{
Fluwx
.
registerApp
(
"wxd930ea5d5a258f4f"
).
then
((
result
)
{
print
(
"succes-->
$result
"
);
print
(
"succes-->
$result
"
);
},
onError:
(
value
)
{
},
onError:
(
value
)
{
print
(
"--->
$value
"
);
print
(
"--->
$value
"
);
...
...
ios/Classes/FluwxPlugin.m
浏览文件 @
29305aa2
...
@@ -32,11 +32,19 @@ BOOL isWeChatRegistered = NO;
...
@@ -32,11 +32,19 @@ BOOL isWeChatRegistered = NO;
}
}
-
(
void
)
handleMethodCall
:(
FlutterMethodCall
*
)
call
result
:(
FlutterResult
)
result
{
-
(
void
)
handleMethodCall
:(
FlutterMethodCall
*
)
call
result
:(
FlutterResult
)
result
{
if
([
registerApp
isEqualToString
:
call
.
method
])
{
if
([
initWeChat
isEqualToString
:
call
.
method
])
{
[
self
initWeChatIfNeeded
:
call
result
:
result
];
[
self
initWeChatIfNeeded
:
call
result
:
result
];
}
if
([
call
.
method
hasPrefix
:
@"share"
])
{
return
;
}
if
([
unregisterApp
isEqualToString
:
call
.
method
])
{
[
self
initWeChatIfNeeded
:
call
result
:
result
];
return
;
}
if
([
call
.
method
hasPrefix
:
@"share"
])
{
[
_fluwxShareHandler
handleShare
:
call
result
:
result
];
[
_fluwxShareHandler
handleShare
:
call
result
:
result
];
return
;
}
else
{
}
else
{
result
(
FlutterMethodNotImplemented
);
result
(
FlutterMethodNotImplemented
);
}
}
...
@@ -55,7 +63,6 @@ BOOL isWeChatRegistered = NO;
...
@@ -55,7 +63,6 @@ BOOL isWeChatRegistered = NO;
}
}
NSString
*
appId
=
call
.
arguments
;
NSString
*
appId
=
call
.
arguments
;
NSLog
(
appId
);
if
([
StringUtil
isBlank
:
appId
])
{
if
([
StringUtil
isBlank
:
appId
])
{
result
([
FlutterError
errorWithCode
:
@"invalid app id"
message
:
@"are you sure your app id is correct ? "
details
:
appId
]);
result
([
FlutterError
errorWithCode
:
@"invalid app id"
message
:
@"are you sure your app id is correct ? "
details
:
appId
]);
return
;
return
;
...
@@ -66,5 +73,9 @@ BOOL isWeChatRegistered = NO;
...
@@ -66,5 +73,9 @@ BOOL isWeChatRegistered = NO;
result
(
@YES
);
result
(
@YES
);
}
}
-
(
void
)
unregisterApp
:(
FlutterMethodCall
*
)
call
result
:(
FlutterResult
)
result
{
[
WXApi
unregisterApp
];
result
(
@YES
);
}
@end
@end
ios/Classes/constants/FluwxMethods.h
浏览文件 @
29305aa2
...
@@ -4,7 +4,8 @@
...
@@ -4,7 +4,8 @@
#import <Foundation/Foundation.h>
#import <Foundation/Foundation.h>
extern
NSString
*
const
initWeChat
;
extern
NSString
*
const
registerApp
;
extern
NSString
*
const
unregisterApp
;
extern
NSString
*
const
weChatResponse
;
extern
NSString
*
const
weChatResponse
;
extern
NSString
*
const
shareText
;
extern
NSString
*
const
shareText
;
extern
NSString
*
const
shareImage
;
extern
NSString
*
const
shareImage
;
...
...
ios/Classes/constants/FluwxMethods.m
浏览文件 @
29305aa2
...
@@ -4,7 +4,8 @@
...
@@ -4,7 +4,8 @@
#import "FluwxMethods.h"
#import "FluwxMethods.h"
NSString
*
const
initWeChat
=
@"initWeChat"
;
NSString
*
const
registerApp
=
@"registerApp"
;
NSString
*
const
unregisterApp
=
@"unregisterApp"
;
NSString
*
const
weChatResponse
=
@"onWeChatResponse"
;
NSString
*
const
weChatResponse
=
@"onWeChatResponse"
;
NSString
*
const
shareText
=
@"shareText"
;
NSString
*
const
shareText
=
@"shareText"
;
NSString
*
const
shareImage
=
@"shareImage"
;
NSString
*
const
shareImage
=
@"shareImage"
;
...
...
lib/src/fluwx.dart
浏览文件 @
29305aa2
...
@@ -20,10 +20,13 @@ class Fluwx {
...
@@ -20,10 +20,13 @@ class Fluwx {
Stream
<
Map
>
get
weChatResponseUpdate
=>
_responseStreamController
.
stream
;
Stream
<
Map
>
get
weChatResponseUpdate
=>
_responseStreamController
.
stream
;
static
Future
init
(
String
appId
)
async
{
static
Future
registerApp
(
String
appId
)
async
{
return
await
_channel
.
invokeMethod
(
"
initWeChat
"
,
appId
);
return
await
_channel
.
invokeMethod
(
"
registerApp
"
,
appId
);
}
}
static
Future
unregisterApp
()
async
{
return
await
_channel
.
invokeMethod
(
"unregisterApp"
);
}
void
listen
()
{
void
listen
()
{
_channel
.
setMethodCallHandler
(
_handler
);
_channel
.
setMethodCallHandler
(
_handler
);
}
}
...
@@ -33,7 +36,6 @@ class Fluwx {
...
@@ -33,7 +36,6 @@ class Fluwx {
}
}
Future
share
(
WeChatShareModel
model
)
async
{
Future
share
(
WeChatShareModel
model
)
async
{
var
s
=
_shareModelMethodMapper
[
model
.
runtimeType
];
if
(
_shareModelMethodMapper
.
containsKey
(
model
.
runtimeType
))
{
if
(
_shareModelMethodMapper
.
containsKey
(
model
.
runtimeType
))
{
return
await
_channel
.
invokeMethod
(
return
await
_channel
.
invokeMethod
(
_shareModelMethodMapper
[
model
.
runtimeType
],
model
.
toMap
());
_shareModelMethodMapper
[
model
.
runtimeType
],
model
.
toMap
());
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论