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:
@@ -11,12 +11,13 @@ struct BookmarksView: View {
|
||||
@State private var editingBookmark: Bookmark?
|
||||
@State private var browsingBookmark: Bookmark?
|
||||
@State private var podcastBookmark: Bookmark?
|
||||
@State private var readingProgress: [String: Double] = ReadingProgress.all()
|
||||
|
||||
var body: some View {
|
||||
NavigationStack {
|
||||
List {
|
||||
ForEach(viewModel.bookmarks) { bookmark in
|
||||
BookmarkRow(bookmark: bookmark)
|
||||
BookmarkRow(bookmark: bookmark, readingProgress: readingProgress[bookmark.url] ?? 0)
|
||||
.onTapGesture {
|
||||
browsingBookmark = bookmark
|
||||
}
|
||||
@@ -158,6 +159,9 @@ struct BookmarksView: View {
|
||||
BrowserView(url: url, title: bookmark.displayTitle, claude: viewModel.claude)
|
||||
}
|
||||
}
|
||||
.onChange(of: browsingBookmark) { _, new in
|
||||
if new == nil { readingProgress = ReadingProgress.all() }
|
||||
}
|
||||
.sheet(item: $podcastBookmark) { bookmark in
|
||||
if let claude = viewModel.claude {
|
||||
PodcastPlayerView(articleUrl: bookmark.url, claude: claude)
|
||||
|
||||
Reference in New Issue
Block a user