调整方法注释和顺序

master
wanghualei 2023-03-27 18:10:41 +08:00
parent 6597433980
commit 462ef3382e
1 changed files with 85 additions and 85 deletions

View File

@ -1032,18 +1032,30 @@ class Mop {
return ret; return ret;
} }
/// get current using applet ///
/// 使 /// [qrcode]
/// {appId,name,icon,description,version,thumbnail} Future qrcodeOpenApplet(String qrcode, {bool isSingleProcess = false}) async {
Future<Map<String, dynamic>> currentApplet() async { Map<String, Object> params = {
final ret = await _channel.invokeMapMethod("currentApplet"); 'qrcode': qrcode,
return Map<String, dynamic>.from(ret!); 'isSingleProcess': isSingleProcess,
};
return await _channel.invokeMapMethod("qrcodeOpenApplet", params);
} }
Future<Map<String, dynamic>> changeUserId(String userId) async { /// --
Map<String, Object> params = {'userId': userId}; Future scanOpenApplet(String info, {bool isSingleProcess = false}) async {
final ret = await _channel.invokeMapMethod("changeUserId", params); Map<String, Object> params = {
return Map<String, dynamic>.from(ret!); 'info': info,
'isSingleProcess': isSingleProcess,
};
return await _channel.invokeMapMethod("scanOpenApplet", params);
}
///
Future<void> closeApplet(String appletId, bool animated) async {
await _channel.invokeMethod(
"closeApplet", {"appletId": appletId, "animated": animated});
return;
} }
/// close all running applets /// close all running applets
@ -1052,10 +1064,11 @@ class Mop {
return await _channel.invokeMethod("closeAllApplets"); return await _channel.invokeMethod("closeAllApplets");
} }
/// clear applets cache ///
/// Future<void> finishRunningApplet(String appletId, bool animated) async {
Future clearApplets() async { await _channel.invokeMethod(
return await _channel.invokeMethod("clearApplets"); "finishRunningApplet", {"appletId": appletId, "animated": animated});
return;
} }
/// ///
@ -1070,30 +1083,18 @@ class Mop {
return await _channel.invokeMethod("removeAllUsedApplets", params); return await _channel.invokeMethod("removeAllUsedApplets", params);
} }
/// /// clear applets cache
Future<String> sdkVersion() async { ///
return await _channel Future clearApplets() async {
.invokeMapMethod("sdkVersion") return await _channel.invokeMethod("clearApplets");
.then((value) => value?["data"]);
} }
/// -- /// get current using applet
Future scanOpenApplet(String info, {bool isSingleProcess = false}) async { /// 使
Map<String, Object> params = { /// {appId,name,icon,description,version,thumbnail}
'info': info, Future<Map<String, dynamic>> currentApplet() async {
'isSingleProcess': isSingleProcess, final ret = await _channel.invokeMapMethod("currentApplet");
}; return Map<String, dynamic>.from(ret!);
return await _channel.invokeMapMethod("scanOpenApplet", params);
}
///
/// [qrcode]
Future qrcodeOpenApplet(String qrcode, {bool isSingleProcess = false}) async {
Map<String, Object> params = {
'qrcode': qrcode,
'isSingleProcess': isSingleProcess,
};
return await _channel.invokeMapMethod("qrcodeOpenApplet", params);
} }
/// QrCode /// QrCode
@ -1152,49 +1153,11 @@ class Mop {
_channel.invokeMethod("registerExtensionApi", {"name": name}); _channel.invokeMethod("registerExtensionApi", {"name": name});
} }
/// /// register webview extension api
Future<String> getSMSign(String plainText) async { /// webviewapi
var result = void addWebExtentionApi(String name, ExtensionApiHandler handler) {
await _channel.invokeMapMethod("smsign", {'plainText': plainText}); _webExtensionApis[name] = handler;
var data = result?['data']['data']; _channel.invokeMethod("addWebExtentionApi", {"name": name});
debugPrint(data);
return data;
}
/// WKWebView
void webViewBounces(bool bounces) async {
await _channel.invokeMapMethod("webViewBounces", {'bounces': bounces});
return;
}
///
Future<void> closeApplet(String appletId, bool animated) async {
await _channel.invokeMethod(
"closeApplet", {"appletId": appletId, "animated": animated});
return;
}
///
Future<void> finishRunningApplet(String appletId, bool animated) async {
await _channel.invokeMethod(
"finishRunningApplet", {"appletId": appletId, "animated": animated});
return;
}
///
Future setActivityTransitionAnim(Anim anim) async {
await _channel.invokeMethod("setActivityTransitionAnim", {"anim": ""});
return;
}
///
/// [appId] id
/// [eventData]
Future<void> sendCustomEvent(
String appId, Map<String, dynamic> eventData) async {
await _channel.invokeMethod(
"sendCustomEvent", {"appId": appId, "eventData": eventData});
return;
} }
/// webviewjs /// webviewjs
@ -1213,14 +1176,51 @@ class Mop {
return; return;
} }
/// register webview extension api ///
/// webviewapi /// [appId] id
void addWebExtentionApi(String name, ExtensionApiHandler handler) { /// [eventData]
_webExtensionApis[name] = handler; Future<void> sendCustomEvent(
_channel.invokeMethod("addWebExtentionApi", {"name": name}); String appId, Map<String, dynamic> eventData) async {
await _channel.invokeMethod(
"sendCustomEvent", {"appId": appId, "eventData": eventData});
return;
} }
/// Future<Map<String, dynamic>> changeUserId(String userId) async {
Map<String, Object> params = {'userId': userId};
final ret = await _channel.invokeMapMethod("changeUserId", params);
return Map<String, dynamic>.from(ret!);
}
///
Future<String> sdkVersion() async {
return await _channel
.invokeMapMethod("sdkVersion")
.then((value) => value?["data"]);
}
///
Future<String> getSMSign(String plainText) async {
var result =
await _channel.invokeMapMethod("smsign", {'plainText': plainText});
var data = result?['data']['data'];
debugPrint(data);
return data;
}
/// WKWebViewiOS
void webViewBounces(bool bounces) async {
await _channel.invokeMapMethod("webViewBounces", {'bounces': bounces});
return;
}
/// Android
Future setActivityTransitionAnim(Anim anim) async {
await _channel.invokeMethod("setActivityTransitionAnim", {"anim": ""});
return;
}
/// Android
void moveCurrentAppletToFront() async { void moveCurrentAppletToFront() async {
return await _channel.invokeMethod("moveCurrentAppletToFront"); return await _channel.invokeMethod("moveCurrentAppletToFront");
} }