feat: 增加小程序打开的事件回调
parent
853039fc0f
commit
4a731a8e53
|
@ -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
|
||||
|
|
|
@ -36,4 +36,7 @@ abstract class AppletHandler {
|
|||
///自定义菜单点击处理
|
||||
Future<void> onCustomMenuClick(
|
||||
String appId, String path, String menuId, String appInfo);
|
||||
|
||||
//打开小程序
|
||||
Future<void> appletDidOpen(String appId);
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue