Skip to content

Commit e8f14f1

Browse files
authored
Merge pull request #435 from superwall/develop
4.13.0
2 parents 309e0cc + dba80c3 commit e8f14f1

File tree

64 files changed

+4687
-4047
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+4687
-4047
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@
22

33
The changelog for `SuperwallKit`. Also see the [releases](https://github.com/superwall/Superwall-iOS/releases) on GitHub.
44

5+
## 4.13.0
6+
7+
### Enhancements
8+
9+
- Adds support for local images and videos in paywalls.
10+
- Schedules trial notifications after purchasing Stripe products.
11+
12+
### Fixes
13+
14+
- Fixes race condition relating to the user ID when upgrading from v3 of the SDK to v4.
15+
- Fixes issue where the Superscript version hadn't been upgraded to 1.0.13 if installed via CocoaPods.
16+
517
## 4.12.11
618

719
### Enhancements

Examples/Advanced/Advanced.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Examples/Advanced/Advanced/Info.plist

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
<key>CFBundleURLTypes</key>
66
<array>
77
<dict>
8+
<key>CFBundleTypeRole</key>
9+
<string>Editor</string>
810
<key>CFBundleURLName</key>
9-
<string>com.superwall.SuperwallSwiftUIExample</string>
11+
<string>com.superwall.Advanced</string>
1012
<key>CFBundleURLSchemes</key>
1113
<array>
1214
<string>exampleapp</string>

Examples/Advanced/Advanced/WelcomeView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ struct WelcomeView: View {
7070
@ViewBuilder
7171
private func logInButton() -> some View {
7272
BrandedButton(title: "Log In") {
73-
Superwall.shared.identify(userId: "678")
73+
Superwall.shared.identify(userId: "789")
7474
Superwall.shared.setUserAttributes(["firstName": name])
7575
isLoggedIn = true
7676
}

Examples/Basic/Basic/WelcomeView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ struct WelcomeView: View {
7070
@ViewBuilder
7171
private func logInButton() -> some View {
7272
BrandedButton(title: "Log In") {
73-
Superwall.shared.identify(userId: "678")
73+
Superwall.shared.identify(userId: "789")
7474
Superwall.shared.setUserAttributes(["firstName": name])
7575
isLoggedIn = true
7676
}

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2025 Nest22
3+
Copyright (c) 2026 Nest22
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

Sources/SuperwallKit/Config/Models/Config.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ struct Config: Codable, Equatable {
129129

130130
try featureFlags.encode(to: encoder)
131131
try container.encodeIfPresent(requestId, forKey: .requestId)
132+
try container.encodeIfPresent(web2appConfig, forKey: .web2appConfig)
133+
try container.encodeIfPresent(iosAppId, forKey: .iosAppId)
132134
}
133135

134136
init(

Sources/SuperwallKit/Config/Options/SuperwallOptions.swift

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,26 @@ public final class SuperwallOptions: NSObject, Encodable {
1717
/// Configures the appearance and behaviour of paywalls.
1818
public var paywalls = PaywallOptions()
1919

20+
/// A mapping of local resource IDs to local file URLs.
21+
///
22+
/// Use this to serve paywall assets (images, videos, Lottie animations) from local files
23+
/// instead of fetching them over the network. When a paywall references a `localResourceId`,
24+
/// the SDK will look up the corresponding URL in this dictionary and serve the file via the
25+
/// `swlocal://` URL scheme.
26+
///
27+
/// Set this before calling ``Superwall/configure(apiKey:purchaseController:options:completion:)-52tke``
28+
/// to ensure resources are available before any paywall can trigger (e.g. on `app_launch`).
29+
///
30+
/// ```swift
31+
/// let options = SuperwallOptions()
32+
/// options.localResources = [
33+
/// "hero-video": Bundle.main.url(forResource: "onboarding", withExtension: "mp4")!,
34+
/// "hero-image": Bundle.main.url(forResource: "hero", withExtension: "png")!
35+
/// ]
36+
/// Superwall.configure(apiKey: "your-api-key", options: options)
37+
/// ```
38+
public var localResources: [String: URL] = [:]
39+
2040
/// An enum representing the StoreKit versions the SDK should use.
2141
@objc(SWKStoreKitVersion)
2242
public enum StoreKitVersion: Int, Encodable, CustomStringConvertible {
@@ -134,7 +154,7 @@ public final class SuperwallOptions: NSObject, Encodable {
134154
case .local:
135155
return "localhost:3000"
136156
case .custom:
137-
return hostDomain
157+
return "collector.superwall.dev"
138158
default:
139159
return "collector.\(hostDomain)"
140160
}

Sources/SuperwallKit/Debug/DebugViewController.swift

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,12 @@ final class DebugViewController: UIViewController {
7979
let button = SWBounceButton()
8080
button.setTitle("", for: .normal)
8181
button.titleLabel?.font = UIFont.boldSystemFont(ofSize: 14)
82+
button.titleLabel?.numberOfLines = 0
83+
button.titleLabel?.lineBreakMode = .byWordWrapping
84+
button.titleLabel?.textAlignment = .center
8285
button.backgroundColor = lightBackgroundColor
8386
button.setTitleColor(primaryColor, for: .normal)
84-
button.contentEdgeInsets = UIEdgeInsets(top: 0, left: 10, bottom: 0, right: 10)
87+
button.contentEdgeInsets = UIEdgeInsets(top: 6, left: 10, bottom: 6, right: 10)
8588
button.translatesAutoresizingMaskIntoConstraints = false
8689
button.imageView?.tintColor = primaryColor
8790
button.layer.cornerRadius = 10
@@ -346,12 +349,18 @@ final class DebugViewController: UIViewController {
346349
@objc func pressedConsoleButton() {
347350
let releaseVersionNumber = Bundle.main.releaseVersionNumber ?? ""
348351
let buildVersionNumber = Bundle.main.buildVersionNumber ?? ""
352+
let localResourceCount = Superwall.shared.options.localResources.count
349353
presentAlert(
350354
title: nil,
351355
message: "Superwall v\(sdkVersion) | App v\(releaseVersionNumber) (\(buildVersionNumber))",
352356
options: [
353357
AlertOption(title: "Localization", action: showLocalizationPicker, style: .default),
354-
AlertOption(title: "Templates", action: showConsole, style: .default)
358+
AlertOption(title: "Templates", action: showConsole, style: .default),
359+
AlertOption(
360+
title: "Local Resources (\(localResourceCount))",
361+
action: showLocalResources,
362+
style: .default
363+
)
355364
],
356365
on: consoleButton
357366
)
@@ -396,6 +405,12 @@ final class DebugViewController: UIViewController {
396405
await present(navController, animated: true)
397406
}
398407

408+
func showLocalResources() async {
409+
let viewController = SWLocalResourcesViewController()
410+
let navController = UINavigationController(rootViewController: viewController)
411+
await present(navController, animated: true)
412+
}
413+
399414
@objc func pressedBottomButton() {
400415
presentAlert(
401416
title: nil,

0 commit comments

Comments
 (0)