├── .gitignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── android ├── .gitignore ├── build.gradle ├── gradle.properties ├── settings.gradle └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── plugin │ └── wechat │ └── flutter │ └── isanye │ └── cn │ └── syflutterwechat │ ├── SyFlutterWechatPlugin.java │ └── wxapi │ ├── StateManager.java │ └── WXPayEntryActivity.java ├── example ├── .gitignore ├── .metadata ├── README.md ├── android │ ├── app │ │ ├── build.gradle │ │ └── src │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ └── plugin │ │ │ │ └── wechat │ │ │ │ └── flutter │ │ │ │ └── isanye │ │ │ │ └── cn │ │ │ │ └── syflutterwechatexample │ │ │ │ └── MainActivity.java │ │ │ └── res │ │ │ ├── drawable │ │ │ └── launch_background.xml │ │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ └── ic_launcher.png │ │ │ └── values │ │ │ └── styles.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ └── settings.gradle ├── ios │ ├── Flutter │ │ ├── AppFrameworkInfo.plist │ │ ├── Debug.xcconfig │ │ └── Release.xcconfig │ ├── Podfile │ ├── Runner.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ └── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ └── WorkspaceSettings.xcsettings │ └── Runner │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ ├── Icon-App-20x20@1x.png │ │ │ ├── Icon-App-20x20@2x.png │ │ │ ├── Icon-App-20x20@3x.png │ │ │ ├── Icon-App-29x29@1x.png │ │ │ ├── Icon-App-29x29@2x.png │ │ │ ├── Icon-App-29x29@3x.png │ │ │ ├── Icon-App-40x40@1x.png │ │ │ ├── Icon-App-40x40@2x.png │ │ │ ├── Icon-App-40x40@3x.png │ │ │ ├── Icon-App-60x60@2x.png │ │ │ ├── Icon-App-60x60@3x.png │ │ │ ├── Icon-App-76x76@1x.png │ │ │ ├── Icon-App-76x76@2x.png │ │ │ └── Icon-App-83.5x83.5@2x.png │ │ └── LaunchImage.imageset │ │ │ ├── Contents.json │ │ │ ├── LaunchImage.png │ │ │ ├── LaunchImage@2x.png │ │ │ ├── LaunchImage@3x.png │ │ │ └── README.md │ │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ │ ├── Info.plist │ │ └── main.m ├── lib │ └── main.dart └── pubspec.yaml ├── ios ├── .gitignore ├── Assets │ └── .gitkeep ├── Classes │ ├── SyFlutterWechatPlugin.h │ └── SyFlutterWechatPlugin.m └── sy_flutter_wechat.podspec ├── lib └── sy_flutter_wechat.dart ├── pubspec.yaml ├── sy_flutter_wechat.iml └── sy_flutter_wechat_android.iml /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .dart_tool/ 3 | 4 | .packages 5 | .pub/ 6 | pubspec.lock 7 | 8 | build/ 9 | .idea/ 10 | idea/ -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | 2 | ## 0.2.2 3 | update pubspec.yaml description 4 | add more doc 5 | 6 | ## 0.2.1 7 | podspec add s.static_framework = true 8 | related [issue](https://github.com/lishuhao/sy_flutter_wechat/issues/1) 9 | 10 | ## 0.1.3 11 | 12 | * initial release. 13 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | TODO: Add your license here. 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # I'm sorry I cannot offer support for this package any more. Feel free to fork it, you have the source 2 | 3 |

4 | 5 | Build Status 6 | 7 |

