From 4a731a8e53bc9199f40a523963feaea249d0f74a Mon Sep 17 00:00:00 2001 From: wangtao Date: Tue, 19 Oct 2021 21:26:05 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E5=B0=8F=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F=E6=89=93=E5=BC=80=E7=9A=84=E4=BA=8B=E4=BB=B6=E5=9B=9E?= =?UTF-8?q?=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ios/Classes/Api/MOPAppletDelegate.m | 11 +++++++++++ lib/api.dart | 3 +++ lib/mop.dart | 5 +++++ 3 files changed, 19 insertions(+) diff --git a/ios/Classes/Api/MOPAppletDelegate.m b/ios/Classes/Api/MOPAppletDelegate.m index c3ff701..d01d99a 100644 --- a/ios/Classes/Api/MOPAppletDelegate.m +++ b/ios/Classes/Api/MOPAppletDelegate.m @@ -102,4 +102,15 @@ }]; } +- (void)applet:(NSString *)appletId didOpenCompletion:(NSError *)error { + if (!appletId) { + return; + } + NSDictionary *params = @{@"appId":appletId}; + FlutterMethodChannel *channel = [[MopPlugin instance] methodChannel]; + [channel invokeMethod:@"extensionApi:appletDidOpen" arguments:params result:^(id _Nullable result) { + + }]; +} + @end diff --git a/lib/api.dart b/lib/api.dart index f5e5f6f..f849c71 100644 --- a/lib/api.dart +++ b/lib/api.dart @@ -36,4 +36,7 @@ abstract class AppletHandler { ///自定义菜单点击处理 Future onCustomMenuClick( String appId, String path, String menuId, String appInfo); + + //打开小程序 + Future appletDidOpen(String appId); } diff --git a/lib/mop.dart b/lib/mop.dart index e155152..855078e 100644 --- a/lib/mop.dart +++ b/lib/mop.dart @@ -54,6 +54,8 @@ class Mop { if (handler != null) { return await handler(call.arguments); } + } else if (call.method.startsWith("extensionApi:")) { + } } @@ -217,6 +219,9 @@ class Mop { return handler.onCustomMenuClick( params["appId"], params["path"], params["menuId"], params["appInfo"]); }; + _extensionApis["appletDidOpen"] = (params) async { + return handler.appletDidOpen(params["appId"]); + }; _channel.invokeMethod("registerAppletHandler"); }