Opening an item reads it, and the page's keys (#11)

selectEntry in the page calls markRead, so picking a row reads it. Natively
an item could be opened, read and left, and it stayed bold. With it comes
the detail that would have been missed by guessing: on the Unread tab the
item you were reading is dropped when you move on to the next one, not
whenever a refresh next comes along, so nothing vanishes from under the
pointer mid-click. A flag that does not save rolls back and says so, where
the page toasts.

The keys are Feedly's set, from player.ts: j n and k p, shift J and K, o m
s v, shift A, r, [, space, the arrows, g then a d p l or s, and ? for the
list of them. The pair window is the page's second and a half, and p and s
mean different things with and without a g in front, which they do there
too.

They are UIKeyCommand rather than SwiftUI's onKeyPress, which is iOS 17,
and they hang off the hosting controller rather than the controller that
owns it: SwiftUI's views hold first responder, so the chain starts inside
that hierarchy and an override further up is never consulted.

What is tested is the map, in KeysTests -- that p is Previous alone and
Popular after g, that every mapped key is registered, that the window is
1.5s -- because a wrong letter there loses a shortcut silently. What is not
tested is whether a press arrives at all: the simulator drops key events
unless something is focused, and running the same tests against Catalyst,
where the keyboard is the point, needs the runner to have accessibility
permission it does not have here. That test is skipped with the reason
written in it rather than deleted or left red.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-20 11:26:05 -04:00
parent a13a797bf5
commit d68f1d0d1d
8 changed files with 371 additions and 12 deletions

View File

@@ -11,6 +11,8 @@ struct LibraryView: View {
/// The file is the one asked for, or the item's first playable one.
var play: (IPX.Entry, IPX.Enclosure?) -> Void
var openPage: (WebViewController.Screen) -> Void
@ObservedObject var keys: RootViewController.Flag
@ObservedObject var sidebar: RootViewController.Flag
/// Everything that lives in the page, named rather than hidden behind one button: it should
/// be as easy to reach Settings here as it is in a browser.
@@ -33,17 +35,39 @@ struct LibraryView: View {
.help("Settings, the directory, OPML")
}
@Environment(\.horizontalSizeClass) private var width
private var wide: Bool { width != .compact }
var body: some View {
NavigationSplitView {
NavigationSplitView(columnVisibility: Binding(
get: { sidebar.on ? .detailOnly : .all },
set: { sidebar.on = $0 == .detailOnly })) {
FeedListView(store: store)
.background(Glass.Wash())
} detail: {
ItemListView(store: store, playback: playback, play: play)
.toolbar {
ToolbarItem(placement: .primaryAction) { pageMenu }
// Wide enough for the page's own three-pane arrangement, or the phone's one-at-a-
// time. The page draws the same line at 820px and hides its columns below it.
Group {
if wide {
ContentPaneView(store: store, playback: playback, play: play)
} else {
ItemListView(store: store, playback: playback, play: play)
}
}
.toolbar { ToolbarItem(placement: .primaryAction) { pageMenu } }
}
// The wash belongs to the window, once. A copy behind each pane met at the split and
// the join showed as a seam straight down the middle.
.background(Glass.Wash())
.tint(Glass.accent)
.navigationSplitViewColumnWidth(min: 200, ideal: 260)
.sheet(isPresented: $keys.on) { KeysView() }
.alert("That did not save",
isPresented: Binding(get: { store.problem != nil },
set: { if !$0 { store.problem = nil } })) {
Button("OK", role: .cancel) { store.problem = nil }
} message: {
Text(store.problem ?? "")
}
.task {
await store.refreshFeeds()
store.reload()