feat: 增加小程序打开的事件回调

master
wangtao 2021-10-19 21:26:05 +08:00
parent 853039fc0f
commit 4a731a8e53
3 changed files with 19 additions and 0 deletions

View File

@ -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

View File

@ -36,4 +36,7 @@ abstract class AppletHandler {
///
Future<void> onCustomMenuClick(
String appId, String path, String menuId, String appInfo);
//
Future<void> appletDidOpen(String appId);
}

View File

@ -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");
}