=============== LIBRARY RULES =============== From library maintainers: - Check whether an article is about a legacy SDK version. It is usually stated in the filename, title, or at the very beginning. If it is legacy, don't use this code and look for a newer version. ### Provide LLM with SDK Installation Docs Source: https://github.com/adaptyteam/adapty-docs/blob/main/src/content/docs/flutter/adapty-cursor-flutter.mdx Instruct your LLM to read the Adapty SDK installation and configuration documentation before writing any code. This ensures the foundational setup is understood. ```markdown Read these Adapty docs before writing code: - https://adapty.io/docs/sdk-installation-flutter.md ``` -------------------------------- ### LLM Prompt for SDK Installation Docs Source: https://github.com/adaptyteam/adapty-docs/blob/main/src/content/docs/capacitor/adapty-cursor-capacitor.mdx Provide your LLM with the URL to the Adapty SDK installation and configuration documentation for Capacitor. This guides the LLM in setting up the SDK. ```text Read these Adapty docs before writing code: - https://adapty.io/docs/sdk-installation-capacitor.md ``` -------------------------------- ### Install and Configure Adapty SDK (KMP) Source: https://github.com/adaptyteam/adapty-docs/blob/main/src/content/docs/kmp/adapty-cursor-kmp.mdx This guide provides the necessary steps to add the Adapty SDK dependency via Gradle and activate it using your Public SDK key, which is essential for all other Adapty functionalities. ```text Read these Adapty docs before writing code: - https://adapty.io/docs/sdk-installation-kotlin-multiplatform.md ``` -------------------------------- ### Present Onboarding in Swift Source: https://github.com/adaptyteam/adapty-docs/blob/main/src/content/docs/ios/ios-present-onboardings.mdx Use this snippet to get an onboarding configuration and present it as a view controller in your Swift application. Ensure you have the Adapty SDK installed and an onboarding created and added to a placement. ```swift import Adapty import AdaptyUI // 0. Get an onboarding if you haven't done it yet let onboarding = try await Adapty.getOnboarding(placementId: "YOUR_PLACEMENT_ID") // 1. Obtain the onboarding view configuration: let configuration = try AdaptyUI.getOnboardingConfiguration(forOnboarding: onboarding) // 2. Create Onboarding View Controller let onboardingController = try AdaptyUI.onboardingController( with: configuration, delegate: ) // 3. Present it to the user present(onboardingController, animated: true) ``` -------------------------------- ### Create and Present Onboarding View in Kotlin Multiplatform Source: https://github.com/adaptyteam/adapty-docs/blob/main/src/content/docs/kmp/kmp-present-onboardings.mdx Use `createOnboardingView` to get a view instance and then `present()` to display it. Each view can only be used once; recreate it if you need to show the onboarding again. Ensure Adapty Kotlin Multiplatform SDK 3.16.1+ is installed. ```kotlin import com.adapty.kmp.AdaptyUI import kotlinx.coroutines.launch viewModelScope.launch { AdaptyUI.createOnboardingView(onboarding = onboarding).onSuccess { view -> view.present() }.onError { error -> // handle the error } } ``` -------------------------------- ### Integrated paywall implementation example Source: https://github.com/adaptyteam/adapty-docs/blob/main/src/content/docs/kmp/kmp-quickstart-paywalls.mdx A comprehensive example combining event observation, paywall retrieval, and UI presentation in a single workflow. ```kotlin // Set up the observer for handling paywall actions AdaptyUI.setPaywallsEventsObserver(object : AdaptyUIPaywallsEventsObserver { override fun paywallViewDidPerformAction(view: AdaptyUIPaywallView, action: AdaptyUIAction) { when (action) { is AdaptyUIAction.CloseAction -> view.dismiss() } } }) // Get and display the paywall Adapty.getPaywall("YOUR_PLACEMENT_ID") .onSuccess { paywall -> if (!paywall.hasViewConfiguration) { // Use custom logic return@onSuccess } val paywallView = AdaptyUI.createPaywallView(paywall = paywall) paywallView?.present() } .onError { error -> // handle the error } ``` -------------------------------- ### Implement AdaptyUIOnboardingsEventsObserver in Kotlin Source: https://github.com/adaptyteam/adapty-docs/blob/main/src/content/docs/kmp/kmp-handling-onboarding-events.mdx Implement the AdaptyUIOnboardingsEventsObserver interface to handle analytics events during the onboarding flow. This example shows how to track different event types like onboarding started, screen presented, screen completed, and unknown events. ```kotlin import com.adapty.kmp.AdaptyUI import com.adapty.kmp.AdaptyUIOnboardingsEventsObserver import com.adapty.kmp.models.AdaptyOnboardingsAnalyticsEvent import com.adapty.kmp.models.AdaptyOnboardingsAnalyticsEventOnboardingCompleted import com.adapty.kmp.models.AdaptyOnboardingsAnalyticsEventOnboardingStarted import com.adapty.kmp.models.AdaptyOnboardingsAnalyticsEventScreenCompleted import com.adapty.kmp.models.AdaptyOnboardingsAnalyticsEventScreenPresented import com.adapty.kmp.models.AdaptyOnboardingsAnalyticsEventUnknown import com.adapty.kmp.models.AdaptyUIOnboardingView import com.adapty.kmp.models.AdaptyUIOnboardingMeta class MyAdaptyUIOnboardingsEventsObserver : AdaptyUIOnboardingsEventsObserver { override fun onboardingViewOnAnalyticsEvent( view: AdaptyUIOnboardingView, meta: AdaptyUIOnboardingMeta, event: AdaptyOnboardingsAnalyticsEvent ) { when (event) { is AdaptyOnboardingsAnalyticsEventOnboardingStarted -> { // Track onboarding start trackEvent("onboarding_started", event.meta) } is AdaptyOnboardingsAnalyticsEventScreenPresented -> { // Track screen presentation trackEvent("screen_presented", event.meta) } is AdaptyOnboardingsAnalyticsEventScreenCompleted -> { // Track screen completion with user response trackEvent("screen_completed", event.meta, event.elementId, event.reply) } is AdaptyOnboardingsAnalyticsEventOnboardingCompleted -> { // Track successful onboarding completion trackEvent("onboarding_completed", event.meta) } is AdaptyOnboardingsAnalyticsEventUnknown -> { // Handle unknown events trackEvent(event.name, event.meta) } // Handle other cases as needed } } private fun trackEvent(eventName: String, meta: AdaptyUIOnboardingMeta, elementId: String? = null, reply: String? = null) { // Implement your analytics tracking here // For example, send to your analytics service } } // Set up the observer AdaptyUI.setOnboardingsEventsObserver(MyAdaptyUIOnboardingsEventsObserver()) ``` -------------------------------- ### Install Adapty SDK and Prebuild Source: https://github.com/adaptyteam/adapty-docs/blob/main/src/content/docs/version-3.0/sdk-installation-react-native-expo.mdx Install the Adapty SDK and its core module, then prebuild your Expo project. This command ensures native dependencies are correctly linked for development. ```bash npx expo install react-native-adapty npx expo prebuild ``` -------------------------------- ### Install iOS pods Source: https://github.com/adaptyteam/adapty-docs/blob/main/src/content/docs/version-3.0/sdk-installation-react-native-pure.mdx After installing the Adapty SDK, navigate to the 'ios' directory and install the necessary pods for iOS integration. ```sh cd ios && pod install ``` -------------------------------- ### Onboarding Close Event Example Source: https://github.com/adaptyteam/adapty-docs/blob/main/src/content/docs/kmp/kmp-handling-onboarding-events.mdx Example JSON payload for the onboarding close action event. ```json { "action_id": "close_button", "meta": { "onboarding_id": "onboarding_123", "screen_cid": "final_screen", "screen_index": 3, "total_screens": 4 } } ``` -------------------------------- ### Onboarding Loading Completion Event Example Source: https://github.com/adaptyteam/adapty-docs/blob/main/src/content/docs/kmp/kmp-handling-onboarding-events.mdx Example JSON payload for the onboarding loading completion event. ```json { "meta": { "onboarding_id": "onboarding_123", "screen_cid": "welcome_screen", "screen_index": 0, "total_screens": 4 } } ``` -------------------------------- ### Full Paywall Integration Example in React Source: https://github.com/adaptyteam/adapty-docs/blob/main/src/content/docs/capacitor/capacitor-quickstart-paywalls.mdx A comprehensive example demonstrating the complete lifecycle of fetching, configuring, and presenting a paywall within a React component. ```typescript import React from 'react'; import { adapty, createPaywallView } from '@adapty/capacitor'; export default function PaywallScreen() { const showPaywall = async () => { try { const paywall = await adapty.getPaywall({ placementId: 'YOUR_PLACEMENT_ID', }); if (!paywall.hasViewConfiguration) { // use your custom logic return; } const view = await createPaywallView(paywall); view.setEventHandlers({ onUrlPress(url) { window.open(url, '_blank'); return false; }, }); await view.present(); } catch (error) { console.warn('Error showing paywall:', error); } }; return (
); } ``` -------------------------------- ### Install Adapty SDK for Capacitor Source: https://github.com/adaptyteam/adapty-docs/blob/main/src/content/docs/capacitor/sdk-installation-capacitor.mdx Install the Adapty SDK package and sync with Capacitor. This is the initial step for integrating Adapty into your Capacitor application. ```sh npm install @adapty/capacitor npx cap sync ``` -------------------------------- ### Onboarding Paywall Action Event Example Source: https://github.com/adaptyteam/adapty-docs/blob/main/src/content/docs/kmp/kmp-handling-onboarding-events.mdx Example JSON payload for an onboarding paywall action event, where the action ID corresponds to a paywall placement ID. ```json { "action_id": "premium_offer_1", "meta": { "onboarding_id": "onboarding_123", "screen_cid": "pricing_screen", "screen_index": 2, "total_screens": 4 } } ``` -------------------------------- ### Set Up Onboarding Event Observer Source: https://github.com/adaptyteam/adapty-docs/blob/main/src/content/docs/kmp/kmp-handling-onboarding-events.mdx Implement the AdaptyUIOnboardingsEventsObserver interface and set it up with AdaptyUI.setOnboardingsEventsObserver(). This should be done early in your app's lifecycle. ```kotlin import com.adapty.kmp.AdaptyUI import com.adapty.kmp.AdaptyUIOnboardingsEventsObserver // In your app initialization AdaptyUI.setOnboardingsEventsObserver(MyAdaptyUIOnboardingsEventsObserver()) ``` -------------------------------- ### Get Products for Custom Paywall in Flutter Source: https://github.com/adaptyteam/adapty-docs/blob/main/src/content/docs/flutter/flutter-quickstart-manual.mdx Retrieves product information for a custom paywall by first fetching the paywall object using a placement ID, and then obtaining the associated products. This is a prerequisite for displaying products in a custom UI. Requires the Adapty Flutter SDK. ```dart import 'package:adapty_flutter/adapty_flutter.dart'; Future loadPaywall() async { try { final paywall = await Adapty().getPaywall(placementId: 'YOUR_PLACEMENT_ID'); final products = await Adapty().getPaywallProducts(paywall: paywall); // Use products to build your custom paywall UI } on AdaptyError catch (adaptyError) { // Handle the error } catch (e) { // Handle the error } } ``` -------------------------------- ### Install dependencies Source: https://github.com/adaptyteam/adapty-docs/blob/main/src/content/docs/version-3.0/migration-to-flutter-sdk-v3.mdx Run the flutter pub get command to update the project dependencies after modifying the pubspec.yaml file. ```bash flutter pub get ``` -------------------------------- ### Example Onboarding Input Configuration Source: https://github.com/adaptyteam/adapty-docs/blob/main/src/content/docs/ios/ios-onboarding-input.mdx This JSON snippet demonstrates the structure for configuring input fields in an onboarding flow. It includes a profile screen client ID, index, and total count, along with parameters for a date picker. ```json { "screenClientId": "profile_screen", "screenIndex": 0, "screensTotal": 3 }, "params": { "type": "datePicker", "value": { "day": 15, "month": 6, "year": 1990 } } } ``` -------------------------------- ### DKIM DNS Record Example Source: https://github.com/adaptyteam/adapty-docs/blob/main/src/content/docs/version-3.0/mail-sending-domain.mdx Add these CNAME records to your DNS settings to enable DKIM signing for email authentication. The token and value are provided by AWS SES during setup. ```dns Type: CNAME Name: {token}._domainkey.{subdomain} Value: {token}.dkim.amazonses.com ``` -------------------------------- ### Read Adapty SDK Installation Docs Source: https://github.com/adaptyteam/adapty-docs/blob/main/src/content/docs/unity/adapty-cursor-unity.mdx Instruct your LLM to read the specified Adapty documentation before writing any code. This is a crucial step for setting up the Adapty SDK in your Unity project. ```text Read these Adapty docs before writing code: - https://adapty.io/docs/sdk-installation-unity.md ``` -------------------------------- ### Setup Context7 for LLM Access Source: https://github.com/adaptyteam/adapty-docs/blob/main/src/content/docs/android/adapty-cursor-android.mdx Run this command to set up Context7, which provides your LLM with direct access to Adapty documentation. It automatically detects your editor for configuration. ```bash npx ctx7 setup ``` -------------------------------- ### Create Onboarding View in C# Source: https://github.com/adaptyteam/adapty-docs/blob/main/src/content/docs/unity/unity-get-onboardings.mdx Initializes an onboarding view using the AdaptyUI SDK. The result of this method is single-use and must be recreated if needed again to avoid presentation errors. ```csharp AdaptyUI.CreateOnboardingView(onboarding, (view, error) => { // handle the result }); ``` -------------------------------- ### Read Attribution Data in React Native Source: https://github.com/adaptyteam/adapty-docs/blob/main/src/content/docs/version-3.0/ua-attribution-data.mdx Use `addEventListener` for `onInstallationDetailsSuccess` to get installation details. Parses the payload JSON to extract and log attribution data including channel, campaign name, and ad name. Includes basic error handling for parsing. ```typescript adapty.addEventListener('onInstallationDetailsSuccess', details => { try { if (!details.payload) return; const payload = JSON.parse(details.payload); const attribution = payload.attribution; if (!attribution) return; const channel = attribution.channel; const campaignName = attribution.campaign_name; const adName = attribution.ad_name; console.log('Channel:', channel ?? 'organic'); } catch (error) { console.error('Error parsing payload:', error); } }); ``` -------------------------------- ### Update ATT Status in React Native Source: https://github.com/adaptyteam/adapty-docs/blob/main/src/content/docs/react-native/react-native-deal-with-att.mdx This snippet demonstrates how to send the AppTrackingTransparency authorization status to Adapty using the React Native SDK. It requires the `react-native-adapty` library and handles potential errors during the update process. The status should be sent as early as possible when it changes. ```typescript import { AppTrackingTransparencyStatus } from 'react-native-adapty'; try { await adapty.updateProfile({ // you can also pass a string value (validated via tsc) if you prefer appTrackingTransparencyStatus: AppTrackingTransparencyStatus.Authorized, }); } catch (error) { // handle `AdaptyError` } ``` -------------------------------- ### Onboarding Navigation Event Example Source: https://github.com/adaptyteam/adapty-docs/blob/main/src/content/docs/kmp/kmp-handling-onboarding-events.mdx This snippet shows the structure of an onboarding navigation event, including screen client ID, index, and total screens. ```json { "meta": { "onboardingId": "onboarding_123", "screenClientId": "profile_screen", "screenIndex": 1, "screensTotal": 4 } } ``` -------------------------------- ### Restore Purchases in Flutter using Adapty SDK Source: https://github.com/adaptyteam/adapty-docs/blob/main/src/content/docs/flutter/flutter-quickstart-manual.mdx Restores previous purchases for the user, syncing their purchase history with Adapty. This is a requirement for subscription-based apps and ensures users retain access to their entitlements. Returns the updated user profile after the restoration process. Requires the Adapty Flutter SDK. ```dart import 'package:adapty_flutter/adapty_flutter.dart'; Future restorePurchases() async { try { final profile = await Adapty().restorePurchases(); // Restore successful, profile updated } on AdaptyError catch (adaptyError) { // Handle the error } catch (e) { // Handle the error } } ``` -------------------------------- ### Initialize Glassfy SDK Source: https://github.com/adaptyteam/adapty-docs/blob/main/src/content/docs/version-3.0/migration-from-glassfy.mdx Demonstrates the initialization process for the Glassfy SDK across various mobile platforms. This is provided for migration reference purposes. ```swift func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { Glassfy.initialize(apiKey: "YOUR_API_KEY", watcherMode: false) [...] // optionally login your user Glassfy.login(user: "youruser") } ``` ```kotlin class App : Application() { override fun onCreate() { super.onCreate() Glassfy.initialize(this, "YOUR_API_KEY", false, null) } } ``` ```java public class App extends Application { @Override public void onCreate() { super.onCreate(); Glassfy.initialize(this, "YOUR_API_KEY", false, null); } } ``` ```flutter try { await Glassfy.initialize('YOU_API_KEY',watcherMode: false); } catch (e) { // error [...] } ``` ```typescript try { await Glassfy.initialize('YOU_API_KEY', false); } catch (e) { // initialization error } ``` -------------------------------- ### Make Purchase in Flutter with Adapty SDK Source: https://github.com/adaptyteam/adapty-docs/blob/main/src/content/docs/flutter/flutter-quickstart-manual.mdx Initiates a purchase for a selected product within a custom paywall. Handles the entire purchase flow, including user confirmation and app store interactions. Returns the updated user profile upon success or indicates cancellation/pending status. Requires the Adapty Flutter SDK. ```dart import 'package:adapty_flutter/adapty_flutter.dart'; Future purchaseProduct(AdaptyPaywallProduct product) async { try { final purchaseResult = await Adapty().makePurchase(product: product); switch (purchaseResult) { case AdaptyPurchaseResultSuccess(profile: final profile): // Purchase successful, profile updated break; case AdaptyPurchaseResultUserCancelled(): // User canceled the purchase break; case AdaptyPurchaseResultPending(): // Purchase is pending (e.g., user will pay offline with cash) break; } } on AdaptyError catch (adaptyError) { // Handle the error } catch (e) { // Handle the error } } ``` -------------------------------- ### Onboarding Event Examples Source: https://github.com/adaptyteam/adapty-docs/blob/main/src/content/docs/react-native/react-native-handling-onboarding-events.mdx Illustrative JSON payloads for various onboarding events, including `onboardingStarted`, `screenPresented`, `screenCompleted`, `secondScreenPresented`, `userEmailCollected`, and `onboardingCompleted`. These examples show the structure of the `event` and `meta` objects. ```json // onboardingStarted { "name": "onboarding_started", "meta": { "onboarding_id": "onboarding_123", "screen_cid": "welcome_screen", "screen_index": 0, "total_screens": 4 } } ``` ```json // screenPresented { "name": "screen_presented", "meta": { "onboarding_id": "onboarding_123", "screen_cid": "interests_screen", "screen_index": 2, "total_screens": 4 } } ``` ```json // screenCompleted { "name": "screen_completed", "meta": { "onboarding_id": "onboarding_123", "screen_cid": "profile_screen", "screen_index": 1, "total_screens": 4 }, "params": { "element_id": "profile_form", "reply": "success" } } ``` ```json // secondScreenPresented { "name": "second_screen_presented", "meta": { "onboarding_id": "onboarding_123", "screen_cid": "profile_screen", "screen_index": 1, "total_screens": 4 } } ``` ```json // userEmailCollected { "name": "user_email_collected", "meta": { "onboarding_id": "onboarding_123", "screen_cid": "profile_screen", "screen_index": 1, "total_screens": 4 } } ``` ```json // onboardingCompleted { "name": "onboarding_completed", "meta": { "onboarding_id": "onboarding_123", "screen_cid": "final_screen", "screen_index": 3, "total_screens": 4 } } ``` -------------------------------- ### Install Adapty SDK using npm or yarn Source: https://github.com/adaptyteam/adapty-docs/blob/main/src/content/docs/version-3.0/sdk-installation-react-native-pure.mdx Install the Adapty SDK package for your React Native project. This command also installs the core Adapty module automatically. ```sh # using npm npm install react-native-adapty # or using yarn yarn add react-native-adapty ``` -------------------------------- ### Cancelled Purchase Event Example Source: https://github.com/adaptyteam/adapty-docs/blob/main/src/content/docs/unity/unity-handling-events.mdx Example JSON payload for a purchase that was canceled by the user. ```javascript { "product": { "vendorProductId": "premium_monthly", "localizedTitle": "Premium Monthly", "localizedDescription": "Premium subscription for 1 month", "localizedPrice": "$9.99", "price": 9.99, "currencyCode": "USD" }, "purchaseResult": { "type": "UserCancelled" } } ``` -------------------------------- ### Fetch Default Audience Onboarding (C#) Source: https://github.com/adaptyteam/adapty-docs/blob/main/src/content/docs/unity/unity-get-onboardings.mdx Fetches the onboarding for a specified placement for the 'All Users' audience. This method is useful for improving onboarding fetch speed in scenarios with many audiences or slow internet connections. It takes a placement ID and a callback function to handle the onboarding object or any errors. Note that this method does not support personalization and may have compatibility issues with multiple app versions. ```csharp Adapty.GetOnboardingForDefaultAudience("YOUR_PLACEMENT_ID", (onboarding, error) => { if (error != null) { // handle the error return; } // the requested onboarding }); ``` -------------------------------- ### Install Dependencies Source: https://github.com/adaptyteam/adapty-docs/blob/main/src/content/docs/version-3.0/sdk-installation-flutter.mdx After adding the dependency to pubspec.yaml, run this command in your terminal to install all project dependencies. ```bash flutter pub get ``` -------------------------------- ### Handle Deferred Data in Swift Source: https://github.com/adaptyteam/adapty-docs/blob/main/src/content/docs/version-3.0/ua-deferred-data.mdx This Swift code snippet demonstrates how to process installation details and navigate to a welcome screen if the `ios_deferred_data` parameter is set to 'welcome'. It includes parsing the JSON payload and handling navigation on the main thread. ```swift Adapty.delegate = self nonisolated func onInstallationDetailsSuccess(_ details: AdaptyInstallationDetails) { guard let payloadStr = details.payload, let data = payloadStr.data(using: .utf8), let payload = try? JSONSerialization.jsonObject(with: data) as? [String: Any], let deeplink = payload["ios_deferred_data"] as? String, deeplink == "welcome" else { return } DispatchQueue.main.async { print("Navigate to welcome screen") // navigate to your screen here } } ``` -------------------------------- ### List all placements for an app Source: https://github.com/adaptyteam/adapty-docs/blob/main/src/content/docs/developer-cli/developer-cli-reference.mdx Use this command to list all available placements for a given app. It accepts pagination flags. ```bash adapty placements list --app ``` -------------------------------- ### Purchase Event Examples Source: https://github.com/adaptyteam/adapty-docs/blob/main/src/content/docs/android/android-handling-events.mdx Provides JSON examples for successful, canceled, and pending purchase events. ```javascript // Successful purchase { "purchaseResult": { "type": "Success", "profile": { "accessLevels": { "premium": { "id": "premium", "isActive": true, "expiresAt": "2024-02-15T10:30:00Z" } } } }, "product": { "vendorProductId": "premium_monthly", "localizedTitle": "Premium Monthly", "localizedDescription": "Premium subscription for 1 month", "localizedPrice": "$9.99", "price": 9.99, "currencyCode": "USD" } } // Cancelled purchase { "purchaseResult": { "type": "UserCanceled" }, "product": { "vendorProductId": "premium_monthly", "localizedTitle": "Premium Monthly", "localizedDescription": "Premium subscription for 1 month", "localizedPrice": "$9.99", "price": 9.99, "currencyCode": "USD" } } // Pending purchase { "purchaseResult": { "type": "Pending" }, "product": { "vendorProductId": "premium_monthly", "localizedTitle": "Premium Monthly", "localizedDescription": "Premium subscription for 1 month", "localizedPrice": "$9.99", "price": 9.99, "currencyCode": "USD" } } ``` -------------------------------- ### Handle Onboarding Paywall Action in Unity Source: https://github.com/adaptyteam/adapty-docs/blob/main/src/content/docs/unity/unity-handling-onboarding-events.mdx Implement this method to open a paywall from within an onboarding flow. It's recommended to dismiss the onboarding before presenting the paywall to avoid display conflicts. The `actionId` is used to fetch and present the paywall. ```csharp public class OnboardingManager : MonoBehaviour, AdaptyOnboardingsEventsListener { public void OnboardingViewOnPaywallAction( AdaptyUIOnboardingView view, AdaptyUIOnboardingMeta meta, string actionId ) { // Dismiss onboarding before presenting paywall view.Dismiss((dismissError) => { if (dismissError != null) { // handle the error return; } Adapty.GetPaywall(actionId, (paywall, error) => { if (error != null) { // handle the error return; } AdaptyUI.CreatePaywallView(paywall, (paywallView, createError) => { if (createError != null) { // handle the error return; } paywallView.Present((presentError) => { if (presentError != null) { // handle the error } }); }); }); }); } // ... other interface methods } ``` -------------------------------- ### Cancelled Purchase Event Example Source: https://github.com/adaptyteam/adapty-docs/blob/main/src/content/docs/ios/ios-handling-events.mdx An example JSON payload for a cancelled purchase, including product details. ```json // Cancelled purchase { "product": { "vendorProductId": "premium_monthly", "localizedTitle": "Premium Monthly", "localizedDescription": "Premium subscription for 1 month", "localizedPrice": "$9.99", "price": 9.99, "currencyCode": "USD" }, "purchaseResult": { "type": "cancelled" } } ``` -------------------------------- ### LLM Documentation Reference for SDK Installation Source: https://github.com/adaptyteam/adapty-docs/blob/main/src/content/docs/android/adapty-cursor-android.mdx Provide these Adapty documentation links to your LLM when it needs to understand the SDK installation and configuration process for Android. This ensures the LLM has the correct, up-to-date information. ```text Read these Adapty docs before writing code: - https://adapty.io/docs/sdk-installation-android.md ``` -------------------------------- ### Create a Product (iOS + Android) Source: https://github.com/adaptyteam/adapty-docs/blob/main/src/content/docs/developer-cli/developer-cli-quickstart.mdx Use this command to create a new Adapty product that can be sold on both iOS and Android platforms. Ensure you have the necessary store product IDs and base plan IDs. ```bash adapty products create --app --title "My Product" --access-level-id --period monthly --ios-product-id --android-product-id --android-base-plan-id ``` -------------------------------- ### Install Adapty CLI Source: https://github.com/adaptyteam/adapty-docs/blob/main/src/content/docs/developer-cli/developer-cli-quickstart.mdx Install the Adapty CLI globally using npm. Requires Node.js 18 or later. ```bash npm install -g adapty ``` -------------------------------- ### Fetch Onboarding Configuration with Adapty SDK (Kotlin) Source: https://github.com/adaptyteam/adapty-docs/blob/main/src/content/docs/kmp/kmp-get-onboardings.mdx Retrieves an onboarding configuration using the `getOnboarding` method from the Adapty SDK. This method requires a `placementId`, `locale`, and allows for specifying a `fetchPolicy` and `loadTimeout`. It returns a success callback with the paywall object or an error callback. ```kotlin import com.adapty.kmp.Adapty import com.adapty.kmp.models.AdaptyPaywallFetchPolicy Adapty.getOnboarding( placementId = "YOUR_PLACEMENT_ID", locale = "en", fetchPolicy = AdaptyPaywallFetchPolicy.Default, loadTimeout = 5.seconds ).onSuccess { paywall -> // the requested paywall }.onError { error -> // handle the error } ``` -------------------------------- ### Example: Failed Web Payment Navigation Event Source: https://github.com/adaptyteam/adapty-docs/blob/main/src/content/docs/unity/unity-handling-events.mdx An example of the event payload when a web paywall navigation fails. ```javascript { "product": { "vendorProductId": "premium_monthly", "localizedTitle": "Premium Monthly", "localizedDescription": "Premium subscription for 1 month", "localizedPrice": "$9.99", "price": 9.99, "currencyCode": "USD" }, "error": { "code": "wrong_param", "message": "Current method is not available for this product", "details": { "underlyingError": "Product not configured for web purchases" } } } ```