|
@@ -4,11 +4,11 @@ import SwiftUI
|
|
|
/// Paths on `shopping.google.com` for category shortcuts (same pattern as Travel).
|
|
/// Paths on `shopping.google.com` for category shortcuts (same pattern as Travel).
|
|
|
private enum ShoppingWebEndpoints {
|
|
private enum ShoppingWebEndpoints {
|
|
|
static let dealsPath = "/deals"
|
|
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 {
|
|
struct ShoppingDesktopWidgetView: View {
|
|
|
let app: LauncherApp
|
|
let app: LauncherApp
|
|
|
let mode: ShoppingWidgetMode
|
|
let mode: ShoppingWidgetMode
|
|
@@ -55,7 +55,7 @@ struct ShoppingDesktopWidgetView: View {
|
|
|
Text("Google Shopping")
|
|
Text("Google Shopping")
|
|
|
.font(.system(size: 15, weight: .bold))
|
|
.font(.system(size: 15, weight: .bold))
|
|
|
.foregroundStyle(.white.opacity(0.92))
|
|
.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))
|
|
.font(.system(size: 11, weight: .medium))
|
|
|
.foregroundStyle(.white.opacity(0.72))
|
|
.foregroundStyle(.white.opacity(0.72))
|
|
|
.multilineTextAlignment(.center)
|
|
.multilineTextAlignment(.center)
|
|
@@ -144,12 +144,12 @@ struct ShoppingDesktopWidgetView: View {
|
|
|
Image(systemName: "tag.fill")
|
|
Image(systemName: "tag.fill")
|
|
|
.font(.system(size: 20, weight: .medium))
|
|
.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))
|
|
.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))
|
|
.font(.system(size: 20, weight: .medium))
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -205,8 +205,9 @@ struct ShoppingDesktopWidgetView: View {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private func openProductSearch(query q: String) {
|
|
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 = [URLQueryItem(name: "q", value: q)]
|
|
|
|
|
+ c.queryItems?.append(URLQueryItem(name: "tbm", value: "shop"))
|
|
|
guard let url = c.url else { return }
|
|
guard let url = c.url else { return }
|
|
|
openInAppBrowser(url)
|
|
openInAppBrowser(url)
|
|
|
}
|
|
}
|