getBootpayJSBeforeContentLoaded method

Future<List<String>> getBootpayJSBeforeContentLoaded()

Implementation

Future<List<String>> getBootpayJSBeforeContentLoaded() async {
  List<String> result = [];

  if (BootpayConfig.IS_FORCE_WEB) {
    result.add("Bootpay.setVersion('" + BootpayConfig.VERSION + "', 'flutter')");
  } else if (Platform.isAndroid) {
    result.add("Bootpay.setDevice('ANDROID');");
    result.add("Bootpay.setVersion('" + BootpayConfig.VERSION + "', 'android_flutter')");
  } else if (Platform.isIOS) {
    result.add("Bootpay.setDevice('IOS');");
    result.add("Bootpay.setVersion('" + BootpayConfig.VERSION + "', 'ios_flutter')");
  }

  if (BootpayConfig.ENV == BootpayConfig.ENV_DEBUG) {
    result.add("Bootpay.setEnvironmentMode('development');");
  } else if (BootpayConfig.ENV == BootpayConfig.ENV_STAGE) {
    result.add("Bootpay.setEnvironmentMode('stage');");
  }
  String locale = widget.payload?.extra?.locale ?? "";
  if(locale.length > 0) {
    result.add("Bootpay.setLocale('$locale');");
  }

  result.add(await getAnalyticsData());

  result.add(widget.closeEventHandler);

  return result;
}