├── .gitignore ├── .metadata ├── CHANGELOG.md ├── LICENSE ├── README.md ├── android ├── .gitignore ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties ├── settings.gradle └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── tech │ └── jitao │ └── aly_oss │ ├── AesHelper.java │ ├── AlyOssPlugin.java │ ├── ErrorCodes.java │ └── MethodCallHandlerImpl.java ├── example ├── .gitignore ├── .metadata ├── README.md ├── android │ ├── .gitignore │ ├── app │ │ ├── build.gradle │ │ └── src │ │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ │ ├── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ │ └── tech │ │ │ │ │ └── jitao │ │ │ │ │ └── aly_oss_example │ │ │ │ │ └── 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 │ │ │ └── profile │ │ │ └── AndroidManifest.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ └── settings.gradle ├── ios │ ├── .gitignore │ ├── Flutter │ │ ├── AppFrameworkInfo.plist │ │ ├── Debug.xcconfig │ │ └── Release.xcconfig │ ├── Podfile │ ├── Podfile.lock │ ├── Runner.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ └── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── 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.lock └── pubspec.yaml ├── ios ├── .gitignore ├── Assets │ └── .gitkeep ├── Classes │ ├── AesHelper.h │ ├── AesHelper.m │ ├── AlyOssPlugin.h │ └── AlyOssPlugin.m └── aly_oss.podspec ├── lib └── aly_oss.dart ├── pubspec.lock └── pubspec.yaml /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .dart_tool/ 3 | .idea/ 4 | 5 | .packages 6 | .pub/ 7 | 8 | build/ 9 | 10 | *.iml 11 | -------------------------------------------------------------------------------- /.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: e70236e36ce1d32067dc68eb55519ec3e14b6b01 8 | channel: beta 9 | 10 | project_type: plugin 11 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## [1.0.1] - 2020-04-13 2 | 3 | - Update license 4 | 5 | ## [1.0.0] - 2020-02-06 6 | 7 | * Initial Release 8 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright © 2019-2020 Ji Tao 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software 6 | and associated documentation files (the “Software”), to deal in the Software without 7 | restriction, including without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all copies or 12 | substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 15 | BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 16 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 17 | DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # aly_oss 2 | 3 | 阿里云 oss 服务 flutter 版插件。 4 | 5 | ## 基础使用 6 | 7 | 代码可参考 example。记得将 token server 地址、bucket 名称替换成你项目的值。 8 | -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | group 'tech.jitao.aly_oss' 2 | version '1.0' 3 | 4 | buildscript { 5 | repositories { 6 | google() 7 | jcenter() 8 | } 9 | 10 | dependencies { 11 | classpath 'com.android.tools.build:gradle:3.5.2' 12 | } 13 | } 14 | 15 | rootProject.allprojects { 16 | repositories { 17 | google() 18 | jcenter() 19 | } 20 | } 21 | 22 | apply plugin: 'com.android.library' 23 | 24 | android { 25 | compileSdkVersion 28 26 | 27 | defaultConfig { 28 | minSdkVersion 21 29 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 30 | } 31 | lintOptions { 32 | disable 'InvalidPackage' 33 | } 34 | } 35 | 36 | dependencies { 37 | implementation 'com.google.guava:guava:28.2-android' 38 | implementation 'com.aliyun.dpa:oss-android-sdk:+' 39 | } 40 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.enableR8=true 3 | android.useAndroidX=true 4 | android.enableJetifier=true 5 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Nov 12 01:19:01 CST 2019 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-5.4.1-all.zip 7 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'aly_oss' 2 | -------------------------------------------------------------------------------- /android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /android/src/main/java/tech/jitao/aly_oss/AesHelper.java: -------------------------------------------------------------------------------- 1 | package tech.jitao.aly_oss; 2 | 3 | import android.util.Base64; 4 | 5 | import java.nio.charset.StandardCharsets; 6 | import java.security.InvalidAlgorithmParameterException; 7 | import java.security.InvalidKeyException; 8 | import java.security.NoSuchAlgorithmException; 9 | 10 | import javax.crypto.BadPaddingException; 11 | import javax.crypto.Cipher; 12 | import javax.crypto.IllegalBlockSizeException; 13 | import javax.crypto.NoSuchPaddingException; 14 | import javax.crypto.spec.IvParameterSpec; 15 | import javax.crypto.spec.SecretKeySpec; 16 | 17 | public final class AesHelper { 18 | private static final String ALGORITHM = "AES"; 19 | private static final String PADDING = "AES/CBC/PKCS5Padding"; 20 | 21 | private AesHelper() { 22 | 23 | } 24 | 25 | public static String encrypt(String key, String iv, String data) { 26 | SecretKeySpec secretKeySpec = new SecretKeySpec(key.getBytes(StandardCharsets.UTF_8), ALGORITHM); 27 | IvParameterSpec ivParameterSpec = new IvParameterSpec(iv.getBytes(StandardCharsets.UTF_8)); 28 | 29 | try { 30 | Cipher cipher = Cipher.getInstance(PADDING); 31 | cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec, ivParameterSpec); 32 | return new String(Base64.encode(cipher.doFinal(data.getBytes(StandardCharsets.UTF_8)), Base64.DEFAULT)); 33 | } catch (NoSuchAlgorithmException | NoSuchPaddingException | BadPaddingException | IllegalBlockSizeException | InvalidKeyException | InvalidAlgorithmParameterException e) { 34 | return null; 35 | } 36 | } 37 | 38 | public static String decrypt(String key, String iv, String base64Data) { 39 | SecretKeySpec secretKeySpec = new SecretKeySpec(key.getBytes(StandardCharsets.UTF_8), ALGORITHM); 40 | IvParameterSpec ivParameterSpec = new IvParameterSpec(iv.getBytes(StandardCharsets.UTF_8)); 41 | 42 | try { 43 | Cipher cipher = Cipher.getInstance(PADDING); 44 | cipher.init(Cipher.DECRYPT_MODE, secretKeySpec, ivParameterSpec); 45 | 46 | return new String(cipher.doFinal(Base64.decode(base64Data, Base64.DEFAULT)), StandardCharsets.UTF_8); 47 | } catch (NoSuchAlgorithmException | NoSuchPaddingException | BadPaddingException | IllegalBlockSizeException | InvalidKeyException | InvalidAlgorithmParameterException e) { 48 | return null; 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /android/src/main/java/tech/jitao/aly_oss/AlyOssPlugin.java: -------------------------------------------------------------------------------- 1 | package tech.jitao.aly_oss; 2 | 3 | import io.flutter.plugin.common.MethodChannel; 4 | import io.flutter.plugin.common.PluginRegistry.Registrar; 5 | 6 | /** 7 | * AlyOssPlugin 8 | */ 9 | public class AlyOssPlugin { 10 | 11 | /** 12 | * Plugin registration. 13 | */ 14 | public static void registerWith(Registrar registrar) { 15 | MethodChannel channel = new MethodChannel(registrar.messenger(), "jitao.tech/aly_oss"); 16 | channel.setMethodCallHandler(new MethodCallHandlerImpl(channel, registrar)); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /android/src/main/java/tech/jitao/aly_oss/ErrorCodes.java: -------------------------------------------------------------------------------- 1 | package tech.jitao.aly_oss; 2 | 3 | public interface ErrorCodes { 4 | String CLIENT_EXCEPTION = "CLIENT_EXCEPTION"; 5 | String SERVICE_EXCEPTION = "SERVICE_EXCEPTION"; 6 | String FAILED_PRECONDITION = "FAILED_PRECONDITION"; 7 | String INTERNAL = "INTERNAL"; 8 | } 9 | -------------------------------------------------------------------------------- /android/src/main/java/tech/jitao/aly_oss/MethodCallHandlerImpl.java: -------------------------------------------------------------------------------- 1 | package tech.jitao.aly_oss; 2 | 3 | import com.alibaba.sdk.android.oss.ClientConfiguration; 4 | import com.alibaba.sdk.android.oss.ClientException; 5 | import com.alibaba.sdk.android.oss.OSS; 6 | import com.alibaba.sdk.android.oss.OSSClient; 7 | import com.alibaba.sdk.android.oss.ServiceException; 8 | import com.alibaba.sdk.android.oss.callback.OSSCompletedCallback; 9 | import com.alibaba.sdk.android.oss.callback.OSSProgressCallback; 10 | import com.alibaba.sdk.android.oss.common.OSSConstants; 11 | import com.alibaba.sdk.android.oss.common.auth.OSSCredentialProvider; 12 | import com.alibaba.sdk.android.oss.common.auth.OSSFederationCredentialProvider; 13 | import com.alibaba.sdk.android.oss.common.auth.OSSFederationToken; 14 | import com.alibaba.sdk.android.oss.common.utils.IOUtils; 15 | import com.alibaba.sdk.android.oss.model.DeleteObjectRequest; 16 | import com.alibaba.sdk.android.oss.model.PutObjectRequest; 17 | import com.alibaba.sdk.android.oss.model.PutObjectResult; 18 | import com.google.common.collect.Maps; 19 | 20 | import org.json.JSONObject; 21 | 22 | import java.io.InputStream; 23 | import java.net.HttpURLConnection; 24 | import java.net.URL; 25 | import java.util.Map; 26 | 27 | import io.flutter.Log; 28 | import io.flutter.plugin.common.MethodCall; 29 | import io.flutter.plugin.common.MethodChannel; 30 | import io.flutter.plugin.common.PluginRegistry; 31 | 32 | public class MethodCallHandlerImpl implements MethodChannel.MethodCallHandler { 33 | private final MethodChannel channel; 34 | private final PluginRegistry.Registrar registrar; 35 | private OSS oss; 36 | 37 | MethodCallHandlerImpl(MethodChannel channel, PluginRegistry.Registrar registrar) { 38 | this.channel = channel; 39 | this.registrar = registrar; 40 | } 41 | 42 | @Override 43 | public void onMethodCall(MethodCall methodCall, MethodChannel.Result result) { 44 | switch (methodCall.method) { 45 | case "init": 46 | init(methodCall, result); 47 | break; 48 | case "upload": 49 | upload(methodCall, result); 50 | break; 51 | case "exist": 52 | exist(methodCall, result); 53 | break; 54 | case "delete": 55 | delete(methodCall, result); 56 | break; 57 | default: 58 | result.notImplemented(); 59 | } 60 | } 61 | 62 | private void init(MethodCall call, MethodChannel.Result result) { 63 | final String instanceId = call.argument("instanceId"); 64 | final String requestId = call.argument("requestId"); 65 | final String stsServer = call.argument("stsServer"); 66 | final String endpoint = call.argument("endpoint"); 67 | final String aesKey = call.argument("aesKey"); 68 | final String iv = call.argument("iv"); 69 | final OSSCredentialProvider credentialProvider = new OSSFederationCredentialProvider() { 70 | @Override 71 | public OSSFederationToken getFederationToken() { 72 | try { 73 | URL url = new URL(stsServer); 74 | HttpURLConnection conn = (HttpURLConnection) url.openConnection(); 75 | InputStream input = conn.getInputStream(); 76 | String data = IOUtils.readStreamAsString(input, OSSConstants.DEFAULT_CHARSET_NAME); 77 | String jsonText = AesHelper.decrypt(aesKey, iv, data); 78 | 79 | JSONObject jsonObj = new JSONObject(jsonText); 80 | 81 | return new OSSFederationToken(jsonObj.getString("AccessKeyId"), 82 | jsonObj.getString("AccessKeySecret"), 83 | jsonObj.getString("SecurityToken"), 84 | jsonObj.getString("Expiration")); 85 | } catch (Exception e) { 86 | Log.w("OSSFederationCredentialProvider", e.getMessage()); 87 | } 88 | return null; 89 | } 90 | }; 91 | 92 | final ClientConfiguration conf = new ClientConfiguration(); 93 | conf.setConnectionTimeout(15 * 1000); // 连接超时时间,默认15秒 94 | conf.setSocketTimeout(15 * 1000); // Socket超时时间,默认15秒 95 | conf.setMaxConcurrentRequest(5); // 最大并发请求数,默认5个 96 | conf.setMaxErrorRetry(2); // 失败后最大重试次数,默认2次 97 | 98 | oss = new OSSClient(registrar.context(), endpoint, credentialProvider, conf); 99 | 100 | final Map arguments = Maps.newHashMap(); 101 | arguments.put("instanceId", instanceId); 102 | arguments.put("requestId", requestId); 103 | 104 | result.success(arguments); 105 | } 106 | 107 | private void upload(MethodCall call, MethodChannel.Result result) { 108 | if (!checkOss(result)) { 109 | return; 110 | } 111 | 112 | final String instanceId = call.argument("instanceId"); 113 | final String requestId = call.argument("requestId"); 114 | final String bucket = call.argument("bucket"); 115 | final String key = call.argument("key"); 116 | final String file = call.argument("file"); 117 | 118 | Log.i("upload", "instanceId=" + instanceId + ", bucket=" + bucket + ", key=" + key + ", file=" + file); 119 | PutObjectRequest request = new PutObjectRequest(bucket, key, file); 120 | request.setProgressCallback(new OSSProgressCallback() { 121 | @Override 122 | public void onProgress(PutObjectRequest request, long currentSize, long totalSize) { 123 | final Map arguments = Maps.newHashMap(); 124 | arguments.put("instanceId", instanceId); 125 | arguments.put("requestId", requestId); 126 | arguments.put("bucket", bucket); 127 | arguments.put("key", key); 128 | arguments.put("currentSize", String.valueOf(currentSize)); 129 | arguments.put("totalSize", String.valueOf(totalSize)); 130 | invokeMethod("onProgress", arguments); 131 | } 132 | }); 133 | 134 | oss.asyncPutObject(request, new OSSCompletedCallback() { 135 | 136 | @Override 137 | public void onSuccess(PutObjectRequest request, PutObjectResult result) { 138 | Log.d("onSuccess", "RequestId: " + result.getRequestId()); 139 | 140 | final Map arguments = Maps.newHashMap(); 141 | arguments.put("success", "true"); 142 | arguments.put("instanceId", instanceId); 143 | arguments.put("requestId", requestId); 144 | arguments.put("bucket", bucket); 145 | arguments.put("key", key); 146 | invokeMethod("onUpload", arguments); 147 | } 148 | 149 | @Override 150 | public void onFailure(PutObjectRequest request, ClientException clientException, ServiceException serviceException) { 151 | final Map arguments = Maps.newHashMap(); 152 | arguments.put("success", "false"); 153 | arguments.put("instanceId", instanceId); 154 | arguments.put("requestId", requestId); 155 | arguments.put("bucket", bucket); 156 | arguments.put("key", key); 157 | 158 | if (clientException != null) { 159 | Log.w("onFailure", "ClientException: " + clientException.getMessage()); 160 | 161 | arguments.put("message", clientException.getMessage()); 162 | } 163 | 164 | if (serviceException != null) { 165 | Log.w("onFailure", 166 | "ServiceException: ErrorCode=" + serviceException.getErrorCode() + 167 | "RequestId" + serviceException.getRequestId() + 168 | "HostId" + serviceException.getHostId() + 169 | "RawMessage" + serviceException.getRawMessage()); 170 | 171 | arguments.put("message", serviceException.getRawMessage()); 172 | } 173 | 174 | invokeMethod("onUpload", arguments); 175 | } 176 | } 177 | ); 178 | 179 | final Map map = Maps.newHashMap(); 180 | map.put("instanceId", instanceId); 181 | map.put("requestId", requestId); 182 | map.put("bucket", bucket); 183 | map.put("key", key); 184 | 185 | result.success(map); 186 | } 187 | 188 | private void exist(MethodCall call, MethodChannel.Result result) { 189 | if (!checkOss(result)) { 190 | return; 191 | } 192 | 193 | final String instanceId = call.argument("instanceId"); 194 | final String requestId = call.argument("requestId"); 195 | final String bucket = call.argument("bucket"); 196 | final String key = call.argument("key"); 197 | 198 | try { 199 | final Map map = Maps.newHashMap(); 200 | map.put("instanceId", instanceId); 201 | map.put("requestId", requestId); 202 | map.put("bucket", bucket); 203 | map.put("key", key); 204 | 205 | if (oss.doesObjectExist(bucket, key)) { 206 | map.put("exist", "true"); 207 | } else { 208 | map.put("exist", "false"); 209 | } 210 | 211 | result.success(map); 212 | } catch (ClientException e) { 213 | Log.w("doesObjectExist", "ClientException: " + e.getMessage()); 214 | 215 | result.error(ErrorCodes.CLIENT_EXCEPTION, e.getMessage(), null); 216 | } catch (ServiceException e) { 217 | Log.w("doesObjectExist", "ServiceException: " + e.getRawMessage()); 218 | 219 | result.error(ErrorCodes.SERVICE_EXCEPTION, e.getMessage(), e.getRawMessage()); 220 | } 221 | } 222 | 223 | private void delete(MethodCall call, MethodChannel.Result result) { 224 | if (!checkOss(result)) { 225 | return; 226 | } 227 | 228 | final String instanceId = call.argument("instanceId"); 229 | final String requestId = call.argument("requestId"); 230 | final String bucket = call.argument("bucket"); 231 | final String key = call.argument("key"); 232 | 233 | 234 | DeleteObjectRequest request = new DeleteObjectRequest(bucket, key); 235 | 236 | try { 237 | oss.deleteObject(request); 238 | final Map map = Maps.newHashMap(); 239 | map.put("instanceId", instanceId); 240 | map.put("requestId", requestId); 241 | map.put("bucket", bucket); 242 | map.put("key", key); 243 | 244 | result.success(map); 245 | } catch (ClientException e) { 246 | Log.w("deleteObject", "ClientException: " + e.getMessage()); 247 | 248 | result.error(ErrorCodes.CLIENT_EXCEPTION, e.getMessage(), null); 249 | } catch (ServiceException e) { 250 | Log.w("deleteObject", "ServiceException: " + e.getRawMessage()); 251 | 252 | result.error(ErrorCodes.SERVICE_EXCEPTION, e.getMessage(), e.getRawMessage()); 253 | } 254 | } 255 | 256 | private void invokeMethod(final String method, final Object arguments) { 257 | registrar.activity().runOnUiThread( 258 | new Runnable() { 259 | @Override 260 | public void run() { 261 | channel.invokeMethod(method, arguments); 262 | } 263 | }); 264 | } 265 | 266 | private boolean checkOss(MethodChannel.Result result) { 267 | if (oss == null) { 268 | result.error(ErrorCodes.FAILED_PRECONDITION, "not initialized", "call init first"); 269 | 270 | return false; 271 | } 272 | 273 | return true; 274 | } 275 | } 276 | -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | .dart_tool/ 26 | .flutter-plugins* 27 | .packages 28 | .pub-cache/ 29 | .pub/ 30 | /build/ 31 | 32 | # Web related 33 | lib/generated_plugin_registrant.dart 34 | 35 | # Exceptions to above rules. 36 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 37 | -------------------------------------------------------------------------------- /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: e70236e36ce1d32067dc68eb55519ec3e14b6b01 8 | channel: beta 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # aly_oss_example 2 | 3 | Demonstrates how to use the aly_oss 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.dev/docs/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) 13 | 14 | For help getting started with Flutter, view our 15 | [online documentation](https://flutter.dev/docs), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | -------------------------------------------------------------------------------- /example/android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | -------------------------------------------------------------------------------- /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 28 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 "tech.jitao.aly_oss_example" 37 | minSdkVersion 21 38 | targetSdkVersion 28 39 | versionCode flutterVersionCode.toInteger() 40 | versionName flutterVersionName 41 | testInstrumentationRunner "androidx.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 'androidx.test:runner:1.1.1' 60 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' 61 | } 62 | -------------------------------------------------------------------------------- /example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 9 | 14 | 21 | 25 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /example/android/app/src/main/java/tech/jitao/aly_oss_example/MainActivity.java: -------------------------------------------------------------------------------- 1 | package tech.jitao.aly_oss_example; 2 | 3 | import android.os.Bundle; 4 | 5 | import io.flutter.app.FlutterActivity; 6 | import io.flutter.plugins.GeneratedPluginRegistrant; 7 | 8 | public class MainActivity extends FlutterActivity { 9 | @Override 10 | protected void onCreate(Bundle savedInstanceState) { 11 | super.onCreate(savedInstanceState); 12 | GeneratedPluginRegistrant.registerWith(this); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /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/flmn/aly_oss/8bdb8f62dce905767a64ad3942f4a793992e205a/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/flmn/aly_oss/8bdb8f62dce905767a64ad3942f4a793992e205a/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/flmn/aly_oss/8bdb8f62dce905767a64ad3942f4a793992e205a/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/flmn/aly_oss/8bdb8f62dce905767a64ad3942f4a793992e205a/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/flmn/aly_oss/8bdb8f62dce905767a64ad3942f4a793992e205a/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/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | google() 4 | jcenter() 5 | } 6 | 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:3.5.2' 9 | } 10 | } 11 | 12 | allprojects { 13 | repositories { 14 | google() 15 | jcenter() 16 | } 17 | } 18 | 19 | rootProject.buildDir = '../build' 20 | subprojects { 21 | project.buildDir = "${rootProject.buildDir}/${project.name}" 22 | } 23 | subprojects { 24 | project.evaluationDependsOn(':app') 25 | } 26 | 27 | task clean(type: Delete) { 28 | delete rootProject.buildDir 29 | } 30 | -------------------------------------------------------------------------------- /example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.enableR8=true 3 | android.useAndroidX=true 4 | android.enableJetifier=true 5 | -------------------------------------------------------------------------------- /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-5.6.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/.gitignore: -------------------------------------------------------------------------------- 1 | *.mode1v3 2 | *.mode2v3 3 | *.moved-aside 4 | *.pbxuser 5 | *.perspectivev3 6 | **/*sync/ 7 | .sconsign.dblite 8 | .tags* 9 | **/.vagrant/ 10 | **/DerivedData/ 11 | Icon? 12 | **/Pods/ 13 | **/.symlinks/ 14 | profile 15 | xcuserdata 16 | **/.generated/ 17 | Flutter/App.framework 18 | Flutter/Flutter.framework 19 | Flutter/Generated.xcconfig 20 | Flutter/app.flx 21 | Flutter/app.zip 22 | Flutter/flutter_assets/ 23 | Flutter/flutter_export_environment.sh 24 | ServiceDefinitions.json 25 | Runner/GeneratedPluginRegistrant.* 26 | 27 | # Exceptions to above rules. 28 | !default.mode1v3 29 | !default.mode2v3 30 | !default.pbxuser 31 | !default.perspectivev3 32 | -------------------------------------------------------------------------------- /example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 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 pub 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 | # Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system. 64 | install! 'cocoapods', :disable_input_output_paths => true 65 | 66 | post_install do |installer| 67 | installer.pods_project.targets.each do |target| 68 | target.build_configurations.each do |config| 69 | config.build_settings['ENABLE_BITCODE'] = 'NO' 70 | end 71 | end 72 | end 73 | -------------------------------------------------------------------------------- /example/ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - AliyunOSSiOS (2.10.7) 3 | - aly_oss (0.0.1): 4 | - AliyunOSSiOS 5 | - Flutter 6 | - Flutter (1.0.0) 7 | - image_picker (0.0.1): 8 | - Flutter 9 | 10 | DEPENDENCIES: 11 | - aly_oss (from `.symlinks/plugins/aly_oss/ios`) 12 | - Flutter (from `.symlinks/flutter/ios`) 13 | - image_picker (from `.symlinks/plugins/image_picker/ios`) 14 | 15 | SPEC REPOS: 16 | trunk: 17 | - AliyunOSSiOS 18 | 19 | EXTERNAL SOURCES: 20 | aly_oss: 21 | :path: ".symlinks/plugins/aly_oss/ios" 22 | Flutter: 23 | :path: ".symlinks/flutter/ios" 24 | image_picker: 25 | :path: ".symlinks/plugins/image_picker/ios" 26 | 27 | SPEC CHECKSUMS: 28 | AliyunOSSiOS: 602b6a4e70e62a5f0a6431c20496343141d7e66f 29 | aly_oss: 878031b14b33342a544187e9efd56884fefb231b 30 | Flutter: 0e3d915762c693b495b44d77113d4970485de6ec 31 | image_picker: e3eacd46b94694dde7cf2705955cece853aa1a8f 32 | 33 | PODFILE CHECKSUM: 7fb83752f59ead6285236625b82473f90b1cb932 34 | 35 | COCOAPODS: 1.8.4 36 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 11 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 12 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; 13 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 14 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; 15 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 16 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; 17 | 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; 18 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 19 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 20 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 21 | A7DC28E607787D95A7EE0C12 /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8E078DE96781D193FF28EED6 /* libPods-Runner.a */; }; 22 | /* End PBXBuildFile section */ 23 | 24 | /* Begin PBXCopyFilesBuildPhase section */ 25 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 26 | isa = PBXCopyFilesBuildPhase; 27 | buildActionMask = 2147483647; 28 | dstPath = ""; 29 | dstSubfolderSpec = 10; 30 | files = ( 31 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, 32 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, 33 | ); 34 | name = "Embed Frameworks"; 35 | runOnlyForDeploymentPostprocessing = 0; 36 | }; 37 | /* End PBXCopyFilesBuildPhase section */ 38 | 39 | /* Begin PBXFileReference section */ 40 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 41 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 42 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 43 | 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; 44 | 6DAAA27C7A6B54CC967492F9 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 45 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 46 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 47 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 48 | 8E078DE96781D193FF28EED6 /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 49 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 50 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 51 | 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; 52 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 53 | 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 54 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 55 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 56 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 57 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 58 | CBBF1E8CE82C3A9074E15361 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 59 | FBED578D9448C36D32AF4E28 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; 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 | A7DC28E607787D95A7EE0C12 /* libPods-Runner.a in Frameworks */, 70 | ); 71 | runOnlyForDeploymentPostprocessing = 0; 72 | }; 73 | /* End PBXFrameworksBuildPhase section */ 74 | 75 | /* Begin PBXGroup section */ 76 | 465CF8F29FEE8595AEE24C30 /* Frameworks */ = { 77 | isa = PBXGroup; 78 | children = ( 79 | 8E078DE96781D193FF28EED6 /* libPods-Runner.a */, 80 | ); 81 | name = Frameworks; 82 | sourceTree = ""; 83 | }; 84 | 9740EEB11CF90186004384FC /* Flutter */ = { 85 | isa = PBXGroup; 86 | children = ( 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 | BE95AB812FE9EEE7F4C64879 /* Pods */, 104 | 465CF8F29FEE8595AEE24C30 /* 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 | BE95AB812FE9EEE7F4C64879 /* Pods */ = { 141 | isa = PBXGroup; 142 | children = ( 143 | 6DAAA27C7A6B54CC967492F9 /* Pods-Runner.debug.xcconfig */, 144 | CBBF1E8CE82C3A9074E15361 /* Pods-Runner.release.xcconfig */, 145 | FBED578D9448C36D32AF4E28 /* Pods-Runner.profile.xcconfig */, 146 | ); 147 | path = Pods; 148 | sourceTree = ""; 149 | }; 150 | /* End PBXGroup section */ 151 | 152 | /* Begin PBXNativeTarget section */ 153 | 97C146ED1CF9000F007C117D /* Runner */ = { 154 | isa = PBXNativeTarget; 155 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 156 | buildPhases = ( 157 | A472BE2194EB3972847DAC2A /* [CP] Check Pods Manifest.lock */, 158 | 9740EEB61CF901F6004384FC /* Run Script */, 159 | 97C146EA1CF9000F007C117D /* Sources */, 160 | 97C146EB1CF9000F007C117D /* Frameworks */, 161 | 97C146EC1CF9000F007C117D /* Resources */, 162 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 163 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 164 | 38AC04C254281F43FDDE8673 /* [CP] Embed Pods Frameworks */, 165 | ); 166 | buildRules = ( 167 | ); 168 | dependencies = ( 169 | ); 170 | name = Runner; 171 | productName = Runner; 172 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 173 | productType = "com.apple.product-type.application"; 174 | }; 175 | /* End PBXNativeTarget section */ 176 | 177 | /* Begin PBXProject section */ 178 | 97C146E61CF9000F007C117D /* Project object */ = { 179 | isa = PBXProject; 180 | attributes = { 181 | LastUpgradeCheck = 1020; 182 | ORGANIZATIONNAME = "The Chromium Authors"; 183 | TargetAttributes = { 184 | 97C146ED1CF9000F007C117D = { 185 | CreatedOnToolsVersion = 7.3.1; 186 | DevelopmentTeam = 5F3NP76F26; 187 | }; 188 | }; 189 | }; 190 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 191 | compatibilityVersion = "Xcode 3.2"; 192 | developmentRegion = en; 193 | hasScannedForEncodings = 0; 194 | knownRegions = ( 195 | en, 196 | Base, 197 | ); 198 | mainGroup = 97C146E51CF9000F007C117D; 199 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 200 | projectDirPath = ""; 201 | projectRoot = ""; 202 | targets = ( 203 | 97C146ED1CF9000F007C117D /* Runner */, 204 | ); 205 | }; 206 | /* End PBXProject section */ 207 | 208 | /* Begin PBXResourcesBuildPhase section */ 209 | 97C146EC1CF9000F007C117D /* Resources */ = { 210 | isa = PBXResourcesBuildPhase; 211 | buildActionMask = 2147483647; 212 | files = ( 213 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 214 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 215 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 216 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 217 | ); 218 | runOnlyForDeploymentPostprocessing = 0; 219 | }; 220 | /* End PBXResourcesBuildPhase section */ 221 | 222 | /* Begin PBXShellScriptBuildPhase section */ 223 | 38AC04C254281F43FDDE8673 /* [CP] Embed Pods Frameworks */ = { 224 | isa = PBXShellScriptBuildPhase; 225 | buildActionMask = 2147483647; 226 | files = ( 227 | ); 228 | inputPaths = ( 229 | ); 230 | name = "[CP] Embed Pods Frameworks"; 231 | outputPaths = ( 232 | ); 233 | runOnlyForDeploymentPostprocessing = 0; 234 | shellPath = /bin/sh; 235 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; 236 | showEnvVarsInLog = 0; 237 | }; 238 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 239 | isa = PBXShellScriptBuildPhase; 240 | buildActionMask = 2147483647; 241 | files = ( 242 | ); 243 | inputPaths = ( 244 | ); 245 | name = "Thin Binary"; 246 | outputPaths = ( 247 | ); 248 | runOnlyForDeploymentPostprocessing = 0; 249 | shellPath = /bin/sh; 250 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; 251 | }; 252 | 9740EEB61CF901F6004384FC /* Run Script */ = { 253 | isa = PBXShellScriptBuildPhase; 254 | buildActionMask = 2147483647; 255 | files = ( 256 | ); 257 | inputPaths = ( 258 | ); 259 | name = "Run Script"; 260 | outputPaths = ( 261 | ); 262 | runOnlyForDeploymentPostprocessing = 0; 263 | shellPath = /bin/sh; 264 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 265 | }; 266 | A472BE2194EB3972847DAC2A /* [CP] Check Pods Manifest.lock */ = { 267 | isa = PBXShellScriptBuildPhase; 268 | buildActionMask = 2147483647; 269 | files = ( 270 | ); 271 | inputFileListPaths = ( 272 | ); 273 | inputPaths = ( 274 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 275 | "${PODS_ROOT}/Manifest.lock", 276 | ); 277 | name = "[CP] Check Pods Manifest.lock"; 278 | outputFileListPaths = ( 279 | ); 280 | outputPaths = ( 281 | "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", 282 | ); 283 | runOnlyForDeploymentPostprocessing = 0; 284 | shellPath = /bin/sh; 285 | 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"; 286 | showEnvVarsInLog = 0; 287 | }; 288 | /* End PBXShellScriptBuildPhase section */ 289 | 290 | /* Begin PBXSourcesBuildPhase section */ 291 | 97C146EA1CF9000F007C117D /* Sources */ = { 292 | isa = PBXSourcesBuildPhase; 293 | buildActionMask = 2147483647; 294 | files = ( 295 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */, 296 | 97C146F31CF9000F007C117D /* main.m in Sources */, 297 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 298 | ); 299 | runOnlyForDeploymentPostprocessing = 0; 300 | }; 301 | /* End PBXSourcesBuildPhase section */ 302 | 303 | /* Begin PBXVariantGroup section */ 304 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 305 | isa = PBXVariantGroup; 306 | children = ( 307 | 97C146FB1CF9000F007C117D /* Base */, 308 | ); 309 | name = Main.storyboard; 310 | sourceTree = ""; 311 | }; 312 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 313 | isa = PBXVariantGroup; 314 | children = ( 315 | 97C147001CF9000F007C117D /* Base */, 316 | ); 317 | name = LaunchScreen.storyboard; 318 | sourceTree = ""; 319 | }; 320 | /* End PBXVariantGroup section */ 321 | 322 | /* Begin XCBuildConfiguration section */ 323 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 324 | isa = XCBuildConfiguration; 325 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 326 | buildSettings = { 327 | ALWAYS_SEARCH_USER_PATHS = NO; 328 | CLANG_ANALYZER_NONNULL = YES; 329 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 330 | CLANG_CXX_LIBRARY = "libc++"; 331 | CLANG_ENABLE_MODULES = YES; 332 | CLANG_ENABLE_OBJC_ARC = YES; 333 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 334 | CLANG_WARN_BOOL_CONVERSION = YES; 335 | CLANG_WARN_COMMA = YES; 336 | CLANG_WARN_CONSTANT_CONVERSION = YES; 337 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 338 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 339 | CLANG_WARN_EMPTY_BODY = YES; 340 | CLANG_WARN_ENUM_CONVERSION = YES; 341 | CLANG_WARN_INFINITE_RECURSION = YES; 342 | CLANG_WARN_INT_CONVERSION = YES; 343 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 344 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 345 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 346 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 347 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 348 | CLANG_WARN_STRICT_PROTOTYPES = YES; 349 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 350 | CLANG_WARN_UNREACHABLE_CODE = YES; 351 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 352 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 353 | COPY_PHASE_STRIP = NO; 354 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 355 | ENABLE_NS_ASSERTIONS = NO; 356 | ENABLE_STRICT_OBJC_MSGSEND = YES; 357 | GCC_C_LANGUAGE_STANDARD = gnu99; 358 | GCC_NO_COMMON_BLOCKS = YES; 359 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 360 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 361 | GCC_WARN_UNDECLARED_SELECTOR = YES; 362 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 363 | GCC_WARN_UNUSED_FUNCTION = YES; 364 | GCC_WARN_UNUSED_VARIABLE = YES; 365 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 366 | MTL_ENABLE_DEBUG_INFO = NO; 367 | SDKROOT = iphoneos; 368 | SUPPORTED_PLATFORMS = iphoneos; 369 | TARGETED_DEVICE_FAMILY = "1,2"; 370 | VALIDATE_PRODUCT = YES; 371 | }; 372 | name = Profile; 373 | }; 374 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 375 | isa = XCBuildConfiguration; 376 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 377 | buildSettings = { 378 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 379 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 380 | DEVELOPMENT_TEAM = 5F3NP76F26; 381 | ENABLE_BITCODE = NO; 382 | FRAMEWORK_SEARCH_PATHS = ( 383 | "$(inherited)", 384 | "$(PROJECT_DIR)/Flutter", 385 | ); 386 | INFOPLIST_FILE = Runner/Info.plist; 387 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 388 | LIBRARY_SEARCH_PATHS = ( 389 | "$(inherited)", 390 | "$(PROJECT_DIR)/Flutter", 391 | ); 392 | PRODUCT_BUNDLE_IDENTIFIER = tech.jitao.alyOssExample; 393 | PRODUCT_NAME = "$(TARGET_NAME)"; 394 | VERSIONING_SYSTEM = "apple-generic"; 395 | }; 396 | name = Profile; 397 | }; 398 | 97C147031CF9000F007C117D /* Debug */ = { 399 | isa = XCBuildConfiguration; 400 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 401 | buildSettings = { 402 | ALWAYS_SEARCH_USER_PATHS = NO; 403 | CLANG_ANALYZER_NONNULL = YES; 404 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 405 | CLANG_CXX_LIBRARY = "libc++"; 406 | CLANG_ENABLE_MODULES = YES; 407 | CLANG_ENABLE_OBJC_ARC = YES; 408 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 409 | CLANG_WARN_BOOL_CONVERSION = YES; 410 | CLANG_WARN_COMMA = YES; 411 | CLANG_WARN_CONSTANT_CONVERSION = YES; 412 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 413 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 414 | CLANG_WARN_EMPTY_BODY = YES; 415 | CLANG_WARN_ENUM_CONVERSION = YES; 416 | CLANG_WARN_INFINITE_RECURSION = YES; 417 | CLANG_WARN_INT_CONVERSION = YES; 418 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 419 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 420 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 421 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 422 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 423 | CLANG_WARN_STRICT_PROTOTYPES = YES; 424 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 425 | CLANG_WARN_UNREACHABLE_CODE = YES; 426 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 427 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 428 | COPY_PHASE_STRIP = NO; 429 | DEBUG_INFORMATION_FORMAT = dwarf; 430 | ENABLE_STRICT_OBJC_MSGSEND = YES; 431 | ENABLE_TESTABILITY = YES; 432 | GCC_C_LANGUAGE_STANDARD = gnu99; 433 | GCC_DYNAMIC_NO_PIC = NO; 434 | GCC_NO_COMMON_BLOCKS = YES; 435 | GCC_OPTIMIZATION_LEVEL = 0; 436 | GCC_PREPROCESSOR_DEFINITIONS = ( 437 | "DEBUG=1", 438 | "$(inherited)", 439 | ); 440 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 441 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 442 | GCC_WARN_UNDECLARED_SELECTOR = YES; 443 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 444 | GCC_WARN_UNUSED_FUNCTION = YES; 445 | GCC_WARN_UNUSED_VARIABLE = YES; 446 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 447 | MTL_ENABLE_DEBUG_INFO = YES; 448 | ONLY_ACTIVE_ARCH = YES; 449 | SDKROOT = iphoneos; 450 | TARGETED_DEVICE_FAMILY = "1,2"; 451 | }; 452 | name = Debug; 453 | }; 454 | 97C147041CF9000F007C117D /* Release */ = { 455 | isa = XCBuildConfiguration; 456 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 457 | buildSettings = { 458 | ALWAYS_SEARCH_USER_PATHS = NO; 459 | CLANG_ANALYZER_NONNULL = YES; 460 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 461 | CLANG_CXX_LIBRARY = "libc++"; 462 | CLANG_ENABLE_MODULES = YES; 463 | CLANG_ENABLE_OBJC_ARC = YES; 464 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 465 | CLANG_WARN_BOOL_CONVERSION = YES; 466 | CLANG_WARN_COMMA = YES; 467 | CLANG_WARN_CONSTANT_CONVERSION = YES; 468 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 469 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 470 | CLANG_WARN_EMPTY_BODY = YES; 471 | CLANG_WARN_ENUM_CONVERSION = YES; 472 | CLANG_WARN_INFINITE_RECURSION = YES; 473 | CLANG_WARN_INT_CONVERSION = YES; 474 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 475 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 476 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 477 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 478 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 479 | CLANG_WARN_STRICT_PROTOTYPES = YES; 480 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 481 | CLANG_WARN_UNREACHABLE_CODE = YES; 482 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 483 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 484 | COPY_PHASE_STRIP = NO; 485 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 486 | ENABLE_NS_ASSERTIONS = NO; 487 | ENABLE_STRICT_OBJC_MSGSEND = YES; 488 | GCC_C_LANGUAGE_STANDARD = gnu99; 489 | GCC_NO_COMMON_BLOCKS = YES; 490 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 491 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 492 | GCC_WARN_UNDECLARED_SELECTOR = YES; 493 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 494 | GCC_WARN_UNUSED_FUNCTION = YES; 495 | GCC_WARN_UNUSED_VARIABLE = YES; 496 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 497 | MTL_ENABLE_DEBUG_INFO = NO; 498 | SDKROOT = iphoneos; 499 | SUPPORTED_PLATFORMS = iphoneos; 500 | TARGETED_DEVICE_FAMILY = "1,2"; 501 | VALIDATE_PRODUCT = YES; 502 | }; 503 | name = Release; 504 | }; 505 | 97C147061CF9000F007C117D /* Debug */ = { 506 | isa = XCBuildConfiguration; 507 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 508 | buildSettings = { 509 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 510 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 511 | DEVELOPMENT_TEAM = 5F3NP76F26; 512 | ENABLE_BITCODE = NO; 513 | FRAMEWORK_SEARCH_PATHS = ( 514 | "$(inherited)", 515 | "$(PROJECT_DIR)/Flutter", 516 | ); 517 | INFOPLIST_FILE = Runner/Info.plist; 518 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 519 | LIBRARY_SEARCH_PATHS = ( 520 | "$(inherited)", 521 | "$(PROJECT_DIR)/Flutter", 522 | ); 523 | PRODUCT_BUNDLE_IDENTIFIER = tech.jitao.alyOssExample; 524 | PRODUCT_NAME = "$(TARGET_NAME)"; 525 | VERSIONING_SYSTEM = "apple-generic"; 526 | }; 527 | name = Debug; 528 | }; 529 | 97C147071CF9000F007C117D /* Release */ = { 530 | isa = XCBuildConfiguration; 531 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 532 | buildSettings = { 533 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 534 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 535 | DEVELOPMENT_TEAM = 5F3NP76F26; 536 | ENABLE_BITCODE = NO; 537 | FRAMEWORK_SEARCH_PATHS = ( 538 | "$(inherited)", 539 | "$(PROJECT_DIR)/Flutter", 540 | ); 541 | INFOPLIST_FILE = Runner/Info.plist; 542 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 543 | LIBRARY_SEARCH_PATHS = ( 544 | "$(inherited)", 545 | "$(PROJECT_DIR)/Flutter", 546 | ); 547 | PRODUCT_BUNDLE_IDENTIFIER = tech.jitao.alyOssExample; 548 | PRODUCT_NAME = "$(TARGET_NAME)"; 549 | VERSIONING_SYSTEM = "apple-generic"; 550 | }; 551 | name = Release; 552 | }; 553 | /* End XCBuildConfiguration section */ 554 | 555 | /* Begin XCConfigurationList section */ 556 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 557 | isa = XCConfigurationList; 558 | buildConfigurations = ( 559 | 97C147031CF9000F007C117D /* Debug */, 560 | 97C147041CF9000F007C117D /* Release */, 561 | 249021D3217E4FDB00AE95B9 /* Profile */, 562 | ); 563 | defaultConfigurationIsVisible = 0; 564 | defaultConfigurationName = Release; 565 | }; 566 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 567 | isa = XCConfigurationList; 568 | buildConfigurations = ( 569 | 97C147061CF9000F007C117D /* Debug */, 570 | 97C147071CF9000F007C117D /* Release */, 571 | 249021D4217E4FDB00AE95B9 /* Profile */, 572 | ); 573 | defaultConfigurationIsVisible = 0; 574 | defaultConfigurationName = Release; 575 | }; 576 | /* End XCConfigurationList section */ 577 | }; 578 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 579 | } 580 | -------------------------------------------------------------------------------- /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 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /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/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/flmn/aly_oss/8bdb8f62dce905767a64ad3942f4a793992e205a/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/flmn/aly_oss/8bdb8f62dce905767a64ad3942f4a793992e205a/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/flmn/aly_oss/8bdb8f62dce905767a64ad3942f4a793992e205a/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/flmn/aly_oss/8bdb8f62dce905767a64ad3942f4a793992e205a/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/flmn/aly_oss/8bdb8f62dce905767a64ad3942f4a793992e205a/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/flmn/aly_oss/8bdb8f62dce905767a64ad3942f4a793992e205a/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/flmn/aly_oss/8bdb8f62dce905767a64ad3942f4a793992e205a/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/flmn/aly_oss/8bdb8f62dce905767a64ad3942f4a793992e205a/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/flmn/aly_oss/8bdb8f62dce905767a64ad3942f4a793992e205a/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/flmn/aly_oss/8bdb8f62dce905767a64ad3942f4a793992e205a/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/flmn/aly_oss/8bdb8f62dce905767a64ad3942f4a793992e205a/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/flmn/aly_oss/8bdb8f62dce905767a64ad3942f4a793992e205a/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/flmn/aly_oss/8bdb8f62dce905767a64ad3942f4a793992e205a/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/flmn/aly_oss/8bdb8f62dce905767a64ad3942f4a793992e205a/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/flmn/aly_oss/8bdb8f62dce905767a64ad3942f4a793992e205a/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/flmn/aly_oss/8bdb8f62dce905767a64ad3942f4a793992e205a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flmn/aly_oss/8bdb8f62dce905767a64ad3942f4a793992e205a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flmn/aly_oss/8bdb8f62dce905767a64ad3942f4a793992e205a/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 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | aly_oss_example 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(FLUTTER_BUILD_NAME) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UIViewControllerBasedStatusBarAppearance 43 | 44 | NSPhotoLibraryUsageDescription 45 | 访问相册 46 | NSCameraUsageDescription 47 | 访问相机 48 | NSMicrophoneUsageDescription 49 | 访问麦克风 50 | 51 | 52 | -------------------------------------------------------------------------------- /example/ios/Runner/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import "AppDelegate.h" 4 | 5 | int main(int argc, char* argv[]) { 6 | @autoreleasepool { 7 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:aly_oss/aly_oss.dart'; 4 | import 'package:flutter/material.dart'; 5 | import 'package:image_picker/image_picker.dart'; 6 | import 'package:uuid/uuid.dart'; 7 | 8 | const bucketName = ''; 9 | 10 | void main() => runApp(App()); 11 | 12 | class App extends StatelessWidget { 13 | @override 14 | Widget build(BuildContext context) { 15 | return MaterialApp( 16 | home: Main(), 17 | ); 18 | } 19 | } 20 | 21 | class Main extends StatefulWidget { 22 | @override 23 | _MainState createState() => _MainState(); 24 | } 25 | 26 | class _MainState extends State
{ 27 | final _uuid = Uuid(); 28 | final AlyOss _alyOss = AlyOss(); 29 | StreamSubscription subscription; 30 | 31 | @override 32 | void initState() { 33 | super.initState(); 34 | 35 | subscription = _alyOss.onUpload.listen((data) { 36 | print(data.toString()); 37 | if (data.success) { 38 | } else {} 39 | }); 40 | } 41 | 42 | @override 43 | void dispose() { 44 | if (subscription != null) { 45 | subscription.cancel(); 46 | } 47 | 48 | super.dispose(); 49 | } 50 | 51 | @override 52 | Widget build(BuildContext context) { 53 | return MaterialApp( 54 | home: Scaffold( 55 | appBar: AppBar( 56 | title: const Text('Aly Oss Plugin example app'), 57 | ), 58 | body: Center( 59 | child: Column( 60 | mainAxisSize: MainAxisSize.min, 61 | children: [ 62 | RaisedButton( 63 | color: Theme.of(context).primaryColor, 64 | textColor: Colors.white, 65 | child: Text('INIT'), 66 | onPressed: () async { 67 | var result = await _alyOss 68 | .init(InitRequest(_uuid.v4(), 'https:///get-security-token', 'oss-cn-beijing.aliyuncs.com', '', '')); 69 | 70 | showDialog( 71 | context: context, 72 | builder: (BuildContext context) { 73 | return AlertDialog( 74 | title: Text("INIT"), 75 | content: Text(result['instanceId']), 76 | actions: [ 77 | FlatButton( 78 | child: Text("OK"), 79 | onPressed: () { 80 | Navigator.of(context).pop(); 81 | }, 82 | ) 83 | ], 84 | ); 85 | }, 86 | ); 87 | }, 88 | ), 89 | RaisedButton( 90 | color: Theme.of(context).primaryColor, 91 | textColor: Colors.white, 92 | child: Text('UPLOAD'), 93 | onPressed: () async { 94 | var image = await ImagePicker.pickImage(source: ImageSource.gallery); 95 | 96 | _alyOss.upload(UploadRequest(_uuid.v4(), bucketName, 'flutter/a.jpg', image.absolute.path)); 97 | }, 98 | ), 99 | RaisedButton( 100 | color: Theme.of(context).primaryColor, 101 | textColor: Colors.white, 102 | child: Text('EXIST'), 103 | onPressed: () async { 104 | var result = await _alyOss.exist(KeyRequest(_uuid.v4(), bucketName, 'flutter/a.jpg')); 105 | 106 | showDialog( 107 | context: context, 108 | builder: (BuildContext context) { 109 | return AlertDialog( 110 | title: Text("EXIST"), 111 | content: Text(result['exist']), 112 | actions: [ 113 | FlatButton( 114 | child: Text("OK"), 115 | onPressed: () { 116 | Navigator.of(context).pop(); 117 | }, 118 | ) 119 | ], 120 | ); 121 | }, 122 | ); 123 | }, 124 | ), 125 | RaisedButton( 126 | color: Theme.of(context).primaryColor, 127 | textColor: Colors.white, 128 | child: Text('DELETE'), 129 | onPressed: () async { 130 | var result = await _alyOss.delete(KeyRequest(_uuid.v4(), bucketName, 'flutter/a.jpg')); 131 | 132 | showDialog( 133 | context: context, 134 | builder: (BuildContext context) { 135 | return AlertDialog( 136 | title: Text("DELETE"), 137 | content: Text('OK'), 138 | actions: [ 139 | FlatButton( 140 | child: Text("OK"), 141 | onPressed: () { 142 | Navigator.of(context).pop(); 143 | }, 144 | ) 145 | ], 146 | ); 147 | }, 148 | ); 149 | }, 150 | ), 151 | SizedBox( 152 | height: 180, 153 | ), 154 | ], 155 | ), 156 | ), 157 | ), 158 | ); 159 | } 160 | } 161 | -------------------------------------------------------------------------------- /example/pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | aly_oss: 5 | dependency: "direct dev" 6 | description: 7 | path: ".." 8 | relative: true 9 | source: path 10 | version: "1.0.1" 11 | archive: 12 | dependency: transitive 13 | description: 14 | name: archive 15 | url: "https://pub.flutter-io.cn" 16 | source: hosted 17 | version: "2.0.11" 18 | args: 19 | dependency: transitive 20 | description: 21 | name: args 22 | url: "https://pub.flutter-io.cn" 23 | source: hosted 24 | version: "1.5.2" 25 | async: 26 | dependency: transitive 27 | description: 28 | name: async 29 | url: "https://pub.flutter-io.cn" 30 | source: hosted 31 | version: "2.4.0" 32 | boolean_selector: 33 | dependency: transitive 34 | description: 35 | name: boolean_selector 36 | url: "https://pub.flutter-io.cn" 37 | source: hosted 38 | version: "1.0.5" 39 | charcode: 40 | dependency: transitive 41 | description: 42 | name: charcode 43 | url: "https://pub.flutter-io.cn" 44 | source: hosted 45 | version: "1.1.2" 46 | collection: 47 | dependency: transitive 48 | description: 49 | name: collection 50 | url: "https://pub.flutter-io.cn" 51 | source: hosted 52 | version: "1.14.11" 53 | convert: 54 | dependency: transitive 55 | description: 56 | name: convert 57 | url: "https://pub.flutter-io.cn" 58 | source: hosted 59 | version: "2.1.1" 60 | crypto: 61 | dependency: transitive 62 | description: 63 | name: crypto 64 | url: "https://pub.flutter-io.cn" 65 | source: hosted 66 | version: "2.1.3" 67 | flutter: 68 | dependency: "direct main" 69 | description: flutter 70 | source: sdk 71 | version: "0.0.0" 72 | flutter_plugin_android_lifecycle: 73 | dependency: transitive 74 | description: 75 | name: flutter_plugin_android_lifecycle 76 | url: "https://pub.flutter-io.cn" 77 | source: hosted 78 | version: "1.0.5" 79 | flutter_test: 80 | dependency: "direct dev" 81 | description: flutter 82 | source: sdk 83 | version: "0.0.0" 84 | image: 85 | dependency: transitive 86 | description: 87 | name: image 88 | url: "https://pub.flutter-io.cn" 89 | source: hosted 90 | version: "2.1.4" 91 | image_picker: 92 | dependency: "direct main" 93 | description: 94 | name: image_picker 95 | url: "https://pub.flutter-io.cn" 96 | source: hosted 97 | version: "0.6.5" 98 | matcher: 99 | dependency: transitive 100 | description: 101 | name: matcher 102 | url: "https://pub.flutter-io.cn" 103 | source: hosted 104 | version: "0.12.6" 105 | meta: 106 | dependency: transitive 107 | description: 108 | name: meta 109 | url: "https://pub.flutter-io.cn" 110 | source: hosted 111 | version: "1.1.8" 112 | path: 113 | dependency: transitive 114 | description: 115 | name: path 116 | url: "https://pub.flutter-io.cn" 117 | source: hosted 118 | version: "1.6.4" 119 | pedantic: 120 | dependency: transitive 121 | description: 122 | name: pedantic 123 | url: "https://pub.flutter-io.cn" 124 | source: hosted 125 | version: "1.8.0+1" 126 | petitparser: 127 | dependency: transitive 128 | description: 129 | name: petitparser 130 | url: "https://pub.flutter-io.cn" 131 | source: hosted 132 | version: "2.4.0" 133 | quiver: 134 | dependency: transitive 135 | description: 136 | name: quiver 137 | url: "https://pub.flutter-io.cn" 138 | source: hosted 139 | version: "2.0.5" 140 | sky_engine: 141 | dependency: transitive 142 | description: flutter 143 | source: sdk 144 | version: "0.0.99" 145 | source_span: 146 | dependency: transitive 147 | description: 148 | name: source_span 149 | url: "https://pub.flutter-io.cn" 150 | source: hosted 151 | version: "1.5.5" 152 | stack_trace: 153 | dependency: transitive 154 | description: 155 | name: stack_trace 156 | url: "https://pub.flutter-io.cn" 157 | source: hosted 158 | version: "1.9.3" 159 | stream_channel: 160 | dependency: transitive 161 | description: 162 | name: stream_channel 163 | url: "https://pub.flutter-io.cn" 164 | source: hosted 165 | version: "2.0.0" 166 | string_scanner: 167 | dependency: transitive 168 | description: 169 | name: string_scanner 170 | url: "https://pub.flutter-io.cn" 171 | source: hosted 172 | version: "1.0.5" 173 | term_glyph: 174 | dependency: transitive 175 | description: 176 | name: term_glyph 177 | url: "https://pub.flutter-io.cn" 178 | source: hosted 179 | version: "1.1.0" 180 | test_api: 181 | dependency: transitive 182 | description: 183 | name: test_api 184 | url: "https://pub.flutter-io.cn" 185 | source: hosted 186 | version: "0.2.11" 187 | typed_data: 188 | dependency: transitive 189 | description: 190 | name: typed_data 191 | url: "https://pub.flutter-io.cn" 192 | source: hosted 193 | version: "1.1.6" 194 | uuid: 195 | dependency: transitive 196 | description: 197 | name: uuid 198 | url: "https://pub.flutter-io.cn" 199 | source: hosted 200 | version: "2.0.4" 201 | vector_math: 202 | dependency: transitive 203 | description: 204 | name: vector_math 205 | url: "https://pub.flutter-io.cn" 206 | source: hosted 207 | version: "2.0.8" 208 | xml: 209 | dependency: transitive 210 | description: 211 | name: xml 212 | url: "https://pub.flutter-io.cn" 213 | source: hosted 214 | version: "3.5.0" 215 | sdks: 216 | dart: ">=2.5.0 <3.0.0" 217 | flutter: ">=1.12.13 <2.0.0" 218 | -------------------------------------------------------------------------------- /example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: aly_oss_example 2 | version: 0.0.1 3 | description: Demonstrates how to use the aly_oss plugin. 4 | publish_to: 'none' 5 | 6 | environment: 7 | sdk: ">=2.5.0 <3.0.0" 8 | 9 | dependencies: 10 | flutter: 11 | sdk: flutter 12 | image_picker: ^0.6.5 13 | 14 | dev_dependencies: 15 | flutter_test: 16 | sdk: flutter 17 | 18 | aly_oss: 19 | path: ../ 20 | 21 | flutter: 22 | uses-material-design: true 23 | -------------------------------------------------------------------------------- /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 | /Flutter/flutter_export_environment.sh -------------------------------------------------------------------------------- /ios/Assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flmn/aly_oss/8bdb8f62dce905767a64ad3942f4a793992e205a/ios/Assets/.gitkeep -------------------------------------------------------------------------------- /ios/Classes/AesHelper.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | NSString * aesDecrypt(NSString *key, NSString *iv, NSString *data); 5 | -------------------------------------------------------------------------------- /ios/Classes/AesHelper.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import "AesHelper.h" 3 | 4 | NSString * aesDecrypt(NSString *key, NSString *iv, NSString *data) { 5 | char keyPtr[kCCKeySizeAES128+1]; 6 | bzero(keyPtr, sizeof(keyPtr)); 7 | [key getCString:keyPtr maxLength:sizeof(keyPtr) encoding:NSUTF8StringEncoding]; 8 | 9 | char ivPtr[kCCKeySizeAES128+1]; 10 | bzero(ivPtr, sizeof(ivPtr)); 11 | [iv getCString:ivPtr maxLength:sizeof(ivPtr) encoding:NSUTF8StringEncoding]; 12 | 13 | NSData *contentData = [[NSData alloc] initWithBase64EncodedString:data options:NSDataBase64DecodingIgnoreUnknownCharacters]; 14 | NSUInteger dataLength = contentData.length; 15 | size_t bufferSize = dataLength + kCCBlockSizeAES128; 16 | 17 | void *buffer = malloc(bufferSize); 18 | size_t numBytesDecrypted = 0; 19 | 20 | CCCryptorStatus cryptStatus = CCCrypt(kCCDecrypt, 21 | kCCAlgorithmAES128, 22 | kCCOptionPKCS7Padding, 23 | keyPtr, 24 | kCCBlockSizeAES128, 25 | ivPtr, 26 | contentData.bytes, 27 | dataLength, 28 | buffer, 29 | bufferSize, 30 | &numBytesDecrypted); 31 | 32 | if (cryptStatus == kCCSuccess) { 33 | NSData *decryptedData = [NSData dataWithBytesNoCopy:buffer length:numBytesDecrypted]; 34 | 35 | return [[NSString alloc] initWithData:decryptedData encoding:NSUTF8StringEncoding]; 36 | } 37 | 38 | free(buffer); 39 | 40 | return nil; 41 | } 42 | -------------------------------------------------------------------------------- /ios/Classes/AlyOssPlugin.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface AlyOssPlugin : NSObject 4 | 5 | - (void)init:(FlutterMethodCall *)call result:(FlutterResult)result; 6 | - (void)upload:(FlutterMethodCall *)call result:(FlutterResult)result; 7 | - (void)exist:(FlutterMethodCall *)call result:(FlutterResult)result; 8 | - (void)delete:(FlutterMethodCall *)call result:(FlutterResult)result; 9 | - (bool)checkOss:(FlutterResult)result; 10 | 11 | @end 12 | -------------------------------------------------------------------------------- /ios/Classes/AlyOssPlugin.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import "AesHelper.h" 3 | #import "AlyOssPlugin.h" 4 | 5 | NSObject *REGISTRAR; 6 | FlutterMethodChannel *CHANNEL; 7 | OSSClient *oss = nil; 8 | 9 | @implementation AlyOssPlugin 10 | + (void)registerWithRegistrar:(NSObject*)registrar { 11 | CHANNEL = [FlutterMethodChannel 12 | methodChannelWithName:@"jitao.tech/aly_oss" 13 | binaryMessenger:[registrar messenger]]; 14 | AlyOssPlugin* instance = [[AlyOssPlugin alloc] init]; 15 | [registrar addMethodCallDelegate:instance channel:CHANNEL]; 16 | } 17 | 18 | - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result { 19 | if ([@"init" isEqualToString:call.method]) { 20 | [self init:call result:result]; 21 | 22 | return; 23 | } else if ([@"upload" isEqualToString:call.method]) { 24 | [self upload:call result:result]; 25 | 26 | return; 27 | } else if ([@"exist" isEqualToString:call.method]) { 28 | [self exist:call result:result]; 29 | 30 | return; 31 | } else if ([@"delete" isEqualToString:call.method]) { 32 | [self delete:call result:result]; 33 | 34 | return; 35 | } else { 36 | result(FlutterMethodNotImplemented); 37 | } 38 | } 39 | 40 | - (void)init:(FlutterMethodCall*)call result:(FlutterResult)result { 41 | NSString *instanceId = call.arguments[@"instanceId"]; 42 | NSString *requestId = call.arguments[@"requestId"]; 43 | NSString *stsServer = call.arguments[@"stsServer"]; 44 | NSString *endpoint = call.arguments[@"endpoint"]; 45 | NSString *aesKey = call.arguments[@"aesKey"]; 46 | NSString *iv = call.arguments[@"iv"]; 47 | 48 | id credentialProvider = [[OSSFederationCredentialProvider alloc] initWithFederationTokenGetter:^OSSFederationToken * { 49 | NSURL *url = [NSURL URLWithString:stsServer]; 50 | NSURLRequest *request = [NSURLRequest requestWithURL:url]; 51 | OSSTaskCompletionSource * tcs = [OSSTaskCompletionSource taskCompletionSource]; 52 | NSURLSession *session = [NSURLSession sharedSession]; 53 | NSURLSessionTask * sessionTask = [session dataTaskWithRequest:request 54 | completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { 55 | if (error) { 56 | [tcs setError:error]; 57 | 58 | return; 59 | } 60 | [tcs setResult:data]; 61 | }]; 62 | [sessionTask resume]; 63 | [tcs.task waitUntilFinished]; 64 | 65 | if (tcs.task.error) { 66 | NSLog(@"get token error: %@", tcs.task.error); 67 | 68 | return nil; 69 | } else { 70 | NSData *jsonText=[aesDecrypt(aesKey, iv, [[NSString alloc] initWithData:tcs.task.result encoding:NSUTF8StringEncoding]) dataUsingEncoding:NSUTF8StringEncoding]; 71 | NSLog(@"get token aes: %@", jsonText); 72 | 73 | if (jsonText == nil) { 74 | return nil; 75 | } 76 | 77 | NSDictionary *object = [NSJSONSerialization JSONObjectWithData: jsonText 78 | options:kNilOptions 79 | error:nil]; 80 | OSSFederationToken * token = [OSSFederationToken new]; 81 | token.tAccessKey = [object objectForKey:@"AccessKeyId"]; 82 | token.tSecretKey = [object objectForKey:@"AccessKeySecret"]; 83 | token.tToken = [object objectForKey:@"SecurityToken"]; 84 | token.expirationTimeInGMTFormat = [object objectForKey:@"Expiration"]; 85 | 86 | return token; 87 | } 88 | }]; 89 | 90 | oss = [[OSSClient alloc] initWithEndpoint:endpoint credentialProvider:credentialProvider]; 91 | NSDictionary *arguments = @{ 92 | @"instanceId": instanceId, 93 | @"requestId":requestId 94 | }; 95 | 96 | result(arguments); 97 | } 98 | 99 | - (void)upload:(FlutterMethodCall*)call result:(FlutterResult)result { 100 | if (![self checkOss:result]) { 101 | return; 102 | } 103 | 104 | NSString *instanceId = call.arguments[@"instanceId"]; 105 | NSString *requestId = call.arguments[@"requestId"]; 106 | NSString *bucket = call.arguments[@"bucket"]; 107 | NSString *key = call.arguments[@"key"]; 108 | NSString *file = call.arguments[@"file"]; 109 | 110 | OSSPutObjectRequest *request = [OSSPutObjectRequest new]; 111 | request.bucketName = bucket; 112 | request.objectKey = key; 113 | request.uploadingFileURL = [NSURL fileURLWithPath:file]; 114 | request.uploadProgress = ^(int64_t bytesSent, int64_t totalByteSent, int64_t totalBytesExpectedToSend) { 115 | NSDictionary *arguments = @{ 116 | @"instanceId":instanceId, 117 | @"requestId":requestId, 118 | @"bucket":bucket, 119 | @"key":key, 120 | @"currentSize": [NSString stringWithFormat:@"%lld",totalByteSent], 121 | @"totalSize": [NSString stringWithFormat:@"%lld",totalBytesExpectedToSend] 122 | }; 123 | [CHANNEL invokeMethod:@"onProgress" arguments:arguments]; 124 | }; 125 | 126 | OSSTask *task = [oss putObject:request]; 127 | [task continueWithBlock:^id(OSSTask *task) { 128 | if (!task.error) { 129 | NSDictionary *arguments = @{ 130 | @"success": @"true", 131 | @"instanceId":instanceId, 132 | @"requestId":requestId, 133 | @"bucket":bucket, 134 | @"key":key, 135 | }; 136 | [CHANNEL invokeMethod:@"onUpload" arguments:arguments]; 137 | } else { 138 | NSDictionary *arguments = @{ 139 | @"success": @"false", 140 | @"instanceId":instanceId, 141 | @"requestId":requestId, 142 | @"bucket":bucket, 143 | @"key":key, 144 | @"message":task.error 145 | }; 146 | [CHANNEL invokeMethod:@"onUpload" arguments:arguments]; 147 | } 148 | return nil; 149 | }]; 150 | } 151 | 152 | - (void)exist:(FlutterMethodCall*)call result:(FlutterResult)result { 153 | if (![self checkOss:result]) { 154 | return; 155 | } 156 | 157 | NSString *instanceId = call.arguments[@"instanceId"]; 158 | NSString *requestId = call.arguments[@"requestId"]; 159 | NSString *bucket = call.arguments[@"bucket"]; 160 | NSString *key = call.arguments[@"key"]; 161 | 162 | NSError *error = nil; 163 | BOOL isExist = [oss doesObjectExistInBucket:bucket objectKey:key error:&error]; 164 | 165 | if (!error) { 166 | NSDictionary *arguments = @{ 167 | @"instanceId": instanceId, 168 | @"requestId":requestId, 169 | @"bucket":bucket, 170 | @"key":key, 171 | @"exist": isExist? @"true" : @"false" 172 | }; 173 | 174 | 175 | result(arguments); 176 | } else { 177 | result([FlutterError errorWithCode:@"SERVICE_EXCEPTION" 178 | message:@"发生错误" 179 | details:nil]); 180 | } 181 | } 182 | 183 | - (void)delete:(FlutterMethodCall*)call result:(FlutterResult)result { 184 | if (![self checkOss:result]) { 185 | return; 186 | } 187 | 188 | NSString *instanceId = call.arguments[@"instanceId"]; 189 | NSString *requestId = call.arguments[@"requestId"]; 190 | NSString *bucket = call.arguments[@"bucket"]; 191 | NSString *key = call.arguments[@"key"]; 192 | 193 | OSSDeleteObjectRequest *request = [OSSDeleteObjectRequest new]; 194 | request.bucketName = bucket; 195 | request.objectKey = key; 196 | 197 | OSSTask *task = [oss deleteObject:request]; 198 | 199 | [task continueWithBlock:^id(OSSTask *task) { 200 | return nil; 201 | }]; 202 | 203 | [task waitUntilFinished]; 204 | 205 | if (task.error) { 206 | result([FlutterError errorWithCode:@"SERVICE_EXCEPTION" 207 | message:@"" 208 | details:nil]); 209 | } else { 210 | NSDictionary *arguments = @{ 211 | @"instanceId": instanceId, 212 | @"requestId":requestId, 213 | @"bucket":bucket, 214 | @"key":key 215 | }; 216 | 217 | result(arguments); 218 | } 219 | } 220 | 221 | - (BOOL)checkOss:(FlutterResult)result { 222 | if (oss == nil) { 223 | result([FlutterError errorWithCode:@"FAILED_PRECONDITION" 224 | message:@"not initialized" 225 | details:@"call init first"]); 226 | 227 | return FALSE; 228 | } 229 | 230 | return TRUE; 231 | } 232 | 233 | @end 234 | -------------------------------------------------------------------------------- /ios/aly_oss.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 = 'aly_oss' 6 | s.version = '0.0.1' 7 | s.summary = 'A ALY OSS plugin.' 8 | s.description = <<-DESC 9 | A ALY OSS plugin. 10 | DESC 11 | s.homepage = 'httpq://jitao.tech' 12 | s.license = { :file => '../LICENSE' } 13 | s.author = { 'Ji Tao' => 'jitao@jitao.tech' } 14 | s.source = { :path => '.' } 15 | s.source_files = 'Classes/**/*' 16 | s.public_header_files = 'Classes/**/*.h' 17 | s.dependency 'Flutter' 18 | s.dependency 'AliyunOSSiOS' 19 | 20 | s.ios.deployment_target = '10.0' 21 | end 22 | 23 | -------------------------------------------------------------------------------- /lib/aly_oss.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:flutter/services.dart'; 4 | import 'package:uuid/uuid.dart'; 5 | 6 | class AlyOss { 7 | static final _channel = MethodChannel('jitao.tech/aly_oss')..setMethodCallHandler(_handler); 8 | static final _instances = Map(); 9 | static final _uuid = Uuid(); 10 | String _instanceId; 11 | 12 | AlyOss() { 13 | _instanceId = _uuid.v4(); 14 | _instances[_instanceId] = this; 15 | 16 | print('AlyOss: ' + _instanceId); 17 | } 18 | 19 | StreamController _onProgressController = StreamController.broadcast(); 20 | 21 | Stream get onProgress => _onProgressController.stream; 22 | 23 | StreamController _onUploadController = StreamController.broadcast(); 24 | 25 | Stream get onUpload => _onUploadController.stream; 26 | 27 | static Future _handler(MethodCall methodCall) async { 28 | String instanceId = methodCall.arguments['instanceId']; 29 | AlyOss instance = _instances[instanceId]; 30 | 31 | switch (methodCall.method) { 32 | case 'onProgress': 33 | instance._onProgressController.add(ProgressResponse.fromMap(methodCall.arguments)); 34 | break; 35 | case 'onUpload': 36 | instance._onUploadController.add(UploadResponse.fromMap(methodCall.arguments)); 37 | break; 38 | default: 39 | print('Call ${methodCall.method} from platform, arguments=${methodCall.arguments}'); 40 | } 41 | 42 | return Future.value(true); 43 | } 44 | 45 | /// Initialize plugin with [request] 46 | Future> init(InitRequest request) async { 47 | return await _invokeMethod('init', request.toMap()); 48 | } 49 | 50 | /// Shutdown plugin 51 | void shutdown() { 52 | _onProgressController.close(); 53 | _onUploadController.close(); 54 | } 55 | 56 | Future> upload(UploadRequest request) async { 57 | return await _invokeMethod('upload', request.toMap()); 58 | } 59 | 60 | Future> exist(KeyRequest request) async { 61 | return await _invokeMethod('exist', request.toMap()); 62 | } 63 | 64 | Future> delete(KeyRequest request) async { 65 | return await _invokeMethod('delete', request.toMap()); 66 | } 67 | 68 | Future> _invokeMethod(String method, [Map arguments = const {}]) { 69 | Map withId = Map.of(arguments); 70 | withId['instanceId'] = _instanceId; 71 | 72 | return _channel.invokeMapMethod(method, withId); 73 | } 74 | } 75 | 76 | abstract class Request { 77 | final String requestId; 78 | 79 | Request(this.requestId); 80 | 81 | Map toMap() { 82 | return {'requestId': requestId}; 83 | } 84 | } 85 | 86 | class InitRequest extends Request { 87 | final String stsServer; 88 | final String endpoint; 89 | final String aesKey; 90 | final String iv; 91 | 92 | InitRequest(requestId, this.stsServer, this.endpoint, this.aesKey, this.iv) : super(requestId); 93 | 94 | Map toMap() { 95 | var m = Map.of(super.toMap()); 96 | m['stsServer'] = stsServer; 97 | m['endpoint'] = endpoint; 98 | m['aesKey'] = aesKey; 99 | m['iv'] = iv; 100 | 101 | return m; 102 | } 103 | } 104 | 105 | class KeyRequest extends Request { 106 | final String bucket; 107 | final String key; 108 | 109 | KeyRequest(requestId, this.bucket, this.key) : super(requestId); 110 | 111 | Map toMap() { 112 | var m = Map.of(super.toMap()); 113 | m['bucket'] = bucket; 114 | m['key'] = key; 115 | 116 | return m; 117 | } 118 | } 119 | 120 | class UploadRequest extends KeyRequest { 121 | final String file; 122 | 123 | UploadRequest(requestId, bucket, key, this.file) : super(requestId, bucket, key); 124 | 125 | Map toMap() { 126 | var m = Map.of(super.toMap()); 127 | m['file'] = file; 128 | 129 | return m; 130 | } 131 | } 132 | 133 | abstract class Response { 134 | final bool success; 135 | final String requestId; 136 | 137 | Response({this.success, this.requestId}); 138 | } 139 | 140 | class KeyResponse extends Response { 141 | final String bucket; 142 | final String key; 143 | 144 | KeyResponse({success, requestId, this.bucket, this.key}) : super(success: success, requestId: requestId); 145 | } 146 | 147 | class UploadResponse extends KeyResponse { 148 | UploadResponse({success, requestId, bucket, key}) : super(success: success, requestId: requestId, bucket: bucket, key: key); 149 | 150 | UploadResponse.fromMap(Map map) 151 | : super( 152 | success: "true" == map['success'], 153 | requestId: map['requestId'], 154 | bucket: map['bucket'], 155 | key: map['key'], 156 | ); 157 | 158 | String toString() { 159 | return '{success:$success, requestId:$requestId, bucket:$bucket, key:$key}'; 160 | } 161 | } 162 | 163 | class ProgressResponse extends KeyResponse { 164 | int currentSize; 165 | int totalSize; 166 | 167 | ProgressResponse({success, requestId, bucket, key, this.currentSize, this.totalSize}) 168 | : super(success: success, requestId: requestId, bucket: bucket, key: key); 169 | 170 | ProgressResponse.fromMap(Map map) 171 | : super( 172 | success: "true" == map['success'], 173 | requestId: map['requestId'], 174 | bucket: map['bucket'], 175 | key: map['key'], 176 | ) { 177 | currentSize = int.tryParse(map['currentSize']) ?? 0; 178 | totalSize = int.tryParse(map['totalSize']) ?? 0; 179 | } 180 | 181 | String toString() { 182 | return '{success:$success, requestId:$requestId, bucket:$bucket, key:$key}, currentSize:$currentSize, totalSize:$totalSize'; 183 | } 184 | } 185 | -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | archive: 5 | dependency: transitive 6 | description: 7 | name: archive 8 | url: "https://pub.flutter-io.cn" 9 | source: hosted 10 | version: "2.0.11" 11 | args: 12 | dependency: transitive 13 | description: 14 | name: args 15 | url: "https://pub.flutter-io.cn" 16 | source: hosted 17 | version: "1.5.2" 18 | async: 19 | dependency: transitive 20 | description: 21 | name: async 22 | url: "https://pub.flutter-io.cn" 23 | source: hosted 24 | version: "2.4.0" 25 | boolean_selector: 26 | dependency: transitive 27 | description: 28 | name: boolean_selector 29 | url: "https://pub.flutter-io.cn" 30 | source: hosted 31 | version: "1.0.5" 32 | charcode: 33 | dependency: transitive 34 | description: 35 | name: charcode 36 | url: "https://pub.flutter-io.cn" 37 | source: hosted 38 | version: "1.1.2" 39 | collection: 40 | dependency: transitive 41 | description: 42 | name: collection 43 | url: "https://pub.flutter-io.cn" 44 | source: hosted 45 | version: "1.14.11" 46 | convert: 47 | dependency: transitive 48 | description: 49 | name: convert 50 | url: "https://pub.flutter-io.cn" 51 | source: hosted 52 | version: "2.1.1" 53 | crypto: 54 | dependency: transitive 55 | description: 56 | name: crypto 57 | url: "https://pub.flutter-io.cn" 58 | source: hosted 59 | version: "2.1.3" 60 | flutter: 61 | dependency: "direct main" 62 | description: flutter 63 | source: sdk 64 | version: "0.0.0" 65 | flutter_test: 66 | dependency: "direct dev" 67 | description: flutter 68 | source: sdk 69 | version: "0.0.0" 70 | image: 71 | dependency: transitive 72 | description: 73 | name: image 74 | url: "https://pub.flutter-io.cn" 75 | source: hosted 76 | version: "2.1.4" 77 | matcher: 78 | dependency: transitive 79 | description: 80 | name: matcher 81 | url: "https://pub.flutter-io.cn" 82 | source: hosted 83 | version: "0.12.6" 84 | meta: 85 | dependency: transitive 86 | description: 87 | name: meta 88 | url: "https://pub.flutter-io.cn" 89 | source: hosted 90 | version: "1.1.8" 91 | path: 92 | dependency: transitive 93 | description: 94 | name: path 95 | url: "https://pub.flutter-io.cn" 96 | source: hosted 97 | version: "1.6.4" 98 | pedantic: 99 | dependency: transitive 100 | description: 101 | name: pedantic 102 | url: "https://pub.flutter-io.cn" 103 | source: hosted 104 | version: "1.8.0+1" 105 | petitparser: 106 | dependency: transitive 107 | description: 108 | name: petitparser 109 | url: "https://pub.flutter-io.cn" 110 | source: hosted 111 | version: "2.4.0" 112 | quiver: 113 | dependency: transitive 114 | description: 115 | name: quiver 116 | url: "https://pub.flutter-io.cn" 117 | source: hosted 118 | version: "2.0.5" 119 | sky_engine: 120 | dependency: transitive 121 | description: flutter 122 | source: sdk 123 | version: "0.0.99" 124 | source_span: 125 | dependency: transitive 126 | description: 127 | name: source_span 128 | url: "https://pub.flutter-io.cn" 129 | source: hosted 130 | version: "1.5.5" 131 | stack_trace: 132 | dependency: transitive 133 | description: 134 | name: stack_trace 135 | url: "https://pub.flutter-io.cn" 136 | source: hosted 137 | version: "1.9.3" 138 | stream_channel: 139 | dependency: transitive 140 | description: 141 | name: stream_channel 142 | url: "https://pub.flutter-io.cn" 143 | source: hosted 144 | version: "2.0.0" 145 | string_scanner: 146 | dependency: transitive 147 | description: 148 | name: string_scanner 149 | url: "https://pub.flutter-io.cn" 150 | source: hosted 151 | version: "1.0.5" 152 | term_glyph: 153 | dependency: transitive 154 | description: 155 | name: term_glyph 156 | url: "https://pub.flutter-io.cn" 157 | source: hosted 158 | version: "1.1.0" 159 | test_api: 160 | dependency: transitive 161 | description: 162 | name: test_api 163 | url: "https://pub.flutter-io.cn" 164 | source: hosted 165 | version: "0.2.11" 166 | typed_data: 167 | dependency: transitive 168 | description: 169 | name: typed_data 170 | url: "https://pub.flutter-io.cn" 171 | source: hosted 172 | version: "1.1.6" 173 | uuid: 174 | dependency: "direct main" 175 | description: 176 | name: uuid 177 | url: "https://pub.flutter-io.cn" 178 | source: hosted 179 | version: "2.0.4" 180 | vector_math: 181 | dependency: transitive 182 | description: 183 | name: vector_math 184 | url: "https://pub.flutter-io.cn" 185 | source: hosted 186 | version: "2.0.8" 187 | xml: 188 | dependency: transitive 189 | description: 190 | name: xml 191 | url: "https://pub.flutter-io.cn" 192 | source: hosted 193 | version: "3.5.0" 194 | sdks: 195 | dart: ">=2.5.0 <3.0.0" 196 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: aly_oss 2 | description: An aliyun oss plugin for flutter. Use this plugin to upload files to aliyun oss. 3 | version: 1.0.1 4 | homepage: https://github.com/flmn/aly_oss 5 | 6 | environment: 7 | sdk: ">=2.5.0 <3.0.0" 8 | 9 | dependencies: 10 | flutter: 11 | sdk: flutter 12 | uuid: ^2.0.4 13 | 14 | dev_dependencies: 15 | flutter_test: 16 | sdk: flutter 17 | 18 | flutter: 19 | plugin: 20 | androidPackage: tech.jitao.aly_oss 21 | pluginClass: AlyOssPlugin 22 | --------------------------------------------------------------------------------