Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
clx-fluwx
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
openSourceLibrary
clx-fluwx
Commits
c6670bcd
提交
c6670bcd
authored
3月 05, 2022
作者:
JarvanMo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update android code
上级
82f5ea75
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
30 行增加
和
20 行删除
+30
-20
FluwxPlugin.kt
android/src/main/kotlin/com/jarvan/fluwx/FluwxPlugin.kt
+30
-19
FluwxWXEntryActivity.kt
...ain/kotlin/com/jarvan/fluwx/wxapi/FluwxWXEntryActivity.kt
+0
-1
没有找到文件。
android/src/main/kotlin/com/jarvan/fluwx/FluwxPlugin.kt
浏览文件 @
c6670bcd
package
com.jarvan.fluwx
import
android.content.Context
import
android.content.Intent
import
androidx.annotation.NonNull
import
com.jarvan.fluwx.handlers.*
...
...
@@ -15,11 +16,13 @@ import io.flutter.plugin.common.MethodChannel.Result
import
io.flutter.plugin.common.PluginRegistry
/** FluwxPlugin */
class
FluwxPlugin
:
FlutterPlugin
,
MethodCallHandler
,
ActivityAware
,
PluginRegistry
.
NewIntentListener
{
class
FluwxPlugin
:
FlutterPlugin
,
MethodCallHandler
,
ActivityAware
,
PluginRegistry
.
NewIntentListener
{
companion
object
{
var
callingChannel
:
MethodChannel
?
=
null
var
callingChannel
:
MethodChannel
?
=
null
// 主动获取的启动参数
var
extMsg
:
String
?
=
null
var
extMsg
:
String
?
=
null
}
private
var
shareHandler
:
FluwxShareHandler
?
=
null
...
...
@@ -28,6 +31,8 @@ class FluwxPlugin : FlutterPlugin, MethodCallHandler, ActivityAware, PluginRegis
private
var
fluwxChannel
:
MethodChannel
?
=
null
private
var
context
:
Context
?
=
null
private
fun
handelIntent
(
intent
:
Intent
)
{
val
action
=
intent
.
action
val
dataString
=
intent
.
dataString
...
...
@@ -40,6 +45,7 @@ class FluwxPlugin : FlutterPlugin, MethodCallHandler, ActivityAware, PluginRegis
val
channel
=
MethodChannel
(
flutterPluginBinding
.
binaryMessenger
,
"com.jarvanmo/fluwx"
)
channel
.
setMethodCallHandler
(
this
)
fluwxChannel
=
channel
context
=
flutterPluginBinding
.
applicationContext
authHandler
=
FluwxAuthHandler
(
channel
)
shareHandler
=
FluwxShareHandlerEmbedding
(
flutterPluginBinding
.
flutterAssets
,
...
...
@@ -50,7 +56,7 @@ class FluwxPlugin : FlutterPlugin, MethodCallHandler, ActivityAware, PluginRegis
override
fun
onMethodCall
(
@NonNull
call
:
MethodCall
,
@NonNull
result
:
Result
)
{
callingChannel
=
fluwxChannel
when
{
call
.
method
==
"registerApp"
->
WXAPiHandler
.
registerApp
(
call
,
result
)
call
.
method
==
"registerApp"
->
WXAPiHandler
.
registerApp
(
call
,
result
,
context
)
call
.
method
==
"sendAuth"
->
authHandler
?.
sendAuth
(
call
,
result
)
call
.
method
==
"authByQRCode"
->
authHandler
?.
authByQRCode
(
call
,
result
)
call
.
method
==
"stopAuthByQRCode"
->
authHandler
?.
stopAuthByQRCode
(
result
)
...
...
@@ -63,8 +69,13 @@ class FluwxPlugin : FlutterPlugin, MethodCallHandler, ActivityAware, PluginRegis
call
.
method
.
startsWith
(
"share"
)
->
shareHandler
?.
share
(
call
,
result
)
call
.
method
==
"isWeChatInstalled"
->
WXAPiHandler
.
checkWeChatInstallation
(
result
)
call
.
method
==
"getExtMsg"
->
getExtMsg
(
result
)
call
.
method
==
"openWeChatCustomerServiceChat"
->
openWeChatCustomerServiceChat
(
call
,
result
)
call
.
method
==
"checkSupportOpenBusinessView"
->
WXAPiHandler
.
checkSupportOpenBusinessView
(
result
)
call
.
method
==
"openWeChatCustomerServiceChat"
->
openWeChatCustomerServiceChat
(
call
,
result
)
call
.
method
==
"checkSupportOpenBusinessView"
->
WXAPiHandler
.
checkSupportOpenBusinessView
(
result
)
call
.
method
==
"openBusinessView"
->
openBusinessView
(
call
,
result
)
else
->
result
.
notImplemented
()
}
...
...
@@ -85,7 +96,7 @@ class FluwxPlugin : FlutterPlugin, MethodCallHandler, ActivityAware, PluginRegis
}
override
fun
onAttachedToActivity
(
binding
:
ActivityPluginBinding
)
{
WXAPiHandler
.
setContext
(
binding
.
activity
.
applicationContext
)
//
WXAPiHandler.setContext(binding.activity.applicationContext)
handelIntent
(
binding
.
activity
.
intent
)
shareHandler
?.
permissionHandler
=
PermissionHandler
(
binding
.
activity
)
}
...
...
@@ -126,7 +137,7 @@ class FluwxPlugin : FlutterPlugin, MethodCallHandler, ActivityAware, PluginRegis
val
request
=
WXOpenBusinessWebview
.
Req
()
request
.
businessType
=
1
request
.
queryInfo
=
hashMapOf
(
"token"
to
prepayId
"token"
to
prepayId
)
result
.
success
(
WXAPiHandler
.
wxApi
?.
sendReq
(
request
))
}
...
...
@@ -166,17 +177,17 @@ class FluwxPlugin : FlutterPlugin, MethodCallHandler, ActivityAware, PluginRegis
val
req
=
WXOpenBusinessWebview
.
Req
()
req
.
businessType
=
businessType
req
.
queryInfo
=
hashMapOf
(
"appid"
to
appId
,
"mch_id"
to
mchId
,
"plan_id"
to
planId
,
"contract_code"
to
contractCode
,
"request_serial"
to
requestSerial
,
"contract_display_account"
to
contractDisplayAccount
,
"notify_url"
to
notifyUrl
,
"version"
to
version
,
"sign"
to
sign
,
"timestamp"
to
timestamp
,
"return_app"
to
returnApp
"appid"
to
appId
,
"mch_id"
to
mchId
,
"plan_id"
to
planId
,
"contract_code"
to
contractCode
,
"request_serial"
to
requestSerial
,
"contract_display_account"
to
contractDisplayAccount
,
"notify_url"
to
notifyUrl
,
"version"
to
version
,
"sign"
to
sign
,
"timestamp"
to
timestamp
,
"return_app"
to
returnApp
)
result
.
success
(
WXAPiHandler
.
wxApi
?.
sendReq
(
req
))
}
...
...
android/src/main/kotlin/com/jarvan/fluwx/wxapi/FluwxWXEntryActivity.kt
浏览文件 @
c6670bcd
...
...
@@ -42,7 +42,6 @@ open class FluwxWXEntryActivity : Activity(), IWXAPIEventHandler {
if
(
wechatAppId
!=
null
)
{
WXAPiHandler
.
setupWxApi
(
wechatAppId
,
this
)
WXAPiHandler
.
coolBoot
=
true
Log
.
d
(
"fluwx"
,
"weChatAppId: $wechatAppId"
)
}
else
{
Log
.
e
(
"fluwx"
,
"can't load meta-data weChatAppId"
)
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论