From d7ec654f84b26b39a9d5e36bbe41c9ef3e1ee411 Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Tue, 9 Jun 2026 08:46:51 +0200 Subject: [PATCH] Add Hide option to home shortcut context menu --- Yattee/Localizable.xcstrings | 11 +++++++++++ Yattee/Views/Home/HomeView.swift | 22 ++++++++++++++++++++-- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/Yattee/Localizable.xcstrings b/Yattee/Localizable.xcstrings index 36802df3..14c7d789 100644 --- a/Yattee/Localizable.xcstrings +++ b/Yattee/Localizable.xcstrings @@ -3742,6 +3742,17 @@ } } }, + "home.hideShortcut" : { + "comment" : "Context menu action on Home shortcuts to hide the shortcut", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Hide" + } + } + } + }, "home.history.clear" : { "comment" : "Clear history button", "localizations" : { diff --git a/Yattee/Views/Home/HomeView.swift b/Yattee/Views/Home/HomeView.swift index 28d5f340..98b238ad 100644 --- a/Yattee/Views/Home/HomeView.swift +++ b/Yattee/Views/Home/HomeView.swift @@ -386,7 +386,10 @@ struct HomeView: View { shortcutCardView(for: shortcut) .environment(\.homeShortcutColorfulColor, colorfulColor(atPosition: index)) #if !os(tvOS) - .contextMenu { editShortcutsButton } + .contextMenu { + hideShortcutButton(for: shortcut) + editShortcutsButton + } #endif } } @@ -419,12 +422,27 @@ struct HomeView: View { shortcutRowView(for: shortcut) } #if !os(tvOS) - .contextMenu { editShortcutsButton } + .contextMenu { + hideShortcutButton(for: shortcut) + editShortcutsButton + } #endif } } #if !os(tvOS) + /// Context menu action that hides the given shortcut from Home. + private func hideShortcutButton(for shortcut: HomeShortcutItem) -> some View { + Button { + guard let settingsManager else { return } + var visibility = settingsManager.homeShortcutVisibility + visibility[shortcut] = false + settingsManager.homeShortcutVisibility = visibility + } label: { + Label(String(localized: "home.hideShortcut"), systemImage: "eye.slash") + } + } + /// Context menu action that opens the Home settings sheet to reorder/toggle shortcuts. private var editShortcutsButton: some View { Button {