Add reading progress tracking
All checks were successful
CI / build-and-deploy (push) Successful in 25s
All checks were successful
CI / build-and-deploy (push) Successful in 25s
- BrowserState: inject scroll-tracking JS after page load, report position via WKScriptMessageHandler (weak ref to avoid retain cycle) - BrowserView: thin blue progress bar at top of viewport; saves progress to UserDefaults on dismiss; restores scroll position on revisit - BookmarkRow: 2px progress bar below tags for partially-read articles - BookmarksView: loads ReadingProgress.all() on appear, refreshes when browser sheet dismisses - ReadingProgress: static helper for UserDefaults-backed [url: Double] store; removes entry when article is fully read (≥99%) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,7 @@ import SwiftUI
|
||||
|
||||
struct BookmarkRow: View {
|
||||
let bookmark: Bookmark
|
||||
var readingProgress: Double = 0
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading, spacing: 6) {
|
||||
@@ -54,6 +55,22 @@ struct BookmarkRow: View {
|
||||
}
|
||||
.padding(.leading, 40)
|
||||
}
|
||||
|
||||
// Reading progress indicator
|
||||
if readingProgress > 0.02 {
|
||||
GeometryReader { geo in
|
||||
ZStack(alignment: .leading) {
|
||||
Rectangle()
|
||||
.fill(Color(.systemGray5))
|
||||
Rectangle()
|
||||
.fill(Color.blue.opacity(0.55))
|
||||
.frame(width: geo.size.width * min(readingProgress, 1))
|
||||
}
|
||||
}
|
||||
.frame(height: 2)
|
||||
.clipShape(Capsule())
|
||||
.padding(.leading, 40)
|
||||
}
|
||||
}
|
||||
.padding(.vertical, 14)
|
||||
.contentShape(Rectangle())
|
||||
|
||||
Reference in New Issue
Block a user