Skip to content

Commit

Permalink
adopt PHC 13.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
fire-at-will authored Aug 19, 2024
1 parent 1dd907b commit 402b688
Show file tree
Hide file tree
Showing 41 changed files with 908 additions and 166 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,23 @@ jobs:
- name: Test public API
run: ./gradlew :apiTester:assemble

test-unit-tests:
runs-on: macos-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- uses: gradle/wrapper-validation-action@v2
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0
- name: Execute unit tests
run: ./gradlew allTests

build:
needs: [ detekt, validate-binary-compatibility, test-public-api ]
runs-on: macos-latest
Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,23 @@ jobs:
- name: Test public API
run: ./gradlew :apiTester:assemble

test-unit-tests:
runs-on: macos-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- uses: gradle/wrapper-validation-action@v2
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0
- name: Execute unit tests
run: ./gradlew allTests

build:
needs: [ detekt, validate-binary-compatibility, test-public-api ]
runs-on: macos-latest
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Please follow the [Quickstart Guide](https://docs.revenuecat.com/docs/) for more
- Java 8+
- Kotlin 1.9.0+
- Android 5.0+ (API level 21+)
- iOS 11.0+
- iOS 13.0+

## SDK Reference
Our full SDK reference [can be found here](https://revenuecat.github.io/purchases-kmp/).

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.revenuecat.purchases.kmp.apitester

import com.revenuecat.purchases.kmp.PresentedOfferingContext
import com.revenuecat.purchases.kmp.StoreKitVersion
import com.revenuecat.purchases.kmp.models.InstallmentsInfo
import com.revenuecat.purchases.kmp.models.PricingPhase
import com.revenuecat.purchases.kmp.models.SubscriptionOption
import com.revenuecat.purchases.kmp.models.isBasePlan
import com.revenuecat.purchases.kmp.models.isPrepaid

@Suppress("unused")
private class InstallmentsInfoAPI {
fun checkInstallmentsInfo(installmentsInfo: InstallmentsInfo) {
val commitmentPaymentsCount: Int = installmentsInfo.commitmentPaymentsCount
val renewalCommitmentPaymentsCount: Int = installmentsInfo.renewalCommitmentPaymentsCount
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.revenuecat.purchases.kmp.apitester

import com.revenuecat.purchases.kmp.PurchasesAreCompletedBy
import com.revenuecat.purchases.kmp.StoreKitVersion

@Suppress("unused")
private class PurchasesAreCompletedByAPI {
fun check(mode: PurchasesAreCompletedBy) {
when (mode) {
is PurchasesAreCompletedBy.RevenueCat -> { }
is PurchasesAreCompletedBy.MyApp -> {
val storeKitVersion: StoreKitVersion = mode.storeKitVersion
}
}.exhaustive
}

fun checkStoreKitValueInPurchasesAreCompletedByMyApp() {
PurchasesAreCompletedBy.MyApp(storeKitVersion = StoreKitVersion.STOREKIT_2)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ import com.revenuecat.purchases.kmp.LogLevel
import com.revenuecat.purchases.kmp.Offerings
import com.revenuecat.purchases.kmp.Package
import com.revenuecat.purchases.kmp.Purchases
import com.revenuecat.purchases.kmp.PurchasesAreCompletedBy.MY_APP
import com.revenuecat.purchases.kmp.PurchasesAreCompletedBy
import com.revenuecat.purchases.kmp.PurchasesConfiguration
import com.revenuecat.purchases.kmp.PurchasesDelegate
import com.revenuecat.purchases.kmp.PurchasesError
import com.revenuecat.purchases.kmp.Store
import com.revenuecat.purchases.kmp.StoreKitVersion
import com.revenuecat.purchases.kmp.configure
import com.revenuecat.purchases.kmp.either.FailedPurchase
import com.revenuecat.purchases.kmp.either.awaitGetProductsEither
Expand Down Expand Up @@ -240,7 +241,20 @@ private class PurchasesCommonAPI {

val config: PurchasesConfiguration = PurchasesConfiguration(apiKey = "") {
appUserId = ""
purchasesAreCompletedBy = MY_APP
purchasesAreCompletedBy = PurchasesAreCompletedBy.RevenueCat
userDefaultsSuiteName = ""
storeKitVersion = StoreKitVersion.DEFAULT
showInAppMessagesAutomatically = true
store = Store.PLAY_STORE
diagnosticsEnabled = true
dangerousSettings = DangerousSettings(autoSyncPurchases = true)
verificationMode = EntitlementVerificationMode.INFORMATIONAL
pendingTransactionsForPrepaidPlansEnabled = true
}

val config2: PurchasesConfiguration = PurchasesConfiguration(apiKey = "") {
appUserId = ""
purchasesAreCompletedBy = PurchasesAreCompletedBy.MyApp(StoreKitVersion.DEFAULT)
userDefaultsSuiteName = ""
showInAppMessagesAutomatically = true
store = Store.PLAY_STORE
Expand All @@ -252,7 +266,7 @@ private class PurchasesCommonAPI {
val configuredInstance: Purchases = Purchases.configure(config)
val otherConfiguredInstance: Purchases = Purchases.configure(apiKey = "") {
appUserId = ""
purchasesAreCompletedBy = MY_APP
purchasesAreCompletedBy = PurchasesAreCompletedBy.MyApp(StoreKitVersion.DEFAULT)
userDefaultsSuiteName = ""
showInAppMessagesAutomatically = true
store = Store.PLAY_STORE
Expand All @@ -262,6 +276,14 @@ private class PurchasesCommonAPI {
}
val instance: Purchases = Purchases.sharedInstance
}

fun checkRecordPurchase() {
Purchases.sharedInstance.recordPurchase(
productID = "myProductID",
onError = { error -> },
onSuccess = { storeTransaction -> }
)
}

fun checkLogHandler() {
Purchases.logHandler = object : LogHandler {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.revenuecat.purchases.kmp.apitester

import com.revenuecat.purchases.kmp.StoreKitVersion

@Suppress("unused")
private class StoreKitVersionAPI {
fun check(skVersion: StoreKitVersion) {
when (skVersion) {
StoreKitVersion.STOREKIT_1,
StoreKitVersion.STOREKIT_2,
StoreKitVersion.DEFAULT,
-> {
}
}.exhaustive
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.revenuecat.purchases.kmp.apitester

import com.revenuecat.purchases.kmp.PresentedOfferingContext
import com.revenuecat.purchases.kmp.models.InstallmentsInfo
import com.revenuecat.purchases.kmp.models.PricingPhase
import com.revenuecat.purchases.kmp.models.SubscriptionOption
import com.revenuecat.purchases.kmp.models.isBasePlan
Expand All @@ -16,5 +17,6 @@ private class SubscriptionOptionAPI {
val presentedOfferingContext: PresentedOfferingContext? =
subscriptionOption.presentedOfferingContext
val isPrepaid: Boolean = subscriptionOption.isPrepaid
val installmentsInfo: InstallmentsInfo? = subscriptionOption.installmentsInfo
}
}

This file was deleted.

51 changes: 44 additions & 7 deletions core/api/core.api
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ public final class com/revenuecat/purchases/kmp/Purchases {
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 static final fun getSharedInstance ()Lcom/revenuecat/purchases/kmp/Purchases;
public static final fun getSimulatesAskToBuyInSandbox ()Z
public final fun getStore ()Lcom/revenuecat/purchases/Store;
Expand All @@ -151,6 +150,7 @@ public final class com/revenuecat/purchases/kmp/Purchases {
public static synthetic fun purchase$default (Lcom/revenuecat/purchases/kmp/Purchases;Lcom/revenuecat/purchases/Package;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;Ljava/lang/Boolean;Ljava/lang/String;Lcom/revenuecat/purchases/models/GoogleReplacementMode;ILjava/lang/Object;)V
public static synthetic fun purchase$default (Lcom/revenuecat/purchases/kmp/Purchases;Lcom/revenuecat/purchases/kmp/models/StoreProduct;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;Ljava/lang/Boolean;Ljava/lang/String;Lcom/revenuecat/purchases/models/GoogleReplacementMode;ILjava/lang/Object;)V
public static synthetic fun purchase$default (Lcom/revenuecat/purchases/kmp/Purchases;Lcom/revenuecat/purchases/models/SubscriptionOption;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;Ljava/lang/Boolean;Ljava/lang/String;Lcom/revenuecat/purchases/models/GoogleReplacementMode;ILjava/lang/Object;)V
public final fun recordPurchase (Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)V
public final fun restorePurchases (Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)V
public final fun setAd (Ljava/lang/String;)V
public final fun setAdGroup (Ljava/lang/String;)V
Expand All @@ -177,7 +177,6 @@ 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 setPushToken (Ljava/lang/String;)V
public static final fun setSimulatesAskToBuyInSandbox (Z)V
public final fun showInAppMessagesIfNeeded (Ljava/util/List;)V
Expand Down Expand Up @@ -205,15 +204,38 @@ public final class com/revenuecat/purchases/kmp/Purchases$Companion {
public final fun setSimulatesAskToBuyInSandbox (Z)V
}

public abstract interface class com/revenuecat/purchases/kmp/PurchasesAreCompletedBy {
}

public final class com/revenuecat/purchases/kmp/PurchasesAreCompletedBy$MyApp : com/revenuecat/purchases/kmp/PurchasesAreCompletedBy {
public fun <init> (Lcom/revenuecat/purchases/kmp/StoreKitVersion;)V
public final fun component1 ()Lcom/revenuecat/purchases/kmp/StoreKitVersion;
public final fun copy (Lcom/revenuecat/purchases/kmp/StoreKitVersion;)Lcom/revenuecat/purchases/kmp/PurchasesAreCompletedBy$MyApp;
public static synthetic fun copy$default (Lcom/revenuecat/purchases/kmp/PurchasesAreCompletedBy$MyApp;Lcom/revenuecat/purchases/kmp/StoreKitVersion;ILjava/lang/Object;)Lcom/revenuecat/purchases/kmp/PurchasesAreCompletedBy$MyApp;
public fun equals (Ljava/lang/Object;)Z
public final fun getStoreKitVersion ()Lcom/revenuecat/purchases/kmp/StoreKitVersion;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}

public final class com/revenuecat/purchases/kmp/PurchasesAreCompletedBy$RevenueCat : com/revenuecat/purchases/kmp/PurchasesAreCompletedBy {
public static final field INSTANCE Lcom/revenuecat/purchases/kmp/PurchasesAreCompletedBy$RevenueCat;
public fun equals (Ljava/lang/Object;)Z
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}

public final class com/revenuecat/purchases/kmp/PurchasesConfiguration {
public synthetic fun <init> (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 <init> (Ljava/lang/String;Ljava/lang/String;Lcom/revenuecat/purchases/kmp/PurchasesAreCompletedBy;Ljava/lang/String;Lcom/revenuecat/purchases/kmp/StoreKitVersion;ZLcom/revenuecat/purchases/Store;ZLcom/revenuecat/purchases/kmp/DangerousSettings;Lcom/revenuecat/purchases/kmp/EntitlementVerificationMode;Ljava/lang/Boolean;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 getPendingTransactionsForPrepaidPlansEnabled ()Ljava/lang/Boolean;
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 getStoreKitVersion ()Lcom/revenuecat/purchases/kmp/StoreKitVersion;
public final fun getUserDefaultsSuiteName ()Ljava/lang/String;
public final fun getVerificationMode ()Lcom/revenuecat/purchases/kmp/EntitlementVerificationMode;
public fun toString ()Ljava/lang/String;
Expand All @@ -230,23 +252,29 @@ 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 getPendingTransactionsForPrepaidPlansEnabled ()Ljava/lang/Boolean;
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 getStoreKitVersion ()Lcom/revenuecat/purchases/kmp/StoreKitVersion;
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 pendingTransactionsForPrepaidPlansEnabled (Z)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 setPendingTransactionsForPrepaidPlansEnabled (Ljava/lang/Boolean;)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 setStoreKitVersion (Lcom/revenuecat/purchases/kmp/StoreKitVersion;)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 storeKitVersion (Lcom/revenuecat/purchases/kmp/StoreKitVersion;)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;
}
Expand Down Expand Up @@ -334,6 +362,15 @@ public final class com/revenuecat/purchases/kmp/PurchasesTransactionException :
public final fun getUserCancelled ()Z
}

public final class com/revenuecat/purchases/kmp/StoreKitVersion : java/lang/Enum {
public static final field DEFAULT Lcom/revenuecat/purchases/kmp/StoreKitVersion;
public static final field STOREKIT_1 Lcom/revenuecat/purchases/kmp/StoreKitVersion;
public static final field STOREKIT_2 Lcom/revenuecat/purchases/kmp/StoreKitVersion;
public static fun getEntries ()Lkotlin/enums/EnumEntries;
public static fun valueOf (Ljava/lang/String;)Lcom/revenuecat/purchases/kmp/StoreKitVersion;
public static fun values ()[Lcom/revenuecat/purchases/kmp/StoreKitVersion;
}

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/CustomerInfo;)V
Expand Down
Loading

0 comments on commit 402b688

Please sign in to comment.