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

View File

@ -16,16 +16,189 @@ class FinStoreConfig {
String apiServer; //
String apmServer; //apm,apiServer
int cryptType; //MD5 0:MD5 1:MD5
String fingerprint; //SDK (https://open.fdep.cn/)
String
encryptServerData; //使YES
String cryptType; //MD5 SM
String? fingerprint; //SDK (https://open.fdep.cn/)
bool 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 {
Map<String, dynamic> navigationTitleTextAttributes; //font
class UIConfig {
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 {
@ -48,7 +221,8 @@ class Mop {
// init
_channel = const MethodChannel('mop');
_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) {
debugPrint('matrix: receiveBroadcastStream $value');
for (Map m in _mopEventQueye) {
@ -89,33 +263,54 @@ class Mop {
///
/// 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
/// [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
/// [cryptType] is optional. cryptType, should be MD5/SM
/// [disablePermission] is optional.
/// [encryptServerData]
/// [userId] id
/// [finStoreConfigs]
/// [uiConfig] UI
/// [debug] debug
/// [customWebViewUserAgent] webview ua
/// [appletIntervalUpdateLimit]
/// [maxRunningApplet]
///
Future<Map> initialize(String appkey, String secret,
{ String? apiServer,
String? apiPrefix,
String? cryptType,
bool? disablePermission,
String? userId,
bool encryptServerData = false,
bool debug = false,
bool bindAppletWithMainProcess = false}) async {
Future<Map> initialize(
String sdkkey,
String secret, {
String? apiServer,
String? apiPrefix,
String? cryptType,
bool encryptServerData = false,
bool disablePermission = false,
String? userId,
bool debug = false,
bool bindAppletWithMainProcess = false,
List<FinStoreConfig>? finStoreConfigs,
UIConfig? uiConfig,
String? customWebViewUserAgent,
int appletIntervalUpdateLimit = 0,
int maxRunningApplet = 5,
}) async {
final Map ret = await _channel.invokeMethod('initialize', {
'appkey': appkey,
'appkey': sdkkey,
'secret': secret,
'apiServer': apiServer,
'apiPrefix': apiPrefix,
'cryptType': cryptType,
"encryptServerData": encryptServerData,
'disablePermission': disablePermission,
'userId': userId,
"encryptServerData": encryptServerData,
"debug": debug,
"bindAppletWithMainProcess": bindAppletWithMainProcess
"bindAppletWithMainProcess": bindAppletWithMainProcess,
"finStoreConfigs": finStoreConfigs?.map((e) => e.toMap()),
"uiConfig": uiConfig?.toMap(),
"customWebViewUserAgent": customWebViewUserAgent,
"appletIntervalUpdateLimit": appletIntervalUpdateLimit,
"maxRunningApplet": maxRunningApplet
});
return ret;
}
@ -132,14 +327,11 @@ class Mop {
/// [cryptType] is optional. cryptType, should be MD5/SM
Future<Map> openApplet(
final String appId, {
final String? path,
final String? query,
final int? sequence,
final String? apiServer,
final String? apiPrefix,
final String? fingerprint,
final String? cryptType,
final String? scene,
final String? path,
final String? query,
final int? sequence,
final String? apiServer,
final String? scene,
}) async {
Map<String, Object> params = {'appId': appId};
Map param = {};
@ -148,9 +340,6 @@ class Mop {
if (param.length > 0) params["params"] = param;
if (sequence != null) params["sequence"] = sequence;
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;
final Map ret = await _channel.invokeMethod('openApplet', params);
return ret;
@ -228,7 +417,7 @@ class Mop {
return handler.getUserInfo();
};
_extensionApis["getCustomMenus"] = (params) async {
final res = await handler.getCustomMenus(params["appId"]);
final res = await handler.getCustomMenus(params["appId"]);
List<Map<String, dynamic>> list = [];
res.forEach((element) {
Map<String, dynamic> map = Map();
@ -242,7 +431,8 @@ class Mop {
return list;
};
_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 {
return handler.appletDidOpen(params["appId"]);
@ -274,23 +464,6 @@ class Mop {
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 {
await _channel.invokeMethod(
@ -305,25 +478,26 @@ class Mop {
return;
}
// removeUsedApplet?
Future<void> removeApplet(String appletId) async {
await _channel.invokeMethod("removeApplet", {"appletId": appletId});
//
Future setActivityTransitionAnim(Anim anim) async {
await _channel
.invokeMethod("setActivityTransitionAnim", {"anim": anim.name});
return;
}
//
Future<void> setActivityTransitionAnim() async {}
//
Future<void> sendCustomEvent(Map<String, dynamic> eventData) async {
await _channel.invokeMethod("sendCustomEvent", {"eventData": eventData});
Future<void> sendCustomEvent(
String appId, Map<String, dynamic> eventData) async {
await _channel.invokeMethod(
"sendCustomEvent", {"appId": appId, "eventData": eventData});
return;
}
//js
Future<void> callJS(String eventName, String nativeViewId,
Future<void> callJS(String appId, String eventName, String nativeViewId,
Map<String, dynamic> eventData) async {
await _channel.invokeMethod("callJS", {
"appId": appId,
"eventName": eventName,
"nativeViewId": nativeViewId,
"eventData": eventData