Commit f23b81d358a8b02f46af1712b18f5120dc874089

Authored by wdn127929
1 parent 1a0657cf

安卓企业微信集成OK

@@ -4684,7 +4684,7 @@ class InvicationPageState extends State<InvicationPage> @@ -4684,7 +4684,7 @@ class InvicationPageState extends State<InvicationPage>
4684 HEmptyView(20), 4684 HEmptyView(20),
4685 RoundButton( 4685 RoundButton(
4686 text: '企业微信通知', 4686 text: '企业微信通知',
4687 - width: ScreenUtil().setWidth(100 * 2), 4687 + width: ScreenUtil().setWidth(110 * 2),
4688 height: ScreenUtil().setWidth(96), 4688 height: ScreenUtil().setWidth(96),
4689 fontSize: 30, 4689 fontSize: 30,
4690 textColor: MyColours.color_999999, 4690 textColor: MyColours.color_999999,
@@ -4721,105 +4721,62 @@ class InvicationPageState extends State<InvicationPage> @@ -4721,105 +4721,62 @@ class InvicationPageState extends State<InvicationPage>
4721 ], 4721 ],
4722 ), 4722 ),
4723 RoundButton( 4723 RoundButton(
4724 - text: '微信通知',  
4725 - height: ScreenUtil().setWidth(48 * 2),  
4726 - fontSize: 38,  
4727 - gradientStart: Colors.transparent,  
4728 - gradientEnd: Colors.transparent,  
4729 - radius: ScreenUtil().setWidth(16),  
4730 - isBold: true,  
4731 - onPressed: () async {  
4732 - if (_nameNode.hasFocus ||  
4733 - _phoneNode.hasFocus ||  
4734 - _cusdemNode.hasFocus) {  
4735 - needWechat = true;  
4736 - _showConfirmWidget(  
4737 - needWechat: true,  
4738 - callback: () async {  
4739 - if (ObjectUtil.isEmpty(  
4740 - _baseIndoProvider.baseInfoSunModel) ||  
4741 - ObjectUtil.isEmpty(_baseIndoProvider  
4742 - .baseInfoSunModel.phone)) {  
4743 - // Utils.showToast('请填写经理的联系电话');  
4744 - DialogUtil.cupertinoAlertDialog(context,  
4745 - title: "填写个人信息",  
4746 - content:  
4747 - "暂未填写您的联系信息,请先前往填写,个人信息将会展示给您的顾客。",  
4748 - lTitle: "取消",  
4749 - rTitle: "去填写",  
4750 - lCallback: () {}, rCallback: () {  
4751 - _goBaseInfoPage();  
4752 - }); 4724 + text: '微信通知',
  4725 + height: ScreenUtil().setWidth(48 * 2),
  4726 + fontSize: 38,
  4727 + gradientStart: Colors.transparent,
  4728 + gradientEnd: Colors.transparent,
  4729 + radius: ScreenUtil().setWidth(16),
  4730 + isBold: true,
  4731 + onPressed: () async {
  4732 + if (_nameNode.hasFocus ||
  4733 + _phoneNode.hasFocus ||
  4734 + _cusdemNode.hasFocus) {
  4735 + needWechat = true;
  4736 + _showConfirmWidget(
  4737 + needWechat: true,
  4738 + callback: () async {
  4739 + if (ObjectUtil.isEmpty(
  4740 + _baseIndoProvider.baseInfoSunModel) ||
  4741 + ObjectUtil.isEmpty(
  4742 + _baseIndoProvider.baseInfoSunModel.phone)) {
  4743 + // Utils.showToast('请填写经理的联系电话');
  4744 + DialogUtil.cupertinoAlertDialog(context,
  4745 + title: "填写个人信息",
  4746 + content: "暂未填写您的联系信息,请先前往填写,个人信息将会展示给您的顾客。",
  4747 + lTitle: "取消",
  4748 + rTitle: "去填写",
  4749 + lCallback: () {}, rCallback: () {
  4750 + _goBaseInfoPage();
  4751 + });
4753 4752
4754 - return;  
4755 - }  
4756 - if (youhui != '选择优惠') {  
4757 - Map<String, String> params = {  
4758 - "rid": widget.rid,  
4759 - "aid":  
4760 - '${couponProvider.couponListSelect[couponSelectIndex].id}'  
4761 - };  
4762 - bool isSuc = await couponProvider  
4763 - .setActivityAsReserve(context, params);  
4764 - if (isSuc) {  
4765 - couponProvider.hasModify = true;  
4766 - bus.emit("refresh_book_list");  
4767 - bool isSuccess =  
4768 - await Utils.goShareInvicationToWeChat(  
4769 - context,  
4770 - widget.rid,  
4771 - Provider.of<UserModel>(context,  
4772 - listen: false)  
4773 - .user  
4774 - .openid,  
4775 - );  
4776 - print(isSuccess);  
4777 - if (isSuccess) {  
4778 - _addForward();  
4779 - }  
4780 - }  
4781 - } else {  
4782 - bool isSuccess =  
4783 - await Utils.goShareInvicationToWeChat(  
4784 - context,  
4785 - widget.rid,  
4786 - Provider.of<UserModel>(context,  
4787 - listen: false)  
4788 - .user  
4789 - .openid);  
4790 - if (isSuccess) {  
4791 - _addForward();  
4792 - } 4753 + return;
  4754 + }
  4755 + if (youhui != '选择优惠') {
  4756 + Map<String, String> params = {
  4757 + "rid": widget.rid,
  4758 + "aid":
  4759 + '${couponProvider.couponListSelect[couponSelectIndex].id}'
  4760 + };
  4761 + bool isSuc = await couponProvider
  4762 + .setActivityAsReserve(context, params);
  4763 + if (isSuc) {
  4764 + couponProvider.hasModify = true;
  4765 + bus.emit("refresh_book_list");
  4766 + bool isSuccess =
  4767 + await Utils.goShareInvicationToWeChat(
  4768 + context,
  4769 + widget.rid,
  4770 + Provider.of<UserModel>(context, listen: false)
  4771 + .user
  4772 + .openid,
  4773 + );
  4774 + print(isSuccess);
  4775 + if (isSuccess) {
  4776 + _addForward();
4793 } 4777 }
4794 - });  
4795 - removeOverlay();  
4796 - } else {  
4797 - if (ObjectUtil.isEmpty(  
4798 - _baseIndoProvider.baseInfoSunModel) ||  
4799 - ObjectUtil.isEmpty(  
4800 - _baseIndoProvider.baseInfoSunModel.phone)) {  
4801 - // Utils.showToast('请填写经理的联系电话');  
4802 - DialogUtil.cupertinoAlertDialog(context,  
4803 - title: "填写个人信息",  
4804 - content: "暂未填写您的联系信息,请先前往填写,个人信息将会展示给您的顾客。",  
4805 - lTitle: "取消",  
4806 - rTitle: "去填写",  
4807 - lCallback: () {}, rCallback: () {  
4808 - _goBaseInfoPage();  
4809 - });  
4810 - return;  
4811 - }  
4812 - if (youhui != '选择优惠') {  
4813 - Map<String, String> params = {  
4814 - "rid": widget.rid,  
4815 - "aid":  
4816 - '${couponProvider.couponListSelect[couponSelectIndex].id}'  
4817 - };  
4818 - bool isSuc = await couponProvider  
4819 - .setActivityAsReserve(context, params);  
4820 - if (isSuc) {  
4821 - couponProvider.hasModify = true;  
4822 - bus.emit("refresh_book_list"); 4778 + }
  4779 + } else {
4823 bool isSuccess = 4780 bool isSuccess =
4824 await Utils.goShareInvicationToWeChat( 4781 await Utils.goShareInvicationToWeChat(
4825 context, 4782 context,
@@ -4828,26 +4785,64 @@ class InvicationPageState extends State<InvicationPage> @@ -4828,26 +4785,64 @@ class InvicationPageState extends State<InvicationPage>
4828 listen: false) 4785 listen: false)
4829 .user 4786 .user
4830 .openid); 4787 .openid);
4831 - print(isSuccess);  
4832 if (isSuccess) { 4788 if (isSuccess) {
4833 _addForward(); 4789 _addForward();
4834 } 4790 }
4835 } 4791 }
4836 - } else {  
4837 - bool isSuccess =  
4838 - await Utils.goShareInvicationToWeChat(  
4839 - context,  
4840 - widget.rid,  
4841 - Provider.of<UserModel>(context,  
4842 - listen: false)  
4843 - .user  
4844 - .openid);  
4845 - if (isSuccess) {  
4846 - _addForward();  
4847 - } 4792 + });
  4793 + removeOverlay();
  4794 + } else {
  4795 + if (ObjectUtil.isEmpty(
  4796 + _baseIndoProvider.baseInfoSunModel) ||
  4797 + ObjectUtil.isEmpty(
  4798 + _baseIndoProvider.baseInfoSunModel.phone)) {
  4799 + // Utils.showToast('请填写经理的联系电话');
  4800 + DialogUtil.cupertinoAlertDialog(context,
  4801 + title: "填写个人信息",
  4802 + content: "暂未填写您的联系信息,请先前往填写,个人信息将会展示给您的顾客。",
  4803 + lTitle: "取消",
  4804 + rTitle: "去填写",
  4805 + lCallback: () {}, rCallback: () {
  4806 + _goBaseInfoPage();
  4807 + });
  4808 + return;
  4809 + }
  4810 + if (youhui != '选择优惠') {
  4811 + Map<String, String> params = {
  4812 + "rid": widget.rid,
  4813 + "aid":
  4814 + '${couponProvider.couponListSelect[couponSelectIndex].id}'
  4815 + };
  4816 + bool isSuc = await couponProvider.setActivityAsReserve(
  4817 + context, params);
  4818 + if (isSuc) {
  4819 + couponProvider.hasModify = true;
  4820 + bus.emit("refresh_book_list");
  4821 + bool isSuccess =
  4822 + await Utils.goShareInvicationToWeChat(
  4823 + context,
  4824 + widget.rid,
  4825 + Provider.of<UserModel>(context, listen: false)
  4826 + .user
  4827 + .openid);
  4828 + print(isSuccess);
  4829 + if (isSuccess) {
  4830 + _addForward();
4848 } 4831 }
4849 } 4832 }
4850 - }) 4833 + } else {
  4834 + bool isSuccess = await Utils.goShareInvicationToWeChat(
  4835 + context,
  4836 + widget.rid,
  4837 + Provider.of<UserModel>(context, listen: false)
  4838 + .user
  4839 + .openid);
  4840 + if (isSuccess) {
  4841 + _addForward();
  4842 + }
  4843 + }
  4844 + }
  4845 + })
