diff --git a/content/docs/ios/changelog.mdx b/content/docs/ios/changelog.mdx index 74fd9f80..83259fa4 100644 --- a/content/docs/ios/changelog.mdx +++ b/content/docs/ios/changelog.mdx @@ -3,6 +3,18 @@ title: "Changelog" description: "Release notes for the Superwall iOS SDK" --- +## 4.15.1 + +### Enhancements + +- Adds an `onCustomCallback` parameter to `getPaywall`. +- `SuperwallOptions.localResources` now accepts UIImage's from xcasset files, e.g. `UIImage(named: "my-image")`. +- Exposes abandoned transaction product params in audience filters. + +### Fixes + +- Sanitizes email user attribute. + ## 4.15.0 ### Enhancements diff --git a/content/docs/ios/index.mdx b/content/docs/ios/index.mdx index e97b9368..a8a0d636 100644 --- a/content/docs/ios/index.mdx +++ b/content/docs/ios/index.mdx @@ -50,6 +50,6 @@ If you have feedback on any of our docs, please leave a rating and message at th If you have any issues with the SDK, please [open an issue on GitHub](https://github.com/superwall/superwall-ios/issues). diff --git a/content/docs/ios/sdk-reference/SuperwallOptions.mdx b/content/docs/ios/sdk-reference/SuperwallOptions.mdx index 92d05b0f..324389b5 100644 --- a/content/docs/ios/sdk-reference/SuperwallOptions.mdx +++ b/content/docs/ios/sdk-reference/SuperwallOptions.mdx @@ -29,7 +29,7 @@ public final class SuperwallOptions: NSObject { public var localeIdentifier: String? public var shouldBypassAppTransactionCheck: Bool public var testModeBehavior: TestModeBehavior - public var localResources: [String: URL] + public var localResources: [String: AssetResource] } ``` @@ -73,9 +73,9 @@ public final class SuperwallOptions: NSObject { default: ".automatic", }, localResources: { - type: "[String: URL]", + type: "[String: AssetResource]", description: - "A dictionary mapping resource IDs to local file URLs. See [`localResources`](/ios/sdk-reference/localResources) for the property schema and the [Local Resources guide](/ios/guides/local-resources) for setup details.", + "A dictionary mapping resource IDs to local file URLs or asset catalog images. See [`localResources`](/ios/sdk-reference/localResources) for the property schema and the [Local Resources guide](/ios/guides/local-resources) for setup details.", default: "[:]", }, }} diff --git a/content/docs/ios/sdk-reference/advanced/getPaywall.mdx b/content/docs/ios/sdk-reference/advanced/getPaywall.mdx index 16f98c71..7de38e54 100644 --- a/content/docs/ios/sdk-reference/advanced/getPaywall.mdx +++ b/content/docs/ios/sdk-reference/advanced/getPaywall.mdx @@ -22,7 +22,8 @@ public func getPaywall( forPlacement placement: String, params: [String: Any]? = nil, paywallOverrides: PaywallOverrides? = nil, - delegate: PaywallViewControllerDelegate + delegate: PaywallViewControllerDelegate, + onCustomCallback: ((CustomCallback) async -> CustomCallbackResult)? = nil ) async throws -> PaywallViewController // Completion handler version @@ -31,6 +32,7 @@ public func getPaywall( params: [String: Any]? = nil, paywallOverrides: PaywallOverrides? = nil, delegate: PaywallViewControllerDelegate, + onCustomCallback: ((CustomCallback) async -> CustomCallbackResult)? = nil, completion: @escaping (PaywallViewController?, PaywallSkippedReason?, Error?) -> Void ) ``` @@ -58,6 +60,11 @@ public func getPaywall( description: "A delegate to handle user interactions with the retrieved PaywallViewController.", required: true, }, + onCustomCallback: { + type: "((CustomCallback) async -> CustomCallbackResult)?", + description: "Optional async handler called when the paywall requests a custom callback. Return a `CustomCallbackResult` to report success or failure back to the paywall. Available in version 4.15.1+.", + default: "nil", + }, completion: { type: "@escaping (PaywallViewController?, PaywallSkippedReason?, Error?) -> Void", description: "Completion block for the callback version.", @@ -79,7 +86,15 @@ Task { let paywallViewController = try await Superwall.shared.getPaywall( forPlacement: "premium_feature", params: ["source": "settings"], - delegate: self + delegate: self, + onCustomCallback: { callback in + switch callback.name { + case "validate_email": + return .success(data: ["validated": true]) + default: + return .failure() + } + } ) present(paywallViewController, animated: true) @@ -95,7 +110,10 @@ Using completion handler: ```swift Superwall.shared.getPaywall( forPlacement: "premium_feature", - delegate: self + delegate: self, + onCustomCallback: { callback in + .success(data: ["callback": callback.name]) + } ) { paywall, skippedReason, error in if let paywall = paywall { present(paywall, animated: true) @@ -105,4 +123,4 @@ Superwall.shared.getPaywall( print("Error: \(error)") } } -``` \ No newline at end of file +``` diff --git a/content/docs/ios/sdk-reference/index.mdx b/content/docs/ios/sdk-reference/index.mdx index 967a39ad..e126270a 100644 --- a/content/docs/ios/sdk-reference/index.mdx +++ b/content/docs/ios/sdk-reference/index.mdx @@ -16,6 +16,6 @@ If you have feedback on any of our docs, please leave a rating and message at th If you have any issues with the SDK, please [open an issue on GitHub](https://github.com/superwall/superwall-ios/issues). diff --git a/content/docs/ios/sdk-reference/localResources.mdx b/content/docs/ios/sdk-reference/localResources.mdx index 160353e0..12fbd969 100644 --- a/content/docs/ios/sdk-reference/localResources.mdx +++ b/content/docs/ios/sdk-reference/localResources.mdx @@ -1,20 +1,16 @@ --- title: "localResources" -description: "Register local file URLs so paywalls can load bundled media by resource ID." +description: "Register local resources so paywalls can load bundled media by resource ID." --- - -Available in iOS SDK `4.13.0+`. - - ## Purpose -`localResources` maps resource IDs to local file URLs so paywalls can request bundled media with `swlocal://resource-id` instead of downloading them from a remote URL. +`localResources` maps resource IDs to local resources so paywalls can request bundled media with `swlocal://resource-id` instead of downloading them from a remote URL. Values can be file `URL`s or `UIImage`s from asset catalogs. ## Signature ```swift -public var localResources: [String: URL] +public var localResources: [String: AssetResource] ``` ## Schema @@ -27,8 +23,8 @@ public var localResources: [String: URL] required: true, }, value: { - type: "URL", - description: "A local file URL from your app bundle or sandbox.", + type: "AssetResource", + description: "A local file `URL` from your app bundle or sandbox, or a `UIImage` from an asset catalog.", required: true, }, }} diff --git a/content/shared/local-resources.mdx b/content/shared/local-resources.mdx index c1a4b54e..f77908ea 100644 --- a/content/shared/local-resources.mdx +++ b/content/shared/local-resources.mdx @@ -28,6 +28,7 @@ On iOS, local resources are configured on `SuperwallOptions.localResources` befo let options = SuperwallOptions() options.localResources = [ "hero-image": Bundle.main.url(forResource: "hero", withExtension: "png")!, + "logo": UIImage(named: "Logo")!, "onboarding-video": Bundle.main.url(forResource: "welcome", withExtension: "mp4")! ]