Skip to content

Commit

Permalink
xrOS: add support for debugRevenueCatOverlay (#2702)
Browse files Browse the repository at this point in the history
  • Loading branch information
NachoSoto authored Jun 26, 2023
1 parent 93510f2 commit c7db551
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 deletions.
4 changes: 2 additions & 2 deletions Sources/Support/DebugUI/DebugContentViews.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -414,4 +415,3 @@ private struct ProductStyle: ProductViewStyle {
#endif

#endif
#endif
22 changes: 15 additions & 7 deletions Sources/Support/DebugUI/DebugView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -54,24 +53,33 @@ public extension View {
/// ```
func debugRevenueCatOverlay(isPresented: Binding<Bool>) -> some View {
self.bottomSheet(
presentationDetents: [
.fraction(0.2),
.fraction(0.6),
.large
],
presentationDetents: self.detents,
isPresented: isPresented,
largestUndimmedIdentifier: .fraction(0.6),
cornerRadius: DebugSwiftUIRootView.cornerRadius,
content: {
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<PresentationDetent> {
#if swift(>=5.9) && os(xrOS)
return [.large]
#else
return [
.fraction(0.2),
.fraction(0.6),
.large
]
#endif
}

}

#endif
#endif
2 changes: 0 additions & 2 deletions Sources/Support/DebugUI/DebugViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import Foundation

#if DEBUG && swift(>=5.8) && (os(iOS) || os(macOS))
#if !(swift(>=5.9) && os(xrOS))

import SwiftUI

Expand Down Expand Up @@ -147,4 +146,3 @@ private extension Signing.ResponseVerificationMode {
}

#endif
#endif
2 changes: 0 additions & 2 deletions Sources/Support/DebugUI/DebugViewSheetPresentation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -47,4 +46,3 @@ extension View {
}

#endif
#endif

0 comments on commit c7db551

Please sign in to comment.