Skip to content

fix(skills): Android and KMP snippets that do not compile - #66

Merged
skydoves merged 2 commits into
mainfrom
fix/compile-deprecated-apis
Oct 28, 2026
Merged

skydoves merged 2 commits into
mainfrom
fix/compile-deprecated-apis

Conversation

@skydoves

@skydoves skydoves commented Oct 1, 2026 •

Copy link
Copy Markdown
Member

Motivation

These Android and KMP snippets do not compile against the current SDKs.

Description

  • Android: Package import, PaywallResultHandler object, private state in entitlements-gate
  • KMP: PurchasesAreCompletedBy.MyApp, awaitCustomerInfo, shouldDisplayDismissButton, models package imports

The Android snippets compile against purchases and purchases-ui 10.23.4. KMP is checked against the purchases-kmp 3.10.1 API dumps. The rc-* fixes land in RevenueCat/play-billing-skills and arrive here through the sync.


Note

Low Risk
Documentation-only changes to skill markdown; no runtime or SDK code is modified.

Overview
Updates RevenueCat skill docs so Android and KMP copy-paste snippets match current SDK APIs (Android purchases / purchases-ui 10.23.4, KMP 3.10.1).

Android: Package imports use com.revenuecat.purchases.Package instead of models.Package. Paywall activity samples implement PaywallResultHandler with an explicit onActivityResult override (not a SAM lambda). The entitlements-gate reactive example adds a public refresh() that calls awaitCustomerInfo() and logs PurchasesException, replacing startup code that reached into private _hasPremium.

KMP: Observer-mode migration docs use PurchasesAreCompletedBy.MyApp(StoreKitVersion.STOREKIT_2) from kmp.models, with a note that the type is sealed. Paywall/customer-center snippets import CustomerInfo, Package, and related types from kmp.models; verification uses awaitCustomerInfo() from kmp.ktx. Shared paywall guidance documents KMP dismiss as shouldDisplayDismissButton = true (separate from Android’s setter).

Reviewed by Cursor Bugbot for commit e8b6e50. Bugbot is set up for automated code reviews on this repo. Configure here.

- purchase-flow: Package lives in com.revenuecat.purchases, not
  com.revenuecat.purchases.models, and there is no alias, so both imports
  failed.
- paywall: PaywallResultHandler is a plain Kotlin interface extending
  ActivityResultCallback, not a fun interface, so the lambda form has no
  constructor. An object expression with onActivityResult compiles.
- entitlements-gate: the seeding snippet wrote the private _hasPremium from
  outside the object. A refresh() member keeps the state private and gives
  callers one entry point. It catches PurchasesException rather than using
  runCatching, so coroutine cancellation still propagates, and it logs the
  error so a failed refresh is not silent.

Checked against the purchases-android and purchases-ui API dumps and by
compiling the snippets against purchases and purchases-ui 10.23.4.
- migrate: PurchasesAreCompletedBy in KMP is a sealed type with
  MyApp(storeKitVersion) and RevenueCat. MY_APP is the native Android enum
  and does not exist in KMP, and the kmp. import is a deprecated alias.
- customer-center: Purchases has no customerInfo() function in KMP. The
  coroutine call is awaitCustomerInfo() from the ktx package.
- paywall: the KMP builder exposes shouldDisplayDismissButton as a property,
  and Kotlin cannot call its setter by name. The skill pointed KMP users at
  the Android setShouldDisplayDismissButton. The paywall imports also move
  off the deprecated kmp. aliases to the models package.

Checked against the purchases-kmp 3.10.1 klib API dumps and sources.
@skydoves
skydoves merged commit 33b2866 into main Oct 28, 2026
2 checks passed
@skydoves
skydoves deleted the fix/compile-deprecated-apis branch October 28, 2026 03:13
skydoves added a commit that referenced this pull request Oct 28, 2026
#66 landed on main as a squash of this branch's first two commits, so
those hunks merge cleanly. The one conflict is troubleshoot step 6, where
#64 kept "Setup -> License testing" and "not sideloaded". This branch's
point is that the menu is now Settings -> License testing and that an
opted-in license tester can test sideloaded builds, matching the Android
checklist below it and the platform files, so the branch side wins.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants