diff --git a/apiTester/src/androidMain/kotlin/com/revenuecat/purchases/kmp/apitester/CacheFetchPolicyAPI.kt b/apiTester/src/commonMain/kotlin/com/revenuecat/purchases/kmp/apitester/CacheFetchPolicyAPI.kt similarity index 100% rename from apiTester/src/androidMain/kotlin/com/revenuecat/purchases/kmp/apitester/CacheFetchPolicyAPI.kt rename to apiTester/src/commonMain/kotlin/com/revenuecat/purchases/kmp/apitester/CacheFetchPolicyAPI.kt diff --git a/apiTester/src/commonMain/kotlin/com/revenuecat/purchases/kmp/apitester/DiscountPaymentModeAPI.kt b/apiTester/src/commonMain/kotlin/com/revenuecat/purchases/kmp/apitester/DiscountPaymentModeAPI.kt new file mode 100644 index 00000000..df92e2b2 --- /dev/null +++ b/apiTester/src/commonMain/kotlin/com/revenuecat/purchases/kmp/apitester/DiscountPaymentModeAPI.kt @@ -0,0 +1,17 @@ +package com.revenuecat.purchases.kmp.apitester + +import com.revenuecat.purchases.kmp.models.DiscountPaymentMode + +@Suppress("unused") +private class DiscountPaymentModeAPI { + + fun check(mode: DiscountPaymentMode) { + when (mode) { + DiscountPaymentMode.FREE_TRIAL, + DiscountPaymentMode.PAY_AS_YOU_GO, + DiscountPaymentMode.PAY_UP_FRONT, + -> { + } + }.exhaustive + } +} diff --git a/apiTester/src/commonMain/kotlin/com/revenuecat/purchases/kmp/apitester/DiscountTypeAPI.kt b/apiTester/src/commonMain/kotlin/com/revenuecat/purchases/kmp/apitester/DiscountTypeAPI.kt new file mode 100644 index 00000000..bd1721f0 --- /dev/null +++ b/apiTester/src/commonMain/kotlin/com/revenuecat/purchases/kmp/apitester/DiscountTypeAPI.kt @@ -0,0 +1,16 @@ +package com.revenuecat.purchases.kmp.apitester + +import com.revenuecat.purchases.kmp.models.DiscountType + +@Suppress("unused") +private class DiscountTypeAPI { + + fun check(type: DiscountType) { + when (type) { + DiscountType.INTRODUCTORY, + DiscountType.PROMOTIONAL, + -> { + } + }.exhaustive + } +} diff --git a/apiTester/src/commonMain/kotlin/com/revenuecat/purchases/kmp/apitester/EntitlementInfoAPI.kt b/apiTester/src/commonMain/kotlin/com/revenuecat/purchases/kmp/apitester/EntitlementInfoAPI.kt index 1b32b12a..556f91e4 100644 --- a/apiTester/src/commonMain/kotlin/com/revenuecat/purchases/kmp/apitester/EntitlementInfoAPI.kt +++ b/apiTester/src/commonMain/kotlin/com/revenuecat/purchases/kmp/apitester/EntitlementInfoAPI.kt @@ -1,9 +1,6 @@ package com.revenuecat.purchases.kmp.apitester import com.revenuecat.purchases.kmp.EntitlementInfo -import com.revenuecat.purchases.kmp.OwnershipType -import com.revenuecat.purchases.kmp.PeriodType -import com.revenuecat.purchases.kmp.Store import com.revenuecat.purchases.kmp.VerificationResult import com.revenuecat.purchases.kmp.billingIssueDetectedAtMillis import com.revenuecat.purchases.kmp.datetime.billingIssueDetectedAtInstant @@ -17,11 +14,8 @@ import com.revenuecat.purchases.kmp.isActive import com.revenuecat.purchases.kmp.isSandbox import com.revenuecat.purchases.kmp.latestPurchaseDateMillis import com.revenuecat.purchases.kmp.originalPurchaseDateMillis -import com.revenuecat.purchases.kmp.ownershipType -import com.revenuecat.purchases.kmp.periodType import com.revenuecat.purchases.kmp.productIdentifier import com.revenuecat.purchases.kmp.productPlanIdentifier -import com.revenuecat.purchases.kmp.store import com.revenuecat.purchases.kmp.unsubscribeDetectedAtMillis import com.revenuecat.purchases.kmp.verification import com.revenuecat.purchases.kmp.willRenew @@ -34,14 +28,16 @@ private class EntitlementInfoAPI { val identifier: String = identifier val active: Boolean = isActive val willRenew: Boolean = willRenew - val periodType: PeriodType = periodType + // FIXME re-enable in SDK-3530 + // val periodType: PeriodType = periodType val latestPurchaseDate: Long? = latestPurchaseDateMillis val latestPurchaseInstant: Instant? = latestPurchaseInstant val originalPurchaseDate: Long? = originalPurchaseDateMillis val originalPurchaseInstant: Instant? = originalPurchaseInstant val expirationDate: Long? = expirationDateMillis val expirationInstant: Instant? = expirationInstant - val store: Store = store + // FIXME re-enable in SDK-3530 + // val store: Store = store val productIdentifier: String = productIdentifier val productPlanIdentifier: String? = productPlanIdentifier val sandbox: Boolean = isSandbox @@ -49,7 +45,8 @@ private class EntitlementInfoAPI { val unsubscribeDetectedAtInstant: Instant? = unsubscribeDetectedAtInstant val billingIssueDetectedAt: Long? = billingIssueDetectedAtMillis val billingIssueDetectedAtInstant: Instant? = billingIssueDetectedAtInstant - val ownershipType: OwnershipType = ownershipType + // FIXME re-enable in SDK-3530 + // val ownershipType: OwnershipType = ownershipType val verification: VerificationResult = verification } } diff --git a/apiTester/src/commonMain/kotlin/com/revenuecat/purchases/kmp/apitester/LogLevelAPI.kt b/apiTester/src/commonMain/kotlin/com/revenuecat/purchases/kmp/apitester/LogLevelAPI.kt new file mode 100644 index 00000000..84e1ff0b --- /dev/null +++ b/apiTester/src/commonMain/kotlin/com/revenuecat/purchases/kmp/apitester/LogLevelAPI.kt @@ -0,0 +1,18 @@ +package com.revenuecat.purchases.kmp.apitester + +import com.revenuecat.purchases.kmp.LogLevel + +@Suppress("unused") +private class LogLevelAPI { + fun check(logLevel: LogLevel) { + when (logLevel) { + LogLevel.VERBOSE, + LogLevel.DEBUG, + LogLevel.INFO, + LogLevel.WARN, + LogLevel.ERROR, + -> { + } + }.exhaustive + } +} diff --git a/apiTester/src/androidMain/kotlin/com/revenuecat/purchases/kmp/apitester/OwnershipTypeAPI.kt b/apiTester/src/commonMain/kotlin/com/revenuecat/purchases/kmp/apitester/OwnershipTypeAPI.kt similarity index 100% rename from apiTester/src/androidMain/kotlin/com/revenuecat/purchases/kmp/apitester/OwnershipTypeAPI.kt rename to apiTester/src/commonMain/kotlin/com/revenuecat/purchases/kmp/apitester/OwnershipTypeAPI.kt diff --git a/apiTester/src/androidMain/kotlin/com/revenuecat/purchases/kmp/apitester/PeriodTypeAPI.kt b/apiTester/src/commonMain/kotlin/com/revenuecat/purchases/kmp/apitester/PeriodTypeAPI.kt similarity index 100% rename from apiTester/src/androidMain/kotlin/com/revenuecat/purchases/kmp/apitester/PeriodTypeAPI.kt rename to apiTester/src/commonMain/kotlin/com/revenuecat/purchases/kmp/apitester/PeriodTypeAPI.kt diff --git a/apiTester/src/androidMain/kotlin/com/revenuecat/purchases/kmp/apitester/PurchasesAreCompletedByAPI.kt b/apiTester/src/commonMain/kotlin/com/revenuecat/purchases/kmp/apitester/PurchasesAreCompletedByAPI.kt similarity index 100% rename from apiTester/src/androidMain/kotlin/com/revenuecat/purchases/kmp/apitester/PurchasesAreCompletedByAPI.kt rename to apiTester/src/commonMain/kotlin/com/revenuecat/purchases/kmp/apitester/PurchasesAreCompletedByAPI.kt diff --git a/apiTester/src/androidMain/kotlin/com/revenuecat/purchases/kmp/apitester/StoreAPI.kt b/apiTester/src/commonMain/kotlin/com/revenuecat/purchases/kmp/apitester/StoreAPI.kt similarity index 100% rename from apiTester/src/androidMain/kotlin/com/revenuecat/purchases/kmp/apitester/StoreAPI.kt rename to apiTester/src/commonMain/kotlin/com/revenuecat/purchases/kmp/apitester/StoreAPI.kt diff --git a/apiTester/src/iosMain/kotlin/com/revenuecat/purchases/kmp/apitester/CacheFetchPolicyAPI.kt b/apiTester/src/iosMain/kotlin/com/revenuecat/purchases/kmp/apitester/CacheFetchPolicyAPI.kt deleted file mode 100644 index 5bb30eb5..00000000 --- a/apiTester/src/iosMain/kotlin/com/revenuecat/purchases/kmp/apitester/CacheFetchPolicyAPI.kt +++ /dev/null @@ -1,18 +0,0 @@ -package com.revenuecat.purchases.kmp.apitester - -import com.revenuecat.purchases.kmp.CacheFetchPolicy - -@Suppress("unused") -private class CacheFetchPolicyAPI { - - fun check(fetchPolicy: CacheFetchPolicy) { - when (fetchPolicy) { - CacheFetchPolicy.CACHE_ONLY, - CacheFetchPolicy.FETCH_CURRENT, - CacheFetchPolicy.CACHED_OR_FETCHED, - CacheFetchPolicy.NOT_STALE_CACHED_OR_CURRENT, - -> { - } - }.exhaustive - } -} diff --git a/apiTester/src/iosMain/kotlin/com/revenuecat/purchases/kmp/apitester/OwnershipTypeAPI.kt b/apiTester/src/iosMain/kotlin/com/revenuecat/purchases/kmp/apitester/OwnershipTypeAPI.kt deleted file mode 100644 index a0ed5c99..00000000 --- a/apiTester/src/iosMain/kotlin/com/revenuecat/purchases/kmp/apitester/OwnershipTypeAPI.kt +++ /dev/null @@ -1,16 +0,0 @@ -package com.revenuecat.purchases.kmp.apitester - -import com.revenuecat.purchases.kmp.OwnershipType - -@Suppress("unused") -private class OwnershipTypeAPI { - fun check(type: OwnershipType) { - when (type) { - OwnershipType.PURCHASED, - OwnershipType.FAMILY_SHARED, - OwnershipType.UNKNOWN, - -> { - } - }.exhaustive - } -} diff --git a/apiTester/src/iosMain/kotlin/com/revenuecat/purchases/kmp/apitester/PeriodTypeAPI.kt b/apiTester/src/iosMain/kotlin/com/revenuecat/purchases/kmp/apitester/PeriodTypeAPI.kt deleted file mode 100644 index 79f26eea..00000000 --- a/apiTester/src/iosMain/kotlin/com/revenuecat/purchases/kmp/apitester/PeriodTypeAPI.kt +++ /dev/null @@ -1,16 +0,0 @@ -package com.revenuecat.purchases.kmp.apitester - -import com.revenuecat.purchases.kmp.PeriodType - -@Suppress("unused") -private class PeriodTypeAPI { - fun check(type: PeriodType) { - when (type) { - PeriodType.NORMAL, - PeriodType.INTRO, - PeriodType.TRIAL, - -> { - } - }.exhaustive - } -} diff --git a/apiTester/src/iosMain/kotlin/com/revenuecat/purchases/kmp/apitester/PurchasesAreCompletedByAPI.kt b/apiTester/src/iosMain/kotlin/com/revenuecat/purchases/kmp/apitester/PurchasesAreCompletedByAPI.kt deleted file mode 100644 index 0122e1d6..00000000 --- a/apiTester/src/iosMain/kotlin/com/revenuecat/purchases/kmp/apitester/PurchasesAreCompletedByAPI.kt +++ /dev/null @@ -1,15 +0,0 @@ -package com.revenuecat.purchases.kmp.apitester - -import com.revenuecat.purchases.kmp.PurchasesAreCompletedBy - -@Suppress("unused") -private class PurchasesAreCompletedByAPI { - fun check(mode: PurchasesAreCompletedBy) { - when (mode) { - PurchasesAreCompletedBy.REVENUECAT, - PurchasesAreCompletedBy.MY_APP, - -> { - } - }.exhaustive - } -} diff --git a/apiTester/src/iosMain/kotlin/com/revenuecat/purchases/kmp/apitester/StoreAPI.kt b/apiTester/src/iosMain/kotlin/com/revenuecat/purchases/kmp/apitester/StoreAPI.kt deleted file mode 100644 index 5d14df22..00000000 --- a/apiTester/src/iosMain/kotlin/com/revenuecat/purchases/kmp/apitester/StoreAPI.kt +++ /dev/null @@ -1,22 +0,0 @@ -package com.revenuecat.purchases.kmp.apitester - -import com.revenuecat.purchases.kmp.Store - -@Suppress("unused") -private class StoreAPI { - fun check(store: Store) { - when (store) { - Store.APP_STORE, - Store.MAC_APP_STORE, - Store.PLAY_STORE, - Store.STRIPE, - Store.PROMOTIONAL, - Store.UNKNOWN_STORE, - Store.AMAZON, - Store.RC_BILLING, - Store.EXTERNAL, - -> { - } - }.exhaustive - } -} diff --git a/core/api/core.api b/core/api/core.api index 4be36fd9..ad7f587e 100644 --- a/core/api/core.api +++ b/core/api/core.api @@ -1,3 +1,18 @@ +public final class com/revenuecat/purchases/kmp/CacheFetchPolicy : java/lang/Enum { + public static final field CACHED_OR_FETCHED Lcom/revenuecat/purchases/kmp/CacheFetchPolicy; + public static final field CACHE_ONLY Lcom/revenuecat/purchases/kmp/CacheFetchPolicy; + public static final field Companion Lcom/revenuecat/purchases/kmp/CacheFetchPolicy$Companion; + public static final field FETCH_CURRENT Lcom/revenuecat/purchases/kmp/CacheFetchPolicy; + public static final field NOT_STALE_CACHED_OR_CURRENT Lcom/revenuecat/purchases/kmp/CacheFetchPolicy; + public static fun getEntries ()Lkotlin/enums/EnumEntries; + public static fun valueOf (Ljava/lang/String;)Lcom/revenuecat/purchases/kmp/CacheFetchPolicy; + public static fun values ()[Lcom/revenuecat/purchases/kmp/CacheFetchPolicy; +} + +public final class com/revenuecat/purchases/kmp/CacheFetchPolicy$Companion { + public final fun default ()Lcom/revenuecat/purchases/kmp/CacheFetchPolicy; +} + public final class com/revenuecat/purchases/kmp/CustomerInfo_androidKt { public static final fun getActiveSubscriptions (Lcom/revenuecat/purchases/CustomerInfo;)Ljava/util/Set; public static final fun getAllExpirationDateMillis (Lcom/revenuecat/purchases/CustomerInfo;)Ljava/util/Map; @@ -33,11 +48,11 @@ public final class com/revenuecat/purchases/kmp/EntitlementInfo_androidKt { public static final fun getIdentifier (Lcom/revenuecat/purchases/EntitlementInfo;)Ljava/lang/String; public static final fun getLatestPurchaseDateMillis (Lcom/revenuecat/purchases/EntitlementInfo;)Ljava/lang/Long; public static final fun getOriginalPurchaseDateMillis (Lcom/revenuecat/purchases/EntitlementInfo;)Ljava/lang/Long; - public static final fun getOwnershipType (Lcom/revenuecat/purchases/EntitlementInfo;)Lcom/revenuecat/purchases/OwnershipType; - public static final fun getPeriodType (Lcom/revenuecat/purchases/EntitlementInfo;)Lcom/revenuecat/purchases/PeriodType; + public static final fun getOwnershipType (Lcom/revenuecat/purchases/EntitlementInfo;)Lcom/revenuecat/purchases/kmp/OwnershipType; + public static final fun getPeriodType (Lcom/revenuecat/purchases/EntitlementInfo;)Lcom/revenuecat/purchases/kmp/PeriodType; public static final fun getProductIdentifier (Lcom/revenuecat/purchases/EntitlementInfo;)Ljava/lang/String; public static final fun getProductPlanIdentifier (Lcom/revenuecat/purchases/EntitlementInfo;)Ljava/lang/String; - public static final fun getStore (Lcom/revenuecat/purchases/EntitlementInfo;)Lcom/revenuecat/purchases/Store; + public static final fun getStore (Lcom/revenuecat/purchases/EntitlementInfo;)Lcom/revenuecat/purchases/kmp/Store; public static final fun getUnsubscribeDetectedAtMillis (Lcom/revenuecat/purchases/EntitlementInfo;)Ljava/lang/Long; public static final fun getVerification (Lcom/revenuecat/purchases/EntitlementInfo;)Lcom/revenuecat/purchases/VerificationResult; public static final fun getWillRenew (Lcom/revenuecat/purchases/EntitlementInfo;)Z @@ -67,6 +82,17 @@ public final class com/revenuecat/purchases/kmp/Errors_androidKt { public static final fun toPurchasesError (Lcom/revenuecat/purchases/PurchasesError;)Lcom/revenuecat/purchases/kmp/PurchasesError; } +public final class com/revenuecat/purchases/kmp/LogLevel : java/lang/Enum { + public static final field DEBUG Lcom/revenuecat/purchases/kmp/LogLevel; + public static final field ERROR Lcom/revenuecat/purchases/kmp/LogLevel; + public static final field INFO Lcom/revenuecat/purchases/kmp/LogLevel; + public static final field VERBOSE Lcom/revenuecat/purchases/kmp/LogLevel; + public static final field WARN Lcom/revenuecat/purchases/kmp/LogLevel; + public static fun getEntries ()Lkotlin/enums/EnumEntries; + public static fun valueOf (Ljava/lang/String;)Lcom/revenuecat/purchases/kmp/LogLevel; + public static fun values ()[Lcom/revenuecat/purchases/kmp/LogLevel; +} + public final class com/revenuecat/purchases/kmp/OfferingKt { public static final fun get (Lcom/revenuecat/purchases/Offering;Ljava/lang/String;)Lcom/revenuecat/purchases/Package; public static final fun getMetadataString (Lcom/revenuecat/purchases/Offering;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; @@ -97,6 +123,15 @@ public final class com/revenuecat/purchases/kmp/Offerings_androidKt { public static final fun getCurrent (Lcom/revenuecat/purchases/Offerings;)Lcom/revenuecat/purchases/Offering; } +public final class com/revenuecat/purchases/kmp/OwnershipType : java/lang/Enum { + public static final field FAMILY_SHARED Lcom/revenuecat/purchases/kmp/OwnershipType; + public static final field PURCHASED Lcom/revenuecat/purchases/kmp/OwnershipType; + public static final field UNKNOWN Lcom/revenuecat/purchases/kmp/OwnershipType; + public static fun getEntries ()Lkotlin/enums/EnumEntries; + public static fun valueOf (Ljava/lang/String;)Lcom/revenuecat/purchases/kmp/OwnershipType; + public static fun values ()[Lcom/revenuecat/purchases/kmp/OwnershipType; +} + public final class com/revenuecat/purchases/kmp/PackageKt { public static final fun getIdentifier (Lcom/revenuecat/purchases/PackageType;)Ljava/lang/String; } @@ -108,6 +143,15 @@ public final class com/revenuecat/purchases/kmp/Package_androidKt { public static final fun getStoreProduct (Lcom/revenuecat/purchases/Package;)Lcom/revenuecat/purchases/kmp/models/StoreProduct; } +public final class com/revenuecat/purchases/kmp/PeriodType : java/lang/Enum { + public static final field INTRO Lcom/revenuecat/purchases/kmp/PeriodType; + public static final field NORMAL Lcom/revenuecat/purchases/kmp/PeriodType; + public static final field TRIAL Lcom/revenuecat/purchases/kmp/PeriodType; + public static fun getEntries ()Lkotlin/enums/EnumEntries; + public static fun valueOf (Ljava/lang/String;)Lcom/revenuecat/purchases/kmp/PeriodType; + public static fun values ()[Lcom/revenuecat/purchases/kmp/PeriodType; +} + public final class com/revenuecat/purchases/kmp/PresentedOfferingContext_androidKt { public static final fun getOfferingIdentifier (Lcom/revenuecat/purchases/PresentedOfferingContext;)Ljava/lang/String; public static final fun getPlacementIdentifier (Lcom/revenuecat/purchases/PresentedOfferingContext;)Ljava/lang/String; @@ -124,20 +168,20 @@ public final class com/revenuecat/purchases/kmp/Purchases { public final fun collectDeviceIdentifiers ()V public static final fun configure (Lcom/revenuecat/purchases/kmp/PurchasesConfiguration;)Lcom/revenuecat/purchases/kmp/Purchases; public final fun getAppUserID ()Ljava/lang/String; - public final fun getCustomerInfo (Lcom/revenuecat/purchases/CacheFetchPolicy;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)V - public static synthetic fun getCustomerInfo$default (Lcom/revenuecat/purchases/kmp/Purchases;Lcom/revenuecat/purchases/CacheFetchPolicy;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)V + public final fun getCustomerInfo (Lcom/revenuecat/purchases/kmp/CacheFetchPolicy;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)V + public static synthetic fun getCustomerInfo$default (Lcom/revenuecat/purchases/kmp/Purchases;Lcom/revenuecat/purchases/kmp/CacheFetchPolicy;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)V public final fun getDelegate ()Lcom/revenuecat/purchases/kmp/PurchasesDelegate; public static final fun getForceUniversalAppStore ()Z public static final fun getLogHandler ()Lcom/revenuecat/purchases/LogHandler; - public static final fun getLogLevel ()Lcom/revenuecat/purchases/LogLevel; + public static final fun getLogLevel ()Lcom/revenuecat/purchases/kmp/LogLevel; public final fun getOfferings (Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)V public final fun getProducts (Ljava/util/List;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)V public final fun getPromotionalOffer (Lcom/revenuecat/purchases/kmp/models/StoreProductDiscount;Lcom/revenuecat/purchases/kmp/models/StoreProduct;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)V public static final fun getProxyURL ()Ljava/lang/String; - public final fun getPurchasesAreCompletedBy ()Lcom/revenuecat/purchases/PurchasesAreCompletedBy; + public final fun getPurchasesAreCompletedBy ()Lcom/revenuecat/purchases/kmp/PurchasesAreCompletedBy; public static final fun getSharedInstance ()Lcom/revenuecat/purchases/kmp/Purchases; public static final fun getSimulatesAskToBuyInSandbox ()Z - public final fun getStore ()Lcom/revenuecat/purchases/Store; + public final fun getStore ()Lcom/revenuecat/purchases/kmp/Store; public final fun invalidateCustomerInfoCache ()V public final fun isAnonymous ()Z public static final fun isConfigured ()Z @@ -169,7 +213,7 @@ public final class com/revenuecat/purchases/kmp/Purchases { public static final fun setForceUniversalAppStore (Z)V public final fun setKeyword (Ljava/lang/String;)V public static final fun setLogHandler (Lcom/revenuecat/purchases/LogHandler;)V - public static final fun setLogLevel (Lcom/revenuecat/purchases/LogLevel;)V + public static final fun setLogLevel (Lcom/revenuecat/purchases/kmp/LogLevel;)V public final fun setMediaSource (Ljava/lang/String;)V public final fun setMixpanelDistinctID (Ljava/lang/String;)V public final fun setMparticleID (Ljava/lang/String;)V @@ -177,7 +221,7 @@ public final class com/revenuecat/purchases/kmp/Purchases { public final fun setOnesignalUserID (Ljava/lang/String;)V public final fun setPhoneNumber (Ljava/lang/String;)V public static final fun setProxyURL (Ljava/lang/String;)V - public final fun setPurchasesAreCompletedBy (Lcom/revenuecat/purchases/PurchasesAreCompletedBy;)V + public final fun setPurchasesAreCompletedBy (Lcom/revenuecat/purchases/kmp/PurchasesAreCompletedBy;)V public final fun setPushToken (Ljava/lang/String;)V public static final fun setSimulatesAskToBuyInSandbox (Z)V public final fun showInAppMessagesIfNeeded (Ljava/util/List;)V @@ -193,27 +237,35 @@ public final class com/revenuecat/purchases/kmp/Purchases$Companion { public final fun configure (Lcom/revenuecat/purchases/kmp/PurchasesConfiguration;)Lcom/revenuecat/purchases/kmp/Purchases; public final fun getForceUniversalAppStore ()Z public final fun getLogHandler ()Lcom/revenuecat/purchases/LogHandler; - public final fun getLogLevel ()Lcom/revenuecat/purchases/LogLevel; + public final fun getLogLevel ()Lcom/revenuecat/purchases/kmp/LogLevel; public final fun getProxyURL ()Ljava/lang/String; public final fun getSharedInstance ()Lcom/revenuecat/purchases/kmp/Purchases; public final fun getSimulatesAskToBuyInSandbox ()Z public final fun isConfigured ()Z public final fun setForceUniversalAppStore (Z)V public final fun setLogHandler (Lcom/revenuecat/purchases/LogHandler;)V - public final fun setLogLevel (Lcom/revenuecat/purchases/LogLevel;)V + public final fun setLogLevel (Lcom/revenuecat/purchases/kmp/LogLevel;)V public final fun setProxyURL (Ljava/lang/String;)V public final fun setSimulatesAskToBuyInSandbox (Z)V } +public final class com/revenuecat/purchases/kmp/PurchasesAreCompletedBy : java/lang/Enum { + public static final field MY_APP Lcom/revenuecat/purchases/kmp/PurchasesAreCompletedBy; + public static final field REVENUECAT Lcom/revenuecat/purchases/kmp/PurchasesAreCompletedBy; + public static fun getEntries ()Lkotlin/enums/EnumEntries; + public static fun valueOf (Ljava/lang/String;)Lcom/revenuecat/purchases/kmp/PurchasesAreCompletedBy; + public static fun values ()[Lcom/revenuecat/purchases/kmp/PurchasesAreCompletedBy; +} + public final class com/revenuecat/purchases/kmp/PurchasesConfiguration { - public synthetic fun (Ljava/lang/String;Ljava/lang/String;Lcom/revenuecat/purchases/PurchasesAreCompletedBy;Ljava/lang/String;ZLcom/revenuecat/purchases/Store;ZLcom/revenuecat/purchases/kmp/DangerousSettings;Lcom/revenuecat/purchases/kmp/EntitlementVerificationMode;Lkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (Ljava/lang/String;Ljava/lang/String;Lcom/revenuecat/purchases/kmp/PurchasesAreCompletedBy;Ljava/lang/String;ZLcom/revenuecat/purchases/kmp/Store;ZLcom/revenuecat/purchases/kmp/DangerousSettings;Lcom/revenuecat/purchases/kmp/EntitlementVerificationMode;Lkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun getApiKey ()Ljava/lang/String; public final fun getAppUserId ()Ljava/lang/String; public final fun getDangerousSettings ()Lcom/revenuecat/purchases/kmp/DangerousSettings; public final fun getDiagnosticsEnabled ()Z - public final fun getPurchasesAreCompletedBy ()Lcom/revenuecat/purchases/PurchasesAreCompletedBy; + public final fun getPurchasesAreCompletedBy ()Lcom/revenuecat/purchases/kmp/PurchasesAreCompletedBy; public final fun getShowInAppMessagesAutomatically ()Z - public final fun getStore ()Lcom/revenuecat/purchases/Store; + public final fun getStore ()Lcom/revenuecat/purchases/kmp/Store; public final fun getUserDefaultsSuiteName ()Ljava/lang/String; public final fun getVerificationMode ()Lcom/revenuecat/purchases/kmp/EntitlementVerificationMode; public fun toString ()Ljava/lang/String; @@ -230,23 +282,23 @@ public final class com/revenuecat/purchases/kmp/PurchasesConfiguration$Builder { public final fun getAppUserId ()Ljava/lang/String; public final fun getDangerousSettings ()Lcom/revenuecat/purchases/kmp/DangerousSettings; public final fun getDiagnosticsEnabled ()Z - public final fun getPurchasesAreCompletedBy ()Lcom/revenuecat/purchases/PurchasesAreCompletedBy; + public final fun getPurchasesAreCompletedBy ()Lcom/revenuecat/purchases/kmp/PurchasesAreCompletedBy; public final fun getShowInAppMessagesAutomatically ()Z - public final fun getStore ()Lcom/revenuecat/purchases/Store; + public final fun getStore ()Lcom/revenuecat/purchases/kmp/Store; public final fun getUserDefaultsSuiteName ()Ljava/lang/String; public final fun getVerificationMode ()Lcom/revenuecat/purchases/kmp/EntitlementVerificationMode; - public final fun purchasesAreCompletedBy (Lcom/revenuecat/purchases/PurchasesAreCompletedBy;)Lcom/revenuecat/purchases/kmp/PurchasesConfiguration$Builder; + public final fun purchasesAreCompletedBy (Lcom/revenuecat/purchases/kmp/PurchasesAreCompletedBy;)Lcom/revenuecat/purchases/kmp/PurchasesConfiguration$Builder; public final synthetic fun setApiKey (Ljava/lang/String;)V public final synthetic fun setAppUserId (Ljava/lang/String;)V public final synthetic fun setDangerousSettings (Lcom/revenuecat/purchases/kmp/DangerousSettings;)V public final synthetic fun setDiagnosticsEnabled (Z)V - public final synthetic fun setPurchasesAreCompletedBy (Lcom/revenuecat/purchases/PurchasesAreCompletedBy;)V + public final synthetic fun setPurchasesAreCompletedBy (Lcom/revenuecat/purchases/kmp/PurchasesAreCompletedBy;)V public final synthetic fun setShowInAppMessagesAutomatically (Z)V - public final synthetic fun setStore (Lcom/revenuecat/purchases/Store;)V + public final synthetic fun setStore (Lcom/revenuecat/purchases/kmp/Store;)V public final synthetic fun setUserDefaultsSuiteName (Ljava/lang/String;)V public final synthetic fun setVerificationMode (Lcom/revenuecat/purchases/kmp/EntitlementVerificationMode;)V public final fun showInAppMessagesAutomatically (Z)Lcom/revenuecat/purchases/kmp/PurchasesConfiguration$Builder; - public final fun store (Lcom/revenuecat/purchases/Store;)Lcom/revenuecat/purchases/kmp/PurchasesConfiguration$Builder; + public final fun store (Lcom/revenuecat/purchases/kmp/Store;)Lcom/revenuecat/purchases/kmp/PurchasesConfiguration$Builder; public final fun userDefaultsSuiteName (Ljava/lang/String;)Lcom/revenuecat/purchases/kmp/PurchasesConfiguration$Builder; public final fun verificationMode (Lcom/revenuecat/purchases/kmp/EntitlementVerificationMode;)Lcom/revenuecat/purchases/kmp/PurchasesConfiguration$Builder; } @@ -334,6 +386,21 @@ public final class com/revenuecat/purchases/kmp/PurchasesTransactionException : public final fun getUserCancelled ()Z } +public final class com/revenuecat/purchases/kmp/Store : java/lang/Enum { + public static final field AMAZON Lcom/revenuecat/purchases/kmp/Store; + public static final field APP_STORE Lcom/revenuecat/purchases/kmp/Store; + public static final field EXTERNAL Lcom/revenuecat/purchases/kmp/Store; + public static final field MAC_APP_STORE Lcom/revenuecat/purchases/kmp/Store; + public static final field PLAY_STORE Lcom/revenuecat/purchases/kmp/Store; + public static final field PROMOTIONAL Lcom/revenuecat/purchases/kmp/Store; + public static final field RC_BILLING Lcom/revenuecat/purchases/kmp/Store; + public static final field STRIPE Lcom/revenuecat/purchases/kmp/Store; + public static final field UNKNOWN_STORE Lcom/revenuecat/purchases/kmp/Store; + public static fun getEntries ()Lkotlin/enums/EnumEntries; + public static fun valueOf (Ljava/lang/String;)Lcom/revenuecat/purchases/kmp/Store; + public static fun values ()[Lcom/revenuecat/purchases/kmp/Store; +} + public final class com/revenuecat/purchases/kmp/UpdatedCustomerInfoDelegate : com/revenuecat/purchases/kmp/PurchasesDelegate { public fun (Lkotlin/jvm/functions/Function1;)V public fun onCustomerInfoUpdated (Lcom/revenuecat/purchases/CustomerInfo;)V @@ -362,8 +429,8 @@ public final class com/revenuecat/purchases/kmp/i18n/Locale_androidKt { } public final class com/revenuecat/purchases/kmp/ktx/CoroutinesKt { - public static final fun awaitCustomerInfo (Lcom/revenuecat/purchases/kmp/Purchases;Lcom/revenuecat/purchases/CacheFetchPolicy;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static synthetic fun awaitCustomerInfo$default (Lcom/revenuecat/purchases/kmp/Purchases;Lcom/revenuecat/purchases/CacheFetchPolicy;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public static final fun awaitCustomerInfo (Lcom/revenuecat/purchases/kmp/Purchases;Lcom/revenuecat/purchases/kmp/CacheFetchPolicy;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun awaitCustomerInfo$default (Lcom/revenuecat/purchases/kmp/Purchases;Lcom/revenuecat/purchases/kmp/CacheFetchPolicy;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; public static final fun awaitGetProducts (Lcom/revenuecat/purchases/kmp/Purchases;Ljava/util/List;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static final fun awaitLogIn (Lcom/revenuecat/purchases/kmp/Purchases;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static final fun awaitLogOut (Lcom/revenuecat/purchases/kmp/Purchases;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; diff --git a/core/src/androidMain/kotlin/com/revenuecat/purchases/kmp/CacheFetchPolicy.android.kt b/core/src/androidMain/kotlin/com/revenuecat/purchases/kmp/CacheFetchPolicy.android.kt index 606c2382..a3172aec 100644 --- a/core/src/androidMain/kotlin/com/revenuecat/purchases/kmp/CacheFetchPolicy.android.kt +++ b/core/src/androidMain/kotlin/com/revenuecat/purchases/kmp/CacheFetchPolicy.android.kt @@ -1,5 +1,11 @@ package com.revenuecat.purchases.kmp -import com.revenuecat.purchases.CacheFetchPolicy as RcCacheFetchPolicy +import com.revenuecat.purchases.CacheFetchPolicy as AndroidCacheFetchPolicy -public actual typealias CacheFetchPolicy = RcCacheFetchPolicy +internal fun CacheFetchPolicy.toAndroidCacheFetchPolicy(): AndroidCacheFetchPolicy = + when (this) { + CacheFetchPolicy.CACHE_ONLY -> AndroidCacheFetchPolicy.CACHE_ONLY + CacheFetchPolicy.FETCH_CURRENT -> AndroidCacheFetchPolicy.FETCH_CURRENT + CacheFetchPolicy.NOT_STALE_CACHED_OR_CURRENT -> AndroidCacheFetchPolicy.NOT_STALE_CACHED_OR_CURRENT + CacheFetchPolicy.CACHED_OR_FETCHED -> AndroidCacheFetchPolicy.CACHED_OR_FETCHED + } diff --git a/core/src/androidMain/kotlin/com/revenuecat/purchases/kmp/EntitlementInfo.android.kt b/core/src/androidMain/kotlin/com/revenuecat/purchases/kmp/EntitlementInfo.android.kt index 52edd58f..cac1ed9f 100644 --- a/core/src/androidMain/kotlin/com/revenuecat/purchases/kmp/EntitlementInfo.android.kt +++ b/core/src/androidMain/kotlin/com/revenuecat/purchases/kmp/EntitlementInfo.android.kt @@ -3,9 +3,9 @@ package com.revenuecat.purchases.kmp import com.revenuecat.purchases.EntitlementInfo as RcEntitlementInfo -import com.revenuecat.purchases.OwnershipType as RcOwnershipType -import com.revenuecat.purchases.PeriodType as RcPeriodType -import com.revenuecat.purchases.Store as RcStore +import com.revenuecat.purchases.OwnershipType as AndroidOwnershipType +import com.revenuecat.purchases.PeriodType as AndroidPeriodType +import com.revenuecat.purchases.Store as AndroidStore public actual typealias EntitlementInfo = RcEntitlementInfo @@ -16,7 +16,7 @@ public actual val EntitlementInfo.isActive: Boolean public actual val EntitlementInfo.willRenew: Boolean get() = willRenew public actual val EntitlementInfo.periodType: PeriodType - get() = periodType + get() = periodType.toPeriodType() public actual val EntitlementInfo.latestPurchaseDateMillis: Long? get() = latestPurchaseDate.time public actual val EntitlementInfo.originalPurchaseDateMillis: Long? @@ -24,7 +24,7 @@ public actual val EntitlementInfo.originalPurchaseDateMillis: Long? public actual val EntitlementInfo.expirationDateMillis: Long? get() = expirationDate?.time public actual val EntitlementInfo.store: Store - get() = store + get() = store.toStore() public actual val EntitlementInfo.productIdentifier: String get() = productIdentifier public actual val EntitlementInfo.productPlanIdentifier: String? @@ -36,10 +36,47 @@ public actual val EntitlementInfo.unsubscribeDetectedAtMillis: Long? public actual val EntitlementInfo.billingIssueDetectedAtMillis: Long? get() = billingIssueDetectedAt?.time public actual val EntitlementInfo.ownershipType: OwnershipType - get() = ownershipType + get() = ownershipType.toOwnershipType() public actual val EntitlementInfo.verification: VerificationResult get() = verification -public actual typealias Store = RcStore -public actual typealias PeriodType = RcPeriodType -public actual typealias OwnershipType = RcOwnershipType +internal fun AndroidStore.toStore(): Store = + when (this) { + AndroidStore.APP_STORE -> Store.APP_STORE + AndroidStore.MAC_APP_STORE -> Store.MAC_APP_STORE + AndroidStore.PLAY_STORE -> Store.PLAY_STORE + AndroidStore.STRIPE -> Store.STRIPE + AndroidStore.PROMOTIONAL -> Store.PROMOTIONAL + AndroidStore.UNKNOWN_STORE -> Store.UNKNOWN_STORE + AndroidStore.AMAZON -> Store.AMAZON + AndroidStore.RC_BILLING -> Store.RC_BILLING + AndroidStore.EXTERNAL -> Store.EXTERNAL + } + +internal fun Store.toAndroidStore(): AndroidStore = + when (this) { + Store.APP_STORE -> AndroidStore.APP_STORE + Store.MAC_APP_STORE -> AndroidStore.MAC_APP_STORE + Store.PLAY_STORE -> AndroidStore.PLAY_STORE + Store.STRIPE -> AndroidStore.STRIPE + Store.PROMOTIONAL -> AndroidStore.PROMOTIONAL + Store.UNKNOWN_STORE -> AndroidStore.UNKNOWN_STORE + Store.AMAZON -> AndroidStore.AMAZON + Store.RC_BILLING -> AndroidStore.RC_BILLING + Store.EXTERNAL -> AndroidStore.EXTERNAL + } + +internal fun AndroidPeriodType.toPeriodType(): PeriodType = + when (this) { + AndroidPeriodType.NORMAL -> PeriodType.NORMAL + AndroidPeriodType.INTRO -> PeriodType.INTRO + AndroidPeriodType.TRIAL -> PeriodType.TRIAL + } + +internal fun AndroidOwnershipType.toOwnershipType(): OwnershipType = + when (this) { + AndroidOwnershipType.PURCHASED -> OwnershipType.PURCHASED + AndroidOwnershipType.FAMILY_SHARED -> OwnershipType.FAMILY_SHARED + AndroidOwnershipType.UNKNOWN -> OwnershipType.UNKNOWN + + } diff --git a/core/src/androidMain/kotlin/com/revenuecat/purchases/kmp/LogLevel.android.kt b/core/src/androidMain/kotlin/com/revenuecat/purchases/kmp/LogLevel.android.kt index 5dec3155..bc819174 100644 --- a/core/src/androidMain/kotlin/com/revenuecat/purchases/kmp/LogLevel.android.kt +++ b/core/src/androidMain/kotlin/com/revenuecat/purchases/kmp/LogLevel.android.kt @@ -1,5 +1,21 @@ package com.revenuecat.purchases.kmp -import com.revenuecat.purchases.LogLevel as RcLogLevel +import com.revenuecat.purchases.LogLevel as AndroidLogLevel -public actual typealias LogLevel = RcLogLevel +internal fun AndroidLogLevel.toLogLevel(): LogLevel = + when (this) { + AndroidLogLevel.VERBOSE -> LogLevel.VERBOSE + AndroidLogLevel.DEBUG -> LogLevel.DEBUG + AndroidLogLevel.INFO -> LogLevel.INFO + AndroidLogLevel.WARN -> LogLevel.WARN + AndroidLogLevel.ERROR -> LogLevel.ERROR + } + +internal fun LogLevel.toAndroidLogLevel(): AndroidLogLevel = + when (this) { + LogLevel.VERBOSE -> AndroidLogLevel.VERBOSE + LogLevel.DEBUG -> AndroidLogLevel.DEBUG + LogLevel.INFO -> AndroidLogLevel.INFO + LogLevel.WARN -> AndroidLogLevel.WARN + LogLevel.ERROR -> AndroidLogLevel.ERROR + } diff --git a/core/src/androidMain/kotlin/com/revenuecat/purchases/kmp/Purchases.android.kt b/core/src/androidMain/kotlin/com/revenuecat/purchases/kmp/Purchases.android.kt index 2eb09c77..50e97e72 100644 --- a/core/src/androidMain/kotlin/com/revenuecat/purchases/kmp/Purchases.android.kt +++ b/core/src/androidMain/kotlin/com/revenuecat/purchases/kmp/Purchases.android.kt @@ -41,7 +41,11 @@ public actual class Purchases private constructor(private val androidPurchases: ) @JvmStatic - public actual var logLevel: LogLevel by AndroidPurchases.Companion::logLevel + public actual var logLevel: LogLevel + get() = AndroidPurchases.Companion.logLevel.toLogLevel() + set(value) { + AndroidPurchases.Companion.logLevel = value.toAndroidLogLevel() + } @JvmStatic public actual var logHandler: LogHandler by AndroidPurchases.Companion::logHandler @@ -70,12 +74,12 @@ public actual class Purchases private constructor(private val androidPurchases: context = AndroidProvider.requireApplication(), apiKey = apiKey, appUserID = appUserId, - purchasesAreCompletedBy = purchasesAreCompletedBy, + purchasesAreCompletedBy = purchasesAreCompletedBy.toAndroidPurchasesAreCompletedBy(), platformInfo = PlatformInfo( flavor = BuildKonfig.platformFlavor, version = frameworkVersion, ), - store = store ?: Store.PLAY_STORE, + store = (store ?: Store.PLAY_STORE).toAndroidStore(), dangerousSettings = dangerousSettings.toAndroidDangerousSettings(), shouldShowInAppMessagesAutomatically = showInAppMessagesAutomatically, verificationMode = verificationMode.name, @@ -98,7 +102,11 @@ public actual class Purchases private constructor(private val androidPurchases: AndroidDangerousSettings(autoSyncPurchases) } - public actual var purchasesAreCompletedBy: PurchasesAreCompletedBy by androidPurchases::purchasesAreCompletedBy + public actual var purchasesAreCompletedBy: PurchasesAreCompletedBy + get() = androidPurchases.purchasesAreCompletedBy.toPurchasesAreCompletedBy() + set(value) { + androidPurchases.purchasesAreCompletedBy = value.toAndroidPurchasesAreCompletedBy() + } public actual val appUserID: String by androidPurchases::appUserID @@ -110,7 +118,8 @@ public actual class Purchases private constructor(private val androidPurchases: public actual val isAnonymous: Boolean by androidPurchases::isAnonymous - public actual val store: Store by androidPurchases::store + public actual val store: Store + get() = androidPurchases.store.toStore() public actual fun syncPurchases( onError: (error: PurchasesError) -> Unit, @@ -283,7 +292,7 @@ public actual class Purchases private constructor(private val androidPurchases: onError: (error: PurchasesError) -> Unit, onSuccess: (customerInfo: CustomerInfo) -> Unit, ): Unit = androidPurchases.getCustomerInfoWith( - fetchPolicy = fetchPolicy, + fetchPolicy = fetchPolicy.toAndroidCacheFetchPolicy(), onError = { onError(it.toPurchasesError()) }, onSuccess = { onSuccess(it) } ) diff --git a/core/src/androidMain/kotlin/com/revenuecat/purchases/kmp/PurchasesAreCompletedBy.android.kt b/core/src/androidMain/kotlin/com/revenuecat/purchases/kmp/PurchasesAreCompletedBy.android.kt index 3f800e20..06893b24 100644 --- a/core/src/androidMain/kotlin/com/revenuecat/purchases/kmp/PurchasesAreCompletedBy.android.kt +++ b/core/src/androidMain/kotlin/com/revenuecat/purchases/kmp/PurchasesAreCompletedBy.android.kt @@ -2,4 +2,14 @@ package com.revenuecat.purchases.kmp import com.revenuecat.purchases.PurchasesAreCompletedBy as AndroidPurchasesAreCompletedBy -public actual typealias PurchasesAreCompletedBy = AndroidPurchasesAreCompletedBy +internal fun AndroidPurchasesAreCompletedBy.toPurchasesAreCompletedBy(): PurchasesAreCompletedBy = + when (this) { + AndroidPurchasesAreCompletedBy.REVENUECAT -> PurchasesAreCompletedBy.REVENUECAT + AndroidPurchasesAreCompletedBy.MY_APP -> PurchasesAreCompletedBy.MY_APP + } + +internal fun PurchasesAreCompletedBy.toAndroidPurchasesAreCompletedBy(): AndroidPurchasesAreCompletedBy = + when (this) { + PurchasesAreCompletedBy.REVENUECAT -> AndroidPurchasesAreCompletedBy.REVENUECAT + PurchasesAreCompletedBy.MY_APP -> AndroidPurchasesAreCompletedBy.MY_APP + } diff --git a/core/src/androidMain/kotlin/com/revenuecat/purchases/kmp/models/DiscountPaymentMode.android.kt b/core/src/androidMain/kotlin/com/revenuecat/purchases/kmp/models/DiscountPaymentMode.android.kt deleted file mode 100644 index 10bd4308..00000000 --- a/core/src/androidMain/kotlin/com/revenuecat/purchases/kmp/models/DiscountPaymentMode.android.kt +++ /dev/null @@ -1,7 +0,0 @@ -package com.revenuecat.purchases.kmp.models - -public actual enum class DiscountPaymentMode { - FREE_TRIAL, - PAY_AS_YOU_GO, - PAY_UP_FRONT, -} diff --git a/core/src/androidMain/kotlin/com/revenuecat/purchases/kmp/models/DiscountType.android.kt b/core/src/androidMain/kotlin/com/revenuecat/purchases/kmp/models/DiscountType.android.kt deleted file mode 100644 index d6eaded3..00000000 --- a/core/src/androidMain/kotlin/com/revenuecat/purchases/kmp/models/DiscountType.android.kt +++ /dev/null @@ -1,6 +0,0 @@ -package com.revenuecat.purchases.kmp.models - -public actual enum class DiscountType { - INTRODUCTORY, - PROMOTIONAL, -} diff --git a/core/src/commonMain/kotlin/com/revenuecat/purchases/kmp/CacheFetchPolicy.kt b/core/src/commonMain/kotlin/com/revenuecat/purchases/kmp/CacheFetchPolicy.kt index be781c8b..bae76ac1 100644 --- a/core/src/commonMain/kotlin/com/revenuecat/purchases/kmp/CacheFetchPolicy.kt +++ b/core/src/commonMain/kotlin/com/revenuecat/purchases/kmp/CacheFetchPolicy.kt @@ -3,7 +3,7 @@ package com.revenuecat.purchases.kmp /** * Specifies behavior for a caching API. */ -public expect enum class CacheFetchPolicy { +public enum class CacheFetchPolicy { /** * Returns values from the cache, or throws an error if not available. It won't initiate a fetch. */ @@ -33,6 +33,6 @@ public expect enum class CacheFetchPolicy { /** * Returns the default policy when no policy is provided. */ - public fun default(): CacheFetchPolicy + public fun default(): CacheFetchPolicy = CACHED_OR_FETCHED } } diff --git a/core/src/commonMain/kotlin/com/revenuecat/purchases/kmp/EntitlementInfo.kt b/core/src/commonMain/kotlin/com/revenuecat/purchases/kmp/EntitlementInfo.kt index e620bef6..d66e87a3 100644 --- a/core/src/commonMain/kotlin/com/revenuecat/purchases/kmp/EntitlementInfo.kt +++ b/core/src/commonMain/kotlin/com/revenuecat/purchases/kmp/EntitlementInfo.kt @@ -92,7 +92,7 @@ public expect val EntitlementInfo.verification: VerificationResult /** * Enum of supported stores */ -public expect enum class Store { +public enum class Store { /** * For entitlements granted via Apple App Store. */ @@ -142,7 +142,7 @@ public expect enum class Store { /** * Enum of supported period types for an entitlement. */ -public expect enum class PeriodType { +public enum class PeriodType { /** * If the entitlement is not under an introductory or trial period. */ @@ -162,7 +162,7 @@ public expect enum class PeriodType { /** * Enum of supported ownership types for an entitlement. */ -public expect enum class OwnershipType { +public enum class OwnershipType { /** * The purchase was made directly by this user. */ diff --git a/core/src/commonMain/kotlin/com/revenuecat/purchases/kmp/LogLevel.kt b/core/src/commonMain/kotlin/com/revenuecat/purchases/kmp/LogLevel.kt index c23d1cba..677428fb 100644 --- a/core/src/commonMain/kotlin/com/revenuecat/purchases/kmp/LogLevel.kt +++ b/core/src/commonMain/kotlin/com/revenuecat/purchases/kmp/LogLevel.kt @@ -3,7 +3,7 @@ package com.revenuecat.purchases.kmp /** * The level to log at. */ -public expect enum class LogLevel { +public enum class LogLevel { VERBOSE, DEBUG, INFO, diff --git a/core/src/commonMain/kotlin/com/revenuecat/purchases/kmp/PurchasesAreCompletedBy.kt b/core/src/commonMain/kotlin/com/revenuecat/purchases/kmp/PurchasesAreCompletedBy.kt index 80c82a87..ebf8d031 100644 --- a/core/src/commonMain/kotlin/com/revenuecat/purchases/kmp/PurchasesAreCompletedBy.kt +++ b/core/src/commonMain/kotlin/com/revenuecat/purchases/kmp/PurchasesAreCompletedBy.kt @@ -3,7 +3,7 @@ package com.revenuecat.purchases.kmp /** * Modes for completing the purchase process. */ -public expect enum class PurchasesAreCompletedBy { +public enum class PurchasesAreCompletedBy { /** * RevenueCat will automatically acknowledge verified purchases. No action is required by you. */ diff --git a/core/src/commonMain/kotlin/com/revenuecat/purchases/kmp/models/DiscountPaymentMode.kt b/core/src/commonMain/kotlin/com/revenuecat/purchases/kmp/models/DiscountPaymentMode.kt index ca576d64..33f93c5e 100644 --- a/core/src/commonMain/kotlin/com/revenuecat/purchases/kmp/models/DiscountPaymentMode.kt +++ b/core/src/commonMain/kotlin/com/revenuecat/purchases/kmp/models/DiscountPaymentMode.kt @@ -4,7 +4,7 @@ package com.revenuecat.purchases.kmp.models * App Store only. The payment mode for a [StoreProductDiscount] indicates how the product discount * price is charged. */ -public expect enum class DiscountPaymentMode { +public enum class DiscountPaymentMode { /** * No initial charge. */ diff --git a/core/src/commonMain/kotlin/com/revenuecat/purchases/kmp/models/DiscountType.kt b/core/src/commonMain/kotlin/com/revenuecat/purchases/kmp/models/DiscountType.kt index d30c03bf..756f5d14 100644 --- a/core/src/commonMain/kotlin/com/revenuecat/purchases/kmp/models/DiscountType.kt +++ b/core/src/commonMain/kotlin/com/revenuecat/purchases/kmp/models/DiscountType.kt @@ -3,7 +3,7 @@ package com.revenuecat.purchases.kmp.models /** * App Store only. Denotes the type of a [StoreProductDiscount]. */ -public expect enum class DiscountType { +public enum class DiscountType { /** * Introductory offer. */ diff --git a/core/src/iosMain/kotlin/com/revenuecat/purchases/kmp/CacheFetchPolicy.ios.kt b/core/src/iosMain/kotlin/com/revenuecat/purchases/kmp/CacheFetchPolicy.ios.kt index 8173ebc9..0ded4f0f 100644 --- a/core/src/iosMain/kotlin/com/revenuecat/purchases/kmp/CacheFetchPolicy.ios.kt +++ b/core/src/iosMain/kotlin/com/revenuecat/purchases/kmp/CacheFetchPolicy.ios.kt @@ -1,24 +1,12 @@ package com.revenuecat.purchases.kmp -import cocoapods.PurchasesHybridCommon.RCCacheFetchPolicy import cocoapods.PurchasesHybridCommon.RCCacheFetchPolicyCachedOrFetched import cocoapods.PurchasesHybridCommon.RCCacheFetchPolicyFetchCurrent import cocoapods.PurchasesHybridCommon.RCCacheFetchPolicyFromCacheOnly import cocoapods.PurchasesHybridCommon.RCCacheFetchPolicyNotStaleCachedOrFetched +import cocoapods.PurchasesHybridCommon.RCCacheFetchPolicy as IosCacheFetchPolicy -public actual enum class CacheFetchPolicy { - CACHE_ONLY, - FETCH_CURRENT, - NOT_STALE_CACHED_OR_CURRENT, - CACHED_OR_FETCHED, - ; - - public actual companion object { - public actual fun default(): CacheFetchPolicy = CACHED_OR_FETCHED - } -} - -internal fun CacheFetchPolicy.toRCCacheFetchPolicy(): RCCacheFetchPolicy = +internal fun CacheFetchPolicy.toIosCacheFetchPolicy(): IosCacheFetchPolicy = when (this) { CacheFetchPolicy.CACHE_ONLY -> RCCacheFetchPolicyFromCacheOnly CacheFetchPolicy.FETCH_CURRENT -> RCCacheFetchPolicyFetchCurrent diff --git a/core/src/iosMain/kotlin/com/revenuecat/purchases/kmp/EntitlementInfo.ios.kt b/core/src/iosMain/kotlin/com/revenuecat/purchases/kmp/EntitlementInfo.ios.kt index d3942115..6dec7a70 100644 --- a/core/src/iosMain/kotlin/com/revenuecat/purchases/kmp/EntitlementInfo.ios.kt +++ b/core/src/iosMain/kotlin/com/revenuecat/purchases/kmp/EntitlementInfo.ios.kt @@ -6,18 +6,18 @@ import cocoapods.PurchasesHybridCommon.RCEntitlementInfo import cocoapods.PurchasesHybridCommon.RCIntro import cocoapods.PurchasesHybridCommon.RCMacAppStore import cocoapods.PurchasesHybridCommon.RCNormal -import cocoapods.PurchasesHybridCommon.RCPeriodType import cocoapods.PurchasesHybridCommon.RCPlayStore import cocoapods.PurchasesHybridCommon.RCPromotional -import cocoapods.PurchasesHybridCommon.RCPurchaseOwnershipType import cocoapods.PurchasesHybridCommon.RCPurchaseOwnershipTypeFamilyShared import cocoapods.PurchasesHybridCommon.RCPurchaseOwnershipTypePurchased import cocoapods.PurchasesHybridCommon.RCPurchaseOwnershipTypeUnknown -import cocoapods.PurchasesHybridCommon.RCStore import cocoapods.PurchasesHybridCommon.RCStripe import cocoapods.PurchasesHybridCommon.RCTrial import cocoapods.PurchasesHybridCommon.RCUnknownStore import com.revenuecat.purchases.kmp.ktx.toEpochMilliseconds +import cocoapods.PurchasesHybridCommon.RCPeriodType as IosPeriodType +import cocoapods.PurchasesHybridCommon.RCPurchaseOwnershipType as IosOwnershipType +import cocoapods.PurchasesHybridCommon.RCStore as IosStore public actual typealias EntitlementInfo = RCEntitlementInfo @@ -52,31 +52,7 @@ public actual val EntitlementInfo.ownershipType: OwnershipType public actual val EntitlementInfo.verification: VerificationResult get() = verification().toVerificationResult() -public actual enum class Store { - APP_STORE, - MAC_APP_STORE, - PLAY_STORE, - STRIPE, - PROMOTIONAL, - UNKNOWN_STORE, - AMAZON, - RC_BILLING, - EXTERNAL, -} - -public actual enum class PeriodType { - NORMAL, - INTRO, - TRIAL, -} - -public actual enum class OwnershipType { - PURCHASED, - FAMILY_SHARED, - UNKNOWN, -} - -internal fun RCStore.toStore(): Store = +internal fun IosStore.toStore(): Store = when (this) { RCAppStore -> Store.APP_STORE RCMacAppStore -> Store.MAC_APP_STORE @@ -85,21 +61,21 @@ internal fun RCStore.toStore(): Store = RCPromotional -> Store.PROMOTIONAL RCUnknownStore -> Store.UNKNOWN_STORE RCAmazon -> Store.AMAZON - else -> error("Unknown RCStore: $this") + else -> error("Unknown IosStore: $this") } -internal fun RCPeriodType.toPeriodType(): PeriodType = +internal fun IosPeriodType.toPeriodType(): PeriodType = when (this) { RCNormal -> PeriodType.NORMAL RCIntro -> PeriodType.INTRO RCTrial -> PeriodType.TRIAL - else -> error("Unknown RCPeriodType: $this") + else -> error("Unknown IosPeriodType: $this") } -internal fun RCPurchaseOwnershipType.toOwnershipType(): OwnershipType = +internal fun IosOwnershipType.toOwnershipType(): OwnershipType = when (this) { RCPurchaseOwnershipTypePurchased -> OwnershipType.PURCHASED RCPurchaseOwnershipTypeFamilyShared -> OwnershipType.FAMILY_SHARED RCPurchaseOwnershipTypeUnknown -> OwnershipType.UNKNOWN - else -> error("Unknown RCPurchaseOwnershipType: $this") + else -> error("Unknown IosOwnershipType: $this") } diff --git a/core/src/iosMain/kotlin/com/revenuecat/purchases/kmp/LogLevel.ios.kt b/core/src/iosMain/kotlin/com/revenuecat/purchases/kmp/LogLevel.ios.kt index 6feb1e5e..a22565fb 100644 --- a/core/src/iosMain/kotlin/com/revenuecat/purchases/kmp/LogLevel.ios.kt +++ b/core/src/iosMain/kotlin/com/revenuecat/purchases/kmp/LogLevel.ios.kt @@ -1,31 +1,23 @@ package com.revenuecat.purchases.kmp -import cocoapods.PurchasesHybridCommon.RCLogLevel import cocoapods.PurchasesHybridCommon.RCLogLevelDebug import cocoapods.PurchasesHybridCommon.RCLogLevelError import cocoapods.PurchasesHybridCommon.RCLogLevelInfo import cocoapods.PurchasesHybridCommon.RCLogLevelVerbose import cocoapods.PurchasesHybridCommon.RCLogLevelWarn +import cocoapods.PurchasesHybridCommon.RCLogLevel as IosLogLevel -public actual enum class LogLevel { - VERBOSE, - DEBUG, - INFO, - WARN, - ERROR, -} - -internal fun RCLogLevel.toLogLevel(): LogLevel = +internal fun IosLogLevel.toLogLevel(): LogLevel = when (this) { RCLogLevelVerbose -> LogLevel.VERBOSE RCLogLevelDebug -> LogLevel.DEBUG RCLogLevelInfo -> LogLevel.INFO RCLogLevelWarn -> LogLevel.WARN RCLogLevelError -> LogLevel.ERROR - else -> error("Unexpected RCLogLevel: $this") + else -> error("Unexpected IosLogLevel: $this") } -internal fun LogLevel.toRcLogLevel(): RCLogLevel = +internal fun LogLevel.toRcLogLevel(): IosLogLevel = when (this) { LogLevel.VERBOSE -> RCLogLevelVerbose LogLevel.DEBUG -> RCLogLevelDebug diff --git a/core/src/iosMain/kotlin/com/revenuecat/purchases/kmp/Purchases.ios.kt b/core/src/iosMain/kotlin/com/revenuecat/purchases/kmp/Purchases.ios.kt index c024ce16..ec0e5e23 100644 --- a/core/src/iosMain/kotlin/com/revenuecat/purchases/kmp/Purchases.ios.kt +++ b/core/src/iosMain/kotlin/com/revenuecat/purchases/kmp/Purchases.ios.kt @@ -62,7 +62,7 @@ public actual class Purchases private constructor(private val iosPurchases: IosP IosPurchases.configureWithAPIKey( apiKey = apiKey, appUserID = appUserId, - purchasesAreCompletedBy = purchasesAreCompletedBy.toRCPurchasesAreCompletedBy(), + purchasesAreCompletedBy = purchasesAreCompletedBy.toIosPurchasesAreCompletedBy(), userDefaultsSuiteName = userDefaultsSuiteName, platformFlavor = BuildKonfig.platformFlavor, platformFlavorVersion = frameworkVersion, @@ -99,7 +99,7 @@ public actual class Purchases private constructor(private val iosPurchases: IosP public actual var purchasesAreCompletedBy: PurchasesAreCompletedBy get() = iosPurchases.purchasesAreCompletedBy().toPurchasesAreCompletedBy() set(value) { - iosPurchases.setPurchasesAreCompletedBy(value.toRCPurchasesAreCompletedBy()) + iosPurchases.setPurchasesAreCompletedBy(value.toIosPurchasesAreCompletedBy()) } public actual val appUserID: String @@ -289,7 +289,7 @@ public actual class Purchases private constructor(private val iosPurchases: IosP onError: (error: PurchasesError) -> Unit, onSuccess: (customerInfo: CustomerInfo) -> Unit, ): Unit = iosPurchases.getCustomerInfoWithFetchPolicy( - fetchPolicy.toRCCacheFetchPolicy() + fetchPolicy.toIosCacheFetchPolicy() ) { customerInfo, error -> if (error != null) onError(error.toPurchasesErrorOrThrow()) else onSuccess(customerInfo ?: error("Expected a non-null RCCustomerInfo")) diff --git a/core/src/iosMain/kotlin/com/revenuecat/purchases/kmp/PurchasesAreCompletedBy.ios.kt b/core/src/iosMain/kotlin/com/revenuecat/purchases/kmp/PurchasesAreCompletedBy.ios.kt index e5f7f755..258b1e43 100644 --- a/core/src/iosMain/kotlin/com/revenuecat/purchases/kmp/PurchasesAreCompletedBy.ios.kt +++ b/core/src/iosMain/kotlin/com/revenuecat/purchases/kmp/PurchasesAreCompletedBy.ios.kt @@ -1,22 +1,17 @@ package com.revenuecat.purchases.kmp -import cocoapods.PurchasesHybridCommon.RCPurchasesAreCompletedBy import cocoapods.PurchasesHybridCommon.RCPurchasesAreCompletedByMyApp import cocoapods.PurchasesHybridCommon.RCPurchasesAreCompletedByRevenueCat +import cocoapods.PurchasesHybridCommon.RCPurchasesAreCompletedBy as IosPurchasesAreCompletedBy -public actual enum class PurchasesAreCompletedBy { - REVENUECAT, - MY_APP, -} - -internal fun RCPurchasesAreCompletedBy.toPurchasesAreCompletedBy(): PurchasesAreCompletedBy = +internal fun IosPurchasesAreCompletedBy.toPurchasesAreCompletedBy(): PurchasesAreCompletedBy = when (this) { RCPurchasesAreCompletedByRevenueCat -> PurchasesAreCompletedBy.REVENUECAT RCPurchasesAreCompletedByMyApp -> PurchasesAreCompletedBy.MY_APP - else -> error("Unexpected RCPurchasesAreCompletedBy: $this") + else -> error("Unexpected IosPurchasesAreCompletedBy: $this") } -internal fun PurchasesAreCompletedBy.toRCPurchasesAreCompletedBy(): RCPurchasesAreCompletedBy = +internal fun PurchasesAreCompletedBy.toIosPurchasesAreCompletedBy(): IosPurchasesAreCompletedBy = when (this) { PurchasesAreCompletedBy.REVENUECAT -> RCPurchasesAreCompletedByRevenueCat PurchasesAreCompletedBy.MY_APP -> RCPurchasesAreCompletedByMyApp diff --git a/core/src/iosMain/kotlin/com/revenuecat/purchases/kmp/models/DiscountPaymentMode.ios.kt b/core/src/iosMain/kotlin/com/revenuecat/purchases/kmp/models/DiscountPaymentMode.ios.kt index bdc98b52..ec283eb0 100644 --- a/core/src/iosMain/kotlin/com/revenuecat/purchases/kmp/models/DiscountPaymentMode.ios.kt +++ b/core/src/iosMain/kotlin/com/revenuecat/purchases/kmp/models/DiscountPaymentMode.ios.kt @@ -1,17 +1,11 @@ package com.revenuecat.purchases.kmp.models -import cocoapods.PurchasesHybridCommon.RCPaymentMode import cocoapods.PurchasesHybridCommon.RCPaymentModeFreeTrial import cocoapods.PurchasesHybridCommon.RCPaymentModePayAsYouGo import cocoapods.PurchasesHybridCommon.RCPaymentModePayUpFront +import cocoapods.PurchasesHybridCommon.RCPaymentMode as IosDiscountPaymentMode -public actual enum class DiscountPaymentMode { - FREE_TRIAL, - PAY_AS_YOU_GO, - PAY_UP_FRONT, -} - -internal fun RCPaymentMode.toDiscountPaymentMode(): DiscountPaymentMode = +internal fun IosDiscountPaymentMode.toDiscountPaymentMode(): DiscountPaymentMode = when (this) { RCPaymentModeFreeTrial -> DiscountPaymentMode.FREE_TRIAL RCPaymentModePayAsYouGo -> DiscountPaymentMode.PAY_AS_YOU_GO diff --git a/core/src/iosMain/kotlin/com/revenuecat/purchases/kmp/models/DiscountType.ios.kt b/core/src/iosMain/kotlin/com/revenuecat/purchases/kmp/models/DiscountType.ios.kt index b9148790..6fb15300 100644 --- a/core/src/iosMain/kotlin/com/revenuecat/purchases/kmp/models/DiscountType.ios.kt +++ b/core/src/iosMain/kotlin/com/revenuecat/purchases/kmp/models/DiscountType.ios.kt @@ -1,15 +1,10 @@ package com.revenuecat.purchases.kmp.models -import cocoapods.PurchasesHybridCommon.RCDiscountType import cocoapods.PurchasesHybridCommon.RCDiscountTypeIntroductory import cocoapods.PurchasesHybridCommon.RCDiscountTypePromotional +import cocoapods.PurchasesHybridCommon.RCDiscountType as IosDiscountType -public actual enum class DiscountType { - INTRODUCTORY, - PROMOTIONAL, -} - -internal fun RCDiscountType.toDiscountType(): DiscountType = +internal fun IosDiscountType.toDiscountType(): DiscountType = when(this) { RCDiscountTypeIntroductory -> DiscountType.INTRODUCTORY RCDiscountTypePromotional -> DiscountType.PROMOTIONAL diff --git a/either/api/either.api b/either/api/either.api index 57217132..2bc6156c 100644 --- a/either/api/either.api +++ b/either/api/either.api @@ -1,6 +1,6 @@ public final class com/revenuecat/purchases/kmp/either/EitherKt { - public static final fun awaitCustomerInfoEither (Lcom/revenuecat/purchases/kmp/Purchases;Lcom/revenuecat/purchases/CacheFetchPolicy;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static synthetic fun awaitCustomerInfoEither$default (Lcom/revenuecat/purchases/kmp/Purchases;Lcom/revenuecat/purchases/CacheFetchPolicy;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public static final fun awaitCustomerInfoEither (Lcom/revenuecat/purchases/kmp/Purchases;Lcom/revenuecat/purchases/kmp/CacheFetchPolicy;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun awaitCustomerInfoEither$default (Lcom/revenuecat/purchases/kmp/Purchases;Lcom/revenuecat/purchases/kmp/CacheFetchPolicy;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; public static final fun awaitGetProductsEither (Lcom/revenuecat/purchases/kmp/Purchases;Ljava/util/List;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static final fun awaitLogInEither (Lcom/revenuecat/purchases/kmp/Purchases;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static final fun awaitLogOutEither (Lcom/revenuecat/purchases/kmp/Purchases;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; diff --git a/result/api/result.api b/result/api/result.api index 2fb2ed2d..b74e7459 100644 --- a/result/api/result.api +++ b/result/api/result.api @@ -1,6 +1,6 @@ public final class com/revenuecat/purchases/kmp/result/ResultKt { - public static final fun awaitCustomerInfoResult (Lcom/revenuecat/purchases/kmp/Purchases;Lcom/revenuecat/purchases/CacheFetchPolicy;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static synthetic fun awaitCustomerInfoResult$default (Lcom/revenuecat/purchases/kmp/Purchases;Lcom/revenuecat/purchases/CacheFetchPolicy;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public static final fun awaitCustomerInfoResult (Lcom/revenuecat/purchases/kmp/Purchases;Lcom/revenuecat/purchases/kmp/CacheFetchPolicy;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun awaitCustomerInfoResult$default (Lcom/revenuecat/purchases/kmp/Purchases;Lcom/revenuecat/purchases/kmp/CacheFetchPolicy;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; public static final fun awaitGetProductsResult (Lcom/revenuecat/purchases/kmp/Purchases;Ljava/util/List;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static final fun awaitLogInResult (Lcom/revenuecat/purchases/kmp/Purchases;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static final fun awaitLogOutResult (Lcom/revenuecat/purchases/kmp/Purchases;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;