Skip to content

Commit 60d6b13

Browse files
authored
Paywall Screens Beta (#132)
4.0.0 beta release
1 parent acda368 commit 60d6b13

File tree

61 files changed

+5178
-3777
lines changed

Some content is hidden

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

61 files changed

+5178
-3777
lines changed

ApphudSDK.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'ApphudSDK'
3-
s.version = '3.6.2'
3+
s.version = '4.0.0-beta'
44
s.summary = 'Build and Measure In-App Subscriptions on iOS.'
55
s.description = 'Apphud covers every aspect when it comes to In-App Subscriptions from integration to analytics on iOS and Android.'
66
s.homepage = 'https://github.com/apphud/ApphudSDK'

Examples/ApphudDemoSwift/ApphudSDKDemo/AppDelegate.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,25 +25,27 @@ class AppDelegate: UIResponder, UIApplicationDelegate, @preconcurrency UNUserNot
2525
Apphud.start(apiKey: "YOUR_API_KEY")
2626
Apphud.setDeviceIdentifiers(idfa: nil, idfv: UIDevice.current.identifierForVendor?.uuidString)
2727
fetchIDFA()
28-
28+
29+
Apphud.preloadPaywallScreens(placementIdentifiers: ["MY_PLAYWALL_PLACEMENT_ID", "ANOTHER_PLACEMENT_ID"])
30+
2931
/** Custom User Properties Examples */
3032
Apphud.setUserProperty(key: .email, value: "user@example.com", setOnce: true)
3133
Apphud.setUserProperty(key: .init("custom_prop_1"), value: 0.5)
3234
Apphud.setUserProperty(key: .init("custom_prop_2"), value: true)
3335
Apphud.incrementUserProperty(key: .init("coins_count"), by: 2)
3436
// Apphud.setDelegate(self)
35-
Apphud.setUIDelegate(self)
37+
Apphud.setUIDelegate(self)
3638
registerForNotifications()
3739

3840
return true
3941
}
40-
42+
4143
func registerForNotifications() {
4244
UNUserNotificationCenter.current().delegate = self
4345
UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .badge, .sound]) { (_, _) in }
4446
UIApplication.shared.registerForRemoteNotifications()
4547
}
46-
48+
4749
func fetchIDFA() {
4850
if #available(iOS 14.5, *) {
4951
DispatchQueue.main.asyncAfter(deadline: .now()+2.0) {

Examples/ApphudDemoSwift/ApphudSDKDemo/Helpers/Router.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@
77
//
88

99
import UIKit
10+
import ApphudSDK
1011

1112
@MainActor
1213
class Router: NSObject {
1314

1415
static let shared = Router()
1516

16-
func showRepeatPaywall(_ id: PaywallID, purchaseCallback: @escaping (Bool) -> Void, completion: @escaping () -> Void) {
17+
func showRepeatPaywall(_ id: PlacementID, purchaseCallback: @escaping (Bool) -> Void, completion: @escaping () -> Void) {
1718
let storyBoard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
1819
let paywallRepeatController = storyBoard.instantiateViewController(withIdentifier: "PaywallViewController") as! PaywallViewController
1920
paywallRepeatController.purchaseCallback = purchaseCallback

Examples/ApphudDemoSwift/ApphudSDKDemo/PaywallViewController.swift

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import ApphudSDK
1111
import StoreKit
1212
import SwiftUI
1313

14-
enum PaywallID: String {
15-
case main // should be equal to identifier in your Apphud > Paywalls
14+
enum PlacementID: String {
15+
case main // should be equal to identifier in your Apphud > Placements
1616
case onboarding
1717
}
1818

@@ -52,7 +52,7 @@ class PaywallViewController: UIViewController {
5252

5353
private func loadPaywalls() async {
5454
let placements = await Apphud.placements()
55-
let placement = placements.first(where: { $0.identifier == PaywallID.onboarding.rawValue }) ?? placements.first
55+
let placement = placements.first(where: { $0.identifier == PlacementID.onboarding.rawValue }) ?? placements.first
5656
if let paywall = placement?.paywall {
5757
self.handlePaywallReady(paywall: paywall)
5858
}
@@ -103,8 +103,6 @@ class PaywallViewController: UIViewController {
103103
override func viewDidDisappear(_ animated: Bool) {
104104
super.viewDidDisappear(animated)
105105

106-
// send Apphud log, that your paywall closed
107-
self.paywall.map { Apphud.paywallClosed($0) }
108106
dismissCompletion?()
109107
}
110108

@@ -175,13 +173,13 @@ class PaywallViewController: UIViewController {
175173
}
176174
}))
177175
sheet.addAction(UIAlertAction(title: "Cancel", style: .cancel))
178-
176+
179177
if let popoverController = sheet.popoverPresentationController {
180178
popoverController.sourceView = self.view // The view containing the anchor rectangle for the popover.
181179
popoverController.sourceRect = CGRect(x: self.view.bounds.midX, y: self.view.bounds.midY, width: 0, height: 0) // The rectangle in the specified view in which to anchor the popover.
182180
popoverController.permittedArrowDirections = [] // Optional: No arrow or specify direction
183181
}
184-
182+
185183
present(sheet, animated: true)
186184
}
187185
}

Examples/ApphudDemoSwift/Pods/Pods.xcodeproj/project.pbxproj

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

Examples/ApphudDemoSwiftUI/AppDelegate.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ class AppDelegate: NSObject, UIApplicationDelegate, @preconcurrency UNUserNotifi
4141
UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .badge, .sound]) { _, _ in }
4242
UIApplication.shared.registerForRemoteNotifications()
4343
}
44-
44+
4545
func fetchIDFA() {
4646
DispatchQueue.main.asyncAfter(deadline: .now()+2.0) {
4747
if #available(iOS 14.5, *) {
4848
ATTrackingManager.requestTrackingAuthorization { status in
4949
guard status == .authorized else {return}
5050
let idfa = ASIdentifierManager.shared().advertisingIdentifier.uuidString
51-
51+
5252
Apphud.setDeviceIdentifiers(idfa: idfa, idfv: UIDevice.current.identifierForVendor?.uuidString)
5353
}
5454
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
PODS:
2-
- ApphudSDK (3.3.2)
2+
- ApphudSDK (3.7.0)
33

44
DEPENDENCIES:
55
- ApphudSDK (from `../../`)
@@ -9,8 +9,8 @@ EXTERNAL SOURCES:
99
:path: "../../"
1010

1111
SPEC CHECKSUMS:
12-
ApphudSDK: 3d344e67b3c9d77ad50118fc18f1dab894b47b6f
12+
ApphudSDK: 5836a9fde7d5f166d63da441620d85abfd5be837
1313

1414
PODFILE CHECKSUM: 4b9915c3556364dfea2be629bb16d3499b9ecc2d
1515

16-
COCOAPODS: 1.15.2
16+
COCOAPODS: 1.16.2

Examples/ApphudDemoSwiftUI/Pods/Local Podspecs/ApphudSDK.podspec.json

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

Examples/ApphudDemoSwiftUI/Pods/Manifest.lock

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

0 commit comments

Comments
 (0)