Commit db3cb48d authored by 汪林玲's avatar 汪林玲

统一插件

parent 3c95241b
......@@ -3,7 +3,7 @@ description: Demonstrates how to use the jdsdk plugin.
publish_to: 'none'
environment:
sdk: ">=2.1.0 <3.0.0"
sdk: ">=2.8.0 <3.0.0"
dependencies:
flutter:
......
......@@ -16,21 +16,21 @@
NSString *appKey = call.arguments[@"appKey"];
NSString *appSecret = call.arguments[@"appSecret"];
[[KeplerApiManager sharedKPService]asyncInitSdk:appKey secretKey:appSecret sucessCallback:^(){
result(@"{status:1}");
result(@{@"errorCode":@"0",@"errorMessage":@"成功",@"data":@{}});
}failedCallback:^(NSError *error){
result(@"{status:0}");
result(@{@"errorCode":@"-1",@"errorMessage":@"初始化失败",@"data":@{}});
}];
} else if([@"openUrl" isEqualToString:call.method]){
NSString *url = call.arguments[@"url"];
//判断是否安装京东app
if ([[UIApplication sharedApplication]canOpenURL:[NSURL URLWithString:[NSString stringWithFormat:@"openapp.jdmobile://"]]]) {
[[KeplerApiManager sharedKPService]openKeplerPageWithURL:url userInfo:nil successCallback:^{
result(@"{status:1}");
result(@YES);
} failedCallback:^(NSInteger code, NSString * _Nonnull url) {
result(@"{status:0}");
result(@NO);
}];
}else{
result(@"{status:0}");
result(@NO);
}
} else {
result(FlutterMethodNotImplemented);
......
......@@ -10,10 +10,8 @@ class Jdsdk {
/// [appKey] appKey
/// [appSecret] app密钥
///
static Future<String> init(
{@required String appKey, @required String appSecret}) async {
final String version = await _channel
.invokeMethod('init', {"appKey": appKey, "appSecret": appSecret});
static Future<Map<String,dynamic>> init({@required String appKey, @required String appSecret}) async {
final Map<String,dynamic> version = await _channel.invokeMethod('init', {"appKey": appKey, "appSecret": appSecret});
return version;
}
......@@ -21,8 +19,8 @@ class Jdsdk {
/// 打开京东的任意URL
/// [url] 待打开的url地址
///
static Future<String> openUrl({@required String url}) async {
final String version = await _channel.invokeMethod('openUrl', {"url": url});
static Future<bool> openUrl({@required String url}) async {
final bool version = await _channel.invokeMethod('openUrl', {"url": url});
return version;
}
}
......@@ -4,8 +4,10 @@ version: 0.0.1
author: wuchaowen <chaowen1110@gmail.com>
homepage: https://github.com/selfimgr/flutter_jdsdk.git
publish_to: 'none'
environment:
sdk: ">=2.1.0 <3.0.0"
sdk: ">=2.8.0 <3.0.0"
dependencies:
flutter:
......@@ -15,46 +17,7 @@ dev_dependencies:
flutter_test:
sdk: flutter
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter.
flutter:
# This section identifies this Flutter project as a plugin project.
# The androidPackage and pluginClass identifiers should not ordinarily
# be modified. They are used by the tooling to maintain consistency when
# adding or updating assets for this project.
plugin:
androidPackage: com.jd.jdsdk
pluginClass: JdsdkPlugin
\ No newline at end of file
# To add assets to your plugin package, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
#
# For details regarding assets in packages, see
# https://flutter.dev/assets-and-images/#from-packages
#
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware.
# To add custom fonts to your plugin package, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts in packages, see
# https://flutter.dev/custom-fonts/#from-packages
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment