Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Paywalls V2] Remove/replace PAYWALL_COMPONENTS compiler flag and fix OS/platform compile issues #4727

Merged
merged 28 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
281c2a4
We can't just remove PAYWALL_COMPONENT because we don't support macos…
joshdholtz Jan 28, 2025
20a8e04
Move PartialComponent outside of PaywallComponent extension
joshdholtz Jan 28, 2025
f21ff99
Fix some lint errors
joshdholtz Jan 29, 2025
51e68a1
Wrong thing
joshdholtz Jan 29, 2025
54f3151
Undid things i shouldn't have done
joshdholtz Jan 29, 2025
86ebde8
Removed more
joshdholtz Jan 29, 2025
6bbb72d
Added comment
joshdholtz Jan 29, 2025
097248d
Removed/fix some places for the check thingies
joshdholtz Jan 29, 2025
452b032
RevenueCat module compiles on all the things
joshdholtz Jan 29, 2025
755971d
RevenueCatUI compiles in all the platforms now
joshdholtz Jan 29, 2025
69ffbbe
Make all the things compile again
joshdholtz Jan 29, 2025
85d6da1
Make work for visionOS
joshdholtz Jan 29, 2025
6d3164f
Fix some platform and xcode version issues
joshdholtz Jan 29, 2025
4cae4b4
Fix failing spm ios 15 test
joshdholtz Jan 29, 2025
301412b
Undo circleci changes
joshdholtz Jan 29, 2025
1cbadf1
Replace smooth with easeInOut
joshdholtz Jan 29, 2025
4a7aacc
Only run the thing i want
joshdholtz Jan 29, 2025
8e73a28
Attempt to remove circular
joshdholtz Jan 29, 2025
0147679
Explicit returns
joshdholtz Jan 29, 2025
72f88ee
Does this pass
joshdholtz Jan 29, 2025
7f027a2
This is it
joshdholtz Jan 29, 2025
6f7b7af
Swift 5.9 for this
joshdholtz Jan 29, 2025
8181c44
All tests again
joshdholtz Jan 29, 2025
d6852c3
Undid public testing processor stuff
joshdholtz Jan 29, 2025
957ff6e
Undo this too
joshdholtz Jan 29, 2025
1b782cc
Swift compiler check out pill style circular
joshdholtz Jan 29, 2025
7c96e1d
Fixes from PR review
joshdholtz Jan 29, 2025
6ae501b
Fix compile for mac
joshdholtz Jan 29, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions RevenueCat.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,6 @@
4D322E3A2B7E7B570004AF53 /* PurchasesOrchestratorSK1Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D322E392B7E7B570004AF53 /* PurchasesOrchestratorSK1Tests.swift */; };
4D322E3C2B7E7E250004AF53 /* PurchasesOrchestratorCommonTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D322E3B2B7E7E250004AF53 /* PurchasesOrchestratorCommonTests.swift */; };
4D3BA4CC2D37D15E00668AFC /* PaywallTimelineComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D3BA4CB2D37D15E00668AFC /* PaywallTimelineComponent.swift */; };
4D3BA4CD2D37D15E00668AFC /* PaywallTimelineComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D3BA4CB2D37D15E00668AFC /* PaywallTimelineComponent.swift */; };
4D3BA5882D432E5900668AFC /* Fill.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D3BA5872D432E5700668AFC /* Fill.swift */; };
4D3BA5B22D47AB4400668AFC /* TimelineComponentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D3BA5AF2D47AB4400668AFC /* TimelineComponentView.swift */; };
4D3BA5B32D47AB4400668AFC /* TimelineComponentViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D3BA5B02D47AB4400668AFC /* TimelineComponentViewModel.swift */; };
Expand Down Expand Up @@ -6725,7 +6724,6 @@
88A543E12C37A4820039C6A5 /* TemplateView+MultiTier.swift in Sources */,
3523048A2D0A0F30003971A4 /* ErrorView.swift in Sources */,
887A60B72C1D037000E1A461 /* WatchTemplateView.swift in Sources */,
4D3BA4CD2D37D15E00668AFC /* PaywallTimelineComponent.swift in Sources */,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just double checking we want this removed from here, I see in the other change it was duplicated, but I don't see PaywallTimelineComponent in this section?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah yeah! It was added to both RevenueCat and RevenueCatUI targets which was wrong 😅 So I removed the RevenueCatUI one since this file is part of the offerings response codable stuff

But thanks for checking 🙏

887A60722C1D037000E1A461 /* PaywallViewMode+Extensions.swift in Sources */,
887A60C32C1D037000E1A461 /* FooterView.swift in Sources */,
2C7457212CE702BB004ACE52 /* PackageContext.swift in Sources */,
Expand Down
30 changes: 0 additions & 30 deletions RevenueCatUI/PaywallView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,6 @@ public struct PaywallView: View {
countries: offering.paywall?.zeroDecimalPlaceCountries
)

