From c7db551bc45da024e338e0ff559be151a640a42d Mon Sep 17 00:00:00 2001 From: NachoSoto Date: Mon, 26 Jun 2023 13:06:13 -0700 Subject: [PATCH] `xrOS`: add support for `debugRevenueCatOverlay` (#2702) --- .../Support/DebugUI/DebugContentViews.swift | 4 ++-- Sources/Support/DebugUI/DebugView.swift | 22 +++++++++++++------ Sources/Support/DebugUI/DebugViewModel.swift | 2 -- .../DebugUI/DebugViewSheetPresentation.swift | 2 -- 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/Sources/Support/DebugUI/DebugContentViews.swift b/Sources/Support/DebugUI/DebugContentViews.swift index 04c91e6067..e1aa2712e1 100644 --- a/Sources/Support/DebugUI/DebugContentViews.swift +++ b/Sources/Support/DebugUI/DebugContentViews.swift @@ -12,7 +12,6 @@ // Created by Nacho Soto on 5/30/23. #if DEBUG && swift(>=5.8) && (os(iOS) || os(macOS)) -#if !(swift(>=5.9) && os(xrOS)) import StoreKit import SwiftUI @@ -294,11 +293,13 @@ private struct DebugOfferingView: View { .foregroundStyle(.secondary) .font(.subheadline) } + #if !(swift(>=5.9) && os(xrOS)) .containerBackground(for: .subscriptionStoreFullHeight) { Rectangle() .edgesIgnoringSafeArea(.all) .foregroundStyle(Color.blue.gradient.quaternary) } + #endif } .backgroundStyle(.clear) .subscriptionStoreButtonLabel(.multiline) @@ -414,4 +415,3 @@ private struct ProductStyle: ProductViewStyle { #endif #endif -#endif diff --git a/Sources/Support/DebugUI/DebugView.swift b/Sources/Support/DebugUI/DebugView.swift index be1fc7e8f9..8bae7f59e7 100644 --- a/Sources/Support/DebugUI/DebugView.swift +++ b/Sources/Support/DebugUI/DebugView.swift @@ -12,7 +12,6 @@ // Created by Nacho Soto on 5/30/23. #if DEBUG && swift(>=5.8) && (os(iOS) || os(macOS)) -#if !(swift(>=5.9) && os(xrOS)) import SwiftUI @@ -54,11 +53,7 @@ public extension View { /// ``` func debugRevenueCatOverlay(isPresented: Binding) -> some View { self.bottomSheet( - presentationDetents: [ - .fraction(0.2), - .fraction(0.6), - .large - ], + presentationDetents: self.detents, isPresented: isPresented, largestUndimmedIdentifier: .fraction(0.6), cornerRadius: DebugSwiftUIRootView.cornerRadius, @@ -66,12 +61,25 @@ public extension View { DebugSwiftUIRootView() #if os(macOS) .frame(width: 500, height: 600) + #elseif swift(>=5.9) && os(xrOS) + .frame(width: 600, height: 700) #endif } ) } + private var detents: Set { + #if swift(>=5.9) && os(xrOS) + return [.large] + #else + return [ + .fraction(0.2), + .fraction(0.6), + .large + ] + #endif + } + } #endif -#endif diff --git a/Sources/Support/DebugUI/DebugViewModel.swift b/Sources/Support/DebugUI/DebugViewModel.swift index 58435351d1..df71173ba7 100644 --- a/Sources/Support/DebugUI/DebugViewModel.swift +++ b/Sources/Support/DebugUI/DebugViewModel.swift @@ -14,7 +14,6 @@ import Foundation #if DEBUG && swift(>=5.8) && (os(iOS) || os(macOS)) -#if !(swift(>=5.9) && os(xrOS)) import SwiftUI @@ -147,4 +146,3 @@ private extension Signing.ResponseVerificationMode { } #endif -#endif diff --git a/Sources/Support/DebugUI/DebugViewSheetPresentation.swift b/Sources/Support/DebugUI/DebugViewSheetPresentation.swift index 85d35e9217..1701c423b6 100644 --- a/Sources/Support/DebugUI/DebugViewSheetPresentation.swift +++ b/Sources/Support/DebugUI/DebugViewSheetPresentation.swift @@ -12,7 +12,6 @@ // Created by Nacho Soto on 5/30/23. #if DEBUG && swift(>=5.8) && (os(iOS) || os(macOS)) -#if !(swift(>=5.9) && os(xrOS)) import SwiftUI @@ -47,4 +46,3 @@ extension View { } #endif -#endif