Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
clx-fluwx
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
openSourceLibrary
clx-fluwx
Commits
7c9e7c77
Unverified
提交
7c9e7c77
authored
12月 20, 2019
作者:
JarvanMo
提交者:
GitHub
12月 20, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #172 from lichfy/master
分享文件
上级
b92a06bc
1562fd33
显示空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
139 行增加
和
1 行删除
+139
-1
gradle-wrapper.jar
android/gradle/wrapper/gradle-wrapper.jar
+0
-0
gradle-wrapper.properties
android/gradle/wrapper/gradle-wrapper.properties
+6
-0
WeChatPluginMethods.java
...kotlin/com/jarvan/fluwx/constant/WeChatPluginMethods.java
+1
-0
FluwxShareHandler.kt
...main/kotlin/com/jarvan/fluwx/handler/FluwxShareHandler.kt
+31
-0
SHARE.md
doc/SHARE.md
+13
-0
SHARE_CN.md
doc/SHARE_CN.md
+14
-0
FluwxMethods.h
ios/Classes/constants/FluwxMethods.h
+1
-0
FluwxMethods.m
ios/Classes/constants/FluwxMethods.m
+1
-0
FluwxShareHandler.m
ios/Classes/handler/FluwxShareHandler.m
+24
-0
fluwx_iml.dart
lib/src/fluwx_iml.dart
+2
-1
wechat_share_models.dart
lib/src/models/wechat_share_models.dart
+46
-0
没有找到文件。
android/gradle/wrapper/gradle-wrapper.jar
0 → 100644
浏览文件 @
7c9e7c77
File added
android/gradle/wrapper/gradle-wrapper.properties
0 → 100644
浏览文件 @
7c9e7c77
#Tue Aug 13 10:22:39 CST 2019
distributionBase
=
GRADLE_USER_HOME
distributionPath
=
wrapper/dists
zipStoreBase
=
GRADLE_USER_HOME
zipStorePath
=
wrapper/dists
distributionUrl
=
https
\:
//services.gradle.org/distributions/gradle-5.1.1-all.zip
android/src/main/kotlin/com/jarvan/fluwx/constant/WeChatPluginMethods.java
浏览文件 @
7c9e7c77
...
...
@@ -20,6 +20,7 @@ public class WeChatPluginMethods {
public
static
final
String
SHARE_VIDEO
=
"shareVideo"
;
public
static
final
String
SHARE_WEB_PAGE
=
"shareWebPage"
;
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
PAY
=
"payWithFluwx"
;
...
...
android/src/main/kotlin/com/jarvan/fluwx/handler/FluwxShareHandler.kt
浏览文件 @
7c9e7c77
...
...
@@ -72,6 +72,7 @@ internal class FluwxShareHandler {
WeChatPluginMethods
.
SHARE_MUSIC
->
shareMusic
(
call
,
result
)
WeChatPluginMethods
.
SHARE_VIDEO
->
shareVideo
(
call
,
result
)
WeChatPluginMethods
.
SHARE_WEB_PAGE
->
shareWebPage
(
call
,
result
)
WeChatPluginMethods
.
SHARE_FILE
->
shareFile
(
call
,
result
)
else
->
{
result
.
notImplemented
()
}
...
...
@@ -359,6 +360,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?{
// var imgObj: WXImageObject? = null
// var imageFile:File? = null
...
...
doc/SHARE.md
浏览文件 @
7c9e7c77
...
...
@@ -124,3 +124,16 @@ Two kind of video:`videoUrl`和`videoLowBandUrl`.They are not coexisting,if bo
fluwx
.
share
(
model
);
```
### Share File
```
dart
var
model
=
fluwx
.
WeChatShareFileModel
(
filePath:
_filePath
,
scene:
scene
,
title:
_title
,
description:
_description
);
fluwx
.
share
(
model
);
```
File size is limited and cannot exceed 10M
doc/SHARE_CN.md
浏览文件 @
7c9e7c77
...
...
@@ -120,3 +120,16 @@
);
fluwx
.
share
(
model
);
```
### 分享文件
```
dart
var
model
=
fluwx
.
WeChatShareFileModel
(
filePath:
_filePath
,
scene:
scene
,
title:
_title
,
description:
_description
);
fluwx
.
share
(
model
);
```
文件有大小限制,不能超过10M;文件路径还要考虑权限
\ No newline at end of file
ios/Classes/constants/FluwxMethods.h
浏览文件 @
7c9e7c77
...
...
@@ -12,6 +12,7 @@ extern NSString *const shareImage;
extern
NSString
*
const
shareMusic
;
extern
NSString
*
const
shareVideo
;
extern
NSString
*
const
shareWebPage
;
extern
NSString
*
const
shareFile
;
extern
NSString
*
const
shareMiniProgram
;
extern
NSString
*
const
launchMiniProgram
;
...
...
ios/Classes/constants/FluwxMethods.m
浏览文件 @
7c9e7c77
...
...
@@ -11,6 +11,7 @@ NSString *const shareText = @"shareText";
NSString
*
const
shareImage
=
@"shareImage"
;
NSString
*
const
shareMusic
=
@"shareMusic"
;
NSString
*
const
shareVideo
=
@"shareVideo"
;
NSString
*
const
shareFile
=
@"shareFile"
;
NSString
*
const
shareWebPage
=
@"shareWebPage"
;
NSString
*
const
shareMiniProgram
=
@"shareMiniProgram"
;
NSString
*
const
LaunchMiniProgram
=
@"launchMiniProgram"
;
...
...
ios/Classes/handler/FluwxShareHandler.m
浏览文件 @
7c9e7c77
...
...
@@ -55,6 +55,8 @@ NSObject <FlutterPluginRegistrar> *_fluwxRegistrar;
[
self
shareVideo
:
call
result
:
result
];
}
else
if
([
shareMiniProgram
isEqualToString
:
call
.
method
])
{
[
self
shareMiniProgram
:
call
result
:
result
];
}
else
if
([
shareFile
isEqualToString
:
call
.
method
]){
[
self
shareFile
:
call
result
:
result
];
}
...
...
@@ -371,6 +373,28 @@ NSObject <FlutterPluginRegistrar> *_fluwxRegistrar;
}
-
(
void
)
shareFile
:(
FlutterMethodCall
*
)
call
result
:(
FlutterResult
)
result
{
dispatch_queue_t
globalQueue
=
dispatch_get_global_queue
(
0
,
0
);
dispatch_async
(
globalQueue
,
^
{
NSString
*
thumbnail
=
call
.
arguments
[
fluwxKeyThumbnail
];
UIImage
*
thumbnailImage
=
[
self
getThumbnail
:
thumbnail
size
:
32
*
1024
];
NSString
*
filePath
=
call
.
arguments
[
@"filePath"
];
NSData
*
data
=
[
NSData
dataWithContentsOfFile
:
filePath
];
dispatch_async
(
dispatch_get_main_queue
(),
^
{
NSString
*
scene
=
call
.
arguments
[
fluwxKeyScene
];
BOOL
done
=
[
WXApiRequestHandler
sendFileData
:
data
fileExtension
:
call
.
arguments
[
@"fileExtension"
]
Title:
call
.
arguments
[
fluwxKeyTitle
]
Description:
call
.
arguments
[
fluwxKeyDescription
]
ThumbImage:
thumbnailImage
InScene:
[
StringToWeChatScene
toScene
:
scene
]];
result
(@{
fluwxKeyPlatform
:
fluwxKeyIOS
,
fluwxKeyResult
:
@
(
done
)});
});
});
}
-
(
void
)
shareMiniProgram
:(
FlutterMethodCall
*
)
call
result
:(
FlutterResult
)
result
{
dispatch_queue_t
globalQueue
=
dispatch_get_global_queue
(
0
,
0
);
dispatch_async
(
globalQueue
,
^
{
...
...
lib/src/fluwx_iml.dart
浏览文件 @
7c9e7c77
...
...
@@ -582,7 +582,8 @@ const Map<Type, String> _shareModelMethodMapper = {
WeChatShareMusicModel:
"shareMusic"
,
WeChatShareVideoModel:
"shareVideo"
,
WeChatShareWebPageModel:
"shareWebPage"
,
WeChatShareMiniProgramModel:
"shareMiniProgram"
WeChatShareMiniProgramModel:
"shareMiniProgram"
,
WeChatShareFileModel:
"shareFile"
,
};
const
Map
<
int
,
AuthByQRCodeErrorCode
>
_authByQRCodeErrorCodes
=
{
...
...
lib/src/models/wechat_share_models.dart
浏览文件 @
7c9e7c77
...
...
@@ -385,3 +385,48 @@ class WeChatShareWebPageModel extends WeChatShareModel {
};
}
}
class
WeChatShareFileModel
extends
WeChatShareModel
{
final
String
transaction
;
final
String
filePath
;
final
String
fileExtension
;
final
String
thumbnail
;
final
String
title
;
final
String
description
;
WeChatShareFileModel
({
String
transaction
,
this
.
filePath
,
this
.
fileExtension
:
"pdf"
,
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
,
"fileExtension"
:
fileExtension
,
_thumbnail:
thumbnail
,
_title:
title
,
_description:
description
,
_mediaTagName:
mediaTagName
,
_messageAction:
messageAction
,
_messageExt:
messageExt
,
};
}
}
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论