|
|
@@ -0,0 +1,43 @@ |
|
|
|
import 'dart:io'; |
|
|
|
|
|
|
|
import 'package:zhiying_comm/util/application.dart'; |
|
|
|
|
|
|
|
import 'jdsdk.dart'; |
|
|
|
|
|
|
|
class FlutterJDSDKRegister { |
|
|
|
static init() { |
|
|
|
initMethod(); |
|
|
|
} |
|
|
|
|
|
|
|
static void initMethod() { |
|
|
|
////初始化JDSDK |
|
|
|
Application.addStringParamsMethod( |
|
|
|
type: "init_jd_sdk", |
|
|
|
method: (param, callback) async { |
|
|
|
if (param == null) { |
|
|
|
print("jd初始化参数为空"); |
|
|
|
return; |
|
|
|
} |
|
|
|
var result = await Jdsdk.init(appKey: param['appKey'] ?? '', appSecret: param['appSecret'] ?? ''); |
|
|
|
print(result); |
|
|
|
if (callback != null) { |
|
|
|
callback(result); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
////打开京东appUrl |
|
|
|
Application.addStringParamsMethod( |
|
|
|
type: "open_jd_url", |
|
|
|
method: (param, callback) async { |
|
|
|
if (param == null) { |
|
|
|
print("jd初始化参数为空"); |
|
|
|
return; |
|
|
|
} |
|
|
|
var result = await Jdsdk.openUrl(url: param['url'] ?? ''); |
|
|
|
print(result); |
|
|
|
if (callback != null) { |
|
|
|
callback(result); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
} |