#if PAYWALL_COMPONENTS
if let paywallComponents = offering.paywallComponents {

// For fallback view or footer
Expand Down Expand Up @@ -339,35 +338,6 @@ public struct PaywallView: View {
paywallView
}
}
#else
let (paywall, displayedLocale, template, error) = offering.validatedPaywall(locale: self.locale)

let paywallView = LoadedOfferingPaywallView(
offering: offering,
activelySubscribedProductIdentifiers: activelySubscribedProductIdentifiers,
paywall: paywall,
template: template,
mode: self.mode,
fonts: fonts,
displayCloseButton: self.displayCloseButton,
introEligibility: checker,
purchaseHandler: purchaseHandler,
locale: displayedLocale,
showZeroDecimalPlacePrices: showZeroDecimalPlacePrices
)

if let error {
DebugErrorView(
"\(error.description)\n" +
"You can fix this by editing the paywall in the RevenueCat dashboard.\n" +
"The displayed paywall contains default configuration.\n" +
"This error will be hidden in production.",
replacement: paywallView
)
} else {
paywallView
}
#endif
}

// MARK: -
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import Foundation
import RevenueCat
import SwiftUI

#if PAYWALL_COMPONENTS
#if !os(macOS) && !os(tvOS) // For Paywalls V2

@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
struct ButtonComponentView: View {
Expand Down Expand Up @@ -43,9 +43,12 @@ struct ButtonComponentView: View {
#if canImport(SafariServices) && canImport(UIKit)
.sheet(isPresented: .isNotNil($inAppBrowserURL)) {
SafariView(url: inAppBrowserURL!)
}.presentCustomerCenter(isPresented: $showCustomerCenter) {
showCustomerCenter = false
}
#if os(iOS)
.presentCustomerCenter(isPresented: $showCustomerCenter, onDismiss: {
showCustomerCenter = false
})
#endif
#endif
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import Foundation
import RevenueCat

#if PAYWALL_COMPONENTS
#if !os(macOS) && !os(tvOS) // For Paywalls V2

@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
class ButtonComponentViewModel {
Expand Down
2 changes: 1 addition & 1 deletion RevenueCatUI/Templates/V2/Components/ComponentsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import RevenueCat
import SwiftUI

#if PAYWALL_COMPONENTS
#if !os(macOS) && !os(tvOS) // For Paywalls V2

@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
struct ComponentsView: View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import Foundation
import RevenueCat
import SwiftUI

#if PAYWALL_COMPONENTS
#if !os(macOS) && !os(tvOS) // For Paywalls V2

@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
struct IconComponentView: View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import Foundation
import RevenueCat
import SwiftUI

#if PAYWALL_COMPONENTS
#if !os(macOS) && !os(tvOS) // For Paywalls V2

private typealias PresentedIconPartial = PaywallComponent.PartialIconComponent

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import Foundation
import RevenueCat
import SwiftUI

#if PAYWALL_COMPONENTS
#if !os(macOS) && !os(tvOS) // For Paywalls V2

@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
struct ImageComponentView: View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import Foundation
import RevenueCat
import SwiftUI

#if PAYWALL_COMPONENTS
#if !os(macOS) && !os(tvOS) // For Paywalls V2

@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
class ImageComponentViewModel {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import Foundation
import SwiftUI

#if PAYWALL_COMPONENTS
#if !os(macOS) && !os(tvOS) // For Paywalls V2

enum ComponentViewState {
case `default`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import Foundation
import RevenueCat
import SwiftUI

#if PAYWALL_COMPONENTS
#if !os(macOS) && !os(tvOS) // For Paywalls V2

@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
struct PackageComponentView: View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import Foundation
import RevenueCat

#if PAYWALL_COMPONENTS
#if !os(macOS) && !os(tvOS) // For Paywalls V2

@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
class PackageComponentViewModel {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import Foundation
import RevenueCat
import SwiftUI

#if PAYWALL_COMPONENTS
#if !os(macOS) && !os(tvOS) // For Paywalls V2

@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
struct PurchaseButtonComponentView: View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import Foundation
import RevenueCat
import SwiftUI

#if PAYWALL_COMPONENTS
#if !os(macOS) && !os(tvOS) // For Paywalls V2

@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
class PurchaseButtonComponentViewModel {
Expand Down
2 changes: 1 addition & 1 deletion RevenueCatUI/Templates/V2/Components/Root/RootView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import Foundation
import RevenueCat
import SwiftUI

#if PAYWALL_COMPONENTS
#if !os(macOS) && !os(tvOS) // For Paywalls V2

@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
struct RootView: View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import RevenueCat
import SwiftUI

#if PAYWALL_COMPONENTS
#if !os(macOS) && !os(tvOS) // For Paywalls V2

@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
class RootViewModel {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

import SwiftUI

#if PAYWALL_COMPONENTS
#if !os(macOS) && !os(tvOS) // For Paywalls V2

@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
struct FlexHStack: View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

import SwiftUI

#if PAYWALL_COMPONENTS
#if !os(macOS) && !os(tvOS) // For Paywalls V2

@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
struct FlexVStack: View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import Foundation
import RevenueCat

#if PAYWALL_COMPONENTS
#if !os(macOS) && !os(tvOS) // For Paywalls V2

enum JustifyContent {
case start, center, end, spaceBetween, spaceAround, spaceEvenly
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import SwiftUI

// swiftlint:disable file_length

#if PAYWALL_COMPONENTS
#if !os(macOS) && !os(tvOS) // For Paywalls V2

@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
struct StackComponentView: View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import RevenueCat
import SwiftUI

#if PAYWALL_COMPONENTS
#if !os(macOS) && !os(tvOS) // For Paywalls V2

typealias PresentedStackPartial = PaywallComponent.PartialStackComponent

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import Foundation
import RevenueCat
import SwiftUI

#if PAYWALL_COMPONENTS
#if !os(macOS) && !os(tvOS) // For Paywalls V2

@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
struct StickyFooterComponentView: View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import RevenueCat
import SwiftUI

#if PAYWALL_COMPONENTS
#if !os(macOS) && !os(tvOS) // For Paywalls V2

@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
class StickyFooterComponentViewModel {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import Foundation
import RevenueCat
import SwiftUI

#if PAYWALL_COMPONENTS
#if !os(macOS) && !os(tvOS) // For Paywalls V2

@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
struct TabControlButtonComponentView: View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import RevenueCat
import SwiftUI

#if PAYWALL_COMPONENTS
#if !os(macOS) && !os(tvOS) // For Paywalls V2

@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
class TabControlButtonComponentViewModel {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import Foundation
import RevenueCat
import SwiftUI

#if PAYWALL_COMPONENTS
#if !os(macOS) && !os(tvOS) // For Paywalls V2

@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
struct TabControlComponentView: View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import RevenueCat
import SwiftUI

#if PAYWALL_COMPONENTS
#if !os(macOS) && !os(tvOS) // For Paywalls V2

@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
class TabControlComponentViewModel {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import Foundation
import RevenueCat
import SwiftUI

#if PAYWALL_COMPONENTS
#if !os(macOS) && !os(tvOS) // For Paywalls V2

@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
struct TabControlToggleComponentView: View {
Expand Down Expand Up @@ -83,7 +83,7 @@ private struct CustomToggleStyle: ToggleStyle {
.offset(x: configuration.isOn ? 10 : -10)
)
.onTapGesture {
withAnimation(.smooth(duration: 0.2)) {
withAnimation(.easeInOut(duration: 0.2)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this intended? (Maybe smooth is not supported on older versions?)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah yeah, intended 😊 Had issues with smooth on older OS versions so just moved to easeInOut 🤷‍♂️

configuration.isOn.toggle()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import RevenueCat
import SwiftUI

#if PAYWALL_COMPONENTS
#if !os(macOS) && !os(tvOS) // For Paywalls V2

@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
class TabControlToggleComponentViewModel {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import Foundation
import RevenueCat
import SwiftUI

#if PAYWALL_COMPONENTS
#if !os(macOS) && !os(tvOS) // For Paywalls V2

@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
class TabControlContext: ObservableObject {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import RevenueCat
import SwiftUI

#if PAYWALL_COMPONENTS
#if !os(macOS) && !os(tvOS) // For Paywalls V2

@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
class TabsComponentViewModel {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import Foundation
import RevenueCat
import SwiftUI

#if PAYWALL_COMPONENTS
#if !os(macOS) && !os(tvOS) // For Paywalls V2

@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
struct TextComponentView: View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import RevenueCat
import SwiftUI

#if PAYWALL_COMPONENTS
#if !os(macOS) && !os(tvOS) // For Paywalls V2

@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
class TextComponentViewModel {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import Foundation
import RevenueCat
import SwiftUI

#if PAYWALL_COMPONENTS
#if !os(macOS) && !os(tvOS) // For Paywalls V2

@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
struct TimelineComponentView: View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import Foundation
import RevenueCat

#if PAYWALL_COMPONENTS
#if !os(macOS) && !os(tvOS) // For Paywalls V2

@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
class TimelineComponentViewModel {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import Combine
import RevenueCat

#if PAYWALL_COMPONENTS
#if !os(macOS) && !os(tvOS) // For Paywalls V2

@MainActor
class IntroOfferEligibilityContext: ObservableObject {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import RevenueCat
import SwiftUI

#if PAYWALL_COMPONENTS
#if !os(macOS) && !os(tvOS) // For Paywalls V2

@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
class PackageContext: ObservableObject {
Expand Down
Loading