onClickHowToUse method

void onClickHowToUse(
  1. BuildContext context, {
  2. required String ctaUrl,
  3. required String gifUrl,
  4. required String productId,
  5. required bool howItWorksStepsAvailable,
  6. required String brandLogoUrl,
  7. required String tncFilePath,
})

Implementation

void onClickHowToUse(
  BuildContext context, {
  required String ctaUrl,
  required String gifUrl,
  required String productId,
  required bool howItWorksStepsAvailable,
  required String brandLogoUrl,
  required String tncFilePath,
}) {
  if (howItWorksStepsAvailable) {
    if (hubbleConfig().howToUseModalVersion == 2) {
      HowItWorksModalBuilderV2.reveal(
        context,
        productId: productId,
        brandLogoUrl: brandLogoUrl,
        tncFilePath: tncFilePath,
        onTncClick: (
            {required String brandLogoUrl,
            required String tncFilePath}) async {
          deeplinkHandler(
            Screens.productTncScreen.name,
            queryParams: {
              'tncFilePath': tncFilePath,
              'brandLogo': brandLogoUrl
            },
            named: true,
            push: true,
            eventProps: {},
          );
        },
      );
    } else {
      HowItWorksModalBuilder.reveal(
        context,
        productId: productId,
        brandLogoUrl: brandLogoUrl,
        tncFilePath: tncFilePath,
        onTncClick: (
            {required String brandLogoUrl,
            required String tncFilePath}) async {
          deeplinkHandler(
            Screens.productTncScreen.name,
            queryParams: {
              'tncFilePath': tncFilePath,
              'brandLogo': brandLogoUrl
            },
            named: true,
            push: true,
            eventProps: {},
          );
        },
      );
    }
  } else {
    deeplinkHandler(
      Screens.voucherHowToUseScreen.name,
      queryParams: {
        'ctaUrl': ctaUrl,
        'gifUrl': gifUrl,
        'brandLogo': brandLogoUrl,
        'tncFilePath': tncFilePath,
      },
      named: true,
      push: true,
      eventProps: <String, dynamic>{
        'sourceScreen': Screens.productPurchaseSuccessScreen.name,
        'orderId': state.params['orderId']
      },
    );
  }
}