From d2262be6f185041bd355cd73dd0f1181c9aa2702 Mon Sep 17 00:00:00 2001 From: developer Date: Sun, 13 Nov 2022 21:24:08 +0800 Subject: [PATCH 1/3] release: version:2.38.7 --- ios/mop.podspec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ios/mop.podspec b/ios/mop.podspec index 278fe67..365f8d0 100644 --- a/ios/mop.podspec +++ b/ios/mop.podspec @@ -17,7 +17,7 @@ A finclip miniprogram flutter sdk. s.dependency 'Flutter' s.ios.deployment_target = '9.0' - s.dependency 'FinApplet' , '2.38.5' - s.dependency 'FinAppletExt' , '2.38.5' + s.dependency 'FinApplet' , '2.38.7' + s.dependency 'FinAppletExt' , '2.38.7' end From 73f3a24e5521750c37f2a2a0b1473a39b9da242b Mon Sep 17 00:00:00 2001 From: wanghualei Date: Tue, 15 Nov 2022 22:05:00 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89api=E8=BF=94=E5=9B=9E=E5=80=BC=E4=B8=8D=E6=98=AF?= =?UTF-8?q?=E5=AD=97=E5=85=B8=E7=B1=BB=E5=9E=8B=E7=9A=84=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ios/Classes/Api/MOP_registerExtensionApi.m | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ios/Classes/Api/MOP_registerExtensionApi.m b/ios/Classes/Api/MOP_registerExtensionApi.m index c1dedaf..04a5d99 100644 --- a/ios/Classes/Api/MOP_registerExtensionApi.m +++ b/ios/Classes/Api/MOP_registerExtensionApi.m @@ -23,9 +23,10 @@ [channel invokeMethod:api arguments:param result:^(id _Nullable result) { NSLog(@"extensionApi reslut:%@",result); // 先判断是否flutter发生错误 - BOOL isFlutterError = [result isKindOfClass:[FlutterError class]] || result == FlutterMethodNotImplemented; - if (isFlutterError) { - NSLog(@"extensionApi reslut:fail"); +// BOOL isFlutterError = [result isKindOfClass:[FlutterError class]] || result == FlutterMethodNotImplemented; + BOOL isValid = [result isKindOfClass:[NSDictionary class]]; + if (!isValid) { + NSLog(@"extensionApi reslut is not NSDictionary"); callback(FATExtensionCodeFailure,nil); return; } From 6c00cfc418f08e75c6a173fbe171b2566d49ed6f Mon Sep 17 00:00:00 2001 From: wanghualei Date: Tue, 15 Nov 2022 22:50:41 +0800 Subject: [PATCH 3/3] =?UTF-8?q?update=20=E8=87=AA=E5=AE=9A=E4=B9=89api?= =?UTF-8?q?=E7=9A=84=E8=BF=94=E5=9B=9E=E5=80=BC=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/mop.dart | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/lib/mop.dart b/lib/mop.dart index 55df1ec..fb1c6dd 100644 --- a/lib/mop.dart +++ b/lib/mop.dart @@ -7,7 +7,8 @@ import 'package:mop/api.dart'; typedef MopEventCallback = void Function(dynamic event); typedef MopEventErrorCallback = void Function(dynamic event); -typedef ExtensionApiHandler = Future Function(dynamic params); +typedef ExtensionApiHandler = Future> Function(dynamic params); +typedef MopAppletHandler = Future Function(dynamic params); class FinStoreConfig { ///创建应用时生成的SDK Key @@ -317,6 +318,8 @@ class Mop { late int eventId = 0; final List> _mopEventQueye = >[]; + final Map _appletHandlerApis = {}; + final Map _extensionApis = {}; Map _webExtensionApis = {}; @@ -360,6 +363,11 @@ class Mop { if (handler != null) { return await handler(call.arguments); } + + final apiHandler = _appletHandlerApis[name]; + if (apiHandler != null) { + return await apiHandler(call.arguments); + } } else if (call.method.startsWith("webExtentionApi:")) { final name = call.method.substring("webExtentionApi:".length); final handler = _webExtensionApis[name]; @@ -553,13 +561,13 @@ class Mop { /// 注册小程序事件处理 /// void registerAppletHandler(AppletHandler handler) { - _extensionApis["forwardApplet"] = (params) async { + _appletHandlerApis["forwardApplet"] = (params) async { handler.forwardApplet(Map.from(params)); }; - _extensionApis["getUserInfo"] = (params) { + _appletHandlerApis["getUserInfo"] = (params) { return handler.getUserInfo(); }; - _extensionApis["getCustomMenus"] = (params) async { + _appletHandlerApis["getCustomMenus"] = (params) async { final res = await handler.getCustomMenus(params["appId"]); List> list = []; res.forEach((element) { @@ -573,14 +581,14 @@ class Mop { debugPrint("registerAppletHandler getCustomMenus list $list"); return list; }; - _extensionApis["onCustomMenuClick"] = (params) async { + _appletHandlerApis["onCustomMenuClick"] = (params) async { return handler.onCustomMenuClick( params["appId"], params["path"], params["menuId"], params["appInfo"]); }; - _extensionApis["appletDidOpen"] = (params) async { + _appletHandlerApis["appletDidOpen"] = (params) async { return handler.appletDidOpen(params["appId"]); }; - _extensionApis["getPhoneNumber"] = (params) async { + _appletHandlerApis["getPhoneNumber"] = (params) async { return handler.getMobileNumber((params0) => {_channel.invokeMethod("getPhoneNumberResult", params0)}); };