mirror of
https://github.com/yattee/yattee.git
synced 2026-07-21 06:42:01 +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" : {
|
"home.downloads.notAvailable" : {
|
||||||
"comment" : "Downloads not available on tvOS",
|
"comment" : "Downloads not available on tvOS",
|
||||||
"localizations" : {
|
"localizations" : {
|
||||||
|
|||||||
@@ -382,6 +382,9 @@ struct HomeView: View {
|
|||||||
return LazyVGrid(columns: columns, spacing: gridSpacing) {
|
return LazyVGrid(columns: columns, spacing: gridSpacing) {
|
||||||
ForEach(settingsManager?.visibleShortcuts() ?? HomeShortcutItem.defaultOrder) { shortcut in
|
ForEach(settingsManager?.visibleShortcuts() ?? HomeShortcutItem.defaultOrder) { shortcut in
|
||||||
shortcutCardView(for: shortcut)
|
shortcutCardView(for: shortcut)
|
||||||
|
#if !os(tvOS)
|
||||||
|
.contextMenu { editShortcutsButton }
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
@@ -404,9 +407,23 @@ struct HomeView: View {
|
|||||||
) {
|
) {
|
||||||
shortcutRowView(for: shortcut)
|
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
|
@ViewBuilder
|
||||||
private func shortcutCardView(for shortcut: HomeShortcutItem) -> some View {
|
private func shortcutCardView(for shortcut: HomeShortcutItem) -> some View {
|
||||||
switch shortcut {
|
switch shortcut {
|
||||||
|
|||||||
Reference in New Issue
Block a user