Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
clx-fluwx
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
openSourceLibrary
clx-fluwx
Commits
d22f043c
提交
d22f043c
authored
8月 10, 2018
作者:
JarvanMo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add context into handler
上级
3e9ffabb
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
12 行增加
和
0 行删除
+12
-0
WechatPlugin.kt
...src/main/kotlin/com/jarvanmo/wechatplugin/WechatPlugin.kt
+1
-0
WeChatPluginHandler.kt
.../com/jarvanmo/wechatplugin/handler/WeChatPluginHandler.kt
+11
-0
没有找到文件。
android/src/main/kotlin/com/jarvanmo/wechatplugin/WechatPlugin.kt
浏览文件 @
d22f043c
...
@@ -14,6 +14,7 @@ class WechatPlugin(private var channel: MethodChannel,private var registrar: Reg
...
@@ -14,6 +14,7 @@ class WechatPlugin(private var channel: MethodChannel,private var registrar: Reg
@JvmStatic
@JvmStatic
fun
registerWith
(
registrar
:
Registrar
):
Unit
{
fun
registerWith
(
registrar
:
Registrar
):
Unit
{
val
channel
=
MethodChannel
(
registrar
.
messenger
(),
"wechat_plugin"
)
val
channel
=
MethodChannel
(
registrar
.
messenger
(),
"wechat_plugin"
)
WeChatPluginHandler
.
setContext
(
registrar
.
context
().
applicationContext
)
channel
.
setMethodCallHandler
(
WechatPlugin
(
channel
,
registrar
))
channel
.
setMethodCallHandler
(
WechatPlugin
(
channel
,
registrar
))
WeChatPluginHandler
.
setMethodChannel
(
channel
)
WeChatPluginHandler
.
setMethodChannel
(
channel
)
}
}
...
...
android/src/main/kotlin/com/jarvanmo/wechatplugin/handler/WeChatPluginHandler.kt
浏览文件 @
d22f043c
package
com.jarvanmo.wechatplugin.handler
package
com.jarvanmo.wechatplugin.handler
import
android.annotation.SuppressLint
import
android.content.Context
import
com.jarvanmo.wechatplugin.config.WeChatPluginMethods
import
com.jarvanmo.wechatplugin.config.WeChatPluginMethods
import
com.jarvanmo.wechatplugin.config.WechatPluginConfig
import
com.jarvanmo.wechatplugin.config.WechatPluginConfig
import
com.tencent.mm.opensdk.modelbase.BaseResp
import
com.tencent.mm.opensdk.modelbase.BaseResp
...
@@ -10,8 +12,10 @@ import com.tencent.mm.opensdk.modelmsg.WXTextObject
...
@@ -10,8 +12,10 @@ import com.tencent.mm.opensdk.modelmsg.WXTextObject
import
com.tencent.mm.opensdk.openapi.IWXAPI
import
com.tencent.mm.opensdk.openapi.IWXAPI
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
top.zibin.luban.Luban
@SuppressLint
(
"StaticFieldLeak"
)
/***
/***
* Created by mo on 2018/8/8
* Created by mo on 2018/8/8
* 冷风如刀,以大地为砧板,视众生为鱼肉。
* 冷风如刀,以大地为砧板,视众生为鱼肉。
...
@@ -22,6 +26,8 @@ object WeChatPluginHandler {
...
@@ -22,6 +26,8 @@ object WeChatPluginHandler {
private
var
channel
:
MethodChannel
?
=
null
private
var
channel
:
MethodChannel
?
=
null
private
var
context
:
Context
?
=
null
fun
apiIsNull
()
=
wxApi
==
null
fun
apiIsNull
()
=
wxApi
==
null
...
@@ -33,6 +39,11 @@ object WeChatPluginHandler {
...
@@ -33,6 +39,11 @@ object WeChatPluginHandler {
this
.
wxApi
=
wxApi
this
.
wxApi
=
wxApi
}
}
fun
setContext
(
context
:
Context
){
this
.
context
=
context
.
applicationContext
}
fun
handle
(
call
:
MethodCall
,
result
:
MethodChannel
.
Result
)
{
fun
handle
(
call
:
MethodCall
,
result
:
MethodChannel
.
Result
)
{
when
(
call
.
method
)
{
when
(
call
.
method
)
{
WeChatPluginMethods
.
SHARE_TEXT
->
shareText
(
call
)
WeChatPluginMethods
.
SHARE_TEXT
->
shareText
(
call
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论