Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
clx-fluwx
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
openSourceLibrary
clx-fluwx
Commits
f5852d9c
提交
f5852d9c
authored
8月 14, 2018
作者:
JarvanMo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix bugs and test share text
上级
53155a88
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
28 行增加
和
19 行删除
+28
-19
FluwxPlugin.kt
android/src/main/kotlin/com/jarvan/fluwx/FluwxPlugin.kt
+18
-13
WeChatPluginHandler.kt
...in/kotlin/com/jarvan/fluwx/handler/WeChatPluginHandler.kt
+1
-1
build.gradle
example/android/app/build.gradle
+1
-1
main.dart
example/lib/main.dart
+6
-2
wechat_plugin.dart
lib/src/wechat_plugin.dart
+2
-2
没有找到文件。
android/src/main/kotlin/com/jarvan/fluwx/FluwxPlugin.kt
浏览文件 @
f5852d9c
package
com.jarvan.fluwx
import
android.util.Log
import
com.jarvan.fluwx.constant.CallResult
import
com.jarvan.fluwx.constant.WeChatPluginMethods
import
com.jarvan.fluwx.handler.WeChatPluginHandler
...
...
@@ -22,19 +23,23 @@ class FluwxPlugin(private var registrar: Registrar) : MethodCallHandler {
}
override
fun
onMethodCall
(
call
:
MethodCall
,
result
:
Result
):
Unit
{
when
{
WeChatPluginMethods
.
INIT
==
call
.
method
->
{
val
api
=
WXAPIFactory
.
createWXAPI
(
registrar
.
context
().
applicationContext
,
call
.
arguments
as
String
?)
api
.
registerApp
(
call
.
arguments
as
String
)
WeChatPluginHandler
.
setWxApi
(
api
)
}
WeChatPluginHandler
.
apiIsNull
()
->
{
result
.
error
(
CallResult
.
RESULT_API_NULL
,
"please config wxapi first"
,
null
)
return
}
call
.
method
.
startsWith
(
"share"
)
->
{
WeChatPluginHandler
.
handle
(
call
,
result
)
}
if
(
call
.
method
==
WeChatPluginMethods
.
INIT
){
val
api
=
WXAPIFactory
.
createWXAPI
(
registrar
.
context
().
applicationContext
,
call
.
arguments
as
String
?)
api
.
registerApp
(
call
.
arguments
as
String
)
WeChatPluginHandler
.
setWxApi
(
api
)
return
}
if
(
WeChatPluginHandler
.
apiIsNull
()){
result
.
error
(
CallResult
.
RESULT_API_NULL
,
"please config wxapi first"
,
null
)
return
}
if
(
call
.
method
.
startsWith
(
"share"
)){
WeChatPluginHandler
.
handle
(
call
,
result
)
}
else
{
result
.
notImplemented
()
}
}
}
android/src/main/kotlin/com/jarvan/fluwx/handler/WeChatPluginHandler.kt
浏览文件 @
f5852d9c
...
...
@@ -47,7 +47,7 @@ object WeChatPluginHandler {
fun
handle
(
call
:
MethodCall
,
result
:
MethodChannel
.
Result
)
{
if
(
wxApi
!!
.
isWXAppInstalled
)
{
if
(
!
wxApi
!!
.
isWXAppInstalled
)
{
result
.
error
(
CallResult
.
RESULT_WE_CHAT_NOT_INSTALLED
,
CallResult
.
RESULT_WE_CHAT_NOT_INSTALLED
,
null
)
return
}
...
...
example/android/app/build.gradle
浏览文件 @
f5852d9c
...
...
@@ -45,7 +45,7 @@ android {
signingConfigs
{
debug
{
storeFile
file
(
"
../
debug.keystore"
)
storeFile
file
(
"debug.keystore"
)
}
}
}
...
...
example/lib/main.dart
浏览文件 @
f5852d9c
...
...
@@ -17,7 +17,7 @@ class _MyAppState extends State<MyApp> {
@override
void
initState
()
{
super
.
initState
();
initPlatformState
();
//
initPlatformState();
Fluwx
.
init
(
"wxd930ea5d5a258f4f"
);
}
...
...
@@ -49,7 +49,11 @@ class _MyAppState extends State<MyApp> {
title:
const
Text
(
'Plugin example app'
),
),
body:
new
Center
(
child:
new
Text
(
'Running on:
$_platformVersion
\n
'
),
child:
new
FlatButton
(
onPressed:
()
{
var
fluwx
=
Fluwx
();
fluwx
.
shareText
(
WeChatShareTextModel
(
text:
"share text from flutter"
,
transaction:
"hehe"
));
},
child:
new
Text
(
"share text to wechat"
)),
),
),
);
...
...
lib/src/wechat_plugin.dart
浏览文件 @
f5852d9c
...
...
@@ -6,13 +6,13 @@ import 'package:fluwx/src/wechat_share_models.dart';
class
Fluwx
{
static
const
MethodChannel
_channel
=
const
MethodChannel
(
'
wechat_plugin
'
);
static
const
MethodChannel
_channel
=
const
MethodChannel
(
'
fluwx
'
);
StreamController
<
Map
>
_responseStreamController
=
new
StreamController
.
broadcast
();
Stream
<
Map
>
get
weChatResponseUpdate
=>
_responseStreamController
.
stream
;
static
Future
<
int
>
init
(
String
appId
)
async
{
return
await
_channel
.
invokeMethod
(
"initWeChat"
);
return
await
_channel
.
invokeMethod
(
"initWeChat"
,
appId
);
}
void
listen
(){
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论