0

我已经购买了,但每个收听的产品和高级页面都打开了 PurchasedStatus.purchased 工作。

void listenToPurchaseUpdated(List<PurchaseDetails> purchaseDetailsList, BuildContext context) {
  purchaseDetailsList.forEach((PurchaseDetails purchaseDetails) async {
    debugPrint('special forEach ${purchaseDetails.productID}');
    switch (purchaseDetails.status) {
      case PurchaseStatus.pending:
        await getCircularCupertinoAlert(context: context);
        break;
      case PurchaseStatus.purchased:
        await inAppSuccessHandler(purchaseDetails: purchaseDetails, context: context); //todo init add
        break;
      case PurchaseStatus.restored:
        await inAppRestoreHandler(purchaseDetails: purchaseDetails, context: context); //todo init add
        break;
      case PurchaseStatus.error:
        await InAppPurchase.instance.completePurchase(purchaseDetails);
        await inAppErrorHandler(purchaseDetails: purchaseDetails, context: context);
        break;
      default:
        break;
    }
    if (purchaseDetails.pendingCompletePurchase) {
      await InAppPurchase.instance.completePurchase(purchaseDetails);
    }
  });
}
4

0 回答 0