api声明修改

master
kangxuyao 2021-12-22 14:35:51 +08:00
parent 35998a8490
commit 48c8f1c708
3 changed files with 267 additions and 72 deletions

View File

@ -1 +1 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"mop","path":"/Users/wangtao/Documents/fantai/code/finclip-flutter-sdk/","dependencies":[]}],"android":[{"name":"mop","path":"/Users/wangtao/Documents/fantai/code/finclip-flutter-sdk/","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"mop","dependencies":[]}],"date_created":"2021-12-20 16:48:35.113009","version":"2.2.1"} {"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"mop","path":"/Users/kangxuyao/StudioProjects/finclip-flutter-sdk/","dependencies":[]}],"android":[{"name":"flutter_plugin_android_lifecycle","path":"/Users/kangxuyao/.pub-cache/hosted/pub.flutter-io.cn/flutter_plugin_android_lifecycle-2.0.5/","dependencies":[]},{"name":"mop","path":"/Users/kangxuyao/StudioProjects/finclip-flutter-sdk/","dependencies":["flutter_plugin_android_lifecycle"]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"mop","dependencies":["flutter_plugin_android_lifecycle"]}],"date_created":"2021-12-22 09:19:50.961703","version":"2.6.0-12.0.pre.553"}

View File

@ -7,7 +7,7 @@ packages:
name: async name: async
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.6.1" version: "2.8.2"
boolean_selector: boolean_selector:
dependency: transitive dependency: transitive
description: description:
@ -21,14 +21,14 @@ packages:
name: characters name: characters
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.1.0" version: "1.2.0"
charcode: charcode:
dependency: transitive dependency: transitive
description: description:
name: charcode name: charcode
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.2.0" version: "1.3.1"
clock: clock:
dependency: transitive dependency: transitive
description: description:
@ -49,7 +49,7 @@ packages:
name: cupertino_icons name: cupertino_icons
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.1.3" version: "1.0.4"
fake_async: fake_async:
dependency: transitive dependency: transitive
description: description:
@ -62,32 +62,53 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
flutter_lints:
dependency: "direct dev"
description:
name: flutter_lints
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.4"
flutter_plugin_android_lifecycle:
dependency: transitive
description:
name: flutter_plugin_android_lifecycle
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.5"
flutter_test: flutter_test:
dependency: "direct dev" dependency: "direct dev"
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
lints:
dependency: transitive
description:
name: lints
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.1"
matcher: matcher:
dependency: transitive dependency: transitive
description: description:
name: matcher name: matcher
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.12.10" version: "0.12.11"
meta: meta:
dependency: transitive dependency: transitive
description: description:
name: meta name: meta
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.3.0" version: "1.7.0"
mop: mop:
dependency: "direct dev" dependency: "direct main"
description: description:
path: ".." path: ".."
relative: true relative: true
source: path source: path
version: "2.34.9" version: "2.34.12"
path: path:
dependency: transitive dependency: transitive
description: description:
@ -141,7 +162,7 @@ packages:
name: test_api name: test_api
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.3.0" version: "0.4.3"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:
@ -155,7 +176,7 @@ packages:
name: vector_math name: vector_math
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.1.0" version: "2.1.1"
sdks: sdks:
dart: ">=2.12.0 <3.0.0" dart: ">=2.14.0 <3.0.0"
flutter: ">=1.10.0" flutter: ">=2.2.3"

View File

