Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
clx-fluwx
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
openSourceLibrary
clx-fluwx
Commits
c9361349
提交
c9361349
authored
8月 12, 2019
作者:
lichdr
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
分享文件
上级
c60de433
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
77 行增加
和
1 行删除
+77
-1
WeChatPluginMethods.java
...kotlin/com/jarvan/fluwx/constant/WeChatPluginMethods.java
+1
-0
FluwxShareHandler.kt
...main/kotlin/com/jarvan/fluwx/handler/FluwxShareHandler.kt
+31
-0
fluwx_iml.dart
lib/src/fluwx_iml.dart
+2
-1
wechat_share_models.dart
lib/src/models/wechat_share_models.dart
+43
-0
没有找到文件。
android/src/main/kotlin/com/jarvan/fluwx/constant/WeChatPluginMethods.java
浏览文件 @
c9361349
...
@@ -20,6 +20,7 @@ public class WeChatPluginMethods {
...
@@ -20,6 +20,7 @@ public class WeChatPluginMethods {
public
static
final
String
SHARE_VIDEO
=
"shareVideo"
;
public
static
final
String
SHARE_VIDEO
=
"shareVideo"
;
public
static
final
String
SHARE_WEB_PAGE
=
"shareWebPage"
;
public
static
final
String
SHARE_WEB_PAGE
=
"shareWebPage"
;
public
static
final
String
SHARE_MINI_PROGRAM
=
"shareMiniProgram"
;
public
static
final
String
SHARE_MINI_PROGRAM
=
"shareMiniProgram"
;
public
static
final
String
SHARE_FILE
=
"shareFile"
;
public
static
final
String
LAUNCH_MINI_PROGRAM
=
"launchMiniProgram"
;
public
static
final
String
LAUNCH_MINI_PROGRAM
=
"launchMiniProgram"
;
public
static
final
String
PAY
=
"payWithFluwx"
;
public
static
final
String
PAY
=
"payWithFluwx"
;
...
...
android/src/main/kotlin/com/jarvan/fluwx/handler/FluwxShareHandler.kt
浏览文件 @
c9361349
...
@@ -70,6 +70,7 @@ internal class FluwxShareHandler {
...
@@ -70,6 +70,7 @@ internal class FluwxShareHandler {
WeChatPluginMethods
.
SHARE_MUSIC
->
shareMusic
(
call
,
result
)
WeChatPluginMethods
.
SHARE_MUSIC
->
shareMusic
(
call
,
result
)
WeChatPluginMethods
.
SHARE_VIDEO
->
shareVideo
(
call
,
result
)
WeChatPluginMethods
.
SHARE_VIDEO
->
shareVideo
(
call
,
result
)
WeChatPluginMethods
.
SHARE_WEB_PAGE
->
shareWebPage
(
call
,
result
)
WeChatPluginMethods
.
SHARE_WEB_PAGE
->
shareWebPage
(
call
,
result
)
WeChatPluginMethods
.
SHARE_FILE
->
shareFile
(
call
,
result
)
else
->
{
else
->
{
result
.
notImplemented
()
result
.
notImplemented
()
}
}
...
@@ -343,6 +344,36 @@ internal class FluwxShareHandler {
...
@@ -343,6 +344,36 @@ internal class FluwxShareHandler {
}
}
}
}
private
fun
shareFile
(
call
:
MethodCall
,
result
:
MethodChannel
.
Result
){
val
file
=
WXFileObject
()
val
filePath
:
String
?
=
call
.
argument
(
"filePath"
)
file
.
filePath
=
filePath
val
msg
=
WXMediaMessage
()
msg
.
mediaObject
=
file
msg
.
title
=
call
.
argument
(
"title"
)
msg
.
description
=
call
.
argument
(
"description"
)
val
thumbnail
:
String
?
=
call
.
argument
(
"thumbnail"
)
GlobalScope
.
launch
(
Dispatchers
.
Main
,
CoroutineStart
.
DEFAULT
)
{
if
(
thumbnail
!=
null
&&
thumbnail
.
isNotBlank
())
{
msg
.
thumbData
=
getThumbnailByteArrayCommon
(
registrar
,
thumbnail
)
}
val
req
=
SendMessageToWX
.
Req
()
setCommonArguments
(
call
,
req
,
msg
)
req
.
message
=
msg
val
done
=
WXAPiHandler
.
wxApi
?.
sendReq
(
req
)
result
.
success
(
mapOf
(
WechatPluginKeys
.
PLATFORM
to
WechatPluginKeys
.
ANDROID
,
WechatPluginKeys
.
RESULT
to
done
)
)
}
}
// private fun createWxImageObject(imagePath:String):WXImageObject?{
// private fun createWxImageObject(imagePath:String):WXImageObject?{
// var imgObj: WXImageObject? = null
// var imgObj: WXImageObject? = null
// var imageFile:File? = null
// var imageFile:File? = null
...
...
lib/src/fluwx_iml.dart
浏览文件 @
c9361349
...
@@ -358,7 +358,8 @@ const Map<Type, String> _shareModelMethodMapper = {
...
@@ -358,7 +358,8 @@ const Map<Type, String> _shareModelMethodMapper = {
WeChatShareMusicModel:
"shareMusic"
,
WeChatShareMusicModel:
"shareMusic"
,
WeChatShareVideoModel:
"shareVideo"
,
WeChatShareVideoModel:
"shareVideo"
,
WeChatShareWebPageModel:
"shareWebPage"
,
WeChatShareWebPageModel:
"shareWebPage"
,
WeChatShareMiniProgramModel:
"shareMiniProgram"
WeChatShareMiniProgramModel:
"shareMiniProgram"
,
WeChatShareFileModel:
"shareFile"
,
};
};
const
Map
<
int
,
AuthByQRCodeErrorCode
>
_authByQRCodeErrorCodes
=
{
const
Map
<
int
,
AuthByQRCodeErrorCode
>
_authByQRCodeErrorCodes
=
{
...
...
lib/src/models/wechat_share_models.dart
浏览文件 @
c9361349
...
@@ -339,3 +339,45 @@ class WeChatShareWebPageModel extends WeChatShareModel {
...
@@ -339,3 +339,45 @@ class WeChatShareWebPageModel extends WeChatShareModel {
};
};
}
}
}
}
class
WeChatShareFileModel
extends
WeChatShareModel
{
final
String
transaction
;
final
String
filePath
;
final
String
thumbnail
;
final
String
title
;
final
String
description
;
WeChatShareFileModel
({
String
transaction
,
this
.
filePath
,
this
.
title
:
""
,
this
.
description
:
""
,
String
thumbnail
,
WeChatScene
scene
,
String
messageExt
,
String
messageAction
,
String
mediaTagName
,
})
:
this
.
transaction
=
transaction
??
"text"
,
this
.
thumbnail
=
thumbnail
??
""
,
assert
(
filePath
!=
null
),
super
(
mediaTagName:
mediaTagName
,
messageAction:
messageAction
,
messageExt:
messageExt
,
scene:
scene
);
@override
Map
toMap
()
{
return
{
_transaction:
transaction
,
_scene:
scene
.
toString
(),
"filePath"
:
filePath
,
_thumbnail:
thumbnail
,
_title:
title
,
_description:
description
,
_mediaTagName:
mediaTagName
,
_messageAction:
messageAction
,
_messageExt:
messageExt
,
};
}
}
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论