restorePurchase static method

void restorePurchase({
  1. BuildContext? closePage,
})

Implementation

static void restorePurchase({BuildContext? closePage}) {
  LoadingHelper.show();
  // Wait for 10 seconds using a Timer
  Timer(Duration(seconds: 10), () {
    LoadingHelper.hide();

    if (PurchaseHelper.isPremium) {
      Get.snackbar(
        "Success".tr,
        "Purchases restored successfully.",
        icon: const Icon(Icons.check, color: Colors.green),
        snackPosition: SnackPosition.BOTTOM,
      );

      closePage?.closeActivity();
    } else {
      Get.snackbar(
        "Error".tr,
        "nosubs".tr,
        icon: const Icon(Icons.error, color: Colors.red),
        snackPosition: SnackPosition.BOTTOM,
      );
    }
  });
}