├── .DS_Store ├── .dart_tool └── package_config.json ├── .gitattributes ├── .gitignore ├── .metadata ├── .packages ├── CHANGELOG.md ├── LICENSE ├── README.md ├── aliossflutter.iml ├── android ├── .classpath ├── .gitignore ├── .project ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── com │ └── jlcool │ └── aliossflutter │ ├── AESCipher.java │ ├── AliossflutterPlugin.java │ └── SecretUtils.java ├── example ├── .flutter-plugins-dependencies ├── .gitignore ├── .metadata ├── README.md ├── android │ ├── .project │ ├── app │ │ ├── .classpath │ │ ├── .project │ │ ├── build.gradle │ │ └── src │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ └── com │ │ │ │ └── jlcool │ │ │ │ └── aliossflutterexample │ │ │ │ └── MainActivity.java │ │ │ └── res │ │ │ ├── drawable │ │ │ └── launch_background.xml │ │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ └── ic_launcher.png │ │ │ └── values │ │ │ └── styles.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ └── settings.gradle ├── ios │ ├── Flutter │ │ ├── .last_build_id │ │ ├── AppFrameworkInfo.plist │ │ ├── Debug.xcconfig │ │ ├── Flutter.podspec │ │ ├── Generated.xcconfig │ │ ├── Release.xcconfig │ │ └── flutter_export_environment.sh │ ├── Podfile │ ├── 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 │ │ ├── GeneratedPluginRegistrant.h │ │ ├── GeneratedPluginRegistrant.m │ │ ├── Info.plist │ │ └── main.m ├── lib │ └── main.dart ├── pubspec.yaml └── test │ └── widget_test.dart ├── ios ├── .gitignore ├── Assets │ └── .gitkeep ├── Classes │ ├── AESCipher │ │ ├── AESCipher.h │ │ └── AESCipher.m │ ├── AliossflutterPlugin.h │ ├── AliossflutterPlugin.m │ ├── GTMBase64.h │ ├── GTMBase64.m │ ├── GTMDefines.h │ ├── JKEncrypt.h │ └── JKEncrypt.m └── aliossflutter.podspec ├── lib ├── aliossflutter.dart └── response.dart ├── pubspec.lock └── pubspec.yaml /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jlcool/aliossflutter/2dfbae1cce461b44b3b8e86cb5b4daa1285b720f/.DS_Store -------------------------------------------------------------------------------- /.dart_tool/package_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "configVersion": 2, 3 | "packages": [ 4 | { 5 | "name": "characters", 6 | "rootUri": "file:///Users/jiangliang/.pub-cache/hosted/pub.flutter-io.cn/characters-1.1.0-nullsafety.2", 7 | "packageUri": "lib/", 8 | "languageVersion": "2.10" 9 | }, 10 | { 11 | "name": "charcode", 12 | "rootUri": "file:///Users/jiangliang/.pub-cache/hosted/pub.flutter-io.cn/charcode-1.1.2", 13 | "packageUri": "lib/", 14 | "languageVersion": "1.0" 15 | }, 16 | { 17 | "name": "collection", 18 | "rootUri": "file:///Users/jiangliang/.pub-cache/hosted/pub.flutter-io.cn/collection-1.15.0-nullsafety.2", 19 | "packageUri": "lib/", 20 | "languageVersion": "2.10" 21 | }, 22 | { 23 | "name": "convert", 24 | "rootUri": "file:///Users/jiangliang/.pub-cache/hosted/pub.flutter-io.cn/convert-2.0.2", 25 | "packageUri": "lib/", 26 | "languageVersion": "1.17" 27 | }, 28 | { 29 | "name": "crypto", 30 | "rootUri": "file:///Users/jiangliang/.pub-cache/hosted/pub.flutter-io.cn/crypto-2.0.6", 31 | "packageUri": "lib/", 32 | "languageVersion": "2.0" 33 | }, 34 | { 35 | "name": "flutter", 36 | "rootUri": "file:///Users/jiangliang/development/flutter/packages/flutter", 37 | "packageUri": "lib/", 38 | "languageVersion": "2.10" 39 | }, 40 | { 41 | "name": "meta", 42 | "rootUri": "file:///Users/jiangliang/.pub-cache/hosted/pub.flutter-io.cn/meta-1.3.0-nullsafety.2", 43 | "packageUri": "lib/", 44 | "languageVersion": "2.10" 45 | }, 46 | { 47 | "name": "sky_engine", 48 | "rootUri": "file:///Users/jiangliang/development/flutter/bin/cache/pkg/sky_engine", 49 | "packageUri": "lib/", 50 | "languageVersion": "1.11" 51 | }, 52 | { 53 | "name": "typed_data", 54 | "rootUri": "file:///Users/jiangliang/.pub-cache/hosted/pub.flutter-io.cn/typed_data-1.3.0-nullsafety.2", 55 | "packageUri": "lib/", 56 | "languageVersion": "2.10" 57 | }, 58 | { 59 | "name": "uuid", 60 | "rootUri": "file:///Users/jiangliang/.pub-cache/hosted/pub.flutter-io.cn/uuid-2.0.0", 61 | "packageUri": "lib/", 62 | "languageVersion": "2.0" 63 | }, 64 | { 65 | "name": "vector_math", 66 | "rootUri": "file:///Users/jiangliang/.pub-cache/hosted/pub.flutter-io.cn/vector_math-2.1.0-nullsafety.2", 67 | "packageUri": "lib/", 68 | "languageVersion": "2.10" 69 | }, 70 | { 71 | "name": "aliossflutter", 72 | "rootUri": "../", 73 | "packageUri": "lib/", 74 | "languageVersion": "2.0" 75 | } 76 | ], 77 | "generated": "2020-11-15T14:07:15.905922Z", 78 | "generator": "pub", 79 | "generatorVersion": "2.10.0-38.0.dev" 80 | } 81 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.java linguist-language=Dart 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Build and Release Folders 2 | bin-debug/ 3 | bin-release/ 4 | [Oo]bj/ 5 | [Bb]in/ 6 | 7 | # Other files and folders 8 | .settings/ 9 | 10 | # Executables 11 | *.swf 12 | *.air 13 | *.ipa 14 | *.apk 15 | 16 | # Project files, i.e. `.project`, `.actionScriptProperties` and `.flexProperties` 17 | # should NOT be excluded as they contain compiler settings and other important 18 | # information for Eclipse / Flash Builder. 19 | /.idea/codeStyles 20 | /.idea 21 | /android/.idea 22 | -------------------------------------------------------------------------------- /.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: 15209f4fb8cb7dc70a2fb7c9475bb22fd9c2c373 8 | channel: dev 9 | 10 | project_type: plugin 11 | -------------------------------------------------------------------------------- /.packages: -------------------------------------------------------------------------------- 1 | # Generated by pub on 2020-11-15 22:07:15.897304. 2 | characters:file:///Users/jiangliang/.pub-cache/hosted/pub.flutter-io.cn/characters-1.1.0-nullsafety.2/lib/ 3 | charcode:file:///Users/jiangliang/.pub-cache/hosted/pub.flutter-io.cn/charcode-1.1.2/lib/ 4 | collection:file:///Users/jiangliang/.pub-cache/hosted/pub.flutter-io.cn/collection-1.15.0-nullsafety.2/lib/ 5 | convert:file:///Users/jiangliang/.pub-cache/hosted/pub.flutter-io.cn/convert-2.0.2/lib/ 6 | crypto:file:///Users/jiangliang/.pub-cache/hosted/pub.flutter-io.cn/crypto-2.0.6/lib/ 7 | flutter:file:///Users/jiangliang/development/flutter/packages/flutter/lib/ 8 | meta:file:///Users/jiangliang/.pub-cache/hosted/pub.flutter-io.cn/meta-1.3.0-nullsafety.2/lib/ 9 | sky_engine:file:///Users/jiangliang/development/flutter/bin/cache/pkg/sky_engine/lib/ 10 | typed_data:file:///Users/jiangliang/.pub-cache/hosted/pub.flutter-io.cn/typed_data-1.3.0-nullsafety.2/lib/ 11 | uuid:file:///Users/jiangliang/.pub-cache/hosted/pub.flutter-io.cn/uuid-2.0.0/lib/ 12 | vector_math:file:///Users/jiangliang/.pub-cache/hosted/pub.flutter-io.cn/vector_math-2.1.0-nullsafety.2/lib/ 13 | aliossflutter:lib/ 14 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 0.0.2 2 | 增加判断文件是否存在 3 | 4 | ## 0.0.1 5 | 6 | * TODO: Describe initial release. 7 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # aliossflutter 2 | 3 | [go-flutter 桌面版](https://github.com/jlcool/go_flutter_alioss) 4 | 5 | example里的配置文件自行添加配置 6 | ```dart 7 | ///https://help.aliyun.com/document_detail/102082.html?spm=a2c4g.11186623.6.626.15695d26D8hGYE 8 | static final String stsserver=""; 9 | ///https://help.aliyun.com/document_detail/31837.html?spm=a2c4g.11186623.6.573.2b6144fdkv167F 10 | static final String endpoint=""; 11 | ///这是对sts认证的token加密用的key 12 | ///如果不加密这里不需要 13 | static final String cryptkey=""; 14 | static final String bucket=""; 15 | static final String key=""; 16 | ///上传回调配置 17 | ///参考 https://help.aliyun.com/document_detail/93985.html?spm=a2c4g.11186623.6.954.390a7c57VfH42B 18 | static final String callbackUrl=""; 19 | static final String callbackHost=""; 20 | ///支持 application/x-www-form-urlencoded 和application/json 21 | static final String callbackBodyType="application/json"; 22 | static final String callbackBody="{\"j_bucket\":\${bucket},\"j_object\":\${object},\"j_etag\":\${etag},\"j_size\":\${size},\"j_mimeType\":\${mimeType},\"j_height\":\${imageInfo.height},\"j_width\":\${imageInfo.width},\"j_format\":\${imageInfo.format},\"j_memberId\":\${x:var1}}"; 23 | static final String callbackVars="{\"x:var1\":\"123\"}"; 24 | ``` 25 | 26 | 阿里云oss 27 | 初始化一次就可以了,可以在main.dart里初始化,插件会自动管理sts token过期 28 | 后台返回sts格式: 29 | ``` 30 | { 31 | "StatusCode": 200, 32 | "AccessKeyId":"STS.iA645eTOXEqP3cg3VeHf", 33 | "AccessKeySecret":"rV3VQrpFQ4BsyHSAvi5NVLpPIVffDJv4LojUBZCf", 34 | "Expiration":"2015-11-03T09:52:59Z", 35 | "SecurityToken":"CAES7QIIARKAAZPlqaN9ILiQZPS+JDkS/GSZN45RLx4YS/p3OgaUC+oJl3XSlbJ7StKpQ...." 36 | } 37 | ``` 38 | 加密sts返回格式: 39 | ``` 40 | { 41 | "Data": "3des加密后的 sts" 42 | } 43 | ``` 44 | 初始化 45 | ```dart 46 | import 'package:aliossflutter/aliossflutter.dart'; 47 | AliOSSFlutter alioss=AliOSSFlutter(); 48 | alioss.init("sts url", "http://oss-cn-hangzhou.aliyuncs.com"); 49 | //可选一种 sts token 3DES加密方式 50 | //alioss.init("sts url", "http://oss-cn-hangzhou.aliyuncs.com",cryptkey:"key"); 51 | //监听初始化 52 | alioss.responseFromInit.listen((data){ 53 | if(data) { 54 | _msg="初始化成功"; 55 | }else{ 56 | _msg="初始化失败"; 57 | } 58 | }); 59 | ``` 60 | 使用keyid和Secret初始化 61 | ```dart 62 | secretInit(String accessKeyId,String accessKeySecret, String endpoint) 63 | ``` 64 | 上传 65 | ```dart 66 | AliOSSFlutter alioss=AliOSSFlutter(); 67 | alioss.upload("bucket", file.path, "key",callbackBody: Config.callbackBody,callbackBodyType: Config.callbackBodyType,callbackHost: Config.callbackHost,callbackUrl: Config.callbackUrl,callbackVars: Config.callbackVars); 68 | //监听上传 69 | alioss.responseFromUpload.listen((data) { 70 | if(data.success) { 71 | setState(() { 72 | _msg="上传成功 key:"+data.key+" 服务器回调返回值:"+data.servercallback; 73 | }); 74 | }else{ 75 | _msg="上传失败"; 76 | } 77 | }); 78 | ``` 79 | 下载 80 | ```dart 81 | AliOSSFlutter alioss=AliOSSFlutter(); 82 | alioss.download(bucket, key, path,{process = ""}); 83 | //监听下载回调 84 | alioss.responseFromDownload.listen((data) { 85 | if(data.success) { 86 | setState(() { 87 | _path=data.path; 88 | _msg="下载成功:"+_path; 89 | }); 90 | }else{ 91 | _msg="下载失败"; 92 | } 93 | }); 94 | ``` 95 | url签名: 96 | ```dart 97 | //type=1 签名私有资源 98 | //type=0 签名公开的访问URL 99 | alioss.signUrl(bucket, key,{type = "0",interval = "1800",process = ""}) 100 | 101 | //监听url签名 102 | alioss.responseFromSign.listen((data){ 103 | if(data.success) { 104 | setState(() { 105 | _msg="url 签名 :"+data.url; 106 | }); 107 | }else{ 108 | _msg="url 签名失败"; 109 | } 110 | }); 111 | ``` 112 | 监听进度上传和下载共用 113 | ```dart 114 | alioss.responseFromProgress.listen((data){ 115 | if(data.key==key) { 116 | setState(() { 117 | _progress=data.getProgress(); 118 | }); 119 | } 120 | }); 121 | ``` 122 | 123 | 判断文件是否存在 124 | ```dart 125 | alioss.exist(bucket, key).then((exist) { 126 | if (exist) { 127 | _msg = "已存在"; 128 | } else if (!exist) { 129 | _msg = "不存在"; 130 | } 131 | setState(() {}); 132 | }).catchError((err) { 133 | _msg = "错误:$err"; 134 | setState(() {}); 135 | }); 136 | ``` 137 | 写了个插件开发过程,可以参考下 138 | [插件开发方法](https://github.com/jlcool/aliossflutter/wiki/%E6%8F%92%E4%BB%B6%E5%BC%80%E5%8F%91%E6%B5%81%E7%A8%8B). 139 | 140 | -------------------------------------------------------------------------------- /aliossflutter.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /android/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | -------------------------------------------------------------------------------- /android/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | aliossflutter 4 | Project android_ created by Buildship. 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.buildship.core.gradleprojectbuilder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | org.eclipse.buildship.core.gradleprojectnature 22 | 23 | 24 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | group 'com.jlcool.aliossflutter' 2 | version '1.0-SNAPSHOT' 3 | 4 | buildscript { 5 | repositories { 6 | google() 7 | jcenter() 8 | } 9 | 10 | dependencies { 11 | classpath 'com.android.tools.build:gradle:3.2.1' 12 | } 13 | } 14 | 15 | rootProject.allprojects { 16 | repositories { 17 | google() 18 | jcenter() 19 | } 20 | } 21 | 22 | apply plugin: 'com.android.library' 23 | 24 | android { 25 | compileSdkVersion 28 26 | 27 | defaultConfig { 28 | minSdkVersion 16 29 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 30 | } 31 | lintOptions { 32 | disable 'InvalidPackage' 33 | } 34 | } 35 | dependencies { 36 | implementation 'com.aliyun.dpa:oss-android-sdk:+' 37 | implementation 'com.squareup.okhttp3:okhttp:3.4.1' 38 | implementation 'com.squareup.okio:okio:1.9.0' 39 | } -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | android.enableR8=true 5 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jlcool/aliossflutter/2dfbae1cce461b44b3b8e86cb5b4daa1285b720f/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Dec 04 16:23:03 CST 2018 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/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn () { 37 | echo "$*" 38 | } 39 | 40 | die () { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save () { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'aliossflutter' 2 | -------------------------------------------------------------------------------- /android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /android/src/main/java/com/jlcool/aliossflutter/AESCipher.java: -------------------------------------------------------------------------------- 1 | package com.jlcool.aliossflutter; 2 | 3 | import java.security.InvalidAlgorithmParameterException; 4 | import java.security.InvalidKeyException; 5 | import java.security.NoSuchAlgorithmException; 6 | import android.util.Base64; 7 | import javax.crypto.BadPaddingException; 8 | import javax.crypto.Cipher; 9 | import javax.crypto.IllegalBlockSizeException; 10 | import javax.crypto.NoSuchPaddingException; 11 | import javax.crypto.spec.IvParameterSpec; 12 | import javax.crypto.spec.SecretKeySpec; 13 | 14 | import java.io.UnsupportedEncodingException; 15 | 16 | public class AESCipher { 17 | 18 | private static final String IV_STRING = "0000000000000000"; 19 | private static final String charset = "UTF-8"; 20 | 21 | public static String aesEncryptString(String content, String key) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException, UnsupportedEncodingException { 22 | byte[] contentBytes = content.getBytes(charset); 23 | byte[] keyBytes = key.getBytes(charset); 24 | byte[] encryptedBytes = aesEncryptBytes(contentBytes, keyBytes); 25 | return new String(Base64.encode(encryptedBytes, Base64.DEFAULT)); 26 | } 27 | 28 | public static String aesDecryptString(String content, String key) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException, UnsupportedEncodingException { 29 | 30 | byte[] encryptedBytes = Base64.decode(content, Base64.DEFAULT); 31 | byte[] keyBytes = key.getBytes(charset); 32 | byte[] decryptedBytes = aesDecryptBytes(encryptedBytes, keyBytes); 33 | return new String(decryptedBytes, charset); 34 | } 35 | 36 | public static byte[] aesEncryptBytes(byte[] contentBytes, byte[] keyBytes) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException, UnsupportedEncodingException { 37 | return cipherOperation(contentBytes, keyBytes, Cipher.ENCRYPT_MODE); 38 | } 39 | 40 | public static byte[] aesDecryptBytes(byte[] contentBytes, byte[] keyBytes) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException, UnsupportedEncodingException { 41 | return cipherOperation(contentBytes, keyBytes, Cipher.DECRYPT_MODE); 42 | } 43 | 44 | private static byte[] cipherOperation(byte[] contentBytes, byte[] keyBytes, int mode) throws UnsupportedEncodingException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException { 45 | SecretKeySpec secretKey = new SecretKeySpec(keyBytes, "AES"); 46 | 47 | byte[] initParam = IV_STRING.getBytes(charset); 48 | IvParameterSpec ivParameterSpec = new IvParameterSpec(initParam); 49 | 50 | Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); 51 | cipher.init(mode, secretKey, ivParameterSpec); 52 | 53 | return cipher.doFinal(contentBytes); 54 | } 55 | 56 | } -------------------------------------------------------------------------------- /android/src/main/java/com/jlcool/aliossflutter/SecretUtils.java: -------------------------------------------------------------------------------- 1 | package com.jlcool.aliossflutter; 2 | 3 | import android.util.Base64; 4 | 5 | import java.io.UnsupportedEncodingException; 6 | 7 | import javax.crypto.Cipher; 8 | import javax.crypto.SecretKey; 9 | import javax.crypto.spec.SecretKeySpec; 10 | 11 | 12 | /** 13 | * SecretUtils {3DES加密解密的工具类 } 14 | * @author William 15 | * @date 2013-04-19 16 | */ 17 | public class SecretUtils { 18 | 19 | //定义加密算法,有DES、DESede(即3DES)、Blowfish 20 | private static final String Algorithm = "DESede"; 21 | static String PASSWORD_CRYPT_KEY = ""; 22 | /** 23 | * 加密方法 24 | * @param src 源数据的字节数组 25 | * @return 26 | */ 27 | public static byte[] encryptMode(String src) { 28 | try { 29 | SecretKey deskey = new SecretKeySpec(build3DesKey(PASSWORD_CRYPT_KEY), Algorithm); //生成密钥 30 | Cipher c1 = Cipher.getInstance(Algorithm); //实例化负责加密/解密的Cipher工具类 31 | c1.init(Cipher.ENCRYPT_MODE, deskey); //初始化为加密模式 32 | return Base64.encode(c1.doFinal(src.getBytes("UTF-8")),Base64.DEFAULT); 33 | } catch (java.security.NoSuchAlgorithmException e1) { 34 | e1.printStackTrace(); 35 | } catch (javax.crypto.NoSuchPaddingException e2) { 36 | e2.printStackTrace(); 37 | } catch (Exception e3) { 38 | e3.printStackTrace(); 39 | } 40 | return null; 41 | } 42 | 43 | 44 | /** 45 | * 解密函数 46 | * @param src 密文的字节数组 47 | * @return 48 | */ 49 | public static byte[] decryptMode(String src) { 50 | try { 51 | SecretKey deskey = new SecretKeySpec(build3DesKey(PASSWORD_CRYPT_KEY), Algorithm); 52 | Cipher c1 = Cipher.getInstance(Algorithm); 53 | c1.init(Cipher.DECRYPT_MODE, deskey); //初始化为解密模式 54 | return c1.doFinal(Base64.decode(src.getBytes("UTF-8"), Base64.DEFAULT) ); 55 | } catch (java.security.NoSuchAlgorithmException e1) { 56 | e1.printStackTrace(); 57 | } catch (javax.crypto.NoSuchPaddingException e2) { 58 | e2.printStackTrace(); 59 | } catch (Exception e3) { 60 | e3.printStackTrace(); 61 | } 62 | return null; 63 | } 64 | 65 | 66 | /* 67 | * 根据字符串生成密钥字节数组 68 | * @param keyStr 密钥字符串 69 | * @return 70 | * @throws UnsupportedEncodingException 71 | */ 72 | public static byte[] build3DesKey(String keyStr) throws UnsupportedEncodingException{ 73 | byte[] key = new byte[24]; //声明一个24位的字节数组,默认里面都是0 74 | byte[] temp = keyStr.getBytes("UTF-8"); //将字符串转成字节数组 75 | 76 | /* 77 | * 执行数组拷贝 78 | * System.arraycopy(源数组,从源数组哪里开始拷贝,目标数组,拷贝多少位) 79 | */ 80 | if(key.length > temp.length){ 81 | //如果temp不够24位,则拷贝temp数组整个长度的内容到key数组中 82 | System.arraycopy(temp, 0, key, 0, temp.length); 83 | }else{ 84 | //如果temp大于24位,则拷贝temp数组24个长度的内容到key数组中 85 | System.arraycopy(temp, 0, key, 0, key.length); 86 | } 87 | return key; 88 | } 89 | } -------------------------------------------------------------------------------- /example/.flutter-plugins-dependencies: -------------------------------------------------------------------------------- 1 | {"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"aliossflutter","path":"/Users/jiangliang/FlutterProjects/github/aliossflutter/","dependencies":[]}],"android":[{"name":"aliossflutter","path":"/Users/jiangliang/FlutterProjects/github/aliossflutter/","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"aliossflutter","dependencies":[]}],"date_created":"2020-11-15 22:38:52.435656","version":"1.21.0-10.0.pre.162"} -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.lock 4 | *.log 5 | *.pyc 6 | *.swp 7 | .DS_Store 8 | .atom/ 9 | .buildlog/ 10 | .history 11 | .svn/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # Visual Studio Code related 20 | .vscode/ 21 | 22 | # Flutter/Dart/Pub related 23 | **/doc/api/ 24 | .dart_tool/ 25 | .flutter-plugins 26 | .packages 27 | .pub-cache/ 28 | .pub/ 29 | build/ 30 | 31 | # Android related 32 | **/android/**/gradle-wrapper.jar 33 | **/android/.gradle 34 | **/android/captures/ 35 | **/android/gradlew 36 | **/android/gradlew.bat 37 | **/android/local.properties 38 | **/android/**/GeneratedPluginRegistrant.java 39 | 40 | # iOS/XCode related 41 | **/ios/**/*.mode1v3 42 | **/ios/**/*.mode2v3 43 | **/ios/**/*.moved-aside 44 | **/ios/**/*.pbxuser 45 | **/ios/**/*.perspectivev3 46 | **/ios/**/*sync/ 47 | **/ios/**/.sconsign.dblite 48 | **/ios/**/.tags* 49 | **/ios/**/.vagrant/ 50 | **/ios/**/DerivedData/ 51 | **/ios/**/Icon? 52 | **/ios/**/Pods/ 53 | **/ios/**/.symlinks/ 54 | **/ios/**/profile 55 | **/ios/**/xcuserdata 56 | **/ios/.generated/ 57 | **/ios/Flutter/App.framework 58 | **/ios/Flutter/Flutter.framework 59 | **/ios/Flutter/Generated.xcconfig 60 | **/ios/Flutter/app.flx 61 | **/ios/Flutter/app.zip 62 | **/ios/Flutter/flutter_assets/ 63 | **/ios/ServiceDefinitions.json 64 | **/ios/Runner/GeneratedPluginRegistrant.* 65 | 66 | # Exceptions to above rules. 67 | !**/ios/**/default.mode1v3 68 | !**/ios/**/default.mode2v3 69 | !**/ios/**/default.pbxuser 70 | !**/ios/**/default.perspectivev3 71 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 72 | -------------------------------------------------------------------------------- /example/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 15209f4fb8cb7dc70a2fb7c9475bb22fd9c2c373 8 | channel: dev 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # aliossflutter_example 2 | 3 | Demonstrates how to use the aliossflutter plugin. 4 | 5 | ## Getting Started 6 | 7 | For help getting started with Flutter, view our online 8 | [documentation](https://flutter.io/). 9 | -------------------------------------------------------------------------------- /example/android/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | android 4 | Project android created by Buildship. 5 | 6 | 7 | 8 | 9 | org.eclipse.buildship.core.gradleprojectbuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.buildship.core.gradleprojectnature 16 | 17 | 18 | -------------------------------------------------------------------------------- /example/android/app/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /example/android/app/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | app 4 | Project app created by Buildship. 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.buildship.core.gradleprojectbuilder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | org.eclipse.buildship.core.gradleprojectnature 22 | 23 | 24 | -------------------------------------------------------------------------------- /example/android/app/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 "com.jlcool.aliossflutterexample" 37 | minSdkVersion 16 38 | targetSdkVersion 28 39 | versionCode flutterVersionCode.toInteger() 40 | versionName flutterVersionName 41 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 42 | } 43 | 44 | buildTypes { 45 | release { 46 | // TODO: Add your own signing config for the release build. 47 | // Signing with the debug keys for now, so `flutter run --release` works. 48 | signingConfig signingConfigs.debug 49 | } 50 | } 51 | } 52 | 53 | flutter { 54 | source '../..' 55 | } 56 | 57 | dependencies { 58 | testImplementation 'junit:junit:4.12' 59 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 60 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 61 | } 62 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 8 | 9 | 14 | 19 | 26 | 30 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /example/android/app/src/main/java/com/jlcool/aliossflutterexample/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.jlcool.aliossflutterexample; 2 | 3 | import android.os.Bundle; 4 | import io.flutter.app.FlutterActivity; 5 | import io.flutter.plugins.GeneratedPluginRegistrant; 6 | 7 | public class MainActivity extends FlutterActivity { 8 | @Override 9 | protected void onCreate(Bundle savedInstanceState) { 10 | super.onCreate(savedInstanceState); 11 | GeneratedPluginRegistrant.registerWith(this); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jlcool/aliossflutter/2dfbae1cce461b44b3b8e86cb5b4daa1285b720f/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/jlcool/aliossflutter/2dfbae1cce461b44b3b8e86cb5b4daa1285b720f/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/jlcool/aliossflutter/2dfbae1cce461b44b3b8e86cb5b4daa1285b720f/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/jlcool/aliossflutter/2dfbae1cce461b44b3b8e86cb5b4daa1285b720f/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/jlcool/aliossflutter/2dfbae1cce461b44b3b8e86cb5b4daa1285b720f/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | google() 4 | jcenter() 5 | } 6 | 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:3.2.1' 9 | } 10 | } 11 | 12 | allprojects { 13 | repositories { 14 | google() 15 | jcenter() 16 | } 17 | } 18 | 19 | rootProject.buildDir = '../build' 20 | subprojects { 21 | project.buildDir = "${rootProject.buildDir}/${project.name}" 22 | } 23 | subprojects { 24 | project.evaluationDependsOn(':app') 25 | } 26 | 27 | task clean(type: Delete) { 28 | delete rootProject.buildDir 29 | } 30 | -------------------------------------------------------------------------------- /example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.enableR8=true 3 | -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip 7 | -------------------------------------------------------------------------------- /example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() 4 | 5 | def plugins = new Properties() 6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') 7 | if (pluginsFile.exists()) { 8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } 9 | } 10 | 11 | plugins.each { name, path -> 12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() 13 | include ":$name" 14 | project(":$name").projectDir = pluginDirectory 15 | } 16 | -------------------------------------------------------------------------------- /example/ios/Flutter/.last_build_id: -------------------------------------------------------------------------------- 1 | 9e4e0406759ff45f5b8811d0e05d8531 -------------------------------------------------------------------------------- /example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/ios/Flutter/Flutter.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE: This podspec is NOT to be published. It is only used as a local source! 3 | # 4 | 5 | Pod::Spec.new do |s| 6 | s.name = 'Flutter' 7 | s.version = '1.0.0' 8 | s.summary = 'High-performance, high-fidelity mobile apps.' 9 | s.description = <<-DESC 10 | Flutter provides an easy and productive way to build and deploy high-performance mobile apps for Android and iOS. 11 | DESC 12 | s.homepage = 'https://flutter.io' 13 | s.license = { :type => 'MIT' } 14 | s.author = { 'Flutter Dev Team' => 'flutter-dev@googlegroups.com' } 15 | s.source = { :git => 'https://github.com/flutter/engine', :tag => s.version.to_s } 16 | s.ios.deployment_target = '8.0' 17 | s.vendored_frameworks = 'Flutter.framework' 18 | end 19 | -------------------------------------------------------------------------------- /example/ios/Flutter/Generated.xcconfig: -------------------------------------------------------------------------------- 1 | // This is a generated file; do not edit or check into version control. 2 | FLUTTER_ROOT=/Users/jiangliang/development/flutter 3 | FLUTTER_APPLICATION_PATH=/Users/jiangliang/FlutterProjects/github/aliossflutter/example 4 | FLUTTER_TARGET=lib/main.dart 5 | FLUTTER_BUILD_DIR=build 6 | SYMROOT=${SOURCE_ROOT}/../build/ios 7 | OTHER_LDFLAGS=$(inherited) -framework Flutter 8 | FLUTTER_FRAMEWORK_DIR=/Users/jiangliang/development/flutter/bin/cache/artifacts/engine/ios 9 | FLUTTER_BUILD_NAME=1.0.0 10 | FLUTTER_BUILD_NUMBER=1 11 | DART_OBFUSCATION=false 12 | TRACK_WIDGET_CREATION=false 13 | TREE_SHAKE_ICONS=false 14 | PACKAGE_CONFIG=.packages 15 | -------------------------------------------------------------------------------- /example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/ios/Flutter/flutter_export_environment.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # This is a generated file; do not edit or check into version control. 3 | export "FLUTTER_ROOT=/Users/jiangliang/development/flutter" 4 | export "FLUTTER_APPLICATION_PATH=/Users/jiangliang/FlutterProjects/github/aliossflutter/example" 5 | export "FLUTTER_TARGET=lib/main.dart" 6 | export "FLUTTER_BUILD_DIR=build" 7 | export "SYMROOT=${SOURCE_ROOT}/../build/ios" 8 | export "OTHER_LDFLAGS=$(inherited) -framework Flutter" 9 | export "FLUTTER_FRAMEWORK_DIR=/Users/jiangliang/development/flutter/bin/cache/artifacts/engine/ios" 10 | export "FLUTTER_BUILD_NAME=1.0.0" 11 | export "FLUTTER_BUILD_NUMBER=1" 12 | export "DART_OBFUSCATION=false" 13 | export "TRACK_WIDGET_CREATION=false" 14 | export "TREE_SHAKE_ICONS=false" 15 | export "PACKAGE_CONFIG=.packages" 16 | -------------------------------------------------------------------------------- /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 | generated_key_values = {} 19 | skip_line_start_symbols = ["#", "/"] 20 | File.foreach(file_abs_path) do |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 | generated_key_values[podname] = podpath 28 | else 29 | puts "Invalid plugin specification: #{line}" 30 | end 31 | end 32 | generated_key_values 33 | end 34 | 35 | target 'Runner' do 36 | # Flutter Pod 37 | 38 | copied_flutter_dir = File.join(__dir__, 'Flutter') 39 | copied_framework_path = File.join(copied_flutter_dir, 'Flutter.framework') 40 | copied_podspec_path = File.join(copied_flutter_dir, 'Flutter.podspec') 41 | unless File.exist?(copied_framework_path) && File.exist?(copied_podspec_path) 42 | # Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet. 43 | # That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration. 44 | # CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist. 45 | 46 | generated_xcode_build_settings_path = File.join(copied_flutter_dir, 'Generated.xcconfig') 47 | unless File.exist?(generated_xcode_build_settings_path) 48 | raise "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first" 49 | end 50 | generated_xcode_build_settings = parse_KV_file(generated_xcode_build_settings_path) 51 | cached_framework_dir = generated_xcode_build_settings['FLUTTER_FRAMEWORK_DIR']; 52 | 53 | unless File.exist?(copied_framework_path) 54 | FileUtils.cp_r(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir) 55 | end 56 | unless File.exist?(copied_podspec_path) 57 | FileUtils.cp(File.join(cached_framework_dir, 'Flutter.podspec'), copied_flutter_dir) 58 | end 59 | end 60 | 61 | # Keep pod path relative so it can be checked into Podfile.lock. 62 | pod 'Flutter', :path => 'Flutter' 63 | 64 | # Plugin Pods 65 | 66 | # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock 67 | # referring to absolute paths on developers' machines. 68 | system('rm -rf .symlinks') 69 | system('mkdir -p .symlinks/plugins') 70 | plugin_pods = parse_KV_file('../.flutter-plugins') 71 | plugin_pods.each do |name, path| 72 | symlink = File.join('.symlinks', 'plugins', name) 73 | File.symlink(path, symlink) 74 | pod name, :path => File.join(symlink, 'ios') 75 | end 76 | end 77 | 78 | post_install do |installer| 79 | installer.pods_project.targets.each do |target| 80 | target.build_configurations.each do |config| 81 | config.build_settings['ENABLE_BITCODE'] = 'NO' 82 | end 83 | end 84 | end 85 | -------------------------------------------------------------------------------- /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 | 88BC9741BDDBC0B823578764 /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C115BCFF6CBDDC1E14E20135 /* libPods-Runner.a */; }; 13 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; }; 14 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; 15 | 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; 16 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 17 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 18 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 19 | /* End PBXBuildFile section */ 20 | 21 | /* Begin PBXCopyFilesBuildPhase section */ 22 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 23 | isa = PBXCopyFilesBuildPhase; 24 | buildActionMask = 2147483647; 25 | dstPath = ""; 26 | dstSubfolderSpec = 10; 27 | files = ( 28 | ); 29 | name = "Embed Frameworks"; 30 | runOnlyForDeploymentPostprocessing = 0; 31 | }; 32 | /* End PBXCopyFilesBuildPhase section */ 33 | 34 | /* Begin PBXFileReference section */ 35 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 36 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 37 | 32BDF36FEBA895C834515138 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Pods/Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; 38 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 39 | 6DE13942677E2761C1C15D60 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 40 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 41 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 42 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 43 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 44 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 45 | 977C5C6EA15C49A4ABB94063 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 46 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 47 | 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 48 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 49 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 50 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 51 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 52 | C115BCFF6CBDDC1E14E20135 /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 53 | /* End PBXFileReference section */ 54 | 55 | /* Begin PBXFrameworksBuildPhase section */ 56 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 57 | isa = PBXFrameworksBuildPhase; 58 | buildActionMask = 2147483647; 59 | files = ( 60 | 88BC9741BDDBC0B823578764 /* libPods-Runner.a in Frameworks */, 61 | ); 62 | runOnlyForDeploymentPostprocessing = 0; 63 | }; 64 | /* End PBXFrameworksBuildPhase section */ 65 | 66 | /* Begin PBXGroup section */ 67 | 0C5220913B096F05C8E438EC /* Frameworks */ = { 68 | isa = PBXGroup; 69 | children = ( 70 | C115BCFF6CBDDC1E14E20135 /* libPods-Runner.a */, 71 | ); 72 | name = Frameworks; 73 | sourceTree = ""; 74 | }; 75 | 9740EEB11CF90186004384FC /* Flutter */ = { 76 | isa = PBXGroup; 77 | children = ( 78 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 79 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 80 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 81 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 82 | ); 83 | name = Flutter; 84 | sourceTree = ""; 85 | }; 86 | 97C146E51CF9000F007C117D = { 87 | isa = PBXGroup; 88 | children = ( 89 | 9740EEB11CF90186004384FC /* Flutter */, 90 | 97C146F01CF9000F007C117D /* Runner */, 91 | 97C146EF1CF9000F007C117D /* Products */, 92 | E08A116DAB0ACB0D716B8700 /* Pods */, 93 | 0C5220913B096F05C8E438EC /* Frameworks */, 94 | ); 95 | sourceTree = ""; 96 | }; 97 | 97C146EF1CF9000F007C117D /* Products */ = { 98 | isa = PBXGroup; 99 | children = ( 100 | 97C146EE1CF9000F007C117D /* Runner.app */, 101 | ); 102 | name = Products; 103 | sourceTree = ""; 104 | }; 105 | 97C146F01CF9000F007C117D /* Runner */ = { 106 | isa = PBXGroup; 107 | children = ( 108 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */, 109 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */, 110 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 111 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 112 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 113 | 97C147021CF9000F007C117D /* Info.plist */, 114 | 97C146F11CF9000F007C117D /* Supporting Files */, 115 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 116 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 117 | ); 118 | path = Runner; 119 | sourceTree = ""; 120 | }; 121 | 97C146F11CF9000F007C117D /* Supporting Files */ = { 122 | isa = PBXGroup; 123 | children = ( 124 | 97C146F21CF9000F007C117D /* main.m */, 125 | ); 126 | name = "Supporting Files"; 127 | sourceTree = ""; 128 | }; 129 | E08A116DAB0ACB0D716B8700 /* Pods */ = { 130 | isa = PBXGroup; 131 | children = ( 132 | 6DE13942677E2761C1C15D60 /* Pods-Runner.debug.xcconfig */, 133 | 977C5C6EA15C49A4ABB94063 /* Pods-Runner.release.xcconfig */, 134 | 32BDF36FEBA895C834515138 /* Pods-Runner.profile.xcconfig */, 135 | ); 136 | name = Pods; 137 | sourceTree = ""; 138 | }; 139 | /* End PBXGroup section */ 140 | 141 | /* Begin PBXNativeTarget section */ 142 | 97C146ED1CF9000F007C117D /* Runner */ = { 143 | isa = PBXNativeTarget; 144 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 145 | buildPhases = ( 146 | 13E2F37E3EEB0D1B41C6554E /* [CP] Check Pods Manifest.lock */, 147 | 9740EEB61CF901F6004384FC /* Run Script */, 148 | 97C146EA1CF9000F007C117D /* Sources */, 149 | 97C146EB1CF9000F007C117D /* Frameworks */, 150 | 97C146EC1CF9000F007C117D /* Resources */, 151 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 152 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 153 | 59F24CEF61BB61B6B33689ED /* [CP] Embed Pods Frameworks */, 154 | ); 155 | buildRules = ( 156 | ); 157 | dependencies = ( 158 | ); 159 | name = Runner; 160 | productName = Runner; 161 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 162 | productType = "com.apple.product-type.application"; 163 | }; 164 | /* End PBXNativeTarget section */ 165 | 166 | /* Begin PBXProject section */ 167 | 97C146E61CF9000F007C117D /* Project object */ = { 168 | isa = PBXProject; 169 | attributes = { 170 | LastUpgradeCheck = 0910; 171 | ORGANIZATIONNAME = "The Chromium Authors"; 172 | TargetAttributes = { 173 | 97C146ED1CF9000F007C117D = { 174 | CreatedOnToolsVersion = 7.3.1; 175 | DevelopmentTeam = YJV4N2CBA3; 176 | }; 177 | }; 178 | }; 179 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 180 | compatibilityVersion = "Xcode 3.2"; 181 | developmentRegion = English; 182 | hasScannedForEncodings = 0; 183 | knownRegions = ( 184 | en, 185 | Base, 186 | ); 187 | mainGroup = 97C146E51CF9000F007C117D; 188 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 189 | projectDirPath = ""; 190 | projectRoot = ""; 191 | targets = ( 192 | 97C146ED1CF9000F007C117D /* Runner */, 193 | ); 194 | }; 195 | /* End PBXProject section */ 196 | 197 | /* Begin PBXResourcesBuildPhase section */ 198 | 97C146EC1CF9000F007C117D /* Resources */ = { 199 | isa = PBXResourcesBuildPhase; 200 | buildActionMask = 2147483647; 201 | files = ( 202 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 203 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 204 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */, 205 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 206 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 207 | ); 208 | runOnlyForDeploymentPostprocessing = 0; 209 | }; 210 | /* End PBXResourcesBuildPhase section */ 211 | 212 | /* Begin PBXShellScriptBuildPhase section */ 213 | 13E2F37E3EEB0D1B41C6554E /* [CP] Check Pods Manifest.lock */ = { 214 | isa = PBXShellScriptBuildPhase; 215 | buildActionMask = 2147483647; 216 | files = ( 217 | ); 218 | inputFileListPaths = ( 219 | ); 220 | inputPaths = ( 221 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 222 | "${PODS_ROOT}/Manifest.lock", 223 | ); 224 | name = "[CP] Check Pods Manifest.lock"; 225 | outputFileListPaths = ( 226 | ); 227 | outputPaths = ( 228 | "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", 229 | ); 230 | runOnlyForDeploymentPostprocessing = 0; 231 | shellPath = /bin/sh; 232 | 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"; 233 | showEnvVarsInLog = 0; 234 | }; 235 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 236 | isa = PBXShellScriptBuildPhase; 237 | buildActionMask = 2147483647; 238 | files = ( 239 | ); 240 | inputPaths = ( 241 | ); 242 | name = "Thin Binary"; 243 | outputPaths = ( 244 | ); 245 | runOnlyForDeploymentPostprocessing = 0; 246 | shellPath = /bin/sh; 247 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; 248 | }; 249 | 59F24CEF61BB61B6B33689ED /* [CP] Embed Pods Frameworks */ = { 250 | isa = PBXShellScriptBuildPhase; 251 | buildActionMask = 2147483647; 252 | files = ( 253 | ); 254 | inputPaths = ( 255 | "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh", 256 | "${PODS_ROOT}/../Flutter/Flutter.framework", 257 | ); 258 | name = "[CP] Embed Pods Frameworks"; 259 | outputPaths = ( 260 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework", 261 | ); 262 | runOnlyForDeploymentPostprocessing = 0; 263 | shellPath = /bin/sh; 264 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; 265 | showEnvVarsInLog = 0; 266 | }; 267 | 9740EEB61CF901F6004384FC /* Run Script */ = { 268 | isa = PBXShellScriptBuildPhase; 269 | buildActionMask = 2147483647; 270 | files = ( 271 | ); 272 | inputPaths = ( 273 | ); 274 | name = "Run Script"; 275 | outputPaths = ( 276 | ); 277 | runOnlyForDeploymentPostprocessing = 0; 278 | shellPath = /bin/sh; 279 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 280 | }; 281 | /* End PBXShellScriptBuildPhase section */ 282 | 283 | /* Begin PBXSourcesBuildPhase section */ 284 | 97C146EA1CF9000F007C117D /* Sources */ = { 285 | isa = PBXSourcesBuildPhase; 286 | buildActionMask = 2147483647; 287 | files = ( 288 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */, 289 | 97C146F31CF9000F007C117D /* main.m in Sources */, 290 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 291 | ); 292 | runOnlyForDeploymentPostprocessing = 0; 293 | }; 294 | /* End PBXSourcesBuildPhase section */ 295 | 296 | /* Begin PBXVariantGroup section */ 297 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 298 | isa = PBXVariantGroup; 299 | children = ( 300 | 97C146FB1CF9000F007C117D /* Base */, 301 | ); 302 | name = Main.storyboard; 303 | sourceTree = ""; 304 | }; 305 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 306 | isa = PBXVariantGroup; 307 | children = ( 308 | 97C147001CF9000F007C117D /* Base */, 309 | ); 310 | name = LaunchScreen.storyboard; 311 | sourceTree = ""; 312 | }; 313 | /* End PBXVariantGroup section */ 314 | 315 | /* Begin XCBuildConfiguration section */ 316 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 317 | isa = XCBuildConfiguration; 318 | buildSettings = { 319 | ALWAYS_SEARCH_USER_PATHS = NO; 320 | CLANG_ANALYZER_NONNULL = YES; 321 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 322 | CLANG_CXX_LIBRARY = "libc++"; 323 | CLANG_ENABLE_MODULES = YES; 324 | CLANG_ENABLE_OBJC_ARC = YES; 325 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 326 | CLANG_WARN_BOOL_CONVERSION = YES; 327 | CLANG_WARN_COMMA = YES; 328 | CLANG_WARN_CONSTANT_CONVERSION = YES; 329 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 330 | CLANG_WARN_EMPTY_BODY = YES; 331 | CLANG_WARN_ENUM_CONVERSION = YES; 332 | CLANG_WARN_INFINITE_RECURSION = YES; 333 | CLANG_WARN_INT_CONVERSION = YES; 334 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 335 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 336 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 337 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 338 | CLANG_WARN_STRICT_PROTOTYPES = YES; 339 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 340 | CLANG_WARN_UNREACHABLE_CODE = YES; 341 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 342 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 343 | COPY_PHASE_STRIP = NO; 344 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 345 | ENABLE_NS_ASSERTIONS = NO; 346 | ENABLE_STRICT_OBJC_MSGSEND = YES; 347 | GCC_C_LANGUAGE_STANDARD = gnu99; 348 | GCC_NO_COMMON_BLOCKS = YES; 349 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 350 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 351 | GCC_WARN_UNDECLARED_SELECTOR = YES; 352 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 353 | GCC_WARN_UNUSED_FUNCTION = YES; 354 | GCC_WARN_UNUSED_VARIABLE = YES; 355 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 356 | MTL_ENABLE_DEBUG_INFO = NO; 357 | SDKROOT = iphoneos; 358 | TARGETED_DEVICE_FAMILY = "1,2"; 359 | VALIDATE_PRODUCT = YES; 360 | }; 361 | name = Profile; 362 | }; 363 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 364 | isa = XCBuildConfiguration; 365 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 366 | buildSettings = { 367 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 368 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 369 | DEVELOPMENT_TEAM = YJV4N2CBA3; 370 | ENABLE_BITCODE = NO; 371 | FRAMEWORK_SEARCH_PATHS = ( 372 | "$(inherited)", 373 | "$(PROJECT_DIR)/Flutter", 374 | ); 375 | INFOPLIST_FILE = Runner/Info.plist; 376 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 377 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 378 | LIBRARY_SEARCH_PATHS = ( 379 | "$(inherited)", 380 | "$(PROJECT_DIR)/Flutter", 381 | ); 382 | PRODUCT_BUNDLE_IDENTIFIER = com.jlcool.aliossflutterExample; 383 | PRODUCT_NAME = "$(TARGET_NAME)"; 384 | VERSIONING_SYSTEM = "apple-generic"; 385 | }; 386 | name = Profile; 387 | }; 388 | 97C147031CF9000F007C117D /* Debug */ = { 389 | isa = XCBuildConfiguration; 390 | buildSettings = { 391 | ALWAYS_SEARCH_USER_PATHS = NO; 392 | CLANG_ANALYZER_NONNULL = YES; 393 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 394 | CLANG_CXX_LIBRARY = "libc++"; 395 | CLANG_ENABLE_MODULES = YES; 396 | CLANG_ENABLE_OBJC_ARC = YES; 397 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 398 | CLANG_WARN_BOOL_CONVERSION = YES; 399 | CLANG_WARN_COMMA = YES; 400 | CLANG_WARN_CONSTANT_CONVERSION = YES; 401 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 402 | CLANG_WARN_EMPTY_BODY = YES; 403 | CLANG_WARN_ENUM_CONVERSION = YES; 404 | CLANG_WARN_INFINITE_RECURSION = YES; 405 | CLANG_WARN_INT_CONVERSION = YES; 406 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 407 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 408 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 409 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 410 | CLANG_WARN_STRICT_PROTOTYPES = YES; 411 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 412 | CLANG_WARN_UNREACHABLE_CODE = YES; 413 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 414 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 415 | COPY_PHASE_STRIP = NO; 416 | DEBUG_INFORMATION_FORMAT = dwarf; 417 | ENABLE_STRICT_OBJC_MSGSEND = YES; 418 | ENABLE_TESTABILITY = YES; 419 | GCC_C_LANGUAGE_STANDARD = gnu99; 420 | GCC_DYNAMIC_NO_PIC = NO; 421 | GCC_NO_COMMON_BLOCKS = YES; 422 | GCC_OPTIMIZATION_LEVEL = 0; 423 | GCC_PREPROCESSOR_DEFINITIONS = ( 424 | "DEBUG=1", 425 | "$(inherited)", 426 | ); 427 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 428 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 429 | GCC_WARN_UNDECLARED_SELECTOR = YES; 430 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 431 | GCC_WARN_UNUSED_FUNCTION = YES; 432 | GCC_WARN_UNUSED_VARIABLE = YES; 433 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 434 | MTL_ENABLE_DEBUG_INFO = YES; 435 | ONLY_ACTIVE_ARCH = YES; 436 | SDKROOT = iphoneos; 437 | TARGETED_DEVICE_FAMILY = "1,2"; 438 | }; 439 | name = Debug; 440 | }; 441 | 97C147041CF9000F007C117D /* Release */ = { 442 | isa = XCBuildConfiguration; 443 | buildSettings = { 444 | ALWAYS_SEARCH_USER_PATHS = NO; 445 | CLANG_ANALYZER_NONNULL = YES; 446 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 447 | CLANG_CXX_LIBRARY = "libc++"; 448 | CLANG_ENABLE_MODULES = YES; 449 | CLANG_ENABLE_OBJC_ARC = YES; 450 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 451 | CLANG_WARN_BOOL_CONVERSION = YES; 452 | CLANG_WARN_COMMA = YES; 453 | CLANG_WARN_CONSTANT_CONVERSION = YES; 454 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 455 | CLANG_WARN_EMPTY_BODY = YES; 456 | CLANG_WARN_ENUM_CONVERSION = YES; 457 | CLANG_WARN_INFINITE_RECURSION = YES; 458 | CLANG_WARN_INT_CONVERSION = YES; 459 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 460 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 461 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 462 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 463 | CLANG_WARN_STRICT_PROTOTYPES = YES; 464 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 465 | CLANG_WARN_UNREACHABLE_CODE = YES; 466 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 467 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 468 | COPY_PHASE_STRIP = NO; 469 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 470 | ENABLE_NS_ASSERTIONS = NO; 471 | ENABLE_STRICT_OBJC_MSGSEND = YES; 472 | GCC_C_LANGUAGE_STANDARD = gnu99; 473 | GCC_NO_COMMON_BLOCKS = YES; 474 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 475 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 476 | GCC_WARN_UNDECLARED_SELECTOR = YES; 477 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 478 | GCC_WARN_UNUSED_FUNCTION = YES; 479 | GCC_WARN_UNUSED_VARIABLE = YES; 480 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 481 | MTL_ENABLE_DEBUG_INFO = NO; 482 | SDKROOT = iphoneos; 483 | TARGETED_DEVICE_FAMILY = "1,2"; 484 | VALIDATE_PRODUCT = YES; 485 | }; 486 | name = Release; 487 | }; 488 | 97C147061CF9000F007C117D /* Debug */ = { 489 | isa = XCBuildConfiguration; 490 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 491 | buildSettings = { 492 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 493 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 494 | DEVELOPMENT_TEAM = YJV4N2CBA3; 495 | ENABLE_BITCODE = NO; 496 | FRAMEWORK_SEARCH_PATHS = ( 497 | "$(inherited)", 498 | "$(PROJECT_DIR)/Flutter", 499 | ); 500 | INFOPLIST_FILE = Runner/Info.plist; 501 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 502 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 503 | LIBRARY_SEARCH_PATHS = ( 504 | "$(inherited)", 505 | "$(PROJECT_DIR)/Flutter", 506 | ); 507 | PRODUCT_BUNDLE_IDENTIFIER = com.jlcool.aliossflutterExample; 508 | PRODUCT_NAME = "$(TARGET_NAME)"; 509 | VERSIONING_SYSTEM = "apple-generic"; 510 | }; 511 | name = Debug; 512 | }; 513 | 97C147071CF9000F007C117D /* Release */ = { 514 | isa = XCBuildConfiguration; 515 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 516 | buildSettings = { 517 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 518 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 519 | DEVELOPMENT_TEAM = YJV4N2CBA3; 520 | ENABLE_BITCODE = NO; 521 | FRAMEWORK_SEARCH_PATHS = ( 522 | "$(inherited)", 523 | "$(PROJECT_DIR)/Flutter", 524 | ); 525 | INFOPLIST_FILE = Runner/Info.plist; 526 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 527 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 528 | LIBRARY_SEARCH_PATHS = ( 529 | "$(inherited)", 530 | "$(PROJECT_DIR)/Flutter", 531 | ); 532 | PRODUCT_BUNDLE_IDENTIFIER = com.jlcool.aliossflutterExample; 533 | PRODUCT_NAME = "$(TARGET_NAME)"; 534 | VERSIONING_SYSTEM = "apple-generic"; 535 | }; 536 | name = Release; 537 | }; 538 | /* End XCBuildConfiguration section */ 539 | 540 | /* Begin XCConfigurationList section */ 541 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 542 | isa = XCConfigurationList; 543 | buildConfigurations = ( 544 | 97C147031CF9000F007C117D /* Debug */, 545 | 97C147041CF9000F007C117D /* Release */, 546 | 249021D3217E4FDB00AE95B9 /* Profile */, 547 | ); 548 | defaultConfigurationIsVisible = 0; 549 | defaultConfigurationName = Release; 550 | }; 551 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 552 | isa = XCConfigurationList; 553 | buildConfigurations = ( 554 | 97C147061CF9000F007C117D /* Debug */, 555 | 97C147071CF9000F007C117D /* Release */, 556 | 249021D4217E4FDB00AE95B9 /* Profile */, 557 | ); 558 | defaultConfigurationIsVisible = 0; 559 | defaultConfigurationName = Release; 560 | }; 561 | /* End XCConfigurationList section */ 562 | }; 563 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 564 | } 565 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 33 | 34 | 40 | 41 | 42 | 43 | 44 | 45 | 56 | 58 | 64 | 65 | 66 | 67 | 68 | 69 | 75 | 77 | 83 | 84 | 85 | 86 | 88 | 89 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner/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/jlcool/aliossflutter/2dfbae1cce461b44b3b8e86cb5b4daa1285b720f/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/jlcool/aliossflutter/2dfbae1cce461b44b3b8e86cb5b4daa1285b720f/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/jlcool/aliossflutter/2dfbae1cce461b44b3b8e86cb5b4daa1285b720f/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/jlcool/aliossflutter/2dfbae1cce461b44b3b8e86cb5b4daa1285b720f/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/jlcool/aliossflutter/2dfbae1cce461b44b3b8e86cb5b4daa1285b720f/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/jlcool/aliossflutter/2dfbae1cce461b44b3b8e86cb5b4daa1285b720f/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/jlcool/aliossflutter/2dfbae1cce461b44b3b8e86cb5b4daa1285b720f/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/jlcool/aliossflutter/2dfbae1cce461b44b3b8e86cb5b4daa1285b720f/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/jlcool/aliossflutter/2dfbae1cce461b44b3b8e86cb5b4daa1285b720f/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/jlcool/aliossflutter/2dfbae1cce461b44b3b8e86cb5b4daa1285b720f/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/jlcool/aliossflutter/2dfbae1cce461b44b3b8e86cb5b4daa1285b720f/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/jlcool/aliossflutter/2dfbae1cce461b44b3b8e86cb5b4daa1285b720f/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/jlcool/aliossflutter/2dfbae1cce461b44b3b8e86cb5b4daa1285b720f/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/jlcool/aliossflutter/2dfbae1cce461b44b3b8e86cb5b4daa1285b720f/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/jlcool/aliossflutter/2dfbae1cce461b44b3b8e86cb5b4daa1285b720f/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/jlcool/aliossflutter/2dfbae1cce461b44b3b8e86cb5b4daa1285b720f/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jlcool/aliossflutter/2dfbae1cce461b44b3b8e86cb5b4daa1285b720f/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jlcool/aliossflutter/2dfbae1cce461b44b3b8e86cb5b4daa1285b720f/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/GeneratedPluginRegistrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | #ifndef GeneratedPluginRegistrant_h 6 | #define GeneratedPluginRegistrant_h 7 | 8 | #import 9 | 10 | NS_ASSUME_NONNULL_BEGIN 11 | 12 | @interface GeneratedPluginRegistrant : NSObject 13 | + (void)registerWithRegistry:(NSObject*)registry; 14 | @end 15 | 16 | NS_ASSUME_NONNULL_END 17 | #endif /* GeneratedPluginRegistrant_h */ 18 | -------------------------------------------------------------------------------- /example/ios/Runner/GeneratedPluginRegistrant.m: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | #import "GeneratedPluginRegistrant.h" 6 | 7 | #if __has_include() 8 | #import 9 | #else 10 | @import aliossflutter; 11 | #endif 12 | 13 | @implementation GeneratedPluginRegistrant 14 | 15 | + (void)registerWithRegistry:(NSObject*)registry { 16 | [AliossflutterPlugin registerWithRegistrar:[registry registrarForPlugin:@"AliossflutterPlugin"]]; 17 | } 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /example/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | aliossflutter_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 | 45 | 46 | -------------------------------------------------------------------------------- /example/ios/Runner/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import "AppDelegate.h" 4 | 5 | int main(int argc, char* argv[]) { 6 | @autoreleasepool { 7 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'dart:io'; 3 | import 'package:aliossflutter/aliossflutter.dart'; 4 | 5 | void main() => runApp(MyApp()); 6 | 7 | class MyApp extends StatefulWidget { 8 | @override 9 | _MyAppState createState() => _MyAppState(); 10 | } 11 | 12 | class _MyAppState extends State { 13 | String _msg = "消息"; 14 | double _progress = 0; 15 | String _rs = ""; 16 | AliOSSFlutter alioss = AliOSSFlutter(); 17 | String _path = ""; 18 | 19 | String stsserver = ""; 20 | String endpoint = ""; 21 | String cryptkey = ""; 22 | String bucket = ""; 23 | String key = "bbb.jpg"; 24 | String callbackUrl = ""; 25 | String callbackHost = ""; 26 | 27 | ///支持 application/x-www-form-urlencoded 和application/json 28 | String callbackBodyType = "application/json"; 29 | String callbackBody = 30 | "{\"j_bucket\":\${bucket},\"j_object\":\${object},\"j_etag\":\${etag},\"j_size\":\${size},\"j_mimeType\":\${mimeType},\"j_height\":\${imageInfo.height},\"j_width\":\${imageInfo.width},\"j_format\":\${imageInfo.format},\"j_memberId\":\${x:var1}}"; 31 | String callbackVars = "{\"x:var1\":\"123\"}"; 32 | 33 | @override 34 | void initState() { 35 | super.initState(); 36 | 37 | alioss.responseFromProgress.listen((data) { 38 | if (data.key == key) { 39 | print("_progress:" + data.getProgress().toString()); 40 | setState(() { 41 | _progress = data.getProgress(); 42 | }); 43 | } 44 | }); 45 | alioss.responseFromInit.listen((data) { 46 | if (data) { 47 | setState(() { 48 | _msg = "初始化成功"; 49 | }); 50 | } else { 51 | setState(() { 52 | _msg = "初始化失败"; 53 | }); 54 | } 55 | }); 56 | alioss.responseFromSign.listen((data) { 57 | if (data.success) { 58 | setState(() { 59 | _msg = "url 签名 :" + data.url; 60 | }); 61 | } else { 62 | setState(() { 63 | _msg = "url 签名失败"; 64 | }); 65 | } 66 | }); 67 | alioss.responseFromUpload.listen((data) { 68 | if (data.success) { 69 | setState(() { 70 | _msg = "上传成功 key:" + data.key + " 服务器返回值:" + data.servercallback; 71 | }); 72 | } else { 73 | setState(() { 74 | _msg = "上传失败" + data.msg; 75 | }); 76 | } 77 | }); 78 | alioss.responseFromDownload.listen((data) { 79 | if (data.success) { 80 | setState(() { 81 | _path = data.path; 82 | _msg = "下载成功:" + _path; 83 | }); 84 | } else { 85 | setState(() { 86 | _msg = "下载失败"; 87 | }); 88 | } 89 | }); 90 | alioss.responseFromDelete.listen((data) { 91 | if (data.success) { 92 | setState(() { 93 | _msg = data.key + "删除成功"; 94 | }); 95 | } else { 96 | setState(() { 97 | _msg = data.key + "删除失败"; 98 | }); 99 | } 100 | }); 101 | 102 | alioss.responseFromListObjects.listen((data) { 103 | if (data.success) { 104 | data.objects.forEach((element) { 105 | _msg += "${element["Key"]} \n"; 106 | }); 107 | setState(() {}); 108 | } else { 109 | setState(() { 110 | _msg = "获取失败"; 111 | }); 112 | } 113 | }); 114 | } 115 | 116 | void _init() async { 117 | //初始化 118 | alioss.init(stsserver, endpoint, 119 | cryptkey: cryptkey, 120 | crypttype: "aes"); //,cryptkey: cryptkey,crypttype: "aes" 121 | //或者 122 | //alioss.secretInit("","",""); 123 | } 124 | 125 | void _uploadPic() async { 126 | String filePath = ""; 127 | alioss.upload(bucket, filePath, key, 128 | callbackBody: callbackBody, 129 | callbackBodyType: callbackBodyType, 130 | callbackHost: callbackHost, 131 | callbackUrl: callbackUrl, 132 | callbackVars: callbackVars); 133 | } 134 | 135 | void _sign() async { 136 | alioss.signUrl(bucket, key, type: "1"); 137 | } 138 | 139 | void _des() async { 140 | alioss.des(cryptkey, "encrypt", "123").then((data) { 141 | setState(() { 142 | _rs = data; 143 | _msg = "123加密后:" + data; 144 | }); 145 | }); 146 | } 147 | 148 | void _des1() async { 149 | alioss.des(cryptkey, "decrypt", _rs).then((data) { 150 | setState(() { 151 | _msg = _rs + "解密后:" + data; 152 | }); 153 | }); 154 | } 155 | 156 | void _delete() async { 157 | alioss.delete(bucket, key); 158 | } 159 | 160 | void _listObjects() { 161 | alioss.listObjects("jiyi1"); 162 | } 163 | 164 | void _download() async { 165 | String downloadPath = ""; 166 | alioss.download(bucket, key, downloadPath + "/" + key); 167 | } 168 | 169 | void _exist() async { 170 | alioss.exist(bucket, key).then((exist) { 171 | if (exist) { 172 | _msg = "已存在"; 173 | } else if (!exist) { 174 | _msg = "不存在"; 175 | } 176 | setState(() {}); 177 | }).catchError((err) { 178 | _msg = "错误:$err"; 179 | setState(() {}); 180 | }); 181 | } 182 | 183 | @override 184 | Widget build(BuildContext context) { 185 | return MaterialApp( 186 | home: Scaffold( 187 | appBar: AppBar( 188 | title: const Text('AliOss Flutter Plugin'), 189 | ), 190 | body: SingleChildScrollView( 191 | child: Center( 192 | child: Column( 193 | mainAxisAlignment: MainAxisAlignment.center, 194 | children: [ 195 | Text(_msg), 196 | LinearProgressIndicator( 197 | value: _progress, 198 | ), 199 | MaterialButton( 200 | onPressed: _init, 201 | child: Text("初始化"), 202 | ), 203 | MaterialButton( 204 | onPressed: _uploadPic, 205 | child: Text("选择图片"), 206 | ), 207 | MaterialButton( 208 | onPressed: _exist, 209 | child: Text("是否存在"), 210 | ), 211 | MaterialButton( 212 | onPressed: _sign, 213 | child: Text("Url签名"), 214 | ), 215 | MaterialButton( 216 | onPressed: _download, 217 | child: Text("下载图片"), 218 | ), 219 | MaterialButton( 220 | onPressed: _des, 221 | child: Text("3des加密"), 222 | ), 223 | MaterialButton( 224 | onPressed: _des1, 225 | child: Text("3des解密"), 226 | ), 227 | MaterialButton( 228 | onPressed: _delete, 229 | child: Text("删除图片"), 230 | ), 231 | MaterialButton( 232 | onPressed: _listObjects, 233 | child: Text("列出文件"), 234 | ) 235 | ], 236 | ), 237 | ), 238 | )), 239 | ); 240 | } 241 | } 242 | -------------------------------------------------------------------------------- /example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: aliossflutter_example 2 | description: Demonstrates how to use the aliossflutter plugin. 3 | publish_to: 'none' 4 | 5 | environment: 6 | sdk: ">=2.0.0-dev.68.0 <3.0.0" 7 | 8 | dependencies: 9 | flutter: 10 | sdk: flutter 11 | 12 | # The following adds the Cupertino Icons font to your application. 13 | # Use with the CupertinoIcons class for iOS style icons. 14 | cupertino_icons: ^0.1.2 15 | 16 | dev_dependencies: 17 | flutter_test: 18 | sdk: flutter 19 | 20 | aliossflutter: 21 | path: ../ 22 | 23 | # For information on the generic Dart part of this file, see the 24 | # following page: https://www.dartlang.org/tools/pub/pubspec 25 | 26 | # The following section is specific to Flutter. 27 | flutter: 28 | 29 | # The following line ensures that the Material Icons font is 30 | # included with your application, so that you can use the icons in 31 | # the material Icons class. 32 | uses-material-design: true 33 | 34 | # To add assets to your application, add an assets section, like this: 35 | # assets: 36 | # - images/a_dot_burr.jpeg 37 | # - images/a_dot_ham.jpeg 38 | 39 | # An image asset can refer to one or more resolution-specific "variants", see 40 | # https://flutter.io/assets-and-images/#resolution-aware. 41 | 42 | # For details regarding adding assets from package dependencies, see 43 | # https://flutter.io/assets-and-images/#from-packages 44 | 45 | # To add custom fonts to your application, add a fonts section here, 46 | # in this "flutter" section. Each entry in this list should have a 47 | # "family" key with the font family name, and a "fonts" key with a 48 | # list giving the asset and other descriptors for the font. For 49 | # example: 50 | # fonts: 51 | # - family: Schyler 52 | # fonts: 53 | # - asset: fonts/Schyler-Regular.ttf 54 | # - asset: fonts/Schyler-Italic.ttf 55 | # style: italic 56 | # - family: Trajan Pro 57 | # fonts: 58 | # - asset: fonts/TrajanPro.ttf 59 | # - asset: fonts/TrajanPro_Bold.ttf 60 | # weight: 700 61 | # 62 | # For details regarding fonts from package dependencies, 63 | # see https://flutter.io/custom-fonts/#from-packages 64 | -------------------------------------------------------------------------------- /example/test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility that Flutter provides. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | 9 | void main() { 10 | 11 | } 12 | -------------------------------------------------------------------------------- /ios/.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | .vagrant/ 3 | .sconsign.dblite 4 | .svn/ 5 | 6 | .DS_Store 7 | *.swp 8 | profile 9 | 10 | DerivedData/ 11 | build/ 12 | GeneratedPluginRegistrant.h 13 | GeneratedPluginRegistrant.m 14 | 15 | .generated/ 16 | 17 | *.pbxuser 18 | *.mode1v3 19 | *.mode2v3 20 | *.perspectivev3 21 | 22 | !default.pbxuser 23 | !default.mode1v3 24 | !default.mode2v3 25 | !default.perspectivev3 26 | 27 | xcuserdata 28 | 29 | *.moved-aside 30 | 31 | *.pyc 32 | *sync/ 33 | Icon? 34 | .tags* 35 | 36 | /Flutter/Generated.xcconfig 37 | -------------------------------------------------------------------------------- /ios/Assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jlcool/aliossflutter/2dfbae1cce461b44b3b8e86cb5b4daa1285b720f/ios/Assets/.gitkeep -------------------------------------------------------------------------------- /ios/Classes/AESCipher/AESCipher.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | NSString * aesEncryptString(NSString *content, NSString *key); 4 | NSString * aesDecryptString(NSString *content, NSString *key); 5 | NSData * aesEncryptData(NSData *data, NSData *key); 6 | NSData * aesDecryptData(NSData *data, NSData *key); 7 | -------------------------------------------------------------------------------- /ios/Classes/AESCipher/AESCipher.m: -------------------------------------------------------------------------------- 1 | 2 | #import "AESCipher.h" 3 | #import 4 | 5 | NSString const *kInitVector = @"0000000000000000"; 6 | size_t const kKeySize = kCCKeySizeAES256; 7 | 8 | NSData * cipherOperation(NSData *contentData, NSData *keyData, CCOperation operation) { 9 | NSUInteger dataLength = contentData.length; 10 | 11 | void const *initVectorBytes = [kInitVector dataUsingEncoding:NSUTF8StringEncoding].bytes; 12 | void const *contentBytes = contentData.bytes; 13 | void const *keyBytes = keyData.bytes; 14 | 15 | size_t operationSize = dataLength + kCCBlockSizeAES128; 16 | void *operationBytes = malloc(operationSize); 17 | if (operationBytes == NULL) { 18 | return nil; 19 | } 20 | size_t actualOutSize = 0; 21 | 22 | CCCryptorStatus cryptStatus = CCCrypt(operation, 23 | kCCAlgorithmAES, 24 | kCCOptionPKCS7Padding, 25 | keyBytes, 26 | kKeySize, 27 | initVectorBytes, 28 | contentBytes, 29 | dataLength, 30 | operationBytes, 31 | operationSize, 32 | &actualOutSize); 33 | 34 | if (cryptStatus == kCCSuccess) { 35 | return [NSData dataWithBytesNoCopy:operationBytes length:actualOutSize]; 36 | } 37 | free(operationBytes); 38 | operationBytes = NULL; 39 | return nil; 40 | } 41 | 42 | NSString * aesEncryptString(NSString *content, NSString *key) { 43 | NSCParameterAssert(content); 44 | NSCParameterAssert(key); 45 | 46 | NSData *contentData = [content dataUsingEncoding:NSUTF8StringEncoding]; 47 | NSData *keyData = [key dataUsingEncoding:NSUTF8StringEncoding]; 48 | NSData *encrptedData = aesEncryptData(contentData, keyData); 49 | return [encrptedData base64EncodedStringWithOptions:NSDataBase64EncodingEndLineWithLineFeed]; 50 | } 51 | 52 | NSString * aesDecryptString(NSString *content, NSString *key) { 53 | NSCParameterAssert(content); 54 | NSCParameterAssert(key); 55 | 56 | NSData *contentData = [[NSData alloc] initWithBase64EncodedString:content options:NSDataBase64DecodingIgnoreUnknownCharacters]; 57 | NSData *keyData = [key dataUsingEncoding:NSUTF8StringEncoding]; 58 | NSData *decryptedData = aesDecryptData(contentData, keyData); 59 | return [[NSString alloc] initWithData:decryptedData encoding:NSUTF8StringEncoding]; 60 | } 61 | 62 | NSData * aesEncryptData(NSData *contentData, NSData *keyData) { 63 | NSCParameterAssert(contentData); 64 | NSCParameterAssert(keyData); 65 | 66 | NSString *hint = [NSString stringWithFormat:@"The key size of AES-%lu should be %lu bytes!", kKeySize * 8, kKeySize]; 67 | NSCAssert(keyData.length == kKeySize, hint); 68 | return cipherOperation(contentData, keyData, kCCEncrypt); 69 | } 70 | 71 | NSData * aesDecryptData(NSData *contentData, NSData *keyData) { 72 | NSCParameterAssert(contentData); 73 | NSCParameterAssert(keyData); 74 | 75 | NSString *hint = [NSString stringWithFormat:@"The key size of AES-%lu should be %lu bytes!", kKeySize * 8, kKeySize]; 76 | NSCAssert(keyData.length == kKeySize, hint); 77 | return cipherOperation(contentData, keyData, kCCDecrypt); 78 | } 79 | -------------------------------------------------------------------------------- /ios/Classes/AliossflutterPlugin.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface AliossflutterPlugin : NSObject; 4 | 5 | - (void)init:(FlutterMethodCall *)call result:(FlutterResult)result; 6 | - (void)update:(FlutterMethodCall *)call result:(FlutterResult)result; 7 | - (void)download:(FlutterMethodCall *)call result:(FlutterResult)result; 8 | - (void)signUrl:(FlutterMethodCall *)call result:(FlutterResult)result; 9 | - (void)doesObjectExist:(FlutterMethodCall *)call result:(FlutterResult)result; 10 | @end 11 | -------------------------------------------------------------------------------- /ios/Classes/AliossflutterPlugin.m: -------------------------------------------------------------------------------- 1 | #import "AliossflutterPlugin.h" 2 | #import 3 | #import "JKEncrypt.h" 4 | #import "AESCipher.h" 5 | 6 | NSString *endpoint = @""; 7 | NSObject *registrar; 8 | FlutterMethodChannel *channel; 9 | OSSClient *oss ; 10 | 11 | @implementation AliossflutterPlugin 12 | + (void)registerWithRegistrar:(NSObject*)registrar { 13 | channel = [FlutterMethodChannel 14 | methodChannelWithName:@"aliossflutter" 15 | binaryMessenger:[registrar messenger]]; 16 | AliossflutterPlugin* instance = [[AliossflutterPlugin alloc] init]; 17 | [registrar addMethodCallDelegate:instance channel:channel]; 18 | } 19 | 20 | - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result { 21 | 22 | if ([@"init" isEqualToString:call.method]) { 23 | [self init:call result:result]; 24 | return; 25 | }else if ([@"secretInit" isEqualToString:call.method]) { 26 | [self secretInit:call result:result]; 27 | return; 28 | }else if ([@"upload" isEqualToString:call.method]) { 29 | [self update:call result:result]; 30 | return; 31 | }else if ([@"uploadByte" isEqualToString:call.method]) { 32 | [self updateByte:call result:result]; 33 | return; 34 | } 35 | else if ([@"download" isEqualToString:call.method]) { 36 | [self download:call result:result]; 37 | return; 38 | }else if ([@"signurl" isEqualToString:call.method]) { 39 | [self signUrl:call result:result]; 40 | return; 41 | }else if ([@"des" isEqualToString:call.method]) { 42 | [self des:call result:result]; 43 | return; 44 | }else if ([@"delete" isEqualToString:call.method]) { 45 | [self delete:call result:result]; 46 | return; 47 | }else if ([@"doesObjectExist" isEqualToString:call.method]) { 48 | [self doesObjectExist:call result:result]; 49 | return; 50 | }else if ([@"listObjects" isEqualToString:call.method]) { 51 | [self listObjects:call result:result]; 52 | return; 53 | }else { 54 | result(FlutterMethodNotImplemented); 55 | } 56 | } 57 | - (void)secretInit:(FlutterMethodCall*)call result:(FlutterResult)result { 58 | endpoint = call.arguments[@"endpoint"]; 59 | NSString *accessKeyId =call.arguments[@"accessKeyId"]; 60 | NSString *accessKeySecret =call.arguments[@"accessKeySecret"]; 61 | NSString *_id =call.arguments[@"id"]; 62 | 63 | id credential = [[OSSCustomSignerCredentialProvider alloc] initWithImplementedSigner:^NSString *(NSString *contentToSign, NSError *__autoreleasing *error) { 64 | // 您需要在这里依照OSS规定的签名算法,实现加签一串字符内容,并把得到的签名传拼接上AccessKeyId后返回 65 | // 一般实现是,将字符内容post到您的业务服务器,然后返回签名 66 | // 如果因为某种原因加签失败,描述error信息后,返回nil 67 | NSString *signature = [OSSUtil calBase64Sha1WithData:contentToSign withSecret:accessKeySecret]; // 这里是用SDK内的工具函数进行本地加签,建议您通过业务server实现远程加签 68 | if (signature != nil) { 69 | *error = nil; 70 | } else { 71 | NSDictionary *m1 = @{ 72 | @"result": @"fail", 73 | @"id":_id 74 | }; 75 | [channel invokeMethod:@"onInit" arguments:m1]; 76 | return nil; 77 | } 78 | return [NSString stringWithFormat:@"OSS %@:%@", accessKeyId, signature]; 79 | }]; 80 | 81 | oss = [[OSSClient alloc] initWithEndpoint:endpoint credentialProvider:credential]; 82 | NSDictionary *m1 = @{ 83 | @"result": @"success", 84 | @"id":_id 85 | }; 86 | [channel invokeMethod:@"onInit" arguments:m1]; 87 | } 88 | 89 | - (void)init:(FlutterMethodCall*)call result:(FlutterResult)result { 90 | 91 | endpoint = call.arguments[@"endpoint"]; 92 | NSString *stsServer =call.arguments[@"stsserver"]; 93 | NSString *crypt_key =call.arguments[@"cryptkey"]; 94 | NSString *crypt_type =call.arguments[@"crypttype"]; 95 | NSString *_id =call.arguments[@"id"]; 96 | 97 | id credential1 = [[OSSFederationCredentialProvider alloc] initWithFederationTokenGetter:^OSSFederationToken * { 98 | 99 | NSLog(@"init credential1"); 100 | NSURL * url = [NSURL URLWithString:stsServer]; 101 | NSURLRequest * request = [NSURLRequest requestWithURL:url]; 102 | OSSTaskCompletionSource * tcs = [OSSTaskCompletionSource taskCompletionSource]; 103 | NSURLSession * session = [NSURLSession sharedSession]; 104 | // 发送请求 105 | NSURLSessionTask * sessionTask = [session dataTaskWithRequest:request 106 | 107 | completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { 108 | if (error) { 109 | [tcs setError:error]; 110 | return; 111 | } 112 | [tcs setResult:data]; 113 | }]; 114 | [sessionTask resume]; 115 | // 需要阻塞等待请求返回 116 | [tcs.task waitUntilFinished]; 117 | // 解析结果 118 | if (tcs.task.error) { 119 | NSLog(@"get token error: %@", tcs.task.error); 120 | return nil; 121 | } else { 122 | // 返回数据是json格式,需要解析得到token的各个字段 123 | 124 | NSData *data=tcs.task.result; 125 | 126 | 127 | if(![crypt_key isEqualToString:@""]){ 128 | NSDictionary * object = [NSJSONSerialization JSONObjectWithData:data 129 | options:kNilOptions 130 | error:nil]; 131 | if([crypt_type isEqualToString:@"aes"]){ 132 | data=[aesDecryptString([object objectForKey:@"Data"],crypt_key) dataUsingEncoding:NSUTF8StringEncoding]; 133 | NSLog(@"get token aes: %@", data); 134 | }else{ 135 | JKEncrypt * en = [[JKEncrypt alloc]init]; 136 | data=[[en doDecEncryptStr:[object objectForKey:@"Data"] key:crypt_key] dataUsingEncoding:NSUTF8StringEncoding]; 137 | NSLog(@"get token 3des: %@", data); 138 | } 139 | } 140 | 141 | NSDictionary *ossobject = [NSJSONSerialization JSONObjectWithData: data 142 | options:kNilOptions 143 | error:nil]; 144 | OSSFederationToken * token = [OSSFederationToken new]; 145 | token.tAccessKey = [ossobject objectForKey:@"AccessKeyId"]; 146 | token.tSecretKey = [ossobject objectForKey:@"AccessKeySecret"]; 147 | token.tToken = [ossobject objectForKey:@"SecurityToken"]; 148 | token.expirationTimeInGMTFormat = [ossobject objectForKey:@"Expiration"]; 149 | 150 | return token; 151 | } 152 | }]; 153 | oss = [[OSSClient alloc] initWithEndpoint:endpoint credentialProvider:credential1]; 154 | NSDictionary *m1 = @{ 155 | @"result": @"success", 156 | @"id":_id 157 | }; 158 | [channel invokeMethod:@"onInit" arguments:m1]; 159 | } 160 | - (void)update:(FlutterMethodCall*)call result:(FlutterResult)result { 161 | NSString * _id = call.arguments[@"id"]; 162 | NSString * key = call.arguments[@"key"]; 163 | if (oss == nil) { 164 | NSDictionary *m1 = @{ 165 | @"result": @"fail", 166 | @"id": _id, 167 | @"key":key, 168 | @"message":@"请先初始化" 169 | }; 170 | [channel invokeMethod:@"onUpload" arguments:m1]; 171 | } else { 172 | NSString *bucket = call.arguments[@"bucket"]; 173 | NSString * file = call.arguments[@"file"]; 174 | OSSPutObjectRequest * put = [OSSPutObjectRequest new]; 175 | // 必填字段 176 | put.bucketName = bucket; 177 | put.objectKey = key; 178 | put.uploadingFileURL = [NSURL fileURLWithPath:file]; 179 | // put.uploadingData = ; // 直接上传NSData 180 | put.uploadProgress = ^(int64_t bytesSent, int64_t totalByteSent, int64_t totalBytesExpectedToSend) { 181 | // 当前上传段长度、当前已经上传总长度、一共需要上传的总长度 182 | NSDictionary *m1 = @{ 183 | @"key":key, 184 | @"currentSize": [NSString stringWithFormat:@"%lld",totalByteSent], 185 | @"totalSize": [NSString stringWithFormat:@"%lld",totalBytesExpectedToSend], 186 | @"id":_id 187 | }; 188 | [channel invokeMethod:@"onProgress" arguments:m1]; 189 | }; 190 | 191 | // 以下可选字段的含义参考: https://docs.aliyun.com/#/pub/oss/api-reference/object&PutObject 192 | // put.contentType = @""; 193 | // put.contentMd5 = @""; 194 | // put.contentEncoding = @""; 195 | // put.contentDisposition = @""; 196 | // put.objectMeta = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"value1", @"x-oss-meta-name1", nil]; // 可以在上传时设置元信息或者其他HTTP头部 197 | OSSTask * putTask = [oss putObject:put]; 198 | [putTask continueWithBlock:^id(OSSTask *task) { 199 | if (!task.error) { 200 | NSDictionary *m1 = @{ 201 | @"result": @"success", 202 | @"key":key, 203 | @"id":_id 204 | }; 205 | [channel invokeMethod:@"onUpload" arguments:m1]; 206 | } else { 207 | 208 | NSDictionary *m1 = @{ 209 | @"result": @"fail", 210 | @"key":key, 211 | @"id":_id, 212 | @"message":task.error 213 | }; 214 | [channel invokeMethod:@"onUpload" arguments:m1]; 215 | } 216 | return nil; 217 | }]; 218 | // [putTask waitUntilFinished]; 219 | // [put cancel]; 220 | } 221 | } 222 | - (void)updateByte:(FlutterMethodCall*)call result:(FlutterResult)result { 223 | NSString * _id = call.arguments[@"id"]; 224 | NSString * key = call.arguments[@"key"]; 225 | if (oss == nil) { 226 | NSDictionary *m1 = @{ 227 | @"result": @"fail", 228 | @"id": _id, 229 | @"key":key, 230 | @"message":@"请先初始化" 231 | }; 232 | [channel invokeMethod:@"onUpload" arguments:m1]; 233 | } else { 234 | NSString *bucket = call.arguments[@"bucket"]; 235 | FlutterStandardTypedData * fileByte=call.arguments[@"fileByte"]; 236 | OSSPutObjectRequest * put = [OSSPutObjectRequest new]; 237 | // 必填字段 238 | put.bucketName = bucket; 239 | put.objectKey = key; 240 | put.uploadingData =fileByte.data; 241 | // put.uploadingData = ; // 直接上传NSData 242 | put.uploadProgress = ^(int64_t bytesSent, int64_t totalByteSent, int64_t totalBytesExpectedToSend) { 243 | // 当前上传段长度、当前已经上传总长度、一共需要上传的总长度 244 | NSDictionary *m1 = @{ 245 | @"key":key, 246 | @"currentSize": [NSString stringWithFormat:@"%lld",totalByteSent], 247 | @"totalSize": [NSString stringWithFormat:@"%lld",totalBytesExpectedToSend], 248 | @"id":_id 249 | }; 250 | [channel invokeMethod:@"onProgress" arguments:m1]; 251 | }; 252 | 253 | // 以下可选字段的含义参考: https://docs.aliyun.com/#/pub/oss/api-reference/object&PutObject 254 | // put.contentType = @""; 255 | // put.contentMd5 = @""; 256 | // put.contentEncoding = @""; 257 | // put.contentDisposition = @""; 258 | // put.objectMeta = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"value1", @"x-oss-meta-name1", nil]; // 可以在上传时设置元信息或者其他HTTP头部 259 | OSSTask * putTask = [oss putObject:put]; 260 | [putTask continueWithBlock:^id(OSSTask *task) { 261 | if (!task.error) { 262 | NSDictionary *m1 = @{ 263 | @"result": @"success", 264 | @"key":key, 265 | @"id":_id 266 | }; 267 | [channel invokeMethod:@"onUpload" arguments:m1]; 268 | } else { 269 | 270 | NSDictionary *m1 = @{ 271 | @"result": @"fail", 272 | @"key":key, 273 | @"id":_id, 274 | @"message":task.error 275 | }; 276 | [channel invokeMethod:@"onUpload" arguments:m1]; 277 | } 278 | return nil; 279 | }]; 280 | // [putTask waitUntilFinished]; 281 | // [put cancel]; 282 | } 283 | } 284 | - (void)download:(FlutterMethodCall*)call result:(FlutterResult)result { 285 | NSString * _id = call.arguments[@"id"]; 286 | NSString * key = call.arguments[@"key"]; 287 | if (oss == nil) { 288 | NSDictionary *m1 = @{ 289 | @"result": @"fail", 290 | @"id": _id, 291 | @"key":key, 292 | @"message":@"请先初始化" 293 | }; 294 | [channel invokeMethod:@"onDownload" arguments:m1]; 295 | } else { 296 | NSString * bucket = call.arguments[@"bucket"]; 297 | NSString * process = call.arguments[@"process"]; 298 | NSString * path = call.arguments[@"path"]; 299 | 300 | OSSGetObjectRequest * request = [OSSGetObjectRequest new]; 301 | 302 | // 必填字段 303 | request.bucketName = bucket; 304 | request.objectKey = key; 305 | 306 | // 可选字段 307 | request.downloadProgress = ^(int64_t bytesWritten, int64_t totalBytesWritten, int64_t totalBytesExpectedToWrite) { 308 | NSDictionary *m1 = @{ 309 | @"key":key, 310 | @"currentSize": [NSString stringWithFormat:@"%lld",totalBytesWritten], 311 | @"totalSize": [NSString stringWithFormat:@"%lld",totalBytesExpectedToWrite], 312 | @"id":_id 313 | }; 314 | [channel invokeMethod:@"onProgress" arguments:m1]; 315 | }; 316 | // request.range = [[OSSRange alloc] initWithStart:0 withEnd:99]; // bytes=0-99,指定范围下载 317 | request.downloadToFileURL = [NSURL fileURLWithPath:path]; // 如果需要直接下载到文件,需要指明目标文件地址 318 | if(![process isEqualToString:@""]){ 319 | request.xOssProcess=process; 320 | } 321 | OSSTask * getTask = [oss getObject:request]; 322 | [getTask continueWithBlock:^id(OSSTask *task) { 323 | if (!task.error) { 324 | NSDictionary *m1 = @{ 325 | @"result": @"success", 326 | @"path":path, 327 | @"key":key, 328 | @"id":_id 329 | }; 330 | [channel invokeMethod:@"onDownload" arguments:m1]; 331 | 332 | } else { 333 | NSDictionary *m1 = @{ 334 | @"result": @"fail", 335 | @"path":path, 336 | @"key":key, 337 | @"message":task.error, 338 | @"id":_id 339 | }; 340 | [channel invokeMethod:@"onDownload" arguments:m1]; 341 | } 342 | return nil; 343 | }]; 344 | } 345 | } 346 | - (void)signUrl:(FlutterMethodCall*)call result:(FlutterResult)result { 347 | NSString * _id = call.arguments[@"id"]; 348 | NSString * key = call.arguments[@"key"]; 349 | if (oss == nil) { 350 | NSDictionary *m1 = @{ 351 | @"result": @"fail", 352 | @"id": _id, 353 | @"key":key, 354 | @"message":@"请先初始化" 355 | }; 356 | [channel invokeMethod:@"onSign" arguments:m1]; 357 | } else { 358 | NSString * bucket = call.arguments[@"bucket"]; 359 | NSString * type = call.arguments[@"type"]; 360 | float interval = [call.arguments[@"interval"] floatValue]; 361 | if ([type isEqualToString:@"0"]) { 362 | OSSTask *task = [oss presignPublicURLWithBucketName:bucket 363 | withObjectKey:key]; 364 | NSDictionary *m1 =nil; 365 | if (!task.error) { 366 | m1= @{ 367 | @"result": @"success", 368 | @"id": _id, 369 | @"key":key, 370 | @"url":task.result, 371 | }; 372 | } else { 373 | m1 = @{ 374 | @"result": @"fail", 375 | @"id": _id, 376 | @"key":key, 377 | @"url":@"", 378 | }; 379 | } 380 | [channel invokeMethod:@"onSign" arguments:m1]; 381 | } else if ([type isEqualToString:@"1"]) { 382 | OSSTask * task = nil; 383 | NSString * process = call.arguments[@"process"]; 384 | if([process isEqualToString:@""]){ 385 | task = [oss presignConstrainURLWithBucketName:bucket withObjectKey:key withExpirationInterval:interval]; 386 | }else{ 387 | task = [oss presignConstrainURLWithBucketName:bucket withObjectKey:key withExpirationInterval:interval withParameters:@{ 388 | @"process":process 389 | }]; 390 | } 391 | NSDictionary *m1 =nil; 392 | if (!task.error) { 393 | m1= @{ 394 | @"result": @"success", 395 | @"id": _id, 396 | @"key":key, 397 | @"url":task.result, 398 | }; 399 | } else { 400 | m1 = @{ 401 | @"result": @"fail", 402 | @"id": _id, 403 | @"key":key, 404 | @"url":@"", 405 | }; 406 | } 407 | 408 | [channel invokeMethod:@"onSign" arguments:m1]; 409 | }else{ 410 | 411 | NSDictionary *m1 = @{ 412 | @"result": @"fail", 413 | @"id": _id, 414 | @"key":key, 415 | @"message":@"签名类型错误" 416 | }; 417 | [channel invokeMethod:@"onSign" arguments:m1]; 418 | } 419 | 420 | } 421 | } 422 | - (void)des:(FlutterMethodCall*)call result:(FlutterResult)result { 423 | NSString * _key = call.arguments[@"key"]; 424 | NSString * _type = call.arguments[@"type"]; 425 | NSString * _data = call.arguments[@"data"]; 426 | JKEncrypt * en = [[JKEncrypt alloc]init]; 427 | NSString *_res=@""; 428 | if([_type isEqualToString:@"encrypt"]){ 429 | _res= [en doEncryptStr:_data key:_key]; 430 | }else if([_type isEqualToString:@"decrypt"]){ 431 | _res=[en doDecEncryptStr:_data key:_key]; 432 | } 433 | result(_res); 434 | } 435 | - (void)delete:(FlutterMethodCall*)call result:(FlutterResult)result { 436 | NSString * _id = call.arguments[@"id"]; 437 | NSString * key = call.arguments[@"key"]; 438 | if (oss == nil) { 439 | NSDictionary *m1 = @{ 440 | @"result": @"fail", 441 | @"id": _id, 442 | @"key":key, 443 | @"message":@"请先初始化" 444 | }; 445 | [channel invokeMethod:@"onDelete" arguments:m1]; 446 | } else { 447 | OSSDeleteObjectRequest * delete = [OSSDeleteObjectRequest new]; 448 | delete.bucketName =call.arguments[@"bucket"]; 449 | delete.objectKey = key; 450 | 451 | OSSTask * deleteTask = [oss deleteObject:delete]; 452 | 453 | [deleteTask continueWithBlock:^id(OSSTask *task) { 454 | NSDictionary *m1 =nil; 455 | if (!task.error) { 456 | m1= @{ 457 | @"result": @"success", 458 | @"id": _id, 459 | @"key":key, 460 | }; 461 | }else{ 462 | m1 = @{ 463 | @"result": @"fail", 464 | @"id": _id, 465 | @"key":key, 466 | @"message":@"" 467 | }; 468 | } 469 | [channel invokeMethod:@"onDelete" arguments:m1]; 470 | return nil; 471 | }]; 472 | } 473 | } 474 | 475 | - (void)doesObjectExist:(FlutterMethodCall*)call result:(FlutterResult)result { 476 | NSString * key = call.arguments[@"key"]; 477 | NSString * bucket =call.arguments[@"bucket"]; 478 | if (oss == nil) { 479 | result([FlutterError errorWithCode:@"err" 480 | message:@"请先初始化" 481 | details:nil]); 482 | } else { 483 | NSError * error = nil; 484 | BOOL isExist = [oss doesObjectExistInBucket:bucket objectKey:key error:&error]; 485 | if (!error) { 486 | if(isExist) { 487 | result([NSNumber numberWithBool:true]); 488 | } else { 489 | result([NSNumber numberWithBool:false]); 490 | } 491 | } else { 492 | result([FlutterError errorWithCode:@"err" 493 | message:@"发生错误" 494 | details:nil]); 495 | } 496 | } 497 | } 498 | 499 | - (void)listObjects:(FlutterMethodCall*)call result:(FlutterResult)result { 500 | NSString * bucket =call.arguments[@"bucket"]; 501 | NSString * _id = call.arguments[@"id"]; 502 | NSString * _marker = call.arguments[@"marker"]; 503 | int _maxKeys =[call.arguments[@"maxKeys"] intValue]; 504 | NSString * _prefix = call.arguments[@"prefix"]; 505 | NSString * _delimiter = call.arguments[@"delimiter"]; 506 | if (oss == nil) { 507 | NSDictionary *m1 = @{ 508 | @"result": @"fail", 509 | @"id": _id, 510 | @"message":@"请先初始化" 511 | }; 512 | [channel invokeMethod:@"onListObjects" arguments:m1]; 513 | } else { 514 | OSSGetBucketRequest * getBucket = [OSSGetBucketRequest new]; 515 | getBucket.bucketName = bucket; 516 | 517 | // 以下参数为可选参数,具体含义及说明请参见下表。 518 | getBucket.marker =_marker; 519 | getBucket.maxKeys = _maxKeys; 520 | getBucket.prefix = _prefix; 521 | getBucket.delimiter = _delimiter; 522 | 523 | OSSTask * getBucketTask = [oss getBucket:getBucket]; 524 | 525 | [getBucketTask continueWithBlock:^id(OSSTask *task) { 526 | if (!task.error) { 527 | OSSGetBucketResult * result = task.result; 528 | NSDictionary *objects = @{ 529 | @"result": @"success", 530 | @"id": _id, 531 | @"objects":result.contents 532 | }; 533 | [channel invokeMethod:@"onListObjects" arguments:objects]; 534 | } else { 535 | NSDictionary *m1 = @{ 536 | @"result": @"fail", 537 | @"id": _id, 538 | @"message":task.error 539 | }; 540 | [channel invokeMethod:@"onListObjects" arguments:m1]; 541 | } 542 | return nil; 543 | }]; 544 | } 545 | } 546 | @end 547 | -------------------------------------------------------------------------------- /ios/Classes/GTMBase64.h: -------------------------------------------------------------------------------- 1 | // 2 | // GTMBase64.h 3 | // 4 | // Copyright 2006-2008 Google Inc. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 7 | // use this file except in compliance with the License. You may obtain a copy 8 | // of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 14 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 15 | // License for the specific language governing permissions and limitations under 16 | // the License. 17 | // 18 | 19 | #import 20 | #import "GTMDefines.h" 21 | 22 | // GTMBase64 23 | // 24 | /// Helper for handling Base64 and WebSafeBase64 encodings 25 | // 26 | /// The webSafe methods use different character set and also the results aren't 27 | /// always padded to a multiple of 4 characters. This is done so the resulting 28 | /// data can be used in urls and url query arguments without needing any 29 | /// encoding. You must use the webSafe* methods together, the data does not 30 | /// interop with the RFC methods. 31 | // 32 | @interface GTMBase64 : NSObject 33 | 34 | // 35 | // Standard Base64 (RFC) handling 36 | // 37 | 38 | // encodeData: 39 | // 40 | /// Base64 encodes contents of the NSData object. 41 | // 42 | /// Returns: 43 | /// A new autoreleased NSData with the encoded payload. nil for any error. 44 | // 45 | +(NSData *)encodeData:(NSData *)data; 46 | 47 | // decodeData: 48 | // 49 | /// Base64 decodes contents of the NSData object. 50 | // 51 | /// Returns: 52 | /// A new autoreleased NSData with the decoded payload. nil for any error. 53 | // 54 | +(NSData *)decodeData:(NSData *)data; 55 | 56 | // encodeBytes:length: 57 | // 58 | /// Base64 encodes the data pointed at by |bytes|. 59 | // 60 | /// Returns: 61 | /// A new autoreleased NSData with the encoded payload. nil for any error. 62 | // 63 | +(NSData *)encodeBytes:(const void *)bytes length:(NSUInteger)length; 64 | 65 | // decodeBytes:length: 66 | // 67 | /// Base64 decodes the data pointed at by |bytes|. 68 | // 69 | /// Returns: 70 | /// A new autoreleased NSData with the encoded payload. nil for any error. 71 | // 72 | +(NSData *)decodeBytes:(const void *)bytes length:(NSUInteger)length; 73 | 74 | // stringByEncodingData: 75 | // 76 | /// Base64 encodes contents of the NSData object. 77 | // 78 | /// Returns: 79 | /// A new autoreleased NSString with the encoded payload. nil for any error. 80 | // 81 | +(NSString *)stringByEncodingData:(NSData *)data; 82 | 83 | // stringByEncodingBytes:length: 84 | // 85 | /// Base64 encodes the data pointed at by |bytes|. 86 | // 87 | /// Returns: 88 | /// A new autoreleased NSString with the encoded payload. nil for any error. 89 | // 90 | +(NSString *)stringByEncodingBytes:(const void *)bytes length:(NSUInteger)length; 91 | 92 | // decodeString: 93 | // 94 | /// Base64 decodes contents of the NSString. 95 | // 96 | /// Returns: 97 | /// A new autoreleased NSData with the decoded payload. nil for any error. 98 | // 99 | +(NSData *)decodeString:(NSString *)string; 100 | 101 | // 102 | // Modified Base64 encoding so the results can go onto urls. 103 | // 104 | // The changes are in the characters generated and also allows the result to 105 | // not be padded to a multiple of 4. 106 | // Must use the matching call to encode/decode, won't interop with the 107 | // RFC versions. 108 | // 109 | 110 | // webSafeEncodeData:padded: 111 | // 112 | /// WebSafe Base64 encodes contents of the NSData object. If |padded| is YES 113 | /// then padding characters are added so the result length is a multiple of 4. 114 | // 115 | /// Returns: 116 | /// A new autoreleased NSData with the encoded payload. nil for any error. 117 | // 118 | +(NSData *)webSafeEncodeData:(NSData *)data 119 | padded:(BOOL)padded; 120 | 121 | // webSafeDecodeData: 122 | // 123 | /// WebSafe Base64 decodes contents of the NSData object. 124 | // 125 | /// Returns: 126 | /// A new autoreleased NSData with the decoded payload. nil for any error. 127 | // 128 | +(NSData *)webSafeDecodeData:(NSData *)data; 129 | 130 | // webSafeEncodeBytes:length:padded: 131 | // 132 | /// WebSafe Base64 encodes the data pointed at by |bytes|. If |padded| is YES 133 | /// then padding characters are added so the result length is a multiple of 4. 134 | // 135 | /// Returns: 136 | /// A new autoreleased NSData with the encoded payload. nil for any error. 137 | // 138 | +(NSData *)webSafeEncodeBytes:(const void *)bytes 139 | length:(NSUInteger)length 140 | padded:(BOOL)padded; 141 | 142 | // webSafeDecodeBytes:length: 143 | // 144 | /// WebSafe Base64 decodes the data pointed at by |bytes|. 145 | // 146 | /// Returns: 147 | /// A new autoreleased NSData with the encoded payload. nil for any error. 148 | // 149 | +(NSData *)webSafeDecodeBytes:(const void *)bytes length:(NSUInteger)length; 150 | 151 | // stringByWebSafeEncodingData:padded: 152 | // 153 | /// WebSafe Base64 encodes contents of the NSData object. If |padded| is YES 154 | /// then padding characters are added so the result length is a multiple of 4. 155 | // 156 | /// Returns: 157 | /// A new autoreleased NSString with the encoded payload. nil for any error. 158 | // 159 | +(NSString *)stringByWebSafeEncodingData:(NSData *)data 160 | padded:(BOOL)padded; 161 | 162 | // stringByWebSafeEncodingBytes:length:padded: 163 | // 164 | /// WebSafe Base64 encodes the data pointed at by |bytes|. If |padded| is YES 165 | /// then padding characters are added so the result length is a multiple of 4. 166 | // 167 | /// Returns: 168 | /// A new autoreleased NSString with the encoded payload. nil for any error. 169 | // 170 | +(NSString *)stringByWebSafeEncodingBytes:(const void *)bytes 171 | length:(NSUInteger)length 172 | padded:(BOOL)padded; 173 | 174 | // webSafeDecodeString: 175 | // 176 | /// WebSafe Base64 decodes contents of the NSString. 177 | // 178 | /// Returns: 179 | /// A new autoreleased NSData with the decoded payload. nil for any error. 180 | // 181 | +(NSData *)webSafeDecodeString:(NSString *)string; 182 | 183 | @end -------------------------------------------------------------------------------- /ios/Classes/GTMDefines.h: -------------------------------------------------------------------------------- 1 | // 2 | // GTMDefines.h 3 | // 4 | // Copyright 2008 Google Inc. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 7 | // use this file except in compliance with the License. You may obtain a copy 8 | // of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 14 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 15 | // License for the specific language governing permissions and limitations under 16 | // the License. 17 | // 18 | 19 | // ============================================================================ 20 | 21 | #include 22 | #include 23 | 24 | #if TARGET_OS_IPHONE 25 | #include 26 | #endif // TARGET_OS_IPHONE 27 | 28 | // Not all MAC_OS_X_VERSION_10_X macros defined in past SDKs 29 | #ifndef MAC_OS_X_VERSION_10_5 30 | #define MAC_OS_X_VERSION_10_5 1050 31 | #endif 32 | #ifndef MAC_OS_X_VERSION_10_6 33 | #define MAC_OS_X_VERSION_10_6 1060 34 | #endif 35 | #ifndef MAC_OS_X_VERSION_10_7 36 | #define MAC_OS_X_VERSION_10_7 1070 37 | #endif 38 | 39 | // Not all __IPHONE_X macros defined in past SDKs 40 | #ifndef __IPHONE_3_0 41 | #define __IPHONE_3_0 30000 42 | #endif 43 | #ifndef __IPHONE_3_1 44 | #define __IPHONE_3_1 30100 45 | #endif 46 | #ifndef __IPHONE_3_2 47 | #define __IPHONE_3_2 30200 48 | #endif 49 | #ifndef __IPHONE_4_0 50 | #define __IPHONE_4_0 40000 51 | #endif 52 | #ifndef __IPHONE_4_3 53 | #define __IPHONE_4_3 40300 54 | #endif 55 | #ifndef __IPHONE_5_0 56 | #define __IPHONE_5_0 50000 57 | #endif 58 | 59 | // ---------------------------------------------------------------------------- 60 | // CPP symbols that can be overridden in a prefix to control how the toolbox 61 | // is compiled. 62 | // ---------------------------------------------------------------------------- 63 | 64 | 65 | // By setting the GTM_CONTAINERS_VALIDATION_FAILED_LOG and 66 | // GTM_CONTAINERS_VALIDATION_FAILED_ASSERT macros you can control what happens 67 | // when a validation fails. If you implement your own validators, you may want 68 | // to control their internals using the same macros for consistency. 69 | #ifndef GTM_CONTAINERS_VALIDATION_FAILED_ASSERT 70 | #define GTM_CONTAINERS_VALIDATION_FAILED_ASSERT 0 71 | #endif 72 | 73 | // Give ourselves a consistent way to do inlines. Apple's macros even use 74 | // a few different actual definitions, so we're based off of the foundation 75 | // one. 76 | #if !defined(GTM_INLINE) 77 | #if (defined (__GNUC__) && (__GNUC__ == 4)) || defined (__clang__) 78 | #define GTM_INLINE static __inline__ __attribute__((always_inline)) 79 | #else 80 | #define GTM_INLINE static __inline__ 81 | #endif 82 | #endif 83 | 84 | // Give ourselves a consistent way of doing externs that links up nicely 85 | // when mixing objc and objc++ 86 | #if !defined (GTM_EXTERN) 87 | #if defined __cplusplus 88 | #define GTM_EXTERN extern "C" 89 | #define GTM_EXTERN_C_BEGIN extern "C" { 90 | #define GTM_EXTERN_C_END } 91 | #else 92 | #define GTM_EXTERN extern 93 | #define GTM_EXTERN_C_BEGIN 94 | #define GTM_EXTERN_C_END 95 | #endif 96 | #endif 97 | 98 | // Give ourselves a consistent way of exporting things if we have visibility 99 | // set to hidden. 100 | #if !defined (GTM_EXPORT) 101 | #define GTM_EXPORT __attribute__((visibility("default"))) 102 | #endif 103 | 104 | // Give ourselves a consistent way of declaring something as unused. This 105 | // doesn't use __unused because that is only supported in gcc 4.2 and greater. 106 | #if !defined (GTM_UNUSED) 107 | #define GTM_UNUSED(x) ((void)(x)) 108 | #endif 109 | 110 | // _GTMDevLog & _GTMDevAssert 111 | // 112 | // _GTMDevLog & _GTMDevAssert are meant to be a very lightweight shell for 113 | // developer level errors. This implementation simply macros to NSLog/NSAssert. 114 | // It is not intended to be a general logging/reporting system. 115 | // 116 | // Please see http://code.google.com/p/google-toolbox-for-mac/wiki/DevLogNAssert 117 | // for a little more background on the usage of these macros. 118 | // 119 | // _GTMDevLog log some error/problem in debug builds 120 | // _GTMDevAssert assert if conditon isn't met w/in a method/function 121 | // in all builds. 122 | // 123 | // To replace this system, just provide different macro definitions in your 124 | // prefix header. Remember, any implementation you provide *must* be thread 125 | // safe since this could be called by anything in what ever situtation it has 126 | // been placed in. 127 | // 128 | 129 | // We only define the simple macros if nothing else has defined this. 130 | #ifndef _GTMDevLog 131 | 132 | #ifdef DEBUG 133 | #define _GTMDevLog(...) NSLog(__VA_ARGS__) 134 | #else 135 | #define _GTMDevLog(...) do { } while (0) 136 | #endif 137 | 138 | #endif // _GTMDevLog 139 | 140 | #ifndef _GTMDevAssert 141 | // we directly invoke the NSAssert handler so we can pass on the varargs 142 | // (NSAssert doesn't have a macro we can use that takes varargs) 143 | #if !defined(NS_BLOCK_ASSERTIONS) 144 | #define _GTMDevAssert(condition, ...) \ 145 | do { \ 146 | if (!(condition)) { \ 147 | [[NSAssertionHandler currentHandler] \ 148 | handleFailureInFunction:[NSString stringWithUTF8String:__PRETTY_FUNCTION__] \ 149 | file:[NSString stringWithUTF8String:__FILE__] \ 150 | lineNumber:__LINE__ \ 151 | description:__VA_ARGS__]; \ 152 | } \ 153 | } while(0) 154 | #else // !defined(NS_BLOCK_ASSERTIONS) 155 | #define _GTMDevAssert(condition, ...) do { } while (0) 156 | #endif // !defined(NS_BLOCK_ASSERTIONS) 157 | 158 | #endif // _GTMDevAssert 159 | 160 | // _GTMCompileAssert 161 | // _GTMCompileAssert is an assert that is meant to fire at compile time if you 162 | // want to check things at compile instead of runtime. For example if you 163 | // want to check that a wchar is 4 bytes instead of 2 you would use 164 | // _GTMCompileAssert(sizeof(wchar_t) == 4, wchar_t_is_4_bytes_on_OS_X) 165 | // Note that the second "arg" is not in quotes, and must be a valid processor 166 | // symbol in it's own right (no spaces, punctuation etc). 167 | 168 | // Wrapping this in an #ifndef allows external groups to define their own 169 | // compile time assert scheme. 170 | #ifndef _GTMCompileAssert 171 | // We got this technique from here: 172 | // http://unixjunkie.blogspot.com/2007/10/better-compile-time-asserts_29.html 173 | 174 | #define _GTMCompileAssertSymbolInner(line, msg) _GTMCOMPILEASSERT ## line ## __ ## msg 175 | #define _GTMCompileAssertSymbol(line, msg) _GTMCompileAssertSymbolInner(line, msg) 176 | #define _GTMCompileAssert(test, msg) \ 177 | typedef char _GTMCompileAssertSymbol(__LINE__, msg) [ ((test) ? 1 : -1) ] 178 | #endif // _GTMCompileAssert 179 | 180 | // ---------------------------------------------------------------------------- 181 | // CPP symbols defined based on the project settings so the GTM code has 182 | // simple things to test against w/o scattering the knowledge of project 183 | // setting through all the code. 184 | // ---------------------------------------------------------------------------- 185 | 186 | // Provide a single constant CPP symbol that all of GTM uses for ifdefing 187 | // iPhone code. 188 | #if TARGET_OS_IPHONE // iPhone SDK 189 | // For iPhone specific stuff 190 | #define GTM_IPHONE_SDK 1 191 | #if TARGET_IPHONE_SIMULATOR 192 | #define GTM_IPHONE_SIMULATOR 1 193 | #else 194 | #define GTM_IPHONE_DEVICE 1 195 | #endif // TARGET_IPHONE_SIMULATOR 196 | // By default, GTM has provided it's own unittesting support, define this 197 | // to use the support provided by Xcode, especially for the Xcode4 support 198 | // for unittesting. 199 | #ifndef GTM_IPHONE_USE_SENTEST 200 | #define GTM_IPHONE_USE_SENTEST 0 201 | #endif 202 | #else 203 | // For MacOS specific stuff 204 | #define GTM_MACOS_SDK 1 205 | #endif 206 | 207 | // Some of our own availability macros 208 | #if GTM_MACOS_SDK 209 | #define GTM_AVAILABLE_ONLY_ON_IPHONE UNAVAILABLE_ATTRIBUTE 210 | #define GTM_AVAILABLE_ONLY_ON_MACOS 211 | #else 212 | #define GTM_AVAILABLE_ONLY_ON_IPHONE 213 | #define GTM_AVAILABLE_ONLY_ON_MACOS UNAVAILABLE_ATTRIBUTE 214 | #endif 215 | 216 | // Provide a symbol to include/exclude extra code for GC support. (This mainly 217 | // just controls the inclusion of finalize methods). 218 | #ifndef GTM_SUPPORT_GC 219 | #if GTM_IPHONE_SDK 220 | // iPhone never needs GC 221 | #define GTM_SUPPORT_GC 0 222 | #else 223 | // We can't find a symbol to tell if GC is supported/required, so best we 224 | // do on Mac targets is include it if we're on 10.5 or later. 225 | #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 226 | #define GTM_SUPPORT_GC 0 227 | #else 228 | #define GTM_SUPPORT_GC 1 229 | #endif 230 | #endif 231 | #endif 232 | 233 | // To simplify support for 64bit (and Leopard in general), we provide the type 234 | // defines for non Leopard SDKs 235 | #if !(MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) 236 | // NSInteger/NSUInteger and Max/Mins 237 | #ifndef NSINTEGER_DEFINED 238 | #if __LP64__ || NS_BUILD_32_LIKE_64 239 | typedef long NSInteger; 240 | typedef unsigned long NSUInteger; 241 | #else 242 | typedef int NSInteger; 243 | typedef unsigned int NSUInteger; 244 | #endif 245 | #define NSIntegerMax LONG_MAX 246 | #define NSIntegerMin LONG_MIN 247 | #define NSUIntegerMax ULONG_MAX 248 | #define NSINTEGER_DEFINED 1 249 | #endif // NSINTEGER_DEFINED 250 | // CGFloat 251 | #ifndef CGFLOAT_DEFINED 252 | #if defined(__LP64__) && __LP64__ 253 | // This really is an untested path (64bit on Tiger?) 254 | typedef double CGFloat; 255 | #define CGFLOAT_MIN DBL_MIN 256 | #define CGFLOAT_MAX DBL_MAX 257 | #define CGFLOAT_IS_DOUBLE 1 258 | #else /* !defined(__LP64__) || !__LP64__ */ 259 | typedef float CGFloat; 260 | #define CGFLOAT_MIN FLT_MIN 261 | #define CGFLOAT_MAX FLT_MAX 262 | #define CGFLOAT_IS_DOUBLE 0 263 | #endif /* !defined(__LP64__) || !__LP64__ */ 264 | #define CGFLOAT_DEFINED 1 265 | #endif // CGFLOAT_DEFINED 266 | #endif // MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 267 | 268 | // Some support for advanced clang static analysis functionality 269 | // See http://clang-analyzer.llvm.org/annotations.html 270 | #ifndef __has_feature // Optional. 271 | #define __has_feature(x) 0 // Compatibility with non-clang compilers. 272 | #endif 273 | 274 | #ifndef NS_RETURNS_RETAINED 275 | #if __has_feature(attribute_ns_returns_retained) 276 | #define NS_RETURNS_RETAINED __attribute__((ns_returns_retained)) 277 | #else 278 | #define NS_RETURNS_RETAINED 279 | #endif 280 | #endif 281 | 282 | #ifndef NS_RETURNS_NOT_RETAINED 283 | #if __has_feature(attribute_ns_returns_not_retained) 284 | #define NS_RETURNS_NOT_RETAINED __attribute__((ns_returns_not_retained)) 285 | #else 286 | #define NS_RETURNS_NOT_RETAINED 287 | #endif 288 | #endif 289 | 290 | #ifndef CF_RETURNS_RETAINED 291 | #if __has_feature(attribute_cf_returns_retained) 292 | #define CF_RETURNS_RETAINED __attribute__((cf_returns_retained)) 293 | #else 294 | #define CF_RETURNS_RETAINED 295 | #endif 296 | #endif 297 | 298 | #ifndef CF_RETURNS_NOT_RETAINED 299 | #if __has_feature(attribute_cf_returns_not_retained) 300 | #define CF_RETURNS_NOT_RETAINED __attribute__((cf_returns_not_retained)) 301 | #else 302 | #define CF_RETURNS_NOT_RETAINED 303 | #endif 304 | #endif 305 | 306 | #ifndef NS_CONSUMED 307 | #if __has_feature(attribute_ns_consumed) 308 | #define NS_CONSUMED __attribute__((ns_consumed)) 309 | #else 310 | #define NS_CONSUMED 311 | #endif 312 | #endif 313 | 314 | #ifndef CF_CONSUMED 315 | #if __has_feature(attribute_cf_consumed) 316 | #define CF_CONSUMED __attribute__((cf_consumed)) 317 | #else 318 | #define CF_CONSUMED 319 | #endif 320 | #endif 321 | 322 | #ifndef NS_CONSUMES_SELF 323 | #if __has_feature(attribute_ns_consumes_self) 324 | #define NS_CONSUMES_SELF __attribute__((ns_consumes_self)) 325 | #else 326 | #define NS_CONSUMES_SELF 327 | #endif 328 | #endif 329 | 330 | // Defined on 10.6 and above. 331 | #ifndef NS_FORMAT_ARGUMENT 332 | #define NS_FORMAT_ARGUMENT(A) 333 | #endif 334 | 335 | // Defined on 10.6 and above. 336 | #ifndef NS_FORMAT_FUNCTION 337 | #define NS_FORMAT_FUNCTION(F,A) 338 | #endif 339 | 340 | // Defined on 10.6 and above. 341 | #ifndef CF_FORMAT_ARGUMENT 342 | #define CF_FORMAT_ARGUMENT(A) 343 | #endif 344 | 345 | // Defined on 10.6 and above. 346 | #ifndef CF_FORMAT_FUNCTION 347 | #define CF_FORMAT_FUNCTION(F,A) 348 | #endif 349 | 350 | #ifndef GTM_NONNULL 351 | #define GTM_NONNULL(x) __attribute__((nonnull(x))) 352 | #endif 353 | 354 | #ifdef __OBJC__ 355 | 356 | // Declared here so that it can easily be used for logging tracking if 357 | // necessary. See GTMUnitTestDevLog.h for details. 358 | @class NSString; 359 | GTM_EXTERN void _GTMUnitTestDevLog(NSString *format, ...); 360 | 361 | // Macro to allow you to create NSStrings out of other macros. 362 | // #define FOO foo 363 | // NSString *fooString = GTM_NSSTRINGIFY(FOO); 364 | #if !defined (GTM_NSSTRINGIFY) 365 | #define GTM_NSSTRINGIFY_INNER(x) @#x 366 | #define GTM_NSSTRINGIFY(x) GTM_NSSTRINGIFY_INNER(x) 367 | #endif 368 | 369 | // Macro to allow fast enumeration when building for 10.5 or later, and 370 | // reliance on NSEnumerator for 10.4. Remember, NSDictionary w/ FastEnumeration 371 | // does keys, so pick the right thing, nothing is done on the FastEnumeration 372 | // side to be sure you're getting what you wanted. 373 | #ifndef GTM_FOREACH_OBJECT 374 | #if TARGET_OS_IPHONE || !(MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5) 375 | #define GTM_FOREACH_ENUMEREE(element, enumeration) \ 376 | for (element in enumeration) 377 | #define GTM_FOREACH_OBJECT(element, collection) \ 378 | for (element in collection) 379 | #define GTM_FOREACH_KEY(element, collection) \ 380 | for (element in collection) 381 | #else 382 | #define GTM_FOREACH_ENUMEREE(element, enumeration) \ 383 | for (NSEnumerator *_ ## element ## _enum = enumeration; \ 384 | (element = [_ ## element ## _enum nextObject]) != nil; ) 385 | #define GTM_FOREACH_OBJECT(element, collection) \ 386 | GTM_FOREACH_ENUMEREE(element, [collection objectEnumerator]) 387 | #define GTM_FOREACH_KEY(element, collection) \ 388 | GTM_FOREACH_ENUMEREE(element, [collection keyEnumerator]) 389 | #endif 390 | #endif 391 | 392 | // ============================================================================ 393 | 394 | // To simplify support for both Leopard and Snow Leopard we declare 395 | // the Snow Leopard protocols that we need here. 396 | #if !defined(GTM_10_6_PROTOCOLS_DEFINED) && !(MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6) 397 | #define GTM_10_6_PROTOCOLS_DEFINED 1 398 | @protocol NSConnectionDelegate 399 | @end 400 | @protocol NSAnimationDelegate 401 | @end 402 | @protocol NSImageDelegate 403 | @end 404 | @protocol NSTabViewDelegate 405 | @end 406 | #endif // !defined(GTM_10_6_PROTOCOLS_DEFINED) && !(MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6) 407 | 408 | // GTM_SEL_STRING is for specifying selector (usually property) names to KVC 409 | // or KVO methods. 410 | // In debug it will generate warnings for undeclared selectors if 411 | // -Wunknown-selector is turned on. 412 | // In release it will have no runtime overhead. 413 | #ifndef GTM_SEL_STRING 414 | #ifdef DEBUG 415 | #define GTM_SEL_STRING(selName) NSStringFromSelector(@selector(selName)) 416 | #else 417 | #define GTM_SEL_STRING(selName) @#selName 418 | #endif // DEBUG 419 | #endif // GTM_SEL_STRING 420 | 421 | #endif // __OBJC__ -------------------------------------------------------------------------------- /ios/Classes/JKEncrypt.h: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // 3DES研究 4 | // 5 | // Created by apple on 15/10/22. 6 | // Copyright © 2015年 apple. All rights reserved. 7 | // 8 | 9 | 10 | #import 11 | 12 | @interface JKEncrypt : NSObject 13 | 14 | /**字符串加密 */ 15 | -(NSString *)doEncryptStr:(NSString *)originalStr key:(NSString *)key; 16 | /**字符串解密 */ 17 | -(NSString*)doDecEncryptStr:(NSString *)encryptStr key:(NSString *)key; 18 | /**十六进制解密 */ 19 | -(NSString *)doEncryptHex:(NSString *)originalStr; 20 | /**十六进制加密 */ 21 | -(NSString*)doDecEncryptHex:(NSString *)encryptStr; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /ios/Classes/JKEncrypt.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // 3DES研究 4 | // 5 | // Created by apple on 15/10/22. 6 | // Copyright © 2015年 apple. All rights reserved. 7 | // 8 | 9 | #import "JKEncrypt.h" 10 | #import 11 | #import 12 | #import 13 | #import "GTMBase64.h" 14 | 15 | //密匙 key 16 | #define gkey @"" 17 | //偏移量 18 | #define gIv @"" 19 | 20 | @implementation JKEncrypt 21 | 22 | //字符串 23 | -(NSString *)doEncryptStr:(NSString *)originalStr key:(NSString *)key{ 24 | 25 | //把string 转NSData 26 | NSData* data = [originalStr dataUsingEncoding:NSUTF8StringEncoding]; 27 | 28 | //length 29 | size_t plainTextBufferSize = [data length]; 30 | 31 | const void *vplainText = (const void *)[data bytes]; 32 | 33 | CCCryptorStatus ccStatus; 34 | uint8_t *bufferPtr = NULL; 35 | size_t bufferPtrSize = 0; 36 | size_t movedBytes = 0; 37 | 38 | bufferPtrSize = (plainTextBufferSize + kCCBlockSize3DES) & ~(kCCBlockSize3DES - 1); 39 | bufferPtr = malloc( bufferPtrSize * sizeof(uint8_t)); 40 | memset((void *)bufferPtr, 0x0, bufferPtrSize); 41 | 42 | const void *vkey = (const void *) [key UTF8String]; 43 | //偏移量 44 | const void *vinitVec = (const void *) [gIv UTF8String]; 45 | 46 | //配置CCCrypt 47 | ccStatus = CCCrypt(kCCEncrypt, 48 | kCCAlgorithm3DES, //3DES 49 | kCCOptionECBMode|kCCOptionPKCS7Padding, //设置模式 50 | vkey, //key 51 | kCCKeySize3DES, 52 | vinitVec, //偏移量,这里不用,设置为nil;不用的话,必须为nil,不可以为@“” 53 | vplainText, 54 | plainTextBufferSize, 55 | (void *)bufferPtr, 56 | bufferPtrSize, 57 | &movedBytes); 58 | 59 | NSData *myData = [NSData dataWithBytes:(const void *)bufferPtr length:(NSUInteger)movedBytes]; 60 | NSString *result = [GTMBase64 stringByEncodingData:myData]; 61 | return result; 62 | } 63 | 64 | 65 | 66 | -(NSString*)doDecEncryptStr:(NSString *)encryptStr key:(NSString *)key{ 67 | 68 | NSData *encryptData = [GTMBase64 decodeData:[encryptStr dataUsingEncoding:NSUTF8StringEncoding]]; 69 | 70 | size_t plainTextBufferSize = [encryptData length]; 71 | const void *vplainText = [encryptData bytes]; 72 | 73 | CCCryptorStatus ccStatus; 74 | uint8_t *bufferPtr = NULL; 75 | size_t bufferPtrSize = 0; 76 | size_t movedBytes = 0; 77 | 78 | bufferPtrSize = (plainTextBufferSize + kCCBlockSize3DES) & ~(kCCBlockSize3DES - 1); 79 | bufferPtr = malloc( bufferPtrSize * sizeof(uint8_t)); 80 | memset((void *)bufferPtr, 0x0, bufferPtrSize); 81 | 82 | const void *vkey = (const void *) [key UTF8String]; 83 | 84 | const void *vinitVec = (const void *) [gIv UTF8String]; 85 | 86 | ccStatus = CCCrypt(kCCDecrypt, 87 | kCCAlgorithm3DES, 88 | kCCOptionPKCS7Padding|kCCOptionECBMode, 89 | vkey, 90 | kCCKeySize3DES, 91 | vinitVec, 92 | vplainText, 93 | plainTextBufferSize, 94 | (void *)bufferPtr, 95 | bufferPtrSize, 96 | &movedBytes); 97 | 98 | NSString *result = [[NSString alloc] initWithData:[NSData dataWithBytes:(const void *)bufferPtr 99 | length:(NSUInteger)movedBytes] encoding:NSUTF8StringEncoding]; 100 | 101 | 102 | return result; 103 | } 104 | 105 | 106 | 107 | 108 | //十六进制 109 | -(NSString *)doEncryptHex:(NSString *)originalStr{ 110 | 111 | //把string 转NSData 112 | NSData* data = [originalStr dataUsingEncoding:NSUTF8StringEncoding]; 113 | 114 | //length 115 | size_t plainTextBufferSize = [data length]; 116 | 117 | const void *vplainText = (const void *)[data bytes]; 118 | 119 | CCCryptorStatus ccStatus; 120 | uint8_t *bufferPtr = NULL; 121 | size_t bufferPtrSize = 0; 122 | size_t movedBytes = 0; 123 | 124 | bufferPtrSize = (plainTextBufferSize + kCCBlockSize3DES) & ~(kCCBlockSize3DES - 1); 125 | bufferPtr = malloc( bufferPtrSize * sizeof(uint8_t)); 126 | memset((void *)bufferPtr, 0x0, bufferPtrSize); 127 | 128 | const void *vkey = (const void *) [gkey UTF8String]; 129 | //偏移量 130 | const void *vinitVec = (const void *) [gIv UTF8String]; 131 | 132 | //配置CCCrypt 133 | ccStatus = CCCrypt(kCCEncrypt, 134 | kCCAlgorithm3DES, //3DES 135 | kCCOptionECBMode|kCCOptionPKCS7Padding, //设置模式 136 | vkey, //key 137 | kCCKeySize3DES, 138 | vinitVec, //偏移量,这里不用,设置为nil;不用的话,必须为nil,不可以为@“” 139 | vplainText, 140 | plainTextBufferSize, 141 | (void *)bufferPtr, 142 | bufferPtrSize, 143 | &movedBytes); 144 | 145 | NSData *myData = [NSData dataWithBytes:(const char *)bufferPtr length:(NSUInteger)movedBytes]; 146 | 147 | NSUInteger len = [myData length]; 148 | char * chars = (char *)[myData bytes]; 149 | NSMutableString * hexString = [[NSMutableString alloc] init]; 150 | 151 | for(NSUInteger i = 0; i < len; i++ ) 152 | [hexString appendString:[NSString stringWithFormat:@"%0.2hhx", chars[i]]]; 153 | 154 | return hexString; 155 | 156 | } 157 | 158 | 159 | 160 | -(NSString*)doDecEncryptHex:(NSString *)encryptStr{ 161 | 162 | //十六进制转NSData 163 | long len = [encryptStr length] / 2; 164 | unsigned char *buf = malloc(len); 165 | unsigned char *whole_byte = buf; 166 | char byte_chars[3] = {'\0','\0','\0'}; 167 | 168 | int i; 169 | for (i=0; i < [encryptStr length] / 2; i++) { 170 | byte_chars[0] = [encryptStr characterAtIndex:i*2]; 171 | byte_chars[1] = [encryptStr characterAtIndex:i*2+1]; 172 | *whole_byte = strtol(byte_chars, NULL, 16); 173 | whole_byte++; 174 | } 175 | 176 | NSData *encryptData = [NSData dataWithBytes:buf length:len]; 177 | 178 | size_t plainTextBufferSize = [encryptData length]; 179 | const void *vplainText = [encryptData bytes]; 180 | 181 | CCCryptorStatus ccStatus; 182 | uint8_t *bufferPtr = NULL; 183 | size_t bufferPtrSize = 0; 184 | size_t movedBytes = 0; 185 | 186 | bufferPtrSize = (plainTextBufferSize + kCCBlockSize3DES) & ~(kCCBlockSize3DES - 1); 187 | bufferPtr = malloc( bufferPtrSize * sizeof(uint8_t)); 188 | memset((void *)bufferPtr, 0x0, bufferPtrSize); 189 | 190 | const void *vkey = (const void *) [gkey UTF8String]; 191 | 192 | const void *vinitVec = (const void *) [gIv UTF8String]; 193 | 194 | ccStatus = CCCrypt(kCCDecrypt, 195 | kCCAlgorithm3DES, 196 | kCCOptionPKCS7Padding|kCCOptionECBMode, 197 | vkey, 198 | kCCKeySize3DES, 199 | vinitVec, 200 | vplainText, 201 | plainTextBufferSize, 202 | (void *)bufferPtr, 203 | bufferPtrSize, 204 | &movedBytes); 205 | 206 | NSString *result = [[NSString alloc] initWithData:[NSData dataWithBytes:(const void *)bufferPtr 207 | length:(NSUInteger)movedBytes] encoding:NSUTF8StringEncoding]; 208 | 209 | 210 | return result; 211 | } 212 | 213 | 214 | @end 215 | -------------------------------------------------------------------------------- /ios/aliossflutter.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 = 'aliossflutter' 6 | s.version = '0.0.1' 7 | s.summary = '阿里云oss' 8 | s.description = <<-DESC 9 | 阿里云oss 10 | DESC 11 | s.homepage = 'http://example.com' 12 | s.license = { :file => '../LICENSE' } 13 | s.author = { 'Your Company' => 'email@example.com' } 14 | s.source = { :path => '.' } 15 | s.source_files = 'Classes/**/*' 16 | s.public_header_files = 'Classes/**/*.h' 17 | s.dependency 'Flutter' 18 | s.dependency 'AliyunOSSiOS' 19 | 20 | s.ios.deployment_target = '8.0' 21 | end 22 | 23 | -------------------------------------------------------------------------------- /lib/aliossflutter.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:typed_data'; 3 | import 'package:aliossflutter/response.dart'; 4 | import 'package:flutter/services.dart'; 5 | import 'package:uuid/uuid.dart'; 6 | import 'dart:convert'; 7 | 8 | class AliOSSFlutter { 9 | final MethodChannel _channel = MethodChannel('aliossflutter') 10 | ..setMethodCallHandler(_handler); 11 | static final _uuid = new Uuid(); 12 | String id; 13 | 14 | AliOSSFlutter() { 15 | id = _uuid.v4(); 16 | alis[id] = this; 17 | } 18 | 19 | static final alis = new Map(); 20 | StreamController _responseInitController = 21 | new StreamController.broadcast(); 22 | Stream get responseFromInit => 23 | _responseInitController.stream; 24 | 25 | StreamController _responseProgressController = 26 | new StreamController.broadcast(); 27 | Stream get responseFromProgress => 28 | _responseProgressController.stream; 29 | 30 | StreamController _responseDownloadController = 31 | new StreamController.broadcast(); 32 | Stream get responseFromDownload => 33 | _responseDownloadController.stream; 34 | 35 | StreamController _responseUploadController = 36 | new StreamController.broadcast(); 37 | Stream get responseFromUpload => 38 | _responseUploadController.stream; 39 | 40 | StreamController _responseSignController = 41 | new StreamController.broadcast(); 42 | Stream get responseFromSign => _responseSignController.stream; 43 | 44 | StreamController _responseDeleteController = 45 | new StreamController.broadcast(); 46 | Stream get responseFromDelete => _responseDeleteController.stream; 47 | 48 | StreamController _responseHeadObjectController = 49 | new StreamController.broadcast(); 50 | Stream get responseFromHeadObject => _responseHeadObjectController.stream; 51 | 52 | StreamController _responseListObjectsController = 53 | new StreamController.broadcast(); 54 | Stream get responseFromListObjects => _responseListObjectsController.stream; 55 | 56 | Future _invokeMethod(String method, 57 | [Map arguments = const {}]) { 58 | Map withId = Map.of(arguments); 59 | withId['id'] = id; 60 | return _channel 61 | .invokeMethod(method, withId); 62 | } 63 | 64 | //监听回调方法 65 | static Future _handler(MethodCall methodCall) { 66 | Map arguments; 67 | if(methodCall.arguments is String) 68 | { 69 | arguments=json.decode(methodCall.arguments); 70 | } 71 | else { 72 | arguments = methodCall.arguments as Map; 73 | } 74 | String id = arguments['id']; 75 | AliOSSFlutter oss = alis[id]; 76 | switch (methodCall.method) { 77 | case "onInit": 78 | bool flag=false; 79 | if("success"==arguments["result"]){ 80 | flag=true; 81 | } 82 | oss._responseInitController.add(flag); 83 | break; 84 | case "onProgress": 85 | ProgressResponse res = new ProgressResponse( 86 | key: arguments["key"].toString(), 87 | currentSize: 88 | double.parse(arguments["currentSize"].toString()), 89 | totalSize: 90 | double.parse(arguments["totalSize"].toString())); 91 | oss._responseProgressController.add(res); 92 | break; 93 | case "onSign": 94 | SignResponse res=SignResponse(success: false); 95 | if("success"==arguments["result"]){ 96 | res.success=true; 97 | res.url=arguments["url"]; 98 | }else{ 99 | res.msg=arguments["message"]; 100 | } 101 | res.key=arguments["key"].toString(); 102 | oss._responseSignController.add(res); 103 | break; 104 | case "onDelete": 105 | DeleteResponse res=DeleteResponse(success: false); 106 | if("success"==arguments["result"]){ 107 | res.success=true; 108 | } 109 | res.key=arguments["key"]; 110 | oss._responseDeleteController.add(res); 111 | break; 112 | case "onUpload": 113 | UploadResponse res=UploadResponse(success: false); 114 | if("success"==arguments["result"]){ 115 | res.success=true; 116 | res.servercallback=arguments["servercallback"]; 117 | }else{ 118 | res.msg=arguments["message"]; 119 | } 120 | res.key=arguments["key"]; 121 | oss._responseUploadController.add(res); 122 | break; 123 | case "onDownload": 124 | DownloadResponse res=DownloadResponse(success: false); 125 | if("success"==arguments["result"]){ 126 | res.success=true; 127 | res.path=arguments["path"]; 128 | }else{ 129 | res.msg=arguments["message"]; 130 | } 131 | res.key=arguments["key"].toString(); 132 | oss._responseDownloadController.add(res); 133 | break; 134 | case "asyncHeadObject": 135 | HeadObjectResponse res=HeadObjectResponse(success: false); 136 | if(arguments["result"]){ 137 | res.success=true; 138 | } 139 | res.key=arguments["key"]; 140 | res.lastModified=arguments["lastModified"]; 141 | oss._responseHeadObjectController.add(res); 142 | break; 143 | case "onListObjects": 144 | ListObjectsResponse res=ListObjectsResponse(success: false); 145 | if("success"==arguments["result"]){ 146 | res.success=true; 147 | } 148 | res.objects=arguments["objects"]; 149 | oss._responseListObjectsController.add(res); 150 | break; 151 | } 152 | return Future.value(true); 153 | } 154 | 155 | //上传 156 | Future upload(String bucket, String file, String key,{String callbackUrl,String callbackHost,String callbackBodyType,String callbackBody,String callbackVars}) async { 157 | return await _invokeMethod( 158 | 'upload', {"bucket": bucket, "file": file, "key": key, "callbackUrl": callbackUrl, "callbackHost": callbackHost, "callbackBodyType": callbackBodyType, "callbackBody": callbackBody, "callbackVars": callbackVars}); 159 | } 160 | 161 | Future uploadByte(String bucket, Uint8List fileByte, String key,{String callbackUrl,String callbackHost,String callbackBodyType,String callbackBody,String callbackVars}) async { 162 | return await _invokeMethod( 163 | 'uploadByte', {"bucket": bucket, "fileByte": fileByte, "key": key, "callbackUrl": callbackUrl, "callbackHost": callbackHost, "callbackBodyType": callbackBodyType, "callbackBody": callbackBody, "callbackVars": callbackVars}); 164 | } 165 | 166 | //初始化 167 | Future init(String stsserver, String endpoint, {String cryptkey = "",String crypttype = "3des"}) async { 168 | return await _invokeMethod('init', { 169 | "stsserver": stsserver, 170 | "endpoint": endpoint, 171 | "cryptkey": cryptkey, 172 | "crypttype": crypttype 173 | }); 174 | } 175 | 176 | Future secretInit(String accessKeyId,String accessKeySecret, String endpoint) async { 177 | return await _invokeMethod('secretInit', { 178 | "endpoint": endpoint, 179 | "accessKeyId": accessKeyId, 180 | "accessKeySecret": accessKeySecret 181 | }); 182 | } 183 | 184 | //url签名 185 | Future signUrl(String bucket, String key, 186 | {String type = "0", 187 | String interval = "1800", 188 | String process = ""}) async { 189 | return await _invokeMethod('signurl', { 190 | "bucket": bucket, 191 | "key": key, 192 | "type": type, 193 | "interval": interval, 194 | "process": process 195 | }); 196 | } 197 | 198 | //下载 199 | Future download(String bucket, String key, String path, 200 | {String process = ""}) async { 201 | return await _invokeMethod('download', { 202 | "bucket": bucket, 203 | "key": key, 204 | "path": path, 205 | "process": process 206 | }); 207 | } 208 | 209 | Future exist(String bucket, String key) async { 210 | return await _invokeMethod('doesObjectExist', { 211 | "bucket": bucket, 212 | "key": key 213 | }); 214 | } 215 | Future delete(String bucket, String key) async { 216 | return await _invokeMethod('delete', { 217 | "bucket": bucket, 218 | "key": key, 219 | }); 220 | } 221 | Future listObjects(String bucket, {String prefix="",int maxkeys=100,String marker="",String delimiter=""}) async { 222 | return await _invokeMethod('listObjects', { 223 | "bucket": bucket, 224 | "prefix": prefix, 225 | "maxkeys":maxkeys, 226 | "marker":marker, 227 | "delimiter":delimiter 228 | }); 229 | } 230 | //3des 加解密 231 | Future des(String key, String type, String data, 232 | ) async { 233 | return await _invokeMethod('des', { 234 | "key": key, 235 | "type": type, 236 | "data": data 237 | }); 238 | } 239 | //aes 加解密 240 | Future aes(String key, String type, String data, 241 | ) async { 242 | return await _invokeMethod('aes', { 243 | "key": key, 244 | "type": type, 245 | "data": data 246 | }); 247 | } 248 | 249 | //获取文件元信息 250 | Future asyncHeadObject(String bucket, String key) async { 251 | return await _invokeMethod('asyncHeadObject', { 252 | "bucket": bucket, 253 | "key": key 254 | }); 255 | } 256 | } 257 | -------------------------------------------------------------------------------- /lib/response.dart: -------------------------------------------------------------------------------- 1 | class ProgressResponse { 2 | final double currentSize; 3 | final String key; 4 | final double totalSize; 5 | 6 | ProgressResponse({this.currentSize, this.totalSize,this.key}); 7 | 8 | double getProgress() { 9 | // TODO: implement toString 10 | return currentSize / totalSize; 11 | } 12 | } 13 | class SignResponse { 14 | bool success; 15 | String url; 16 | String key; 17 | String msg; 18 | SignResponse({this.success, this.url,this.msg,this.key}); 19 | } 20 | class UploadResponse { 21 | bool success; 22 | String key; 23 | String msg; 24 | String servercallback; 25 | UploadResponse({this.success, this.key,this.msg,this.servercallback}); 26 | } 27 | class DownloadResponse { 28 | bool success; 29 | String path; 30 | String key; 31 | String msg; 32 | DownloadResponse({this.success, this.path,this.msg,this.key}); 33 | } 34 | class DeleteResponse { 35 | bool success; 36 | String key; 37 | DeleteResponse({this.success,this.key}); 38 | } 39 | class HeadObjectResponse { 40 | bool success; 41 | int lastModified; 42 | String key; 43 | HeadObjectResponse({this.success,this.lastModified,this.key}); 44 | } 45 | class ListObjectsResponse { 46 | bool success; 47 | List objects; 48 | ListObjectsResponse({this.success,this.objects}); 49 | } -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | characters: 5 | dependency: transitive 6 | description: 7 | name: characters 8 | url: "https://pub.flutter-io.cn" 9 | source: hosted 10 | version: "1.1.0-nullsafety.2" 11 | charcode: 12 | dependency: transitive 13 | description: 14 | name: charcode 15 | url: "https://pub.flutter-io.cn" 16 | source: hosted 17 | version: "1.1.2" 18 | collection: 19 | dependency: transitive 20 | description: 21 | name: collection 22 | url: "https://pub.flutter-io.cn" 23 | source: hosted 24 | version: "1.15.0-nullsafety.2" 25 | convert: 26 | dependency: transitive 27 | description: 28 | name: convert 29 | url: "https://pub.flutter-io.cn" 30 | source: hosted 31 | version: "2.0.2" 32 | crypto: 33 | dependency: transitive 34 | description: 35 | name: crypto 36 | url: "https://pub.flutter-io.cn" 37 | source: hosted 38 | version: "2.0.6" 39 | flutter: 40 | dependency: "direct main" 41 | description: flutter 42 | source: sdk 43 | version: "0.0.0" 44 | meta: 45 | dependency: transitive 46 | description: 47 | name: meta 48 | url: "https://pub.flutter-io.cn" 49 | source: hosted 50 | version: "1.3.0-nullsafety.2" 51 | sky_engine: 52 | dependency: transitive 53 | description: flutter 54 | source: sdk 55 | version: "0.0.99" 56 | typed_data: 57 | dependency: transitive 58 | description: 59 | name: typed_data 60 | url: "https://pub.flutter-io.cn" 61 | source: hosted 62 | version: "1.3.0-nullsafety.2" 63 | uuid: 64 | dependency: "direct main" 65 | description: 66 | name: uuid 67 | url: "https://pub.flutter-io.cn" 68 | source: hosted 69 | version: "2.0.0" 70 | vector_math: 71 | dependency: transitive 72 | description: 73 | name: vector_math 74 | url: "https://pub.flutter-io.cn" 75 | source: hosted 76 | version: "2.1.0-nullsafety.2" 77 | sdks: 78 | dart: ">=2.10.0-0.0.dev <2.10.0" 79 | flutter: ">=1.5.9-pre.94 <2.0.0" 80 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: aliossflutter 2 | description: 阿里云oss 3 | version: 0.0.6 4 | author: jlcool 5 | homepage: https://github.com/jlcool/aliossflutter 6 | 7 | environment: 8 | sdk: ">=2.0.0-dev.68.0 <3.0.0" 9 | flutter: ">=1.5.9-pre.94 <2.0.0" 10 | 11 | dependencies: 12 | uuid: ^2.0.0 13 | flutter: 14 | sdk: flutter 15 | 16 | # For information on the generic Dart part of this file, see the 17 | # following page: https://www.dartlang.org/tools/pub/pubspec 18 | 19 | # The following section is specific to Flutter. 20 | flutter: 21 | # This section identifies this Flutter project as a plugin project. 22 | # The androidPackage and pluginClass identifiers should not ordinarily 23 | # be modified. They are used by the tooling to maintain consistency when 24 | # adding or updating assets for this project. 25 | plugin: 26 | androidPackage: com.jlcool.aliossflutter 27 | pluginClass: AliossflutterPlugin 28 | 29 | # To add assets to your plugin package, add an assets section, like this: 30 | # assets: 31 | # - images/a_dot_burr.jpeg 32 | # - images/a_dot_ham.jpeg 33 | # 34 | # For details regarding assets in packages, see 35 | # https://flutter.io/assets-and-images/#from-packages 36 | # 37 | # An image asset can refer to one or more resolution-specific "variants", see 38 | # https://flutter.io/assets-and-images/#resolution-aware. 39 | 40 | # To add custom fonts to your plugin package, add a fonts section here, 41 | # in this "flutter" section. Each entry in this list should have a 42 | # "family" key with the font family name, and a "fonts" key with a 43 | # list giving the asset and other descriptors for the font. For 44 | # example: 45 | # fonts: 46 | # - family: Schyler 47 | # fonts: 48 | # - asset: fonts/Schyler-Regular.ttf 49 | # - asset: fonts/Schyler-Italic.ttf 50 | # style: italic 51 | # - family: Trajan Pro 52 | # fonts: 53 | # - asset: fonts/TrajanPro.ttf 54 | # - asset: fonts/TrajanPro_Bold.ttf 55 | # weight: 700 56 | # 57 | # For details regarding fonts in packages, see 58 | # https://flutter.io/custom-fonts/#from-packages 59 | --------------------------------------------------------------------------------