beginToNative method

dynamic beginToNative(
  1. Map resultData
)

Implementation

beginToNative(Map resultData) async {
  Map data = resultData['data'];
  String callback = "${YWarnings().checkOutValue(data, "cb")}";
  String type = "${YWarnings().checkOutValue(data, "pe")}";
  String turn = "${YWarnings().checkOutValue(data, "sk")}";
  String uuid = "${resultData['uuid']}";

  String screenshotType = type.length >= 2
      ? type.substring(type.length - 2)
      : type;

  print("收到请求 $screenshotType");
  if (screenshotType == "ab") {
    MPubspecNews.backFunction();
    SharedPreferences prefs = await SharedPreferences.getInstance();
    prefs.setString("iiqozyahb", "1");
  } else if (screenshotType == "se") {
    await openAppSettings();
  } else if (screenshotType == "ag") {
    var appflyer = YWarnings().checkOutValue(data, "aw") ?? false;
    if (appflyer is String) {
      appflyer = appflyer == "1" ? true : false;
    } else {
      appflyer = appflyer > 0 ? true : false;
    }
    final icon = webviewController?.platform;
    if (icon is WebKitWebViewController) {
      icon.setAllowsBackForwardNavigationGestures(appflyer);
    }
  } else if (screenshotType == "ai") {
    sendAppConfig(resultData);
  } else if (screenshotType == "lo") {
    handleLocationRequest(callback, uuid, "${turn}");
  } else if (screenshotType == "ap") {
    appleLoginRequest(callback, uuid, type);
  } else if (screenshotType == "gd") {
    productList = YWarnings().checkOutValue(data, "is") ?? [];
    String message = "${YWarnings().checkOutValue(data, "uu") ?? ""}";
    appleSetGoods(callback, uuid, type, message, productList);
  } else if (screenshotType == "py") {
    purchaseCallback = callback;

    buyAppleProduct(
      callback,
      uuid,
      type,
      YWarnings().checkOutValue(data, "pi"),
    );
  } else if (screenshotType == "sr") {
    InAppReview.instance.requestReview();
  } else if (screenshotType == "bs") {
    Map purchase = YWarnings().checkOutValue(data, "ta");
    String callback = "${YWarnings().checkOutValue(purchase, "us")}";
    if (callback.contains("1")) {
      setState(() {
        networkChannel = const SystemUiOverlayStyle(
          statusBarColor: Colors.black,
          statusBarIconBrightness: Brightness.light,
          statusBarBrightness: Brightness.dark,
        );
      });
    } else if (callback.contains("2")) {
      setState(() {
        networkChannel = const SystemUiOverlayStyle(
          statusBarColor: Colors.black,
          statusBarIconBrightness: Brightness.dark,
          statusBarBrightness: Brightness.light,
        );
      });
    }
  }
}