8 | 9 | # sy_flutter_wechat 10 | 11 | 微信SDK flutter插件,支持Android和iOS 12 | 13 | - [x] 微信支付 14 | - [x] 分享文字 15 | - [x] 分享图片 16 | - [x] 分享链接 17 | - [ ] 分享音乐 18 | - [ ] 分享视频 19 | - [ ] 分享小程序 20 | 21 | 分享图片及链接暂时仅支持 **网络图片** , 22 | iOS分享网络图片如果不是 **HTTPS** 的话可能会失败,因为iOS ATS问题。 23 | 微信分享返回的结果仅代表调用微信分享sdk是否成功,不代表用户确实分享出去了, 24 | 微信2018年05月16日调整[分享政策](https://mp.weixin.qq.com/cgi-bin/announce?action=getannouncement&announce_id=11526372695t90Dn&version=&lang=zh_CN)。 25 | 26 | ### 使用方法 27 | 28 | #### Android 29 | 无需配置 30 | 31 | #### iOS 32 | 1. 参考 [微信文档](https://pay.weixin.qq.com/wiki/doc/api/app/app.php?chapter=8_5) 项目设置APPID 33 | 1. 修改 Background Modes,勾选以下两项,否则可能会收不到微信回调 34 | ![](https://raw.githubusercontent.com/lishuhao/assets/master/sy_flutter_wechat/background_mode.jpg) 35 | 36 | ### 示例代码 37 | 38 | ```dart 39 | import 'dart:convert'; 40 | 41 | import 'package:flutter/material.dart'; 42 | import 'package:sy_flutter_wechat/sy_flutter_wechat.dart'; 43 | 44 | void main() => runApp(new MyApp()); 45 | 46 | class MyApp extends StatefulWidget { 47 | @override 48 | _MyAppState createState() => new _MyAppState(); 49 | } 50 | 51 | class _MyAppState extends State { 52 | @override 53 | void initState() { 54 | super.initState(); 55 | _register(); 56 | } 57 | 58 | _register() async { 59 | bool result = await SyFlutterWechat.register('wxf9909bde17439ac2'); 60 | print(result); 61 | } 62 | 63 | @override 64 | Widget build(BuildContext context) { 65 | return new MaterialApp( 66 | home: new Scaffold( 67 | appBar: new AppBar( 68 | title: const Text('Plugin example app'), 69 | ), 70 | body: new ListView( 71 | padding: EdgeInsets.all(8.0), 72 | children: [ 73 | RaisedButton( 74 | child: Text('分享文字'), 75 | onPressed: () async { 76 | bool res = await SyFlutterWechat.shareText('hello world', 77 | shareType: SyShareType.session); 78 | print('分享文字:' + res.toString()); 79 | }, 80 | ), 81 | RaisedButton( 82 | child: Text('分享图片'), 83 | onPressed: () async { 84 | bool res = await SyFlutterWechat.shareImage( 85 | 'https://avatars0.githubusercontent.com/u/10024776', 86 | shareType: SyShareType.timeline); 87 | print('分享图片:' + res.toString()); 88 | }, 89 | ), 90 | RaisedButton( 91 | child: Text('分享网页'), 92 | onPressed: () async { 93 | bool res = await SyFlutterWechat.shareWebPage( 94 | '标题', 95 | '描述', 96 | 'https://avatars0.githubusercontent.com/u/10024776', 97 | 'http://www.example.com', 98 | shareType: SyShareType.session); 99 | print('分享网页:' + res.toString()); 100 | }, 101 | ), 102 | RaisedButton( 103 | child: Text('支付'), 104 | onPressed: () async { 105 | String payInfo = 106 | '{"appid":"wxf9909bde17439ac2","partnerid":"1518469211","prepayid":"wx120649521695951d501636f91748325073","package":"Sign=WXPay","noncestr":"1541976592","timestamp":"1541976592","sign":"E760C99A1A981B9A7D8F17B08EF60FCC"}'; 107 | SyPayResult payResult = await SyFlutterWechat.pay( 108 | SyPayInfo.fromJson(json.decode(payInfo))); 109 | print(payResult); 110 | }, 111 | ), 112 | ], 113 | ), 114 | ), 115 | ); 116 | } 117 | } 118 | ``` 119 | 120 | #### 121 | 其它Flutter plugin 122 | 123 | - [支付宝](https://github.com/lishuhao/sy_flutter_alipay) 124 | - [Flutter组件库](https://github.com/lishuhao/sy_flutter_widgets) 125 | - [高德定位](https://github.com/lishuhao/sy_flutter_amap) 126 | - [七牛云存储SDK](https://github.com/lishuhao/sy_flutter_qiniu_storage) 127 | -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | group 'plugin.wechat.flutter.isanye.cn.syflutterwechat' 2 | version '1.0-SNAPSHOT' 3 | 4 | buildscript { 5 | repositories { 6 | google() 7 | jcenter() 8 | } 9 | 10 | dependencies { 11 | classpath 'com.android.tools.build:gradle:3.1.2' 12 | } 13 | } 14 | 15 | rootProject.allprojects { 16 | repositories { 17 | google() 18 | jcenter() 19 | } 20 | } 21 | 22 | apply plugin: 'com.android.library' 23 | 24 | android { 25 | compileSdkVersion 27 26 | 27 | defaultConfig { 28 | minSdkVersion 16 29 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 30 | } 31 | lintOptions { 32 | disable 'InvalidPackage' 33 | } 34 | 35 | } 36 | dependencies { 37 | implementation 'com.tencent.mm.opensdk:wechat-sdk-android-without-mta:+' 38 | } 39 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'sy_flutter_wechat' 2 | -------------------------------------------------------------------------------- /android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 21 | 22 | 23 | 24 | 25 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /android/src/main/java/plugin/wechat/flutter/isanye/cn/syflutterwechat/SyFlutterWechatPlugin.java: -------------------------------------------------------------------------------- 1 | package plugin.wechat.flutter.isanye.cn.syflutterwechat; 2 | 3 | import android.content.BroadcastReceiver; 4 | import android.content.Context; 5 | import android.content.Intent; 6 | import android.content.IntentFilter; 7 | import android.graphics.Bitmap; 8 | import android.graphics.BitmapFactory; 9 | import android.util.Log; 10 | 11 | import com.tencent.mm.opensdk.modelmsg.SendMessageToWX; 12 | import com.tencent.mm.opensdk.modelmsg.WXImageObject; 13 | import com.tencent.mm.opensdk.modelmsg.WXMediaMessage; 14 | import com.tencent.mm.opensdk.modelmsg.WXTextObject; 15 | import com.tencent.mm.opensdk.modelmsg.WXWebpageObject; 16 | import com.tencent.mm.opensdk.modelpay.PayReq; 17 | import com.tencent.mm.opensdk.openapi.IWXAPI; 18 | import com.tencent.mm.opensdk.openapi.WXAPIFactory; 19 | 20 | import java.io.ByteArrayOutputStream; 21 | import java.io.IOException; 22 | import java.net.URL; 23 | 24 | import io.flutter.plugin.common.MethodCall; 25 | import io.flutter.plugin.common.MethodChannel; 26 | import io.flutter.plugin.common.MethodChannel.MethodCallHandler; 27 | import io.flutter.plugin.common.MethodChannel.Result; 28 | import io.flutter.plugin.common.PluginRegistry.Registrar; 29 | import plugin.wechat.flutter.isanye.cn.syflutterwechat.wxapi.StateManager; 30 | 31 | /** SyFlutterWechatPlugin */ 32 | public class SyFlutterWechatPlugin implements MethodCallHandler { 33 | 34 | private static final String TAG = "SyFlutterWechatPlugin>>"; 35 | public static final String filterName = "wxCallback"; 36 | private IWXAPI wxApi; 37 | private Registrar registrar; 38 | private static Result result; 39 | private static final int THUMB_SIZE = 150; 40 | 41 | 42 | //微信支付回调 43 | private static BroadcastReceiver wxpayCallbackReceiver = new BroadcastReceiver() { 44 | @Override 45 | public void onReceive(Context context, Intent intent) { 46 | Integer errCode = intent.getIntExtra("errCode",-3); 47 | Log.e(TAG,errCode.toString()); 48 | result.success(errCode); 49 | } 50 | }; 51 | 52 | /** Plugin registration. */ 53 | public static void registerWith(Registrar registrar) { 54 | final MethodChannel channel = new MethodChannel(registrar.messenger(), "sy_flutter_wechat"); 55 | final SyFlutterWechatPlugin plugin = new SyFlutterWechatPlugin(registrar); 56 | channel.setMethodCallHandler(plugin); 57 | registrar.context().registerReceiver(wxpayCallbackReceiver,new IntentFilter(filterName)); 58 | } 59 | 60 | private SyFlutterWechatPlugin(Registrar registrar){ 61 | this.registrar = registrar; 62 | } 63 | 64 | 65 | @Override 66 | public void onMethodCall(MethodCall call, Result result) { 67 | SyFlutterWechatPlugin.result = result; 68 | switch (call.method) { 69 | case "getPlatformVersion": 70 | result.success("Android " + android.os.Build.VERSION.RELEASE); 71 | break; 72 | case "register": 73 | this.registerToWX(call,result); 74 | break; 75 | case "shareText": 76 | this.shareText(call,result); 77 | break; 78 | case "shareImage": 79 | this.shareImage(call,result); 80 | break; 81 | case "shareWebPage": 82 | this.shareWebPage(call,result); 83 | break; 84 | case "pay": 85 | this.pay(call); 86 | break; 87 | default: 88 | result.notImplemented(); 89 | break; 90 | } 91 | } 92 | 93 | //注册微信app id 94 | private void registerToWX(MethodCall call, Result result){ 95 | String appId = call.argument("appId"); 96 | wxApi = WXAPIFactory.createWXAPI(registrar.context(),appId); 97 | boolean res =wxApi.registerApp(appId); 98 | StateManager.setApi(wxApi); 99 | result.success(res); 100 | } 101 | 102 | private void shareText(MethodCall call, Result result){ 103 | String text = call.argument("text"); 104 | String shareType = call.argument("shareType"); 105 | 106 | WXTextObject textObj = new WXTextObject(); 107 | textObj.text = text; 108 | 109 | WXMediaMessage msg = new WXMediaMessage(); 110 | msg.mediaObject = textObj; 111 | msg.description = text; 112 | 113 | SendMessageToWX.Req req = new SendMessageToWX.Req(); 114 | req.scene = _convertShareType(shareType); 115 | req.message = msg; 116 | //req.transaction = buildTransaction(""); 117 | boolean res = wxApi.sendReq(req); 118 | //result.success(res); 119 | } 120 | 121 | private void shareImage(final MethodCall call, final Result result){ 122 | final String imageUrl = call.argument("imageUrl"); 123 | final String shareType = call.argument("shareType"); 124 | new Thread(new Runnable() { 125 | WXMediaMessage msg = new WXMediaMessage(); 126 | @Override 127 | public void run() { 128 | try { 129 | Bitmap bmp = BitmapFactory.decodeStream(new URL(imageUrl).openStream()); 130 | WXImageObject imageObject = new WXImageObject(bmp); 131 | Bitmap thumbBmp = Bitmap.createScaledBitmap(bmp, THUMB_SIZE, THUMB_SIZE, true); 132 | 133 | msg.mediaObject = imageObject; 134 | bmp.recycle(); 135 | msg.thumbData = SyFlutterWechatPlugin.bmpToByteArray(thumbBmp, true); 136 | }catch (IOException e){ 137 | e.printStackTrace(); 138 | } 139 | 140 | SendMessageToWX.Req req = new SendMessageToWX.Req(); 141 | req.scene = _convertShareType(shareType); 142 | req.message = msg; 143 | boolean res = wxApi.sendReq(req); 144 | result.success(res); 145 | } 146 | } 147 | ).start(); 148 | } 149 | 150 | private void shareWebPage(final MethodCall call, final Result result){ 151 | final String title = call.argument("title"); 152 | final String description = call.argument("description"); 153 | final String imageUrl = call.argument("imageUrl"); 154 | final String webPageUrl = call.argument("webPageUrl"); 155 | final String shareType = call.argument("shareType"); 156 | new Thread(new Runnable() { 157 | WXWebpageObject webPage = new WXWebpageObject(); 158 | 159 | @Override 160 | public void run() { 161 | webPage.webpageUrl = webPageUrl; 162 | WXMediaMessage msg = new WXMediaMessage(webPage); 163 | msg.title = title; 164 | msg.description = description; 165 | try { 166 | Bitmap bmp = BitmapFactory.decodeStream(new URL(imageUrl).openStream()); 167 | Bitmap thumbBmp = Bitmap.createScaledBitmap(bmp, THUMB_SIZE, THUMB_SIZE, true); 168 | bmp.recycle(); 169 | msg.thumbData = SyFlutterWechatPlugin.bmpToByteArray(thumbBmp, true); 170 | }catch (IOException e){ 171 | e.printStackTrace(); 172 | } 173 | 174 | SendMessageToWX.Req req = new SendMessageToWX.Req(); 175 | req.scene = _convertShareType(shareType); 176 | req.message = msg; 177 | boolean res = wxApi.sendReq(req); 178 | result.success(res); 179 | } 180 | } 181 | ).start(); 182 | } 183 | 184 | //调起微信支付 185 | private void pay(MethodCall call){ 186 | PayReq req = new PayReq(); 187 | req.appId = call.argument("appid"); 188 | req.partnerId = call.argument("partnerid"); 189 | req.prepayId= call.argument("prepayid"); 190 | req.packageValue = call.argument("package"); 191 | req.nonceStr= call.argument("noncestr"); 192 | req.timeStamp= call.argument("timestamp"); 193 | req.sign= call.argument("sign"); 194 | wxApi.sendReq(req); 195 | } 196 | 197 | 198 | private static int _convertShareType(String shareType){ 199 | switch (shareType){ 200 | case "session": 201 | return SendMessageToWX.Req.WXSceneSession; 202 | case "timeline": 203 | return SendMessageToWX.Req.WXSceneTimeline; 204 | case "favorite": 205 | return SendMessageToWX.Req.WXSceneFavorite; 206 | default: 207 | return SendMessageToWX.Req.WXSceneSession; 208 | } 209 | } 210 | 211 | private static byte[] bmpToByteArray(final Bitmap bmp, final boolean needRecycle) { 212 | ByteArrayOutputStream output = new ByteArrayOutputStream(); 213 | bmp.compress(Bitmap.CompressFormat.PNG, 100, output); 214 | if (needRecycle) { 215 | bmp.recycle(); 216 | } 217 | 218 | byte[] result = output.toByteArray(); 219 | try { 220 | output.close(); 221 | } catch (Exception e) { 222 | e.printStackTrace(); 223 | } 224 | 225 | return result; 226 | } 227 | 228 | } 229 | -------------------------------------------------------------------------------- /android/src/main/java/plugin/wechat/flutter/isanye/cn/syflutterwechat/wxapi/StateManager.java: -------------------------------------------------------------------------------- 1 | package plugin.wechat.flutter.isanye.cn.syflutterwechat.wxapi; 2 | 3 | import com.tencent.mm.opensdk.openapi.IWXAPI; 4 | 5 | //保存wxapi供微信支付回调时使用 6 | public class StateManager { 7 | 8 | private static IWXAPI wxapi = null; 9 | 10 | public static void setApi(IWXAPI wxapi){ 11 | StateManager.wxapi = wxapi; 12 | } 13 | 14 | public static IWXAPI getAPi(){ 15 | return StateManager.wxapi; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /android/src/main/java/plugin/wechat/flutter/isanye/cn/syflutterwechat/wxapi/WXPayEntryActivity.java: -------------------------------------------------------------------------------- 1 | package plugin.wechat.flutter.isanye.cn.syflutterwechat.wxapi; 2 | 3 | import android.app.Activity; 4 | import android.content.Intent; 5 | import android.os.Bundle; 6 | import android.util.Log; 7 | 8 | import com.tencent.mm.opensdk.constants.ConstantsAPI; 9 | import com.tencent.mm.opensdk.modelbase.BaseReq; 10 | import com.tencent.mm.opensdk.modelbase.BaseResp; 11 | import com.tencent.mm.opensdk.openapi.IWXAPI; 12 | import com.tencent.mm.opensdk.openapi.IWXAPIEventHandler; 13 | 14 | import plugin.wechat.flutter.isanye.cn.syflutterwechat.SyFlutterWechatPlugin; 15 | 16 | public class WXPayEntryActivity extends Activity implements IWXAPIEventHandler{ 17 | private static final String TAG = "WXPayEntryActivity"; 18 | //微信支付 19 | private IWXAPI iwxapi; 20 | 21 | @Override 22 | protected void onCreate( Bundle savedInstanceState) { 23 | super.onCreate(savedInstanceState); 24 | iwxapi = StateManager.getAPi(); 25 | iwxapi.handleIntent(getIntent(), this); 26 | } 27 | 28 | @Override 29 | protected void onNewIntent(Intent intent) { 30 | super.onNewIntent(intent); 31 | setIntent(intent); 32 | iwxapi.handleIntent(intent, this); 33 | } 34 | 35 | @Override 36 | public void onReq(BaseReq baseReq) { 37 | Log.e(TAG,"req"); 38 | } 39 | 40 | @Override 41 | public void onResp(BaseResp baseResp) { 42 | Log.e(TAG,"微信支付回调"); 43 | 44 | //微信支付 45 | if(baseResp.getType() == ConstantsAPI.COMMAND_PAY_BY_WX){ 46 | Log.e(TAG,"errCode:"+String.valueOf(baseResp.errCode)); 47 | Intent i = new Intent(SyFlutterWechatPlugin.filterName); 48 | i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 49 | i.putExtra("errCode", baseResp.errCode); 50 | this.sendBroadcast(i); 51 | } 52 | finish(); 53 | Log.e(TAG,baseResp.errStr); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.lock 4 | *.log 5 | *.pyc 6 | *.swp 7 | .DS_Store 8 | .atom/ 9 | .buildlog/ 10 | .history 11 | .svn/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # Visual Studio Code related 20 | .vscode/ 21 | 22 | # Flutter/Dart/Pub related 23 | **/doc/api/ 24 | .dart_tool/ 25 | .flutter-plugins 26 | .packages 27 | .pub-cache/ 28 | .pub/ 29 | build/ 30 | 31 | # Android related 32 | **/android/**/gradle-wrapper.jar 33 | **/android/.gradle 34 | **/android/captures/ 35 | **/android/gradlew 36 | **/android/gradlew.bat 37 | **/android/local.properties 38 | **/android/**/GeneratedPluginRegistrant.java 39 | 40 | # iOS/XCode related 41 | **/ios/**/*.mode1v3 42 | **/ios/**/*.mode2v3 43 | **/ios/**/*.moved-aside 44 | **/ios/**/*.pbxuser 45 | **/ios/**/*.perspectivev3 46 | **/ios/**/*sync/ 47 | **/ios/**/.sconsign.dblite 48 | **/ios/**/.tags* 49 | **/ios/**/.vagrant/ 50 | **/ios/**/DerivedData/ 51 | **/ios/**/Icon? 52 | **/ios/**/Pods/ 53 | **/ios/**/.symlinks/ 54 | **/ios/**/profile 55 | **/ios/**/xcuserdata 56 | **/ios/.generated/ 57 | **/ios/Flutter/App.framework 58 | **/ios/Flutter/Flutter.framework 59 | **/ios/Flutter/Generated.xcconfig 60 | **/ios/Flutter/app.flx 61 | **/ios/Flutter/app.zip 62 | **/ios/Flutter/flutter_assets/ 63 | **/ios/ServiceDefinitions.json 64 | **/ios/Runner/GeneratedPluginRegistrant.* 65 | 66 | # Exceptions to above rules. 67 | !**/ios/**/default.mode1v3 68 | !**/ios/**/default.mode2v3 69 | !**/ios/**/default.pbxuser 70 | !**/ios/**/default.perspectivev3 71 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 72 | -------------------------------------------------------------------------------- /example/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: f37c235c32fc15babe6dc7b7bc2ee4387e5ecf92 8 | channel: beta 9 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # sy_flutter_wechat_example 2 | 3 | Demonstrates how to use the sy_flutter_wechat plugin. 4 | 5 | ## Getting Started 6 | 7 | For help getting started with Flutter, view our online 8 | [documentation](https://flutter.io/). 9 | -------------------------------------------------------------------------------- /example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 26 | 27 | android { 28 | compileSdkVersion 27 29 | 30 | lintOptions { 31 | disable 'InvalidPackage' 32 | } 33 | 34 | defaultConfig { 35 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 36 | applicationId "plugin.wechat.flutter.isanye.cn.syflutterwechatexample" 37 | minSdkVersion 16 38 | targetSdkVersion 27 39 | versionCode flutterVersionCode.toInteger() 40 | versionName flutterVersionName 41 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 42 | } 43 | 44 | buildTypes { 45 | release { 46 | // TODO: Add your own signing config for the release build. 47 | // Signing with the debug keys for now, so `flutter run --release` works. 48 | signingConfig signingConfigs.debug 49 | } 50 | } 51 | } 52 | 53 | flutter { 54 | source '../..' 55 | } 56 | 57 | dependencies { 58 | testImplementation 'junit:junit:4.12' 59 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 60 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 61 | } 62 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 8 | 9 | 10 | 15 | 19 | 26 | 30 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /example/android/app/src/main/java/plugin/wechat/flutter/isanye/cn/syflutterwechatexample/MainActivity.java: -------------------------------------------------------------------------------- 1 | package plugin.wechat.flutter.isanye.cn.syflutterwechatexample; 2 | 3 | import android.os.Bundle; 4 | import io.flutter.app.FlutterActivity; 5 | import io.flutter.plugins.GeneratedPluginRegistrant; 6 | 7 | public class MainActivity extends FlutterActivity { 8 | @Override 9 | protected void onCreate(Bundle savedInstanceState) { 10 | super.onCreate(savedInstanceState); 11 | GeneratedPluginRegistrant.registerWith(this); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lishuhao/sy_flutter_wechat/968439d93249e04c1ce47f08950e2e2b4d262ae0/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lishuhao/sy_flutter_wechat/968439d93249e04c1ce47f08950e2e2b4d262ae0/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lishuhao/sy_flutter_wechat/968439d93249e04c1ce47f08950e2e2b4d262ae0/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lishuhao/sy_flutter_wechat/968439d93249e04c1ce47f08950e2e2b4d262ae0/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lishuhao/sy_flutter_wechat/968439d93249e04c1ce47f08950e2e2b4d262ae0/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | google() 4 | jcenter() 5 | } 6 | 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:3.1.2' 9 | } 10 | } 11 | 12 | allprojects { 13 | repositories { 14 | google() 15 | jcenter() 16 | } 17 | } 18 | 19 | rootProject.buildDir = '../build' 20 | subprojects { 21 | project.buildDir = "${rootProject.buildDir}/${project.name}" 22 | } 23 | subprojects { 24 | project.evaluationDependsOn(':app') 25 | } 26 | 27 | task clean(type: Delete) { 28 | delete rootProject.buildDir 29 | } 30 | -------------------------------------------------------------------------------- /example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip 7 | -------------------------------------------------------------------------------- /example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() 4 | 5 | def plugins = new Properties() 6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') 7 | if (pluginsFile.exists()) { 8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } 9 | } 10 | 11 | plugins.each { name, path -> 12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() 13 | include ":$name" 14 | project(":$name").projectDir = pluginDirectory 15 | } 16 | -------------------------------------------------------------------------------- /example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '9.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | def parse_KV_file(file, separator='=') 8 | file_abs_path = File.expand_path(file) 9 | if !File.exists? file_abs_path 10 | return []; 11 | end 12 | pods_ary = [] 13 | skip_line_start_symbols = ["#", "/"] 14 | File.foreach(file_abs_path) { |line| 15 | next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ } 16 | plugin = line.split(pattern=separator) 17 | if plugin.length == 2 18 | podname = plugin[0].strip() 19 | path = plugin[1].strip() 20 | podpath = File.expand_path("#{path}", file_abs_path) 21 | pods_ary.push({:name => podname, :path => podpath}); 22 | else 23 | puts "Invalid plugin specification: #{line}" 24 | end 25 | } 26 | return pods_ary 27 | end 28 | 29 | target 'Runner' do 30 | # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock 31 | # referring to absolute paths on developers' machines. 32 | system('rm -rf .symlinks') 33 | system('mkdir -p .symlinks/plugins') 34 | 35 | # Flutter Pods 36 | generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig') 37 | if generated_xcode_build_settings.empty? 38 | puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first." 39 | end 40 | generated_xcode_build_settings.map { |p| 41 | if p[:name] == 'FLUTTER_FRAMEWORK_DIR' 42 | symlink = File.join('.symlinks', 'flutter') 43 | File.symlink(File.dirname(p[:path]), symlink) 44 | pod 'Flutter', :path => File.join(symlink, File.basename(p[:path])) 45 | end 46 | } 47 | 48 | # Plugin Pods 49 | plugin_pods = parse_KV_file('../.flutter-plugins') 50 | plugin_pods.map { |p| 51 | symlink = File.join('.symlinks', 'plugins', p[:name]) 52 | File.symlink(p[:path], symlink) 53 | pod p[:name], :path => File.join(symlink, 'ios') 54 | } 55 | end 56 | 57 | post_install do |installer| 58 | installer.pods_project.targets.each do |target| 59 | target.build_configurations.each do |config| 60 | config.build_settings['ENABLE_BITCODE'] = 'NO' 61 | end 62 | end 63 | end 64 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 11 | 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */ = {isa = PBXBuildFile; fileRef = 2D5378251FAA1A9400D5DBA9 /* flutter_assets */; }; 12 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 13 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; 14 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 15 | 46D033098A50A02A9BB6E656 /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 93B3E097F5DE665CDFB1F821 /* libPods-Runner.a */; }; 16 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; 17 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 18 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; }; 19 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; 20 | 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; 21 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 22 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 23 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 24 | /* End PBXBuildFile section */ 25 | 26 | /* Begin PBXCopyFilesBuildPhase section */ 27 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 28 | isa = PBXCopyFilesBuildPhase; 29 | buildActionMask = 2147483647; 30 | dstPath = ""; 31 | dstSubfolderSpec = 10; 32 | files = ( 33 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, 34 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, 35 | ); 36 | name = "Embed Frameworks"; 37 | runOnlyForDeploymentPostprocessing = 0; 38 | }; 39 | /* End PBXCopyFilesBuildPhase section */ 40 | 41 | /* Begin PBXFileReference section */ 42 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 43 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 44 | 2D5378251FAA1A9400D5DBA9 /* flutter_assets */ = {isa = PBXFileReference; lastKnownFileType = folder; name = flutter_assets; path = Flutter/flutter_assets; sourceTree = SOURCE_ROOT; }; 45 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 46 | 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; 47 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 48 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 49 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 50 | 93B3E097F5DE665CDFB1F821 /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 51 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 52 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 53 | 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; 54 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 55 | 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 56 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 57 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 58 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 59 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 60 | /* End PBXFileReference section */ 61 | 62 | /* Begin PBXFrameworksBuildPhase section */ 63 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 64 | isa = PBXFrameworksBuildPhase; 65 | buildActionMask = 2147483647; 66 | files = ( 67 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, 68 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, 69 | 46D033098A50A02A9BB6E656 /* libPods-Runner.a in Frameworks */, 70 | ); 71 | runOnlyForDeploymentPostprocessing = 0; 72 | }; 73 | /* End PBXFrameworksBuildPhase section */ 74 | 75 | /* Begin PBXGroup section */ 76 | 9740EEB11CF90186004384FC /* Flutter */ = { 77 | isa = PBXGroup; 78 | children = ( 79 | 2D5378251FAA1A9400D5DBA9 /* flutter_assets */, 80 | 3B80C3931E831B6300D905FE /* App.framework */, 81 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 82 | 9740EEBA1CF902C7004384FC /* Flutter.framework */, 83 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 84 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 85 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 86 | ); 87 | name = Flutter; 88 | sourceTree = ""; 89 | }; 90 | 97C146E51CF9000F007C117D = { 91 | isa = PBXGroup; 92 | children = ( 93 | 9740EEB11CF90186004384FC /* Flutter */, 94 | 97C146F01CF9000F007C117D /* Runner */, 95 | 97C146EF1CF9000F007C117D /* Products */, 96 | 9E45A07396B3E3327259225D /* Pods */, 97 | A1D8DD3E1443B387E38F7081 /* Frameworks */, 98 | ); 99 | sourceTree = ""; 100 | }; 101 | 97C146EF1CF9000F007C117D /* Products */ = { 102 | isa = PBXGroup; 103 | children = ( 104 | 97C146EE1CF9000F007C117D /* Runner.app */, 105 | ); 106 | name = Products; 107 | sourceTree = ""; 108 | }; 109 | 97C146F01CF9000F007C117D /* Runner */ = { 110 | isa = PBXGroup; 111 | children = ( 112 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */, 113 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */, 114 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 115 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 116 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 117 | 97C147021CF9000F007C117D /* Info.plist */, 118 | 97C146F11CF9000F007C117D /* Supporting Files */, 119 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 120 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 121 | ); 122 | path = Runner; 123 | sourceTree = ""; 124 | }; 125 | 97C146F11CF9000F007C117D /* Supporting Files */ = { 126 | isa = PBXGroup; 127 | children = ( 128 | 97C146F21CF9000F007C117D /* main.m */, 129 | ); 130 | name = "Supporting Files"; 131 | sourceTree = ""; 132 | }; 133 | 9E45A07396B3E3327259225D /* Pods */ = { 134 | isa = PBXGroup; 135 | children = ( 136 | ); 137 | name = Pods; 138 | sourceTree = ""; 139 | }; 140 | A1D8DD3E1443B387E38F7081 /* Frameworks */ = { 141 | isa = PBXGroup; 142 | children = ( 143 | 93B3E097F5DE665CDFB1F821 /* libPods-Runner.a */, 144 | ); 145 | name = Frameworks; 146 | sourceTree = ""; 147 | }; 148 | /* End PBXGroup section */ 149 | 150 | /* Begin PBXNativeTarget section */ 151 | 97C146ED1CF9000F007C117D /* Runner */ = { 152 | isa = PBXNativeTarget; 153 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 154 | buildPhases = ( 155 | DF74D48E56DCC76227DCFEAA /* [CP] Check Pods Manifest.lock */, 156 | 9740EEB61CF901F6004384FC /* Run Script */, 157 | 97C146EA1CF9000F007C117D /* Sources */, 158 | 97C146EB1CF9000F007C117D /* Frameworks */, 159 | 97C146EC1CF9000F007C117D /* Resources */, 160 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 161 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 162 | 30AC44CF00D3CFE8BD8881D2 /* [CP] Embed Pods Frameworks */, 163 | ); 164 | buildRules = ( 165 | ); 166 | dependencies = ( 167 | ); 168 | name = Runner; 169 | productName = Runner; 170 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 171 | productType = "com.apple.product-type.application"; 172 | }; 173 | /* End PBXNativeTarget section */ 174 | 175 | /* Begin PBXProject section */ 176 | 97C146E61CF9000F007C117D /* Project object */ = { 177 | isa = PBXProject; 178 | attributes = { 179 | LastUpgradeCheck = 0910; 180 | ORGANIZATIONNAME = "The Chromium Authors"; 181 | TargetAttributes = { 182 | 97C146ED1CF9000F007C117D = { 183 | CreatedOnToolsVersion = 7.3.1; 184 | DevelopmentTeam = JVV4SK28PS; 185 | SystemCapabilities = { 186 | com.apple.BackgroundModes = { 187 | enabled = 1; 188 | }; 189 | }; 190 | }; 191 | }; 192 | }; 193 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 194 | compatibilityVersion = "Xcode 3.2"; 195 | developmentRegion = English; 196 | hasScannedForEncodings = 0; 197 | knownRegions = ( 198 | en, 199 | Base, 200 | ); 201 | mainGroup = 97C146E51CF9000F007C117D; 202 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 203 | projectDirPath = ""; 204 | projectRoot = ""; 205 | targets = ( 206 | 97C146ED1CF9000F007C117D /* Runner */, 207 | ); 208 | }; 209 | /* End PBXProject section */ 210 | 211 | /* Begin PBXResourcesBuildPhase section */ 212 | 97C146EC1CF9000F007C117D /* Resources */ = { 213 | isa = PBXResourcesBuildPhase; 214 | buildActionMask = 2147483647; 215 | files = ( 216 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 217 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 218 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */, 219 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 220 | 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */, 221 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 222 | ); 223 | runOnlyForDeploymentPostprocessing = 0; 224 | }; 225 | /* End PBXResourcesBuildPhase section */ 226 | 227 | /* Begin PBXShellScriptBuildPhase section */ 228 | 30AC44CF00D3CFE8BD8881D2 /* [CP] Embed Pods Frameworks */ = { 229 | isa = PBXShellScriptBuildPhase; 230 | buildActionMask = 2147483647; 231 | files = ( 232 | ); 233 | inputPaths = ( 234 | "${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh", 235 | "${PODS_ROOT}/../.symlinks/flutter/ios/Flutter.framework", 236 | ); 237 | name = "[CP] Embed Pods Frameworks"; 238 | outputPaths = ( 239 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework", 240 | ); 241 | runOnlyForDeploymentPostprocessing = 0; 242 | shellPath = /bin/sh; 243 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; 244 | showEnvVarsInLog = 0; 245 | }; 246 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 247 | isa = PBXShellScriptBuildPhase; 248 | buildActionMask = 2147483647; 249 | files = ( 250 | ); 251 | inputPaths = ( 252 | ); 253 | name = "Thin Binary"; 254 | outputPaths = ( 255 | ); 256 | runOnlyForDeploymentPostprocessing = 0; 257 | shellPath = /bin/sh; 258 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; 259 | }; 260 | 9740EEB61CF901F6004384FC /* Run Script */ = { 261 | isa = PBXShellScriptBuildPhase; 262 | buildActionMask = 2147483647; 263 | files = ( 264 | ); 265 | inputPaths = ( 266 | ); 267 | name = "Run Script"; 268 | outputPaths = ( 269 | ); 270 | runOnlyForDeploymentPostprocessing = 0; 271 | shellPath = /bin/sh; 272 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 273 | }; 274 | DF74D48E56DCC76227DCFEAA /* [CP] Check Pods Manifest.lock */ = { 275 | isa = PBXShellScriptBuildPhase; 276 | buildActionMask = 2147483647; 277 | files = ( 278 | ); 279 | inputPaths = ( 280 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 281 | "${PODS_ROOT}/Manifest.lock", 282 | ); 283 | name = "[CP] Check Pods Manifest.lock"; 284 | outputPaths = ( 285 | "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", 286 | ); 287 | runOnlyForDeploymentPostprocessing = 0; 288 | shellPath = /bin/sh; 289 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 290 | showEnvVarsInLog = 0; 291 | }; 292 | /* End PBXShellScriptBuildPhase section */ 293 | 294 | /* Begin PBXSourcesBuildPhase section */ 295 | 97C146EA1CF9000F007C117D /* Sources */ = { 296 | isa = PBXSourcesBuildPhase; 297 | buildActionMask = 2147483647; 298 | files = ( 299 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */, 300 | 97C146F31CF9000F007C117D /* main.m in Sources */, 301 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 302 | ); 303 | runOnlyForDeploymentPostprocessing = 0; 304 | }; 305 | /* End PBXSourcesBuildPhase section */ 306 | 307 | /* Begin PBXVariantGroup section */ 308 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 309 | isa = PBXVariantGroup; 310 | children = ( 311 | 97C146FB1CF9000F007C117D /* Base */, 312 | ); 313 | name = Main.storyboard; 314 | sourceTree = ""; 315 | }; 316 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 317 | isa = PBXVariantGroup; 318 | children = ( 319 | 97C147001CF9000F007C117D /* Base */, 320 | ); 321 | name = LaunchScreen.storyboard; 322 | sourceTree = ""; 323 | }; 324 | /* End PBXVariantGroup section */ 325 | 326 | /* Begin XCBuildConfiguration section */ 327 | 97C147031CF9000F007C117D /* Debug */ = { 328 | isa = XCBuildConfiguration; 329 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 330 | buildSettings = { 331 | ALWAYS_SEARCH_USER_PATHS = NO; 332 | CLANG_ANALYZER_NONNULL = YES; 333 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 334 | CLANG_CXX_LIBRARY = "libc++"; 335 | CLANG_ENABLE_MODULES = YES; 336 | CLANG_ENABLE_OBJC_ARC = YES; 337 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 338 | CLANG_WARN_BOOL_CONVERSION = YES; 339 | CLANG_WARN_COMMA = YES; 340 | CLANG_WARN_CONSTANT_CONVERSION = YES; 341 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 342 | CLANG_WARN_EMPTY_BODY = YES; 343 | CLANG_WARN_ENUM_CONVERSION = YES; 344 | CLANG_WARN_INFINITE_RECURSION = YES; 345 | CLANG_WARN_INT_CONVERSION = YES; 346 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 347 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 348 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 349 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 350 | CLANG_WARN_STRICT_PROTOTYPES = YES; 351 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 352 | CLANG_WARN_UNREACHABLE_CODE = YES; 353 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 354 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 355 | COPY_PHASE_STRIP = NO; 356 | DEBUG_INFORMATION_FORMAT = dwarf; 357 | ENABLE_STRICT_OBJC_MSGSEND = YES; 358 | ENABLE_TESTABILITY = YES; 359 | GCC_C_LANGUAGE_STANDARD = gnu99; 360 | GCC_DYNAMIC_NO_PIC = NO; 361 | GCC_NO_COMMON_BLOCKS = YES; 362 | GCC_OPTIMIZATION_LEVEL = 0; 363 | GCC_PREPROCESSOR_DEFINITIONS = ( 364 | "DEBUG=1", 365 | "$(inherited)", 366 | ); 367 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 368 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 369 | GCC_WARN_UNDECLARED_SELECTOR = YES; 370 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 371 | GCC_WARN_UNUSED_FUNCTION = YES; 372 | GCC_WARN_UNUSED_VARIABLE = YES; 373 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 374 | MTL_ENABLE_DEBUG_INFO = YES; 375 | ONLY_ACTIVE_ARCH = YES; 376 | SDKROOT = iphoneos; 377 | TARGETED_DEVICE_FAMILY = "1,2"; 378 | }; 379 | name = Debug; 380 | }; 381 | 97C147041CF9000F007C117D /* Release */ = { 382 | isa = XCBuildConfiguration; 383 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 384 | buildSettings = { 385 | ALWAYS_SEARCH_USER_PATHS = NO; 386 | CLANG_ANALYZER_NONNULL = YES; 387 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 388 | CLANG_CXX_LIBRARY = "libc++"; 389 | CLANG_ENABLE_MODULES = YES; 390 | CLANG_ENABLE_OBJC_ARC = YES; 391 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 392 | CLANG_WARN_BOOL_CONVERSION = YES; 393 | CLANG_WARN_COMMA = YES; 394 | CLANG_WARN_CONSTANT_CONVERSION = YES; 395 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 396 | CLANG_WARN_EMPTY_BODY = YES; 397 | CLANG_WARN_ENUM_CONVERSION = YES; 398 | CLANG_WARN_INFINITE_RECURSION = YES; 399 | CLANG_WARN_INT_CONVERSION = YES; 400 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 401 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 402 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 403 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 404 | CLANG_WARN_STRICT_PROTOTYPES = YES; 405 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 406 | CLANG_WARN_UNREACHABLE_CODE = YES; 407 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 408 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 409 | COPY_PHASE_STRIP = NO; 410 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 411 | ENABLE_NS_ASSERTIONS = NO; 412 | ENABLE_STRICT_OBJC_MSGSEND = YES; 413 | GCC_C_LANGUAGE_STANDARD = gnu99; 414 | GCC_NO_COMMON_BLOCKS = YES; 415 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 416 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 417 | GCC_WARN_UNDECLARED_SELECTOR = YES; 418 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 419 | GCC_WARN_UNUSED_FUNCTION = YES; 420 | GCC_WARN_UNUSED_VARIABLE = YES; 421 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 422 | MTL_ENABLE_DEBUG_INFO = NO; 423 | SDKROOT = iphoneos; 424 | TARGETED_DEVICE_FAMILY = "1,2"; 425 | VALIDATE_PRODUCT = YES; 426 | }; 427 | name = Release; 428 | }; 429 | 97C147061CF9000F007C117D /* Debug */ = { 430 | isa = XCBuildConfiguration; 431 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 432 | buildSettings = { 433 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 434 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 435 | DEVELOPMENT_TEAM = JVV4SK28PS; 436 | ENABLE_BITCODE = NO; 437 | FRAMEWORK_SEARCH_PATHS = ( 438 | "$(inherited)", 439 | "$(PROJECT_DIR)/Flutter", 440 | ); 441 | INFOPLIST_FILE = Runner/Info.plist; 442 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 443 | LIBRARY_SEARCH_PATHS = ( 444 | "$(inherited)", 445 | "$(PROJECT_DIR)/Flutter", 446 | ); 447 | PRODUCT_BUNDLE_IDENTIFIER = plugin.wechat.flutter.isanye.cn.syFlutterWechatExample; 448 | PRODUCT_NAME = "$(TARGET_NAME)"; 449 | VERSIONING_SYSTEM = "apple-generic"; 450 | }; 451 | name = Debug; 452 | }; 453 | 97C147071CF9000F007C117D /* Release */ = { 454 | isa = XCBuildConfiguration; 455 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 456 | buildSettings = { 457 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 458 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 459 | DEVELOPMENT_TEAM = JVV4SK28PS; 460 | ENABLE_BITCODE = NO; 461 | FRAMEWORK_SEARCH_PATHS = ( 462 | "$(inherited)", 463 | "$(PROJECT_DIR)/Flutter", 464 | ); 465 | INFOPLIST_FILE = Runner/Info.plist; 466 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 467 | LIBRARY_SEARCH_PATHS = ( 468 | "$(inherited)", 469 | "$(PROJECT_DIR)/Flutter", 470 | ); 471 | PRODUCT_BUNDLE_IDENTIFIER = plugin.wechat.flutter.isanye.cn.syFlutterWechatExample; 472 | PRODUCT_NAME = "$(TARGET_NAME)"; 473 | VERSIONING_SYSTEM = "apple-generic"; 474 | }; 475 | name = Release; 476 | }; 477 | /* End XCBuildConfiguration section */ 478 | 479 | /* Begin XCConfigurationList section */ 480 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 481 | isa = XCConfigurationList; 482 | buildConfigurations = ( 483 | 97C147031CF9000F007C117D /* Debug */, 484 | 97C147041CF9000F007C117D /* Release */, 485 | ); 486 | defaultConfigurationIsVisible = 0; 487 | defaultConfigurationName = Release; 488 | }; 489 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 490 | isa = XCConfigurationList; 491 | buildConfigurations = ( 492 | 97C147061CF9000F007C117D /* Debug */, 493 | 97C147071CF9000F007C117D /* Release */, 494 | ); 495 | defaultConfigurationIsVisible = 0; 496 | defaultConfigurationName = Release; 497 | }; 498 | /* End XCConfigurationList section */ 499 | }; 500 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 501 | } 502 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 33 | 34 | 40 | 41 | 42 | 43 | 44 | 45 | 56 | 58 | 64 | 65 | 66 | 67 | 68 | 69 | 75 | 77 | 83 | 84 | 85 | 86 | 88 | 89 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildSystemType 6 | Original 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface AppDelegate : FlutterAppDelegate 5 | 6 | @end 7 | -------------------------------------------------------------------------------- /example/ios/Runner/AppDelegate.m: -------------------------------------------------------------------------------- 1 | #include "AppDelegate.h" 2 | #include "GeneratedPluginRegistrant.h" 3 | 4 | @implementation AppDelegate 5 | 6 | - (BOOL)application:(UIApplication *)application 7 | didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 8 | [GeneratedPluginRegistrant registerWithRegistry:self]; 9 | // Override point for customization after application launch. 10 | return [super application:application didFinishLaunchingWithOptions:launchOptions]; 11 | } 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lishuhao/sy_flutter_wechat/968439d93249e04c1ce47f08950e2e2b4d262ae0/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lishuhao/sy_flutter_wechat/968439d93249e04c1ce47f08950e2e2b4d262ae0/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lishuhao/sy_flutter_wechat/968439d93249e04c1ce47f08950e2e2b4d262ae0/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lishuhao/sy_flutter_wechat/968439d93249e04c1ce47f08950e2e2b4d262ae0/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lishuhao/sy_flutter_wechat/968439d93249e04c1ce47f08950e2e2b4d262ae0/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lishuhao/sy_flutter_wechat/968439d93249e04c1ce47f08950e2e2b4d262ae0/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lishuhao/sy_flutter_wechat/968439d93249e04c1ce47f08950e2e2b4d262ae0/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lishuhao/sy_flutter_wechat/968439d93249e04c1ce47f08950e2e2b4d262ae0/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lishuhao/sy_flutter_wechat/968439d93249e04c1ce47f08950e2e2b4d262ae0/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lishuhao/sy_flutter_wechat/968439d93249e04c1ce47f08950e2e2b4d262ae0/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lishuhao/sy_flutter_wechat/968439d93249e04c1ce47f08950e2e2b4d262ae0/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lishuhao/sy_flutter_wechat/968439d93249e04c1ce47f08950e2e2b4d262ae0/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lishuhao/sy_flutter_wechat/968439d93249e04c1ce47f08950e2e2b4d262ae0/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lishuhao/sy_flutter_wechat/968439d93249e04c1ce47f08950e2e2b4d262ae0/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lishuhao/sy_flutter_wechat/968439d93249e04c1ce47f08950e2e2b4d262ae0/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lishuhao/sy_flutter_wechat/968439d93249e04c1ce47f08950e2e2b4d262ae0/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lishuhao/sy_flutter_wechat/968439d93249e04c1ce47f08950e2e2b4d262ae0/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lishuhao/sy_flutter_wechat/968439d93249e04c1ce47f08950e2e2b4d262ae0/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /example/ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /example/ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | sy_flutter_wechat_example 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(FLUTTER_BUILD_NAME) 19 | CFBundleSignature 20 | ???? 21 | CFBundleURLTypes 22 | 23 | 24 | CFBundleTypeRole 25 | Editor 26 | CFBundleURLSchemes 27 | 28 | wxf9909bde17439ac2 29 | 30 | 31 | 32 | CFBundleVersion 33 | $(FLUTTER_BUILD_NUMBER) 34 | LSRequiresIPhoneOS 35 | 36 | UIBackgroundModes 37 | 38 | fetch 39 | remote-notification 40 | 41 | UILaunchStoryboardName 42 | LaunchScreen 43 | UIMainStoryboardFile 44 | Main 45 | UISupportedInterfaceOrientations 46 | 47 | UIInterfaceOrientationPortrait 48 | UIInterfaceOrientationLandscapeLeft 49 | UIInterfaceOrientationLandscapeRight 50 | 51 | UISupportedInterfaceOrientations~ipad 52 | 53 | UIInterfaceOrientationPortrait 54 | UIInterfaceOrientationPortraitUpsideDown 55 | UIInterfaceOrientationLandscapeLeft 56 | UIInterfaceOrientationLandscapeRight 57 | 58 | UIViewControllerBasedStatusBarAppearance 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /example/ios/Runner/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import "AppDelegate.h" 4 | 5 | int main(int argc, char* argv[]) { 6 | @autoreleasepool { 7 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:sy_flutter_wechat/sy_flutter_wechat.dart'; 5 | 6 | void main() => runApp(new MyApp()); 7 | 8 | class MyApp extends StatefulWidget { 9 | @override 10 | _MyAppState createState() => new _MyAppState(); 11 | } 12 | 13 | class _MyAppState extends State { 14 | @override 15 | void initState() { 16 | super.initState(); 17 | _register(); 18 | } 19 | 20 | _register() async { 21 | bool result = await SyFlutterWechat.register('wxf9909bde17439ac2'); 22 | print(result); 23 | } 24 | 25 | @override 26 | Widget build(BuildContext context) { 27 | return new MaterialApp( 28 | home: new Scaffold( 29 | appBar: new AppBar( 30 | title: const Text('Plugin example app'), 31 | ), 32 | body: new ListView( 33 | padding: EdgeInsets.all(8.0), 34 | children: [ 35 | RaisedButton( 36 | child: Text('分享文字'), 37 | onPressed: () async { 38 | bool res = await SyFlutterWechat.shareText('hello world', 39 | shareType: SyShareType.session); 40 | print('分享文字:' + res.toString()); 41 | }, 42 | ), 43 | RaisedButton( 44 | child: Text('分享图片'), 45 | onPressed: () async { 46 | bool res = await SyFlutterWechat.shareImage( 47 | 'https://avatars0.githubusercontent.com/u/10024776', 48 | shareType: SyShareType.timeline); 49 | print('分享图片:' + res.toString()); 50 | }, 51 | ), 52 | RaisedButton( 53 | child: Text('分享网页'), 54 | onPressed: () async { 55 | bool res = await SyFlutterWechat.shareWebPage( 56 | '标题', 57 | '描述', 58 | 'https://avatars0.githubusercontent.com/u/10024776', 59 | 'http://www.example.com', 60 | shareType: SyShareType.session); 61 | print('分享网页:' + res.toString()); 62 | }, 63 | ), 64 | RaisedButton( 65 | child: Text('支付'), 66 | onPressed: () async { 67 | String payInfo = 68 | '{"appid":"wxf9909bde17439ac2","partnerid":"1518469211","prepayid":"wx120649521695951d501636f91748325073","package":"Sign=WXPay","noncestr":"1541976592","timestamp":"1541976592","sign":"E760C99A1A981B9A7D8F17B08EF60FCC"}'; 69 | SyPayResult payResult = await SyFlutterWechat.pay( 70 | SyPayInfo.fromJson(json.decode(payInfo))); 71 | print(payResult); 72 | }, 73 | ), 74 | ], 75 | ), 76 | ), 77 | ); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: sy_flutter_wechat_example 2 | description: Demonstrates how to use the sy_flutter_wechat plugin. 3 | 4 | # The following defines the version and build number for your application. 5 | # A version number is three numbers separated by dots, like 1.2.43 6 | # followed by an optional build number separated by a +. 7 | # Both the version and the builder number may be overridden in flutter 8 | # build by specifying --build-name and --build-number, respectively. 9 | # Read more about versioning at semver.org. 10 | version: 1.0.0+1 11 | 12 | environment: 13 | sdk: ">=2.0.0-dev.68.0 <3.0.0" 14 | 15 | dependencies: 16 | flutter: 17 | sdk: flutter 18 | sy_flutter_wechat: 19 | path: ../ 20 | 21 | # The following adds the Cupertino Icons font to your application. 22 | # Use with the CupertinoIcons class for iOS style icons. 23 | cupertino_icons: ^0.1.2 24 | 25 | dev_dependencies: 26 | flutter_test: 27 | sdk: flutter 28 | 29 | # For information on the generic Dart part of this file, see the 30 | # following page: https://www.dartlang.org/tools/pub/pubspec 31 | 32 | # The following section is specific to Flutter. 33 | flutter: 34 | 35 | # The following line ensures that the Material Icons font is 36 | # included with your application, so that you can use the icons in 37 | # the material Icons class. 38 | uses-material-design: true 39 | 40 | # To add assets to your application, add an assets section, like this: 41 | # assets: 42 | # - images/a_dot_burr.jpeg 43 | # - images/a_dot_ham.jpeg 44 | 45 | # An image asset can refer to one or more resolution-specific "variants", see 46 | # https://flutter.io/assets-and-images/#resolution-aware. 47 | 48 | # For details regarding adding assets from package dependencies, see 49 | # https://flutter.io/assets-and-images/#from-packages 50 | 51 | # To add custom fonts to your application, add a fonts section here, 52 | # in this "flutter" section. Each entry in this list should have a 53 | # "family" key with the font family name, and a "fonts" key with a 54 | # list giving the asset and other descriptors for the font. For 55 | # example: 56 | # fonts: 57 | # - family: Schyler 58 | # fonts: 59 | # - asset: fonts/Schyler-Regular.ttf 60 | # - asset: fonts/Schyler-Italic.ttf 61 | # style: italic 62 | # - family: Trajan Pro 63 | # fonts: 64 | # - asset: fonts/TrajanPro.ttf 65 | # - asset: fonts/TrajanPro_Bold.ttf 66 | # weight: 700 67 | # 68 | # For details regarding fonts from package dependencies, 69 | # see https://flutter.io/custom-fonts/#from-packages 70 | -------------------------------------------------------------------------------- /ios/.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | .vagrant/ 3 | .sconsign.dblite 4 | .svn/ 5 | 6 | .DS_Store 7 | *.swp 8 | profile 9 | 10 | DerivedData/ 11 | build/ 12 | GeneratedPluginRegistrant.h 13 | GeneratedPluginRegistrant.m 14 | 15 | .generated/ 16 | 17 | *.pbxuser 18 | *.mode1v3 19 | *.mode2v3 20 | *.perspectivev3 21 | 22 | !default.pbxuser 23 | !default.mode1v3 24 | !default.mode2v3 25 | !default.perspectivev3 26 | 27 | xcuserdata 28 | 29 | *.moved-aside 30 | 31 | *.pyc 32 | *sync/ 33 | Icon? 34 | .tags* 35 | 36 | /Flutter/Generated.xcconfig 37 | -------------------------------------------------------------------------------- /ios/Assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lishuhao/sy_flutter_wechat/968439d93249e04c1ce47f08950e2e2b4d262ae0/ios/Assets/.gitkeep -------------------------------------------------------------------------------- /ios/Classes/SyFlutterWechatPlugin.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "WXApi.h" 3 | 4 | @interface SyFlutterWechatPlugin : NSObject 5 | @end 6 | -------------------------------------------------------------------------------- /ios/Classes/SyFlutterWechatPlugin.m: -------------------------------------------------------------------------------- 1 | #import "SyFlutterWechatPlugin.h" 2 | 3 | @interface SyFlutterWechatPlugin() 4 | 5 | @property FlutterResult result; 6 | 7 | @end 8 | 9 | @implementation SyFlutterWechatPlugin 10 | + (void)registerWithRegistrar:(NSObject*)registrar { 11 | FlutterMethodChannel* channel = [FlutterMethodChannel 12 | methodChannelWithName:@"sy_flutter_wechat" 13 | binaryMessenger:[registrar messenger]]; 14 | SyFlutterWechatPlugin* instance = [[SyFlutterWechatPlugin alloc] init]; 15 | [registrar addApplicationDelegate:instance]; 16 | [registrar addMethodCallDelegate:instance channel:channel]; 17 | } 18 | 19 | - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result { 20 | if ([@"register" isEqualToString:call.method]) { 21 | BOOL res = [WXApi registerApp:call.arguments[@"appId"]]; 22 | result(@((bool)res)); 23 | }else if ([@"shareText" isEqualToString:call.method]) { 24 | [self shareText:call result:result]; 25 | }else if ([@"shareImage" isEqualToString:call.method]) { 26 | [self shareImage:call result:result]; 27 | }else if ([@"shareWebPage" isEqualToString:call.method]) { 28 | [self shareWebPage:call result:result]; 29 | }else if ([@"pay" isEqualToString:call.method]) { 30 | self.result = result; 31 | [self pay:call result:result]; 32 | }else { 33 | result(FlutterMethodNotImplemented); 34 | } 35 | } 36 | 37 | 38 | - (void)shareText:(FlutterMethodCall*)call result:(FlutterResult)result{ 39 | SendMessageToWXReq* req = [[SendMessageToWXReq alloc] init]; 40 | req.text = call.arguments[@"text"]; 41 | req.bText = YES; 42 | req.scene = [self _convertShareType:call]; 43 | BOOL res = [WXApi sendReq:req]; 44 | result(@((bool)res)); 45 | } 46 | 47 | - (void)shareImage:(FlutterMethodCall*)call result:(FlutterResult)result{ 48 | NSString *imageUrl = call.arguments[@"imageUrl"]; 49 | NSData *imageData =[NSData dataWithContentsOfURL:[NSURL URLWithString:imageUrl]];; 50 | UIImage *originImage = [UIImage imageWithData:imageData]; 51 | 52 | WXImageObject *imageObj = [WXImageObject object]; 53 | imageObj.imageData = imageData; 54 | 55 | WXMediaMessage *mediaMsg = [WXMediaMessage message]; 56 | mediaMsg.mediaObject = imageObj; 57 | 58 | UIImage *thumbImage = [self compressImage:originImage toByte:32768]; 59 | [mediaMsg setThumbImage:thumbImage]; 60 | 61 | SendMessageToWXReq* req = [[SendMessageToWXReq alloc] init]; 62 | req.message = mediaMsg; 63 | req.bText = NO; 64 | req.scene = [self _convertShareType:call]; 65 | BOOL res = [WXApi sendReq:req]; 66 | result(@((bool)res)); 67 | } 68 | 69 | - (void)shareWebPage:(FlutterMethodCall*)call result:(FlutterResult)result{ 70 | NSString *imageUrl = call.arguments[@"imageUrl"]; 71 | 72 | NSData *imageData =[NSData dataWithContentsOfURL:[NSURL URLWithString:imageUrl]];; 73 | UIImage *originImage = [UIImage imageWithData:imageData]; 74 | UIImage *thumbImage = [self compressImage:originImage toByte:32768]; 75 | 76 | WXWebpageObject* webObj = [WXWebpageObject object]; 77 | webObj.webpageUrl = call.arguments[@"webPageUrl"]; 78 | 79 | WXMediaMessage *mediaMsg = [WXMediaMessage message]; 80 | mediaMsg.title = call.arguments[@"title"]; 81 | mediaMsg.description = call.arguments[@"description"]; 82 | [mediaMsg setThumbImage:thumbImage]; 83 | mediaMsg.mediaObject = webObj; 84 | 85 | SendMessageToWXReq* req = [[SendMessageToWXReq alloc] init]; 86 | req.message = mediaMsg; 87 | req.bText = NO; 88 | req.scene = [self _convertShareType:call]; 89 | BOOL res = [WXApi sendReq:req]; 90 | result(@((bool)res)); 91 | } 92 | 93 | //支付 94 | - (void)pay:(FlutterMethodCall*)call result:(FlutterResult)result{ 95 | PayReq *req = [[PayReq alloc] init]; 96 | req.partnerId = call.arguments[@"partnerid"]; 97 | req.prepayId= call.arguments[@"prepayid"]; 98 | req.package = call.arguments[@"package"]; 99 | req.nonceStr= call.arguments[@"noncestr"]; 100 | req.timeStamp= [call.arguments[@"timestamp"] unsignedIntValue]; 101 | req.sign= call.arguments[@"sign"]; 102 | [WXApi sendReq:req]; 103 | } 104 | 105 | 106 | 107 | - (enum WXScene)_convertShareType:(FlutterMethodCall*)call{ 108 | NSString *shareType = call.arguments[@"shareType"]; 109 | if([shareType isEqualToString:@"session"]){ 110 | return WXSceneSession; 111 | }else if([shareType isEqualToString:@"timeline"]){ 112 | return WXSceneTimeline; 113 | }else if([shareType isEqualToString:@"favorite"]){ 114 | return WXSceneFavorite; 115 | } 116 | return WXSceneSession; 117 | } 118 | 119 | 120 | //生成分享缩略图 121 | //链接:https://www.jianshu.com/p/a45d99ffccf6 122 | //toByte 缩略图要小于32KB 123 | - (UIImage *)compressImage:(UIImage *)image toByte:(NSUInteger)maxLength { 124 | // Compress by quality 125 | CGFloat compression = 1; 126 | NSData *data = UIImageJPEGRepresentation(image, compression); 127 | if (data.length < maxLength) return image; 128 | 129 | CGFloat max = 1; 130 | CGFloat min = 0; 131 | for (int i = 0; i < 6; ++i) { 132 | compression = (max + min) / 2; 133 | data = UIImageJPEGRepresentation(image, compression); 134 | if (data.length < maxLength * 0.9) { 135 | min = compression; 136 | } else if (data.length > maxLength) { 137 | max = compression; 138 | } else { 139 | break; 140 | } 141 | } 142 | UIImage *resultImage = [UIImage imageWithData:data]; 143 | if (data.length < maxLength) return resultImage; 144 | 145 | // Compress by size 146 | NSUInteger lastDataLength = 0; 147 | while (data.length > maxLength && data.length != lastDataLength) { 148 | lastDataLength = data.length; 149 | CGFloat ratio = (CGFloat)maxLength / data.length; 150 | CGSize size = CGSizeMake((NSUInteger)(resultImage.size.width * sqrtf(ratio)), 151 | (NSUInteger)(resultImage.size.height * sqrtf(ratio))); // Use NSUInteger to prevent white blank 152 | UIGraphicsBeginImageContext(size); 153 | [resultImage drawInRect:CGRectMake(0, 0, size.width, size.height)]; 154 | resultImage = UIGraphicsGetImageFromCurrentImageContext(); 155 | UIGraphicsEndImageContext(); 156 | data = UIImageJPEGRepresentation(resultImage, compression); 157 | } 158 | 159 | return resultImage; 160 | } 161 | 162 | 163 | - (void) onReq:(BaseReq *)req{ 164 | NSLog(@"onReq...."); 165 | } 166 | 167 | - (void) onResp:(BaseResp *)resp{ 168 | if([resp isKindOfClass:[PayResp class]]){ 169 | self.result(@(resp.errCode)); 170 | NSLog(@"支付结果:retcode = %d, retstr = %@",resp.errCode,resp.errStr); 171 | } 172 | NSLog(@"回调结果:retcode = %d, retstr = %@",resp.errCode,resp.errStr); 173 | } 174 | 175 | - (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url{ 176 | return [WXApi handleOpenURL:url delegate:self]; 177 | } 178 | - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation{ 179 | return [WXApi handleOpenURL:url delegate:self]; 180 | } 181 | - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary *)options{ 182 | if([url.host isEqualToString:@"pay"]){ 183 | return [WXApi handleOpenURL:url delegate:self]; 184 | } 185 | return YES; 186 | } 187 | 188 | @end 189 | -------------------------------------------------------------------------------- /ios/sy_flutter_wechat.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html 3 | # 4 | Pod::Spec.new do |s| 5 | s.name = 'sy_flutter_wechat' 6 | s.version = '0.2.1' 7 | s.summary = 'Wechat SDK flutter plugin' 8 | s.description = <<-DESC 9 | Wechat SDK flutter plugin 10 | DESC 11 | s.homepage = 'http://example.com' 12 | s.license = { :file => '../LICENSE' } 13 | s.author = { 'Your Company' => 'email@example.com' } 14 | s.source = { :path => '.' } 15 | s.source_files = 'Classes/**/*' 16 | s.public_header_files = 'Classes/**/*.h' 17 | s.dependency 'Flutter' 18 | 19 | s.dependency 'WechatOpenSDK' 20 | s.static_framework = true 21 | s.ios.deployment_target = '8.0' 22 | end 23 | 24 | -------------------------------------------------------------------------------- /lib/sy_flutter_wechat.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:flutter/services.dart'; 4 | 5 | /// share scene 6 | enum SyShareType { 7 | session, 8 | 9 | /// share to friend 10 | timeline, 11 | 12 | /// share to timeline 13 | favorite 14 | 15 | /// collect 16 | } 17 | 18 | /// pay result 19 | enum SyPayResult { 20 | /// success 21 | success, 22 | 23 | /// fail 24 | fail, 25 | 26 | /// cancel 27 | cancel, 28 | } 29 | 30 | /// wechat class 31 | class SyFlutterWechat { 32 | static const MethodChannel _channel = 33 | const MethodChannel('sy_flutter_wechat'); 34 | 35 | /// register app id 36 | static Future register(String appId) async { 37 | return await _channel 38 | .invokeMethod('register', {'appId': appId}); 39 | } 40 | 41 | /// shareText 42 | static Future shareText(String text, {SyShareType shareType}) async { 43 | return await _channel.invokeMethod('shareText', { 44 | 'text': text, 45 | 'shareType': _shareTypeToStr(shareType) 46 | }); 47 | } 48 | 49 | /// shareImage 50 | static Future shareImage(String imageUrl, 51 | {SyShareType shareType}) async { 52 | return await _channel.invokeMethod('shareImage', { 53 | 'imageUrl': imageUrl, 54 | 'shareType': _shareTypeToStr(shareType) 55 | }); 56 | } 57 | 58 | /// shareWebPage 59 | static Future shareWebPage( 60 | String title, String description, String imageUrl, String webPageUrl, 61 | {SyShareType shareType}) async { 62 | return await _channel.invokeMethod('shareWebPage', { 63 | 'title': title, 64 | 'description': description, 65 | 'imageUrl': imageUrl, 66 | 'webPageUrl': webPageUrl, 67 | 'shareType': _shareTypeToStr(shareType) 68 | }); 69 | } 70 | 71 | /// pay 72 | static Future pay(SyPayInfo payInfo) async { 73 | int payResult = await _channel.invokeMethod('pay', { 74 | 'appid': payInfo.appid, 75 | 'partnerid': payInfo.partnerid, 76 | 'prepayid': payInfo.prepayid, 77 | 'package': payInfo.package, 78 | 'noncestr': payInfo.noncestr, 79 | 'timestamp': payInfo.timestamp, 80 | 'sign': payInfo.sign, 81 | }); 82 | return _convertPayResult(payResult); 83 | } 84 | 85 | static String _shareTypeToStr(SyShareType shareType) { 86 | switch (shareType) { 87 | case SyShareType.session: 88 | return 'session'; 89 | case SyShareType.timeline: 90 | return 'timeline'; 91 | case SyShareType.favorite: 92 | return 'favorite'; 93 | default: 94 | return 'session'; 95 | } 96 | } 97 | 98 | static SyPayResult _convertPayResult(int payResult) { 99 | switch (payResult) { 100 | case 0: 101 | return SyPayResult.success; 102 | case -1: 103 | return SyPayResult.fail; 104 | case -2: 105 | return SyPayResult.cancel; 106 | default: 107 | return null; 108 | } 109 | } 110 | } 111 | 112 | /// pay args 113 | /// 114 | /// 参考微信文档 https://pay.weixin.qq.com/wiki/doc/api/app/app.php?chapter=9_12&index=2 115 | class SyPayInfo { 116 | /// appid 117 | String appid; 118 | 119 | /// partnerid 120 | String partnerid; 121 | 122 | /// prepayid 123 | String prepayid; 124 | 125 | /// package 126 | String package; 127 | 128 | /// noncestr 129 | String noncestr; 130 | 131 | /// timestamp 132 | String timestamp; 133 | 134 | /// sign 135 | String sign; 136 | 137 | SyPayInfo({ 138 | this.appid, 139 | this.partnerid, 140 | this.prepayid, 141 | this.package, 142 | this.noncestr, 143 | this.timestamp, 144 | this.sign, 145 | }); 146 | 147 | /// from json 148 | factory SyPayInfo.fromJson(Map json) { 149 | return SyPayInfo( 150 | appid: json['appid'], 151 | partnerid: json['partnerid'], 152 | prepayid: json['prepayid'], 153 | package: json['package'], 154 | noncestr: json['noncestr'], 155 | timestamp: json['timestamp'], 156 | sign: json['sign'], 157 | ); 158 | } 159 | } 160 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: sy_flutter_wechat 2 | description: A Flutter plugin for integrating Wechat in iOS and Android applications. 3 | version: 0.2.2 4 | author: lishuhao 5 | homepage: https://github.com/lishuhao/sy_flutter_wechat 6 | 7 | environment: 8 | sdk: ">=2.0.0-dev.68.0 <3.0.0" 9 | 10 | dependencies: 11 | flutter: 12 | sdk: flutter 13 | 14 | # For information on the generic Dart part of this file, see the 15 | # following page: https://www.dartlang.org/tools/pub/pubspec 16 | 17 | # The following section is specific to Flutter. 18 | flutter: 19 | plugin: 20 | androidPackage: plugin.wechat.flutter.isanye.cn.syflutterwechat 21 | pluginClass: SyFlutterWechatPlugin 22 | 23 | # To add assets to your plugin package, add an assets section, like this: 24 | # assets: 25 | # - images/a_dot_burr.jpeg 26 | # - images/a_dot_ham.jpeg 27 | # 28 | # For details regarding assets in packages, see 29 | # https://flutter.io/assets-and-images/#from-packages 30 | # 31 | # An image asset can refer to one or more resolution-specific "variants", see 32 | # https://flutter.io/assets-and-images/#resolution-aware. 33 | 34 | # To add custom fonts to your plugin package, add a fonts section here, 35 | # in this "flutter" section. Each entry in this list should have a 36 | # "family" key with the font family name, and a "fonts" key with a 37 | # list giving the asset and other descriptors for the font. For 38 | # example: 39 | # fonts: 40 | # - family: Schyler 41 | # fonts: 42 | # - asset: fonts/Schyler-Regular.ttf 43 | # - asset: fonts/Schyler-Italic.ttf 44 | # style: italic 45 | # - family: Trajan Pro 46 | # fonts: 47 | # - asset: fonts/TrajanPro.ttf 48 | # - asset: fonts/TrajanPro_Bold.ttf 49 | # weight: 700 50 | # 51 | # For details regarding fonts in packages, see 52 | # https://flutter.io/custom-fonts/#from-packages 53 | -------------------------------------------------------------------------------- /sy_flutter_wechat.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /sy_flutter_wechat_android.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | --------------------------------------------------------------------------------