4851 ])), 4846 ])),
4852 ], 4847 ],
4853 )); 4848 ));
@@ -428,14 +428,14 @@ class _FeastDishSharePageState extends State<FeastDishSharePage> { @@ -428,14 +428,14 @@ class _FeastDishSharePageState extends State<FeastDishSharePage> {
428 fontSize: 36, 428 fontSize: 36,
429 isBold: false, 429 isBold: false,
430 onPressed: () { 430 onPressed: () {
431 - // ShareHelper.onShareWx(  
432 - // context,  
433 - // boundaryKey: boundaryKey,  
434 - // );  
435 - ShareHelper.onShareWxwork( 431 + ShareHelper.onShareWx(
436 context, 432 context,
437 boundaryKey: boundaryKey, 433 boundaryKey: boundaryKey,
438 ); 434 );
  435 + // ShareHelper.onShareWxwork(
  436 + // context,
  437 + // boundaryKey: boundaryKey,
  438 + // );
439 439
440 // NavigatorUtil.goFeastDishSharePage(context); 440 // NavigatorUtil.goFeastDishSharePage(context);
441 }, 441 },
@@ -2308,7 +2308,7 @@ class TableManagerPageState extends State<TableManagerPage> { @@ -2308,7 +2308,7 @@ class TableManagerPageState extends State<TableManagerPage> {
2308 children: [ 2308 children: [
2309 RoundButton( 2309 RoundButton(
2310 text: '仅占座', 2310 text: '仅占座',
2311 - width: ScreenUtil().setWidth(64 * 2), 2311 + width: ScreenUtil().setWidth(100 * 2),
2312 height: ScreenUtil().setWidth(96), 2312 height: ScreenUtil().setWidth(96),
2313 fontSize: 24, 2313 fontSize: 24,
2314 textColor: MyColours.color_515151, 2314 textColor: MyColours.color_515151,
@@ -2320,43 +2320,43 @@ class TableManagerPageState extends State<TableManagerPage> { @@ -2320,43 +2320,43 @@ class TableManagerPageState extends State<TableManagerPage> {
2320 // _onlyReserve(); 2320 // _onlyReserve();
2321 JhCommonUtils.debounce(() => _onlyReserve(), 500); 2321 JhCommonUtils.debounce(() => _onlyReserve(), 500);
2322 }), 2322 }),
2323 - HEmptyView(22),  
2324 - RoundButton(  
2325 - text: '短信通知',  
2326 - width: ScreenUtil().setWidth(64 * 2),  
2327 - height: ScreenUtil().setWidth(96),  
2328 - fontSize: 24,  
2329 - textColor: MyColours.color_515151,  
2330 - gradientStart: MyColours.color_f3f3f3,  
2331 - gradientEnd: MyColours.color_f3f3f3,  
2332 - radius: ScreenUtil().setWidth(8),  
2333 - isBold: false,  
2334 - onPressed: () {  
2335 - setState(() {  
2336 - wechatNotification = false;  
2337 - });  
2338 - },  
2339 - ),  
2340 - HEmptyView(20),  
2341 - RoundButton(  
2342 - text: '企业微信通知',  
2343 - width: ScreenUtil().setWidth(80 * 2),  
2344 - height: ScreenUtil().setWidth(96),  
2345 - fontSize: 24,  
2346 - textColor: MyColours.color_515151,  
2347 - gradientStart: MyColours.color_f3f3f3,  
2348 - gradientEnd: MyColours.color_f3f3f3,  
2349 - radius: ScreenUtil().setWidth(8),  
2350 - isBold: false,  
2351 - onPressed: () async {  
2352 - JhCommonUtils.debounce(  
2353 - () => _wechatReserve(false), 500);  
2354 - },  
2355 - ),  
2356 - HEmptyView(20), 2323 + // HEmptyView(22),
  2324 + // RoundButton(
  2325 + // text: '短信通知',
  2326 + // width: ScreenUtil().setWidth(64 * 2),
  2327 + // height: ScreenUtil().setWidth(96),
  2328 + // fontSize: 24,
  2329 + // textColor: MyColours.color_515151,
  2330 + // gradientStart: MyColours.color_f3f3f3,
  2331 + // gradientEnd: MyColours.color_f3f3f3,
  2332 + // radius: ScreenUtil().setWidth(8),
  2333 + // isBold: false,
  2334 + // onPressed: () {
  2335 + // setState(() {
  2336 + // wechatNotification = false;
  2337 + // });
  2338 + // },
  2339 + // ),
  2340 + // HEmptyView(20),
  2341 + // RoundButton(
  2342 + // text: '企业微信通知',
  2343 + // width: ScreenUtil().setWidth(80 * 2),
  2344 + // height: ScreenUtil().setWidth(96),
  2345 + // fontSize: 24,
  2346 + // textColor: MyColours.color_515151,
  2347 + // gradientStart: MyColours.color_f3f3f3,
  2348 + // gradientEnd: MyColours.color_f3f3f3,
  2349 + // radius: ScreenUtil().setWidth(8),
  2350 + // isBold: false,
  2351 + // onPressed: () async {
  2352 + // JhCommonUtils.debounce(
  2353 + // () => _wechatReserve(false), 500);
  2354 + // },
  2355 + // ),
  2356 + HEmptyView(32),
2357 Expanded( 2357 Expanded(
2358 child: RoundButton( 2358 child: RoundButton(
2359 - text: '微信通知', 2359 + text: '录入预订',
2360 height: ScreenUtil().setWidth(96), 2360 height: ScreenUtil().setWidth(96),
2361 fontSize: 32, 2361 fontSize: 32,
2362 gradientStart: MyColours.color_438E93, 2362 gradientStart: MyColours.color_438E93,
@@ -2423,7 +2423,7 @@ class TableManagerPageState extends State<TableManagerPage> { @@ -2423,7 +2423,7 @@ class TableManagerPageState extends State<TableManagerPage> {
2423 // } 2423 // }
2424 // } else { 2424 // } else {
2425 // if (isWechat) { 2425 // if (isWechat) {
2426 - NavigatorUtil.goInvicationPage(context, _model.row.id); 2426 + NavigatorUtil.goInvicationPage(context, _model.row.id);
2427 // } else { 2427 // } else {
2428 // bool isSuccess = await Utils.goShareInvicationToWeChat( 2428 // bool isSuccess = await Utils.goShareInvicationToWeChat(
2429 // context, 2429 // context,
@@ -2098,11 +2098,15 @@ class Utils { @@ -2098,11 +2098,15 @@ class Utils {
2098 bool registerResult = await flutterWxwork.registerApp( 2098 bool registerResult = await flutterWxwork.registerApp(
2099 'wwauthbdca186ec4257973000003', 'wwbdca186ec4257973', '1000003'); 2099 'wwauthbdca186ec4257973000003', 'wwbdca186ec4257973', '1000003');
2100 print(registerResult); 2100 print(registerResult);
  2101 +
  2102 + // isSuccess = await flutterWxwork.shareText(text: "dddddddd");
2101 isSuccess = await flutterWxwork.shareMiniProgram( 2103 isSuccess = await flutterWxwork.shareMiniProgram(
2102 - userName: 'gh_487873d353b3@app',  
2103 - path: _path,  
2104 - hdImageData: _thumbnail,  
2105 - title: _title); 2104 + userName: 'gh_487873d353b3@app',
  2105 + path: _path,
  2106 + hdImageData: _thumbnail,
  2107 + title: _title,
  2108 + description: _description,
  2109 + );
2106 2110
2107 // var isSuccess = await flutterWxwork.shareImage(); 2111 // var isSuccess = await flutterWxwork.shareImage();
2108 print(isSuccess); 2112 print(isSuccess);
  1 +package com.wxwork.flutter_wxwork;
  2 +
  3 +
  4 +import android.graphics.Bitmap;
  5 + import android.graphics.BitmapFactory;
  6 + import android.os.AsyncTask;
  7 + import java.io.InputStream;
  8 + import java.net.HttpURLConnection;
  9 + import java.net.URL;
  10 +
  11 +public class DownloadImageTask extends AsyncTask<String, Void, Bitmap> {
  12 + private OnBitmapDownloadListener listener;
  13 +
  14 + public DownloadImageTask(OnBitmapDownloadListener listener) {
  15 + this.listener = listener;
  16 + }
  17 +
  18 + @Override
  19 + protected Bitmap doInBackground(String... urls) {
  20 + String urlString = urls[0];
  21 + Bitmap bitmap = null;
  22 + try {
  23 + URL url = new URL(urlString);
  24 + HttpURLConnection connection = (HttpURLConnection) url.openConnection();
  25 + connection.setDoInput(true);
  26 + connection.connect();
  27 + InputStream inputStream = connection.getInputStream();
  28 + bitmap = BitmapFactory.decodeStream(inputStream);
  29 + inputStream.close();
  30 + } catch (Exception e) {
  31 + e.printStackTrace();
  32 + }
  33 + return bitmap;
  34 + }
  35 +
  36 + @Override
  37 + protected void onPostExecute(Bitmap bitmap) {
  38 + listener.onBitmapDownloaded(bitmap);
  39 + }
  40 +
  41 + public interface OnBitmapDownloadListener {
  42 + void onBitmapDownloaded(Bitmap bitmap);
  43 + }
  44 +}
@@ -22,6 +22,36 @@ import com.tencent.wework.api.IWWAPIEventHandler; @@ -22,6 +22,36 @@ import com.tencent.wework.api.IWWAPIEventHandler;
22 import com.tencent.wework.api.WWAPIFactory; 22 import com.tencent.wework.api.WWAPIFactory;
23 import com.tencent.wework.api.model.BaseMessage; 23 import com.tencent.wework.api.model.BaseMessage;
24 import com.tencent.wework.api.model.WWAuthMessage; 24 import com.tencent.wework.api.model.WWAuthMessage;
  25 +import com.tencent.wework.api.model.WWMediaMiniProgram;
  26 +import com.tencent.wework.api.model.WWSimpleRespMessage;
  27 +import java.net.HttpURLConnection;
  28 +import java.net.URL;
  29 +import android.graphics.Bitmap;
  30 +import android.graphics.BitmapFactory;
  31 +import java.io.BufferedInputStream;
  32 +import java.io.IOException;
  33 +import java.nio.ByteBuffer;
  34 +import com.wxwork.flutter_wxwork.LoadImageUtil;
  35 +import com.wxwork.flutter_wxwork.NetWorkUtils;
  36 +import android.os.Parcel;
  37 +import android.os.Parcelable;
  38 +import java.io.ByteArrayOutputStream;
  39 +import java.io.ByteArrayInputStream;
  40 +
  41 +
  42 +import java.io.FileOutputStream;
  43 +
  44 +import java.io.InputStream;
  45 +import java.io.OutputStream;
  46 +
  47 +import java.net.MalformedURLException;
  48 +
  49 +import java.net.URLConnection;
  50 +
  51 +
  52 +
  53 +
  54 +
25 55
26 import java.util.HashMap; 56 import java.util.HashMap;
27 import java.util.Map; 57 import java.util.Map;
@@ -49,6 +79,10 @@ public class FlutterWxworkPlugin implements FlutterPlugin, MethodCallHandler { @@ -49,6 +79,10 @@ public class FlutterWxworkPlugin implements FlutterPlugin, MethodCallHandler {
49 79
50 private Context context; 80 private Context context;
51 81
  82 + private static final int SHARE_MINI_PROGRAM_THUMB_LENGTH = 120 ;
  83 +
  84 +
  85 +
52 @Override 86 @Override
53 public void onAttachedToEngine(@NonNull FlutterPluginBinding flutterPluginBinding) { 87 public void onAttachedToEngine(@NonNull FlutterPluginBinding flutterPluginBinding) {
54 channel = new MethodChannel(flutterPluginBinding.getBinaryMessenger(), "flutter_wxwork"); 88 channel = new MethodChannel(flutterPluginBinding.getBinaryMessenger(), "flutter_wxwork");
@@ -65,7 +99,7 @@ public class FlutterWxworkPlugin implements FlutterPlugin, MethodCallHandler { @@ -65,7 +99,7 @@ public class FlutterWxworkPlugin implements FlutterPlugin, MethodCallHandler {
65 if (call.method.equals("isAppInstalled")) { 99 if (call.method.equals("isAppInstalled")) {
66 boolean installed = iwwapi.isWWAppInstalled(); 100 boolean installed = iwwapi.isWWAppInstalled();
67 // if (installed) { 101 // if (installed) {
68 - result.success(installed); 102 + result.success(installed);
69 // } else { 103 // } else {
70 // result.success("0"); 104 // result.success("0");
71 // } 105 // }
@@ -75,7 +109,7 @@ public class FlutterWxworkPlugin implements FlutterPlugin, MethodCallHandler { @@ -75,7 +109,7 @@ public class FlutterWxworkPlugin implements FlutterPlugin, MethodCallHandler {
75 AGENTID = arguments.get("agentId"); 109 AGENTID = arguments.get("agentId");
76 boolean hasRegister = iwwapi.registerApp(SCHEMA); 110 boolean hasRegister = iwwapi.registerApp(SCHEMA);
77 // if (hasRegister) { 111 // if (hasRegister) {
78 - result.success(hasRegister); 112 + result.success(hasRegister);
79 // } else { 113 // } else {
80 // result.success("0"); 114 // result.success("0");
81 // } 115 // }
@@ -105,9 +139,395 @@ public class FlutterWxworkPlugin implements FlutterPlugin, MethodCallHandler { @@ -105,9 +139,395 @@ public class FlutterWxworkPlugin implements FlutterPlugin, MethodCallHandler {
105 } 139 }
106 }); 140 });
107 141
  142 + }else if (call.method.equals("shareImageNetWork")) {
  143 +// APPID = arguments.get("corpId");
  144 +// SCHEMA = arguments.get("scheme");
  145 +// AGENTID = arguments.get("agentId");
  146 +// boolean hasRegister = iwwapi.registerApp(SCHEMA);
  147 +// // if (hasRegister) {
  148 +// result.success(hasRegister);
  149 +// // } else {
  150 +// // result.success("0");
  151 +// // }
  152 + } else if (call.method.equals("shareImagePath")) {
  153 + }else if (call.method.equals("shareMiniProgram")) {
  154 +
  155 + WWMediaMiniProgram miniProgram = new WWMediaMiniProgram();
  156 + miniProgram.appPkg = "com.naji.one_key";
  157 + miniProgram.appName = "周到安排商家";//app name of this android pkg
  158 + miniProgram.appId = APPID; //企业唯一标识。创建企业后显示在,我的企业 CorpID字段
  159 + miniProgram.agentId = AGENTID; //应用唯一标识。显示在具体应用下的 AgentId字段
  160 + miniProgram.schema = SCHEMA;
  161 +
  162 + miniProgram.username = arguments.get("userName"); //必须是应用关联的小程序,注意要有@app后缀
  163 + miniProgram.description = arguments.get("description");
  164 + miniProgram.path = arguments.get("path");
  165 +
  166 +
  167 +
  168 + //得到图片
  169 + DownloadImageTask task = new DownloadImageTask(new DownloadImageTask.OnBitmapDownloadListener() {
  170 + @Override
  171 + public void onBitmapDownloaded(Bitmap bitmap) {
  172 +
  173 +
  174 + //缩略图建议不超过32kb
  175 + Bitmap thumbBmp = Bitmap.createScaledBitmap(bitmap, 500, 400, true);
  176 + bitmap.recycle();
  177 + miniProgram.hdImageData = bmpToByteArray(thumbBmp, true);
  178 + // 在这里处理下载到的Bitmap对象
  179 +// miniProgram.hdImageData = getBytesFromBitmap(bitmap);
  180 + miniProgram.title = arguments.get("title");
  181 + iwwapi.sendMessage(miniProgram, new IWWAPIEventHandler() {
  182 + @Override
  183 + public void handleResp(BaseMessage resp) {
  184 + if(resp instanceof WWSimpleRespMessage){
  185 + WWSimpleRespMessage rsp = (WWSimpleRespMessage)resp;
  186 +// String t = "";
  187 +// Toast.makeText(MainActivity.this,
  188 +// t = "发小程序," + rsp.errCode + "," + rsp.errMsg,
  189 +// Toast.LENGTH_LONG).show();
  190 +
  191 + Map<String, String> map = new HashMap<>();
  192 + map.put("code", String.valueOf(rsp.errCode));
  193 + map.put("errCode", String.valueOf(rsp.errMsg));
  194 +
  195 +
  196 + result.success(map);
  197 + }
  198 + }
  199 + });
  200 + }
  201 + });
  202 +
  203 + Log.i("ExampleClass", "Value: " + arguments.get("hdImageData"));
  204 + task.execute(arguments.get("hdImageData"));
  205 +// LoadImageUtil loadImageUtil = new LoadImageUtil(context);
  206 +// Bitmap bitmap = loadImageUtil.loadBitmapByImgUrl(arguments.get("hdImageData"), new LoadImageUtil.CallBack() {
  207 +// @Override
  208 +// public void callBack(String imgUrl, Bitmap bitmap) {
  209 +// if(bitmap != null){
  210 +//// ImageView img = (ImageView) parent.findViewWithTag(imgUrl);
  211 +//// img.setImageBitmap(bitmap);
  212 +// miniProgram.hdImageData = getBytesFromBitmap(bitmap);
  213 +// miniProgram.title = arguments.get("title");
  214 +// iwwapi.sendMessage(miniProgram, new IWWAPIEventHandler() {
  215 +// @Override
  216 +// public void handleResp(BaseMessage resp) {
  217 +// if(resp instanceof WWSimpleRespMessage){
  218 +// WWSimpleRespMessage rsp = (WWSimpleRespMessage)resp;
  219 +//// String t = "";
  220 +//// Toast.makeText(MainActivity.this,
  221 +//// t = "发小程序," + rsp.errCode + "," + rsp.errMsg,
  222 +//// Toast.LENGTH_LONG).show();
  223 +//
  224 +// Map<String, String> map = new HashMap<>();
  225 +// map.put("code", String.valueOf(rsp.errCode));
  226 +// map.put("errCode", String.valueOf(rsp.errMsg));
  227 +//
  228 +//
  229 +// result.success(map);
  230 +// }
  231 +// }
  232 +// });
  233 +// }
  234 +//
  235 +// }
  236 +// });
  237 +// if(bitmap != null){//如果图片在缓存中,直接获取展示
  238 +// miniProgram.hdImageData = getBytesFromBitmap(bitmap);
  239 +// miniProgram.title = arguments.get("title");
  240 +// iwwapi.sendMessage(miniProgram, new IWWAPIEventHandler() {
  241 +// @Override
  242 +// public void handleResp(BaseMessage resp) {
  243 +// if(resp instanceof WWSimpleRespMessage){
  244 +// WWSimpleRespMessage rsp = (WWSimpleRespMessage)resp;
  245 +//// String t = "";
  246 +//// Toast.makeText(MainActivity.this,
  247 +//// t = "发小程序," + rsp.errCode + "," + rsp.errMsg,
  248 +//// Toast.LENGTH_LONG).show();
  249 +//
  250 +// Map<String, String> map = new HashMap<>();
  251 +// map.put("code", String.valueOf(rsp.errCode));
  252 +// map.put("errCode", String.valueOf(rsp.errMsg));
  253 +//
  254 +//
  255 +// result.success(map);
  256 +// }
  257 +// }
  258 +// });
  259 +// }
  260 +
  261 +
  262 +
  263 +// Bitmap bitmap = getBitmapFromURL(arguments.get("hdImageData"));
  264 +// ByteArrayOutputStream stream = new ByteArrayOutputStream();
  265 +// bitmap.compress(Bitmap.CompressFormat.JPEG, 0, stream);
  266 +// byte[] byteArray = stream.toByteArray();
  267 +//
  268 +
  269 +
  270 +
  271 +
  272 + }else if (call.method.equals("shareText")) {
  273 +
  274 +
  275 +
  276 + WWMediaText txt = new WWMediaText( arguments.get("text")
  277 + );
  278 + txt.appPkg = "com.naji.one_key";
  279 + txt.appName = "周到安排商家" ;
  280 + txt.appId = APPID; //企业唯一标识。创建企业后显示在,我的企业 CorpID字段
  281 + txt.agentId = AGENTID; //应用唯一标识。显示在具体应用下的 AgentId字段
  282 + iwwapi.sendMessage(txt);
  283 + }
  284 +
  285 +
  286 +
  287 + else {
  288 + // result(FlutterMethodNotImplemented);
108 } 289 }
  290 +
  291 +
  292 +
109 } 293 }
110 294
  295 +
  296 + // 转换图片格式为字节数组
  297 + public static byte[] bmpToByteArray(final Bitmap bmp, final boolean needRecycle) {
  298 + ByteArrayOutputStream output = new ByteArrayOutputStream();
  299 + bmp.compress(Bitmap.CompressFormat.PNG, 100, output);
  300 + if (needRecycle) {
  301 + bmp.recycle();
  302 + }
  303 + byte[] result = output.toByteArray();
  304 + try {
  305 + output.close();
  306 + } catch (Exception e) {
  307 + e.printStackTrace();
  308 + }
  309 + return result;
  310 + }
  311 +
  312 +
  313 + public static Bitmap compressBitmap(String imgPath, int targetWidth, int targetHeight, int quality, Bitmap.CompressFormat compressFormat) {
  314 + BitmapFactory.Options options = new BitmapFactory.Options();
  315 + options.inJustDecodeBounds = true;
  316 + BitmapFactory.decodeFile(imgPath, options);
  317 + int actualHeight = options.outHeight;
  318 + int actualWidth = options.outWidth;
  319 +
  320 + float ratio = actualWidth / (float) actualHeight;
  321 + options.inSampleSize = 1;
  322 + while ((actualWidth / 2) > targetWidth && (actualHeight / 2) > targetHeight) {
  323 + actualWidth /= 2;
  324 + actualHeight /= 2;
  325 + options.inSampleSize *= 2;
  326 + }
  327 +
  328 + options.inJustDecodeBounds = false;
  329 + Bitmap bitmap = BitmapFactory.decodeFile(imgPath, options);
  330 +
  331 + Bitmap scaledBitmap = Bitmap.createScaledBitmap(bitmap, targetWidth, (int) (targetWidth / ratio), true);
  332 + bitmap.recycle();
  333 +
  334 + ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
  335 + scaledBitmap.compress(compressFormat, quality, byteArrayOutputStream);
  336 + scaledBitmap.recycle();
  337 +
  338 + return BitmapFactory.decodeByteArray(byteArrayOutputStream.toByteArray(), 0, byteArrayOutputStream.size());
  339 + }
  340 +
  341 +
  342 +
  343 +
  344 +
  345 +
  346 +
  347 +
  348 +
  349 + public static byte[] getBytesFromBitmap(Bitmap bitmap) {
  350 +// Bitmap compressedImage = compressBitmap(bitmap,100);
  351 +
  352 +
  353 +
  354 +
  355 + ByteBuffer byteBuffer = ByteBuffer.allocate(bitmap.getByteCount());
  356 + bitmap.copyPixelsToBuffer(byteBuffer);
  357 +
  358 + return byteBuffer.array();
  359 + }
  360 + /**
  361 + * 压缩图片
  362 + *
  363 + * @param bitmap
  364 + * 被压缩的图片
  365 + * @param sizeLimit
  366 + * 大小限制
  367 + * @return
  368 + * 压缩后的图片
  369 + */
  370 + private static Bitmap compressBitmap(Bitmap bitmap, long sizeLimit) {
  371 + ByteArrayOutputStream baos = new ByteArrayOutputStream();
  372 + int quality = 10;
  373 + bitmap.compress(Bitmap.CompressFormat.JPEG, quality, baos);
  374 +
  375 + // 循环判断压缩后图片是否超过限制大小
  376 + while(baos.toByteArray().length / 1024 > sizeLimit) {
  377 + // 清空baos
  378 + baos.reset();
  379 + bitmap.compress(Bitmap.CompressFormat.JPEG, quality, baos);
  380 + quality -= 10;
  381 + }
  382 +
  383 + Bitmap newBitmap = BitmapFactory.decodeStream(new ByteArrayInputStream(baos.toByteArray()), null, null);
  384 +
  385 + return newBitmap;
  386 + }
  387 +
  388 +// public static Bitmap compressBitmapToSize(Bitmap bitmap, int maxSizeKB) {
  389 +// ByteArrayOutputStream baos = new ByteArrayOutputStream();
  390 +// bitmap.compress(getBitmapCompressFormat(bitmap), 100, baos); // 假设压缩格式为JPEG
  391 +// int options = 100;
  392 +//
  393 +// int bytes = baos.toByteArray().length/1024;
  394 +////
  395 +// // 如果Bitmap的大小已经小于或等于指定的大小,则不需要进一步压缩
  396 +// while (bytes > maxSizeKB ) {
  397 +// // 每次减少质量,然后重新压缩
  398 +// options -= 5; // 降低质量
  399 +// baos.reset(); // 重置baos来清除数据
  400 +// bitmap.compress(getBitmapCompressFormat(bitmap), options, baos);
  401 +//
  402 +//
  403 +// bytes = baos.toByteArray().length/1024;
  404 +// }
  405 +//
  406 +//
  407 +//
  408 +//// while (baos.toByteArray().length / 1024 > maxSizeKB && options != 10) {
  409 +//// baos.reset(); // 清空baos以复用
  410 +//// options -= 10; // 每次减少10
  411 +//// bitmap.compress(getBitmapCompressFormat(bitmap), options, baos);
  412 +//// }
  413 +// ByteArrayInputStream isBm = new ByteArrayInputStream(baos.toByteArray());
  414 +// Bitmap compressedBitmap = BitmapFactory.decodeStream(isBm, null, null);
  415 +// // 释放资源
  416 +// baos.reset();
  417 +// try {
  418 +// baos.close();
  419 +// isBm.close();
  420 +// } catch (IOException e) {
  421 +// e.printStackTrace();
  422 +// }
  423 +// return compressedBitmap;
  424 +// }
  425 +
  426 +// public static Bitmap compressImage(Bitmap bitmap){
  427 +// int height = (int) ( bitmap.getHeight() * (512.0 / bitmap.getWidth()) );
  428 +// bitmap = Bitmap.createScaledBitmap(bitmap, 512, height, true);
  429 +// return bitmap;
  430 +// }
  431 +
  432 +
  433 +// public static Bitmap compressBitmapToSize(Bitmap image, int maxSizeKB) {
  434 +// ByteArrayOutputStream stream = new ByteArrayOutputStream();
  435 +// // 计算压缩比例
  436 +// int quality = 100;
  437 +// image.compress(Bitmap.CompressFormat.JPEG, quality, stream);
  438 +// // 如果图片大小大于指定大小,则以压缩质量为基准重复压缩
  439 +// while ((stream.toByteArray().length / 1024) > maxSizeKB && quality > 0) {
  440 +// stream.reset(); // 重置流以复用
  441 +// quality -= 5; // 每次减少5%的质量
  442 +// image.compress(getBitmapCompressFormat(image), quality, stream);
  443 +// }
  444 +// // 将流转换为字节
  445 +// byte[] imageBytes = stream.toByteArray();
  446 +// // 将字节转换为Bitmap
  447 +// Bitmap compressedImage = BitmapFactory.decodeByteArray(imageBytes, 0, imageBytes.length);
  448 +// // 释放资源
  449 +//
  450 +//// 关闭流
  451 +// try {
  452 +// stream.close();
  453 +// } catch (IOException e) {
  454 +// e.printStackTrace();
  455 +// }
  456 +// return compressedImage;
  457 +// }
  458 +
  459 +
  460 +// public static Bitmap compressBitmapToSize(Bitmap bitmap, int maxSizeKB) {
  461 +// ByteArrayOutputStream baos = new ByteArrayOutputStream();
  462 +// int quality = 100;
  463 +// int bytes = baos.toByteArray().length;
  464 +//
  465 +// // 如果Bitmap的大小已经小于或等于指定的大小,则不需要进一步压缩
  466 +// while (bytes > maxSizeKB ) {
  467 +// // 每次减少质量,然后重新压缩
  468 +// quality -= 5; // 降低质量
  469 +// baos.reset(); // 重置baos来清除数据
  470 +// bitmap.compress(getBitmapCompressFormat(bitmap), quality, baos);
  471 +//
  472 +//
  473 +// bytes = baos.toByteArray().length;
  474 +// }
  475 +//
  476 +// // 将压缩后的数据转换回Bitmap对象
  477 +// ByteArrayInputStream isBm = new ByteArrayInputStream(baos.toByteArray());
  478 +// Bitmap compressedBitmap = BitmapFactory.decodeStream(isBm, null, null);
  479 +// // 关闭流
  480 +// try {
  481 +// baos.close();
  482 +// isBm.close();
  483 +// } catch (IOException e) {
  484 +// e.printStackTrace();
  485 +// }
  486 +// return compressedBitmap;
  487 +// }
  488 +
  489 + public static Bitmap.CompressFormat getBitmapCompressFormat(Bitmap bitmap) {
  490 + Bitmap.Config config = bitmap.getConfig();
  491 + if (config == null) {
  492 + return Bitmap.CompressFormat.PNG;
  493 + }
  494 + switch (config) {
  495 + case RGB_565:
  496 + return Bitmap.CompressFormat.JPEG;
  497 + case ALPHA_8:
  498 + case ARGB_4444:
  499 + case ARGB_8888:
  500 + return Bitmap.CompressFormat.PNG;
  501 + default:
  502 + return Bitmap.CompressFormat.WEBP;
  503 + }
  504 + }
  505 +
  506 +
  507 +
  508 +
  509 +
  510 +// public static Bitmap getBitmapFromURL(String imageUrl) {
  511 +// HttpURLConnection connection = null;
  512 +// try {
  513 +// URL url = new URL(imageUrl);
  514 +// connection = (HttpURLConnection) url.openConnection();
  515 +// connection.setDoInput(true);
  516 +// connection.connect();
  517 +// BufferedInputStream inputStream = new BufferedInputStream(connection.getInputStream());
  518 +// Bitmap myBitmap = BitmapFactory.decodeStream(inputStream);
  519 +// inputStream.close();
  520 +// return myBitmap;
  521 +// } catch (IOException e) {
  522 +// e.printStackTrace();
  523 +// return null;
  524 +// } finally {
  525 +// if (connection != null) {
  526 +// connection.disconnect();
  527 +// }
  528 +// }
  529 +// }
  530 +
111 @Override 531 @Override
112 public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) { 532 public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) {
113 channel.setMethodCallHandler(null); 533 channel.setMethodCallHandler(null);
  1 +package com.wxwork.flutter_wxwork;
  2 +
  3 +
  4 +
  5 + import android.content.Context;
  6 + import android.graphics.Bitmap;
  7 + import android.os.Handler;
  8 + import android.os.Message;
  9 +
  10 + import java.lang.ref.SoftReference;
  11 + import java.util.HashMap;
  12 +
  13 +
  14 +/**
  15 + * Created by Administrator on 2017/9/5.
  16 + */
  17 +
  18 +public class LoadImageUtil {
  19 + private Context context;
  20 + private HashMap<String,SoftReference<Bitmap>> bitMaps;
  21 +
  22 + public LoadImageUtil(Context context) {
  23 + this.context = context;
  24 + this.bitMaps = new HashMap<String,SoftReference<Bitmap>>();//实例化缓存容器
  25 + }
  26 + //回调的接口
  27 + public interface CallBack{
  28 + public void callBack(String imgUrl,Bitmap bitmap);
  29 + }
  30 + //加载图片,进行缓存
  31 + public Bitmap loadBitmapByImgUrl(final String imgUrl, final CallBack callBack){
  32 +// //先判断缓存中有没有图片,得到图片
  33 +// SoftReference<Bitmap> soft = bitMaps.get(imgUrl);
  34 +// if(soft != null){
  35 +// Bitmap bitmap = soft.get();//从软引用中获得bitmap
  36 +// if(bitmap != null){//缓存中有次图片,直接用
  37 +// return bitmap;
  38 +// }else{
  39 +// bitMaps.remove(imgUrl);//key(图片的url)对应的bitmap消耗了,key也没有意义
  40 +// }
  41 +// }
  42 + //代码走到此处,说明缓存中没有图片,需要到第三级缓存:网络缓存去取
  43 + //通过handler实现子线程和ui主线程的通信
  44 + final Handler handler = new Handler(){
  45 + @Override
  46 + public void handleMessage(Message msg) {
  47 + super.handleMessage(msg);
  48 + Bitmap bitmap = (Bitmap) msg.obj;
  49 + callBack.callBack(imgUrl,bitmap);
  50 + }
  51 + };
  52 + //启动线程访问图片
  53 + new Thread(){
  54 + @Override
  55 + public void run() {
  56 + super.run();
  57 + //加载图片
  58 + Bitmap bitmap = new NetWorkUtils().getBitmapByHttpUrlConnectionGet(imgUrl);
  59 + //压缩图片
  60 +
  61 +
  62 + //把bitmap缓存到缓存中,通过软引用
  63 + bitMaps.put(imgUrl,new SoftReference<Bitmap>(bitmap));
  64 +
  65 + handler.sendMessage(handler.obtainMessage(1,bitmap));//发给handler
  66 + }
  67 + }.start();
  68 +
  69 +
  70 +
  71 +// //内存中没有图片,通过次线程去加载,然后放在缓存中
  72 +// bitMaps.put(imgUrl,bitmap);
  73 +
  74 + return null;
  75 + }
  76 +}
  1 +package com.wxwork.flutter_wxwork;
  2 +
  3 +
  4 +
  5 + import android.graphics.Bitmap;
  6 + import android.graphics.BitmapFactory;
  7 +
  8 + import java.io.IOException;
  9 + import java.io.InputStream;
  10 + import java.net.HttpURLConnection;
  11 + import java.net.MalformedURLException;
  12 + import java.net.URL;
  13 +
  14 +/**
  15 + * 网络请求的工具类
  16 + * Created by Administrator on 2017/9/1.
  17 + */
  18 +
  19 +public class NetWorkUtils {
  20 +
  21 + //获得json串的方法,通过HttpClient get
  22 + public String getJsonByHttpClientGet(String url){
  23 +
  24 +
  25 +
  26 + return "";
  27 + }
  28 + //获得json串的方法,通过HttpClient get
  29 + public String getJsonByHttpUrlConnectionGet(String jsonUrl){
  30 +
  31 + URL url = null;
  32 + HttpURLConnection httpURLConnection = null;
  33 + String strJson = "";
  34 + InputStream inputStream = null;
  35 + try {
  36 + url = new URL(jsonUrl);
  37 + httpURLConnection = (HttpURLConnection) url.openConnection();
  38 +
  39 + int responseCode = httpURLConnection.getResponseCode();
  40 + if(responseCode == 200){
  41 + inputStream = httpURLConnection.getInputStream();
  42 + byte[] b = new byte[1024];
  43 + int length = 0;
  44 +
  45 + while((length = inputStream.read(b)) != -1){//循环读取json串,拼装
  46 + strJson += new String(b,0,length);
  47 + }
  48 + }
  49 +
  50 + } catch (MalformedURLException e) {
  51 + e.printStackTrace();
  52 + } catch (IOException e) {
  53 + e.printStackTrace();
  54 + }finally {
  55 + if(inputStream != null){
  56 + try {
  57 + inputStream.close();
  58 + } catch (IOException e) {
  59 + e.printStackTrace();
  60 + }
  61 + }
  62 + }
  63 + return strJson;//返回最终的json数据
  64 + }
  65 +
  66 + //获得json串的方法,通过HttpClient get
  67 + public Bitmap getBitmapByHttpUrlConnectionGet(String imageUrl){
  68 + URL url = null;
  69 + HttpURLConnection httpURLConnection = null;
  70 + Bitmap bitmap = null;
  71 + InputStream inputStream = null;
  72 + try {
  73 + url = new URL(imageUrl);
  74 + httpURLConnection = (HttpURLConnection) url.openConnection();
  75 +
  76 + int responseCode = httpURLConnection.getResponseCode();
  77 + if(responseCode == 200){
  78 + inputStream = httpURLConnection.getInputStream();
  79 + bitmap = BitmapFactory.decodeStream(inputStream);//把图片信息(输入流)
  80 + }
  81 +
  82 + } catch (MalformedURLException e) {
  83 + e.printStackTrace();
  84 + } catch (IOException e) {
  85 + e.printStackTrace();
  86 + }finally {
  87 + if(inputStream != null){
  88 + try {
  89 + inputStream.close();
  90 + } catch (IOException e) {
  91 + e.printStackTrace();
  92 + }
  93 + }
  94 + }
  95 + return bitmap;//返回最终的json数据
  96 + }
  97 +}
@@ -32,9 +32,10 @@ Future<bool> shareImagePath(String path) { @@ -32,9 +32,10 @@ Future<bool> shareImagePath(String path) {
32 {String userName, //必须是应用关联的小程序,注意要有@app后缀 32 {String userName, //必须是应用关联的小程序,注意要有@app后缀
33 String path, 33 String path,
34 String hdImageData, 34 String hdImageData,
35 - String title = "分享标题"}) { 35 + String title = "分享标题",
  36 + String description = ""}) {
36 return FlutterWxworkPlatform.instance.shareMiniProgram( 37 return FlutterWxworkPlatform.instance.shareMiniProgram(
37 - userName: userName, path: path, hdImageData: hdImageData, title: title); 38 + userName: userName, path: path, hdImageData: hdImageData, title: title,description:description);
38 } 39 }
39 40
40 Future<bool> shareText({String text = "分享内容"}) { 41 Future<bool> shareText({String text = "分享内容"}) {
@@ -60,13 +60,15 @@ class MethodChannelFlutterWxwork extends FlutterWxworkPlatform { @@ -60,13 +60,15 @@ class MethodChannelFlutterWxwork extends FlutterWxworkPlatform {
60 {String userName, //必须是应用关联的小程序,注意要有@app后缀 60 {String userName, //必须是应用关联的小程序,注意要有@app后缀
61 String path, 61 String path,
62 String hdImageData, 62 String hdImageData,
63 - String title = "分享标题"}) async { 63 + String title = "分享标题",
  64 + String description= ""}) async {
64 final shareMiniProgram = await methodChannel.invokeMethod<bool>( 65 final shareMiniProgram = await methodChannel.invokeMethod<bool>(
65 'shareMiniProgram', <String, String>{ 66 'shareMiniProgram', <String, String>{
66 'userName': userName, 67 'userName': userName,
67 'path': path, 68 'path': path,
68 'hdImageData': hdImageData, 69 'hdImageData': hdImageData,
69 - 'title': title 70 + 'title': title,
  71 + "description":description
70 }); 72 });
71 return shareMiniProgram; 73 return shareMiniProgram;
72 } 74 }
@@ -53,7 +53,8 @@ abstract class FlutterWxworkPlatform extends PlatformInterface { @@ -53,7 +53,8 @@ abstract class FlutterWxworkPlatform extends PlatformInterface {
53 {String userName, //必须是应用关联的小程序,注意要有@app后缀 53 {String userName, //必须是应用关联的小程序,注意要有@app后缀
54 String path, 54 String path,
55 String hdImageData, 55 String hdImageData,
56 - String title = "分享标题"}) { 56 + String title = "分享标题",
  57 + String description = ""}) {
57 throw UnimplementedError('shareMiniProgram() has not been implemented.'); 58 throw UnimplementedError('shareMiniProgram() has not been implemented.');
58 } 59 }
59 60