From 8cb5447a5d8596052476e5627c0e37892727ef18 Mon Sep 17 00:00:00 2001 From: Kamo Spertsyan Date: Mon, 11 Dec 2023 12:11:04 +0300 Subject: [PATCH] Search for offer only if it is not empty (#530) * Search for offer only if it is not empty * Comment upd * Comments upd --- .../com/qonversion/android/sdk/dto/QPurchaseModel.kt | 2 +- .../android/sdk/dto/QPurchaseUpdateModel.kt | 2 +- .../android/sdk/dto/products/QProductInAppDetails.kt | 2 +- .../android/sdk/dto/products/QProductStoreDetails.kt | 12 ++++++------ .../android/sdk/dto/products/QSubscriptionPeriod.kt | 2 +- .../sdk/internal/billing/BillingClientWrapper.kt | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/sdk/src/main/java/com/qonversion/android/sdk/dto/QPurchaseModel.kt b/sdk/src/main/java/com/qonversion/android/sdk/dto/QPurchaseModel.kt index 06512388..b337ea34 100644 --- a/sdk/src/main/java/com/qonversion/android/sdk/dto/QPurchaseModel.kt +++ b/sdk/src/main/java/com/qonversion/android/sdk/dto/QPurchaseModel.kt @@ -13,7 +13,7 @@ import com.qonversion.android.sdk.dto.products.QProductStoreDetails * If [offerId] is not specified, then the default offer will be applied. To know how we choose * the default offer, see [QProductStoreDetails.defaultSubscriptionOfferDetails]. * - * To prevent applying any offer to the purchase (use only bare base plan), + * If you want to remove any intro/trial offer from the purchase (use only bare base plan), * call the [removeOffer] method. */ data class QPurchaseModel( diff --git a/sdk/src/main/java/com/qonversion/android/sdk/dto/QPurchaseUpdateModel.kt b/sdk/src/main/java/com/qonversion/android/sdk/dto/QPurchaseUpdateModel.kt index 11af066e..91b92283 100644 --- a/sdk/src/main/java/com/qonversion/android/sdk/dto/QPurchaseUpdateModel.kt +++ b/sdk/src/main/java/com/qonversion/android/sdk/dto/QPurchaseUpdateModel.kt @@ -14,7 +14,7 @@ import com.qonversion.android.sdk.dto.products.QProductStoreDetails * If [offerId] is not specified, then the default offer will be applied. To know how we choose * the default offer, see [QProductStoreDetails.defaultSubscriptionOfferDetails]. * - * To prevent applying any offer to the purchase (use only bare base plan), + * If you want to remove any intro/trial offer from the purchase (use only bare base plan), * call the [QPurchaseModel.removeOffer] method. * * If the [updatePolicy] is not provided, then default one diff --git a/sdk/src/main/java/com/qonversion/android/sdk/dto/products/QProductInAppDetails.kt b/sdk/src/main/java/com/qonversion/android/sdk/dto/products/QProductInAppDetails.kt index a3075e83..11ee88ff 100644 --- a/sdk/src/main/java/com/qonversion/android/sdk/dto/products/QProductInAppDetails.kt +++ b/sdk/src/main/java/com/qonversion/android/sdk/dto/products/QProductInAppDetails.kt @@ -12,7 +12,7 @@ data class QProductInAppDetails( val originalOneTimePurchaseOfferDetails: OneTimePurchaseOfferDetails ) { /** - * The price of an in-app product. + * The price of the in-app product. */ val price: QProductPrice = originalOneTimePurchaseOfferDetails.let { QProductPrice(it.priceAmountMicros, it.priceCurrencyCode, it.formattedPrice) diff --git a/sdk/src/main/java/com/qonversion/android/sdk/dto/products/QProductStoreDetails.kt b/sdk/src/main/java/com/qonversion/android/sdk/dto/products/QProductStoreDetails.kt index e475c093..1ec81f5d 100644 --- a/sdk/src/main/java/com/qonversion/android/sdk/dto/products/QProductStoreDetails.kt +++ b/sdk/src/main/java/com/qonversion/android/sdk/dto/products/QProductStoreDetails.kt @@ -21,28 +21,28 @@ data class QProductStoreDetails( val basePlanId: String?, ) { /** - * Identifier of a subscription or an in-app product. + * Identifier of the subscription or the in-app product. */ val productId: String = originalProductDetails.productId /** - * Name of a subscription or an in-app product. + * Name of the subscription or the in-app product. */ val name: String = originalProductDetails.name /** - * Title of a subscription or an in-app product. + * Title of the subscription or the in-app product. * The title includes the name of the app. */ val title: String = originalProductDetails.title /** - * Description of a subscription or an in-app product. + * Description of the subscription or the in-app product. */ val description: String = originalProductDetails.description /** - * Offer details for a subscription. + * Offer details for the subscription. * Offer details contain all the available variations of purchase offers, * including both base plan and eligible base plan + offer combinations * from Google Play Console for current [basePlanId]. @@ -68,7 +68,7 @@ data class QProductStoreDetails( subscriptionOfferDetails?.firstOrNull { it.pricingPhases.size == 1 } /** - * Offer details for an in-app product. + * Offer details for the in-app product. * Null for subscriptions. */ val inAppOfferDetails: QProductInAppDetails? = diff --git a/sdk/src/main/java/com/qonversion/android/sdk/dto/products/QSubscriptionPeriod.kt b/sdk/src/main/java/com/qonversion/android/sdk/dto/products/QSubscriptionPeriod.kt index bcc5beb1..943e55ec 100644 --- a/sdk/src/main/java/com/qonversion/android/sdk/dto/products/QSubscriptionPeriod.kt +++ b/sdk/src/main/java/com/qonversion/android/sdk/dto/products/QSubscriptionPeriod.kt @@ -15,7 +15,7 @@ data class QSubscriptionPeriod( val unit: Unit, /** - * ISO 8601 representation of the period. + * ISO 8601 representation of the period, e.g. "P7D", meaning 7 days period. */ val iso: String ) { diff --git a/sdk/src/main/java/com/qonversion/android/sdk/internal/billing/BillingClientWrapper.kt b/sdk/src/main/java/com/qonversion/android/sdk/internal/billing/BillingClientWrapper.kt index 1cc617ab..eac370f2 100644 --- a/sdk/src/main/java/com/qonversion/android/sdk/internal/billing/BillingClientWrapper.kt +++ b/sdk/src/main/java/com/qonversion/android/sdk/internal/billing/BillingClientWrapper.kt @@ -82,7 +82,7 @@ internal class BillingClientWrapper( return } } - offerId != null -> { + offerId?.isNotEmpty() == true -> { storeDetails.findOffer(offerId) ?: run { fireError("Failed to find offer $offerId for Qonversion product ${product.qonversionID}") return