Răsfoiți Sursa

Fix Shopping widget shortcuts and search reliability.

Replace unstable Lists/Browse routes with stable Trending and Categories destinations, and route large-widget product search through Google Shopping results mode for consistent behavior.

Made-with: Cursor
huzaifahayat12 3 luni în urmă
părinte
comite
4e95b151e5

+ 10 - 9
google_apps/Widgets/ShoppingDesktopWidgetView.swift

@@ -4,11 +4,11 @@ import SwiftUI
 /// Paths on `shopping.google.com` for category shortcuts (same pattern as Travel).
 private enum ShoppingWebEndpoints {
     static let dealsPath = "/deals"
-    static let listsPath = "/lists"
-    static let browsePath = "/browse"
+    static let trendingPath = "https://www.google.com/search?tbm=shop&q=trending+products"
+    static let categoriesPath = "https://www.google.com/search?tbm=shop&q=shop+by+category"
 }
 
-/// Large Google Shopping: toolbar search and four category shortcuts (Shop, Deals, Lists, Browse). Opens in-app browser.
+/// Large Google Shopping: toolbar search and four category shortcuts (Shop, Deals, Trending, Categories). Opens in-app browser.
 struct ShoppingDesktopWidgetView: View {
     let app: LauncherApp
     let mode: ShoppingWidgetMode
@@ -55,7 +55,7 @@ struct ShoppingDesktopWidgetView: View {
                 Text("Google Shopping")
                     .font(.system(size: 15, weight: .bold))
                     .foregroundStyle(.white.opacity(0.92))
-                Text("Search products or open Deals, Lists, and Browse in the in-app browser.")
+                Text("Search products or open Deals, Trending, and Categories in the in-app browser.")
                     .font(.system(size: 11, weight: .medium))
                     .foregroundStyle(.white.opacity(0.72))
                     .multilineTextAlignment(.center)
@@ -144,12 +144,12 @@ struct ShoppingDesktopWidgetView: View {
                 Image(systemName: "tag.fill")
                     .font(.system(size: 20, weight: .medium))
             }
-            shoppingCategoryButton(title: "Lists", path: ShoppingWebEndpoints.listsPath) {
-                Image(systemName: "list.bullet.rectangle.fill")
+            shoppingCategoryButton(title: "Trending", path: ShoppingWebEndpoints.trendingPath) {
+                Image(systemName: "flame.fill")
                     .font(.system(size: 20, weight: .medium))
             }
-            shoppingCategoryButton(title: "Browse", path: ShoppingWebEndpoints.browsePath) {
-                Image(systemName: "square.grid.2x2.fill")
+            shoppingCategoryButton(title: "Categories", path: ShoppingWebEndpoints.categoriesPath) {
+                Image(systemName: "square.grid.3x3.fill")
                     .font(.system(size: 20, weight: .medium))
             }
         }
@@ -205,8 +205,9 @@ struct ShoppingDesktopWidgetView: View {
     }
 
     private func openProductSearch(query q: String) {
-        var c = URLComponents(string: "https://shopping.google.com/search")!
+        var c = URLComponents(string: "https://www.google.com/search")!
         c.queryItems = [URLQueryItem(name: "q", value: q)]
+        c.queryItems?.append(URLQueryItem(name: "tbm", value: "shop"))
         guard let url = c.url else { return }
         openInAppBrowser(url)
     }

+ 3 - 3
google_apps/Widgets/WidgetTemplates.swift

@@ -72,7 +72,7 @@ enum TravelWidgetMode: Hashable, Sendable {
 }
 
 enum ShoppingWidgetMode: Hashable, Sendable {
-    /// Toolbar search plus Shop / Deals / Lists / Browse shortcuts; in-app browser.
+    /// Toolbar search plus Shop / Deals / Trending / Categories shortcuts; in-app browser.
     case interactive
 }
 
@@ -294,8 +294,8 @@ enum WidgetTemplates {
                 v("shopping_medium", "Shopping shortcuts", .medium, true, .actionsGrid(columns: 2), [
                     a("home", "Home", "house", "/"),
                     a("deals", "Deals", "tag", "/deals"),
-                    a("lists", "Lists", "list.bullet.rectangle", "/lists"),
-                    a("browse", "Browse", "square.grid.2x2", "/browse"),
+                    a("trending", "Trending", "flame", "https://www.google.com/search?tbm=shop&q=trending+products"),
+                    a("categories", "Categories", "square.grid.3x3", "https://www.google.com/search?tbm=shop&q=shop+by+category"),
                 ]),
                 v("shopping_large", "Shop & deals", .large, false, .shopping(.interactive), []),
             ]