├── .gitignore
├── .idea
├── codeStyles
│ └── Project.xml
├── libraries
│ ├── Dart_Packages.xml
│ ├── Dart_SDK.xml
│ ├── Flutter_Plugins.xml
│ └── Flutter_for_Android.xml
├── misc.xml
├── modules.xml
├── runConfigurations
│ └── example_lib_main_dart.xml
├── vcs.xml
└── workspace.xml
├── .metadata
├── .vscode
└── settings.json
├── CHANGELOG.md
├── LICENSE
├── README.md
├── android
├── .classpath
├── .gitignore
├── .project
├── .settings
│ └── org.eclipse.buildship.core.prefs
├── build.gradle
├── gradle.properties
├── settings.gradle
└── src
│ └── main
│ ├── AndroidManifest.xml
│ └── java
│ └── com
│ └── onmr
│ └── flutter
│ └── wechat
│ └── WechatPlugin.java
├── example
├── .gitignore
├── .metadata
├── README.md
├── android
│ ├── .project
│ ├── .settings
│ │ └── org.eclipse.buildship.core.prefs
│ ├── app
│ │ ├── .classpath
│ │ ├── .project
│ │ ├── .settings
│ │ │ └── org.eclipse.buildship.core.prefs
│ │ ├── build.gradle
│ │ └── src
│ │ │ └── main
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── java
│ │ │ └── com
│ │ │ │ └── example
│ │ │ │ └── wechatexample
│ │ │ │ └── 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
└── test
│ └── widget_test.dart
├── ios
├── .gitignore
├── Assets
│ └── .gitkeep
├── Classes
│ ├── WechatPlugin.h
│ └── WechatPlugin.m
└── wechat.podspec
├── lib
└── wechat.dart
├── pubspec.yaml
└── wechat.iml
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | .dart_tool/
3 |
4 | .packages
5 | .pub/
6 | pubspec.lock
7 |
8 | build/
9 |
--------------------------------------------------------------------------------
/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/.idea/libraries/Dart_Packages.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
--------------------------------------------------------------------------------
/.idea/libraries/Dart_SDK.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/.idea/libraries/Flutter_Plugins.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/.idea/libraries/Flutter_for_Android.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/.idea/runConfigurations/example_lib_main_dart.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/workspace.xml:
--------------------------------------------------------------------------------
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 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 | 1545208735823
133 |
134 |
135 | 1545208735823
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
--------------------------------------------------------------------------------
/.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: 5391447fae6209bb21a89e6a5a6583cac1af9b4b
8 | channel: stable
9 |
10 | project_type: plugin
11 |
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "java.configuration.updateBuildConfiguration": "disabled"
3 | }
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## 0.0.1
2 |
3 | * TODO: Describe initial release.
4 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | TODO: Add your license here.
2 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # wechat
2 |
3 | Wechat Plugin for Flutter app.
4 |
5 | ## Getting Started
6 |
7 | ```yaml
8 | dependencies:
9 | wechat: ^0.0.2
10 | ```
11 |
12 | ```dart
13 |
14 | import 'package:flutter/material.dart';
15 | import 'dart:async';
16 |
17 | import 'package:flutter/services.dart';
18 | import 'package:wechat/wechat.dart';
19 |
20 | void main() => runApp(MyApp());
21 |
22 | class MyApp extends StatefulWidget {
23 | @override
24 | _MyAppState createState() => _MyAppState();
25 | }
26 |
27 | class _MyAppState extends State {
28 | String _platformVersion = 'Unknown';
29 | String _result = 'no result';
30 |
31 | @override
32 | void initState() {
33 | super.initState();
34 | initPlatformState();
35 | Wechat.register('APPID');
36 | _result = 'no result';
37 | print('inited');
38 | }
39 |
40 | // Platform messages are asynchronous, so we initialize in an async method.
41 | Future initPlatformState() async {
42 | String platformVersion;
43 | // Platform messages may fail, so we use a try/catch PlatformException.
44 | try {
45 | platformVersion = await Wechat.platformVersion;
46 | } on PlatformException {
47 | platformVersion = 'Failed to get platform version.';
48 | }
49 |
50 | // If the widget was removed from the tree while the asynchronous platform
51 | // message was in flight, we want to discard the reply rather than calling
52 | // setState to update our non-existent appearance.
53 | if (!mounted) return;
54 |
55 | setState(() {
56 | _platformVersion = platformVersion;
57 | });
58 | }
59 |
60 | void _share (arguments) async {
61 | try {
62 | var result = await Wechat.share(arguments);
63 | _result = result.toString() ?? 'null result';
64 | } catch (e) {
65 | _result = e.toString();
66 | }
67 | }
68 |
69 | void _shareText ([String to = 'session']) async {
70 | var arguments = {
71 | 'to': to,
72 | 'text': 'Welcome to user flutter wechat plugin.'
73 | };
74 | await _share(arguments);
75 | }
76 |
77 | void _shareImage ([String to = 'session']) async {
78 | _share({
79 | 'kind': 'image',
80 | 'to': to,
81 | 'resourceUrl': 'https://files.onmr.com/wild/2018/09/3177628278.jpg',
82 | 'url': 'https://wild.onmr.com/trails',
83 | 'title': '荒僧',
84 | 'description': '大丈夫当朝游碧海而暮苍梧'
85 | });
86 | }
87 |
88 | void _shareMusic ([String to = 'session']) async {
89 | _share({
90 | 'kind': 'music',
91 | 'to': to,
92 | 'resourceUrl': 'https://pantao.onmr.com/usr/uploads/2018/12/2839345471.mp3',
93 | 'url': 'https://pantao.onmr.com/demo-files',
94 | 'coverUrl': 'https://pantao.onmr.com/usr/uploads/2018/12/2293691504.jpg',
95 | 'title': 'Jingle Bells',
96 | 'description': 'Children\'s Christmas Favorites-Jingle Bells (Album Version)'
97 | });
98 | }
99 |
100 | void _shareWebpage ([String to = 'session']) async {
101 | _share({
102 | 'kind': 'webpage',
103 | 'to': to,
104 | 'url': 'https://pantao.onmr.com/demo-files',
105 | 'coverUrl': 'https://pantao.onmr.com/usr/uploads/2018/12/2293691504.jpg',
106 | 'title': 'Jingle Bells',
107 | 'description': 'Children\'s Christmas Favorites-Jingle Bells (Album Version)'
108 | });
109 | }
110 |
111 | void _login () async {
112 | var result = await Wechat.login({
113 | 'scope': 'snsapi_userinfo',
114 | 'state': 'customstate'
115 | });
116 | _result = result.toString();
117 | }
118 |
119 | void _openWechat () async {
120 | var result = await Wechat.openWechat();
121 | }
122 |
123 | @override
124 | Widget build(BuildContext context) {
125 | return MaterialApp(
126 | home: Scaffold(
127 | appBar: AppBar(
128 | title: const Text('Wechat Plugin App'),
129 | ),
130 | body: ListView(
131 | children: [
132 | ListTile(
133 | leading: Icon(Icons.system_update),
134 | title: Text('Running on: $_platformVersion\n'),
135 | ),
136 | ListTile(
137 | leading: Icon(Icons.text_format),
138 | title: Text('Share text to wechat'),
139 | onTap: () {
140 | _shareText();
141 | },
142 | ),
143 | ListTile(
144 | leading: Icon(Icons.text_format),
145 | title: Text('Share text to wechat timeline'),
146 | onTap: () {
147 | _shareText('timeline');
148 | },
149 | ),
150 | ListTile(
151 | leading: Icon(Icons.image),
152 | title: Text('Share image to wechat'),
153 | onTap: () {
154 | _shareImage();
155 | },
156 | ),
157 | ListTile(
158 | leading: Icon(Icons.music_note),
159 | title: Text('Share music to wechat'),
160 | onTap: () {
161 | _shareMusic();
162 | },
163 | ),
164 | ListTile(
165 | leading: Icon(Icons.web),
166 | title: Text('Share webpage to wechat'),
167 | onTap: () {
168 | _shareWebpage();
169 | },
170 | ),
171 | ListTile(
172 | leading: Icon(Icons.person),
173 | title: Text('Login via wechat'),
174 | onTap: () {
175 | _login();
176 | },
177 | ),
178 | ListTile(
179 | leading: Icon(Icons.person),
180 | title: Text('Open Wechat'),
181 | onTap: () {
182 | _openWechat();
183 | },
184 | ),
185 | Text('result: $_result')
186 | ],
187 | ),
188 | ),
189 | );
190 | }
191 | }
192 |
193 | ```
194 |
195 | ## Troubleshooting
196 |
197 | ### error: include of non-modular header inside framework module 'wechat.WechatPlugin'
198 |
199 | This error always accoured when you create your flutter project with `-i swift` options:
200 |
201 | ```bash
202 | flutter create -i swift myapp
203 | ```
204 |
205 | Fix this, do like this:
206 |
207 | Open `ios/Runner.xcworkspace`, Navigate to `TARGETS` -> `Build Settings`, then search `Allow Non`, set
208 | ` Allow Non-modular includes in Framework Modules` to `YES`
--------------------------------------------------------------------------------
/android/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/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/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | wechat
4 | Wechat Plugin for Flutter app.
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.buildship.core.gradleprojectbuilder
15 |
16 |
17 |
18 |
19 |
20 | org.eclipse.jdt.core.javanature
21 | org.eclipse.buildship.core.gradleprojectnature
22 |
23 |
24 |
--------------------------------------------------------------------------------
/android/.settings/org.eclipse.buildship.core.prefs:
--------------------------------------------------------------------------------
1 | connection.project.dir=
2 | eclipse.preferences.version=1
3 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | group 'com.onmr.flutter.wechat'
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.2.1'
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 | compile 'com.tencent.mm.opensdk:wechat-sdk-android-with-mta:+'
38 | }
--------------------------------------------------------------------------------
/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 |
--------------------------------------------------------------------------------
/android/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'wechat'
2 |
--------------------------------------------------------------------------------
/android/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/android/src/main/java/com/onmr/flutter/wechat/WechatPlugin.java:
--------------------------------------------------------------------------------
1 | package com.onmr.flutter.wechat;
2 |
3 | import io.flutter.plugin.common.EventChannel;
4 | import io.flutter.plugin.common.MethodCall;
5 | import io.flutter.plugin.common.MethodChannel;
6 | import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
7 | import io.flutter.plugin.common.MethodChannel.Result;
8 | import io.flutter.plugin.common.PluginRegistry;
9 | import io.flutter.plugin.common.PluginRegistry.Registrar;
10 | import io.flutter.plugin.common.EventChannel.StreamHandler;
11 |
12 | import android.content.BroadcastReceiver;
13 | import android.content.Context;
14 | import android.content.Intent;
15 | import android.content.IntentFilter;
16 | import android.graphics.Bitmap;
17 | import android.graphics.BitmapFactory;
18 | import android.graphics.Bitmap.CompressFormat;
19 | import android.os.Handler;
20 | import android.os.Message;
21 | import android.util.Log;
22 | import android.widget.Toast;
23 |
24 | import com.tencent.mm.opensdk.modelbase.BaseReq;
25 | import com.tencent.mm.opensdk.modelbase.BaseResp;
26 | import com.tencent.mm.opensdk.modelmsg.SendAuth;
27 | import com.tencent.mm.opensdk.modelmsg.SendMessageToWX;
28 | import com.tencent.mm.opensdk.modelmsg.WXImageObject;
29 | import com.tencent.mm.opensdk.modelmsg.WXMediaMessage;
30 | import com.tencent.mm.opensdk.modelmsg.WXMusicObject;
31 | import com.tencent.mm.opensdk.modelmsg.WXTextObject;
32 | import com.tencent.mm.opensdk.modelmsg.WXVideoObject;
33 | import com.tencent.mm.opensdk.modelmsg.WXWebpageObject;
34 | import com.tencent.mm.opensdk.modelpay.PayReq;
35 | import com.tencent.mm.opensdk.openapi.IWXAPI;
36 | import com.tencent.mm.opensdk.openapi.IWXAPIEventHandler;
37 | import com.tencent.mm.opensdk.openapi.WXAPIFactory;
38 |
39 | import java.io.BufferedInputStream;
40 | import java.io.BufferedOutputStream;
41 | import java.io.ByteArrayOutputStream;
42 | import java.io.IOException;
43 | import java.io.InputStream;
44 | import java.io.OutputStream;
45 | import java.net.HttpURLConnection;
46 | import java.net.URL;
47 |
48 | /** WechatPlugin */
49 | public class WechatPlugin implements MethodCallHandler {
50 |
51 | private static int code;//返回错误吗
52 | private static String loginCode;//获取access_code
53 | private static IWXAPI api;
54 | private static Result result;
55 | private Context context;
56 | private String appid;
57 | private Bitmap bitmap;
58 | private WXMediaMessage message;
59 | private String kind = "session";
60 | private final PluginRegistry.Registrar registrar;
61 | private BroadcastReceiver sendRespReceiver;
62 |
63 | private WechatPlugin(Context ctx, Registrar registrar) {
64 | this.registrar = registrar;
65 | context = ctx;
66 | }
67 |
68 | public static int getCode() {
69 | return code;
70 | }
71 |
72 | public static void setCode(int value) {
73 | code = value;
74 | }
75 |
76 | public static String getLoginCode() {
77 | return loginCode;
78 | }
79 |
80 | public static void setLoginCode(String value) {
81 | loginCode = value;
82 | }
83 |
84 | private Handler handler = new Handler(new Handler.Callback() {
85 | @Override
86 | public boolean handleMessage(Message osMessage) {
87 | SendMessageToWX.Req request = new SendMessageToWX.Req();
88 | request.scene = kind.equals("timeline")
89 | ? SendMessageToWX.Req.WXSceneTimeline
90 | : kind.equals("favorite")
91 | ? SendMessageToWX.Req.WXSceneFavorite
92 | : SendMessageToWX.Req.WXSceneSession;
93 |
94 | if (bitmap != null) {
95 | Bitmap thumbBitmap = Bitmap.createScaledBitmap(bitmap, 100, 100, true);
96 | message.thumbData = convertBitmapToByteArray(thumbBitmap, true);
97 | }
98 | switch (osMessage.what) {
99 | case 0:
100 | request.transaction = String.valueOf(System.currentTimeMillis());
101 | request.message = message;
102 | api.sendReq(request);
103 | break;
104 | case 1:
105 | if (bitmap == null) {
106 | Toast.makeText(context, "图片路径错误", Toast.LENGTH_SHORT).show();
107 | break;
108 | }
109 | WXImageObject imageObject = new WXImageObject(bitmap);
110 | message.mediaObject = imageObject;
111 | request.transaction = String.valueOf(System.currentTimeMillis());
112 | request.message = message;
113 | api.sendReq(request);
114 | break;
115 | case 2:
116 | request.transaction = String.valueOf(System.currentTimeMillis());
117 | request.message = message;
118 | api.sendReq(request);
119 | break;
120 | case 3:
121 | request.transaction = String.valueOf(System.currentTimeMillis());
122 | request.message = message;
123 | api.sendReq(request);
124 | break;
125 | default:
126 | break;
127 | }
128 | return false;
129 | }
130 | });
131 |
132 | /** Plugin registration. */
133 | public static void registerWith(Registrar registrar) {
134 | final MethodChannel channel = new MethodChannel(registrar.messenger(), "wechat");
135 | channel.setMethodCallHandler(new WechatPlugin(registrar.context(), registrar));
136 | IntentFilter intentFilter = new IntentFilter();
137 | intentFilter.addAction("sendResp");
138 | registrar.context().registerReceiver(createReceiver(), intentFilter);
139 | }
140 |
141 | @Override
142 | public void onMethodCall(MethodCall call, Result result) {
143 | if (call.method.equals("getPlatformVersion")) {
144 | result.success("Android " + android.os.Build.VERSION.RELEASE);
145 | }
146 | else if (call.method.equals("register")) {
147 | appid = call.argument("appid");
148 | api = WXAPIFactory.createWXAPI(context, appid, true);
149 | result.success(api.registerApp(appid));
150 | }
151 | // Check if wechat app installed
152 | else if (call.method.equals("isWechatInstalled")) {
153 | if (api == null) {
154 | result.success(false);
155 | } else {
156 | result.success(api.isWXAppInstalled());
157 | }
158 | }
159 | else if (call.method.equals("getApiVersion")) {
160 | result.success(api.getWXAppSupportAPI());
161 | }
162 | else if (call.method.equals("openWechat")) {
163 | result.success(api.openWXApp());
164 | }
165 | else if (call.method.equals("share")) {
166 | final String kind = call.argument("kind");
167 | final String to = call.argument("to");
168 | final String coverUrl = call.argument("coverUrl");
169 | SendMessageToWX.Req request = new SendMessageToWX.Req();
170 | message = new WXMediaMessage();
171 | request.scene = to.equals("timeline")
172 | ? SendMessageToWX.Req.WXSceneTimeline
173 | : to.equals("favorite")
174 | ? SendMessageToWX.Req.WXSceneFavorite
175 | : SendMessageToWX.Req.WXSceneSession;
176 | switch (kind) {
177 | case "text":
178 | WXTextObject textObject = new WXTextObject();
179 | final String text = call.argument("text");
180 | textObject.text = text;
181 | message.mediaObject = textObject;
182 | message.description = text;
183 | request.transaction = String.valueOf(System.currentTimeMillis());
184 | request.message = message;
185 | api.sendReq(request);
186 | break;
187 | case "music":
188 | WXMusicObject musicObject = new WXMusicObject();
189 | musicObject.musicUrl = call.argument("resourceUrl").toString();
190 | musicObject.musicDataUrl = call.argument("resourceUrl").toString();
191 | musicObject.musicLowBandDataUrl = call.argument("resourceUrl").toString();
192 | musicObject.musicLowBandUrl = call.argument("resourceUrl").toString();
193 | message = new WXMediaMessage();
194 | message.mediaObject = musicObject;
195 | message.title = call.argument("title").toString();
196 | message.description = call.argument("description").toString();
197 | //网络图片或者本地图片
198 | new Thread() {
199 | public void run() {
200 | Message osMessage = new Message();
201 | bitmap = GetBitmap(coverUrl);
202 | osMessage.what = 2;
203 | handler.sendMessage(osMessage);
204 | }
205 | }.start();
206 | break;
207 | case "video":
208 | WXVideoObject videoObject = new WXVideoObject();
209 | videoObject.videoUrl = call.argument("resourceUrl").toString();
210 | videoObject.videoLowBandUrl = call.argument("resourceUrl").toString();
211 | message = new WXMediaMessage();
212 | message.mediaObject = videoObject;
213 | message.title = call.argument("title").toString();
214 | message.description = call.argument("description").toString();
215 | //网络图片或者本地图片
216 | new Thread() {
217 | public void run() {
218 | Message osMessage = new Message();
219 | bitmap = GetBitmap(coverUrl);
220 | osMessage.what = 3;
221 | handler.sendMessage(osMessage);
222 | }
223 | }.start();
224 | break;
225 | case "image":
226 | message = new WXMediaMessage();
227 | message.title = call.argument("title").toString();
228 | message.description = call.argument("description").toString();
229 | final String imageResourceUrl = call.argument("resourceUrl");
230 | //网络图片或者本地图片
231 | new Thread() {
232 | public void run() {
233 | Message osMessage = new Message();
234 | bitmap = GetBitmap(imageResourceUrl);
235 | osMessage.what = 1;
236 | handler.sendMessage(osMessage);
237 | }
238 | }.start();
239 | break;
240 | case "webpage":
241 | WXWebpageObject webpageObject = new WXWebpageObject();
242 | webpageObject.webpageUrl = call.argument("url").toString();
243 | message = new WXMediaMessage();
244 | message.mediaObject = webpageObject;
245 | message.title = call.argument("title").toString();
246 | message.description = call.argument("description").toString();
247 | //网络图片或者本地图片
248 | new Thread() {
249 | public void run() {
250 | Message osMessage = new Message();
251 | bitmap = GetBitmap(coverUrl);
252 | osMessage.what = 0;
253 | handler.sendMessage(osMessage);
254 | }
255 | }.start();
256 | break;
257 | }
258 | }
259 | else if (call.method.equals("login")) {
260 | final String scope = call.argument("scope").toString();
261 | final String state = call.argument("state").toString();
262 | SendAuth.Req authRequest = new SendAuth.Req();
263 | authRequest.scope = scope;
264 | authRequest.state = state;
265 | api.sendReq(authRequest);
266 | }
267 | else if (call.method.equals("pay")) {
268 | final String appId = call.argument("appId").toString();
269 | final String partnerId = call.argument("partnerId").toString();
270 | final String prepayId = call.argument("prepayId").toString();
271 | final String nonceStr = call.argument("nonceStr").toString();
272 | final String timestamp = call.argument("timestamp").toString();
273 | final String sign = call.argument("sign").toString();
274 | final String packageValue = call.argument("package").toString();
275 | PayReq payRequest = new PayReq();
276 | payRequest.partnerId = partnerId;
277 | payRequest.prepayId = prepayId;
278 | payRequest.nonceStr = nonceStr;
279 | payRequest.timeStamp = timestamp;
280 | payRequest.sign = sign;
281 | payRequest.packageValue = packageValue;
282 | payRequest.appId = appId;
283 | api.sendReq(payRequest);
284 | }
285 | else {
286 | result.notImplemented();
287 | }
288 | }
289 |
290 | public Bitmap GetBitmap(String url) {
291 | Bitmap bitmap = null;
292 | InputStream in = null;
293 | BufferedOutputStream out = null;
294 | try {
295 | in = new BufferedInputStream(new URL(url).openStream(), 1024);
296 | final ByteArrayOutputStream dataStream = new ByteArrayOutputStream();
297 | out = new BufferedOutputStream(dataStream, 1024);
298 | copy(in, out);
299 | out.flush();
300 | byte[] data = dataStream.toByteArray();
301 | bitmap = BitmapFactory.decodeByteArray(data, 0, data.length);
302 | return bitmap;
303 | } catch (IOException e) {
304 | e.printStackTrace();
305 | return null;
306 | }
307 | }
308 |
309 | public byte[] convertBitmapToByteArray(final Bitmap bitmap, final boolean needRecycle) {
310 | ByteArrayOutputStream output = new ByteArrayOutputStream();
311 | bitmap.compress(CompressFormat.PNG, 100, output);
312 | if (needRecycle) {
313 | bitmap.recycle();
314 | }
315 |
316 | byte[] result = output.toByteArray();
317 | try {
318 | output.close();
319 | } catch (Exception e) {
320 | e.printStackTrace();
321 | }
322 |
323 | return result;
324 | }
325 |
326 | private static void copy(InputStream in, OutputStream out) throws IOException {
327 | byte[] b = new byte[1024];
328 | int read;
329 | while ((read = in.read(b)) != -1) {
330 | out.write(b, 0, read);
331 | }
332 | }
333 |
334 | private static BroadcastReceiver createReceiver() {
335 | return new BroadcastReceiver() {
336 | @Override
337 | public void onReceive(Context context, Intent intent) {
338 | System.out.println(intent.getStringExtra("type"));
339 | if (intent.getStringExtra("type").equals("SendAuthResp")) {
340 | result.success(intent.getStringExtra("code"));
341 | }
342 | else if (intent.getStringExtra("type").equals("PayResp")) {
343 | result.success(intent.getStringExtra("code"));
344 | }
345 | else if (intent.getStringExtra("type").equals("ShareResp")) {
346 | System.out.println(intent.getStringExtra("code"));
347 | result.success(intent.getStringExtra("code"));
348 | }
349 | }
350 | };
351 | }
352 | }
353 |
--------------------------------------------------------------------------------
/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: 5391447fae6209bb21a89e6a5a6583cac1af9b4b
8 | channel: stable
9 |
10 | project_type: app
11 |
--------------------------------------------------------------------------------
/example/README.md:
--------------------------------------------------------------------------------
1 | # wechat_example
2 |
3 | Demonstrates how to use the wechat plugin.
4 |
5 | ## Getting Started
6 |
7 | This project is a starting point for a Flutter application.
8 |
9 | A few resources to get you started if this is your first Flutter project:
10 |
11 | - [Lab: Write your first Flutter app](https://flutter.io/docs/get-started/codelab)
12 | - [Cookbook: Useful Flutter samples](https://flutter.io/docs/cookbook)
13 |
14 | For help getting started with Flutter, view our
15 | [online documentation](https://flutter.io/docs), which offers tutorials,
16 | samples, guidance on mobile development, and a full API reference.
17 |
--------------------------------------------------------------------------------
/example/android/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | android
4 | Project android created by Buildship.
5 |
6 |
7 |
8 |
9 | org.eclipse.buildship.core.gradleprojectbuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.buildship.core.gradleprojectnature
16 |
17 |
18 |
--------------------------------------------------------------------------------
/example/android/.settings/org.eclipse.buildship.core.prefs:
--------------------------------------------------------------------------------
1 | connection.project.dir=
2 | eclipse.preferences.version=1
3 |
--------------------------------------------------------------------------------
/example/android/app/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/example/android/app/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | app
4 | Project app created by Buildship.
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.buildship.core.gradleprojectbuilder
15 |
16 |
17 |
18 |
19 |
20 | org.eclipse.jdt.core.javanature
21 | org.eclipse.buildship.core.gradleprojectnature
22 |
23 |
24 |
--------------------------------------------------------------------------------
/example/android/app/.settings/org.eclipse.buildship.core.prefs:
--------------------------------------------------------------------------------
1 | connection.project.dir=..
2 | eclipse.preferences.version=1
3 |
--------------------------------------------------------------------------------
/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 "com.example.wechatexample"
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/com/example/wechatexample/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.wechatexample;
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/pantao/flutter-wechat/01522da81e725947e545445897a3f4efce6cacfb/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/pantao/flutter-wechat/01522da81e725947e545445897a3f4efce6cacfb/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/pantao/flutter-wechat/01522da81e725947e545445897a3f4efce6cacfb/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/pantao/flutter-wechat/01522da81e725947e545445897a3f4efce6cacfb/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/pantao/flutter-wechat/01522da81e725947e545445897a3f4efce6cacfb/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.2.1'
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.10.2-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 | project 'Runner', {
8 | 'Debug' => :debug,
9 | 'Profile' => :release,
10 | 'Release' => :release,
11 | }
12 |
13 | def parse_KV_file(file, separator='=')
14 | file_abs_path = File.expand_path(file)
15 | if !File.exists? file_abs_path
16 | return [];
17 | end
18 | pods_ary = []
19 | skip_line_start_symbols = ["#", "/"]
20 | File.foreach(file_abs_path) { |line|
21 | next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
22 | plugin = line.split(pattern=separator)
23 | if plugin.length == 2
24 | podname = plugin[0].strip()
25 | path = plugin[1].strip()
26 | podpath = File.expand_path("#{path}", file_abs_path)
27 | pods_ary.push({:name => podname, :path => podpath});
28 | else
29 | puts "Invalid plugin specification: #{line}"
30 | end
31 | }
32 | return pods_ary
33 | end
34 |
35 | target 'Runner' do
36 | # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
37 | # referring to absolute paths on developers' machines.
38 | system('rm -rf .symlinks')
39 | system('mkdir -p .symlinks/plugins')
40 |
41 | # Flutter Pods
42 | generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig')
43 | if generated_xcode_build_settings.empty?
44 | puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first."
45 | end
46 | generated_xcode_build_settings.map { |p|
47 | if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
48 | symlink = File.join('.symlinks', 'flutter')
49 | File.symlink(File.dirname(p[:path]), symlink)
50 | pod 'Flutter', :path => File.join(symlink, File.basename(p[:path]))
51 | end
52 | }
53 |
54 | # Plugin Pods
55 | plugin_pods = parse_KV_file('../.flutter-plugins')
56 | plugin_pods.map { |p|
57 | symlink = File.join('.symlinks', 'plugins', p[:name])
58 | File.symlink(p[:path], symlink)
59 | pod p[:name], :path => File.join(symlink, 'ios')
60 | }
61 | end
62 |
63 | post_install do |installer|
64 | installer.pods_project.targets.each do |target|
65 | target.build_configurations.each do |config|
66 | config.build_settings['ENABLE_BITCODE'] = 'NO'
67 | end
68 | end
69 | end
70 |
--------------------------------------------------------------------------------
/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 | 1176384B12DB9322C963BC31 /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6FDC882567142E625489DE12 /* libPods-Runner.a */; };
11 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
12 | 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */ = {isa = PBXBuildFile; fileRef = 2D5378251FAA1A9400D5DBA9 /* flutter_assets */; };
13 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
14 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; };
15 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
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 | 6FDC882567142E625489DE12 /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; };
48 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; };
49 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; };
50 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; };
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 | 1176384B12DB9322C963BC31 /* libPods-Runner.a in Frameworks */,
70 | );
71 | runOnlyForDeploymentPostprocessing = 0;
72 | };
73 | /* End PBXFrameworksBuildPhase section */
74 |
75 | /* Begin PBXGroup section */
76 | 8B5896A22734E3A27263AF0D /* Pods */ = {
77 | isa = PBXGroup;
78 | children = (
79 | );
80 | name = Pods;
81 | sourceTree = "";
82 | };
83 | 9740EEB11CF90186004384FC /* Flutter */ = {
84 | isa = PBXGroup;
85 | children = (
86 | 2D5378251FAA1A9400D5DBA9 /* flutter_assets */,
87 | 3B80C3931E831B6300D905FE /* App.framework */,
88 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
89 | 9740EEBA1CF902C7004384FC /* Flutter.framework */,
90 | 9740EEB21CF90195004384FC /* Debug.xcconfig */,
91 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
92 | 9740EEB31CF90195004384FC /* Generated.xcconfig */,
93 | );
94 | name = Flutter;
95 | sourceTree = "";
96 | };
97 | 97C146E51CF9000F007C117D = {
98 | isa = PBXGroup;
99 | children = (
100 | 9740EEB11CF90186004384FC /* Flutter */,
101 | 97C146F01CF9000F007C117D /* Runner */,
102 | 97C146EF1CF9000F007C117D /* Products */,
103 | 8B5896A22734E3A27263AF0D /* Pods */,
104 | BE86DBF27F1FD920B404EA98 /* Frameworks */,
105 | );
106 | sourceTree = "";
107 | };
108 | 97C146EF1CF9000F007C117D /* Products */ = {
109 | isa = PBXGroup;
110 | children = (
111 | 97C146EE1CF9000F007C117D /* Runner.app */,
112 | );
113 | name = Products;
114 | sourceTree = "";
115 | };
116 | 97C146F01CF9000F007C117D /* Runner */ = {
117 | isa = PBXGroup;
118 | children = (
119 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */,
120 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */,
121 | 97C146FA1CF9000F007C117D /* Main.storyboard */,
122 | 97C146FD1CF9000F007C117D /* Assets.xcassets */,
123 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
124 | 97C147021CF9000F007C117D /* Info.plist */,
125 | 97C146F11CF9000F007C117D /* Supporting Files */,
126 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
127 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
128 | );
129 | path = Runner;
130 | sourceTree = "";
131 | };
132 | 97C146F11CF9000F007C117D /* Supporting Files */ = {
133 | isa = PBXGroup;
134 | children = (
135 | 97C146F21CF9000F007C117D /* main.m */,
136 | );
137 | name = "Supporting Files";
138 | sourceTree = "";
139 | };
140 | BE86DBF27F1FD920B404EA98 /* Frameworks */ = {
141 | isa = PBXGroup;
142 | children = (
143 | 6FDC882567142E625489DE12 /* 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 | 9094B1D87A0686C59EF9C641 /* [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 | 8666D5687DFE31B79F725D8D /* [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 = 7GA82M95EJ;
185 | ProvisioningStyle = Manual;
186 | };
187 | };
188 | };
189 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
190 | compatibilityVersion = "Xcode 3.2";
191 | developmentRegion = English;
192 | hasScannedForEncodings = 0;
193 | knownRegions = (
194 | en,
195 | Base,
196 | );
197 | mainGroup = 97C146E51CF9000F007C117D;
198 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
199 | projectDirPath = "";
200 | projectRoot = "";
201 | targets = (
202 | 97C146ED1CF9000F007C117D /* Runner */,
203 | );
204 | };
205 | /* End PBXProject section */
206 |
207 | /* Begin PBXResourcesBuildPhase section */
208 | 97C146EC1CF9000F007C117D /* Resources */ = {
209 | isa = PBXResourcesBuildPhase;
210 | buildActionMask = 2147483647;
211 | files = (
212 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
213 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
214 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */,
215 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
216 | 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */,
217 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
218 | );
219 | runOnlyForDeploymentPostprocessing = 0;
220 | };
221 | /* End PBXResourcesBuildPhase section */
222 |
223 | /* Begin PBXShellScriptBuildPhase section */
224 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
225 | isa = PBXShellScriptBuildPhase;
226 | buildActionMask = 2147483647;
227 | files = (
228 | );
229 | inputPaths = (
230 | );
231 | name = "Thin Binary";
232 | outputPaths = (
233 | );
234 | runOnlyForDeploymentPostprocessing = 0;
235 | shellPath = /bin/sh;
236 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin";
237 | };
238 | 8666D5687DFE31B79F725D8D /* [CP] Embed Pods Frameworks */ = {
239 | isa = PBXShellScriptBuildPhase;
240 | buildActionMask = 2147483647;
241 | files = (
242 | );
243 | inputFileListPaths = (
244 | );
245 | inputPaths = (
246 | "${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
247 | "${PODS_ROOT}/../.symlinks/flutter/ios/Flutter.framework",
248 | );
249 | name = "[CP] Embed Pods Frameworks";
250 | outputFileListPaths = (
251 | );
252 | outputPaths = (
253 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework",
254 | );
255 | runOnlyForDeploymentPostprocessing = 0;
256 | shellPath = /bin/sh;
257 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
258 | showEnvVarsInLog = 0;
259 | };
260 | 9094B1D87A0686C59EF9C641 /* [CP] Check Pods Manifest.lock */ = {
261 | isa = PBXShellScriptBuildPhase;
262 | buildActionMask = 2147483647;
263 | files = (
264 | );
265 | inputFileListPaths = (
266 | );
267 | inputPaths = (
268 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
269 | "${PODS_ROOT}/Manifest.lock",
270 | );
271 | name = "[CP] Check Pods Manifest.lock";
272 | outputFileListPaths = (
273 | );
274 | outputPaths = (
275 | "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
276 | );
277 | runOnlyForDeploymentPostprocessing = 0;
278 | shellPath = /bin/sh;
279 | 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";
280 | showEnvVarsInLog = 0;
281 | };
282 | 9740EEB61CF901F6004384FC /* Run Script */ = {
283 | isa = PBXShellScriptBuildPhase;
284 | buildActionMask = 2147483647;
285 | files = (
286 | );
287 | inputPaths = (
288 | );
289 | name = "Run Script";
290 | outputPaths = (
291 | );
292 | runOnlyForDeploymentPostprocessing = 0;
293 | shellPath = /bin/sh;
294 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
295 | };
296 | /* End PBXShellScriptBuildPhase section */
297 |
298 | /* Begin PBXSourcesBuildPhase section */
299 | 97C146EA1CF9000F007C117D /* Sources */ = {
300 | isa = PBXSourcesBuildPhase;
301 | buildActionMask = 2147483647;
302 | files = (
303 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */,
304 | 97C146F31CF9000F007C117D /* main.m in Sources */,
305 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
306 | );
307 | runOnlyForDeploymentPostprocessing = 0;
308 | };
309 | /* End PBXSourcesBuildPhase section */
310 |
311 | /* Begin PBXVariantGroup section */
312 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = {
313 | isa = PBXVariantGroup;
314 | children = (
315 | 97C146FB1CF9000F007C117D /* Base */,
316 | );
317 | name = Main.storyboard;
318 | sourceTree = "";
319 | };
320 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = {
321 | isa = PBXVariantGroup;
322 | children = (
323 | 97C147001CF9000F007C117D /* Base */,
324 | );
325 | name = LaunchScreen.storyboard;
326 | sourceTree = "";
327 | };
328 | /* End PBXVariantGroup section */
329 |
330 | /* Begin XCBuildConfiguration section */
331 | 249021D3217E4FDB00AE95B9 /* Profile */ = {
332 | isa = XCBuildConfiguration;
333 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
334 | buildSettings = {
335 | ALWAYS_SEARCH_USER_PATHS = NO;
336 | CLANG_ANALYZER_NONNULL = YES;
337 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
338 | CLANG_CXX_LIBRARY = "libc++";
339 | CLANG_ENABLE_MODULES = YES;
340 | CLANG_ENABLE_OBJC_ARC = YES;
341 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
342 | CLANG_WARN_BOOL_CONVERSION = YES;
343 | CLANG_WARN_COMMA = YES;
344 | CLANG_WARN_CONSTANT_CONVERSION = YES;
345 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
346 | CLANG_WARN_EMPTY_BODY = YES;
347 | CLANG_WARN_ENUM_CONVERSION = YES;
348 | CLANG_WARN_INFINITE_RECURSION = YES;
349 | CLANG_WARN_INT_CONVERSION = YES;
350 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
351 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
352 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
353 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
354 | CLANG_WARN_STRICT_PROTOTYPES = YES;
355 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
356 | CLANG_WARN_UNREACHABLE_CODE = YES;
357 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
358 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
359 | COPY_PHASE_STRIP = NO;
360 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
361 | ENABLE_NS_ASSERTIONS = NO;
362 | ENABLE_STRICT_OBJC_MSGSEND = YES;
363 | GCC_C_LANGUAGE_STANDARD = gnu99;
364 | GCC_NO_COMMON_BLOCKS = YES;
365 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
366 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
367 | GCC_WARN_UNDECLARED_SELECTOR = YES;
368 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
369 | GCC_WARN_UNUSED_FUNCTION = YES;
370 | GCC_WARN_UNUSED_VARIABLE = YES;
371 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
372 | MTL_ENABLE_DEBUG_INFO = NO;
373 | SDKROOT = iphoneos;
374 | TARGETED_DEVICE_FAMILY = "1,2";
375 | VALIDATE_PRODUCT = YES;
376 | };
377 | name = Profile;
378 | };
379 | 249021D4217E4FDB00AE95B9 /* Profile */ = {
380 | isa = XCBuildConfiguration;
381 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
382 | buildSettings = {
383 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
384 | CODE_SIGN_STYLE = Manual;
385 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
386 | DEVELOPMENT_TEAM = 7GA82M95EJ;
387 | ENABLE_BITCODE = NO;
388 | FRAMEWORK_SEARCH_PATHS = (
389 | "$(inherited)",
390 | "$(PROJECT_DIR)/Flutter",
391 | );
392 | INFOPLIST_FILE = Runner/Info.plist;
393 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
394 | LIBRARY_SEARCH_PATHS = (
395 | "$(inherited)",
396 | "$(PROJECT_DIR)/Flutter",
397 | );
398 | PRODUCT_BUNDLE_IDENTIFIER = com.onmr.flutter.example.wechat;
399 | PRODUCT_NAME = "$(TARGET_NAME)";
400 | PROVISIONING_PROFILE_SPECIFIER = "Flutter Wechat Plugin Demo App";
401 | VERSIONING_SYSTEM = "apple-generic";
402 | };
403 | name = Profile;
404 | };
405 | 97C147031CF9000F007C117D /* Debug */ = {
406 | isa = XCBuildConfiguration;
407 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
408 | buildSettings = {
409 | ALWAYS_SEARCH_USER_PATHS = NO;
410 | CLANG_ANALYZER_NONNULL = YES;
411 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
412 | CLANG_CXX_LIBRARY = "libc++";
413 | CLANG_ENABLE_MODULES = YES;
414 | CLANG_ENABLE_OBJC_ARC = YES;
415 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
416 | CLANG_WARN_BOOL_CONVERSION = YES;
417 | CLANG_WARN_COMMA = YES;
418 | CLANG_WARN_CONSTANT_CONVERSION = YES;
419 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
420 | CLANG_WARN_EMPTY_BODY = YES;
421 | CLANG_WARN_ENUM_CONVERSION = YES;
422 | CLANG_WARN_INFINITE_RECURSION = YES;
423 | CLANG_WARN_INT_CONVERSION = YES;
424 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
425 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
426 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
427 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
428 | CLANG_WARN_STRICT_PROTOTYPES = YES;
429 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
430 | CLANG_WARN_UNREACHABLE_CODE = YES;
431 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
432 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
433 | COPY_PHASE_STRIP = NO;
434 | DEBUG_INFORMATION_FORMAT = dwarf;
435 | ENABLE_STRICT_OBJC_MSGSEND = YES;
436 | ENABLE_TESTABILITY = YES;
437 | GCC_C_LANGUAGE_STANDARD = gnu99;
438 | GCC_DYNAMIC_NO_PIC = NO;
439 | GCC_NO_COMMON_BLOCKS = YES;
440 | GCC_OPTIMIZATION_LEVEL = 0;
441 | GCC_PREPROCESSOR_DEFINITIONS = (
442 | "DEBUG=1",
443 | "$(inherited)",
444 | );
445 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
446 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
447 | GCC_WARN_UNDECLARED_SELECTOR = YES;
448 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
449 | GCC_WARN_UNUSED_FUNCTION = YES;
450 | GCC_WARN_UNUSED_VARIABLE = YES;
451 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
452 | MTL_ENABLE_DEBUG_INFO = YES;
453 | ONLY_ACTIVE_ARCH = YES;
454 | SDKROOT = iphoneos;
455 | TARGETED_DEVICE_FAMILY = "1,2";
456 | };
457 | name = Debug;
458 | };
459 | 97C147041CF9000F007C117D /* Release */ = {
460 | isa = XCBuildConfiguration;
461 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
462 | buildSettings = {
463 | ALWAYS_SEARCH_USER_PATHS = NO;
464 | CLANG_ANALYZER_NONNULL = YES;
465 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
466 | CLANG_CXX_LIBRARY = "libc++";
467 | CLANG_ENABLE_MODULES = YES;
468 | CLANG_ENABLE_OBJC_ARC = YES;
469 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
470 | CLANG_WARN_BOOL_CONVERSION = YES;
471 | CLANG_WARN_COMMA = YES;
472 | CLANG_WARN_CONSTANT_CONVERSION = YES;
473 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
474 | CLANG_WARN_EMPTY_BODY = YES;
475 | CLANG_WARN_ENUM_CONVERSION = YES;
476 | CLANG_WARN_INFINITE_RECURSION = YES;
477 | CLANG_WARN_INT_CONVERSION = YES;
478 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
479 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
480 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
481 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
482 | CLANG_WARN_STRICT_PROTOTYPES = YES;
483 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
484 | CLANG_WARN_UNREACHABLE_CODE = YES;
485 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
486 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
487 | COPY_PHASE_STRIP = NO;
488 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
489 | ENABLE_NS_ASSERTIONS = NO;
490 | ENABLE_STRICT_OBJC_MSGSEND = YES;
491 | GCC_C_LANGUAGE_STANDARD = gnu99;
492 | GCC_NO_COMMON_BLOCKS = YES;
493 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
494 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
495 | GCC_WARN_UNDECLARED_SELECTOR = YES;
496 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
497 | GCC_WARN_UNUSED_FUNCTION = YES;
498 | GCC_WARN_UNUSED_VARIABLE = YES;
499 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
500 | MTL_ENABLE_DEBUG_INFO = NO;
501 | SDKROOT = iphoneos;
502 | TARGETED_DEVICE_FAMILY = "1,2";
503 | VALIDATE_PRODUCT = YES;
504 | };
505 | name = Release;
506 | };
507 | 97C147061CF9000F007C117D /* Debug */ = {
508 | isa = XCBuildConfiguration;
509 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
510 | buildSettings = {
511 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
512 | CODE_SIGN_STYLE = Manual;
513 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
514 | DEVELOPMENT_TEAM = 7GA82M95EJ;
515 | ENABLE_BITCODE = NO;
516 | FRAMEWORK_SEARCH_PATHS = (
517 | "$(inherited)",
518 | "$(PROJECT_DIR)/Flutter",
519 | );
520 | INFOPLIST_FILE = Runner/Info.plist;
521 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
522 | LIBRARY_SEARCH_PATHS = (
523 | "$(inherited)",
524 | "$(PROJECT_DIR)/Flutter",
525 | );
526 | PRODUCT_BUNDLE_IDENTIFIER = com.onmr.flutter.example.wechat;
527 | PRODUCT_NAME = "$(TARGET_NAME)";
528 | PROVISIONING_PROFILE_SPECIFIER = "Flutter Wechat Plugin Demo App";
529 | VERSIONING_SYSTEM = "apple-generic";
530 | };
531 | name = Debug;
532 | };
533 | 97C147071CF9000F007C117D /* Release */ = {
534 | isa = XCBuildConfiguration;
535 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
536 | buildSettings = {
537 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
538 | CODE_SIGN_STYLE = Manual;
539 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
540 | DEVELOPMENT_TEAM = 7GA82M95EJ;
541 | ENABLE_BITCODE = NO;
542 | FRAMEWORK_SEARCH_PATHS = (
543 | "$(inherited)",
544 | "$(PROJECT_DIR)/Flutter",
545 | );
546 | INFOPLIST_FILE = Runner/Info.plist;
547 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
548 | LIBRARY_SEARCH_PATHS = (
549 | "$(inherited)",
550 | "$(PROJECT_DIR)/Flutter",
551 | );
552 | PRODUCT_BUNDLE_IDENTIFIER = com.onmr.flutter.example.wechat;
553 | PRODUCT_NAME = "$(TARGET_NAME)";
554 | PROVISIONING_PROFILE_SPECIFIER = "Flutter Wechat Plugin Demo App";
555 | VERSIONING_SYSTEM = "apple-generic";
556 | };
557 | name = Release;
558 | };
559 | /* End XCBuildConfiguration section */
560 |
561 | /* Begin XCConfigurationList section */
562 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {
563 | isa = XCConfigurationList;
564 | buildConfigurations = (
565 | 97C147031CF9000F007C117D /* Debug */,
566 | 97C147041CF9000F007C117D /* Release */,
567 | 249021D3217E4FDB00AE95B9 /* Profile */,
568 | );
569 | defaultConfigurationIsVisible = 0;
570 | defaultConfigurationName = Release;
571 | };
572 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = {
573 | isa = XCConfigurationList;
574 | buildConfigurations = (
575 | 97C147061CF9000F007C117D /* Debug */,
576 | 97C147071CF9000F007C117D /* Release */,
577 | 249021D4217E4FDB00AE95B9 /* Profile */,
578 | );
579 | defaultConfigurationIsVisible = 0;
580 | defaultConfigurationName = Release;
581 | };
582 | /* End XCConfigurationList section */
583 | };
584 | rootObject = 97C146E61CF9000F007C117D /* Project object */;
585 | }
586 |
--------------------------------------------------------------------------------
/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/pantao/flutter-wechat/01522da81e725947e545445897a3f4efce6cacfb/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/pantao/flutter-wechat/01522da81e725947e545445897a3f4efce6cacfb/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/pantao/flutter-wechat/01522da81e725947e545445897a3f4efce6cacfb/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/pantao/flutter-wechat/01522da81e725947e545445897a3f4efce6cacfb/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/pantao/flutter-wechat/01522da81e725947e545445897a3f4efce6cacfb/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/pantao/flutter-wechat/01522da81e725947e545445897a3f4efce6cacfb/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/pantao/flutter-wechat/01522da81e725947e545445897a3f4efce6cacfb/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/pantao/flutter-wechat/01522da81e725947e545445897a3f4efce6cacfb/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/pantao/flutter-wechat/01522da81e725947e545445897a3f4efce6cacfb/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/pantao/flutter-wechat/01522da81e725947e545445897a3f4efce6cacfb/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/pantao/flutter-wechat/01522da81e725947e545445897a3f4efce6cacfb/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/pantao/flutter-wechat/01522da81e725947e545445897a3f4efce6cacfb/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/pantao/flutter-wechat/01522da81e725947e545445897a3f4efce6cacfb/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/pantao/flutter-wechat/01522da81e725947e545445897a3f4efce6cacfb/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/pantao/flutter-wechat/01522da81e725947e545445897a3f4efce6cacfb/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/pantao/flutter-wechat/01522da81e725947e545445897a3f4efce6cacfb/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pantao/flutter-wechat/01522da81e725947e545445897a3f4efce6cacfb/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pantao/flutter-wechat/01522da81e725947e545445897a3f4efce6cacfb/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 | CFBundleDisplayName
8 | 微信示例
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | wechat_example
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | $(FLUTTER_BUILD_NAME)
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | $(FLUTTER_BUILD_NUMBER)
25 | LSRequiresIPhoneOS
26 |
27 | UILaunchStoryboardName
28 | LaunchScreen
29 | UIMainStoryboardFile
30 | Main
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 | UISupportedInterfaceOrientations~ipad
38 |
39 | UIInterfaceOrientationPortrait
40 | UIInterfaceOrientationPortraitUpsideDown
41 | UIInterfaceOrientationLandscapeLeft
42 | UIInterfaceOrientationLandscapeRight
43 |
44 | UIViewControllerBasedStatusBarAppearance
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/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 'package:flutter/material.dart';
2 | import 'dart:async';
3 |
4 | import 'package:flutter/services.dart';
5 | import 'package:wechat/wechat.dart';
6 |
7 | void main() => runApp(MyApp());
8 |
9 | class MyApp extends StatefulWidget {
10 | @override
11 | _MyAppState createState() => _MyAppState();
12 | }
13 |
14 | class _MyAppState extends State {
15 | String _platformVersion = 'Unknown';
16 | String _result = 'no result';
17 |
18 | @override
19 | void initState() {
20 | super.initState();
21 | initPlatformState();
22 | Wechat.register('APPID');
23 | _result = 'no result';
24 | print('inited');
25 | }
26 |
27 | // Platform messages are asynchronous, so we initialize in an async method.
28 | Future initPlatformState() async {
29 | String platformVersion;
30 | // Platform messages may fail, so we use a try/catch PlatformException.
31 | try {
32 | platformVersion = await Wechat.platformVersion;
33 | } on PlatformException {
34 | platformVersion = 'Failed to get platform version.';
35 | }
36 |
37 | // If the widget was removed from the tree while the asynchronous platform
38 | // message was in flight, we want to discard the reply rather than calling
39 | // setState to update our non-existent appearance.
40 | if (!mounted) return;
41 |
42 | setState(() {
43 | _platformVersion = platformVersion;
44 | });
45 | }
46 |
47 | void _share (arguments) async {
48 | try {
49 | var result = await Wechat.share(arguments);
50 | _result = result.toString() ?? 'null result';
51 | } catch (e) {
52 | _result = e.toString();
53 | }
54 | }
55 |
56 | void _shareText ([String to = 'session']) async {
57 | var arguments = {
58 | 'to': to,
59 | 'text': 'Welcome to user flutter wechat plugin.'
60 | };
61 | await _share(arguments);
62 | }
63 |
64 | void _shareImage ([String to = 'session']) async {
65 | _share({
66 | 'kind': 'image',
67 | 'to': to,
68 | 'resourceUrl': 'https://files.onmr.com/wild/2018/09/3177628278.jpg',
69 | 'url': 'https://wild.onmr.com/trails',
70 | 'title': '荒僧',
71 | 'description': '大丈夫当朝游碧海而暮苍梧'
72 | });
73 | }
74 |
75 | void _shareMusic ([String to = 'session']) async {
76 | _share({
77 | 'kind': 'music',
78 | 'to': to,
79 | 'resourceUrl': 'https://pantao.onmr.com/usr/uploads/2018/12/2839345471.mp3',
80 | 'url': 'https://pantao.onmr.com/demo-files',
81 | 'coverUrl': 'https://pantao.onmr.com/usr/uploads/2018/12/2293691504.jpg',
82 | 'title': 'Jingle Bells',
83 | 'description': 'Children\'s Christmas Favorites-Jingle Bells (Album Version)'
84 | });
85 | }
86 |
87 | void _shareWebpage ([String to = 'session']) async {
88 | _share({
89 | 'kind': 'webpage',
90 | 'to': to,
91 | 'url': 'https://pantao.onmr.com/demo-files',
92 | 'coverUrl': 'https://pantao.onmr.com/usr/uploads/2018/12/2293691504.jpg',
93 | 'title': 'Jingle Bells',
94 | 'description': 'Children\'s Christmas Favorites-Jingle Bells (Album Version)'
95 | });
96 | }
97 |
98 | void _login () async {
99 | var result = await Wechat.login({
100 | 'scope': 'snsapi_userinfo',
101 | 'state': 'customstate'
102 | });
103 | _result = result.toString();
104 | }
105 |
106 | void _openWechat () async {
107 | var result = await Wechat.openWechat();
108 | }
109 |
110 | @override
111 | Widget build(BuildContext context) {
112 | return MaterialApp(
113 | home: Scaffold(
114 | appBar: AppBar(
115 | title: const Text('Wechat Plugin App'),
116 | ),
117 | body: ListView(
118 | children: [
119 | ListTile(
120 | leading: Icon(Icons.system_update),
121 | title: Text('Running on: $_platformVersion\n'),
122 | ),
123 | ListTile(
124 | leading: Icon(Icons.text_format),
125 | title: Text('Share text to wechat'),
126 | onTap: () {
127 | _shareText();
128 | },
129 | ),
130 | ListTile(
131 | leading: Icon(Icons.text_format),
132 | title: Text('Share text to wechat timeline'),
133 | onTap: () {
134 | _shareText('timeline');
135 | },
136 | ),
137 | ListTile(
138 | leading: Icon(Icons.image),
139 | title: Text('Share image to wechat'),
140 | onTap: () {
141 | _shareImage();
142 | },
143 | ),
144 | ListTile(
145 | leading: Icon(Icons.music_note),
146 | title: Text('Share music to wechat'),
147 | onTap: () {
148 | _shareMusic();
149 | },
150 | ),
151 | ListTile(
152 | leading: Icon(Icons.web),
153 | title: Text('Share webpage to wechat'),
154 | onTap: () {
155 | _shareWebpage();
156 | },
157 | ),
158 | ListTile(
159 | leading: Icon(Icons.person),
160 | title: Text('Login via wechat'),
161 | onTap: () {
162 | _login();
163 | },
164 | ),
165 | ListTile(
166 | leading: Icon(Icons.person),
167 | title: Text('Open Wechat'),
168 | onTap: () {
169 | _openWechat();
170 | },
171 | ),
172 | Text('result: $_result')
173 | ],
174 | ),
175 | ),
176 | );
177 | }
178 | }
179 |
--------------------------------------------------------------------------------
/example/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: wechat_example
2 | description: Demonstrates how to use the wechat plugin.
3 | publish_to: 'none'
4 |
5 | environment:
6 | sdk: ">=2.0.0-dev.68.0 <3.0.0"
7 |
8 | dependencies:
9 | flutter:
10 | sdk: flutter
11 |
12 | # The following adds the Cupertino Icons font to your application.
13 | # Use with the CupertinoIcons class for iOS style icons.
14 | cupertino_icons: ^0.1.2
15 |
16 | dev_dependencies:
17 | flutter_test:
18 | sdk: flutter
19 |
20 | wechat:
21 | path: ../
22 |
23 | # For information on the generic Dart part of this file, see the
24 | # following page: https://www.dartlang.org/tools/pub/pubspec
25 |
26 | # The following section is specific to Flutter.
27 | flutter:
28 |
29 | # The following line ensures that the Material Icons font is
30 | # included with your application, so that you can use the icons in
31 | # the material Icons class.
32 | uses-material-design: true
33 |
34 | # To add assets to your application, add an assets section, like this:
35 | # assets:
36 | # - images/a_dot_burr.jpeg
37 | # - images/a_dot_ham.jpeg
38 |
39 | # An image asset can refer to one or more resolution-specific "variants", see
40 | # https://flutter.io/assets-and-images/#resolution-aware.
41 |
42 | # For details regarding adding assets from package dependencies, see
43 | # https://flutter.io/assets-and-images/#from-packages
44 |
45 | # To add custom fonts to your application, add a fonts section here,
46 | # in this "flutter" section. Each entry in this list should have a
47 | # "family" key with the font family name, and a "fonts" key with a
48 | # list giving the asset and other descriptors for the font. For
49 | # example:
50 | # fonts:
51 | # - family: Schyler
52 | # fonts:
53 | # - asset: fonts/Schyler-Regular.ttf
54 | # - asset: fonts/Schyler-Italic.ttf
55 | # style: italic
56 | # - family: Trajan Pro
57 | # fonts:
58 | # - asset: fonts/TrajanPro.ttf
59 | # - asset: fonts/TrajanPro_Bold.ttf
60 | # weight: 700
61 | #
62 | # For details regarding fonts from package dependencies,
63 | # see https://flutter.io/custom-fonts/#from-packages
64 |
--------------------------------------------------------------------------------
/example/test/widget_test.dart:
--------------------------------------------------------------------------------
1 | // This is a basic Flutter widget test.
2 | //
3 | // To perform an interaction with a widget in your test, use the WidgetTester
4 | // utility that Flutter provides. For example, you can send tap and scroll
5 | // gestures. You can also use WidgetTester to find child widgets in the widget
6 | // tree, read text, and verify that the values of widget properties are correct.
7 |
8 | import 'package:flutter/material.dart';
9 | import 'package:flutter_test/flutter_test.dart';
10 |
11 | import 'package:wechat_example/main.dart';
12 |
13 | void main() {
14 | testWidgets('Verify Platform version', (WidgetTester tester) async {
15 | // Build our app and trigger a frame.
16 | await tester.pumpWidget(MyApp());
17 |
18 | // Verify that platform version is retrieved.
19 | expect(
20 | find.byWidgetPredicate(
21 | (Widget widget) => widget is Text &&
22 | widget.data.startsWith('Running on:'),
23 | ),
24 | findsOneWidget,
25 | );
26 | });
27 | }
28 |
--------------------------------------------------------------------------------
/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/pantao/flutter-wechat/01522da81e725947e545445897a3f4efce6cacfb/ios/Assets/.gitkeep
--------------------------------------------------------------------------------
/ios/Classes/WechatPlugin.h:
--------------------------------------------------------------------------------
1 | #import
2 | #include "WXApi.h"
3 |
4 | @interface WechatPlugin : NSObject
5 | @end
6 |
--------------------------------------------------------------------------------
/ios/Classes/WechatPlugin.m:
--------------------------------------------------------------------------------
1 | #import "WechatPlugin.h"
2 |
3 | @implementation WechatPlugin {
4 | FlutterResult result;
5 | }
6 |
7 | - (instancetype)init {
8 | self = [super init];
9 | [[NSNotificationCenter defaultCenter]
10 | addObserver:self
11 | selector:@selector(handleOpenURL:)
12 | name:@"WeChat"
13 | object:nil
14 | ];
15 | return self;
16 | }
17 |
18 | - (void)dealloc {
19 | [[NSNotificationCenter defaultCenter] removeObserver:self];
20 | }
21 |
22 | + (void)registerWithRegistrar:(NSObject*)registrar {
23 | FlutterMethodChannel* channel = [FlutterMethodChannel
24 | methodChannelWithName:@"wechat"
25 | binaryMessenger:[registrar messenger]];
26 | WechatPlugin* instance = [[WechatPlugin alloc] init];
27 | [registrar addMethodCallDelegate:instance channel:channel];
28 | }
29 |
30 | - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
31 | NSDictionary *arguments = [call arguments];
32 | if ([@"getPlatformVersion" isEqualToString:call.method]) {
33 | result([@"iOS " stringByAppendingString:[[UIDevice currentDevice] systemVersion]]);
34 | }
35 | // Register app to Wechat with appid
36 | else if ([@"register" isEqualToString:call.method]) {
37 | [WXApi registerApp:arguments[@"appid"]];
38 | result(nil);
39 | }
40 |
41 | else if ([@"isWechatInstalled" isEqualToString:call.method]) {
42 | BOOL installed = [WXApi isWXAppInstalled];
43 | result([NSString stringWithFormat:@"%@", installed ? @"true" : @"false"]);
44 | }
45 |
46 | else if ([@"getApiVersion" isEqualToString:call.method]) {
47 | NSString *apiVersion = [WXApi getApiVersion];
48 | result([NSString stringWithFormat:@"%@", apiVersion]);
49 | }
50 |
51 | else if ([@"openWechat" isEqualToString:call.method]) {
52 | result(nil);
53 | }
54 |
55 | // Share something to Wechat
56 | else if ([@"share" isEqualToString:call.method]) {
57 |
58 | // What kind of things want to share
59 | NSString* kind = arguments[@"kind"];
60 | NSString* to = arguments[@"to"];
61 |
62 | // Wechat Message Request.
63 | SendMessageToWXReq *request = [[SendMessageToWXReq alloc] init];
64 | // Defaults request is not bText.
65 | request.bText = NO;
66 | // Share to wechat timeline.
67 | if ([@"timeline" isEqualToString:to]) {
68 | request.scene = WXSceneTimeline;
69 | }
70 | // Add to wechat favorites list.
71 | else if ([@"favorite" isEqualToString:to]) {
72 | request.scene = WXSceneFavorite;
73 | }
74 | // Defaults share to wechat session.
75 | else {
76 | request.scene = WXSceneSession;
77 | }
78 |
79 | // Sharing some text content
80 | if ([@"text" isEqualToString:kind]) {
81 | // Text content
82 | NSString *text = arguments[@"text"];
83 | request.text = text;
84 | request.bText = YES;
85 | }
86 | // Sharing an image
87 | else if ([@"image" isEqualToString:kind]) {
88 | // Image imageUrl
89 | NSString *resourceUrl = arguments[@"resourceUrl"];
90 |
91 | WXMediaMessage *mediaMessage = [WXMediaMessage message];
92 | WXImageObject *imageObject = [WXImageObject object];
93 | imageObject.imageData = [NSData dataWithContentsOfURL:[NSURL URLWithString:resourceUrl]];
94 | mediaMessage.mediaObject = imageObject;
95 |
96 | request.message = mediaMessage;
97 | }
98 | // Sharing music
99 | else if ([@"music" isEqualToString:kind]) {
100 | // music resource Url
101 | NSString *resourceUrl = arguments[@"resourceUrl"];
102 | // title of this music
103 | NSString *title = arguments[@"title"];
104 | // description of this music
105 | NSString *description = arguments[@"description"];
106 | // webpage url of this music
107 | NSString *url = arguments[@"url"];
108 | // cover Url of this music
109 | NSString *coverUrl = arguments[@"coverUrl"];
110 | NSData* coverImageData = [NSData dataWithContentsOfURL:[NSURL URLWithString:coverUrl]];
111 |
112 | WXMusicObject *musicObject = [WXMusicObject object];
113 | musicObject.musicUrl = url;
114 | musicObject.musicDataUrl = resourceUrl;
115 |
116 | WXMediaMessage *mediaMessage = [WXMediaMessage message];
117 | mediaMessage.title = title;
118 | mediaMessage.description = description;
119 | [mediaMessage setThumbImage:[UIImage imageWithData:coverImageData]];
120 | mediaMessage.mediaObject = musicObject;
121 |
122 | request.message = mediaMessage;
123 | }
124 | // Sharing video
125 | else if ([@"video" isEqualToString:kind]) {
126 | NSString *resourceUrl = arguments[@"resourceUrl"];
127 | NSString *coverUrl = arguments[@"coverUrl"];
128 | // NSString *url = arguments[@"url"];
129 | NSString *title = arguments[@"title"];
130 | NSString *description = arguments[@"description"];
131 |
132 | NSData* coverImageData = [NSData dataWithContentsOfURL:[NSURL URLWithString:coverUrl]];
133 |
134 | WXVideoObject *mediaObject = [WXVideoObject object];
135 | mediaObject.videoUrl = resourceUrl;
136 |
137 | WXMediaMessage *mediaMessage = [WXMediaMessage message];
138 | mediaMessage.title = title;
139 | mediaMessage.description = description;
140 | mediaMessage.mediaObject = mediaObject;
141 | [mediaMessage setThumbImage:[UIImage imageWithData:coverImageData]];
142 |
143 | request.message = mediaMessage;
144 | }
145 | // Sharing webpage
146 | else if ([@"webpage" isEqualToString:kind]) {
147 | NSString *coverUrl = arguments[@"coverUrl"];
148 | NSString *url = arguments[@"url"];
149 | NSString *title = arguments[@"title"];
150 | NSString *description = arguments[@"description"];
151 |
152 | NSData* coverImageData = [NSData dataWithContentsOfURL:[NSURL URLWithString:coverUrl]];
153 |
154 | WXWebpageObject *mediaObject = [WXWebpageObject object];
155 | mediaObject.webpageUrl = url;
156 |
157 | WXMediaMessage *mediaMessage = [WXMediaMessage message];
158 | mediaMessage.title = title;
159 | mediaMessage.description = description;
160 | mediaMessage.mediaObject = mediaObject;
161 | [mediaMessage setThumbImage:[UIImage imageWithData:coverImageData]];
162 |
163 | request.message = mediaMessage;
164 | }
165 | [WXApi sendReq:request];
166 | }
167 |
168 | // Login via wechat
169 | else if ([@"login" isEqualToString:call.method]) {
170 | NSString* scope= arguments[@"scope"];
171 | NSString* state= arguments[@"state"];
172 | SendAuthReq *request = [[SendAuthReq alloc] init];
173 | request.scope = scope;
174 | request.state = state;
175 |
176 | [WXApi sendReq:request];
177 | }
178 |
179 | // Pay via wechat
180 | else if ([@"pay" isEqualToString:call.method]) {
181 | NSString *partnerId = arguments[@"partnerId"];
182 | NSString *prepayId = arguments[@"prepayId"];
183 | NSString *package = arguments[@"package"];
184 | NSString *nonceStr = arguments[@"nonceStr"];
185 | NSString *timestamp= arguments[@"timestamp"];
186 | NSString *sign= arguments[@"sign"];
187 |
188 | PayReq *request = [[PayReq alloc] init];
189 | request.partnerId = partnerId;
190 | request.prepayId = prepayId;
191 | request.package = package;
192 | request.nonceStr = nonceStr;
193 | request.timeStamp = [timestamp intValue];
194 | request.sign = sign;
195 |
196 | [WXApi sendReq:request];
197 | }
198 |
199 | else {
200 | result(FlutterMethodNotImplemented);
201 | }
202 | }
203 |
204 | -(BOOL)handleOpenURL:(NSNotification *)notification {
205 | NSString * urlString = [notification userInfo][@"url"];
206 | NSURL * url = [NSURL URLWithString:urlString];
207 | if ([WXApi handleOpenURL:url delegate:self]) {
208 | return YES;
209 | }
210 | else {
211 | return NO;
212 | }
213 | }
214 |
215 | -(void) onResp:(BaseResp*)resp {
216 | if([resp isKindOfClass:[SendMessageToWXResp class]]) {
217 | result([NSString stringWithFormat:@"%d",resp.errCode]);
218 | }
219 | else if ([resp isKindOfClass:[SendAuthResp class]]) {
220 | SendAuthResp *r = (SendAuthResp *)resp;
221 | if (r.errCode == WXSuccess) {
222 | result(r.code);
223 | }
224 | else {
225 | result([NSString stringWithFormat:@"%d",r.errCode]);
226 | }
227 | }
228 | else if ([resp isKindOfClass:[PayResp class]]) {
229 | result([NSString stringWithFormat:@"%d",resp.errCode]);
230 | }
231 | }
232 |
233 | @end
234 |
--------------------------------------------------------------------------------
/ios/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 = 'wechat'
6 | s.version = '0.0.5'
7 | s.summary = 'Wechat Plugin for Flutter app.'
8 | s.description = <<-DESC
9 | Wechat SDK for Flutter App.
10 | DESC
11 | s.homepage = 'https://github.com/pantao/flutter-wechat'
12 | s.license = { :file => '../LICENSE' }
13 | s.author = { 'Pan Tao' => '54778899@qq.com' }
14 | s.source = { :path => '.' }
15 | s.source_files = 'Classes/**/*'
16 | s.public_header_files = 'Classes/**/*.h'
17 | s.static_framework = true
18 |
19 | s.dependency 'Flutter'
20 | s.dependency 'WechatOpenSDK'
21 |
22 | s.frameworks = ["SystemConfiguration", "CoreTelephony"]
23 | s.libraries = ["z", "sqlite3.0", "c++"]
24 |
25 | s.ios.deployment_target = '8.0'
26 | end
27 |
28 |
--------------------------------------------------------------------------------
/lib/wechat.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 |
3 | import 'package:flutter/services.dart';
4 |
5 | /// Wechat Plugin for Flutter App
6 | class Wechat {
7 | static const MethodChannel _channel =
8 | const MethodChannel('wechat');
9 |
10 | /// Get platform version
11 | static Future get platformVersion async {
12 | final String version = await _channel.invokeMethod('getPlatformVersion');
13 | return version;
14 | }
15 |
16 | /// Register app to Wechat with [appid]
17 | static Future register(String appid) async {
18 | var result = await _channel.invokeMethod(
19 | 'register',
20 | {
21 | 'appid': appid
22 | }
23 | );
24 | return result;
25 | }
26 |
27 | /// Check if wechat app has was installed.
28 | static Future isWechatInstalled() async {
29 | var result = await _channel.invokeMethod(
30 | 'isWechatInstalled'
31 | );
32 | return result == 'true' ? true : false;
33 | }
34 |
35 | /// Get wechat sdk api version.
36 | static Future getApiVersion() async {
37 | var result = await _channel.invokeMethod(
38 | 'getApiVersion'
39 | );
40 | return result;
41 | }
42 |
43 | /// open wechat app.
44 | static Future openWechat() async {
45 | var result = await _channel.invokeMethod(
46 | 'openWechat'
47 | );
48 | return result;
49 | }
50 |
51 | /// Sharing
52 | ///
53 | /// arguments object structure
54 | ///
55 | /// ```
56 | /// {
57 | /// "kind": "text",
58 | /// "to": "session",
59 | /// "title": "the title of message",
60 | /// "description": "short description of message.",
61 | /// "coverUrl": "https://example.com/path/to/cover/image.jpg",
62 | /// "resourceUrl": "https://example.com/path/to/resource.mp4"
63 | /// }
64 | /// ```
65 | ///
66 | /// when kind is `music` or `video`, the `resourceUrl` means the data url of the mucis or video
67 | static Future share(Map arguments) async {
68 | arguments['kind'] = arguments['kind'] ?? 'text';
69 | arguments['to'] = arguments['to'] ?? 'session';
70 |
71 | var result = await _channel.invokeMethod(
72 | 'share',
73 | arguments
74 | );
75 |
76 | return result;
77 | }
78 |
79 | /// Login
80 | ///
81 | /// arguments object structure:
82 | ///
83 | /// ```
84 | /// {
85 | /// "scope": "snsapi_userinfo",
86 | /// "state": "customestate"
87 | /// }
88 | /// ```
89 | static Future login(Map arguments) async {
90 | arguments['scope'] = arguments['scope'] ?? 'snsapi_userinfo';
91 |
92 | var result = await _channel.invokeMethod(
93 | 'login',
94 | arguments
95 | );
96 | return result;
97 | }
98 |
99 | /// Pay
100 | ///
101 | /// arguments object structure:
102 | ///
103 | /// ```
104 | /// {
105 | /// "partnerId": "partnerId",
106 | /// "prepayId": "prepayId",
107 | /// "package": "package",
108 | /// "nonceStr": "nonceStr",
109 | /// "timestamp": "timestamp",
110 | /// "sign": "sign"
111 | /// }
112 | /// ```
113 | static Future pay(Map arguments) async {
114 | var result = await _channel.invokeMethod(
115 | 'pay',
116 | arguments
117 | );
118 | return result;
119 | }
120 | }
121 |
--------------------------------------------------------------------------------
/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: wechat
2 | description: Wechat SDK Plugin for Flutter app.
3 | version: 0.0.5
4 | author: pantao<54778899@qq.com>
5 | homepage: https://github.com/pantao/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 | # This section identifies this Flutter project as a plugin project.
20 | # The androidPackage and pluginClass identifiers should not ordinarily
21 | # be modified. They are used by the tooling to maintain consistency when
22 | # adding or updating assets for this project.
23 | plugin:
24 | androidPackage: com.onmr.flutter.wechat
25 | pluginClass: WechatPlugin
26 |
27 | # To add assets to your plugin package, add an assets section, like this:
28 | # assets:
29 | # - images/a_dot_burr.jpeg
30 | # - images/a_dot_ham.jpeg
31 | #
32 | # For details regarding assets in packages, see
33 | # https://flutter.io/assets-and-images/#from-packages
34 | #
35 | # An image asset can refer to one or more resolution-specific "variants", see
36 | # https://flutter.io/assets-and-images/#resolution-aware.
37 |
38 | # To add custom fonts to your plugin package, add a fonts section here,
39 | # in this "flutter" section. Each entry in this list should have a
40 | # "family" key with the font family name, and a "fonts" key with a
41 | # list giving the asset and other descriptors for the font. For
42 | # example:
43 | # fonts:
44 | # - family: Schyler
45 | # fonts:
46 | # - asset: fonts/Schyler-Regular.ttf
47 | # - asset: fonts/Schyler-Italic.ttf
48 | # style: italic
49 | # - family: Trajan Pro
50 | # fonts:
51 | # - asset: fonts/TrajanPro.ttf
52 | # - asset: fonts/TrajanPro_Bold.ttf
53 | # weight: 700
54 | #
55 | # For details regarding fonts in packages, see
56 | # https://flutter.io/custom-fonts/#from-packages
57 |
--------------------------------------------------------------------------------
/wechat.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------