From bf865d59c050831876b0edfc07e8f27629bb4a61 Mon Sep 17 00:00:00 2001 From: Liudmila Nemkova Date: Thu, 21 Nov 2024 13:20:46 +0100 Subject: [PATCH 1/2] update --- versioned_docs/version-3.0/migration-to-adapty-sdk-v3.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versioned_docs/version-3.0/migration-to-adapty-sdk-v3.md b/versioned_docs/version-3.0/migration-to-adapty-sdk-v3.md index 1ac4da9..74298ba 100644 --- a/versioned_docs/version-3.0/migration-to-adapty-sdk-v3.md +++ b/versioned_docs/version-3.0/migration-to-adapty-sdk-v3.md @@ -230,7 +230,7 @@ You only need to configure the Adapty SDK once, typically at the start of your a 1. Remove the AdaptyUI SDK import from your application as follows: - ```dart title="Dart" + ```diff import 'package:adapty_flutter/adapty_flutter.dart'; - import 'package:adapty_ui_flutter/adapty_ui_flutter.dart'; ``` From 0b78a640a81d8f44ec1a4b76797f5d2d703f568d Mon Sep 17 00:00:00 2001 From: Liudmila Nemkova Date: Thu, 21 Nov 2024 13:32:32 +0100 Subject: [PATCH 2/2] Added old version of Flutter --- .../version-3.0/migration-to-adapty-sdk-v3.md | 7 +- .../version-3.0/sdk-installation-flutter.md | 170 ++++++++++++++++-- 2 files changed, 156 insertions(+), 21 deletions(-) diff --git a/versioned_docs/version-3.0/migration-to-adapty-sdk-v3.md b/versioned_docs/version-3.0/migration-to-adapty-sdk-v3.md index 74298ba..1a08426 100644 --- a/versioned_docs/version-3.0/migration-to-adapty-sdk-v3.md +++ b/versioned_docs/version-3.0/migration-to-adapty-sdk-v3.md @@ -208,7 +208,8 @@ Please note that the AdaptyUI library is deprecated and is now included as part ```diff dependencies: - adapty_flutter: ^3.2.1 + + adapty_flutter: ^3.2.1 + - adapty_flutter: ^2.10.3 - adapty_ui_flutter: ^2.1.3 ``` @@ -220,9 +221,9 @@ Please note that the AdaptyUI library is deprecated and is now included as part ## Configure Adapty SDKs -Previously, you needed to create `Adapty-Info.plist` and `AndroidManifest.xml` files and add them to your project for Adapty SDK configuration. +Previously, you needed to use `Adapty-Info.plist` and `AndroidManifest.xml` files for Adapty SDK configuration. -Now, there’s no need to create additional files. Instead, you can provide all required parameters during activation. +Now, there’s no need to use additional files. Instead, you can provide all required parameters during activation. You only need to configure the Adapty SDK once, typically at the start of your app’s lifecycle. diff --git a/versioned_docs/version-3.0/sdk-installation-flutter.md b/versioned_docs/version-3.0/sdk-installation-flutter.md index dc4387e..50ccdc3 100644 --- a/versioned_docs/version-3.0/sdk-installation-flutter.md +++ b/versioned_docs/version-3.0/sdk-installation-flutter.md @@ -4,6 +4,11 @@ description: "Discover step-by-step instructions for installing and configuring metadataTitle: "Flutter - Adapty SDK Installation and Configuration Guide" --- +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + + + Adapty SDK includes two key modules for seamless integration into your mobile app: - **Core Adapty**: This essential SDK is required for Adapty to function properly in your app. @@ -45,20 +50,20 @@ You only need to configure the Adapty SDK once, typically early in your app's li 2. Activate Adapty SDK with the following code: - ```dart title="Dart" - try { - await Adapty().activate( - configuration: AdaptyConfiguration(apiKey: 'YOUR_API_KEY') - ..withLogLevel(AdaptyLogLevel.debug) - ..withObserverMode(false) - ..withCustomerUserId(null) - ..withIpAddressCollectionDisabled(false) - ..withIdfaCollectionDisabled(false), - ); - } catch (e) { - // handle the error - } - ``` + ```dart title="Dart" + try { + await Adapty().activate( + configuration: AdaptyConfiguration(apiKey: 'YOUR_API_KEY') + ..withLogLevel(AdaptyLogLevel.debug) + ..withObserverMode(false) + ..withCustomerUserId(null) + ..withIpAddressCollectionDisabled(false) + ..withIdfaCollectionDisabled(false), + ); + } catch (e) { + // handle the error + } + ``` Parameters: @@ -76,7 +81,6 @@ Parameters: You need to configure the AdaptyUI module only if you plan to use [Paywall Builder](display-pb-paywalls) and have [installed AdaptyUI module](sdk-installation-ios#install-sdks-via-cocoapods): ```dart title="Dart" - try { final mediaCache = AdaptyUIMediaCacheConfiguration( memoryStorageTotalCostLimit: 100 * 1024 * 1024, // 100MB @@ -103,8 +107,138 @@ Parameters: | **memoryStorageCountLimit** | required | The item count limit of the memory storage. | | **diskStorageSizeLimit** | required | The file size limit on disk of the storage in bytes. 0 means no limit. | + + +Adapty comprises two crucial SDKs for seamless integration into your mobile app: + +- Core **AdaptySDK**: This is a fundamental, mandatory SDK necessary for the proper functioning of Adapty within your app. +- **AdaptyUI SDK**: This optional SDK becomes necessary if you use the Adapty Paywall builder: a user-friendly, no-code tool for easily creating cross-platform paywalls. These paywalls are built in a visual constructor right in our dashboard, run entirely natively on the device, and require minimal effort from you to create something that performs well. + +Please consult the compatibility table below to choose the correct pair of Adapty SDK and AdaptyUI SDK. + +| Adapty SDK version | AdaptyUI SDK version | +| :----------------- | :------------------- | +| 2.9.3 | 2.1.0 | +| 2.10.0 | 2.1.1 | +| 2.10.1 | 2.1.2 | +| 2.10.3 | 2.1.3 | + +## Install Adapty SDKs + +1. Add Adapty and AdaptyUI to your `pubspec.yaml` file: + + ```yaml title="pubspec.yaml" + dependencies: + adapty_flutter: ^2.10.3 + adapty_ui_flutter: ^2.1.3 + ``` + +2. Run: + + ```bash title="Bash" + flutter pub get + ``` + +3. Import Adapty SDKs in your application in the following way: + + ```dart title="Dart" + import 'package:adapty_flutter/adapty_flutter.dart'; + import 'package:adapty_ui_flutter/adapty_ui_flutter.dart'; + ``` + +## Configure Adapty SDKs + +The configuration of the Adapty SDK for Flutter slightly differs depending on the mobile operating system (iOS or Android) you are going to release it for. + +### Configure Adapty SDKs for iOS + +Create `Adapty-Info.plist` and add it to your project. Add the flag `AdaptyPublicSdkKey` in this file with the value of your Public SDK key. + +```xml title="Adapty-Info.plist" + + AdaptyPublicSdkKey + PUBLIC_SDK_KEY + AdaptyObserverMode + + +``` + +Parameters: + +| Parameter | Presence | Description | +| -------------------------- | -------- | ------------------------------------------------------------ | +| **AdaptyPublicSdkKey** | required | The key you can find in the **Public SDK key** field of your app settings in Adapty: [**App settings**-> **General** tab -> **API keys** subsection](https://app.adapty.io/settings/general) | +| **AdaptyObserverMode** | optional |

A boolean value controlling [Observer mode](observer-vs-full-mode). Turn it on if you handle purchases and subscription status yourself and use Adapty for sending subscription events and analytics. At any purchase or restore in your application, you'll need to call `.restorePurchases()` method to record the action in Adapty. The default value is `false`.

🚧 When running in Observer mode, Adapty SDK won't close any transactions, so make sure you're handling it.

| +| **idfaCollectionDisabled** | optional |

A boolean parameter, that allows you to disable IDFA collection for your iOS app. The default value is `false`.

For more details, refer to the [Analytics integration](analytics-integration#disable-collection-of-idfa) section.

| + +### Configure Adapty SDKs for Android + +1. Add the `AdaptyPublicSdkKey` flag into the app’s `AndroidManifest.xml` \(Android) file with the value of your Public SDK key. + + ```xml title="AndroidManifest.xml" + + ... + + + + ``` + + Required parameters: + +| Parameter | Presence | Description | +| ---------------------------- | -------- | ------------------------------------------------------------ | +| PUBLIC_SDK_KEY | required |

Contents of the **Public SDK key** field in the [**App Settings** -> **General** tab](https://app.adapty.io/settings/general) in the Adapty Dashboard. **SDK keys** are unique for every app, so if you have multiple apps make sure you choose the right one.

Make sure you use the **Public SDK key** for Adapty initialization, since the **Secret key** should be used for [server-side API](getting-started-with-server-side-api) only.

| +| AdaptyObserverMode | optional |

A boolean value that is controlling [Observer mode](observer-vs-full-mode) . Turn it on if you handle purchases and subscription status yourself and use Adapty for sending subscription events and analytics.

The default value is `false`.

🚧 When running in Observer mode, Adapty SDK won't close any transactions, so make sure you're handling it.

| +| AdaptyIDFACollectionDisabled | optional |

A boolean parameter, that allows you to disable IDFA collection for your app. The default value is `false`.

For more details, refer to the [Analytics integration](analytics-integration#disable-collection-of-idfa) section.

| + + + +2. In your application, add: + + ```javascript title="Flutter" + import 'package:adapty_flutter/adapty_flutter.dart'; + ``` + +3. Activate Adapty SDK with the following code: + + ```javascript title="Flutter" + try { + Adapty().activate(); + } on AdaptyError catch (adaptyError) {} + } catch (e) {} + ``` + +Please keep in mind that for paywalls and products to be displayed in your mobile application, and for analytics to work, you need to [display the paywalls](display-pb-paywalls) and, if you're using paywalls not created with the Paywall Builder, [handle the purchase process](making-purchases) within your app. + +### Set up the logging system + +Adapty logs errors and other crucial information to provide insight into your app's functionality. There are the following available levels: + +| Level | Description | +| :------ | :----------------------------------------------------------- | +| error | Only errors will be logged. | +| warn | Errors and messages from the SDK that do not cause critical errors, but are worth paying attention to will be logged. | +| info | Errors, warnings, and serious information messages, such as those that log the lifecycle of various modules will be logged. | +| verbose | Any additional information that may be useful during debugging, such as function calls, API queries, etc. will be logged. | + +You can set `logLevel` in your app before configuring Adapty. + +```javascript title="Flutter" +try { + await Adapty().setLogLevel(AdaptyLogLevel.verbose); +} on AdaptyError catch (adaptyError) { +} catch (e) {} +``` + +
+ :::danger -Read the checklist before releasing your app +Read checklist before releasing the app + +Before releasing your application, go through the [Release Checklist](release-checklist) to ensure that you have completed all the steps, and also check the success of the integration using the criteria for assessing its success. +::: -Before launching your app, make sure to go through the [Release Checklist](release-checklist) to confirm all steps are completed. Additionally, evaluate the integration's success using the provided criteria. -::: \ No newline at end of file