Bladeren bron

Update promo banner close behavior.

Keep banner always visible for non-premium (close opens paywall) and allow premium users to dismiss it until relaunch.

Co-authored-by: Cursor <cursoragent@cursor.com>
huzaifahayat12 2 maanden geleden
bovenliggende
commit
df983b8d24
1 gewijzigde bestanden met toevoegingen van 20 en 13 verwijderingen
  1. 20 13
      google_apps/LauncherRootView.swift

+ 20 - 13
google_apps/LauncherRootView.swift

@@ -23,6 +23,7 @@ struct LauncherRootView: View {
     @State private var showingPremiumScreen = false
     @State private var showingCreateAppSheet = false
     @State private var previouslyPremiumUnlocked = false
+    @State private var isPromoBannerVisible = true
     @State private var lastKnownPremiumProductID: PremiumProductID?
     @State private var ratingPromptTask: Task<Void, Never>?
     @State private var customApps: [LauncherApp] = []
@@ -153,19 +154,24 @@ struct LauncherRootView: View {
                 )
                 .padding(.top, 8)
 
-                PromoBanner(
-                    isPremiumUnlocked: premiumStore.isPremiumUnlocked,
-                    activePremiumProductID: premiumStore.activePremiumProductID ?? lastKnownPremiumProductID,
-                    onCloseTap: {
-                        if !premiumStore.isPremiumUnlocked {
-                            showingPremiumScreen = true
-                        }
-                    },
-                    onUpgradeTap: { showingPremiumScreen = true },
-                    onManageSubscriptionTap: { openManageSubscriptions() }
-                )
-                .padding(.bottom, 8)
-                .zIndex(1)
+                let shouldShowPromoBanner = !premiumStore.isPremiumUnlocked || isPromoBannerVisible
+                if shouldShowPromoBanner {
+                    PromoBanner(
+                        isPremiumUnlocked: premiumStore.isPremiumUnlocked,
+                        activePremiumProductID: premiumStore.activePremiumProductID ?? lastKnownPremiumProductID,
+                        onCloseTap: {
+                            if premiumStore.isPremiumUnlocked {
+                                isPromoBannerVisible = false
+                            } else {
+                                showingPremiumScreen = true
+                            }
+                        },
+                        onUpgradeTap: { showingPremiumScreen = true },
+                        onManageSubscriptionTap: { openManageSubscriptions() }
+                    )
+                    .padding(.bottom, 8)
+                    .zIndex(1)
+                }
 
                 appsPage
             }
@@ -211,6 +217,7 @@ struct LauncherRootView: View {
         }
         .onAppear {
             previouslyPremiumUnlocked = premiumStore.isPremiumUnlocked
+            isPromoBannerVisible = true
             if let active = premiumStore.activePremiumProductID {
                 lastKnownPremiumProductID = active
             }