├── .gitignore
├── .idea
├── codeStyles
│ └── Project.xml
├── libraries
│ ├── Dart_SDK.xml
│ ├── Flutter_Plugins.xml
│ └── Flutter_for_Android.xml
├── misc.xml
├── modules.xml
├── runConfigurations
│ └── example_lib_main_dart.xml
├── vcs.xml
└── workspace.xml
├── .metadata
├── CHANGELOG.md
├── LICENSE
├── README.en.md
├── README.md
├── android
├── .gitignore
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ └── gradle-wrapper.properties
├── settings.gradle
└── src
│ ├── libs
│ ├── JDSDK_h.jar
│ ├── armeabi-v7a
│ │ └── libCPS.so
│ ├── armeabi
│ │ └── libCPS.so
│ ├── cps_1.0.0.jar
│ ├── jdmasdk.jar
│ └── x86
│ │ └── libCPS.so
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── wxwx
│ │ └── flutter_kepler
│ │ ├── FlutterKeplerHandle.java
│ │ ├── FlutterKeplerPlugin.java
│ │ ├── LoadingDialog.java
│ │ ├── PluginConstants.java
│ │ ├── PluginResponse.java
│ │ └── PluginUtil.java
│ └── res
│ ├── drawable-xxhdpi
│ ├── kepler_back_normal.png
│ ├── kepler_back_pressed.png
│ ├── kepler_selcet_more_normal.png
│ ├── kepler_selcet_more_pressed.png
│ ├── neterror.png
│ ├── seclect_item_has_message.png
│ ├── seclect_item_history.png
│ ├── seclect_item_logout.png
│ ├── seclect_item_no_has_message.png
│ ├── seclect_item_orderlist.png
│ ├── seclect_item_serch.png
│ ├── select_bg.9.png
│ └── white.png
│ ├── drawable
│ ├── btn_reload.xml
│ ├── kepler_btn_back.xml
│ ├── kepler_btn_select_more.xml
│ ├── kepler_dialog_bk.xml
│ ├── kepler_dialog_button_ne.xml
│ ├── kepler_dialog_button_po.xml
│ ├── pressbar_color.xml
│ ├── sdk_title_bg_with_shadow.xml
│ └── yuanjiao.xml
│ ├── layout
│ ├── dialogloading.xml
│ ├── item_tab_layout.xml
│ ├── kepler_mid_lin.xml
│ ├── kepler_simple_dialog_lay.xml
│ ├── more_select_item.xml
│ ├── neterror_layout.xml
│ ├── sdk_title_layout.xml
│ └── web_bottom_layout.xml
│ ├── raw
│ └── safe.jpg
│ └── values
│ ├── strings.xml
│ └── styles.xml
├── example
├── .gitignore
├── .metadata
├── README.md
├── android
│ ├── app
│ │ ├── build.gradle
│ │ ├── release.keystore
│ │ └── src
│ │ │ ├── debug
│ │ │ └── AndroidManifest.xml
│ │ │ ├── main
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── java
│ │ │ │ └── com
│ │ │ │ │ └── wxwx
│ │ │ │ │ └── flutter_kepler_example
│ │ │ │ │ └── MainActivity.java
│ │ │ └── res
│ │ │ │ ├── drawable
│ │ │ │ └── launch_background.xml
│ │ │ │ ├── mipmap-hdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-mdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xxxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── raw
│ │ │ │ └── safe.jpg
│ │ │ │ └── values
│ │ │ │ └── styles.xml
│ │ │ └── profile
│ │ │ └── AndroidManifest.xml
│ ├── build.gradle
│ ├── gradle.properties
│ ├── gradle
│ │ └── wrapper
│ │ │ └── gradle-wrapper.properties
│ └── settings.gradle
├── ios
│ ├── Flutter
│ │ ├── AppFrameworkInfo.plist
│ │ ├── Debug.xcconfig
│ │ ├── Release.xcconfig
│ │ └── flutter_export_environment.sh
│ ├── Podfile
│ ├── Podfile.lock
│ ├── Runner.xcodeproj
│ │ ├── project.pbxproj
│ │ ├── project.xcworkspace
│ │ │ └── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ └── xcschemes
│ │ │ └── Runner.xcscheme
│ ├── Runner.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ └── Runner
│ │ ├── AppDelegate.h
│ │ ├── AppDelegate.m
│ │ ├── Assets.xcassets
│ │ ├── AppIcon.appiconset
│ │ │ ├── Contents.json
│ │ │ ├── Icon-App-1024x1024@1x.png
│ │ │ ├── Icon-App-20x20@1x.png
│ │ │ ├── Icon-App-20x20@2x.png
│ │ │ ├── Icon-App-20x20@3x.png
│ │ │ ├── Icon-App-29x29@1x.png
│ │ │ ├── Icon-App-29x29@2x.png
│ │ │ ├── Icon-App-29x29@3x.png
│ │ │ ├── Icon-App-40x40@1x.png
│ │ │ ├── Icon-App-40x40@2x.png
│ │ │ ├── Icon-App-40x40@3x.png
│ │ │ ├── Icon-App-60x60@2x.png
│ │ │ ├── Icon-App-60x60@3x.png
│ │ │ ├── Icon-App-76x76@1x.png
│ │ │ ├── Icon-App-76x76@2x.png
│ │ │ └── Icon-App-83.5x83.5@2x.png
│ │ └── LaunchImage.imageset
│ │ │ ├── Contents.json
│ │ │ ├── LaunchImage.png
│ │ │ ├── LaunchImage@2x.png
│ │ │ ├── LaunchImage@3x.png
│ │ │ └── README.md
│ │ ├── Base.lproj
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
│ │ ├── Info.plist
│ │ ├── Kepler.bundle
│ │ └── safe.jpg
│ │ └── main.m
├── lib
│ └── main.dart
├── pubspec.lock
├── pubspec.yaml
└── test
│ └── widget_test.dart
├── flutter_kepler.iml
├── flutter_kepler
└── .idea
│ └── workspace.xml
├── images
└── ios.jpg
├── ios
├── .gitignore
├── Assets
│ └── .gitkeep
├── Classes
│ ├── ConstKey
│ │ └── FlutterKeplerConstKey.h
│ ├── FlutterKeplerPlugin.h
│ ├── FlutterKeplerPlugin.m
│ ├── Handle
│ │ ├── FlutterKeplerHandler.h
│ │ └── FlutterKeplerHandler.m
│ └── Tools
│ │ ├── FlutterKeplerTools.h
│ │ └── FlutterKeplerTools.m
├── JDKepler
│ └── JDKeplerSDK.framework
│ │ ├── Headers
│ │ ├── JDKeplerSDK.h
│ │ └── KeplerApiManager.h
│ │ ├── Info.plist
│ │ ├── JDKeplerSDK
│ │ └── Modules
│ │ └── module.modulemap
└── flutter_kepler.podspec
├── lib
├── flutter_kepler.dart
├── kepler_const_key.dart
└── kepler_model.dart
├── pubspec.lock
├── pubspec.yaml
└── test
└── flutter_kepler_test.dart
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | .dart_tool/
3 |
4 | .packages
5 | .pub/
6 |
7 | build/
8 |
--------------------------------------------------------------------------------
/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | xmlns:android
14 |
15 | ^$
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | xmlns:.*
25 |
26 | ^$
27 |
28 |
29 | BY_NAME
30 |
31 |
32 |
33 |
34 |
35 |
36 | .*:id
37 |
38 | http://schemas.android.com/apk/res/android
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | .*:name
48 |
49 | http://schemas.android.com/apk/res/android
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 | name
59 |
60 | ^$
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 | style
70 |
71 | ^$
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 | .*
81 |
82 | ^$
83 |
84 |
85 | BY_NAME
86 |
87 |
88 |
89 |
90 |
91 |
92 | .*
93 |
94 | http://schemas.android.com/apk/res/android
95 |
96 |
97 | ANDROID_ATTRIBUTE_ORDER
98 |
99 |
100 |
101 |
102 |
103 |
104 | .*
105 |
106 | .*
107 |
108 |
109 | BY_NAME
110 |
111 |
112 |
113 |
114 |
115 |
116 |
--------------------------------------------------------------------------------
/.idea/libraries/Dart_SDK.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/.idea/libraries/Flutter_Plugins.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/libraries/Flutter_for_Android.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/.idea/runConfigurations/example_lib_main_dart.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/workspace.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/.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: e4ebcdf6f4facee5779c38a04d91d08dc58ea7a4
8 | channel: beta
9 |
10 | project_type: plugin
11 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 |
8 | ## 0.0.1
9 | 完成开发
10 | * TODO: Describe initial release.
11 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 FlutterTaoBaoKe
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.en.md:
--------------------------------------------------------------------------------
1 | # flutter_kepler
2 |
3 | #### Description
4 | flutter 京东开普勒插件
5 |
6 | #### Software Architecture
7 | Software architecture description
8 |
9 | #### Installation
10 |
11 | 1. xxxx
12 | 2. xxxx
13 | 3. xxxx
14 |
15 | #### Instructions
16 |
17 | 1. xxxx
18 | 2. xxxx
19 | 3. xxxx
20 |
21 | #### Contribution
22 |
23 | 1. Fork the repository
24 | 2. Create Feat_xxx branch
25 | 3. Commit your code
26 | 4. Create Pull Request
27 |
28 |
29 | #### Gitee Feature
30 |
31 | 1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
32 | 2. Gitee blog [blog.gitee.com](https://blog.gitee.com)
33 | 3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
34 | 4. The most valuable open source project [GVP](https://gitee.com/gvp)
35 | 5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
36 | 6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
8 | # flutter_kepler
9 |
10 | #### 介绍
11 | flutter 京东开普勒插件
12 |
13 | 地址:[flutter_kepler](https://pub.dev/packages/flutter_kepler)
14 |
15 | 支持Android和iOS,原生版本V2.2.4
16 |
17 | Android:983598009@qq.com
18 | iOS:329106954@qq.com
19 | ### 如何引入项目
20 |
21 | [如何引入](https://pub.dev/packages/flutter_kepler#-installing-tab-)
22 | ```
23 | dependencies:
24 | flutter_kepler: ^版本号
25 | ```
26 |
27 | ### 已知问题
28 | * iOS
29 | 不知道是不是example的iOS包名导购模式还在申请的原因,登录收不到回调。建议集成方自己试一下
30 |
31 | ### 工程性方法
32 | 参考[开普勒文档](http://kepler.jd.com/console/docCenterCatalog/docContent?channelId=46)
33 |
34 | #### ios需要的工程性配置
35 |
36 | 1.进入[后台管理](http://kepler.jd.com/console/app/app_list.action),生成自己的SDK
37 | 2.将下载的SDk解压缩得到 JDKeplerSDK.framework、Kepler.bundle(JDKeplerSDK.framework用不上)
38 | 3.将Kepler.bundle拖入原生项目,如下图
39 | 
40 |
41 | #### android需要的工程性配置
42 |
43 | 在待引入工程的android目录下, AndroidManifest.xml文件内
44 |
45 | `例如 flutter_kepler\example\android\app\src\main\AndroidManifest.xml`
46 |
47 | 添加以下配置
48 |
49 | ```
50 |
51 | ...
52 |
53 |
54 |
55 |
56 |
57 |
58 | ...
59 |
60 | ...
61 |
64 |
65 |
66 |
67 |
72 |
73 |
75 | ...
76 |
77 |
78 | ```
79 |
80 | [参考链接]()
81 |
82 | 安全图片同样需要放在 待引入工程的android目录下 , /main/res/raw/safe.jpg
83 |
84 |
85 | ### 方法说明
86 | * 头文件引入
87 | ```
88 | import 'package:flutter_kepler/flutter_kepler.dart';
89 | ```
90 |
91 | * 初始化
92 | ```
93 | /**
94 | * 初始化
95 | * appKey:去管理后台查看
96 | * appSecret:去管理后台查看
97 | * result:{
98 | * errorCode, //0为初始化成功,其他为失败
99 | * errorMessage, //message
100 | * }
101 | */
102 | var result = await FlutterKepler.initKepler(
103 | appKey: "",
104 | appSecret: "",
105 | );
106 | ```
107 |
108 | * 打开url
109 | ```
110 | ///
111 | /// 通过URL打开任意商品页面
112 | /// @param url 页面url
113 | /// @param userInfo 不需要可以不传 传参数据为第三方应用自定义,可以为页面,频道标识;也可以标识分成信息;该数据只做统计需求。传参长度,使用URL encode之后长度必须小于256字节(不建议传入中文以及特殊字符)
114 | /// 禁止传参带入以下符号: =#%&+?<{}
115 | ///
116 | ///
117 | FlutterKepler.keplerPageWithURL(
118 | url: "",
119 | userInfo:{},
120 | );
121 | ```
122 |
123 | * 打开导航页
124 | ```
125 | ///
126 | /// 打开导航页
127 | /// @param userInfo 不需要可以不传 传参数据为第三方应用自定义,可以为页面,频道标识;也可以标识分成信息;该数据只做统计需求。传参长度,使用URL encode之后长度必须小于256字节(不建议传入中文以及特殊字符)
128 | /// 禁止传参带入以下符号: =#%&+?<{}
129 | ///
130 | ///
131 | FlutterKepler.keplerNavigationPage(userInfo:{},);
132 | ```
133 |
134 | * 通过SKU打开Kepler单品页
135 | ```
136 |
137 | ///
138 | /// 通过SKU打开Kepler单品页
139 | /// @param sku 商品sku
140 | /// @param userInfo 不需要可以不传 传参数据为第三方应用自定义,可以为页面,频道标识;也可以标识分成信息;该数据只做统计需求。传参长度,使用URL encode之后长度必须小于256字节(不建议传入中文以及特殊字符)
141 | /// 禁止传参带入以下符号: =#%&+?<{}
142 | ///
143 | ///
144 | FlutterKepler.keplerOpenItemDetailWithSKU(
145 | sku: "",
146 | userInfo:{},
147 | );
148 | ```
149 |
150 | * 打开订单列表
151 | ```
152 | ///
153 | /// 打开订单列表
154 | /// @param userInfo 不需要可以不传 传参数据为第三方应用自定义,可以为页面,频道标识;也可以标识分成信息;该数据只做统计需求。传参长度,使用URL encode之后长度必须小于256字节(不建议传入中文以及特殊字符)
155 | /// 禁止传参带入以下符号: =#%&+?<{}
156 | ///
157 | ///
158 | FlutterKepler.keplerOpenOrderList(
159 | userInfo:{}
160 | );
161 | ```
162 |
163 |
164 | * 根据搜索关键字打开搜索结果页
165 | ```
166 | ///
167 | /// 根据搜索关键字打开搜索结果页
168 | /// @param searchKey 搜索关键字
169 | /// @param userInfo 不需要可以不传 传参数据为第三方应用自定义,可以为页面,频道标识;也可以标识分成信息;该数据只做统计需求。传参长度,使用URL encode之后长度必须小于256字节(不建议传入中文以及特殊字符)
170 | /// 禁止传参带入以下符号: =#%&+?<{}
171 | ///
172 | ///
173 | FlutterKepler.keplerOpenSearchResult(
174 | searchKey: "",
175 | userInfo:{}
176 | );
177 | ```
178 |
179 | * 打开购物车界面
180 | ```
181 | ///
182 | /// 打开购物车界面
183 | /// @param userInfo 不需要可以不传 传参数据为第三方应用自定义,可以为页面,频道标识;也可以标识分成信息;该数据只做统计需求。传参长度,使用URL encode之后长度必须小于256字节(不建议传入中文以及特殊字符)
184 | /// 禁止传参带入以下符号: =#%&+?<{}
185 | ///
186 | ///
187 | FlutterKepler.keplerOpenShoppingCart(
188 | userInfo:{}
189 | );
190 | ```
191 |
192 |
193 | * 添加到购物车(深圳的加车接口)
194 | ```
195 | ///
196 | /// 添加到购物车(深圳的加车接口)
197 | /// @param sku 添加到购物车中的商品id
198 | /// @param number 添加到购物车中商品数量,默认1件
199 | ///result:{
200 | /// errorCode, //0为成功,其他为失败
201 | /// errorMessage, //message
202 | /// }
203 | ///
204 | var result = await FlutterKepler.keplerAddToCartWithSku(
205 | sku: "",
206 | number:"",
207 | );
208 | ```
209 |
210 | * 联盟一键加购
211 | ```
212 | ///
213 | ///联盟一键加购
214 | ///unionID 联盟ID
215 | ///AppID 查看位置:我的推广-推广管理-APP管理
216 | ///skuID 商品SKU,
217 | ///refer refer (原生页面传域名+文章编号)
218 | ///
219 | ///result:{
220 | /// errorCode, //0为成功,其他为失败
221 | /// errorMessage, //message
222 | /// }
223 |
224 | var result = await FlutterKepler.keplerFastPurchase(
225 | unionID: "",
226 | appID: "",
227 | skuID: "",
228 | refer: "",
229 | );
230 | ```
231 |
232 | * 登录授权
233 | ```
234 | ///⚠️iOS可能收不到回调,Android正常,请自行测试
235 | ///登录授权
236 | ///
237 | ///result:{
238 | /// errorCode, //0为成功,其他为失败
239 | /// errorMessage, //message
240 | /// }
241 | var result = await FlutterKepler.keplerLogin();
242 | ```
243 |
244 | * 登出并清除登录状态
245 | ```
246 | ///登出,清除登录状态
247 | FlutterKepler.keplerCancelAuth();
248 | ```
249 |
250 | * 判断是否登录
251 | ```
252 | ///判断登录是否失效
253 | ///
254 | ///result:{
255 | /// errorCode, //0为成功,其他为失败
256 | /// errorMessage, //message
257 | /// }
258 | var result = await FlutterKepler.keplerIsLogin();
259 | ```
260 |
261 | * 是否强制使用H5打开界面 默认为true
262 | ```
263 | /// 是否强制使用H5打开界面 默认为true;
264 | /// 设置为false时,调用商品详情页,订单列表,购物车等方法时将跳转到京东app并打开对应的界面
265 | FlutterKepler.setKeplerOpenByH5(isOpenByH5: bool);
266 | ```
267 |
--------------------------------------------------------------------------------
/android/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | group 'com.wxwx.flutter_kepler'
2 | version '1.0'
3 |
4 | buildscript {
5 | repositories {
6 | google()
7 | jcenter()
8 | }
9 |
10 | dependencies {
11 | classpath 'com.android.tools.build:gradle:3.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 "androidx.test.runner.AndroidJUnitRunner"
30 | }
31 | lintOptions {
32 | disable 'InvalidPackage'
33 | }
34 |
35 | sourceSets{
36 | main{
37 | jniLibs.srcDirs = ['src/libs']
38 | }
39 | }
40 | compileOptions {
41 | sourceCompatibility JavaVersion.VERSION_1_8
42 | targetCompatibility JavaVersion.VERSION_1_8
43 | }
44 | }
45 |
46 | dependencies{
47 | implementation files('src/libs/jdmasdk.jar')
48 | implementation files('src/libs/JDSDK_h.jar')
49 | implementation files('src/libs/cps_1.0.0.jar')
50 | }
51 |
--------------------------------------------------------------------------------
/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 |
3 | #android.useAndroidX=true
4 | #android.enableJetifier=true
5 |
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | zipStoreBase=GRADLE_USER_HOME
4 | zipStorePath=wrapper/dists
5 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
6 |
--------------------------------------------------------------------------------
/android/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'flutter_kepler'
2 |
--------------------------------------------------------------------------------
/android/src/libs/JDSDK_h.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterTaoBaoKe/flutter_kepler/1da2bff95d51bbd0406c37f9109405cbc4f93086/android/src/libs/JDSDK_h.jar
--------------------------------------------------------------------------------
/android/src/libs/armeabi-v7a/libCPS.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterTaoBaoKe/flutter_kepler/1da2bff95d51bbd0406c37f9109405cbc4f93086/android/src/libs/armeabi-v7a/libCPS.so
--------------------------------------------------------------------------------
/android/src/libs/armeabi/libCPS.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterTaoBaoKe/flutter_kepler/1da2bff95d51bbd0406c37f9109405cbc4f93086/android/src/libs/armeabi/libCPS.so
--------------------------------------------------------------------------------
/android/src/libs/cps_1.0.0.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterTaoBaoKe/flutter_kepler/1da2bff95d51bbd0406c37f9109405cbc4f93086/android/src/libs/cps_1.0.0.jar
--------------------------------------------------------------------------------
/android/src/libs/jdmasdk.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterTaoBaoKe/flutter_kepler/1da2bff95d51bbd0406c37f9109405cbc4f93086/android/src/libs/jdmasdk.jar
--------------------------------------------------------------------------------
/android/src/libs/x86/libCPS.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterTaoBaoKe/flutter_kepler/1da2bff95d51bbd0406c37f9109405cbc4f93086/android/src/libs/x86/libCPS.so
--------------------------------------------------------------------------------
/android/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/android/src/main/java/com/wxwx/flutter_kepler/FlutterKeplerHandle.java:
--------------------------------------------------------------------------------
1 | package com.wxwx.flutter_kepler;
2 |
3 | import android.content.DialogInterface;
4 | import android.os.Handler;
5 | import android.util.Log;
6 | import android.webkit.WebChromeClient;
7 | import android.webkit.WebViewClient;
8 | import android.widget.Toast;
9 | import io.flutter.plugin.common.PluginRegistry.Registrar;
10 | import io.flutter.plugin.common.MethodChannel.Result;
11 | import io.flutter.plugin.common.MethodCall;
12 | import java.util.HashMap;
13 | import android.app.AlertDialog;
14 | import static com.wxwx.flutter_kepler.PluginConstants.*;
15 | import static com.wxwx.flutter_kepler.PluginUtil.*;
16 |
17 | import com.kepler.jd.Listener.ActionCallBck;
18 | import com.kepler.jd.Listener.AsyncInitListener;
19 | import com.kepler.jd.Listener.LoginListener;
20 | import com.kepler.jd.Listener.OpenAppAction;
21 | import com.kepler.jd.login.KeplerApiManager;
22 | import com.kepler.jd.sdk.bean.KelperTask;
23 | import com.kepler.jd.sdk.bean.KeplerAttachParameter;
24 | import com.kepler.jd.sdk.bean.KeplerGlobalParameter;
25 | import com.kepler.jd.sdk.exception.KeplerBufferOverflowException;
26 | import com.kepler.jd.sdk.exception.KeplerAttachException;
27 |
28 | import org.json.JSONException;
29 |
30 | import java.util.Map;
31 |
32 | /**
33 | *
34 | * @Author karedem
35 | * @Date 2019/9/7 19:55
36 | * @Description 接口处理者
37 | **/
38 | public class FlutterKeplerHandle {
39 |
40 | private static FlutterKeplerHandle handle;
41 | private Registrar register;
42 | private Handler mHandler = new Handler();
43 | private KelperTask mKelperTask = null;
44 | /**
45 | * 加载对话框
46 | */
47 | private LoadingDialog dialog;
48 |
49 | private OpenAppAction mOpenAppAction = new OpenAppAction() {
50 | @Override
51 | public void onStatus(final int status) {
52 | mHandler.post(new Runnable() {
53 | @Override
54 | public void run() {
55 | if (status == OpenAppAction.OpenAppAction_start) {//开始状态未必一定执行,
56 | //dialogShow();
57 | } else {
58 | mKelperTask=null;
59 | //dialogDiss();
60 | }
61 | }
62 | });
63 | }
64 | };
65 |
66 | /**
67 | * 显示加载对话框
68 | */
69 | private void dialogShow() {
70 | if (dialog == null) {
71 | dialog = new LoadingDialog(register.activity());
72 | // dialog.setCanceledOnTouchOutside(false);
73 | dialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
74 | @Override
75 | public void onCancel(DialogInterface dialog) {
76 | if (mKelperTask != null) {//取消
77 | mKelperTask.setCancel(true);
78 | }
79 | }
80 | });
81 | }
82 | dialog.show();
83 | }
84 |
85 | private void dialogDiss() {
86 | if (dialog != null) {
87 | dialog.dismiss();
88 | }
89 | }
90 |
91 | //第一次调用getInstance register不能为空
92 | public static FlutterKeplerHandle getInstance(Registrar register){
93 | if (handle == null){
94 | synchronized (FlutterKeplerHandle.class){
95 | handle = new FlutterKeplerHandle();
96 | handle.register = register;
97 | }
98 | }
99 | return handle;
100 | }
101 |
102 | /**
103 | * 将map参数构造为 KeplerAttachParameter 对象
104 | * @param map
105 | * @return
106 | */
107 | private KeplerAttachParameter getAttachParameter(Map info) throws JSONException, KeplerAttachException, KeplerBufferOverflowException{
108 | if (info == null){
109 | info = new HashMap<>();
110 | }
111 | KeplerAttachParameter customerInfo = new KeplerAttachParameter();
112 |
113 | for (String key:info.keySet()){
114 | if ("customerInfo".equalsIgnoreCase(key)){
115 | customerInfo.setCustomerInfo(String.valueOf(info.get(key)));
116 | }else if ("positionId".equalsIgnoreCase(key)){
117 | try {
118 | customerInfo.setPositionId((Integer)info.get(key));
119 | }
120 | catch (Exception e){}
121 | }else {
122 | customerInfo.putKeplerAttachParameter(key,String.valueOf(info.get(key)));
123 | }
124 | }
125 | return customerInfo;
126 | }
127 |
128 | /**
129 | * 初始化开普勒
130 | * @param call
131 | * @param result
132 | */
133 | public void initKepler(MethodCall call, Result result){
134 | String appKey = call.argument("appKey");
135 | String appSecret = call.argument("appSecret");
136 | KeplerApiManager.asyncInitSdk(register.activity().getApplication(), appKey, appSecret, new AsyncInitListener() {
137 | @Override
138 | public void onSuccess() {
139 | result.success(PluginResponse.success(null).toMap());
140 | }
141 |
142 | @Override
143 | public void onFailure() {
144 | String errorCode = "-1";
145 | String errorMsg = "初始化失败";
146 | result.success(new PluginResponse(errorCode, errorMsg, null).toMap());
147 | }
148 | });
149 | }
150 |
151 | /**
152 | * 授权登陆
153 | * @param result
154 | */
155 | public void keplerLogin(Result result){
156 | KeplerApiManager.getWebViewService().login(register.activity(), new LoginListener() {
157 | @Override
158 | public void authSuccess() {
159 | result.success(PluginResponse.success(null).toMap());
160 | }
161 |
162 | @Override
163 | public void authFailed(int errorCode) {
164 | result.success(authError(errorCode).toMap());
165 | }
166 | });
167 | }
168 |
169 | public void keplerIsLogin(MethodCall call, Result result){
170 | KeplerApiManager.getWebViewService().checkLoginState(new ActionCallBck() {
171 | @Override
172 | public boolean onDateCall(int key, String info) {
173 | Map res = new HashMap<>();
174 | res.put("key", key);
175 | res.put("info", info);
176 | result.success(PluginResponse.success(res).toMap());
177 | return false;
178 | }
179 |
180 | @Override
181 | public boolean onErrCall(int key, String error) {
182 | result.success(new PluginResponse(String.valueOf(key), error, null).toMap());
183 | return false;
184 | }
185 | });
186 | }
187 |
188 | /**
189 | * 清除授权登陆
190 | * @param result
191 | */
192 | public void keplerCancelAuth(MethodCall call, Result result){
193 | KeplerApiManager.getWebViewService().cancelAuth(register.activity());
194 | }
195 |
196 | /**
197 | * 通过URL方式打开
198 | * @param call
199 | * @param result
200 | */
201 | public void openJDUrlPage(MethodCall call, Result result){
202 | String url = call.argument("url");
203 | Map info = (Map)call.argument("userInfo");
204 | try {
205 | KeplerAttachParameter customerInfo = getAttachParameter(info);
206 | mKelperTask= KeplerApiManager.getWebViewService().openJDUrlPage(url, customerInfo,register.activity(), mOpenAppAction,TIMEOUT);
207 | } catch (KeplerBufferOverflowException | KeplerAttachException | JSONException e) {
208 | result.success(PluginResponse.failed(e).toMap());
209 | }
210 | }
211 |
212 | /**
213 | * 打开导航页
214 | */
215 | public void keplerNavigationPage(MethodCall call, Result result){
216 | Map info = (Map)call.argument("userInfo");
217 | try {
218 | KeplerAttachParameter customerInfo = getAttachParameter(info);
219 | mKelperTask= KeplerApiManager.getWebViewService().openNavigationPage(customerInfo,register.activity(), mOpenAppAction,TIMEOUT);
220 | } catch (KeplerBufferOverflowException | KeplerAttachException | JSONException e) {
221 | result.success(PluginResponse.failed(e).toMap());
222 | }
223 | }
224 |
225 | /**
226 | * 通过SKU 打开商品详情
227 | */
228 | public void keplerOpenItemDetail(MethodCall call, Result result){
229 | String sku = call.argument("sku");
230 | Map info = (Map)call.argument("userInfo");
231 | try {
232 | KeplerAttachParameter customerInfo = getAttachParameter(info);
233 | mKelperTask= KeplerApiManager.getWebViewService().openItemDetailsPage(sku, customerInfo,register.activity(), mOpenAppAction,TIMEOUT);
234 | } catch (KeplerBufferOverflowException | KeplerAttachException | JSONException e) {
235 | result.success(PluginResponse.failed(e).toMap());
236 | }
237 | }
238 |
239 | /**
240 | * 打开dingdan列表
241 | */
242 | public void keplerOpenOrderList(MethodCall call, Result result){
243 | Map info = (Map)call.argument("userInfo");
244 | try {
245 | KeplerAttachParameter customerInfo = getAttachParameter(info);
246 | mKelperTask= KeplerApiManager.getWebViewService().openOrderListPage(customerInfo,register.activity(), mOpenAppAction,TIMEOUT);
247 | } catch (KeplerBufferOverflowException | KeplerAttachException | JSONException e) {
248 | result.success(PluginResponse.failed(e).toMap());
249 | }
250 | }
251 |
252 | /**
253 | * 打开search结果
254 | * @param call
255 | * @param result
256 | */
257 | public void keplerOpenSearchResult(MethodCall call, Result result){
258 | String searchKey = call.argument("searchKey");
259 | Map info = (Map)call.argument("userInfo");
260 | try {
261 | KeplerAttachParameter customerInfo = getAttachParameter(info);
262 | mKelperTask= KeplerApiManager.getWebViewService().openSearchPage(
263 | searchKey, customerInfo, register.activity(), mOpenAppAction, TIMEOUT);
264 | } catch (KeplerBufferOverflowException | KeplerAttachException | JSONException e) {
265 | result.success(PluginResponse.failed(e).toMap());
266 | }
267 | }
268 |
269 | /**
270 | * 打开购物车
271 | * @param result
272 | */
273 | public void keplerOpenShoppingCart(MethodCall call, Result result){
274 | Map info = (Map)call.argument("userInfo");
275 | try {
276 | KeplerAttachParameter customerInfo = getAttachParameter(info);
277 | mKelperTask= KeplerApiManager.getWebViewService().openCartPage(
278 | customerInfo, register.activity(), mOpenAppAction, TIMEOUT);
279 | } catch (KeplerBufferOverflowException | KeplerAttachException | JSONException e) {
280 | result.success(PluginResponse.failed(e).toMap());
281 | }
282 | }
283 |
284 | /**
285 | * 加入shoppingCart
286 | * @param result
287 | */
288 | public void keplerAddToCartWithSku(MethodCall call, Result result){
289 | String sku = call.argument("sku");
290 | String[] skus = new String[]{sku};
291 | String num = call.argument("num");
292 | int[] numbers = new int[]{Integer.parseInt(num)};
293 | try {
294 | KeplerApiManager.getWebViewService().add2Cart(register.activity(), skus, numbers, new ActionCallBck() {
295 | @Override
296 | public boolean onDateCall(int key, String info) {
297 | Map res = new HashMap<>();
298 | res.put("key", key);
299 | res.put("info", info);
300 | result.success(PluginResponse.success(res).toMap());
301 | return false;
302 | }
303 | @Override public boolean onErrCall(int key, final String error) {
304 | PluginResponse response = PluginUtil.addCartError(key, error);
305 | result.success(response.toMap());
306 | return true;
307 | }
308 | });
309 | } catch (Exception e) {
310 | result.success(PluginResponse.failed(e).toMap());
311 | }
312 | }
313 |
314 | /**
315 | * 一键加入购物车
316 | * @param call call.argument["unionID"] 联盟ID,必须传入真实的联盟ID;
317 | * call.argument["appId"] APPID(查看位置:联盟后台-我的推广-推广管理-APP管理);
318 | * call.argument["skuID"] 加车商品的skuId ;
319 | * call.argument["refer"] H5文章页面传url,原生页面传域名+文章编号 ;
320 | * @param result
321 | */
322 | public void keplerFastPurchase(MethodCall call, Result result){
323 | String unionID = call.argument("unionID");
324 | String appId = call.argument("appId");
325 | String skuID = call.argument("skuID");
326 | String refer = call.argument("refer");
327 |
328 | KeplerApiManager.getWebViewService().addToCart(register.activity(),
329 | unionID,
330 | appId,
331 | skuID,
332 | refer, new ActionCallBck() {
333 | @Override
334 | public boolean onDateCall(int key, final String info) {
335 | Map res = new HashMap<>();
336 | res.put("key", key);
337 | res.put("info", info);
338 | result.success(PluginResponse.success(res).toMap());
339 | return false;
340 | }
341 |
342 | @Override
343 | public boolean onErrCall(final int key, final String error) {
344 | PluginResponse response = PluginUtil.addCartError(key, error);
345 | result.success(response.toMap());
346 | return false;
347 | }
348 | });
349 | }
350 |
351 | //原生SDK Android未实现此接口
352 | public void keplerCheckUpdate(MethodCall call, Result result){
353 | //nothing to do
354 | }
355 |
356 | //原生SDK Android未实现此接口
357 | public void setKeplerProgressBarColor(MethodCall call, Result result){
358 | //nothing to do
359 | }
360 |
361 | /**
362 | * 是否强制使用H5打开界面 默认为YES;设置为NO时,调用商品详情页,订单列表,购物车等方法时将跳转到京东app并打开对应的界面.
363 | * @param call
364 | * @param result
365 | */
366 | public void setKeplerOpenByH5(MethodCall call, Result result){
367 | boolean isOpenByH5 = call.argument("isOpenByH5");
368 | KeplerGlobalParameter.getSingleton().setIsOpenByH5Mode(isOpenByH5);
369 | }
370 |
371 | /**
372 | * 打开京东后显示的返回按钮的tagID
373 | * @param call
374 | * @param result
375 | */
376 | public void setKeplerJDappBackTagID(MethodCall call, Result result){
377 | String JDappBackTagID = call.argument("JDappBackTagID");
378 | KeplerGlobalParameter.getSingleton().setJDappBackTagID(JDappBackTagID);
379 | }
380 |
381 | }
--------------------------------------------------------------------------------
/android/src/main/java/com/wxwx/flutter_kepler/FlutterKeplerPlugin.java:
--------------------------------------------------------------------------------
1 | package com.wxwx.flutter_kepler;
2 |
3 | import io.flutter.plugin.common.MethodCall;
4 | import io.flutter.plugin.common.MethodChannel;
5 | import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
6 | import io.flutter.plugin.common.MethodChannel.Result;
7 | import io.flutter.plugin.common.PluginRegistry.Registrar;
8 |
9 | /** FlutterKeplerPlugin */
10 | public class FlutterKeplerPlugin implements MethodCallHandler {
11 |
12 | private static com.wxwx.flutter_kepler.FlutterKeplerHandle handle;
13 | /** Plugin registration. */
14 | public static void registerWith(Registrar registrar) {
15 | handle = FlutterKeplerHandle.getInstance(registrar);
16 | final MethodChannel channel = new MethodChannel(registrar.messenger(), "flutter_kepler");
17 | channel.setMethodCallHandler(new FlutterKeplerPlugin());
18 | }
19 |
20 | @Override
21 | public void onMethodCall(MethodCall call, Result result) {
22 | if (call.method.equals("getPlatformVersion")) {
23 | result.success("Android " + android.os.Build.VERSION.RELEASE);
24 | }else if(call.method.equals("initKepler")){
25 | handle.initKepler(call, result);
26 | }else if(call.method.equals("keplerLogin")){
27 | handle.keplerLogin(result);
28 | }else if(call.method.equals("keplerIsLogin")){
29 | handle.keplerIsLogin(call, result);
30 | }else if(call.method.equals("keplerCancelAuth")){
31 | handle.keplerCancelAuth(call, result);
32 | } else if(call.method.equals("keplerPageWithURL")){
33 | handle.openJDUrlPage(call, result);
34 | } else if(call.method.equals("keplerNavigationPage")){
35 | handle.keplerNavigationPage(call, result);
36 | } else if(call.method.equals("keplerOpenItemDetailWithSKU")){
37 | handle.keplerOpenItemDetail(call, result);
38 | } else if(call.method.equals("keplerOpenOrderList")){
39 | handle.keplerOpenOrderList(call, result);
40 | } else if(call.method.equals("keplerOpenSearchResult")){
41 | handle.keplerOpenSearchResult(call, result);
42 | } else if(call.method.equals("keplerOpenShoppingCart")){
43 | handle.keplerOpenShoppingCart(call, result);
44 | } else if(call.method.equals("keplerAddToCartWithSku")){
45 | handle.keplerAddToCartWithSku(call, result);
46 | } else if(call.method.equals("keplerFastPurchase")){
47 | handle.keplerFastPurchase(call, result);
48 | } else if(call.method.equals("keplerCheckUpdate")){
49 | handle.keplerCheckUpdate(call, result);
50 | } else if(call.method.equals("setKeplerProgressBarColor")){
51 | handle.setKeplerProgressBarColor(call, result);
52 | } else if(call.method.equals("setKeplerOpenByH5")){
53 | handle.setKeplerOpenByH5(call, result);
54 | } else if(call.method.equals("setKeplerJDappBackTagID")){
55 | handle.setKeplerJDappBackTagID(call, result);
56 | } else {
57 | result.notImplemented();
58 | }
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/android/src/main/java/com/wxwx/flutter_kepler/LoadingDialog.java:
--------------------------------------------------------------------------------
1 | package com.wxwx.flutter_kepler;
2 |
3 | import android.app.Dialog;
4 | import android.content.Context;
5 | import android.os.Bundle;
6 | import android.widget.LinearLayout;
7 | import android.widget.TextView;
8 |
9 | import com.wxwx.flutter_kepler.R;
10 |
11 | public class LoadingDialog extends Dialog {
12 |
13 | private TextView tv;
14 |
15 | public LoadingDialog(Context context) {
16 | super(context, R.style.loadingDialogStyle);
17 | }
18 |
19 | @Override
20 | protected void onCreate(Bundle savedInstanceState) {
21 | super.onCreate(savedInstanceState);
22 | setContentView(R.layout.dialogloading);
23 | tv = (TextView)findViewById(R.id.tv);
24 | tv.setText("加载");
25 | LinearLayout linearLayout = (LinearLayout)this.findViewById(R.id.LinearLayout);
26 | linearLayout.getBackground().setAlpha(210);
27 | }
28 |
29 | }
30 |
31 |
--------------------------------------------------------------------------------
/android/src/main/java/com/wxwx/flutter_kepler/PluginConstants.java:
--------------------------------------------------------------------------------
1 | package com.wxwx.flutter_kepler;
2 |
3 | /**
4 | * @Author karedem
5 | * @Date 2019/9/10 11:28
6 | * @Description 常量类
7 | **/
8 | public interface PluginConstants {
9 |
10 | /**
11 | * 超时时间设定
12 | */
13 | int TIMEOUT = 15;
14 | String ERROR_CODE_EXCEPTION = "-99999";
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/android/src/main/java/com/wxwx/flutter_kepler/PluginResponse.java:
--------------------------------------------------------------------------------
1 | package com.wxwx.flutter_kepler;
2 |
3 | import java.io.Serializable;
4 | import java.util.HashMap;
5 | import java.util.Map;
6 |
7 | import static com.wxwx.flutter_kepler.PluginConstants.*;
8 |
9 | /**
10 | * @Author karedem
11 | * @Date 2019/9/7 19:55
12 | * @Description 插件 响应返回实体类
13 | **/
14 | public class PluginResponse implements Serializable {
15 |
16 | private String errorCode;
17 | private String errorMessage;
18 | private Object data;
19 |
20 | public static PluginResponse success(Object obj){
21 | return new PluginResponse("0", "成功", obj);
22 | }
23 |
24 | public static PluginResponse failed(Exception e){
25 | return new PluginResponse(ERROR_CODE_EXCEPTION, "异常中止: " + e.getMessage(), null);
26 | }
27 |
28 | public PluginResponse(String errorCode, String errorMessage, Object data) {
29 | this.errorCode = errorCode;
30 | this.errorMessage = errorMessage;
31 | this.data = data;
32 | }
33 |
34 | public Map toMap(){
35 | HashMap map = new HashMap<>();
36 | map.put("errorCode", errorCode);
37 | map.put("errorMessage", errorMessage);
38 | map.put("data", data);
39 | return map;
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/android/src/main/java/com/wxwx/flutter_kepler/PluginUtil.java:
--------------------------------------------------------------------------------
1 | package com.wxwx.flutter_kepler;
2 |
3 | import static com.wxwx.flutter_kepler.PluginConstants.*;
4 | import com.kepler.jd.login.KeplerApiManager;
5 | import java.util.Map;
6 |
7 | /**
8 | * @Author karedem
9 | * @Date 2019/9/10 11:42
10 | * @Description 映射返回对应值
11 | **/
12 | public class PluginUtil {
13 |
14 |
15 | //根据授权登陆错误码返回对应结果
16 | public static PluginResponse authError(int errorCode){
17 | switch (errorCode) {
18 | case KeplerApiManager.KeplerApiManagerLoginErr_Init:// 初始化失败
19 | return new PluginResponse(String.valueOf(errorCode), "初始化失败", null);
20 | case KeplerApiManager.KeplerApiManagerLoginErr_InitIng:// 初始化没有完成
21 | return new PluginResponse(String.valueOf(errorCode), "初始化没有完成", null);
22 | case KeplerApiManager.KeplerApiManagerLoginErr_openH5authPageURLSettingNull://跳转url // 为null break;
23 | return new PluginResponse(String.valueOf(errorCode),"跳转url为null", null);
24 | case KeplerApiManager.KeplerApiManagerLoginErr_getTokenErr:// 获取失败(oath授权之后,获取cookie过程出错) break;
25 | return new PluginResponse(String.valueOf(errorCode),"获取cookie过程出错", null);
26 | case KeplerApiManager.KeplerApiManagerLoginErr_User_Cancel:// 用户取消 break;
27 | return new PluginResponse(String.valueOf(errorCode),"用户取消", null);
28 | case KeplerApiManager.KeplerApiManagerLoginErr_AuthErr_ActivityOpen://打开授权页面失败 break;
29 | return new PluginResponse(String.valueOf(errorCode),"打开授权页面失败", null);
30 | default:
31 | return new PluginResponse(String.valueOf(errorCode),"未定义的失败原因", null);
32 | }
33 | }
34 |
35 | //根据打开购物车错误码返回对应结果
36 | public static PluginResponse addCartError(int key, String error){
37 | switch (key) {
38 | case KeplerApiManager.KeplerApiManagerActionErr:
39 | case KeplerApiManager.KeplerApiManagerActionServerErr:
40 | // 操作失败 break;
41 | case KeplerApiManager.KeplerApiManagerActionErr_CartFullErr:
42 | // 购物车上限 break;
43 | case KeplerApiManager.KeplerApiManagerActionErr_DataErr:
44 | case KeplerApiManager.KeplerApiManagerActionErr_ParameterErr:
45 | case KeplerApiManager.KeplerApiManagerActionErr_ParserErr:
46 | case KeplerApiManager.KeplerApiManagerActionErr_TokenLast:
47 | case KeplerApiManager.NetLinker_Err_Not_200: // 服务端出错 break;
48 | case KeplerApiManager.KeplerApiManagerActionErr_AppKeyNotExist:// app_key不存在
49 | case KeplerApiManager.KeplerApiManagerActionErr_AppKeyErr:// 无效app_key
50 | case KeplerApiManager.KeplerApiManagerActionErr_AppKeyLast://缺少app_key参数 break;
51 | case KeplerApiManager.KeplerApiManagerActionErr_TokenNotExist:
52 | case KeplerApiManager.KeplerApiManagerActionErr_UNLogin:
53 | case KeplerApiManager.KeplerApiManagerActionErr_TokenTimeOutTErr:
54 | // KeplerApiManager.getWebViewService().login( // StartActivityForSDK.this, // mLoginListener); break;
55 | case KeplerApiManager.NetLinker_Err_NoNetwork: // 没有网络 break;
56 | case KeplerApiManager.NetLinker_Err_UnsupportedEncodingException:
57 | case KeplerApiManager.NetLinker_Err_IOException:
58 | case KeplerApiManager.NetLinker_Err_ClientProtocolException:
59 | case KeplerApiManager.NetLinker_Err_NetException: // 网络访问出错 break;
60 | case KeplerApiManager.KeplerApiManagerAdd2CartErr_NoLogin:
61 | //调用加车接口失败,失败原因:未登录状态
62 | break;
63 | default: break;
64 | }
65 | //这里有error 暂时不用switch判断
66 | return new PluginResponse(String.valueOf(key), error, null);
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/android/src/main/res/drawable-xxhdpi/kepler_back_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterTaoBaoKe/flutter_kepler/1da2bff95d51bbd0406c37f9109405cbc4f93086/android/src/main/res/drawable-xxhdpi/kepler_back_normal.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-xxhdpi/kepler_back_pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterTaoBaoKe/flutter_kepler/1da2bff95d51bbd0406c37f9109405cbc4f93086/android/src/main/res/drawable-xxhdpi/kepler_back_pressed.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-xxhdpi/kepler_selcet_more_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterTaoBaoKe/flutter_kepler/1da2bff95d51bbd0406c37f9109405cbc4f93086/android/src/main/res/drawable-xxhdpi/kepler_selcet_more_normal.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-xxhdpi/kepler_selcet_more_pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterTaoBaoKe/flutter_kepler/1da2bff95d51bbd0406c37f9109405cbc4f93086/android/src/main/res/drawable-xxhdpi/kepler_selcet_more_pressed.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-xxhdpi/neterror.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterTaoBaoKe/flutter_kepler/1da2bff95d51bbd0406c37f9109405cbc4f93086/android/src/main/res/drawable-xxhdpi/neterror.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-xxhdpi/seclect_item_has_message.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterTaoBaoKe/flutter_kepler/1da2bff95d51bbd0406c37f9109405cbc4f93086/android/src/main/res/drawable-xxhdpi/seclect_item_has_message.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-xxhdpi/seclect_item_history.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterTaoBaoKe/flutter_kepler/1da2bff95d51bbd0406c37f9109405cbc4f93086/android/src/main/res/drawable-xxhdpi/seclect_item_history.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-xxhdpi/seclect_item_logout.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterTaoBaoKe/flutter_kepler/1da2bff95d51bbd0406c37f9109405cbc4f93086/android/src/main/res/drawable-xxhdpi/seclect_item_logout.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-xxhdpi/seclect_item_no_has_message.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterTaoBaoKe/flutter_kepler/1da2bff95d51bbd0406c37f9109405cbc4f93086/android/src/main/res/drawable-xxhdpi/seclect_item_no_has_message.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-xxhdpi/seclect_item_orderlist.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterTaoBaoKe/flutter_kepler/1da2bff95d51bbd0406c37f9109405cbc4f93086/android/src/main/res/drawable-xxhdpi/seclect_item_orderlist.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-xxhdpi/seclect_item_serch.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterTaoBaoKe/flutter_kepler/1da2bff95d51bbd0406c37f9109405cbc4f93086/android/src/main/res/drawable-xxhdpi/seclect_item_serch.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-xxhdpi/select_bg.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterTaoBaoKe/flutter_kepler/1da2bff95d51bbd0406c37f9109405cbc4f93086/android/src/main/res/drawable-xxhdpi/select_bg.9.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable-xxhdpi/white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterTaoBaoKe/flutter_kepler/1da2bff95d51bbd0406c37f9109405cbc4f93086/android/src/main/res/drawable-xxhdpi/white.png
--------------------------------------------------------------------------------
/android/src/main/res/drawable/btn_reload.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/android/src/main/res/drawable/kepler_btn_back.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/android/src/main/res/drawable/kepler_btn_select_more.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/android/src/main/res/drawable/kepler_dialog_bk.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
--------------------------------------------------------------------------------
/android/src/main/res/drawable/kepler_dialog_button_ne.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | -
5 |
6 |
7 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/android/src/main/res/drawable/kepler_dialog_button_po.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | -
5 |
6 |
7 |
9 |
10 |
11 |
12 |
13 | -
14 |
15 |
16 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/android/src/main/res/drawable/pressbar_color.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | -
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | -
22 |
23 |
24 |
25 |
26 |
32 |
33 |
34 |
35 |
36 | -
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/android/src/main/res/drawable/sdk_title_bg_with_shadow.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/android/src/main/res/drawable/yuanjiao.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
11 |
12 |
--------------------------------------------------------------------------------
/android/src/main/res/layout/dialogloading.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
15 |
16 |
23 |
24 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/android/src/main/res/layout/item_tab_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
15 |
16 |
23 |
24 |
32 |
33 |
34 |
41 |
42 |
49 |
50 |
58 |
59 |
60 |
67 |
68 |
76 |
77 |
85 |
86 |
87 |
--------------------------------------------------------------------------------
/android/src/main/res/layout/kepler_mid_lin.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/android/src/main/res/layout/kepler_simple_dialog_lay.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
18 |
19 |
25 |
26 |
37 |
38 |
39 |
43 |
44 |
51 |
52 |
64 |
65 |
77 |
78 |
79 |
--------------------------------------------------------------------------------
/android/src/main/res/layout/more_select_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
16 |
17 |
25 |
26 |
--------------------------------------------------------------------------------
/android/src/main/res/layout/neterror_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
17 |
18 |
26 |
27 |
36 |
37 |
46 |
47 |
58 |
59 |
--------------------------------------------------------------------------------
/android/src/main/res/layout/sdk_title_layout.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
12 |
13 |
14 |
15 |
24 |
25 |
26 |
27 |
34 |
35 |
42 |
43 |
44 |
45 |
46 |
54 |
55 |
64 |
65 |
76 |
77 |
78 |
87 |
88 |
97 |
98 |
--------------------------------------------------------------------------------
/android/src/main/res/layout/web_bottom_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
17 |
18 |
23 |
24 |
35 |
36 |
39 |
40 |
--------------------------------------------------------------------------------
/android/src/main/res/raw/safe.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterTaoBaoKe/flutter_kepler/1da2bff95d51bbd0406c37f9109405cbc4f93086/android/src/main/res/raw/safe.jpg
--------------------------------------------------------------------------------
/android/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | sdk
4 | Illegal application ,check init !
5 | 请检查您的网络环境
6 | 订单中心
7 | 最近浏览
8 | 搜索
9 | 消息
10 | 退出登录
11 | "下单后24小时内未支付成功,订单将被取消,请尽快完成支付。"
12 | 确定要离开收银台
13 | 继续支付
14 | 确认离开
15 | 注销成功
16 | 未登录
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/android/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
16 |
17 |
18 |
21 |
22 |
26 |
27 |
31 |
32 |
36 |
37 |
41 |
42 |
48 |
49 |
55 |
56 |
60 |
61 |
65 |
66 |
72 |
73 |
84 |
--------------------------------------------------------------------------------
/example/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 |
12 | # IntelliJ related
13 | *.iml
14 | *.ipr
15 | *.iws
16 | .idea/
17 |
18 | # The .vscode folder contains launch configuration and tasks you configure in
19 | # VS Code which you may wish to be included in version control, so this line
20 | # is commented out by default.
21 | #.vscode/
22 |
23 | # Flutter/Dart/Pub related
24 | **/doc/api/
25 | .dart_tool/
26 | .flutter-plugins
27 | .packages
28 | .pub-cache/
29 | .pub/
30 | /build/
31 |
32 | # Android related
33 | **/android/**/gradle-wrapper.jar
34 | **/android/.gradle
35 | **/android/captures/
36 | **/android/gradlew
37 | **/android/gradlew.bat
38 | **/android/local.properties
39 | **/android/**/GeneratedPluginRegistrant.java
40 |
41 | # iOS/XCode related
42 | **/ios/**/*.mode1v3
43 | **/ios/**/*.mode2v3
44 | **/ios/**/*.moved-aside
45 | **/ios/**/*.pbxuser
46 | **/ios/**/*.perspectivev3
47 | **/ios/**/*sync/
48 | **/ios/**/.sconsign.dblite
49 | **/ios/**/.tags*
50 | **/ios/**/.vagrant/
51 | **/ios/**/DerivedData/
52 | **/ios/**/Icon?
53 | **/ios/**/Pods/
54 | **/ios/**/.symlinks/
55 | **/ios/**/profile
56 | **/ios/**/xcuserdata
57 | **/ios/.generated/
58 | **/ios/Flutter/App.framework
59 | **/ios/Flutter/Flutter.framework
60 | **/ios/Flutter/Generated.xcconfig
61 | **/ios/Flutter/app.flx
62 | **/ios/Flutter/app.zip
63 | **/ios/Flutter/flutter_assets/
64 | **/ios/ServiceDefinitions.json
65 | **/ios/Runner/GeneratedPluginRegistrant.*
66 |
67 | # Exceptions to above rules.
68 | !**/ios/**/default.mode1v3
69 | !**/ios/**/default.mode2v3
70 | !**/ios/**/default.pbxuser
71 | !**/ios/**/default.perspectivev3
72 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
73 |
--------------------------------------------------------------------------------
/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: e4ebcdf6f4facee5779c38a04d91d08dc58ea7a4
8 | channel: beta
9 |
10 | project_type: app
11 |
--------------------------------------------------------------------------------
/example/README.md:
--------------------------------------------------------------------------------
1 | # flutter_kepler_example
2 |
3 | Demonstrates how to use the flutter_kepler plugin.
4 |
5 | ## Getting Started
6 |
7 | This project is a starting point for a Flutter application.
8 |
9 | A few resources to get you started if this is your first Flutter project:
10 |
11 | - [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
12 | - [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)
13 |
14 | For help getting started with Flutter, view our
15 | [online documentation](https://flutter.dev/docs), which offers tutorials,
16 | samples, guidance on mobile development, and a full API reference.
17 |
--------------------------------------------------------------------------------
/example/android/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.wxwx.flutter_kepler_example"
37 | minSdkVersion 16
38 | targetSdkVersion 28
39 | versionCode flutterVersionCode.toInteger()
40 | versionName flutterVersionName
41 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
42 | }
43 |
44 | signingConfigs {
45 | debug {
46 | storeFile file("release.keystore")
47 | storePassword 'cater123'
48 | keyAlias 'release.keystore'
49 | keyPassword 'cater123'
50 | }
51 | release {
52 | storeFile file("release.keystore")
53 | storePassword 'cater123'
54 | keyAlias 'release.keystore'
55 | keyPassword 'cater123'
56 | }
57 | }
58 |
59 | buildTypes {
60 | release {
61 | // Signing with the debug keys for now, so `flutter run --release` works.
62 | signingConfig signingConfigs.debug
63 |
64 | shrinkResources false
65 | ndk {
66 | abiFilters 'armeabi-v7a'
67 | }
68 | }
69 |
70 | debug {
71 | // Signing with the debug keys for now, so `flutter run --release` works.
72 | signingConfig signingConfigs.debug
73 |
74 | shrinkResources false
75 | }
76 | }
77 | }
78 |
79 | flutter {
80 | source '../..'
81 | }
82 |
83 | dependencies {
84 | testImplementation 'junit:junit:4.12'
85 | androidTestImplementation 'androidx.test:runner:1.1.1'
86 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
87 | }
88 |
--------------------------------------------------------------------------------
/example/android/app/release.keystore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterTaoBaoKe/flutter_kepler/1da2bff95d51bbd0406c37f9109405cbc4f93086/example/android/app/release.keystore
--------------------------------------------------------------------------------
/example/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
14 |
18 |
25 |
29 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
41 |
42 |
43 |
44 |
49 |
50 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/example/android/app/src/main/java/com/wxwx/flutter_kepler_example/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.wxwx.flutter_kepler_example;
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/FlutterTaoBaoKe/flutter_kepler/1da2bff95d51bbd0406c37f9109405cbc4f93086/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/FlutterTaoBaoKe/flutter_kepler/1da2bff95d51bbd0406c37f9109405cbc4f93086/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/FlutterTaoBaoKe/flutter_kepler/1da2bff95d51bbd0406c37f9109405cbc4f93086/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/FlutterTaoBaoKe/flutter_kepler/1da2bff95d51bbd0406c37f9109405cbc4f93086/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/FlutterTaoBaoKe/flutter_kepler/1da2bff95d51bbd0406c37f9109405cbc4f93086/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/raw/safe.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterTaoBaoKe/flutter_kepler/1da2bff95d51bbd0406c37f9109405cbc4f93086/example/android/app/src/main/res/raw/safe.jpg
--------------------------------------------------------------------------------
/example/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
--------------------------------------------------------------------------------
/example/android/app/src/profile/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | repositories {
3 | google()
4 | jcenter()
5 | }
6 |
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:3.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 |
3 | #android.useAndroidX=true
4 | #android.enableJetifier=true
5 |
--------------------------------------------------------------------------------
/example/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Jun 23 08:50:38 CEST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
7 |
--------------------------------------------------------------------------------
/example/android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
4 |
5 | def plugins = new Properties()
6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
7 | if (pluginsFile.exists()) {
8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
9 | }
10 |
11 | plugins.each { name, path ->
12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
13 | include ":$name"
14 | project(":$name").projectDir = pluginDirectory
15 | }
16 |
--------------------------------------------------------------------------------
/example/ios/Flutter/AppFrameworkInfo.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | App
9 | CFBundleIdentifier
10 | io.flutter.flutter.app
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | App
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1.0
23 | MinimumOSVersion
24 | 8.0
25 |
26 |
27 |
--------------------------------------------------------------------------------
/example/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/example/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/example/ios/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/wuxing/Documents/environment/flutter"
4 | export "FLUTTER_APPLICATION_PATH=/Users/wuxing/Desktop/flutter/flutter_kepler/example"
5 | export "FLUTTER_TARGET=/Users/wuxing/Desktop/flutter/flutter_kepler/example/lib/main.dart"
6 | export "FLUTTER_BUILD_DIR=build"
7 | export "SYMROOT=${SOURCE_ROOT}/../build/ios"
8 | export "FLUTTER_FRAMEWORK_DIR=/Users/wuxing/Documents/environment/flutter/bin/cache/artifacts/engine/ios"
9 | export "TRACK_WIDGET_CREATION=true"
10 |
--------------------------------------------------------------------------------
/example/ios/Podfile:
--------------------------------------------------------------------------------
1 | # Uncomment this line to define a global platform for your project
2 | # platform :ios, '9.0'
3 |
4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency.
5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true'
6 |
7 | project 'Runner', {
8 | 'Debug' => :debug,
9 | 'Profile' => :release,
10 | 'Release' => :release,
11 | }
12 |
13 | def parse_KV_file(file, separator='=')
14 | file_abs_path = File.expand_path(file)
15 | if !File.exists? file_abs_path
16 | return [];
17 | end
18 | pods_ary = []
19 | skip_line_start_symbols = ["#", "/"]
20 | File.foreach(file_abs_path) { |line|
21 | next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
22 | plugin = line.split(pattern=separator)
23 | if plugin.length == 2
24 | podname = plugin[0].strip()
25 | path = plugin[1].strip()
26 | podpath = File.expand_path("#{path}", file_abs_path)
27 | pods_ary.push({:name => podname, :path => podpath});
28 | else
29 | puts "Invalid plugin specification: #{line}"
30 | end
31 | }
32 | return pods_ary
33 | end
34 |
35 | target 'Runner' do
36 | # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
37 | # referring to absolute paths on developers' machines.
38 | system('rm -rf .symlinks')
39 | system('mkdir -p .symlinks/plugins')
40 |
41 | # Flutter Pods
42 | generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig')
43 | if generated_xcode_build_settings.empty?
44 | puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first."
45 | end
46 | generated_xcode_build_settings.map { |p|
47 | if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
48 | symlink = File.join('.symlinks', 'flutter')
49 | File.symlink(File.dirname(p[:path]), symlink)
50 | pod 'Flutter', :path => File.join(symlink, File.basename(p[:path]))
51 | end
52 | }
53 |
54 | # Plugin Pods
55 | plugin_pods = parse_KV_file('../.flutter-plugins')
56 | plugin_pods.map { |p|
57 | symlink = File.join('.symlinks', 'plugins', p[:name])
58 | File.symlink(p[:path], symlink)
59 | pod p[:name], :path => File.join(symlink, 'ios')
60 | }
61 | end
62 |
63 | # Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system.
64 | install! 'cocoapods', :disable_input_output_paths => true
65 |
66 | post_install do |installer|
67 | installer.pods_project.targets.each do |target|
68 | target.build_configurations.each do |config|
69 | config.build_settings['ENABLE_BITCODE'] = 'NO'
70 | end
71 | end
72 | end
73 |
--------------------------------------------------------------------------------
/example/ios/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - Flutter (1.0.0)
3 | - flutter_kepler (0.0.1):
4 | - Flutter
5 |
6 | DEPENDENCIES:
7 | - Flutter (from `.symlinks/flutter/ios`)
8 | - flutter_kepler (from `.symlinks/plugins/flutter_kepler/ios`)
9 |
10 | EXTERNAL SOURCES:
11 | Flutter:
12 | :path: ".symlinks/flutter/ios"
13 | flutter_kepler:
14 | :path: ".symlinks/plugins/flutter_kepler/ios"
15 |
16 | SPEC CHECKSUMS:
17 | Flutter: 0e3d915762c693b495b44d77113d4970485de6ec
18 | flutter_kepler: 871457e3a934d3f99f3ae6c63fb3de88e8b55829
19 |
20 | PODFILE CHECKSUM: 7fb83752f59ead6285236625b82473f90b1cb932
21 |
22 | COCOAPODS: 1.6.1
23 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
39 |
40 |
41 |
42 |
43 |
44 |
54 |
56 |
62 |
63 |
64 |
65 |
66 |
67 |
73 |
75 |
81 |
82 |
83 |
84 |
86 |
87 |
90 |
91 |
92 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/Runner/AppDelegate.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 |
4 | @interface AppDelegate : FlutterAppDelegate
5 |
6 | @end
7 |
--------------------------------------------------------------------------------
/example/ios/Runner/AppDelegate.m:
--------------------------------------------------------------------------------
1 | #include "AppDelegate.h"
2 | #include "GeneratedPluginRegistrant.h"
3 |
4 | @implementation AppDelegate
5 |
6 | - (BOOL)application:(UIApplication *)application
7 | didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
8 | [GeneratedPluginRegistrant registerWithRegistry:self];
9 | // Override point for customization after application launch.
10 | return [super application:application didFinishLaunchingWithOptions:launchOptions];
11 | }
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "20x20",
5 | "idiom" : "iphone",
6 | "filename" : "Icon-App-20x20@2x.png",
7 | "scale" : "2x"
8 | },
9 | {
10 | "size" : "20x20",
11 | "idiom" : "iphone",
12 | "filename" : "Icon-App-20x20@3x.png",
13 | "scale" : "3x"
14 | },
15 | {
16 | "size" : "29x29",
17 | "idiom" : "iphone",
18 | "filename" : "Icon-App-29x29@1x.png",
19 | "scale" : "1x"
20 | },
21 | {
22 | "size" : "29x29",
23 | "idiom" : "iphone",
24 | "filename" : "Icon-App-29x29@2x.png",
25 | "scale" : "2x"
26 | },
27 | {
28 | "size" : "29x29",
29 | "idiom" : "iphone",
30 | "filename" : "Icon-App-29x29@3x.png",
31 | "scale" : "3x"
32 | },
33 | {
34 | "size" : "40x40",
35 | "idiom" : "iphone",
36 | "filename" : "Icon-App-40x40@2x.png",
37 | "scale" : "2x"
38 | },
39 | {
40 | "size" : "40x40",
41 | "idiom" : "iphone",
42 | "filename" : "Icon-App-40x40@3x.png",
43 | "scale" : "3x"
44 | },
45 | {
46 | "size" : "60x60",
47 | "idiom" : "iphone",
48 | "filename" : "Icon-App-60x60@2x.png",
49 | "scale" : "2x"
50 | },
51 | {
52 | "size" : "60x60",
53 | "idiom" : "iphone",
54 | "filename" : "Icon-App-60x60@3x.png",
55 | "scale" : "3x"
56 | },
57 | {
58 | "size" : "20x20",
59 | "idiom" : "ipad",
60 | "filename" : "Icon-App-20x20@1x.png",
61 | "scale" : "1x"
62 | },
63 | {
64 | "size" : "20x20",
65 | "idiom" : "ipad",
66 | "filename" : "Icon-App-20x20@2x.png",
67 | "scale" : "2x"
68 | },
69 | {
70 | "size" : "29x29",
71 | "idiom" : "ipad",
72 | "filename" : "Icon-App-29x29@1x.png",
73 | "scale" : "1x"
74 | },
75 | {
76 | "size" : "29x29",
77 | "idiom" : "ipad",
78 | "filename" : "Icon-App-29x29@2x.png",
79 | "scale" : "2x"
80 | },
81 | {
82 | "size" : "40x40",
83 | "idiom" : "ipad",
84 | "filename" : "Icon-App-40x40@1x.png",
85 | "scale" : "1x"
86 | },
87 | {
88 | "size" : "40x40",
89 | "idiom" : "ipad",
90 | "filename" : "Icon-App-40x40@2x.png",
91 | "scale" : "2x"
92 | },
93 | {
94 | "size" : "76x76",
95 | "idiom" : "ipad",
96 | "filename" : "Icon-App-76x76@1x.png",
97 | "scale" : "1x"
98 | },
99 | {
100 | "size" : "76x76",
101 | "idiom" : "ipad",
102 | "filename" : "Icon-App-76x76@2x.png",
103 | "scale" : "2x"
104 | },
105 | {
106 | "size" : "83.5x83.5",
107 | "idiom" : "ipad",
108 | "filename" : "Icon-App-83.5x83.5@2x.png",
109 | "scale" : "2x"
110 | },
111 | {
112 | "size" : "1024x1024",
113 | "idiom" : "ios-marketing",
114 | "filename" : "Icon-App-1024x1024@1x.png",
115 | "scale" : "1x"
116 | }
117 | ],
118 | "info" : {
119 | "version" : 1,
120 | "author" : "xcode"
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterTaoBaoKe/flutter_kepler/1da2bff95d51bbd0406c37f9109405cbc4f93086/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/FlutterTaoBaoKe/flutter_kepler/1da2bff95d51bbd0406c37f9109405cbc4f93086/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/FlutterTaoBaoKe/flutter_kepler/1da2bff95d51bbd0406c37f9109405cbc4f93086/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/FlutterTaoBaoKe/flutter_kepler/1da2bff95d51bbd0406c37f9109405cbc4f93086/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/FlutterTaoBaoKe/flutter_kepler/1da2bff95d51bbd0406c37f9109405cbc4f93086/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/FlutterTaoBaoKe/flutter_kepler/1da2bff95d51bbd0406c37f9109405cbc4f93086/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/FlutterTaoBaoKe/flutter_kepler/1da2bff95d51bbd0406c37f9109405cbc4f93086/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/FlutterTaoBaoKe/flutter_kepler/1da2bff95d51bbd0406c37f9109405cbc4f93086/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/FlutterTaoBaoKe/flutter_kepler/1da2bff95d51bbd0406c37f9109405cbc4f93086/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/FlutterTaoBaoKe/flutter_kepler/1da2bff95d51bbd0406c37f9109405cbc4f93086/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/FlutterTaoBaoKe/flutter_kepler/1da2bff95d51bbd0406c37f9109405cbc4f93086/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/FlutterTaoBaoKe/flutter_kepler/1da2bff95d51bbd0406c37f9109405cbc4f93086/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/FlutterTaoBaoKe/flutter_kepler/1da2bff95d51bbd0406c37f9109405cbc4f93086/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/FlutterTaoBaoKe/flutter_kepler/1da2bff95d51bbd0406c37f9109405cbc4f93086/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/FlutterTaoBaoKe/flutter_kepler/1da2bff95d51bbd0406c37f9109405cbc4f93086/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/FlutterTaoBaoKe/flutter_kepler/1da2bff95d51bbd0406c37f9109405cbc4f93086/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterTaoBaoKe/flutter_kepler/1da2bff95d51bbd0406c37f9109405cbc4f93086/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterTaoBaoKe/flutter_kepler/1da2bff95d51bbd0406c37f9109405cbc4f93086/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md:
--------------------------------------------------------------------------------
1 | # Launch Screen Assets
2 |
3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory.
4 |
5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
--------------------------------------------------------------------------------
/example/ios/Runner/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/example/ios/Runner/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/example/ios/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | flutter_kepler_example
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | $(FLUTTER_BUILD_NAME)
19 | CFBundleSignature
20 | ????
21 | CFBundleURLTypes
22 |
23 |
24 | CFBundleTypeRole
25 | Editor
26 | CFBundleURLSchemes
27 |
28 | sdkback0f777b0b8bc2db2c3105394cb3700111
29 |
30 |
31 |
32 | CFBundleVersion
33 | $(FLUTTER_BUILD_NUMBER)
34 | LSApplicationQueriesSchemes
35 |
36 | weixin
37 | openapp.jdmobile
38 | jdlogin
39 |
40 | LSRequiresIPhoneOS
41 |
42 | NSCameraUsageDescription
43 | 请允许APP访问您的相机
44 | NSPhotoLibraryUsageDescription
45 | 请允许APP使用你的相册
46 | UILaunchStoryboardName
47 | LaunchScreen
48 | UIMainStoryboardFile
49 | Main
50 | UISupportedInterfaceOrientations
51 |
52 | UIInterfaceOrientationPortrait
53 | UIInterfaceOrientationLandscapeLeft
54 | UIInterfaceOrientationLandscapeRight
55 |
56 | UISupportedInterfaceOrientations~ipad
57 |
58 | UIInterfaceOrientationPortrait
59 | UIInterfaceOrientationPortraitUpsideDown
60 | UIInterfaceOrientationLandscapeLeft
61 | UIInterfaceOrientationLandscapeRight
62 |
63 | UIViewControllerBasedStatusBarAppearance
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/example/ios/Runner/Kepler.bundle/safe.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterTaoBaoKe/flutter_kepler/1da2bff95d51bbd0406c37f9109405cbc4f93086/example/ios/Runner/Kepler.bundle/safe.jpg
--------------------------------------------------------------------------------
/example/ios/Runner/main.m:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 | #import "AppDelegate.h"
4 |
5 | int main(int argc, char* argv[]) {
6 | @autoreleasepool {
7 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/example/lib/main.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 |
3 | import 'package:flutter/material.dart';
4 | import 'package:flutter/services.dart';
5 | import 'package:flutter_kepler/flutter_kepler.dart';
6 |
7 | void main() => runApp(MyApp());
8 |
9 | class MyApp extends StatefulWidget {
10 | @override
11 | _MyAppState createState() => _MyAppState();
12 | }
13 |
14 | class _MyAppState extends State {
15 | String _platformVersion = 'Unknown';
16 |
17 | @override
18 | void initState() {
19 | super.initState();
20 | initPlatformState();
21 | }
22 |
23 | // Platform messages are asynchronous, so we initialize in an async method.
24 | Future initPlatformState() async {
25 | String platformVersion;
26 | // Platform messages may fail, so we use a try/catch PlatformException.
27 | try {
28 | platformVersion = await FlutterKepler.platformVersion;
29 | } on PlatformException {
30 | platformVersion = 'Failed to get platform version.';
31 | }
32 |
33 | // If the widget was removed from the tree while the asynchronous platform
34 | // message was in flight, we want to discard the reply rather than calling
35 | // setState to update our non-existent appearance.
36 | if (!mounted) return;
37 |
38 | setState(() {
39 | _platformVersion = platformVersion;
40 | });
41 | }
42 |
43 | @override
44 | Widget build(BuildContext context) {
45 | return MaterialApp(
46 | home: Scaffold(
47 | appBar: AppBar(
48 | title: const Text('Plugin example app'),
49 | ),
50 | body: CustomScrollView(
51 | slivers: [
52 | SliverList(
53 | delegate:
54 | SliverChildBuilderDelegate(_buildItem, childCount: 1),
55 | ),
56 | ],
57 | )));
58 | }
59 |
60 | Widget _buildItem(BuildContext context, int index) {
61 | return Center(
62 | child: Column(children: [
63 | FlatButton(
64 | child: Text("初始化开普勒"),
65 | onPressed: () async {
66 | try {
67 | // var waite3s = await FlutterAlibc.openItemDetail(itemID: "12345");
68 | // 如果什么都不给
69 | var result = await FlutterKepler.initKepler(
70 | appKey: "0f777b0b8bc2db2c3105394cb3700111",
71 | appSecret: "eeac919be32c4cdbaaeca71bf8974112",
72 | );
73 | print(result);
74 | } on Exception {}
75 | },
76 | ),
77 | FlatButton(
78 | child: Text("打开Url"),
79 | onPressed: () {
80 | FlutterKepler.keplerPageWithURL(
81 | url: "https://item.jd.com/10510526268.html",
82 | );
83 | },
84 | ),
85 | FlatButton(
86 | child: Text("打开导航页"),
87 | onPressed: () {
88 | FlutterKepler.keplerNavigationPage();
89 | },
90 | ),
91 | FlatButton(
92 | child: Text("通过SKU打开Kepler单品页"),
93 | onPressed: () {
94 | FlutterKepler.keplerOpenItemDetailWithSKU(
95 | sku: "43684925672",
96 | );
97 | },
98 | ),
99 | FlatButton(
100 | child: Text("打开订单列表"),
101 | onPressed: () {
102 | FlutterKepler.keplerOpenOrderList();
103 | },
104 | ),
105 | FlatButton(
106 | child: Text("根据搜索关键字打开搜索结果页"),
107 | onPressed: () {
108 | FlutterKepler.keplerOpenSearchResult(
109 | searchKey: "耐克",
110 | );
111 | },
112 | ),
113 | FlatButton(
114 | child: Text("打开购物车界面"),
115 | onPressed: () {
116 | FlutterKepler.keplerOpenShoppingCart();
117 | },
118 | ),
119 | FlatButton(
120 | child: Text("添加到购物车(深圳的加车接口)"),
121 | onPressed: () async {
122 | var result = await FlutterKepler.keplerAddToCartWithSku(
123 | sku: "43684925672",
124 | );
125 | print(result.errorCode);
126 | },
127 | ),
128 | FlatButton(
129 | child: Text("联盟一键加购"),
130 | onPressed: () async {
131 | var result = await FlutterKepler.keplerFastPurchase(
132 | unionID: "",
133 | appID: "",
134 | skuID: "",
135 | refer: "",
136 | );
137 | print(result.errorCode);
138 | },
139 | ),
140 | // FlatButton(
141 | // child: Text("静态化检测更新"),
142 | // onPressed: () {
143 | // FlutterKepler.keplerCheckUpdate();
144 | // },
145 | // ),
146 | FlatButton(
147 | child: Text("登录授权"),
148 | onPressed: () async {
149 | var result = await FlutterKepler.keplerLogin();
150 | print(result.errorCode);
151 | },
152 | ),
153 | FlatButton(
154 | child: Text("取消授权并且清除登录态"),
155 | onPressed: () {
156 | FlutterKepler.keplerCancelAuth();
157 | },
158 | ),
159 | // FlatButton(
160 | // child: Text("设置进度条颜色"),
161 | // onPressed: () {
162 | // FlutterKepler.setKeplerProgressBarColor(color: "##e23b41");
163 | // },
164 | // ),
165 | FlatButton(
166 | child: Text("判断是否登录"),
167 | onPressed: () async {
168 | var result = await FlutterKepler.keplerIsLogin();
169 | print(result.errorCode);
170 | },
171 | ),
172 | FlatButton(
173 | child: Text("是否强制用h5打开"),
174 | onPressed: () {
175 | FlutterKepler.setKeplerOpenByH5(isOpenByH5: true);
176 | },
177 | ),
178 | ]),
179 | );
180 | }
181 | }
182 |
--------------------------------------------------------------------------------
/example/pubspec.lock:
--------------------------------------------------------------------------------
1 | # Generated by pub
2 | # See https://dart.dev/tools/pub/glossary#lockfile
3 | packages:
4 | async:
5 | dependency: transitive
6 | description:
7 | name: async
8 | url: "https://pub.dartlang.org"
9 | source: hosted
10 | version: "2.3.0"
11 | boolean_selector:
12 | dependency: transitive
13 | description:
14 | name: boolean_selector
15 | url: "https://pub.dartlang.org"
16 | source: hosted
17 | version: "1.0.5"
18 | charcode:
19 | dependency: transitive
20 | description:
21 | name: charcode
22 | url: "https://pub.dartlang.org"
23 | source: hosted
24 | version: "1.1.2"
25 | collection:
26 | dependency: transitive
27 | description:
28 | name: collection
29 | url: "https://pub.dartlang.org"
30 | source: hosted
31 | version: "1.14.11"
32 | cupertino_icons:
33 | dependency: "direct main"
34 | description:
35 | name: cupertino_icons
36 | url: "https://pub.dartlang.org"
37 | source: hosted
38 | version: "0.1.2"
39 | flutter:
40 | dependency: "direct main"
41 | description: flutter
42 | source: sdk
43 | version: "0.0.0"
44 | flutter_kepler:
45 | dependency: "direct dev"
46 | description:
47 | path: ".."
48 | relative: true
49 | source: path
50 | version: "0.0.1"
51 | flutter_test:
52 | dependency: "direct dev"
53 | description: flutter
54 | source: sdk
55 | version: "0.0.0"
56 | matcher:
57 | dependency: transitive
58 | description:
59 | name: matcher
60 | url: "https://pub.dartlang.org"
61 | source: hosted
62 | version: "0.12.5"
63 | meta:
64 | dependency: transitive
65 | description:
66 | name: meta
67 | url: "https://pub.dartlang.org"
68 | source: hosted
69 | version: "1.1.7"
70 | path:
71 | dependency: transitive
72 | description:
73 | name: path
74 | url: "https://pub.dartlang.org"
75 | source: hosted
76 | version: "1.6.4"
77 | pedantic:
78 | dependency: transitive
79 | description:
80 | name: pedantic
81 | url: "https://pub.dartlang.org"
82 | source: hosted
83 | version: "1.8.0+1"
84 | quiver:
85 | dependency: transitive
86 | description:
87 | name: quiver
88 | url: "https://pub.dartlang.org"
89 | source: hosted
90 | version: "2.0.5"
91 | sky_engine:
92 | dependency: transitive
93 | description: flutter
94 | source: sdk
95 | version: "0.0.99"
96 | source_span:
97 | dependency: transitive
98 | description:
99 | name: source_span
100 | url: "https://pub.dartlang.org"
101 | source: hosted
102 | version: "1.5.5"
103 | stack_trace:
104 | dependency: transitive
105 | description:
106 | name: stack_trace
107 | url: "https://pub.dartlang.org"
108 | source: hosted
109 | version: "1.9.3"
110 | stream_channel:
111 | dependency: transitive
112 | description:
113 | name: stream_channel
114 | url: "https://pub.dartlang.org"
115 | source: hosted
116 | version: "2.0.0"
117 | string_scanner:
118 | dependency: transitive
119 | description:
120 | name: string_scanner
121 | url: "https://pub.dartlang.org"
122 | source: hosted
123 | version: "1.0.5"
124 | term_glyph:
125 | dependency: transitive
126 | description:
127 | name: term_glyph
128 | url: "https://pub.dartlang.org"
129 | source: hosted
130 | version: "1.1.0"
131 | test_api:
132 | dependency: transitive
133 | description:
134 | name: test_api
135 | url: "https://pub.dartlang.org"
136 | source: hosted
137 | version: "0.2.5"
138 | typed_data:
139 | dependency: transitive
140 | description:
141 | name: typed_data
142 | url: "https://pub.dartlang.org"
143 | source: hosted
144 | version: "1.1.6"
145 | vector_math:
146 | dependency: transitive
147 | description:
148 | name: vector_math
149 | url: "https://pub.dartlang.org"
150 | source: hosted
151 | version: "2.0.8"
152 | sdks:
153 | dart: ">=2.2.2 <3.0.0"
154 |
--------------------------------------------------------------------------------
/example/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: flutter_kepler_example
2 | description: Demonstrates how to use the flutter_kepler plugin.
3 | publish_to: 'none'
4 |
5 | environment:
6 | sdk: ">=2.1.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 | flutter_kepler:
21 | path: ../
22 |
23 | # For information on the generic Dart part of this file, see the
24 | # following page: https://dart.dev/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.dev/assets-and-images/#resolution-aware.
41 |
42 | # For details regarding adding assets from package dependencies, see
43 | # https://flutter.dev/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.dev/custom-fonts/#from-packages
64 |
--------------------------------------------------------------------------------
/example/test/widget_test.dart:
--------------------------------------------------------------------------------
1 | // This is a basic Flutter widget test.
2 | //
3 | // To perform an interaction with a widget in your test, use the WidgetTester
4 | // utility that Flutter provides. For example, you can send tap and scroll
5 | // gestures. You can also use WidgetTester to find child widgets in the widget
6 | // tree, read text, and verify that the values of widget properties are correct.
7 |
8 | import 'package:flutter/material.dart';
9 | import 'package:flutter_test/flutter_test.dart';
10 |
11 | import 'package:flutter_kepler_example/main.dart';
12 |
13 | void main() {
14 | testWidgets('Verify Platform version', (WidgetTester tester) async {
15 | // Build our app and trigger a frame.
16 | await tester.pumpWidget(MyApp());
17 |
18 | // Verify that platform version is retrieved.
19 | expect(
20 | find.byWidgetPredicate(
21 | (Widget widget) => widget is Text &&
22 | widget.data.startsWith('Running on:'),
23 | ),
24 | findsOneWidget,
25 | );
26 | });
27 | }
28 |
--------------------------------------------------------------------------------
/flutter_kepler.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/flutter_kepler/.idea/workspace.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 | 1567853606742
66 |
67 |
68 | 1567853606742
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
--------------------------------------------------------------------------------
/images/ios.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterTaoBaoKe/flutter_kepler/1da2bff95d51bbd0406c37f9109405cbc4f93086/images/ios.jpg
--------------------------------------------------------------------------------
/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/FlutterTaoBaoKe/flutter_kepler/1da2bff95d51bbd0406c37f9109405cbc4f93086/ios/Assets/.gitkeep
--------------------------------------------------------------------------------
/ios/Classes/ConstKey/FlutterKeplerConstKey.h:
--------------------------------------------------------------------------------
1 | //
2 | // FlutterKeplerConstKey.h
3 | // flutter_Kepler
4 | //
5 | // Created by 吴兴 on 2019/9/4.
6 | //
7 |
8 | #ifndef FlutterKeplerConstKey_h
9 | #define FlutterKeplerConstKey_h
10 |
11 | static NSString *FlutterKeplerConstKey_ErrorCode = @"errorCode";
12 | static NSString *FlutterKeplerConstKey_ErrorMessage = @"errorMessage";
13 | static NSString *FlutterKeplerConstKey_Data = @"data";
14 | #endif /* FlutterKeplerConstKey_h */
15 |
--------------------------------------------------------------------------------
/ios/Classes/FlutterKeplerPlugin.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @interface FlutterKeplerPlugin : NSObject
4 | @end
5 |
--------------------------------------------------------------------------------
/ios/Classes/FlutterKeplerPlugin.m:
--------------------------------------------------------------------------------
1 | #import "FlutterKeplerPlugin.h"
2 | #import "FlutterKeplerHandler.h"
3 | #import
4 | #import
5 | @interface FlutterKeplerPlugin()
6 | @property(nonatomic,strong) FlutterKeplerHandler *keplerHandler;
7 | @end
8 |
9 | @implementation FlutterKeplerPlugin
10 | + (void)registerWithRegistrar:(NSObject*)registrar {
11 | FlutterMethodChannel* channel = [FlutterMethodChannel
12 | methodChannelWithName:@"flutter_kepler"
13 | binaryMessenger:[registrar messenger]];
14 | FlutterKeplerPlugin* instance = [[FlutterKeplerPlugin alloc] initWithRegistrar:registrar];
15 | [registrar addMethodCallDelegate:instance channel:channel];
16 | }
17 | - (instancetype)initWithRegistrar:(NSObject *)registrar {
18 | self = [super init];
19 |
20 | if (self) {
21 | self.keplerHandler = [[FlutterKeplerHandler alloc]init];
22 | }
23 |
24 | return self;
25 | }
26 | - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
27 | if ([@"getPlatformVersion" isEqualToString:call.method]) {
28 | result([@"iOS " stringByAppendingString:[[UIDevice currentDevice] systemVersion]]);
29 | }else if ([@"initKepler" isEqualToString:call.method]) {
30 | [_keplerHandler initKepler:call result:result];
31 | }else if ([@"keplerPageWithURL" isEqualToString:call.method]) {
32 | [_keplerHandler keplerPageWithURL:call result:result];
33 | }else if ([@"keplerNavigationPage" isEqualToString:call.method]) {
34 | [_keplerHandler keplerNavigationPage:call result:result];
35 | }else if ([@"keplerOpenItemDetailWithSKU" isEqualToString:call.method]) {
36 | [_keplerHandler keplerOpenItemDetailWithSKU:call result:result];
37 | }else if ([@"keplerOpenOrderList" isEqualToString:call.method]) {
38 | [_keplerHandler keplerOpenOrderList:call result:result];
39 | }else if ([@"keplerOpenSearchResult" isEqualToString:call.method]) {
40 | [_keplerHandler keplerOpenSearchResult:call result:result];
41 | }else if ([@"keplerOpenShoppingCart" isEqualToString:call.method]) {
42 | [_keplerHandler keplerOpenShoppingCart:call result:result];
43 | }else if ([@"keplerAddToCartWithSku" isEqualToString:call.method]) {
44 | [_keplerHandler keplerAddToCartWithSku:call result:result];
45 | }else if ([@"keplerFastPurchase" isEqualToString:call.method]) {
46 | [_keplerHandler keplerFastPurchase:call result:result];
47 | }else if ([@"keplerCheckUpdate" isEqualToString:call.method]) {
48 | [_keplerHandler keplerCheckUpdate:call result:result];
49 | }else if ([@"keplerLogin" isEqualToString:call.method]) {
50 | [_keplerHandler keplerLogin:call result:result];
51 | }else if ([@"keplerCancelAuth" isEqualToString:call.method]) {
52 | [_keplerHandler keplerCancelAuth:call result:result];
53 | }else if ([@"setKeplerProgressBarColor" isEqualToString:call.method]) {
54 | [_keplerHandler setKeplerProgressBarColor:call result:result];
55 | }else if ([@"keplerIsLogin" isEqualToString:call.method]) {
56 | [_keplerHandler keplerLoginWithSuccess:call result:result];
57 | }else if ([@"setKeplerOpenByH5" isEqualToString:call.method]) {
58 | [_keplerHandler setKeplerOpenByH5:call result:result];
59 | } else {
60 | result(FlutterMethodNotImplemented);
61 | }
62 | }
63 |
64 |
65 |
66 | - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *) sourceApplication annotation:(id)annotation NS_AVAILABLE_IOS(4_2){
67 | if(![[KeplerApiManager sharedKPService] handleOpenURL:url]){
68 | // 处理其他app跳转到自己的app
69 | }
70 | return YES;
71 | }
72 |
73 | - (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary *)options{
74 | if (@available(iOS 9.0, *)) {
75 | __unused BOOL isHandledByKepler=[[KeplerApiManager sharedKPService] handleOpenURL:url];
76 | } else {
77 | // Fallback on earlier versions
78 | }
79 | return YES;
80 | }
81 |
82 |
83 |
84 |
85 | @end
86 |
--------------------------------------------------------------------------------
/ios/Classes/Handle/FlutterKeplerHandler.h:
--------------------------------------------------------------------------------
1 | //
2 | // FlutterKeplerHandler.h
3 | // flutter_kepler
4 | //
5 | // Created by 吴兴 on 2019/9/10.
6 | //
7 |
8 | #import
9 | #import
10 | NS_ASSUME_NONNULL_BEGIN
11 |
12 | @interface FlutterKeplerHandler : NSObject
13 | //初始化
14 | - (void)initKepler:(FlutterMethodCall *)call result:(FlutterResult)result;
15 | // * 通过URL打开任意商品页面
16 | - (void)keplerPageWithURL:(FlutterMethodCall *)call result:(FlutterResult)result;
17 | //打开导航页
18 | - (void)keplerNavigationPage:(FlutterMethodCall *)call result:(FlutterResult)result;
19 | // * 通过SKU打开Kepler单品页
20 | - (void)keplerOpenItemDetailWithSKU:(FlutterMethodCall *)call result:(FlutterResult)result;
21 | //打开订单列表 (支持Native && H5)
22 | - (void)keplerOpenOrderList:(FlutterMethodCall *)call result:(FlutterResult)result;
23 | //根据搜索关键字打开搜索结果页
24 | - (void)keplerOpenSearchResult:(FlutterMethodCall *)call result:(FlutterResult)result;
25 | //打开购物车
26 | - (void)keplerOpenShoppingCart:(FlutterMethodCall *)call result:(FlutterResult)result;
27 | // 添加到购物车(深圳)
28 | - (void)keplerAddToCartWithSku:(FlutterMethodCall *)call result:(FlutterResult)result;
29 | // 联盟一键加购
30 | - (void)keplerFastPurchase:(FlutterMethodCall *)call result:(FlutterResult)result;
31 | //静态化检测更新
32 | - (void)keplerCheckUpdate:(FlutterMethodCall *)call result:(FlutterResult)result;
33 | //登录授权
34 | - (void)keplerLogin:(FlutterMethodCall *)call result:(FlutterResult)result;
35 | //取消授权并且清除登录态
36 | - (void)keplerCancelAuth:(FlutterMethodCall *)call result:(FlutterResult)result;
37 |
38 | //设置进度条颜色
39 | - (void)setKeplerProgressBarColor:(FlutterMethodCall *)call result:(FlutterResult)result;
40 | //检测登录态
41 | - (void)keplerLoginWithSuccess:(FlutterMethodCall *)call result:(FlutterResult)result;
42 | // 是否强制使用H5打开界面 默认为YES;设置为NO时,调用商品详情页,订单列表,购物车等方法时将跳转到京东app并打开对应的界面.
43 | - (void)setKeplerOpenByH5:(FlutterMethodCall *)call result:(FlutterResult)result;
44 | //打开京东后显示的返回按钮的tagID
45 | - (void)setKeplerJDappBackTagID:(FlutterMethodCall *)call result:(FlutterResult)result;
46 | @end
47 |
48 | NS_ASSUME_NONNULL_END
49 |
--------------------------------------------------------------------------------
/ios/Classes/Handle/FlutterKeplerHandler.m:
--------------------------------------------------------------------------------
1 | //
2 | // FlutterKeplerHandler.m
3 | // flutter_kepler
4 | //
5 | // Created by 吴兴 on 2019/9/10.
6 | //
7 |
8 | #import "FlutterKeplerHandler.h"
9 | #import
10 | #import
11 | #import "FlutterKeplerConstKey.h"
12 | #import "FlutterKeplerTools.h"
13 | @implementation FlutterKeplerHandler
14 | //初始化开普勒
15 | - (void)initKepler:(FlutterMethodCall *)call result:(FlutterResult)result {
16 | NSString *appKey = call.arguments[@"appKey"];
17 | NSString *appSecret = call.arguments[@"appSecret"];
18 | // [[KeplerApiManager sharedKPService]asyncInitSdk:appKey secretKey:appSecret jdInnerLogin:^(UIViewController *currentViewController) {
19 | // NSLog(@"这是干啥");
20 | // } sucessCallback:^{
21 | // result(@{
22 | // FlutterKeplerConstKey_ErrorCode:@"0",
23 | // FlutterKeplerConstKey_ErrorMessage:@"success",
24 | // });
25 | // } failedCallback:^(NSError *error) {
26 | // result(@{
27 | // FlutterKeplerConstKey_ErrorCode:@"0",
28 | // FlutterKeplerConstKey_ErrorMessage:@"success",
29 | // });
30 | // }];
31 | //
32 |
33 | [[KeplerApiManager sharedKPService]asyncInitSdk:appKey secretKey:appSecret sucessCallback:^(){
34 | //
35 | result(@{
36 | FlutterKeplerConstKey_ErrorCode:@"0",
37 | FlutterKeplerConstKey_ErrorMessage:@"success",
38 | });
39 | }failedCallback:^(NSError *error){
40 | //
41 | result(@{
42 | FlutterKeplerConstKey_ErrorCode:[NSString stringWithFormat: @"%ld", error.code],
43 | FlutterKeplerConstKey_ErrorMessage:error.localizedDescription,
44 | });
45 | }];
46 | }
47 | #pragma mark - 实用功能
48 | /**
49 | * 通过URL打开任意商品页面
50 | * @param url 页面url
51 | * @param sourceController 当前显示的UIViewController
52 | * @param jumpType 跳转类型(默认 push) 1代表present 2代表push
53 | * @param userInfo 不需要可以传nil 传参数据为第三方应用自定义,可以为页面,频道标识;也可以标识分成信息;该数据只做统计需求。传参长度,使用URL encode之后长度必须小于256字节(不建议传入中文以及特殊字符)
54 | * 禁止传参带入以下符号: =#%&+?<{}
55 | *
56 | */
57 | - (void)keplerPageWithURL:(FlutterMethodCall *)call result:(FlutterResult)result {
58 | NSString *url = call.arguments[@"url"];
59 | // NSInteger jumpType = [call.arguments[@"jumpType"] integerValue];
60 | NSInteger jumpType = [[NSNumber numberWithInt:1] integerValue];
61 | NSDictionary *userInfo = [FlutterKeplerTools nullToNil:call.arguments[@"userInfo"]];
62 | UIViewController *rootViewController = [UIApplication sharedApplication].delegate.window.rootViewController;
63 | [[KeplerApiManager sharedKPService] openKeplerPageWithURL:url sourceController:rootViewController jumpType:jumpType userInfo:userInfo];
64 | }
65 | /**
66 | * 打开导航页
67 | */
68 | - (void)keplerNavigationPage:(FlutterMethodCall *)call result:(FlutterResult)result {
69 | UIViewController *rootViewController = [UIApplication sharedApplication].delegate.window.rootViewController;
70 | // NSInteger jumpType = [call.arguments[@"jumpType"] integerValue];
71 | NSInteger jumpType = [[NSNumber numberWithInt:1] integerValue];
72 | NSDictionary *userInfo = [FlutterKeplerTools nullToNil:call.arguments[@"userInfo"]];
73 | [[KeplerApiManager sharedKPService] openNavigationPage:rootViewController jumpType:jumpType userInfo:userInfo];
74 | }
75 |
76 |
77 | /**
78 | * 通过SKU打开Kepler单品页
79 | * @param sku 商品SKU
80 | */
81 | - (void)keplerOpenItemDetailWithSKU:(FlutterMethodCall *)call result:(FlutterResult)result {
82 | UIViewController *rootViewController = [UIApplication sharedApplication].delegate.window.rootViewController;
83 | NSString *sku = call.arguments[@"sku"];
84 | // NSInteger jumpType = [call.arguments[@"jumpType"] integerValue];
85 | NSInteger jumpType = [[NSNumber numberWithInt:1] integerValue];
86 | NSDictionary *userInfo = [FlutterKeplerTools nullToNil:call.arguments[@"userInfo"]];
87 | [[KeplerApiManager sharedKPService] openItemDetailWithSKU:sku sourceController:rootViewController jumpType:jumpType userInfo:userInfo];
88 | }
89 |
90 | //打开订单列表 (支持Native && H5)
91 | - (void)keplerOpenOrderList:(FlutterMethodCall *)call result:(FlutterResult)result {
92 | UIViewController *rootViewController = [UIApplication sharedApplication].delegate.window.rootViewController;
93 | // NSInteger jumpType = [call.arguments[@"jumpType"] integerValue];
94 | NSInteger jumpType = [[NSNumber numberWithInt:1] integerValue];
95 | NSDictionary *userInfo = [FlutterKeplerTools nullToNil:call.arguments[@"userInfo"]];
96 | [[KeplerApiManager sharedKPService] openOrderList:rootViewController jumpType:jumpType userInfo:userInfo];
97 | }
98 |
99 | /**
100 | * 根据搜索关键字打开搜索结果页
101 | * @param searchKey 搜索关键字
102 | */
103 | - (void)keplerOpenSearchResult:(FlutterMethodCall *)call result:(FlutterResult)result {
104 | UIViewController *rootViewController = [UIApplication sharedApplication].delegate.window.rootViewController;
105 | NSString *searchKey = call.arguments[@"searchKey"];
106 | // NSInteger jumpType = [call.arguments[@"jumpType"] integerValue];
107 | NSInteger jumpType = [[NSNumber numberWithInt:1] integerValue];
108 | NSDictionary *userInfo = [FlutterKeplerTools nullToNil:call.arguments[@"userInfo"]];
109 | [[KeplerApiManager sharedKPService] openSearchResult:searchKey sourceController:rootViewController jumpType:jumpType userInfo:userInfo];
110 | }
111 |
112 | /**
113 | * 打开购物车界面
114 | */
115 | - (void)keplerOpenShoppingCart:(FlutterMethodCall *)call result:(FlutterResult)result {
116 | UIViewController *rootViewController = [UIApplication sharedApplication].delegate.window.rootViewController;
117 | // NSInteger jumpType = [call.arguments[@"jumpType"] integerValue];
118 | NSInteger jumpType = [[NSNumber numberWithInt:1] integerValue];
119 | NSDictionary *userInfo = [FlutterKeplerTools nullToNil:call.arguments[@"userInfo"]];
120 | [[KeplerApiManager sharedKPService] openShoppingCart:rootViewController jumpType:jumpType userInfo:userInfo];
121 | }
122 |
123 | /**
124 | * 添加到购物车(深圳)
125 | *
126 | * @param sku 商品sku
127 | * @param num 添加到购物车中商品数量
128 | * @param success 添加成功回调
129 | * @param failure 添加失败回调
130 | */
131 | - (void)keplerAddToCartWithSku:(FlutterMethodCall *)call result:(FlutterResult)result {
132 | UIViewController *rootViewController = [UIApplication sharedApplication].delegate.window.rootViewController;
133 | NSString *sku = call.arguments[@"sku"];
134 | NSString *num = call.arguments[@"num"];
135 |
136 |
137 | [[KeplerApiManager sharedKPService] addToCartWithSku:sku num:num sourceController:rootViewController success:^{
138 | // 加车成功
139 | result(@{
140 | FlutterKeplerConstKey_ErrorCode : @"0",
141 | FlutterKeplerConstKey_ErrorMessage : @"success",
142 | });
143 | } failure:^(NSInteger errorCode) {
144 | result(@{
145 | FlutterKeplerConstKey_ErrorCode :[NSString stringWithFormat: @"%ld", (long)errorCode],
146 | FlutterKeplerConstKey_ErrorMessage : [self errorMessageFromCode:errorCode],
147 | });
148 | }];
149 | }
150 |
151 | /**
152 |
153 | 联盟一键加购 unionID 联盟ID,AppID 查看位置:我的推广-推广管理-APP管理 skuID 商品SKU,
154 |
155 | refer refer (原生页面传域名+文章编号),viewController 当前的视图控制器,completionHandler 返回
156 |
157 | */
158 | - (void)keplerFastPurchase:(FlutterMethodCall *)call result:(FlutterResult)flutterResult {
159 | UIViewController *rootViewController = [UIApplication sharedApplication].delegate.window.rootViewController;
160 | NSString *unionID = call.arguments[@"unionID"];
161 | NSString *appId = call.arguments[@"appId"];
162 | NSString *skuID = call.arguments[@"skuID"];
163 | NSString *refer = call.arguments[@"refer"];
164 | [[KeplerApiManager sharedKPService] keplerFastPurchaseWith:unionID appID:appId skuID:skuID refer:refer controller:rootViewController completion:^(BOOL result, id _Nullable responseObject, NSError * _Nullable error) {
165 | if (result) {
166 | flutterResult(@{
167 | FlutterKeplerConstKey_ErrorCode : @"0",
168 | FlutterKeplerConstKey_ErrorMessage : @"success",
169 | });
170 | }else{
171 | flutterResult(@{
172 | FlutterKeplerConstKey_ErrorCode : [NSString stringWithFormat: @"%ld", (long)error.code],
173 | FlutterKeplerConstKey_ErrorMessage :error.localizedDescription,
174 | });
175 | }
176 | }];
177 | }
178 |
179 |
180 | #pragma mark - 辅助功能
181 | //静态化检测更新
182 | - (void)keplerCheckUpdate:(FlutterMethodCall *)call result:(FlutterResult)result {
183 | [[KeplerApiManager sharedKPService] checkUpdate];
184 | }
185 |
186 | //登录授权
187 | - (void)keplerLogin:(FlutterMethodCall *)call result:(FlutterResult)result {
188 | UIViewController *rootViewController = [UIApplication sharedApplication].delegate.window.rootViewController;
189 | [[KeplerApiManager sharedKPService] keplerLoginWithViewController:rootViewController success:^{
190 | // 哪来的token???
191 | result(@{
192 | FlutterKeplerConstKey_ErrorCode:@"0",
193 | FlutterKeplerConstKey_ErrorMessage:@"success",
194 | // FlutterKeplerConstKey_Data:@{},
195 | });
196 | } failure:^(NSError *error) {
197 | result(@{
198 | FlutterKeplerConstKey_ErrorCode:[NSString stringWithFormat: @"%ld", error.code],
199 | FlutterKeplerConstKey_ErrorMessage:error.localizedDescription,
200 | // FlutterKeplerConstKey_Data:@{},
201 | });
202 | }];
203 | }
204 |
205 | //取消授权并且清除登录态
206 | - (void)keplerCancelAuth:(FlutterMethodCall *)call result:(FlutterResult)result {
207 | [[KeplerApiManager sharedKPService] cancelAuth];
208 | }
209 |
210 |
211 | //设置进度条颜色
212 | - (void)setKeplerProgressBarColor:(FlutterMethodCall *)call result:(FlutterResult)result {
213 | NSString *color16 = call.arguments[@"color"];
214 | if(![FlutterKeplerTools isNil:color16]){
215 | UIColor *color = [FlutterKeplerTools colorWithHexString:color16];
216 | [[KeplerApiManager sharedKPService] setKeplerProgressBarColor:color];
217 | }
218 | }
219 |
220 | //检测登录态
221 | - (void)keplerLoginWithSuccess:(FlutterMethodCall *)call result:(FlutterResult)result {
222 | [[KeplerApiManager sharedKPService] keplerLoginWithSuccess:^{
223 | result(@{
224 | FlutterKeplerConstKey_ErrorCode:@"0",
225 | FlutterKeplerConstKey_ErrorMessage:@"登录有效",
226 | });
227 | } failure:^{
228 | result(@{
229 | FlutterKeplerConstKey_ErrorCode:@"-1",
230 | FlutterKeplerConstKey_ErrorMessage:@"登录失效",
231 | });
232 | }];
233 | }
234 |
235 | // 是否强制使用H5打开界面 默认为YES;设置为NO时,调用商品详情页,订单列表,购物车等方法时将跳转到京东app并打开对应的界面.
236 | - (void)setKeplerOpenByH5:(FlutterMethodCall *)call result:(FlutterResult)result {
237 | [KeplerApiManager sharedKPService].isOpenByH5 = [call.arguments[@"isOpenByH5"] boolValue];
238 | }
239 |
240 | //打开京东后显示的返回按钮的tagID
241 | - (void)setKeplerJDappBackTagID:(FlutterMethodCall *)call result:(FlutterResult)result {
242 | [KeplerApiManager sharedKPService].JDappBackTagID = call.arguments[@"JDappBackTagID"];
243 | }
244 |
245 |
246 |
247 | //错误码判断
248 | - (NSString *)errorMessageFromCode:(NSInteger)errorCode{
249 | switch (errorCode) {
250 | case 0:
251 | return @"success";
252 | break;
253 | case 30001:
254 | return @"SKU类型无效";
255 | break;
256 | case 30002:
257 | return @"未找到SKU";
258 | break;
259 | case 30003:
260 | return @"加入购物车失败";
261 | break;
262 | case 30004:
263 | return @"绑定用户参数有误";
264 | break;
265 | case 30008:
266 | return @"加车参数有误";
267 | break;
268 | case 30009:
269 | return @"查询所有sku失败";
270 | break;
271 | case 30010:
272 | return @"请求接口参数缺失";
273 | break;
274 | case 30012:
275 | return @"IP参数格式有误";
276 | break;
277 | case 30013:
278 | return @"DeviceType参数格式有误";
279 | break;
280 | case 30014:
281 | return @"UniodID有误";
282 | break;
283 | default:
284 | return @"未知错误";
285 | break;
286 | }
287 | }
288 | @end
289 |
--------------------------------------------------------------------------------
/ios/Classes/Tools/FlutterKeplerTools.h:
--------------------------------------------------------------------------------
1 | //
2 | // FlutterAlibcTools.h
3 | // flutter_alibc
4 | //
5 | // Created by 吴兴 on 2019/8/29.
6 | //
7 |
8 | #import
9 |
10 | NS_ASSUME_NONNULL_BEGIN
11 |
12 | @interface FlutterKeplerTools : NSObject
13 | //判断String是否为空
14 | + (BOOL)isNil:(NSString *)string;
15 | //Json转Dic
16 | + (NSDictionary *)dictionaryWithJsonString:(NSString *)jsonString;
17 | //判断是不是null,是就转nil
18 | + (id)nullToNil:(id)obj;
19 | //改变类型
20 | +(id)changeType:(id)myObj;
21 | // 颜色转换:iOS中(以#开头)十六进制的颜色转换为UIColor(RGB)
22 | + (UIColor *) colorWithHexString: (NSString *)color;
23 |
24 | @end
25 |
26 | NS_ASSUME_NONNULL_END
27 |
--------------------------------------------------------------------------------
/ios/Classes/Tools/FlutterKeplerTools.m:
--------------------------------------------------------------------------------
1 | //
2 | // FlutterAlibcTools.m
3 | // flutter_alibc
4 | //
5 | // Created by 吴兴 on 2019/8/29.
6 | //
7 |
8 | #import "FlutterKeplerTools.h"
9 |
10 | @implementation FlutterKeplerTools
11 |
12 | + (BOOL)isNil:(NSString *)string {
13 | if (string == nil) {
14 | return YES;
15 | }
16 |
17 | if ([string isKindOfClass:[NSNull class]]) {
18 | return YES;
19 | }
20 | return [[string stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] length] == 0;
21 | }
22 |
23 | + (NSDictionary *)dictionaryWithJsonString:(NSString *)jsonString{
24 | if (jsonString == nil) {
25 | return nil;
26 | }
27 |
28 | NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding];
29 | NSError *err;
30 | NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:jsonData
31 | options:NSJSONReadingMutableContainers
32 | error:&err];
33 | if(err)
34 | {
35 | NSLog(@"json解析失败:%@",err);
36 | return nil;
37 | }
38 | return dic;
39 | }
40 |
41 | + (id)nullToNil:(id)obj{
42 | if ([obj isKindOfClass:[NSNull class]]) {
43 | return nil;
44 | }
45 | return obj;
46 | }
47 |
48 |
49 | #pragma mark - 公有方法,直接使用
50 | //类型识别:将所有的NSNull类型转化成@""
51 | +(id)changeType:(id)myObj
52 | {
53 | if ([myObj isKindOfClass:[NSDictionary class]])
54 | {
55 | return [self nullDic:myObj];
56 | }
57 | else if([myObj isKindOfClass:[NSArray class]])
58 | {
59 | return [self nullArr:myObj];
60 | }
61 | else if([myObj isKindOfClass:[NSString class]])
62 | {
63 | return [self stringToString:myObj];
64 | }
65 | else if([myObj isKindOfClass:[NSNull class]])
66 | {
67 | return [self nullToString];
68 | }
69 | else
70 | {
71 | return myObj;
72 | }
73 | }
74 |
75 | #pragma mark - 私有方法
76 | //将NSDictionary中的Null类型的项目转化成@""
77 | +(NSDictionary *)nullDic:(NSDictionary *)myDic
78 | {
79 | NSArray *keyArr = [myDic allKeys];
80 | NSMutableDictionary *resDic = [[NSMutableDictionary alloc]init];
81 | for (int i = 0; i < keyArr.count; i ++)
82 | {
83 | id obj = [myDic objectForKey:keyArr[i]];
84 | obj = [self changeType:obj];
85 | [resDic setObject:obj forKey:keyArr[i]];
86 | }
87 | return resDic;
88 | }
89 |
90 | //将NSArray中的Null类型的项目转化成@""
91 | +(NSArray *)nullArr:(NSArray *)myArr
92 | {
93 | NSMutableArray *resArr = [[NSMutableArray alloc] init];
94 | for (int i = 0; i < myArr.count; i ++)
95 | {
96 | id obj = myArr[i];
97 | obj = [self changeType:obj];
98 | [resArr addObject:obj];
99 | }
100 | return resArr;
101 | }
102 |
103 | //将NSString类型的原路返回
104 | +(NSString *)stringToString:(NSString *)string
105 | {
106 | return string;
107 | }
108 |
109 | //将Null类型的项目转化成@""
110 | +(NSString *)nullToString
111 | {
112 | // return @"";
113 | return @"";
114 | }
115 |
116 |
117 | + (UIColor *) colorWithHexString: (NSString *)color
118 | {
119 | NSString *cString = [[color stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] uppercaseString];
120 |
121 | // String should be 6 or 8 characters
122 | if ([cString length] < 6) {
123 | return [UIColor clearColor];
124 | }
125 | // 判断前缀
126 | if ([cString hasPrefix:@"0X"])
127 | cString = [cString substringFromIndex:2];
128 | if ([cString hasPrefix:@"#"])
129 | cString = [cString substringFromIndex:1];
130 | if ([cString length] != 6)
131 | return [UIColor clearColor];
132 | // 从六位数值中找到RGB对应的位数并转换
133 | NSRange range;
134 | range.location = 0;
135 | range.length = 2;
136 | //R、G、B
137 | NSString *rString = [cString substringWithRange:range];
138 | range.location = 2;
139 | NSString *gString = [cString substringWithRange:range];
140 | range.location = 4;
141 | NSString *bString = [cString substringWithRange:range];
142 | // Scan values
143 | unsigned int r, g, b;
144 | [[NSScanner scannerWithString:rString] scanHexInt:&r];
145 | [[NSScanner scannerWithString:gString] scanHexInt:&g];
146 | [[NSScanner scannerWithString:bString] scanHexInt:&b];
147 |
148 | return [UIColor colorWithRed:((float) r / 255.0f) green:((float) g / 255.0f) blue:((float) b / 255.0f) alpha:1.0f];
149 | }
150 |
151 | @end
152 |
--------------------------------------------------------------------------------
/ios/JDKepler/JDKeplerSDK.framework/Headers/JDKeplerSDK.h:
--------------------------------------------------------------------------------
1 | //
2 | // JDKeplerSDK.h
3 | // JDKeplerSDK
4 | //
5 | // Created by JD.K on 16/3/15.
6 | // Copyright © 2016年 JD.K. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | //! Project version number for JDKeplerSDK.
12 | FOUNDATION_EXPORT double JDKeplerSDKVersionNumber;
13 |
14 | //! Project version string for JDKeplerSDK.
15 | FOUNDATION_EXPORT const unsigned char JDKeplerSDKVersionString[];
16 |
17 | // In this header, you should import all the public headers of your framework using statements like #import
18 | #import
19 |
20 |
21 |
--------------------------------------------------------------------------------
/ios/JDKepler/JDKeplerSDK.framework/Headers/KeplerApiManager.h:
--------------------------------------------------------------------------------
1 | //
2 | // KeplerApiManager.h
3 | // KeplerApp
4 | // 提供Kepler服务
5 | // Created by JD.K on 16/6/20.
6 | // Copyright © 2016年 JD.K. All rights reserved.
7 | // version 2.2.4
8 |
9 | #import
10 | #import
11 |
12 | /** 初始化成功回调 */
13 | typedef void (^initSuccessCallback)();
14 | /** 初始化失败回调 */
15 | typedef void (^initFailedCallback)(NSError *error);
16 | /** JD内部App登录流程 */
17 | typedef void (^initJDInnerLogin)(UIViewController *currentViewController);
18 |
19 | typedef NS_ENUM(NSInteger, JDInnerLogin) {
20 | JDInnerLoginFailure = 0, //获取code失败
21 | JDInnerLoginCancel, //用户取消登录
22 | JDInnerLoginSuccess //获取code成功
23 | };
24 | /**
25 | * Kepler登录授权成功回调
26 | *
27 | * @param token 登录授权成功后返回的token
28 | */
29 | typedef void (^keplerLoginSuccessCallback)();
30 | /** Kepler登录授权失败回调 */
31 | typedef void (^keplerLoginFailureCallback)(NSError *error);
32 |
33 | typedef void (^keplerCompletionHandler)(BOOL result,id _Nullable responseObject, NSError * _Nullable error);
34 |
35 |
36 | @interface KeplerApiManager : NSObject
37 |
38 | /**
39 | 分佣的 AppKey2
40 | */
41 | @property (nonatomic, copy) NSString *secondAppKey;
42 | //********************************* 通过京东APP打开链接相关参数 ************************************
43 | /**
44 | 是否强制使用H5打开界面 设置为YES时,打开链接时不会跳转到JD APP
45 | */
46 | @property (nonatomic, assign)BOOL isOpenByH5;
47 |
48 | /**
49 | 当isOpenByH5为 NO 时,准备跳转到JD APP时会调用这些代码。可以把开启 Loading动画的代码放到这里
50 | 为避免造成混乱,在关闭Kepler界面时,会置为nil。因此需要在每次打开Kepler之前单独设置。
51 | */
52 | @property (nonatomic, copy) void(^startOpenJDAppBlock)();
53 |
54 | /**
55 | 当isOpenByH5为 NO 时,跳转JD APP准备工作完成时会调用这些代码,success为YES表示成功,可以打开JD APP,为NO时表示打开失败。
56 | 为避免造成混乱,在关闭Kepler界面时,会置为nil。因此需要在每次打开Kepler之前单独设置。
57 | */
58 | @property (nonatomic, copy) void(^finishOpenJDAppBlock)(BOOL success,NSError *error);
59 | /**
60 | * 打开京东后显示的返回按钮的tagID
61 | **/
62 | @property (nonatomic, copy) NSString *JDappBackTagID;
63 | /**
64 | * 京东达人内容ID 关闭kepler界面时会清除 如果需要此值 再次打开需要再次设置
65 | **/
66 | @property (nonatomic, copy) NSString *actId;
67 | /**
68 | * 京东达人 内容渠道扩展字段 关闭kepler界面时会清除 如果需要此值 再次打开需要再次设置
69 | **/
70 | @property (nonatomic, copy) NSString *ext;
71 |
72 | /**
73 | 打开京东超时时间设置 关闭 Kepler 界面时不会重置 默认为60
74 | */
75 | @property (nonatomic, assign) NSTimeInterval openJDTimeout;
76 | //*******************************************************************************************************
77 |
78 |
79 |
80 | /**
81 | * KeplerApiManager 单例
82 | *
83 | * @return KeplerApiManager 单例
84 | */
85 | + (KeplerApiManager *)sharedKPService;
86 | /**
87 | * 注册Kepler 服务
88 | *
89 | * @param appKey 注册的appKey
90 | * @param appSecret 注册的secretKey
91 | */
92 | - (void)asyncInitSdk:(NSString *)appKey
93 | secretKey:(NSString *)appSecret
94 | jdInnerLogin:(initJDInnerLogin)jdInnerLogin
95 | sucessCallback:(initSuccessCallback)sucessCallback
96 | failedCallback:(initFailedCallback)failedCallback;
97 |
98 | /**
99 | * 注册Kepler 服务
100 | *
101 | * @param appKey 注册的appKey
102 | * @param appSecret 注册的secretKey
103 | */
104 | - (void)asyncInitSdk:(NSString *)appKey
105 | secretKey:(NSString *)appSecret
106 | sucessCallback:(initSuccessCallback)sucessCallback
107 | failedCallback:(initFailedCallback)failedCallback;
108 |
109 |
110 | /**
111 | * 通过URL打开Kepler页面
112 | *
113 | * @param url 页面url
114 | * @param sourceController 当前显示的UIViewController
115 | * @param jumpType 跳转类型(默认 push) 1代表present 2代表push
116 | * @param customParams 自定义订单统计参数 不需要可以传nil
117 | */
118 | - (void)openKeplerPageWithURL:(NSString *)url sourceController:(UIViewController *)sourceController jumpType:(NSInteger)jumpType customParams:(NSString *)customParams API_DEPRECATED_WITH_REPLACEMENT("openKeplerPageWithURL:sourceController:jumpType:userInfo:", ios(7.0,11.0));
119 |
120 | - (void)openKeplerPageWithURL:(NSString *)url sourceController:(UIViewController *)sourceController jumpType:(NSInteger)jumpType userInfo:(NSDictionary *)userInfo;
121 |
122 | /**
123 | * 打开导航页
124 | */
125 | - (void)openNavigationPage:(UIViewController *)sourceController jumpType:(NSInteger)jumpType customParams:(NSString *)customParams API_DEPRECATED_WITH_REPLACEMENT("openNavigationPage:sourceController:jumpType:userInfo:", ios(7.0,11.0));
126 |
127 | - (void)openNavigationPage:(UIViewController *)sourceController jumpType:(NSInteger)jumpType userInfo:(NSDictionary *)userInfo;
128 | /**
129 | * 通过SKU打开Kepler单品页
130 | *
131 | * @param sku 商品SKU
132 | */
133 | - (void)openItemDetailWithSKU:(NSString *)sku sourceController:(UIViewController *)sourceController jumpType:(NSInteger)jumpType customParams:(NSString *)customParams API_DEPRECATED_WITH_REPLACEMENT("openItemDetailWithSKU:sourceController:jumpType:userInfo:", ios(7.0,11.0));
134 |
135 | - (void)openItemDetailWithSKU:(NSString *)sku sourceController:(UIViewController *)sourceController jumpType:(NSInteger)jumpType userInfo:(NSDictionary *)userInfo;
136 |
137 | /**
138 | * 打开订单列表
139 | */
140 | - (void)openOrderList:(UIViewController *)sourceController jumpType:(NSInteger)jumpType customParams:(NSString *)customParams API_DEPRECATED_WITH_REPLACEMENT("openOrderList:sourceController:jumpType:userInfo:", ios(7.0,11.0));
141 |
142 | - (void)openOrderList:(UIViewController *)sourceController jumpType:(NSInteger)jumpType userInfo:(NSDictionary *)userInfo;
143 |
144 | /**
145 | * 根据搜索关键字打开搜索结果页
146 | *
147 | * @param searchKey 搜索关键字
148 | */
149 | - (void)openSearchResult:(NSString *)searchKey sourceController:(UIViewController *)sourceController jumpType:(NSInteger)jumpType customParams:(NSString *)customParams API_DEPRECATED_WITH_REPLACEMENT("openSearchResult:sourceController:jumpType:userInfo:", ios(7.0,11.0));
150 |
151 | - (void)openSearchResult:(NSString *)searchKey sourceController:(UIViewController *)sourceController jumpType:(NSInteger)jumpType userInfo:(NSDictionary *)userInfo;
152 |
153 | /**
154 | * 打开购物车界面
155 | *
156 | */
157 | - (void)openShoppingCart:(UIViewController *)sourceController jumpType:(NSInteger)jumpType customParams:(NSString *)customParams API_DEPRECATED_WITH_REPLACEMENT("openShoppingCart:sourceController:jumpType:userInfo:", ios(7.0,11.0));
158 |
159 | - (void)openShoppingCart:(UIViewController *)sourceController jumpType:(NSInteger)jumpType userInfo:(NSDictionary *)userInfo;
160 |
161 |
162 | /********* 注释:下面标注内的方法与上面对应个方法功能完全相同,只是有返回值 ***** For金融 **/
163 | /***************************** Start *******************************************/
164 |
165 | - (UIViewController *)openKeplerPageWithURL:(NSString *)url customParams:(NSString *)customParams hiddenNavigationBar:(BOOL)hidden API_DEPRECATED_WITH_REPLACEMENT("openKeplerPageWithURL:userInfo:hiddenNavigationBar:", ios(7.0,11.0));
166 | - (UIViewController *)openKeplerPageWithURL:(NSString *)url userInfo:(NSDictionary *)userInfo hiddenNavigationBar:(BOOL)hidden;
167 |
168 | /**
169 | * 打开导航页
170 | */
171 | - (UIViewController *)openNavigationPageWithCustomParams:(NSString *)customParams hiddenNavigationBar:(BOOL)hidden API_DEPRECATED_WITH_REPLACEMENT("openNavigationPageWithUserInfo:userInfo:hiddenNavigationBar:", ios(7.0,11.0));
172 | - (UIViewController *)openNavigationPageWithUserInfo:(NSDictionary *)userInfo hiddenNavigationBar:(BOOL)hidden;
173 |
174 | /**
175 | * 通过SKU打开Kepler单品页
176 | */
177 | - (UIViewController *)openItemDetailWithSKU:(NSString *)sku customParams:(NSString *)customParams hiddenNavigationBar:(BOOL)hidden API_DEPRECATED_WITH_REPLACEMENT("openItemDetailWithSKU:userInfo:hiddenNavigationBar:", ios(7.0,11.0));
178 | - (UIViewController *)openItemDetailWithSKU:(NSString *)sku userInfo:(NSDictionary *)userInfo hiddenNavigationBar:(BOOL)hidden;
179 |
180 | /**
181 | * 打开订单列表
182 | */
183 | - (UIViewController *)openOrderListWithCustomParams:(NSString *)customParams hiddenNavigationBar:(BOOL)hidden API_DEPRECATED_WITH_REPLACEMENT("openOrderListWithUserInfo:userInfo:hiddenNavigationBar:", ios(7.0,11.0));
184 | - (UIViewController *)openOrderListWithUserInfo:(NSDictionary *)userInfo hiddenNavigationBar:(BOOL)hidden;
185 |
186 | /**
187 | * 根据搜索关键字打开搜索结果页
188 | */
189 | - (UIViewController *)openSearchResult:(NSString *)searchKey customParams:(NSString *)customParams hiddenNavigationBar:(BOOL)hidden API_DEPRECATED_WITH_REPLACEMENT("openSearchResult:userInfo:hiddenNavigationBar:", ios(7.0,11.0));
190 | - (UIViewController *)openSearchResult:(NSString *)searchKey userInfo:(NSDictionary *)userInfo hiddenNavigationBar:(BOOL)hidden;
191 |
192 | /**
193 | * 打开购物车界面
194 | *
195 | */
196 | - (UIViewController *)openShoppingCartWithCustomParams:(NSString *)customParams hiddenNavigationBar:(BOOL)hidden API_DEPRECATED_WITH_REPLACEMENT("openShoppingCartWithUserInfo:userInfo:hiddenNavigationBar:", ios(7.0,11.0));
197 | - (UIViewController *)openShoppingCartWithUserInfo:(NSDictionary *)userInfo hiddenNavigationBar:(BOOL)hidden;
198 |
199 |
200 | /**
201 | 联盟一键加购
202 |
203 | @param unionID 联盟ID
204 | @param appID AppID 查看位置:我的推广-推广管理-APP管理
205 | @param skuID 商品SKU
206 | @param refer refer (原生页面传域名+文章编号)
207 | @param viewController 当前的视图控制器
208 | @param completionHandler 返回
209 | */
210 | - (void)keplerFastPurchaseWith:(NSString *)unionID
211 | appID:(NSString *)appID
212 | skuID:(NSString *)skuID
213 | refer:(NSString *)refer
214 | controller:(UIViewController *)viewController
215 | completion:(keplerCompletionHandler)completionHandler;
216 |
217 |
218 | /***************************** End *******************************************/
219 |
220 |
221 | /**深圳的加车接口
222 | @param sku 商品sku
223 | @param num 商品数量
224 | @param success 添加成功回调
225 | @param failure 添加失败回调
226 | */
227 | - (void)addToCartWithSku:(NSString *)sku num:(NSString *)num sourceController:(UIViewController *)sourceController success:(void(^)(void))success failure:(void(^)(NSInteger))failure;
228 |
229 | /**
230 | * Kepler处理URL
231 | *
232 | * @param url url
233 | *
234 | * @return 处理结果
235 | */
236 | - (BOOL)handleOpenURL:(NSURL*)url;
237 | /**
238 | * 取消打开京东 如果打开京东APP在弱网情况下耗时过长,需要取消打开京东,可调用该方法。
239 | * SDK会执行finishOpenJDAppBlock
240 | * 取消后不会尝试使用H5打开
241 | **/
242 | - (void)cancelOpenJD;
243 |
244 | /**
245 | * M静态化检测更新
246 | */
247 | - (void)checkUpdate;
248 | /**
249 | * 取消授权
250 | */
251 | - (void)cancelAuth;
252 |
253 | /**
254 | * 设置加载进度条颜色
255 | */
256 | - (void)setKeplerProgressBarColor:(UIColor *)progressBarColor;
257 | /**
258 | * 设置导航背景颜色
259 | */
260 | - (void)setKeplerNavBackgroundColor:(UIColor *)backgrondColor;
261 | /**
262 | * 设置导航高度
263 | */
264 | - (void)setKeplerNavHeight:(CGFloat)height;
265 | /**
266 | * 设置导航标题颜色
267 | */
268 | - (void)setKeplerNavTitleTextColor:(UIColor *)textColor;
269 | /**
270 | * 设置导航标题字体
271 | */
272 | - (void)setKeplerNavTitleFont:(UIFont *)font;
273 | /**
274 | * 设置导航按钮文字颜色
275 | */
276 | - (void)setKeplerNavBtnTextColor:(UIColor *)textColor;
277 | /**
278 | * 设置导航按钮文字字体
279 | */
280 | - (void)setKeplerNavBtnFont:(UIFont *)font;
281 |
282 | /**
283 | * Kepler登录授权
284 | */
285 | - (void)keplerLoginWithViewController:(UIViewController *)viewController success:(keplerLoginSuccessCallback)successCallback failure:(keplerLoginFailureCallback)failureCallback;
286 |
287 | //登录态验证
288 | - (void)keplerLoginWithSuccess:(void (^)())successBlock failure:(void (^)())failureBlock;
289 |
290 |
291 | //金融内部使用
292 | - (void)getTokenWithCode:(NSString *)code success:(keplerLoginSuccessCallback)successCallback failure:(keplerLoginFailureCallback)failureCallback;
293 |
294 | - (void)jdInnerLoginResult:(JDInnerLogin)result code:(NSString *)code;
295 |
296 | @end
297 |
298 |
--------------------------------------------------------------------------------
/ios/JDKepler/JDKeplerSDK.framework/Info.plist:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterTaoBaoKe/flutter_kepler/1da2bff95d51bbd0406c37f9109405cbc4f93086/ios/JDKepler/JDKeplerSDK.framework/Info.plist
--------------------------------------------------------------------------------
/ios/JDKepler/JDKeplerSDK.framework/JDKeplerSDK:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterTaoBaoKe/flutter_kepler/1da2bff95d51bbd0406c37f9109405cbc4f93086/ios/JDKepler/JDKeplerSDK.framework/JDKeplerSDK
--------------------------------------------------------------------------------
/ios/JDKepler/JDKeplerSDK.framework/Modules/module.modulemap:
--------------------------------------------------------------------------------
1 | framework module JDKeplerSDK {
2 | umbrella header "JDKeplerSDK.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
--------------------------------------------------------------------------------
/ios/flutter_kepler.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 = 'flutter_kepler'
6 | s.version = '0.0.1'
7 | s.summary = '京东开普勒插件'
8 | s.description = <<-DESC
9 | 京东开普勒插件
10 | DESC
11 | s.homepage = 'http://example.com'
12 | s.license = { :file => '../LICENSE' }
13 | s.author = { 'Your Company' => 'email@example.com' }
14 | s.source = { :path => '.' }
15 | s.source_files = 'Classes/**/*'
16 | s.public_header_files = 'Classes/**/*.h'
17 | s.dependency 'Flutter'
18 |
19 | s.vendored_frameworks ="JDKepler/*.framework"
20 | #s.resource = "JDKepler/*.bundle"
21 |
22 | s.frameworks = "UIKit","Foundation","SystemConfiguration","JavaScriptCore"
23 |
24 | s.libraries = "z","sqlite3.0","c++"
25 |
26 | s.ios.deployment_target = '8.0'
27 | end
28 |
29 |
--------------------------------------------------------------------------------
/lib/flutter_kepler.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 |
3 | import 'package:flutter/foundation.dart';
4 | import 'package:flutter/services.dart';
5 | import 'package:flutter_kepler/kepler_model.dart';
6 |
7 | import 'kepler_const_key.dart';
8 |
9 | class FlutterKepler {
10 | static const MethodChannel _channel = const MethodChannel('flutter_kepler');
11 |
12 | static Future get platformVersion async {
13 | final String version = await _channel.invokeMethod('getPlatformVersion');
14 | return version;
15 | }
16 |
17 | // 初始化
18 | static Future initKepler(
19 | {@required String appKey, @required String appSecret}) async {
20 | Map result = await _channel
21 | .invokeMethod("initKepler", {"appKey": appKey, "appSecret": appSecret});
22 | return ResultModel(
23 | result[KeplerConstKey.errorCode],
24 | result[KeplerConstKey.errorMessage],
25 | );
26 | }
27 |
28 | ///
29 | /// 通过URL打开任意商品页面
30 | /// @param url 页面url
31 | /// @param userInfo 不需要可以不传 传参数据为第三方应用自定义,可以为页面,频道标识;也可以标识分成信息;该数据只做统计需求。传参长度,使用URL encode之后长度必须小于256字节(不建议传入中文以及特殊字符)
32 | /// 禁止传参带入以下符号: =#%&+?<{}
33 | ///
34 | ///
35 | static keplerPageWithURL({@required String url, Map userInfo}) {
36 | _channel
37 | .invokeMethod("keplerPageWithURL", {"url": url, "userInfo": userInfo});
38 | }
39 |
40 | ///
41 | /// 打开导航页
42 | /// @param userInfo 不需要可以不传 传参数据为第三方应用自定义,可以为页面,频道标识;也可以标识分成信息;该数据只做统计需求。传参长度,使用URL encode之后长度必须小于256字节(不建议传入中文以及特殊字符)
43 | /// 禁止传参带入以下符号: =#%&+?<{}
44 | ///
45 | ///
46 | static keplerNavigationPage({Map userInfo}) {
47 | _channel.invokeMethod("keplerNavigationPage", {"userInfo": userInfo});
48 | }
49 |
50 | ///
51 | /// 通过SKU打开Kepler单品页
52 | /// @param sku 商品sku
53 | /// @param userInfo 不需要可以不传 传参数据为第三方应用自定义,可以为页面,频道标识;也可以标识分成信息;该数据只做统计需求。传参长度,使用URL encode之后长度必须小于256字节(不建议传入中文以及特殊字符)
54 | /// 禁止传参带入以下符号: =#%&+?<{}
55 | ///
56 | ///
57 | static keplerOpenItemDetailWithSKU({@required String sku, Map userInfo}) {
58 | _channel.invokeMethod(
59 | "keplerOpenItemDetailWithSKU", {"sku": sku, "userInfo": userInfo});
60 | }
61 |
62 | ///
63 | /// 打开订单列表
64 | /// @param userInfo 不需要可以不传 传参数据为第三方应用自定义,可以为页面,频道标识;也可以标识分成信息;该数据只做统计需求。传参长度,使用URL encode之后长度必须小于256字节(不建议传入中文以及特殊字符)
65 | /// 禁止传参带入以下符号: =#%&+?<{}
66 | ///
67 | ///
68 | static keplerOpenOrderList({Map userInfo}) {
69 | _channel.invokeMethod("keplerOpenOrderList", {"userInfo": userInfo});
70 | }
71 |
72 | ///
73 | /// 根据搜索关键字打开搜索结果页
74 | /// @param searchKey 搜索关键字
75 | /// @param userInfo 不需要可以不传 传参数据为第三方应用自定义,可以为页面,频道标识;也可以标识分成信息;该数据只做统计需求。传参长度,使用URL encode之后长度必须小于256字节(不建议传入中文以及特殊字符)
76 | /// 禁止传参带入以下符号: =#%&+?<{}
77 | ///
78 | ///
79 | static keplerOpenSearchResult({@required String searchKey, Map userInfo}) {
80 | _channel.invokeMethod("keplerOpenSearchResult",
81 | {"searchKey": searchKey, "userInfo": userInfo});
82 | }
83 |
84 | ///
85 | /// 打开购物车界面
86 | /// @param userInfo 不需要可以不传 传参数据为第三方应用自定义,可以为页面,频道标识;也可以标识分成信息;该数据只做统计需求。传参长度,使用URL encode之后长度必须小于256字节(不建议传入中文以及特殊字符)
87 | /// 禁止传参带入以下符号: =#%&+?<{}
88 | ///
89 | ///
90 | static keplerOpenShoppingCart({Map userInfo}) {
91 | _channel.invokeMethod("keplerOpenShoppingCart", {"userInfo": userInfo});
92 | }
93 |
94 | ///
95 | /// 添加到购物车(深圳的加车接口)
96 | /// @param sku 添加到购物车中的商品id
97 | /// @param number 添加到购物车中商品数量,默认1件
98 | ///
99 | ///
100 | static Future keplerAddToCartWithSku(
101 | {@required String sku, String number = "1"}) async {
102 | Map result = await _channel
103 | .invokeMethod("keplerAddToCartWithSku", {"sku": sku, "num": number});
104 | return ResultModel(
105 | result[KeplerConstKey.errorCode],
106 | result[KeplerConstKey.errorMessage],
107 | );
108 | }
109 |
110 | ///
111 | ///联盟一键加购
112 | ///unionID 联盟ID
113 | ///AppID 查看位置:我的推广-推广管理-APP管理
114 | ///skuID 商品SKU,
115 | ///refer refer (原生页面传域名+文章编号)
116 | ///
117 | static Future keplerFastPurchase({
118 | @required String unionID,
119 | @required String appID,
120 | @required String skuID,
121 | @required String refer,
122 | }) async {
123 | Map result = await _channel.invokeMethod("keplerFastPurchase",
124 | {"unionID": unionID, "appID": appID, "skuID": skuID, "refer": refer});
125 | return ResultModel(
126 | result[KeplerConstKey.errorCode],
127 | result[KeplerConstKey.errorMessage],
128 | );
129 | }
130 |
131 | // /// 静态化检测更新,Android无此接口
132 | // static keplerCheckUpdate() {
133 | // _channel.invokeMethod("keplerCheckUpdate");
134 | // }
135 |
136 | /// 登录授权
137 | static Future keplerLogin() async {
138 | Map result = await _channel.invokeMethod("keplerLogin");
139 | return ResultModel(
140 | result[KeplerConstKey.errorCode],
141 | result[KeplerConstKey.errorMessage],
142 | );
143 | }
144 |
145 | //取消授权并且清除登录态
146 | static keplerCancelAuth() {
147 | _channel.invokeMethod(
148 | "keplerCancelAuth",
149 | );
150 | }
151 |
152 | // // 设置进度条颜色,16进制
153 | // static setKeplerProgressBarColor({
154 | // @required String color,
155 | // }) {
156 | // _channel.invokeMethod("setKeplerProgressBarColor", {"color": color});
157 | // }
158 |
159 | // 判断当前是否已经登录授权
160 | static Future keplerIsLogin() async {
161 | Map result = await _channel.invokeMethod("keplerIsLogin");
162 | return ResultModel(
163 | result[KeplerConstKey.errorCode],
164 | result[KeplerConstKey.errorMessage],
165 | );
166 | }
167 |
168 | /// 是否强制使用H5打开界面 默认为true;
169 | /// 设置为false时,调用商品详情页,订单列表,购物车等方法时将跳转到京东app并打开对应的界面
170 | static setKeplerOpenByH5({
171 | @required bool isOpenByH5,
172 | }) {
173 | _channel.invokeMethod("setKeplerOpenByH5", {"isOpenByH5": isOpenByH5});
174 | }
175 | }
176 |
--------------------------------------------------------------------------------
/lib/kepler_const_key.dart:
--------------------------------------------------------------------------------
1 | /*
2 | * @Description: 固定值
3 | * @Author: wuxing
4 | * @Date: 2019-09-12 23:23:13
5 | * @LastEditors: wuxing
6 | * @LastEditTime: 2019-09-12 23:24:13
7 | */
8 |
9 | class KeplerConstKey {
10 | // 错误码
11 | static String errorCode = "errorCode";
12 | // 错误信息
13 | static String errorMessage = "errorMessage";
14 | // result
15 | static String data = "data";
16 | }
--------------------------------------------------------------------------------
/lib/kepler_model.dart:
--------------------------------------------------------------------------------
1 | /*
2 | * @Description: model
3 | * @Author: wuxing
4 | * @Date: 2019-09-12 23:19:08
5 | * @LastEditors: wuxing
6 | * @LastEditTime: 2019-09-12 23:19:38
7 | */
8 |
9 | class ResultModel {
10 | // 错误码
11 | final String errorCode;
12 | // 错误信息
13 | final String errorMessage;
14 |
15 | ResultModel(this.errorCode, this.errorMessage);
16 |
17 | @override
18 | String toString() {
19 | return "{ \"errorCode\" : " +
20 | errorCode +
21 | " ; \" errorMessage \" : " +
22 | errorMessage +
23 | " }";
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/pubspec.lock:
--------------------------------------------------------------------------------
1 | # Generated by pub
2 | # See https://dart.dev/tools/pub/glossary#lockfile
3 | packages:
4 | async:
5 | dependency: transitive
6 | description:
7 | name: async
8 | url: "https://pub.dartlang.org"
9 | source: hosted
10 | version: "2.3.0"
11 | boolean_selector:
12 | dependency: transitive
13 | description:
14 | name: boolean_selector
15 | url: "https://pub.dartlang.org"
16 | source: hosted
17 | version: "1.0.5"
18 | charcode:
19 | dependency: transitive
20 | description:
21 | name: charcode
22 | url: "https://pub.dartlang.org"
23 | source: hosted
24 | version: "1.1.2"
25 | collection:
26 | dependency: transitive
27 | description:
28 | name: collection
29 | url: "https://pub.dartlang.org"
30 | source: hosted
31 | version: "1.14.11"
32 | flutter:
33 | dependency: "direct main"
34 | description: flutter
35 | source: sdk
36 | version: "0.0.0"
37 | flutter_test:
38 | dependency: "direct dev"
39 | description: flutter
40 | source: sdk
41 | version: "0.0.0"
42 | matcher:
43 | dependency: transitive
44 | description:
45 | name: matcher
46 | url: "https://pub.dartlang.org"
47 | source: hosted
48 | version: "0.12.5"
49 | meta:
50 | dependency: transitive
51 | description:
52 | name: meta
53 | url: "https://pub.dartlang.org"
54 | source: hosted
55 | version: "1.1.7"
56 | path:
57 | dependency: transitive
58 | description:
59 | name: path
60 | url: "https://pub.dartlang.org"
61 | source: hosted
62 | version: "1.6.4"
63 | pedantic:
64 | dependency: transitive
65 | description:
66 | name: pedantic
67 | url: "https://pub.dartlang.org"
68 | source: hosted
69 | version: "1.8.0+1"
70 | quiver:
71 | dependency: transitive
72 | description:
73 | name: quiver
74 | url: "https://pub.dartlang.org"
75 | source: hosted
76 | version: "2.0.5"
77 | sky_engine:
78 | dependency: transitive
79 | description: flutter
80 | source: sdk
81 | version: "0.0.99"
82 | source_span:
83 | dependency: transitive
84 | description:
85 | name: source_span
86 | url: "https://pub.dartlang.org"
87 | source: hosted
88 | version: "1.5.5"
89 | stack_trace:
90 | dependency: transitive
91 | description:
92 | name: stack_trace
93 | url: "https://pub.dartlang.org"
94 | source: hosted
95 | version: "1.9.3"
96 | stream_channel:
97 | dependency: transitive
98 | description:
99 | name: stream_channel
100 | url: "https://pub.dartlang.org"
101 | source: hosted
102 | version: "2.0.0"
103 | string_scanner:
104 | dependency: transitive
105 | description:
106 | name: string_scanner
107 | url: "https://pub.dartlang.org"
108 | source: hosted
109 | version: "1.0.5"
110 | term_glyph:
111 | dependency: transitive
112 | description:
113 | name: term_glyph
114 | url: "https://pub.dartlang.org"
115 | source: hosted
116 | version: "1.1.0"
117 | test_api:
118 | dependency: transitive
119 | description:
120 | name: test_api
121 | url: "https://pub.dartlang.org"
122 | source: hosted
123 | version: "0.2.5"
124 | typed_data:
125 | dependency: transitive
126 | description:
127 | name: typed_data
128 | url: "https://pub.dartlang.org"
129 | source: hosted
130 | version: "1.1.6"
131 | vector_math:
132 | dependency: transitive
133 | description:
134 | name: vector_math
135 | url: "https://pub.dartlang.org"
136 | source: hosted
137 | version: "2.0.8"
138 | sdks:
139 | dart: ">=2.2.2 <3.0.0"
140 |
--------------------------------------------------------------------------------
/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: flutter_kepler
2 | description: 京东开普勒插件
3 | version: 0.0.1
4 | author: wx
5 | homepage: https://github.com/FlutterTaoBaoKe/flutter_kepler.git
6 |
7 | environment:
8 | sdk: ">=2.1.0 <3.0.0"
9 |
10 | dependencies:
11 | flutter:
12 | sdk: flutter
13 |
14 | dev_dependencies:
15 | flutter_test:
16 | sdk: flutter
17 |
18 | # For information on the generic Dart part of this file, see the
19 | # following page: https://dart.dev/tools/pub/pubspec
20 |
21 | # The following section is specific to Flutter.
22 | flutter:
23 | # This section identifies this Flutter project as a plugin project.
24 | # The androidPackage and pluginClass identifiers should not ordinarily
25 | # be modified. They are used by the tooling to maintain consistency when
26 | # adding or updating assets for this project.
27 | plugin:
28 | androidPackage: com.wxwx.flutter_kepler
29 | pluginClass: FlutterKeplerPlugin
30 |
31 | # To add assets to your plugin package, add an assets section, like this:
32 | # assets:
33 | # - images/a_dot_burr.jpeg
34 | # - images/a_dot_ham.jpeg
35 | #
36 | # For details regarding assets in packages, see
37 | # https://flutter.dev/assets-and-images/#from-packages
38 | #
39 | # An image asset can refer to one or more resolution-specific "variants", see
40 | # https://flutter.dev/assets-and-images/#resolution-aware.
41 |
42 | # To add custom fonts to your plugin package, add a fonts section here,
43 | # in this "flutter" section. Each entry in this list should have a
44 | # "family" key with the font family name, and a "fonts" key with a
45 | # list giving the asset and other descriptors for the font. For
46 | # example:
47 | # fonts:
48 | # - family: Schyler
49 | # fonts:
50 | # - asset: fonts/Schyler-Regular.ttf
51 | # - asset: fonts/Schyler-Italic.ttf
52 | # style: italic
53 | # - family: Trajan Pro
54 | # fonts:
55 | # - asset: fonts/TrajanPro.ttf
56 | # - asset: fonts/TrajanPro_Bold.ttf
57 | # weight: 700
58 | #
59 | # For details regarding fonts in packages, see
60 | # https://flutter.dev/custom-fonts/#from-packages
61 |
--------------------------------------------------------------------------------
/test/flutter_kepler_test.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/services.dart';
2 | import 'package:flutter_test/flutter_test.dart';
3 | import 'package:flutter_kepler/flutter_kepler.dart';
4 |
5 | void main() {
6 | const MethodChannel channel = MethodChannel('flutter_kepler');
7 |
8 | setUp(() {
9 | channel.setMockMethodCallHandler((MethodCall methodCall) async {
10 | return '42';
11 | });
12 | });
13 |
14 | tearDown(() {
15 | channel.setMockMethodCallHandler(null);
16 | });
17 |
18 | test('getPlatformVersion', () async {
19 | expect(await FlutterKepler.platformVersion, '42');
20 | });
21 | }
22 |
--------------------------------------------------------------------------------