Fluwx
doesn't support all kind of sharing.Only text, image, web page,
music, video and mini program are supported.We'll consider the more.
More support will be considered in the future.
.
NOTE:Images or thumbnails used for sharing only support
png
andjpg
.Network or assets images are OK.
However,using images fromassets
,you have to add a schemaassets://
。
For assets image from a particular package,you have to add a query param:?package=package_name
If you want to use local image,file://
must be provided.For example, a local image path should be "file://path/to/your/image.jpg".
If no schema or wrong schema provided,Fluwx
will load it as network image.Be careful
Due to the limits of WeChat,the thumbnail must be smaller than 32k(mini-program's is smaller than 120k),you'd better provide
a qualified thumbnail.Otherwise,Fluwx
will compress it for you. The result of compression is unpredictable.
Considering that we may obtain a path such as content://media/external/file on Android,fluwx
also support reading image or thumbnail fromcontent://
.
content://
only works on Android.
The destination of sharing can be SESSION(default),TIMELINE or FAVORITE.However,mini-program only support SESSION.
///[WeChatScene.SESSION]会话
///[WeChatScene.TIMELINE]朋友圈
///[WeChatScene.FAVORITE]收藏
enum WeChatScene {
SESSION,
TIMELINE,
FAVORITE
}
the return value of fluwx.share(model)
is Map
:
{
"platform":"Android",//or iOS
result:true //or false,depends on WXApi.sendRequest()
}
fluwx.share(WeChatShareTextModel(
text: "text from fluwx",
transaction: "transaction}",
scene: scene
));
fluwx.share(WeChatShareImageModel(
image: _imagePath,
thumbnail: _thumbnail,
transaction: _imagePath,
scene: scene,
description: "image"));
NOTE:
Fluwx
will create thumbnail fromimage
if thumbnail isn't provided.
var model = WeChatShareMusicModel(
title: _title,
description: _description,
transaction: "music",
musicUrl: _musicUrl,
musicLowBandUrl: _musicLowBandUrl
);
fluwx.share(model);
Two kind of music:musicUrl
和musicLowBandUrl
.They are not coexisting,if both are assigned, onlymusicUrl
will be used.
var model = new WeChatShareVideoModel(
videoUrl: _videoUrl,
transaction: "video",
videoLowBandUrl: _videoLowBandUrl,
thumbnail: _thumnail,
description: _description,
title: _title
);
fluwx.share(model);
Two kind of video:videoUrl
和videoLowBandUrl
.They are not coexisting,if both are assigned, only videoUrl
will be used.
var model =new WeChatShareMiniProgramModel(
webPageUrl: _webPageUrl,
miniProgramType:fluwx.WXMiniProgramType.RELEASE,
userName: _userName,
title: _title,
description: _description,
thumbnail: _thumbnail
);
fluwx.share(model);