You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a flow includes buttons that request system permissions (push notifications, camera access, and others), the SDK calls your `AdaptySystemRequestsHandler`. You implement this handler to request the permission from the OS and return the result.
8
8
9
+
## When the handler fires
10
+
11
+
The handler is invoked when the user taps a button in the rendered flow that triggers a system permission request. The SDK calls your `handlePermission` method with the permission type, you request the permission from the OS, and return the result — the flow then continues based on whether you returned `.granted` or `.denied`.
12
+
9
13
## Implement AdaptySystemRequestsHandler
10
14
11
15
Create a class that conforms to the `AdaptySystemRequestsHandler` protocol and implement the required `handlePermission` method. Return `.granted(_)` or `.denied(_)` to report the result back to the flow — the associated `String?` carries optional detail (often `nil`).
@@ -85,7 +85,7 @@ You can register only the closure parameters you need and omit those you do not
85
85
86
86
For UIKit apps, events are handled through the `AdaptyFlowControllerDelegate` protocol. See [Display flows & paywalls - iOS](ios-present-paywalls) for how to set up `AdaptyFlowController` with `AdaptyFlowControllerDelegate`.
87
87
88
-
The protocol declares 14 methods. Three of them have no default implementation and must be implemented when conforming: `didFailPurchase`, `didFinishRestoreWith`, and `didFailRestoreWith`. The rest provide default no-op implementations and can be overridden when you want custom behavior. Methods are grouped below by purpose.
88
+
The protocol declares 13 methods. Three of them have no default implementation and must be implemented when conforming: `didFailPurchase`, `didFinishRestoreWith`, and `didFailRestoreWith`. The rest provide default no-op implementations and can be overridden when you want custom behavior. Methods are grouped below by purpose.
89
89
90
90
### Lifecycle
91
91
@@ -201,18 +201,6 @@ func flowController(
201
201
202
202
Invoked after a web payment navigation finishes, whether successful or failed.
203
203
204
-
### Analytic events
205
-
206
-
```swift showLineNumbers title="Swift"
207
-
funcflowController(
208
-
_controller: AdaptyFlowController,
209
-
didReceiveAnalyticEventname: String,
210
-
params: [String: any Sendable]
211
-
) { }
212
-
```
213
-
214
-
Forward custom analytic events fired by the flow's script (e.g. `paywall_opened`, `cta_tapped`) to your analytics provider (Amplitude, Mixpanel, etc.). Only events explicitly marked as customer-facing in the flow configuration are delivered here.
Copy file name to clipboardExpand all lines: src/content/docs/ios/ios-present-paywalls.mdx
+14-9Lines changed: 14 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,20 @@ To get the `AdaptyUI.FlowConfiguration` object used below, see [Get paywalls and
18
18
19
19
### Present as a modal view
20
20
21
-
In order to display a paywall or flow on the device screen as a modal view, use the `.flow` modifier in SwiftUI:
21
+
In order to display a paywall or flow on the device screen as a modal view, use the `.flow` modifier in SwiftUI. The minimal call requires `isPresented`, `flowConfiguration`, and the four required callbacks:
22
+
23
+
```swift showLineNumbers title="SwiftUI"
24
+
.flow(
25
+
isPresented: $flowPresented,
26
+
flowConfiguration: <AdaptyUI.FlowConfiguration>,
27
+
didFailPurchase: { _, _in/* handle the error */ },
28
+
didFinishRestore: { _in/* check access level and dismiss */ },
29
+
didFailRestore: { _in/* handle the error */ },
30
+
didFailRendering: { _in flowPresented =false }
31
+
)
32
+
```
33
+
34
+
For more control, add optional callbacks like `didPerformAction` to handle button taps and `didFinishPurchase` to react to successful purchases:
22
35
23
36
```swift showLineNumbers title="SwiftUI"
24
37
@Statevar flowPresented =false// ensure that you manage this variable state and set it to `true` at the moment you want to show the paywall or flow
Copy file name to clipboardExpand all lines: src/content/docs/ios/ios-quickstart-paywalls.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,7 +43,7 @@ Before you start, complete these steps:
43
43
2.[Create your products](create-product) in Adapty.
44
44
3.[Create a paywall and add products to it](create-paywall).
45
45
4.[Create a placement and add your paywall to it](create-placement).
46
-
5.[Install and activate the Adapty SDK](sdk-installation-ios) in your app code.
46
+
5.[Install and activate the Adapty SDK](sdk-installation-ios) in your app code. This guide uses Adapty iOS SDK v4 (beta) APIs.
47
47
48
48
:::tip
49
49
The fastest way to complete these steps is to follow the [quickstart guide](quickstart) or create paywalls and placements using the [Developer CLI](developer-cli-quickstart).
Adapty iOS SDK 4.0 (beta) introduces a new flow methods alongside the existing paywall methods. The new flow methods work with both the Paywall Builder and the new Flow Builder — no setup changes are required on the Adapty Dashboard side. There are three things to know about the type changes:
7
+
Adapty iOS SDK 4.0 (beta) introduces new flow methods to replace the v3 paywall methods. The new flow methods work with both the Paywall Builder and the new Flow Builder — no setup changes are required on the Adapty Dashboard side. There are three things to know about the type changes:
8
8
9
9
-**`AdaptyFlow` is a new type.** It is a placement that wraps one or more paywalls — the value returned by the new `Adapty.getFlow(placementId:)` method.
10
10
-**`AdaptyPaywall` has been renamed to `AdaptyFlowPaywall`.** Code that previously held a single paywall now holds an `AdaptyFlowPaywall` (the type the SDK returns inside an `AdaptyFlow.paywalls` collection or via flow-builder APIs).
@@ -22,7 +22,7 @@ Adapty iOS SDK 4.0 (beta) introduces a new flow methods alongside the existing p
22
22
23
23
## Replace getPaywall with getFlow
24
24
25
-
Replace `Adapty.getPaywall()` with `Adapty.getFlow()`. The returned type changes from `AdaptyPaywall` to `AdaptyFlow`. The `locale` parameter has been removed.
25
+
Replace `Adapty.getPaywall()` with `Adapty.getFlow()`. The returned type changes from `AdaptyPaywall` to `AdaptyFlow`. The `locale` parameter has moved from the fetch call to `AdaptyUI.getFlowConfiguration(forFlow:locale:)` — see the next section.
26
26
27
27
```diff showLineNumbers
28
28
- let paywall = try await Adapty.getPaywall(
@@ -34,13 +34,22 @@ Replace `Adapty.getPaywall()` with `Adapty.getFlow()`. The returned type changes
34
34
35
35
## Replace getPaywallConfiguration with getFlowConfiguration
36
36
37
-
Replace `AdaptyUI.getPaywallConfiguration(forPaywall:)` with `AdaptyUI.getFlowConfiguration(forFlow:)`. The method now takes an `AdaptyFlow` object instead of `AdaptyPaywall`.
37
+
Replace `AdaptyUI.getPaywallConfiguration(forPaywall:)` with `AdaptyUI.getFlowConfiguration(forFlow:)`. The method now takes an `AdaptyFlow` object instead of `AdaptyPaywall`. Locale handling now lives here — pass it via the `locale:` parameter:
38
38
39
39
```diff showLineNumbers
40
40
- let paywallConfiguration = try await AdaptyUI.getPaywallConfiguration(forPaywall: paywall)
41
41
+ let flowConfiguration = try await AdaptyUI.getFlowConfiguration(forFlow: flow)
42
42
```
43
43
44
+
If you previously passed `locale:` to `getPaywall`, pass it to `getFlowConfiguration` instead:
45
+
46
+
```diff showLineNumbers
47
+
- let paywall = try await Adapty.getPaywall(placementId: "main", locale: "fr")
48
+
- let paywallConfiguration = try await AdaptyUI.getPaywallConfiguration(forPaywall: paywall)
49
+
+ let flow = try await Adapty.getFlow(placementId: "main")
50
+
+ let flowConfiguration = try await AdaptyUI.getFlowConfiguration(forFlow: flow, locale: "fr")
51
+
```
52
+
44
53
## Replace AdaptyPaywallController with AdaptyFlowController (UIKit)
45
54
46
55
Replace `AdaptyPaywallController` with `AdaptyFlowController` and update the factory method name:
@@ -133,13 +142,6 @@ Rename the delegate protocol and update all method signatures. Note that `didSel
|**flow**| required | An `AdaptyFlow` object to obtain a controller for the desired paywall. |
102
+
|**forFlow**| required | An `AdaptyFlow` object obtained via `Adapty.getFlow`. |
103
+
|**locale**| <p>optional</p><p>default: `nil`</p> | The identifier of the [paywall localization](add-paywall-locale-in-adapty-paywall-builder). Expected as a language code with one or two subtags separated by `-` (e.g., `en`, `pt-br`). See [Localizations and locale codes](localizations-and-locale-codes). |
103
104
|**loadTimeout**| default: 5 sec | This value limits the timeout for this method. If the timeout is reached, cached data or local fallback will be returned. Note that in rare cases this method can timeout slightly later than specified in `loadTimeout`, since the operation may consist of different requests under the hood. |
104
105
|**products**| optional | Provide an array of `AdaptyPaywallProduct` objects to optimize the display timing of products on the screen. If `nil` is passed, AdaptyUI will automatically fetch the necessary products. |
0 commit comments