@ -16,16 +16,189 @@ class FinStoreConfig {
String apiServer; // String apiServer; //
String apmServer; //apm,apiServer String apmServer; //apm,apiServer
int cryptType; //MD5 0:MD5 1:MD5 String cryptType; //MD5 SM
String fingerprint; //SDK (https://open.fdep.cn/) String? fingerprint; //SDK (https://open.fdep.cn/)
String bool encryptServerData; //使YES
encryptServerData; //使YES
FinStoreConfig(this.sdkKey, this.sdkSecret, this.apiServer, this.apmServer,
{this.cryptType = "MD5",
this.fingerprint,
this.encryptServerData = false});
Map<String, dynamic> toMap() {
return {
"sdkkey": sdkKey,
"sdkSecret": sdkSecret,
"apiServer": apiServer,
"apmServer": apmServer,
"cryptType": cryptType,
"fingerprint": fingerprint,
"encryptServerData": encryptServerData
};
}
} }
class FinAppletUIConfig { class UIConfig {
Map<String, dynamic> navigationTitleTextAttributes; //font Map<String, dynamic>? navigationTitleTextAttributes; //font
///
bool isAlwaysShowBackInDefaultNavigationBar = false;
///
bool isClearNavigationBarNavButtonBackground = false;
///"更多""反馈与投诉"
bool isHideFeedbackAndComplaints = false;
///"更多""返回首页"
bool isHideBackHome = false;
///"更多""转发"
bool isHideForwardMenu = false;
/// ServiceSDK
bool hideTransitionCloseButton = false;
///
bool disableSlideCloseAppletGesture = false;
///
CapsuleConfig? capsuleConfig;
FloatWindowConfig? floatWindowConfig;
Map<String, dynamic> toMap() {
return {
"navigationTitleTextAttributes": navigationTitleTextAttributes,
"isAlwaysShowBackInDefaultNavigationBar":
isAlwaysShowBackInDefaultNavigationBar,
"isClearNavigationBarNavButtonBackground":
isClearNavigationBarNavButtonBackground,
"isHideFeedbackAndComplaints": isHideFeedbackAndComplaints,
"isHideBackHome": isHideBackHome,
"isHideForwardMenu": isHideForwardMenu,
"hideTransitionCloseButton": hideTransitionCloseButton,
"disableSlideCloseAppletGesture": disableSlideCloseAppletGesture,
"capsuleConfig": capsuleConfig?.toMap(),
"floatWindowConfig": floatWindowConfig?.toMap(),
};
}
}
///
class CapsuleConfig {
/// 88
double capsuleWidth = 88;
///32
double capsuleHeight = 32;
///
double capsuleRightMargin = 7;
///5
double capsuleCornerRadius = 5;
///0.8
double capsuleBorderWidth = 1;
///
int capsuleBgLightColor = 0x33000000;
///
int capsuleBgDarkColor = 0x80ffffff;
///
int capsuleBorderLightColor = 0x80ffffff;
///
int capsuleBorderDarkColor = 0x26000000;
///线
int capsuleDividerLightColor = 0x80ffffff;
///线
int capsuleDividerDarkColor = 0x26000000;
///使
int? moreLightImage;
///使
int? moreDarkImage;
///
double moreBtnWidth = 32;
///
double moreBtnLeftMargin = 6;
///使
int? closeLightImage;
///使
int? closeDarkImage;
///
double closeBtnWidth = 32;
///
double closeBtnLeftMargin = 6;
Map<String, dynamic> toMap() {
return {
"capsuleWidth": capsuleWidth,
"capsuleHeight": capsuleHeight,
"capsuleRightMargin": capsuleRightMargin,
"capsuleCornerRadius": capsuleCornerRadius,
"capsuleBorderWidth": capsuleBorderWidth,
"capsuleBgLightColor": capsuleBgLightColor,
"capsuleBgDarkColor": capsuleBgDarkColor,
"capsuleBorderLightColor": capsuleBorderLightColor,
"capsuleBorderDarkColor": capsuleBorderDarkColor,
"capsuleDividerLightColor": capsuleDividerLightColor,
"capsuleDividerDarkColor": capsuleDividerDarkColor,
"moreLightImage": moreLightImage,
"moreDarkImage": moreDarkImage,
"moreBtnWidth": moreBtnWidth,
"moreBtnLeftMargin": moreBtnLeftMargin,
"closeLightImage": closeLightImage,
"closeDarkImage": closeDarkImage,
"closeBtnWidth": closeBtnWidth,
"closeBtnLeftMargin": closeBtnLeftMargin,
};
}
}
class FloatWindowConfig {
bool floatMode = false;
int x;
int y;
int width;
int height;
FloatWindowConfig(this.floatMode, this.x, this.y, this.width, this.height);
Map<String, dynamic> toMap() {
return {
"floatMode": floatMode,
"x": x,
"y": y,
"width": width,
"height": height
};
}
}
enum Anim {
SlideFromLeftToRightAnim,
SlideFromRightToLeftAnim,
SlideFromTopToBottomAnim,
SlideFromBottomToTopAnim,
FadeInAnim,
NoneAnim
} }
class Mop { class Mop {
@ -48,7 +221,8 @@ class Mop {
// init // init
_channel = const MethodChannel('mop'); _channel = const MethodChannel('mop');
_channel.setMethodCallHandler(_handlePlatformMethodCall); _channel.setMethodCallHandler(_handlePlatformMethodCall);
_mopEventChannel = const EventChannel('plugins.mop.finogeeks.com/mop_event'); _mopEventChannel =
const EventChannel('plugins.mop.finogeeks.com/mop_event');
_mopEventChannel.receiveBroadcastStream().listen((dynamic value) { _mopEventChannel.receiveBroadcastStream().listen((dynamic value) {
debugPrint('matrix: receiveBroadcastStream $value'); debugPrint('matrix: receiveBroadcastStream $value');
for (Map m in _mopEventQueye) { for (Map m in _mopEventQueye) {
@ -89,33 +263,54 @@ class Mop {
/// ///
/// initialize mop miniprogram engine. /// initialize mop miniprogram engine.
/// ///
/// [appkey] is required. it can be getted from api.finclip.com /// [sdkkey] is required. it can be getted from api.finclip.com
/// [secret] is required. it can be getted from api.finclip.com /// [secret] is required. it can be getted from api.finclip.com
/// [apiServer] is optional. the mop server address. default is https://mp.finogeek.com /// [apiServer] is optional. the mop server address. default is https://mp.finogeek.com
/// [apiPrefix] is optional. the mop server prefix. default is /api/v1/mop /// [apiPrefix] is optional. the mop server prefix. default is /api/v1/mop
/// [cryptType] is optional. cryptType, should be MD5/SM /// [cryptType] is optional. cryptType, should be MD5/SM
/// [disablePermission] is optional. /// [disablePermission] is optional.
/// [encryptServerData]
/// [userId] id
/// [finStoreConfigs]
/// [uiConfig] UI
/// [debug] debug
/// [customWebViewUserAgent] webview ua
/// [appletIntervalUpdateLimit]
/// [maxRunningApplet]
/// ///
Future<Map> initialize(String appkey, String secret, Future<Map> initialize(
{ String? apiServer, String sdkkey,
String secret, {
String? apiServer,
String? apiPrefix, String? apiPrefix,
String? cryptType, String? cryptType,
bool? disablePermission,
String? userId,
bool encryptServerData = false, bool encryptServerData = false,
bool disablePermission = false,
String? userId,
bool debug = false, bool debug = false,
bool bindAppletWithMainProcess = false}) async { bool bindAppletWithMainProcess = false,
List<FinStoreConfig>? finStoreConfigs,
UIConfig? uiConfig,
String? customWebViewUserAgent,
int appletIntervalUpdateLimit = 0,
int maxRunningApplet = 5,
}) async {
final Map ret = await _channel.invokeMethod('initialize', { final Map ret = await _channel.invokeMethod('initialize', {
'appkey': appkey, 'appkey': sdkkey,
'secret': secret, 'secret': secret,
'apiServer': apiServer, 'apiServer': apiServer,
'apiPrefix': apiPrefix, 'apiPrefix': apiPrefix,
'cryptType': cryptType, 'cryptType': cryptType,
"encryptServerData": encryptServerData,
'disablePermission': disablePermission, 'disablePermission': disablePermission,
'userId': userId, 'userId': userId,
"encryptServerData": encryptServerData,
"debug": debug, "debug": debug,
"bindAppletWithMainProcess": bindAppletWithMainProcess "bindAppletWithMainProcess": bindAppletWithMainProcess,
"finStoreConfigs": finStoreConfigs?.map((e) => e.toMap()),
"uiConfig": uiConfig?.toMap(),
"customWebViewUserAgent": customWebViewUserAgent,
"appletIntervalUpdateLimit": appletIntervalUpdateLimit,
"maxRunningApplet": maxRunningApplet
}); });
return ret; return ret;
} }
@ -136,9 +331,6 @@ class Mop {
final String? query, final String? query,
final int? sequence, final int? sequence,
final String? apiServer, final String? apiServer,
final String? apiPrefix,
final String? fingerprint,
final String? cryptType,
final String? scene, final String? scene,
}) async { }) async {
Map<String, Object> params = {'appId': appId}; Map<String, Object> params = {'appId': appId};
@ -148,9 +340,6 @@ class Mop {
if (param.length > 0) params["params"] = param; if (param.length > 0) params["params"] = param;
if (sequence != null) params["sequence"] = sequence; if (sequence != null) params["sequence"] = sequence;
if (apiServer != null) params["apiServer"] = apiServer; if (apiServer != null) params["apiServer"] = apiServer;
if (apiPrefix != null) params["apiPrefix"] = apiPrefix;
if (fingerprint != null) params["fingerprint"] = fingerprint;
if (cryptType != null) params["cryptType"] = cryptType;
if (scene != null) param["scene"] = scene; if (scene != null) param["scene"] = scene;
final Map ret = await _channel.invokeMethod('openApplet', params); final Map ret = await _channel.invokeMethod('openApplet', params);
return ret; return ret;
@ -242,7 +431,8 @@ class Mop {
return list; return list;
}; };
_extensionApis["onCustomMenuClick"] = (params) async { _extensionApis["onCustomMenuClick"] = (params) async {
return handler.onCustomMenuClick(params["appId"], params["path"], params["menuId"], params["appInfo"]); return handler.onCustomMenuClick(
params["appId"], params["path"], params["menuId"], params["appInfo"]);
}; };
_extensionApis["appletDidOpen"] = (params) async { _extensionApis["appletDidOpen"] = (params) async {
return handler.appletDidOpen(params["appId"]); return handler.appletDidOpen(params["appId"]);
@ -274,23 +464,6 @@ class Mop {
return; return;
} }
//20211220Api
//
Future<void> setFinStoreConfigs(List<FinStoreConfig> configs) async {}
//ui
Future<void> setUiConfig() async {}
//ua setUiConfigua
Future<void> setCustomWebViewUserAgent(String ua) async {}
//
Future<void> startApplet() async {}
//
Future<void> setAppletIntervalUpdateLimit(int count) async {}
// //
Future<void> closeApplet(String appletId, bool animated) async { Future<void> closeApplet(String appletId, bool animated) async {
await _channel.invokeMethod( await _channel.invokeMethod(
@ -305,25 +478,26 @@ class Mop {
return; return;
} }
// removeUsedApplet? //
Future<void> removeApplet(String appletId) async { Future setActivityTransitionAnim(Anim anim) async {
await _channel.invokeMethod("removeApplet", {"appletId": appletId}); await _channel
.invokeMethod("setActivityTransitionAnim", {"anim": anim.name});
return; return;
} }
//
Future<void> setActivityTransitionAnim() async {}
// //
Future<void> sendCustomEvent(Map<String, dynamic> eventData) async { Future<void> sendCustomEvent(
await _channel.invokeMethod("sendCustomEvent", {"eventData": eventData}); String appId, Map<String, dynamic> eventData) async {
await _channel.invokeMethod(
"sendCustomEvent", {"appId": appId, "eventData": eventData});
return; return;
} }
//js //js
Future<void> callJS(String eventName, String nativeViewId, Future<void> callJS(String appId, String eventName, String nativeViewId,
Map<String, dynamic> eventData) async { Map<String, dynamic> eventData) async {
await _channel.invokeMethod("callJS", { await _channel.invokeMethod("callJS", {
"appId": appId,
"eventName": eventName, "eventName": eventName,
"nativeViewId": nativeViewId, "nativeViewId": nativeViewId,
"eventData": eventData "eventData": eventData