Skip to content

Latest commit

 

History

History
98 lines (89 loc) · 3.18 KB

SHARE.md

File metadata and controls

98 lines (89 loc) · 3.18 KB

Summary

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 pngandjpg.Network or assets images are OK.
However,using images from assets,you have to add a schema assets://
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 from content://.
content:// only works on Android.

The Destination

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
      }

Return

the return value of fluwx.share(model) is Map

    {
       "platform":"Android",//or iOS
       result:true //or false,depends on WXApi.sendRequest()
     }

Share Text

  fluwx.share(WeChatShareTextModel(
      text: "text from fluwx",
      transaction: "transaction}",
      scene: scene
    ));

Share Image

 fluwx.share(WeChatShareImageModel(
        image: _imagePath,
        thumbnail: _thumbnail,
        transaction: _imagePath,
        scene: scene,
        description: "image"));

NOTE:Fluwx will create thumbnail from image if thumbnail isn't provided.

Share Music

  var model = WeChatShareMusicModel(
      title: _title,
      description: _description,
      transaction: "music",
      musicUrl: _musicUrl,
      musicLowBandUrl: _musicLowBandUrl
    );

    fluwx.share(model);

Two kind of music:musicUrlmusicLowBandUrl.They are not coexisting,if both are assigned, onlymusicUrl will be used.

Share Video

   var model = new WeChatShareVideoModel(
     videoUrl: _videoUrl,
     transaction: "video",
     videoLowBandUrl: _videoLowBandUrl,
     thumbnail: _thumnail,
     description: _description,
     title: _title
   );
   fluwx.share(model);

Two kind of video:videoUrlvideoLowBandUrl.They are not coexisting,if both are assigned, only videoUrl will be used.

Share Mini Program

 var model =new WeChatShareMiniProgramModel(
      webPageUrl: _webPageUrl,
      miniProgramType:fluwx.WXMiniProgramType.RELEASE,
      userName: _userName,
      title: _title,
      description: _description,
      thumbnail: _thumbnail
    );
    fluwx.share(model);