Ver Fonte

Ensure Upgrade paywall uses new wide layout.

Widen the SwiftUI sheet presentation for the paywall so it exceeds the wide-layout breakpoint, and centralize the sizing constants in PremiumPaywallMetrics.

Co-authored-by: Cursor <cursoragent@cursor.com>
huzaifahayat12 há 2 meses atrás
pai
commit
1838294de4

+ 6 - 1
google_apps/LauncherRootView.swift

@@ -186,7 +186,12 @@ struct LauncherRootView: View {
         .sheet(isPresented: $showingPremiumScreen) {
             PremiumFeaturesView()
                 .environmentObject(premiumStore)
-                .frame(minWidth: 560, minHeight: 690)
+                .frame(
+                    minWidth: PremiumPaywallMetrics.sheetMinWidth,
+                    idealWidth: PremiumPaywallMetrics.sheetIdealWidth,
+                    minHeight: PremiumPaywallMetrics.sheetMinHeight,
+                    idealHeight: PremiumPaywallMetrics.sheetIdealHeight
+                )
         }
         .task {
             await premiumStore.refreshEntitlements()

+ 12 - 2
google_apps/PremiumFeaturesView.swift

@@ -72,7 +72,7 @@ struct PremiumFeaturesView: View {
             .ignoresSafeArea()
 
             GeometryReader { geo in
-                let useWideLayout = geo.size.width >= 620
+                let useWideLayout = geo.size.width >= PremiumPaywallMetrics.wideLayoutMinWidth
                 VStack(spacing: 0) {
                     paywallTopBar
                         .padding(.horizontal, useWideLayout ? 22 : 16)
@@ -505,6 +505,16 @@ struct PremiumFeaturesView: View {
     }
 }
 
+enum PremiumPaywallMetrics {
+    /// Below this width `PremiumFeaturesView` uses single-column (“compact”) layout.
+    static let wideLayoutMinWidth: CGFloat = 620
+    /// SwiftUI `.sheet` defaults narrower than this; constrain so Upgrade matches launch/browser paywall.
+    static let sheetMinWidth: CGFloat = 900
+    static let sheetIdealWidth: CGFloat = 920
+    static let sheetMinHeight: CGFloat = 600
+    static let sheetIdealHeight: CGFloat = 640
+}
+
 enum PremiumPaywallWindowSizing {
     /// Sizes the paywall to sit inside the parent window (launcher default content ~980×700, browser ~1200×800).
     static func contentSize(forParentWindow parent: NSWindow) -> NSSize {
@@ -522,6 +532,6 @@ enum PremiumPaywallWindowSizing {
 #Preview {
     PremiumFeaturesView()
         .environmentObject(PremiumStore.shared)
-        .frame(width: 920, height: 620)
+        .frame(width: PremiumPaywallMetrics.sheetIdealWidth, height: PremiumPaywallMetrics.sheetMinHeight + 20)
 }
 #endif

+ 6 - 1
google_apps/Widgets/WidgetsRootView.swift

@@ -63,7 +63,12 @@ struct WidgetsRootView: View {
         .sheet(isPresented: $showingPremiumScreen) {
             PremiumFeaturesView()
                 .environmentObject(premiumStore)
-                .frame(minWidth: 560, minHeight: 690)
+                .frame(
+                    minWidth: PremiumPaywallMetrics.sheetMinWidth,
+                    idealWidth: PremiumPaywallMetrics.sheetIdealWidth,
+                    minHeight: PremiumPaywallMetrics.sheetMinHeight,
+                    idealHeight: PremiumPaywallMetrics.sheetIdealHeight
+                )
         }
     }