mirror of
https://github.com/yattee/yattee.git
synced 2026-07-20 14:22:02 +00:00
Add Hide option to home shortcut context menu
This commit is contained in:
@@ -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" : {
|
"home.history.clear" : {
|
||||||
"comment" : "Clear history button",
|
"comment" : "Clear history button",
|
||||||
"localizations" : {
|
"localizations" : {
|
||||||
|
|||||||
@@ -386,7 +386,10 @@ struct HomeView: View {
|
|||||||
shortcutCardView(for: shortcut)
|
shortcutCardView(for: shortcut)
|
||||||
.environment(\.homeShortcutColorfulColor, colorfulColor(atPosition: index))
|
.environment(\.homeShortcutColorfulColor, colorfulColor(atPosition: index))
|
||||||
#if !os(tvOS)
|
#if !os(tvOS)
|
||||||
.contextMenu { editShortcutsButton }
|
.contextMenu {
|
||||||
|
hideShortcutButton(for: shortcut)
|
||||||
|
editShortcutsButton
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -419,12 +422,27 @@ struct HomeView: View {
|
|||||||
shortcutRowView(for: shortcut)
|
shortcutRowView(for: shortcut)
|
||||||
}
|
}
|
||||||
#if !os(tvOS)
|
#if !os(tvOS)
|
||||||
.contextMenu { editShortcutsButton }
|
.contextMenu {
|
||||||
|
hideShortcutButton(for: shortcut)
|
||||||
|
editShortcutsButton
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !os(tvOS)
|
#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.
|
/// Context menu action that opens the Home settings sheet to reorder/toggle shortcuts.
|
||||||
private var editShortcutsButton: some View {
|
private var editShortcutsButton: some View {
|
||||||
Button {
|
Button {
|
||||||
|
|||||||
Reference in New Issue
Block a user