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: fixed tvOS compilation by making it explicitly unavailable #2956

Merged
merged 1 commit into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions RevenueCatUI/Helpers/PaywallData+Default.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ private extension PaywallData {
@available(iOS 16.0, macOS 13.0, tvOS 16.0, *)
@available(watchOS, unavailable)
@available(macOS, unavailable)
@available(tvOS, unavailable)
@available(macCatalyst, unavailable)
struct DefaultPaywall_Previews: PreviewProvider {

Expand Down
1 change: 1 addition & 0 deletions RevenueCatUI/Helpers/PreviewHelpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ enum PreviewHelpers {
/// ```
@available(iOS 16.0, macOS 13.0, tvOS 16.0, *)
@available(macOS, unavailable)
@available(tvOS, unavailable)
struct PreviewableTemplate<T: TemplateViewType>: View {

typealias Creator = @Sendable @MainActor (TemplateViewConfiguration) -> T
Expand Down
3 changes: 3 additions & 0 deletions RevenueCatUI/PaywallView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import SwiftUI
@available(iOS 16.0, macOS 13.0, tvOS 16.0, *)
@available(watchOS, unavailable, message: "RevenueCatUI does not support watchOS yet")
@available(macOS, unavailable, message: "RevenueCatUI does not support macOS yet")
@available(tvOS, unavailable, message: "RevenueCatUI does not support tvOS yet")
@available(macCatalyst, unavailable, message: "RevenueCatUI does not support Catalyst yet")
public struct PaywallView: View {

Expand Down Expand Up @@ -136,6 +137,7 @@ public struct PaywallView: View {
}

@available(iOS 16.0, macOS 13.0, tvOS 16.0, *)
@available(tvOS, unavailable)
struct LoadedOfferingPaywallView: View {

private let offering: Offering
Expand Down Expand Up @@ -220,6 +222,7 @@ private extension PaywallViewMode {
@available(iOS 16.0, macOS 13.0, tvOS 16.0, *)
@available(watchOS, unavailable)
@available(macOS, unavailable)
@available(tvOS, unavailable)
@available(macCatalyst, unavailable)
struct PaywallView_Previews: PreviewProvider {

Expand Down
3 changes: 3 additions & 0 deletions RevenueCatUI/Templates/MultiPackageBoldTemplate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import RevenueCat
import SwiftUI

@available(iOS 16.0, macOS 13.0, tvOS 16.0, *)
@available(tvOS, unavailable)
struct MultiPackageBoldTemplate: TemplateViewType {

private let configuration: TemplateViewConfiguration
Expand Down Expand Up @@ -206,6 +207,7 @@ struct MultiPackageBoldTemplate: TemplateViewType {
// MARK: - Extensions

@available(iOS 16.0, macOS 13.0, tvOS 16.0, *)
@available(tvOS, unavailable)
private extension MultiPackageBoldTemplate {

func localization(for package: Package) -> ProcessedLocalizedConfiguration {
Expand All @@ -226,6 +228,7 @@ private extension MultiPackageBoldTemplate {
@available(iOS 16.0, macOS 13.0, tvOS 16.0, *)
@available(watchOS, unavailable)
@available(macOS, unavailable)
@available(tvOS, unavailable)
@available(macCatalyst, unavailable)
struct MultiPackageBoldTemplate_Previews: PreviewProvider {

Expand Down
2 changes: 2 additions & 0 deletions RevenueCatUI/Templates/OnePackageStandardTemplate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import RevenueCat
import SwiftUI

@available(iOS 16.0, macOS 13.0, tvOS 16.0, *)
@available(tvOS, unavailable)
struct OnePackageStandardTemplate: TemplateViewType {

private let configuration: TemplateViewConfiguration
Expand Down Expand Up @@ -210,6 +211,7 @@ private struct CircleMaskModifier: ViewModifier {
@available(iOS 16.0, macOS 13.0, tvOS 16.0, *)
@available(watchOS, unavailable)
@available(macOS, unavailable)
@available(tvOS, unavailable)
@available(macCatalyst, unavailable)
struct OnePackageStandardTemplate_Previews: PreviewProvider {

Expand Down
2 changes: 2 additions & 0 deletions RevenueCatUI/Templates/OnePackageWithFeaturesTemplate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import RevenueCat
import SwiftUI

@available(iOS 16.0, macOS 13.0, tvOS 16.0, *)
@available(tvOS, unavailable)
struct OnePackageWithFeaturesTemplate: TemplateViewType {

private let configuration: TemplateViewConfiguration
Expand Down Expand Up @@ -183,6 +184,7 @@ private struct FeatureView: View {
@available(iOS 16.0, macOS 13.0, tvOS 16.0, *)
@available(watchOS, unavailable)
@available(macOS, unavailable)
@available(tvOS, unavailable)
@available(macCatalyst, unavailable)
struct OnePackageWithFeaturesTemplate_Previews: PreviewProvider {

Expand Down
2 changes: 2 additions & 0 deletions RevenueCatUI/Templates/TemplateViewType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import SwiftUI

/// A `SwiftUI` view that can display a paywall with `TemplateViewConfiguration`.
@available(iOS 16.0, macOS 13.0, tvOS 16.0, *)
@available(tvOS, unavailable)
protocol TemplateViewType: SwiftUI.View {

init(_ configuration: TemplateViewConfiguration)
Expand All @@ -23,6 +24,7 @@ private extension PaywallTemplate {
}

@available(iOS 16.0, macOS 13.0, tvOS 16.0, *)
@available(tvOS, unavailable)
extension PaywallData {

@ViewBuilder
Expand Down
4 changes: 3 additions & 1 deletion RevenueCatUI/View+PresentPaywall.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import SwiftUI

@available(iOS 16.0, macOS 13.0, tvOS 16.0, *)
@available(macOS, unavailable, message: "RevenueCatUI does not support macOS yet")
@available(tvOS, unavailable, message: "RevenueCatUI does not support tvOS yet")
extension View {

typealias CustomerInfoFetcher = @Sendable () async throws -> CustomerInfo
Expand Down Expand Up @@ -93,7 +94,8 @@ extension View {
}

@available(iOS 16.0, macOS 13.0, tvOS 16.0, *)
@available(macOS, unavailable, message: "RevenueCatUI does not support macOS yet")
@available(macOS, unavailable)
@available(tvOS, unavailable)
private struct PresentingPaywallModifier: ViewModifier {

var shouldDisplay: @Sendable (CustomerInfo) -> Bool
Expand Down
5 changes: 5 additions & 0 deletions RevenueCatUI/Views/LoadingPaywallView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import SwiftUI

/// A `PaywallView` suitable to be displayed as a loading placeholder.
@available(iOS 16.0, macOS 13.0, tvOS 16.0, *)
@available(macOS, unavailable)
@available(tvOS, unavailable)
@MainActor
struct LoadingPaywallView: View {

Expand Down Expand Up @@ -38,6 +40,8 @@ struct LoadingPaywallView: View {
}

@available(iOS 16.0, macOS 13.0, tvOS 16.0, *)
@available(macOS, unavailable)
@available(tvOS, unavailable)
private extension LoadingPaywallView {

static let introEligibility: TrialOrIntroEligibilityChecker = .init(checker: { packages in
Expand Down Expand Up @@ -112,6 +116,7 @@ private extension LoadingPaywallView {
@available(iOS 16.0, macOS 13.0, tvOS 16.0, *)
@available(watchOS, unavailable)
@available(macOS, unavailable)
@available(tvOS, unavailable)
@available(macCatalyst, unavailable)
struct LoadingPaywallView_Previews: PreviewProvider {

Expand Down
5 changes: 4 additions & 1 deletion RevenueCatUI/Views/PurchaseButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import RevenueCat
import SwiftUI

@available(iOS 16.0, macOS 13.0, tvOS 16.0, *)
@available(tvOS, unavailable)
struct PurchaseButton: View {

let package: Package
Expand Down Expand Up @@ -75,6 +76,7 @@ private extension PaywallViewMode {
}
}

@available(tvOS, unavailable)
var buttonSize: ControlSize {
switch self {
case .fullScreen: return .large
Expand All @@ -86,7 +88,7 @@ private extension PaywallViewMode {
var buttonBorderShape: ButtonBorderShape {
switch self {
case .fullScreen:
#if os(macOS)
#if os(macOS) || os(tvOS)
return .roundedRectangle
#else
return .capsule
Expand All @@ -103,6 +105,7 @@ private extension PaywallViewMode {
#if DEBUG && canImport(SwiftUI) && canImport(UIKit)

@available(iOS 16.0, macOS 13.0, tvOS 16.0, *)
@available(tvOS, unavailable, message: "RevenueCatUI does not support tvOS yet")
struct PurchaseButton_Previews: PreviewProvider {

@MainActor
Expand Down