A native feed list and item list (#3)
The lists are native now, and the page is a button in the toolbar: it is still where signing in happens, and it is still the whole of settings, the admin page, the directory and OPML, which were never going to be rewritten. LibraryStore holds a page of items and asks for the next, because the sorting, filtering and searching are the server's work and ten thousand items have no business being in memory to be sorted here. Read and pinned are set locally and sent after, as the page's readWrites map does and for the same reason: a list asked for before the write lands answers with the old state, which put the dot back on an item just read. The interface follows the account's light or dark rather than the phone's, and defaults to dark when nobody has chosen, because that is what ipx's own theme.ts does. Following the system instead put a light list in front of a dark page. preferredColorScheme was not enough on its own -- inside a hosting controller it did not reach the hierarchy -- so the style is overridden on the controller, which also carries to the page presented over it. The sidebar had to be broken into sub-views: the whole list in one expression was more than the type checker would work through, and it said so rather than compiling it. Tested against the real library, 135 feeds and eleven thousand items, and the playback test now drives the native row rather than the page's button. Thirteen pass. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -11,9 +11,14 @@ final class WebViewController: UIViewController, WKNavigationDelegate {
|
||||
private var cookies: CookieBridge!
|
||||
private var api: API!
|
||||
private var playback: Playback!
|
||||
|
||||
/// The web view's cookie store is what authenticates everything else, and its Playback is
|
||||
/// the one the lock screen drives, so the native interface borrows both rather than making
|
||||
/// a second of either.
|
||||
var cookieBridge: CookieBridge { cookies }
|
||||
var player: Playback { playback }
|
||||
private var bridge: Bridge!
|
||||
|
||||
private var playerBar: UIHostingController<PlayerBarView>!
|
||||
private let banner = UIView()
|
||||
private let bannerText = UILabel()
|
||||
private var checkedBridge = false
|
||||
@@ -46,6 +51,7 @@ final class WebViewController: UIViewController, WKNavigationDelegate {
|
||||
pageAtTop,
|
||||
webView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
|
||||
webView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
|
||||
webView.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor),
|
||||
])
|
||||
|
||||
cookies = CookieBridge(store: cfg.websiteDataStore.httpCookieStore)
|
||||
@@ -60,32 +66,10 @@ final class WebViewController: UIViewController, WKNavigationDelegate {
|
||||
Zoom.install(into: cfg.userContentController)
|
||||
|
||||
setUpBanner()
|
||||
setUpPlayerBar()
|
||||
|
||||
if ServerSettings.isConfigured { load() }
|
||||
}
|
||||
|
||||
// MARK: - the player bar
|
||||
|
||||
/// Ours, below the page, with the page's own bar hidden. Two bars for one player would be
|
||||
/// two sets of buttons disagreeing about what is playing, and only one of them is the thing
|
||||
/// CarPlay and the lock screen are driving.
|
||||
private func setUpPlayerBar() {
|
||||
playerBar = UIHostingController(rootView: PlayerBarView(playback: playback))
|
||||
playerBar.view.backgroundColor = .clear
|
||||
playerBar.view.translatesAutoresizingMaskIntoConstraints = false
|
||||
addChild(playerBar)
|
||||
view.addSubview(playerBar.view)
|
||||
playerBar.didMove(toParent: self)
|
||||
|
||||
NSLayoutConstraint.activate([
|
||||
playerBar.view.topAnchor.constraint(equalTo: webView.bottomAnchor),
|
||||
playerBar.view.leadingAnchor.constraint(equalTo: view.leadingAnchor),
|
||||
playerBar.view.trailingAnchor.constraint(equalTo: view.trailingAnchor),
|
||||
playerBar.view.bottomAnchor.constraint(equalTo: view.bottomAnchor),
|
||||
])
|
||||
}
|
||||
|
||||
// MARK: - how big the page is drawn
|
||||
|
||||
/// The page is sized for a phone and for a browser window, and on a Mac -- where the window
|
||||
|
||||
Reference in New Issue
Block a user