mirror of
https://github.com/yattee/yattee.git
synced 2026-07-20 14:22:02 +00:00
Add "Edit Shortcuts" context menu to Home shortcuts
Long-press (or right-click) any Home shortcut to open the Home settings sheet for reordering and toggling shortcuts.
This commit is contained in:
@@ -3674,6 +3674,17 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"home.editShortcuts" : {
|
||||
"comment" : "Context menu action on Home shortcuts to open Home settings",
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "Edit Shortcuts"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"home.downloads.notAvailable" : {
|
||||
"comment" : "Downloads not available on tvOS",
|
||||
"localizations" : {
|
||||
|
||||
@@ -382,6 +382,9 @@ struct HomeView: View {
|
||||
return LazyVGrid(columns: columns, spacing: gridSpacing) {
|
||||
ForEach(settingsManager?.visibleShortcuts() ?? HomeShortcutItem.defaultOrder) { shortcut in
|
||||
shortcutCardView(for: shortcut)
|
||||
#if !os(tvOS)
|
||||
.contextMenu { editShortcutsButton }
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#if os(iOS)
|
||||
@@ -404,9 +407,23 @@ struct HomeView: View {
|
||||
) {
|
||||
shortcutRowView(for: shortcut)
|
||||
}
|
||||
#if !os(tvOS)
|
||||
.contextMenu { editShortcutsButton }
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#if !os(tvOS)
|
||||
/// Context menu action that opens the Home settings sheet to reorder/toggle shortcuts.
|
||||
private var editShortcutsButton: some View {
|
||||
Button {
|
||||
showingCustomizeHome = true
|
||||
} label: {
|
||||
Label(String(localized: "home.editShortcuts"), systemImage: "gear")
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@ViewBuilder
|
||||
private func shortcutCardView(for shortcut: HomeShortcutItem) -> some View {
|
||||
switch shortcut {
|
||||
|
||||
Reference in New Issue
Block a user