callApicheckVersion method

dynamic callApicheckVersion(
  1. BuildContext context
)

Implementation

callApicheckVersion(BuildContext context){
  addLoadingPrensent();
  ApiGameSellon.createDefaultParams((parameter) {
    parameter.set("mobile_version", Config.version_app_number);
    parameter.set("device", Platform.isIOS ? "ios" : "android");
    parameter.set("game_id", Config.idGame);
    parameter.set("type", "major");

    ApiGameSellon api = ApiGameSellon(context);
    api.execute(MethodsSellon.gameCheckVersion, parameter, (response) {
      addLoadingPrensent();
      int iDevice = int.parse(Config.version_app_number.replaceAll(".", ""));
      print("ress ponse ${response.data()}");
      GameVersion? gameVersion = GameVersion.fromJson(response.data()['data']['game']);
      // int app = 0;
      int app = int.parse(gameVersion.versionForMobile!.replaceAll(".", ""));

      if (iDevice < app) {
        Helper().goAppVersionButton(context, onOke: () {
          SellonRouter.pop(context);
          Helper().launcherUpdateApps();
        }, onClose: () {
          SellonRouter.pop(context);
        });
      } else {
        Config.loadingpresent = 100;
        // SellonRouter.makeFirst(context, )
        //goto next;
        // asyncPermission(context);
      }
    });
  });

}