nativeMethodCallHandler method
Implementation
Future<dynamic> nativeMethodCallHandler(MethodCall call) async {
switch (call.method) {
case "DeepLinkCallback":
// Map params, int error, int appAwakePassedTime, String serialNum
LibraryGioModule? advertModule = _modules
?.firstWhere((element) => element is AdvertLibraryGioModule);
if (advertModule != null) {
var args = call.arguments;
var params = args["params"] is Map ? args["params"] : {};
var error = args["error"] is int ? args["error"] : 0;
var appAwakePassedTime = args["appAwakePassedTime"] is num
? args["appAwakePassedTime"].toInt()
: 0;
var serialNum = args["serialNum"];
if (serialNum != null) {
serialNum = serialNum as String;
advertModule = advertModule as AdvertLibraryGioModule;
DeepLinkCallback? callback =
advertModule.doDeepLinkCallbacks[serialNum];
if (callback != null) {
callback.call(params, error, appAwakePassedTime);
advertModule.doDeepLinkCallbacks.remove(serialNum);
return;
}
}
if (advertModule.getConfig() != null) {
AdvertConfig config = (advertModule.getConfig()) as AdvertConfig;
if (config.deepLinkCallback != null) {
config.deepLinkCallback!.call(params, error, appAwakePassedTime);
}
}
}
break;
case "WebCircle":
bool isRunning = call.arguments;
GrowingWebCircleManager.getInstance().toggleWebCircleRunning(isRunning);
break;
case "LifecycleStart":
bool needSendPage = call.arguments;
if (needSendPage) {
GrowingPageProvider.getInstance().sendPageWhenFlutterStart();
}
break;
}
}