=============== LIBRARY RULES =============== From library maintainers: - Add `implementation("app.revenuedot.purchases:purchases-kmp-core:")` in commonMain, plus `app.revenuedot.purchases:purchases-kmp-ui` for paywalls. The artifact ids are the same as RevenueCat's. - Kotlin packages stay `com.revenuecat.purchases.kmp.*`, so imports such as `import com.revenuecat.purchases.kmp.Purchases` do not change. - RevenueDot Cloud (https://api.revenuedot.app) is the default API host. For a self-hosted server, set `Purchases.proxyURL = "https://revenuedot.example.com"` before `Purchases.configure`. - Pass the app's public key from the RevenueDot dashboard to `PurchasesConfiguration`: appl_ on iOS and goog_ on Android. ### Development workflow commands Source: https://github.com/revenuedot/purchases-kmp/blob/revenuedot/main-patches/AGENTS.md Development workflow steps: install the pinned JDK with mise, build, test, lint, and verify documentation. ```bash mise install ``` ```bash ./gradlew build ``` ```bash ./gradlew test ``` ```bash ./gradlew detektAll ``` ```bash ./gradlew dokkatooGenerate ``` -------------------------------- ### Configure SDK with Purchases.configure Source: https://github.com/revenuedot/purchases-kmp/blob/revenuedot/main-patches/migrations/KobanKat-MIGRATION.md Configure the SDK and pass the configuration to configure() in one go. After this, access the singleton via Purchases.sharedInstance. ```kotlin Purchases.configure(apiKey = "") { appUserId = "" // More configuration options. } ``` -------------------------------- ### Create PurchasesConfiguration with DSL Source: https://github.com/revenuedot/purchases-kmp/blob/revenuedot/main-patches/migrations/KobanKat-MIGRATION.md Create a PurchasesConfiguration instance using the DSL-like approach. The constructor is no longer available. ```kotlin val config = PurchasesConfiguration(apiKey = "") { appUserId = "" // More configuration options. } ``` -------------------------------- ### Common Development Commands Source: https://github.com/revenuedot/purchases-kmp/blob/revenuedot/main-patches/AGENTS.md Common Gradle commands for building, testing, linting, generating documentation, assembling, and publishing the project locally. ```bash # Build all modules ./gradlew build # Run all tests ./gradlew test # Run Detekt linting ./gradlew detektAll # Generate documentation ./gradlew dokkatoGenerate # Assemble without tests ./gradlew assemble # Publish locally ./gradlew publishToMavenLocal ``` -------------------------------- ### Run tests and linting Source: https://github.com/revenuedot/purchases-kmp/blob/revenuedot/main-patches/AGENTS.md Commands to run all tests and Detekt linting. The API compatibility check comment is not a command. ```bash ./gradlew test ``` ```bash ./gradlew detektAll ``` -------------------------------- ### Source Set Organization Source: https://github.com/revenuedot/purchases-kmp/blob/revenuedot/main-patches/AGENTS.md Standard Kotlin Multiplatform source set organization for each module, showing common, Android, and Apple-specific directories. ```text module/src/ ├── commonMain/ # Shared Kotlin code (Android + iOS) ├── commonTest/ # Shared tests ├── androidMain/ # Android-specific implementations ├── androidUnitTest/ # Android unit tests ├── appleMain/ # Apple-specific implementations (iOS + watchOS) └── appleTest/ # Apple platform tests ``` -------------------------------- ### Configure RevenueDot purchases-kmp with PurchasesConfiguration Source: https://github.com/revenuedot/purchases-kmp/blob/revenuedot/main-patches/README.md Configures the RevenueDot fork of purchases-kmp with a custom proxy URL for self-hosted servers. The apiKey format is appl_... on iOS and goog_... on Android. RevenueDot Cloud is the default when no proxyURL is set, and the fork already trusts RevenueDot's signing key so no signature or verification setting is needed. ```kotlin import com.revenuecat.purchases.kmp.Purchases import com.revenuecat.purchases.kmp.PurchasesConfiguration fun initPurchases(apiKey: String) { // appl_... on iOS, goog_... on Android, from the RevenueDot dashboard // Self-hosted server only: RevenueDot Cloud (https://api.revenuedot.app) is the default. Purchases.proxyURL = "https://revenuedot.example.com" Purchases.configure(PurchasesConfiguration(apiKey)) } ``` -------------------------------- ### Module Dependencies Source: https://github.com/revenuedot/purchases-kmp/blob/revenuedot/main-patches/AGENTS.md Module dependency graph showing that revenuecatui depends on mappings, core, and models; core depends on models and mappings; mappings depends on models. ```text :revenuecatui --> :mappings, :core, :models :core --> :models, :mappings :mappings --> :models ``` -------------------------------- ### Platform-Specific Test Commands Source: https://github.com/revenuedot/purchases-kmp/blob/revenuedot/main-patches/AGENTS.md Platform-specific test commands for Kotlin Multiplatform, Android, and iOS (requires macOS). ```bash # Common KMP tests ./gradlew commonTest # Android unit tests ./gradlew androidUnitTest # iOS tests (requires macOS) ./gradlew iosSimulatorArm64Test ``` -------------------------------- ### Configure SDK with StoreKit 1 for MyApp purchases Source: https://github.com/revenuedot/purchases-kmp/blob/revenuedot/main-patches/migrations/1.0.0-beta.3-MIGRATION.md Use this snippet when purchases are completed by your app using StoreKit 1. You must explicitly set `purchasesAreCompletedBy` to `PurchasesAreCompletedBy.MyApp(StoreKitVersion.STOREKIT_1)` to use StoreKit 1. Replace `{YOUR_API_KEY}` with your actual API key. ```kotlin val configuration = PurchasesConfiguration(apiKey = {YOUR_API_KEY}) { purchasesAreCompletedBy = PurchasesAreCompletedBy.MyApp(StoreKitVersion.STOREKIT_1) } Purchases.configure(configuration) ``` -------------------------------- ### Add Amazon module to libs.versions.toml Source: https://github.com/revenuedot/purchases-kmp/blob/revenuedot/main-patches/migrations/3.0.0-MIGRATION.md Add this coordinate to your libs.versions.toml file to explicitly include the Amazon module. ```toml purchases-amazon = { module = "com.revenuecat.purchases:purchases-store-amazon", version = "x.y.z"} ``` -------------------------------- ### Configure SDK with StoreKit 2 using storeKitVersion Source: https://github.com/revenuedot/purchases-kmp/blob/revenuedot/main-patches/migrations/1.0.0-beta.3-MIGRATION.md Use this snippet to configure the SDK with a specific StoreKit version on iOS. The `storeKitVersion` parameter defaults to letting the iOS SDK choose the version at runtime, but you can force StoreKit 2 by setting `StoreKitVersion.STOREKIT_2`. Replace `{YOUR_API_KEY}` with your actual API key. ```kotlin val config: PurchasesConfiguration = PurchasesConfiguration(apiKey = {YOUR_API_KEY}) { storeKitVersion = StoreKitVersion.STOREKIT_2 } Purchases.configure(config) ``` -------------------------------- ### Trigger CircleCI pipeline with action=bump Source: https://github.com/revenuedot/purchases-kmp/blob/revenuedot/main-patches/RELEASING.md Triggers a manual release pipeline on CircleCI for the main branch by passing the action parameter set to bump. Requires a CircleCI personal token for authentication. ```shell curl --location --request POST 'https://circleci.com/api/v2/project/github/RevenueCat/purchases-kmp/pipeline' \ --header 'Content-Type: application/json' \ -u "your_circleci_personal_token:" \ -d '{ "branch": "main", "parameters": { "action": "bump" } }' ``` -------------------------------- ### Add RevenueDot KMP SDK dependencies in build.gradle.kts Source: https://github.com/revenuedot/purchases-kmp/blob/revenuedot/main-patches/README.md Add the RevenueDot KMP SDK dependencies to your commonMain source set. The UI artifact is only needed if you use paywalls. Kotlin packages remain com.revenuecat.purchases.kmp.*, so imports do not change. ```kotlin // build.gradle.kts, commonMain implementation("app.revenuedot.purchases:purchases-kmp-core:3.10.1") implementation("app.revenuedot.purchases:purchases-kmp-ui:3.10.1") // only if you use paywalls ``` -------------------------------- ### Add Amazon module to build.gradle Source: https://github.com/revenuedot/purchases-kmp/blob/revenuedot/main-patches/migrations/3.0.0-MIGRATION.md Add this dependency to your build.gradle[.kts] file to include the Amazon module. ```kotlin kotlin { sourceSets { androidMain.dependencies { implementation(libs.purchases.amazon) } } } ``` -------------------------------- ### Add Paywalls dependency Source: https://github.com/revenuedot/purchases-kmp/blob/revenuedot/main-patches/migrations/KobanKat-MIGRATION.md Add this Maven coordinate to your dependencies to use Paywalls. ```text com.revenuecat.purchases:purchases-kmp-ui: ``` -------------------------------- ### Run Fastlane bump lane Source: https://github.com/revenuedot/purchases-kmp/blob/revenuedot/main-patches/RELEASING.md Runs the Fastlane bump lane to create a release PR. The github_rate_limit argument is optional but recommended to avoid hitting the GitHub API rate limit while generating the changelog. ```shell bundle exec fastlane bump github_rate_limit:10 ``` -------------------------------- ### Maven coordinates change for core module Source: https://github.com/revenuedot/purchases-kmp/blob/revenuedot/main-patches/migrations/KobanKat-MIGRATION.md Old and new Maven coordinates for the core module. Replace the old coordinate with the new one in your build files. ```text io.shortway.kobankat:kobankat-core: ``` ```text com.revenuecat.purchases:purchases-kmp-core: ``` -------------------------------- ### Remove PurchasesHybridCommon from build.gradle Source: https://github.com/revenuedot/purchases-kmp/blob/revenuedot/main-patches/migrations/3.0.0-MIGRATION.md Remove these sections from your build.gradle[.kts] if you added the native iOS SDK via CocoaPods. ```kotlin pod("PurchasesHybridCommon") { version = "17.21.2" extraOpts += listOf("-compiler-option", "-fmodules") } pod("PurchasesHybridCommonUI") { version = "17.21.2" extraOpts += listOf("-compiler-option", "-fmodules") } ``` -------------------------------- ### Remove PurchasesHybridCommon from Podfile Source: https://github.com/revenuedot/purchases-kmp/blob/revenuedot/main-patches/migrations/3.0.0-MIGRATION.md Remove these lines from your Podfile if you added the native iOS SDK via CocoaPods. ```ruby pod 'PurchasesHybridCommon', '17.21.2' pod 'PurchasesHybridCommonUI', '17.21.2' ```