Răsfoiți Sursa

Fix Create New App flow disabling launcher interactions.

Replace the modal create-app sheet with an in-window overlay panel and add explicit close handling so opening Create New App no longer leaves the launcher effectively disabled.

Made-with: Cursor
huzaifahayat12 3 luni în urmă
părinte
comite
2c0df070b1
2 a modificat fișierele cu 46 adăugiri și 9 ștergeri
  1. 15 3
      google_apps/CreateAppSheetView.swift
  2. 31 6
      google_apps/LauncherRootView.swift

+ 15 - 3
google_apps/CreateAppSheetView.swift

@@ -13,10 +13,14 @@ struct CreateAppSheetView: View {
     @State private var urlError: String?
 
     let onSave: (NewAppInput) -> Void
+    var onClose: (() -> Void)? = nil
+    var showsBackgroundLayer: Bool = true
 
     var body: some View {
         ZStack {
-            backgroundLayer
+            if showsBackgroundLayer {
+                backgroundLayer
+            }
 
             VStack(spacing: 22) {
                 header
@@ -53,7 +57,7 @@ struct CreateAppSheetView: View {
 
     private var header: some View {
         HStack {
-            Button(action: { dismiss() }) {
+            Button(action: { closeView() }) {
                 Image(systemName: "xmark")
                     .font(.system(size: 17, weight: .medium))
                     .foregroundStyle(.white.opacity(0.86))
@@ -170,7 +174,7 @@ struct CreateAppSheetView: View {
 
         urlError = nil
         onSave(NewAppInput(name: trimmedName, url: url))
-        dismiss()
+        closeView()
     }
 
     private func normalizedURLString(_ value: String) -> String {
@@ -179,6 +183,14 @@ struct CreateAppSheetView: View {
         }
         return "https://\(value)"
     }
+
+    private func closeView() {
+        if let onClose {
+            onClose()
+        } else {
+            dismiss()
+        }
+    }
 }
 
 #if DEBUG

+ 31 - 6
google_apps/LauncherRootView.swift

@@ -172,6 +172,12 @@ struct LauncherRootView: View {
             .padding(.horizontal, 10)
             .padding(.top, 5)
             .padding(.bottom, 8)
+
+            if showingCreateAppSheet {
+                createAppOverlay
+                    .transition(.scale(scale: 0.97).combined(with: .opacity))
+                    .zIndex(50)
+            }
         }
         .ignoresSafeArea(.container, edges: .top)
         .sheet(item: $selectedApp) { app in
@@ -183,12 +189,6 @@ struct LauncherRootView: View {
                 .environmentObject(premiumStore)
                 .frame(minWidth: 560, minHeight: 690)
         }
-        .sheet(isPresented: $showingCreateAppSheet) {
-            CreateAppSheetView { input in
-                addCustomApp(name: input.name, url: input.url)
-            }
-            .frame(minWidth: 760, minHeight: 420)
-        }
         .task {
             await premiumStore.refreshEntitlements()
         }
@@ -313,6 +313,31 @@ struct LauncherRootView: View {
         }
     }
 
+    private var createAppOverlay: some View {
+        VStack {
+            CreateAppSheetView(
+                onSave: { input in
+                    addCustomApp(name: input.name, url: input.url)
+                },
+                onClose: {
+                    showingCreateAppSheet = false
+                },
+                showsBackgroundLayer: false
+            )
+            .frame(minWidth: 760, minHeight: 420)
+            .background(
+                RoundedRectangle(cornerRadius: 22, style: .continuous)
+                    .fill(Color(red: 0.04, green: 0.06, blue: 0.08).opacity(0.96))
+            )
+            .overlay(
+                RoundedRectangle(cornerRadius: 22, style: .continuous)
+                    .stroke(Color.white.opacity(0.12), lineWidth: 1)
+            )
+            .shadow(color: .black.opacity(0.45), radius: 24, x: 0, y: 12)
+        }
+        .padding(.horizontal, 22)
+    }
+
     private func handleAppTap(_ app: LauncherApp) {
         if app.isCreateNew {
             showingCreateAppSheet = true