diff --git a/config/detekt/detekt.yml b/config/detekt/detekt.yml index 4d49482a..679c2a9d 100644 --- a/config/detekt/detekt.yml +++ b/config/detekt/detekt.yml @@ -51,7 +51,7 @@ output-reports: # - 'SarifOutputReport' comments: - active: false + active: true AbsentOrWrongFileLicense: active: false licenseTemplateFile: 'license.template' diff --git a/core/src/commonMain/kotlin/io/shortway/kobankat/CacheFetchPolicy.kt b/core/src/commonMain/kotlin/io/shortway/kobankat/CacheFetchPolicy.kt index 99d59c42..d7745a33 100644 --- a/core/src/commonMain/kotlin/io/shortway/kobankat/CacheFetchPolicy.kt +++ b/core/src/commonMain/kotlin/io/shortway/kobankat/CacheFetchPolicy.kt @@ -30,6 +30,9 @@ public expect enum class CacheFetchPolicy { ; public companion object { + /** + * Returns the default policy when no policy is provided. + */ public fun default(): CacheFetchPolicy } } \ No newline at end of file diff --git a/core/src/commonMain/kotlin/io/shortway/kobankat/DangerousSettings.kt b/core/src/commonMain/kotlin/io/shortway/kobankat/DangerousSettings.kt index f4036a01..b54be06e 100644 --- a/core/src/commonMain/kotlin/io/shortway/kobankat/DangerousSettings.kt +++ b/core/src/commonMain/kotlin/io/shortway/kobankat/DangerousSettings.kt @@ -1,5 +1,14 @@ package io.shortway.kobankat +/** + * Only use a Dangerous Setting if suggested by RevenueCat support team. + */ public data class DangerousSettings( + /** + * Disable or enable syncing purchases automatically. If this is disabled, RevenueCat will not + * sync any purchase automatically, and you will have to call [syncPurchases] whenever a new + * purchase is completed in order to send it to the RevenueCat's backend. Auto syncing of + * purchases is enabled by default. + */ public val autoSyncPurchases: Boolean, ) \ No newline at end of file diff --git a/core/src/commonMain/kotlin/io/shortway/kobankat/EntitlementInfo.kt b/core/src/commonMain/kotlin/io/shortway/kobankat/EntitlementInfo.kt index 21886872..ccf097c7 100644 --- a/core/src/commonMain/kotlin/io/shortway/kobankat/EntitlementInfo.kt +++ b/core/src/commonMain/kotlin/io/shortway/kobankat/EntitlementInfo.kt @@ -1,27 +1,92 @@ package io.shortway.kobankat +/** + * This object gives you access to all of the information about the status of a user's entitlements. + */ public expect class EntitlementInfo +/** + * The entitlement identifier configured in the RevenueCat dashboard. + */ public expect val EntitlementInfo.identifier: String + +/** + * True if the user has access to this entitlement. + */ public expect val EntitlementInfo.isActive: Boolean + +/** + * True if the underlying subscription is set to renew at the end of the billing period + * (expirationDate). Will always be True if entitlement is for lifetime access. + */ public expect val EntitlementInfo.willRenew: Boolean + +/** + * The last period type this entitlement was in. + */ public expect val EntitlementInfo.periodType: PeriodType + /** - * Nullable on iOS only not on Android. + * Nullable on iOS only not on Android. The latest purchase or renewal date for the entitlement, + * in millis since the Unix epoch. */ public expect val EntitlementInfo.latestPurchaseDateMillis: Long? + /** - * Nullable on iOS only not on Android. + * Nullable on iOS only not on Android. The first date this entitlement was purchased in millis + * since the Unix epoch. */ public expect val EntitlementInfo.originalPurchaseDateMillis: Long? + +/** + * The expiration date for the entitlement, can be `null` for lifetime access. If the [periodType] + * is [PeriodType.TRIAL], this is the trial expiration date. + */ public expect val EntitlementInfo.expirationDateMillis: Long? + +/** + * The store where this entitlement was unlocked from. + */ public expect val EntitlementInfo.store: Store + +/** + * The product identifier that unlocked this entitlement. + * * For Google subscriptions, this is the subscription ID. + * * For Amazon subscriptions, this is the `termSku`. + * * For INAPP purchases, this is simply the `productId`. + */ public expect val EntitlementInfo.productIdentifier: String + +/** + * Play Store only. The base plan identifier that unlocked this entitlement. + */ public expect val EntitlementInfo.productPlanIdentifier: String? + +/** + * False if this entitlement is unlocked via a production purchase. + */ public expect val EntitlementInfo.isSandbox: Boolean + +/** + * The date an unsubscribe was detected. Can be `null`. + * + * Note: Entitlement may still be active even if user has unsubscribed. Check the [isActive] + * property. + */ public expect val EntitlementInfo.unsubscribeDetectedAtMillis: Long? + +/** + * The date a billing issue was detected in millis since the Unix epoch. Can be `null` if there is + * no billing issue or an issue has been resolved. Note: Entitlement may still be active even if + * there is a billing issue. Check the `isActive` property. + */ public expect val EntitlementInfo.billingIssueDetectedAtMillis: Long? public expect val EntitlementInfo.ownershipType: OwnershipType + +/** + * If entitlement verification was enabled, the result of that verification. If not, + * [VerificationResult.NOT_REQUESTED]. + */ public expect val EntitlementInfo.verification: VerificationResult /** diff --git a/core/src/commonMain/kotlin/io/shortway/kobankat/EntitlementInfos.kt b/core/src/commonMain/kotlin/io/shortway/kobankat/EntitlementInfos.kt index b5cf9515..fc2ff6b9 100644 --- a/core/src/commonMain/kotlin/io/shortway/kobankat/EntitlementInfos.kt +++ b/core/src/commonMain/kotlin/io/shortway/kobankat/EntitlementInfos.kt @@ -1,8 +1,20 @@ package io.shortway.kobankat +/** + * This class contains all the entitlements associated to the user. + */ public expect class EntitlementInfos +/** + * Map of all EntitlementInfo [EntitlementInfo] objects (active and inactive) keyed by entitlement + * identifier. + */ public expect val EntitlementInfos.all: Map + +/** + * If entitlement verification was enabled, the result of that verification. If not, + * [VerificationResult.NOT_REQUESTED]. + */ public expect val EntitlementInfos.verification: VerificationResult /** diff --git a/core/src/commonMain/kotlin/io/shortway/kobankat/EntitlementVerificationMode.kt b/core/src/commonMain/kotlin/io/shortway/kobankat/EntitlementVerificationMode.kt index 3032c1a1..dad8f927 100644 --- a/core/src/commonMain/kotlin/io/shortway/kobankat/EntitlementVerificationMode.kt +++ b/core/src/commonMain/kotlin/io/shortway/kobankat/EntitlementVerificationMode.kt @@ -1,6 +1,16 @@ package io.shortway.kobankat +/** + * Verification strictness levels for [EntitlementInfo]. + */ public enum class EntitlementVerificationMode { + /** + * The SDK will not perform any entitlement verification. + */ DISABLED, + + /** + * Enable entitlement verification. + */ INFORMATIONAL, } \ No newline at end of file diff --git a/core/src/commonMain/kotlin/io/shortway/kobankat/LogHandler.kt b/core/src/commonMain/kotlin/io/shortway/kobankat/LogHandler.kt index e5996348..fd460b55 100644 --- a/core/src/commonMain/kotlin/io/shortway/kobankat/LogHandler.kt +++ b/core/src/commonMain/kotlin/io/shortway/kobankat/LogHandler.kt @@ -6,9 +6,28 @@ package io.shortway.kobankat * @see PurchasesFactory.logHandler */ public expect interface LogHandler { + /** + * Log a message at the [LogLevel.VERBOSE] level. + */ public fun v(tag: String, msg: String) + + /** + * Log a message at the [LogLevel.DEBUG] level. + */ public fun d(tag: String, msg: String) + + /** + * Log a message at the [LogLevel.INFO] level. + */ public fun i(tag: String, msg: String) + + /** + * Log a message at the [LogLevel.WARN] level. + */ public fun w(tag: String, msg: String) + + /** + * Log a message at the [LogLevel.ERROR] level. + */ public fun e(tag: String, msg: String, throwable: Throwable?) } \ No newline at end of file diff --git a/core/src/commonMain/kotlin/io/shortway/kobankat/LogLevel.kt b/core/src/commonMain/kotlin/io/shortway/kobankat/LogLevel.kt index 306899d3..f78c753c 100644 --- a/core/src/commonMain/kotlin/io/shortway/kobankat/LogLevel.kt +++ b/core/src/commonMain/kotlin/io/shortway/kobankat/LogLevel.kt @@ -1,5 +1,8 @@ package io.shortway.kobankat +/** + * The level to log at. + */ public expect enum class LogLevel { VERBOSE, DEBUG, diff --git a/core/src/commonMain/kotlin/io/shortway/kobankat/ProductType.kt b/core/src/commonMain/kotlin/io/shortway/kobankat/ProductType.kt index 2035dd0a..368897c0 100644 --- a/core/src/commonMain/kotlin/io/shortway/kobankat/ProductType.kt +++ b/core/src/commonMain/kotlin/io/shortway/kobankat/ProductType.kt @@ -1,7 +1,21 @@ package io.shortway.kobankat +/** + * Possible product types. + */ public expect enum class ProductType { + /** + * A subscription product. + */ SUBS, + + /** + * An in-app purchase product. + */ INAPP, + + /** + * The product type could not be determined. + */ UNKNOWN, } \ No newline at end of file diff --git a/core/src/commonMain/kotlin/io/shortway/kobankat/PurchasesConfiguration.kt b/core/src/commonMain/kotlin/io/shortway/kobankat/PurchasesConfiguration.kt index bc0c14d7..ecdf0337 100644 --- a/core/src/commonMain/kotlin/io/shortway/kobankat/PurchasesConfiguration.kt +++ b/core/src/commonMain/kotlin/io/shortway/kobankat/PurchasesConfiguration.kt @@ -1,5 +1,8 @@ package io.shortway.kobankat +/** + * Configuration of the SDK. + */ public data class PurchasesConfiguration( internal val apiKey: String, internal val appUserId: String, diff --git a/core/src/commonMain/kotlin/io/shortway/kobankat/PurchasesDelegate.kt b/core/src/commonMain/kotlin/io/shortway/kobankat/PurchasesDelegate.kt index 4e90e32b..821da41c 100644 --- a/core/src/commonMain/kotlin/io/shortway/kobankat/PurchasesDelegate.kt +++ b/core/src/commonMain/kotlin/io/shortway/kobankat/PurchasesDelegate.kt @@ -3,6 +3,10 @@ package io.shortway.kobankat import io.shortway.kobankat.models.StoreProduct import io.shortway.kobankat.models.StoreTransaction +/** + * A listener interface responsible for handling promotional product purchases (App Store only) and + * changes to customer information. + */ public interface PurchasesDelegate { /** diff --git a/core/src/commonMain/kotlin/io/shortway/kobankat/PurchasesException.kt b/core/src/commonMain/kotlin/io/shortway/kobankat/PurchasesException.kt index e2fb2d68..2b7ca4c1 100644 --- a/core/src/commonMain/kotlin/io/shortway/kobankat/PurchasesException.kt +++ b/core/src/commonMain/kotlin/io/shortway/kobankat/PurchasesException.kt @@ -1,5 +1,8 @@ package io.shortway.kobankat +/** + * An exception wrapping a [PurchasesError]. + */ public open class PurchasesException(public val error: PurchasesError) : Exception() { public val code: PurchasesErrorCode diff --git a/core/src/commonMain/kotlin/io/shortway/kobankat/PurchasesFactory.kt b/core/src/commonMain/kotlin/io/shortway/kobankat/PurchasesFactory.kt index ad07c09b..e02b70d1 100644 --- a/core/src/commonMain/kotlin/io/shortway/kobankat/PurchasesFactory.kt +++ b/core/src/commonMain/kotlin/io/shortway/kobankat/PurchasesFactory.kt @@ -1,10 +1,22 @@ package io.shortway.kobankat +import io.shortway.kobankat.PurchasesFactory.sharedInstance import io.shortway.kobankat.models.BillingFeature import kotlin.jvm.JvmOverloads import kotlin.jvm.JvmStatic +/** + * Factory of [Purchases]. Call `configure()` in each respective platform source set before + * accessing the singleton Purchases instance using [sharedInstance]. + */ public expect object PurchasesFactory { + + /** + * Singleton instance of Purchases. `configure()` will set this. Will throw an exception if the + * shared instance has not been configured. + * + * @return A previously set singleton Purchases instance. + */ public val sharedInstance: Purchases /** diff --git a/core/src/commonMain/kotlin/io/shortway/kobankat/PurchasesTransactionException.kt b/core/src/commonMain/kotlin/io/shortway/kobankat/PurchasesTransactionException.kt index eb066c42..e4880f20 100644 --- a/core/src/commonMain/kotlin/io/shortway/kobankat/PurchasesTransactionException.kt +++ b/core/src/commonMain/kotlin/io/shortway/kobankat/PurchasesTransactionException.kt @@ -1,6 +1,13 @@ package io.shortway.kobankat +/** + * An exception indicating an error occurred during a transaction. Extends [PurchasesException] by + * adding a [userCancelled] property. + */ public class PurchasesTransactionException( purchasesError: PurchasesError, + /** + * Whether the user cancelled the transaction. + */ public val userCancelled: Boolean, ) : PurchasesException(purchasesError) \ No newline at end of file diff --git a/core/src/commonMain/kotlin/io/shortway/kobankat/errors.kt b/core/src/commonMain/kotlin/io/shortway/kobankat/errors.kt index f0a24130..8985b5e9 100644 --- a/core/src/commonMain/kotlin/io/shortway/kobankat/errors.kt +++ b/core/src/commonMain/kotlin/io/shortway/kobankat/errors.kt @@ -18,6 +18,9 @@ public class PurchasesError( } } +/** + * A predefined error type. + */ public enum class PurchasesErrorCode(public val code: Int, public val description: String) { UnknownError(0, "Unknown error."), PurchaseCancelledError(1, "Purchase was cancelled."), diff --git a/core/src/commonMain/kotlin/io/shortway/kobankat/i18n/Locale.kt b/core/src/commonMain/kotlin/io/shortway/kobankat/i18n/Locale.kt index 80ec7262..91d478c8 100644 --- a/core/src/commonMain/kotlin/io/shortway/kobankat/i18n/Locale.kt +++ b/core/src/commonMain/kotlin/io/shortway/kobankat/i18n/Locale.kt @@ -1,11 +1,24 @@ package io.shortway.kobankat.i18n -@Suppress("DataClassPrivateConstructor") -public data class Locale private constructor(val languageCode: String, val countryCode: String) { +/** + * Minimal representation of a locale. + */ +public class Locale private constructor( + public val languageCode: String, + public val countryCode: String +) { public companion object { public val Default: Locale = defaultLocale() + /** + * Creates a new Locale instance. + * + * @param languageCode A 2-letter [ISO 639](https://en.wikipedia.org/wiki/ISO_639) language + * code. + * @param countryCode A 0, 2 or 3-letter + * [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) country code. + */ public fun create(languageCode: String, countryCode: String): Locale = Locale( languageCode = languageCode.lowercase(), diff --git a/core/src/commonMain/kotlin/io/shortway/kobankat/models/GoogleReplacementMode.kt b/core/src/commonMain/kotlin/io/shortway/kobankat/models/GoogleReplacementMode.kt index 20eb6e96..bb0e01f3 100644 --- a/core/src/commonMain/kotlin/io/shortway/kobankat/models/GoogleReplacementMode.kt +++ b/core/src/commonMain/kotlin/io/shortway/kobankat/models/GoogleReplacementMode.kt @@ -2,6 +2,14 @@ package io.shortway.kobankat.models import io.shortway.kobankat.ReplacementMode +/** + * Enum of possible replacement modes to be passed to a Play Store purchase. + * Ignored for Amazon and App Store purchases. + * + * See + * [developer.android.com](https://developer.android.com/google/play/billing/subscriptions#proration) + * for examples. + */ public expect enum class GoogleReplacementMode: ReplacementMode { /** * Old subscription is cancelled, and new subscription takes effect immediately. diff --git a/core/src/commonMain/kotlin/io/shortway/kobankat/models/Period.kt b/core/src/commonMain/kotlin/io/shortway/kobankat/models/Period.kt index f6d9ab3a..4933fc31 100644 --- a/core/src/commonMain/kotlin/io/shortway/kobankat/models/Period.kt +++ b/core/src/commonMain/kotlin/io/shortway/kobankat/models/Period.kt @@ -6,7 +6,14 @@ private const val DAYS_PER_YEAR = 365.0 private const val MONTHS_PER_YEAR = 12.0 private const val WEEKS_PER_MONTH = DAYS_PER_YEAR / MONTHS_PER_YEAR / DAYS_PER_WEEK +/** + * Represents subscription or [PricingPhase] billing period. + */ public expect class Period + +/** + * The unit of time a [Period] is denoted in. + */ public expect enum class PeriodUnit { DAY, WEEK, diff --git a/core/src/commonMain/kotlin/io/shortway/kobankat/models/Price.kt b/core/src/commonMain/kotlin/io/shortway/kobankat/models/Price.kt index 4c99815a..93e28620 100644 --- a/core/src/commonMain/kotlin/io/shortway/kobankat/models/Price.kt +++ b/core/src/commonMain/kotlin/io/shortway/kobankat/models/Price.kt @@ -1,5 +1,8 @@ package io.shortway.kobankat.models +/** + * Represents a monetary price. + */ public expect class Price { /** * Formatted price of the item, including its currency sign. For example $3.00. diff --git a/core/src/commonMain/kotlin/io/shortway/kobankat/models/PurchaseState.kt b/core/src/commonMain/kotlin/io/shortway/kobankat/models/PurchaseState.kt deleted file mode 100644 index 858493d0..00000000 --- a/core/src/commonMain/kotlin/io/shortway/kobankat/models/PurchaseState.kt +++ /dev/null @@ -1,7 +0,0 @@ -package io.shortway.kobankat.models - -public enum class PurchaseState { - UNSPECIFIED_STATE, - PURCHASED, - PENDING, -} \ No newline at end of file diff --git a/core/src/commonMain/kotlin/io/shortway/kobankat/models/PurchasingData.kt b/core/src/commonMain/kotlin/io/shortway/kobankat/models/PurchasingData.kt index e561f2f0..ad456a75 100644 --- a/core/src/commonMain/kotlin/io/shortway/kobankat/models/PurchasingData.kt +++ b/core/src/commonMain/kotlin/io/shortway/kobankat/models/PurchasingData.kt @@ -2,6 +2,9 @@ package io.shortway.kobankat.models import io.shortway.kobankat.ProductType +/** + * Data connected to a purchase. + */ public expect interface PurchasingData { public val productId: String public val productType: ProductType diff --git a/core/src/commonMain/kotlin/io/shortway/kobankat/models/RecurrenceMode.kt b/core/src/commonMain/kotlin/io/shortway/kobankat/models/RecurrenceMode.kt index 8bf84075..4feca43f 100644 --- a/core/src/commonMain/kotlin/io/shortway/kobankat/models/RecurrenceMode.kt +++ b/core/src/commonMain/kotlin/io/shortway/kobankat/models/RecurrenceMode.kt @@ -29,7 +29,4 @@ public val RecurrenceMode.identifier: Int? RecurrenceMode.NON_RECURRING -> 3 RecurrenceMode.UNKNOWN -> null else -> error("Unknown RecurrenceMode: $this") - } - -public fun Int?.toRecurrenceMode(): RecurrenceMode = - RecurrenceMode.entries.firstOrNull { it.identifier == this } ?: RecurrenceMode.UNKNOWN \ No newline at end of file + } \ No newline at end of file diff --git a/core/src/commonMain/kotlin/io/shortway/kobankat/models/StoreProduct.kt b/core/src/commonMain/kotlin/io/shortway/kobankat/models/StoreProduct.kt index 5472ef81..6ece473f 100644 --- a/core/src/commonMain/kotlin/io/shortway/kobankat/models/StoreProduct.kt +++ b/core/src/commonMain/kotlin/io/shortway/kobankat/models/StoreProduct.kt @@ -3,6 +3,9 @@ package io.shortway.kobankat.models import io.shortway.kobankat.ProductType import io.shortway.kobankat.i18n.Locale +/** + * Represents an in-app product's or subscription's listing details. + */ public expect class StoreProduct /** diff --git a/core/src/commonMain/kotlin/io/shortway/kobankat/models/StoreTransaction.kt b/core/src/commonMain/kotlin/io/shortway/kobankat/models/StoreTransaction.kt index 0c459cdf..91887e27 100644 --- a/core/src/commonMain/kotlin/io/shortway/kobankat/models/StoreTransaction.kt +++ b/core/src/commonMain/kotlin/io/shortway/kobankat/models/StoreTransaction.kt @@ -1,5 +1,8 @@ package io.shortway.kobankat.models +/** + * Represents an in-app billing purchase. + */ public expect class StoreTransaction /** @@ -20,11 +23,4 @@ public expect val StoreTransaction.productIds: List /** * Time the product was purchased, in milliseconds since the epoch. */ -public expect val StoreTransaction.purchaseTime: Long - -public enum class PurchaseType { - GOOGLE_PURCHASE, - GOOGLE_RESTORED_PURCHASE, - AMAZON_PURCHASE, - APP_STORE_PURCHASE, -} \ No newline at end of file +public expect val StoreTransaction.purchaseTime: Long \ No newline at end of file diff --git a/core/src/commonMain/kotlin/io/shortway/kobankat/models/SubscriptionOptions.kt b/core/src/commonMain/kotlin/io/shortway/kobankat/models/SubscriptionOptions.kt index d0ebd248..8682735c 100644 --- a/core/src/commonMain/kotlin/io/shortway/kobankat/models/SubscriptionOptions.kt +++ b/core/src/commonMain/kotlin/io/shortway/kobankat/models/SubscriptionOptions.kt @@ -1,5 +1,8 @@ package io.shortway.kobankat.models +/** + * A collection of [SubscriptionOption]s. + */ public expect class SubscriptionOptions { /** diff --git a/core/src/commonMain/kotlin/io/shortway/kobankat/models/Transaction.kt b/core/src/commonMain/kotlin/io/shortway/kobankat/models/Transaction.kt index efa2748c..a8b5abb9 100644 --- a/core/src/commonMain/kotlin/io/shortway/kobankat/models/Transaction.kt +++ b/core/src/commonMain/kotlin/io/shortway/kobankat/models/Transaction.kt @@ -1,7 +1,21 @@ package io.shortway.kobankat.models +/** + * Representation of a transaction. + */ public expect class Transaction +/** + * Identifier of this transaction. + */ public expect val Transaction.transactionIdentifier: String + +/** + * The identifier of the purchased product. + */ public expect val Transaction.productIdentifier: String + +/** + * The purchase date in millis since the Unix epoch. + */ public expect val Transaction.purchaseDateMillis: Long \ No newline at end of file diff --git a/core/src/commonMain/kotlin/io/shortway/kobankat/paywalls/PaywallData.kt b/core/src/commonMain/kotlin/io/shortway/kobankat/paywalls/PaywallData.kt deleted file mode 100644 index a2dc6228..00000000 --- a/core/src/commonMain/kotlin/io/shortway/kobankat/paywalls/PaywallData.kt +++ /dev/null @@ -1,296 +0,0 @@ -package io.shortway.kobankat.paywalls - -import io.shortway.kobankat.i18n.Locale - -/** - * Represents the data required to display a paywall using the `RevenueCatUI` library. - * This data can be created and configured in the dashboard and then accessed from the `Offering/paywall`. - * - * @see [Paywalls Documentation](https://rev.cat/paywalls) - */ - -public interface PaywallData { - - /** - * The type of template used to display this paywall. - */ - public val templateName: String - - /** - * Generic configuration for any paywall. - */ - public val config: Configuration - - /** - * The base remote URL where assets for this paywall are stored. - */ - public val assetBaseURL: String - - /** - * The revision identifier for this paywall. - */ - public val revision: Int - get() = 0 - public val localization: Map - - /** - * Returns the [Locale] and [LocalizedConfiguration] to be used based on the current locale list - * and the available locales for this paywall. - */ - public val localizedConfiguration: Pair - - - - public fun configForLocale(requiredLocale: Locale): LocalizedConfiguration? - - /** - * Generic configuration for any paywall. - */ - public interface Configuration { - /** - * The list of package identifiers this paywall will display. - */ - public val packageIds: List - - /** - * The package to be selected by default. - */ - public val defaultPackage: String? - get() = null - - - public val imagesWebp: Images? - get() = null - - - public val legacyImages: Images? - get() = null - - /** - * Whether the background image will be blurred (in templates with one). - */ - public val blurredBackgroundImage: Boolean - get() = false - - /** - * Whether a restore purchases button should be displayed. - */ - public val displayRestorePurchases: Boolean - get() = true - - /** - * If set, the paywall will display a terms of service link. - */ - public val termsOfServiceURL: String? - get() = null - - /** - * If set, the paywall will display a privacy policy link. - */ - public val privacyURL: String? - get() = null - - /** - * The set of colors used. - */ - public val colors: ColorInformation - - /** - * The images for this template. - */ - public val images: Images - get() { - return Images( - header = imagesWebp?.header ?: legacyImages?.header, - background = imagesWebp?.background ?: legacyImages?.background, - icon = imagesWebp?.icon ?: legacyImages?.icon, - ) - } - - public data class Images( - /** - * Image displayed as a header in a template. - */ - - val header: String? = null, - - /** - * Image displayed as a background in a template. - */ - - val background: String? = null, - - /** - * Image displayed as an app icon in a template. - */ - - val icon: String? = null, - ) { - internal val all: List - get() = listOfNotNull(header, background, icon) - } - - - public data class ColorInformation( - /** - * Set of colors for light mode. - */ - val light: Colors, - - /** - * Set of colors for dark mode. - */ - val dark: Colors? = null, - ) - - - public data class Colors( - /** - * Hex color for the background of the paywall. - */ - val background: String, - - /** - * Hex color for the primary text element. - */ - val text1: String, - - /** - * Hex color for secondary text element. - */ - val text2: String? = null, - - /** - * Hex color for tertiary text element. - */ - val text3: String? = null, - - /** - * Background hex color of the main call to action button. - */ - val callToActionBackground: String, - - /** - * Foreground hex color of the main call to action button. - */ - val callToActionForeground: String, - - /** - * If present, the CTA will create a vertical gradient from [callToActionBackground] to this hex color. - */ - val callToActionSecondaryBackground: String? = null, - - /** - * Primary accent hex color. - */ - val accent1: String? = null, - - /** - * Secondary accent hex color. - */ - val accent2: String? = null, - - /** - * Tertiary accent hex color. - */ - val accent3: String? = null, - ) - } - - /** - * Defines the necessary localized information for a paywall. - */ - public data class LocalizedConfiguration( - /** - * The title of the paywall screen. - */ - val title: String, - - /** - * The subtitle of the paywall screen. - */ - - val subtitle: String? = null, - - /** - * The content of the main action button for purchasing a subscription. - */ - - val callToAction: String, - - /** - * The content of the main action button for purchasing a subscription when an intro offer is available. - * If `null`, no information regarding trial eligibility will be displayed. - */ - - - val callToActionWithIntroOffer: String? = null, - - /** - * The content of the main action button for purchasing a subscription when multiple intro offer are available. - * This may happen in Google Play, if you have an offer with both a free trial and a discounted price. - * If `null`, no information regarding trial eligibility will be displayed. - */ - - - val callToActionWithMultipleIntroOffers: String? = null, - - /** - * Description for the offer to be purchased. - */ - - - val offerDetails: String? = null, - - /** - * Description for the offer to be purchased when an intro offer is available. - * If `null`, no information regarding trial eligibility will be displayed. - */ - - - val offerDetailsWithIntroOffer: String? = null, - - /** - * Description for the offer to be purchased when multiple intro offers are available. - * This may happen in Google Play, if you have an offer with both a free trial and a discounted price. - * If `null`, no information regarding trial eligibility will be displayed. - */ - - - val offerDetailsWithMultipleIntroOffers: String? = null, - - /** - * The name representing each of the packages, most commonly a variable. - */ - - - val offerName: String? = null, - - /** - * An optional list of features that describe this paywall. - */ - val features: List = emptyList(), - ) { - /** - * An item to be showcased in a paywall. - */ - - public data class Feature( - /** - * The title of the feature. - */ - val title: String, - - /** - * An optional description of the feature. - */ - val content: String? = null, - - /** - * An optional icon for the feature. - * This must be an icon identifier known by `RevenueCatUI`. - */ - val iconID: String? = null, - ) - } -} \ No newline at end of file