Skip to content

Commit

Permalink
Moves PurchasesDelegate to the :core module (#194)
Browse files Browse the repository at this point in the history
  • Loading branch information
JayShortway authored Sep 16, 2024
1 parent cdf0e8d commit 53e4bf9
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 41 deletions.
11 changes: 11 additions & 0 deletions core/api/core.api
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,23 @@ public final class com/revenuecat/purchases/kmp/PurchasesConfigurationKt {
public static synthetic fun PurchasesConfiguration$default (Ljava/lang/String;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lcom/revenuecat/purchases/kmp/PurchasesConfiguration;
}

public abstract interface class com/revenuecat/purchases/kmp/PurchasesDelegate {
public abstract fun onCustomerInfoUpdated (Lcom/revenuecat/purchases/kmp/models/CustomerInfo;)V
public abstract fun onPurchasePromoProduct (Lcom/revenuecat/purchases/kmp/models/StoreProduct;Lkotlin/jvm/functions/Function2;)V
}

public final class com/revenuecat/purchases/kmp/PurchasesKt {
public static final synthetic fun configure (Lcom/revenuecat/purchases/kmp/Purchases$Companion;Ljava/lang/String;Lkotlin/jvm/functions/Function1;)Lcom/revenuecat/purchases/kmp/Purchases;
public static synthetic fun configure$default (Lcom/revenuecat/purchases/kmp/Purchases$Companion;Ljava/lang/String;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lcom/revenuecat/purchases/kmp/Purchases;
public static final fun getFrameworkVersion (Lcom/revenuecat/purchases/kmp/Purchases$Companion;)Ljava/lang/String;
}

public final class com/revenuecat/purchases/kmp/UpdatedCustomerInfoDelegate : com/revenuecat/purchases/kmp/PurchasesDelegate {
public fun <init> (Lkotlin/jvm/functions/Function1;)V
public fun onCustomerInfoUpdated (Lcom/revenuecat/purchases/kmp/models/CustomerInfo;)V
public fun onPurchasePromoProduct (Lcom/revenuecat/purchases/kmp/models/StoreProduct;Lkotlin/jvm/functions/Function2;)V
}

public final class com/revenuecat/purchases/kmp/ktx/CoroutinesKt {
public static final fun awaitCustomerInfo (Lcom/revenuecat/purchases/kmp/Purchases;Lcom/revenuecat/purchases/kmp/models/CacheFetchPolicy;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun awaitCustomerInfo$default (Lcom/revenuecat/purchases/kmp/Purchases;Lcom/revenuecat/purchases/kmp/models/CacheFetchPolicy;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
Expand Down
4 changes: 4 additions & 0 deletions core/api/core.klib.api
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ abstract interface com.revenuecat.purchases.kmp/LogHandler { // com.revenuecat.p
abstract fun v(kotlin/String, kotlin/String) // com.revenuecat.purchases.kmp/LogHandler.v|v(kotlin.String;kotlin.String){}[0]
abstract fun w(kotlin/String, kotlin/String) // com.revenuecat.purchases.kmp/LogHandler.w|w(kotlin.String;kotlin.String){}[0]
}
abstract interface com.revenuecat.purchases.kmp/PurchasesDelegate { // com.revenuecat.purchases.kmp/PurchasesDelegate|null[0]
abstract fun onCustomerInfoUpdated(com.revenuecat.purchases.kmp.models/CustomerInfo) // com.revenuecat.purchases.kmp/PurchasesDelegate.onCustomerInfoUpdated|onCustomerInfoUpdated(com.revenuecat.purchases.kmp.models.CustomerInfo){}[0]
abstract fun onPurchasePromoProduct(com.revenuecat.purchases.kmp.models/StoreProduct, kotlin/Function2<kotlin/Function2<com.revenuecat.purchases.kmp.models/PurchasesError, kotlin/Boolean, kotlin/Unit>, kotlin/Function2<com.revenuecat.purchases.kmp.models/StoreTransaction, com.revenuecat.purchases.kmp.models/CustomerInfo, kotlin/Unit>, kotlin/Unit>) // com.revenuecat.purchases.kmp/PurchasesDelegate.onPurchasePromoProduct|onPurchasePromoProduct(com.revenuecat.purchases.kmp.models.StoreProduct;kotlin.Function2<kotlin.Function2<com.revenuecat.purchases.kmp.models.PurchasesError,kotlin.Boolean,kotlin.Unit>,kotlin.Function2<com.revenuecat.purchases.kmp.models.StoreTransaction,com.revenuecat.purchases.kmp.models.CustomerInfo,kotlin.Unit>,kotlin.Unit>){}[0]
}
final class com.revenuecat.purchases.kmp.ktx/SuccessfulLogin { // com.revenuecat.purchases.kmp.ktx/SuccessfulLogin|null[0]
constructor <init>(com.revenuecat.purchases.kmp.models/CustomerInfo, kotlin/Boolean) // com.revenuecat.purchases.kmp.ktx/SuccessfulLogin.<init>|<init>(com.revenuecat.purchases.kmp.models.CustomerInfo;kotlin.Boolean){}[0]
final val created // com.revenuecat.purchases.kmp.ktx/SuccessfulLogin.created|{}created[0]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@ import com.revenuecat.purchases.kmp.mappings.toAndroidSubscriptionOption
import com.revenuecat.purchases.kmp.mappings.toCustomerInfo
import com.revenuecat.purchases.kmp.mappings.toHybridString
import com.revenuecat.purchases.kmp.mappings.toOfferings
import com.revenuecat.purchases.kmp.mappings.toPurchasesDelegate
import com.revenuecat.purchases.kmp.mappings.toPurchasesError
import com.revenuecat.purchases.kmp.mappings.toStore
import com.revenuecat.purchases.kmp.mappings.toStoreProduct
import com.revenuecat.purchases.kmp.mappings.toStoreTransaction
import com.revenuecat.purchases.kmp.mappings.toUpdatedCustomerInfoListener
import com.revenuecat.purchases.kmp.models.BillingFeature
import com.revenuecat.purchases.kmp.models.CacheFetchPolicy
import com.revenuecat.purchases.kmp.models.CustomerInfo
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.revenuecat.purchases.kmp

import com.revenuecat.purchases.interfaces.UpdatedCustomerInfoListener
import com.revenuecat.purchases.kmp.mappings.toCustomerInfo
import com.revenuecat.purchases.kmp.models.CustomerInfo
import com.revenuecat.purchases.kmp.models.PurchasesError
import com.revenuecat.purchases.kmp.models.StoreProduct
Expand All @@ -23,3 +25,16 @@ public class UpdatedCustomerInfoDelegate(
// No-op on Android.
}
}

internal fun UpdatedCustomerInfoListener.toPurchasesDelegate(): PurchasesDelegate =
(this as PurchasesDelegateWrapper).wrapped

internal fun PurchasesDelegate.toUpdatedCustomerInfoListener(): UpdatedCustomerInfoListener =
PurchasesDelegateWrapper(this)

private class PurchasesDelegateWrapper(val wrapped: PurchasesDelegate) :
UpdatedCustomerInfoListener {
override fun onReceived(customerInfo: com.revenuecat.purchases.CustomerInfo) {
wrapped.onCustomerInfoUpdated(customerInfo.toCustomerInfo())
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ import com.revenuecat.purchases.kmp.mappings.toIosStoreProduct
import com.revenuecat.purchases.kmp.mappings.toIosStoreProductDiscount
import com.revenuecat.purchases.kmp.mappings.toOfferings
import com.revenuecat.purchases.kmp.mappings.toPromotionalOffer
import com.revenuecat.purchases.kmp.mappings.toPurchasesDelegate
import com.revenuecat.purchases.kmp.mappings.toPurchasesErrorOrThrow
import com.revenuecat.purchases.kmp.mappings.toRcPurchasesDelegate
import com.revenuecat.purchases.kmp.mappings.toStoreProduct
import com.revenuecat.purchases.kmp.mappings.toStoreTransaction
import com.revenuecat.purchases.kmp.models.BillingFeature
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
package com.revenuecat.purchases.kmp.mappings
package com.revenuecat.purchases.kmp

import cocoapods.PurchasesHybridCommon.RCCustomerInfo
import cocoapods.PurchasesHybridCommon.RCPurchases
import cocoapods.PurchasesHybridCommon.RCPurchasesDelegateProtocol
import cocoapods.PurchasesHybridCommon.RCStoreProduct
import cocoapods.PurchasesHybridCommon.RCStoreTransaction
import com.revenuecat.purchases.kmp.PurchasesDelegate
import com.revenuecat.purchases.kmp.mappings.toCustomerInfo
import com.revenuecat.purchases.kmp.mappings.toPurchasesErrorOrThrow
import com.revenuecat.purchases.kmp.mappings.toStoreProduct
import com.revenuecat.purchases.kmp.mappings.toStoreTransaction
import platform.Foundation.NSError
import platform.darwin.NSObject

public fun RCPurchasesDelegateProtocol.toPurchasesDelegate(): PurchasesDelegate =
internal fun RCPurchasesDelegateProtocol.toPurchasesDelegate(): PurchasesDelegate =
(this as PurchasesDelegateWrapper).wrapped

public fun PurchasesDelegate.toRcPurchasesDelegate(): RCPurchasesDelegateProtocol =
internal fun PurchasesDelegate.toRcPurchasesDelegate(): RCPurchasesDelegateProtocol =
PurchasesDelegateWrapper(this)

private class PurchasesDelegateWrapper(val wrapped: PurchasesDelegate) :
Expand Down

This file was deleted.

11 changes: 0 additions & 11 deletions models/api/models.api
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
public abstract interface class com/revenuecat/purchases/kmp/PurchasesDelegate {
public abstract fun onCustomerInfoUpdated (Lcom/revenuecat/purchases/kmp/models/CustomerInfo;)V
public abstract fun onPurchasePromoProduct (Lcom/revenuecat/purchases/kmp/models/StoreProduct;Lkotlin/jvm/functions/Function2;)V
}

public final class com/revenuecat/purchases/kmp/UpdatedCustomerInfoDelegate : com/revenuecat/purchases/kmp/PurchasesDelegate {
public fun <init> (Lkotlin/jvm/functions/Function1;)V
public fun onCustomerInfoUpdated (Lcom/revenuecat/purchases/kmp/models/CustomerInfo;)V
public fun onPurchasePromoProduct (Lcom/revenuecat/purchases/kmp/models/StoreProduct;Lkotlin/jvm/functions/Function2;)V
}

public final class com/revenuecat/purchases/kmp/models/BillingFeature : java/lang/Enum {
public static final field PRICE_CHANGE_CONFIRMATION Lcom/revenuecat/purchases/kmp/models/BillingFeature;
public static final field SUBSCRIPTIONS Lcom/revenuecat/purchases/kmp/models/BillingFeature;
Expand Down
4 changes: 0 additions & 4 deletions models/api/models.klib.api
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,6 @@ abstract interface com.revenuecat.purchases.kmp.models/SubscriptionOptions { //
abstract val introOffer // com.revenuecat.purchases.kmp.models/SubscriptionOptions.introOffer|{}introOffer[0]
abstract fun <get-introOffer>(): com.revenuecat.purchases.kmp.models/SubscriptionOption? // com.revenuecat.purchases.kmp.models/SubscriptionOptions.introOffer.<get-introOffer>|<get-introOffer>(){}[0]
}
abstract interface com.revenuecat.purchases.kmp/PurchasesDelegate { // com.revenuecat.purchases.kmp/PurchasesDelegate|null[0]
abstract fun onCustomerInfoUpdated(com.revenuecat.purchases.kmp.models/CustomerInfo) // com.revenuecat.purchases.kmp/PurchasesDelegate.onCustomerInfoUpdated|onCustomerInfoUpdated(com.revenuecat.purchases.kmp.models.CustomerInfo){}[0]
abstract fun onPurchasePromoProduct(com.revenuecat.purchases.kmp.models/StoreProduct, kotlin/Function2<kotlin/Function2<com.revenuecat.purchases.kmp.models/PurchasesError, kotlin/Boolean, kotlin/Unit>, kotlin/Function2<com.revenuecat.purchases.kmp.models/StoreTransaction, com.revenuecat.purchases.kmp.models/CustomerInfo, kotlin/Unit>, kotlin/Unit>) // com.revenuecat.purchases.kmp/PurchasesDelegate.onPurchasePromoProduct|onPurchasePromoProduct(com.revenuecat.purchases.kmp.models.StoreProduct;kotlin.Function2<kotlin.Function2<com.revenuecat.purchases.kmp.models.PurchasesError,kotlin.Boolean,kotlin.Unit>,kotlin.Function2<com.revenuecat.purchases.kmp.models.StoreTransaction,com.revenuecat.purchases.kmp.models.CustomerInfo,kotlin.Unit>,kotlin.Unit>){}[0]
}
final class com.revenuecat.purchases.kmp.models/CustomerInfo { // com.revenuecat.purchases.kmp.models/CustomerInfo|null[0]
constructor <init>(kotlin.collections/Set<kotlin/String>, kotlin.collections/Map<kotlin/String, kotlin/Long?>, kotlin.collections/Map<kotlin/String, kotlin/Long?>, kotlin.collections/Set<kotlin/String>, com.revenuecat.purchases.kmp.models/EntitlementInfos, kotlin/Long, kotlin/Long?, kotlin/String?, kotlin.collections/List<com.revenuecat.purchases.kmp.models/Transaction>, kotlin/String, kotlin/String?, kotlin/Long?, kotlin/Long) // com.revenuecat.purchases.kmp.models/CustomerInfo.<init>|<init>(kotlin.collections.Set<kotlin.String>;kotlin.collections.Map<kotlin.String,kotlin.Long?>;kotlin.collections.Map<kotlin.String,kotlin.Long?>;kotlin.collections.Set<kotlin.String>;com.revenuecat.purchases.kmp.models.EntitlementInfos;kotlin.Long;kotlin.Long?;kotlin.String?;kotlin.collections.List<com.revenuecat.purchases.kmp.models.Transaction>;kotlin.String;kotlin.String?;kotlin.Long?;kotlin.Long){}[0]
final val activeSubscriptions // com.revenuecat.purchases.kmp.models/CustomerInfo.activeSubscriptions|{}activeSubscriptions[0]
Expand Down

0 comments on commit 53e4bf9

Please sign in to comment.