Skip to content

fix(reader): reveal chapter selection when tapping a book in the reader - #167

Closed
anthonyraj wants to merge 3 commits into
feat/bible-loopfrom
air/fix-book-chapter-picker-expand-BL-1909
Closed

fix(reader): reveal chapter selection when tapping a book in the reader#167
anthonyraj wants to merge 3 commits into
feat/bible-loopfrom
air/fix-book-chapter-picker-expand-BL-1909

Conversation

@anthonyraj

@anthonyraj anthonyraj commented Jun 29, 2026

Copy link
Copy Markdown
Contributor
Simulator.Screen.Recording.-.iPhone.17.Pro.-.2026-06-29.at.16.39.26.mov

Description

Type of Change

  • feat: New feature (non-breaking change which adds functionality)
  • fix: Bug fix (non-breaking change which fixes an issue)
  • docs: Documentation update
  • refactor: Code refactoring (no functional changes)
  • perf: Performance improvement
  • test: Test additions or updates
  • build: Build system or dependency changes
  • ci: CI configuration changes
  • chore: Other changes (maintenance, etc.)

Breaking Changes

  • This PR contains BREAKING CHANGES

Breaking Change Details:

Migration Guide:

Checklist

  • My code follows the project's code style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings or errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • All commit messages follow conventional commits format

Conventional Commits

All commits in this PR follow conventional commit format:

<type>(<scope>): <subject>

[optional body]

[optional footer]

Example commit messages:

  • feat(api): add Bible verse lookup method
  • fix(auth): resolve token refresh race condition
  • docs: update installation instructions

For breaking changes:

  • feat(api)!: redesign Bible content API

See CONTRIBUTING.md for detailed guidelines.

Related Issues

Closes #
Relates to #

Additional Context

Reviewer Notes

Greptile Summary

This PR fixes the book/chapter picker so it scrolls to and expands the currently-reading book when opened from the reader. The picker's list structure is refactored from Section-based rows to plain sibling rows, a ScrollViewReader is introduced for programmatic scroll positioning, and shared row styling is extracted into a clean bookPickerRow View extension (with the required tvOS compile guard).

Confidence Score: 5/5

Safe to merge — the change is a focused, well-structured fix with no regressions in error handling, state management, or platform guards.

Both files make straightforward, targeted changes. headerExpandedBookCode is set only on open (not close), cleared on dismiss, and the ScrollViewReader+onAppear scroll pattern follows the standard SwiftUI idiom. The tvOS guard on listRowSeparator is correctly placed in the shared bookPickerRow modifier, addressing the platform-availability concern.

No files require special attention.

Important Files Changed

Filename Overview
Sources/YouVersionPlatformReader/Components/BibleReaderBookAndChapterPickerView.swift Refactored from Section-header rows to plain bookRow + conditional chapterListView siblings; added ScrollViewReader to scroll the list to the expanded book on appear; extracted bookPickerRow view modifier (with correct tvOS guard) to remove duplication.
Sources/YouVersionPlatformReader/Components/BibleReaderHeaderView.swift Small targeted fix: sets headerExpandedBookCode to the current reference book before toggling the picker open, so the list opens pre-scrolled to the reader's current position.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[User taps book/chapter pill] --> B{showingBookPicker?}
    B -- false / opening --> C[Set headerExpandedBookCode = reference.bookUSFM]
    C --> D[Toggle showingBookPicker = true]
    B -- true / closing --> D2[Toggle showingBookPicker = false]
    D --> E[Sheet presents BibleReaderBookAndChapterPickerView]
    E --> F[ScrollViewReader wraps List]
    F --> G[List.onAppear]
    G --> H{expandedBookCode set?}
    H -- yes --> I[proxy.scrollTo expandedBookCode, anchor: .top]
    H -- no --> J[List shown at top]
    D2 --> K[onDismiss: headerExpandedBookCode = nil]
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A[User taps book/chapter pill] --> B{showingBookPicker?}
    B -- false / opening --> C[Set headerExpandedBookCode = reference.bookUSFM]
    C --> D[Toggle showingBookPicker = true]
    B -- true / closing --> D2[Toggle showingBookPicker = false]
    D --> E[Sheet presents BibleReaderBookAndChapterPickerView]
    E --> F[ScrollViewReader wraps List]
    F --> G[List.onAppear]
    G --> H{expandedBookCode set?}
    H -- yes --> I[proxy.scrollTo expandedBookCode, anchor: .top]
    H -- no --> J[List shown at top]
    D2 --> K[onDismiss: headerExpandedBookCode = nil]
Loading

Reviews (3): Last reviewed commit: "fix(reader): guard listRowSeparator for ..." | Re-trigger Greptile

@anthonyraj anthonyraj self-assigned this Jun 29, 2026
@github-actions

github-actions Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

✅ Commit Lint: passed

All commit messages in this PR conform to Conventional Commits.

📦 Release preview: v5.2.3v5.2.4 (patch)

Merging this PR will, on the next manual release dispatch, ship as the version above.

Release analyzer output
[analyzer] Analyzing commit: fix(reader): reveal chapter selection when tapping a book in the reader
[analyzer] The release type for the commit is patch
[analyzer] Analyzing commit: refactor(reader): extract shared book-picker row styling

Pull the duplicated listRowInsets/background/separator modifiers on the book
row and the expanded chapter list into a single bookPickerRow(background:verticalInset:)
helper.
[analyzer] The commit should not trigger a release
[analyzer] Analyzing commit: fix(reader): guard listRowSeparator for tvOS build BL-1909
[analyzer] The release type for the commit is patch
[analyzer] Analysis of 3 commits complete: patch release

Pull the duplicated listRowInsets/background/separator modifiers on the book
row and the expanded chapter list into a single bookPickerRow(background:verticalInset:)
helper.
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Code Coverage Report

Coverage after merging air/fix-book-chapter-picker-expand-BL-1909 into feat/bible-loop will be
92.24%
Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
/Users/runner/work/platform-sdk-swift/platform-sdk-swift/DerivedData/Build/Intermediates.noindex/YouVersionPlatform.build/Debug-iphonesimulator/YouVersionPlatformCoreTests.build/DerivedSources
   resource_bundle_accessor.swift87.50%100%75%88.89%19, 44–45
/Users/runner/work/platform-sdk-swift/platform-sdk-swift/Sources/YouVersionPlatformCore
   YouVersionPlatformConfiguration.swift100%100%100%100%
/Users/runner/work/platform-sdk-swift/platform-sdk-swift/Sources/YouVersionPlatformCore/APIs
   URLBuilder.swift87.26%100%88.89%87.05%12–19, 90–99
   URLRequest+YouVersion.swift100%100%100%100%
   YouVersionAPI.swift96.91%100%100%96.55%73, 81, 83
/Users/runner/work/platform-sdk-swift/platform-sdk-swift/Sources/YouVersionPlatformCore/APIs/Bible
   BibleVersionAPI.swift73.50%100%66.67%74.51%118–132, 37–39, 58, 65–67, 75, 87
   BibleVersions.swift87.50%100%77.78%88.89%32, 54, 60–61, 83
   Highlights.swift78.48%100%64.71%80.14%113, 125–132, 156, 159, 175, 202, 205, 213, 234–236, 31, 34, 50, 79, 83, 95
/Users/runner/work/platform-sdk-swift/platform-sdk-swift/Sources/YouVersionPlatformCore/APIs/Languages
   Languages.swift92.75%100%85.71%93.55%47–49, 79
/Users/runner/work/platform-sdk-swift/platform-sdk-swift/Sources/YouVersionPlatformCore/APIs/Organizations
   Organizations.swift37.04%100%33.33%37.50%29–39, 41–43, 51
/Users/runner/work/platform-sdk-swift/platform-sdk-swift/Sources/YouVersionPlatformCore/APIs/Users
   SignInWithYouVersionPKCEAuthorizationRequest.swift94.39%100%92.31%94.68%80–81, 87, 98
   SignInWithYouVersionPermission.swift0%100%0%0%8
   SignInWithYouVersionResult.swift86.21%100%50%92%
   Users.swift71.37%100%58.33%72.86%112, 144–150, 155, 16, 165, 17–20, 202, 205, 21, 222, 228, 245–247, 265–267, 269–271, 273–275, 277–279, 284–286, 31–40, 44, 61, 67–71, 85
   YouVersionUserInfo.swift70.59%100%50%73.33%18, 29–31
/Users/runner/work/platform-sdk-swift/platform-sdk-swift/Sources/YouVersionPlatformCore/APIs/VOTD
   VOTD.swift94.12%100%100%93.33%22
   YouVersionVerseOfTheDay.swift0%100%0%0%15–18, 20–25
/Users/runner/work/platform-sdk-swift/platform-sdk-swift/Sources/YouVersionPlatformCore/Bible
   BibleBook.swift100%100%100%100%
   BibleChapterRepository.swift85.26%100%82.76%85.83%111–113, 42, 49, 54–57, 65–68, 83
   BibleContentStorage.swift100%100%100%100%
   BibleHighlight.swift55.56%100%50%57.14%12–14
   BibleHighlightsCache.swift83.92%100%80%84.96%103–105, 117–118, 135–136, 62, 65–67, 72
   BibleHighlightsRepository.swift77.42%100%67.44%78.72%128–132, 19–20, 204–205, 207–209, 21, 210–211, 23, 237–238, 24, 240–244, 25, 27–29, 306–309, 31, 310–319, 32, 320–329, 33, 330–332
   BibleHighlightsViewModel.swift95.35%100%93.75%95.58%45, 48, 52, 57
   BibleNoteIndicatorsCache.swift0%100%0%0%19, 21, 24–26, 29–31, 34–36, 39–41, 44–46
   BibleReference.swift84.15%100%67.24%86.79%131, 226–227, 251, 255, 288, 301, 311, 321, 331, 333–344, 53–57, 83, 85, 87
   BibleTermHighlight.swift92.54%100%92.86%92.45%41–43, 69
   BibleTermHighlightsCache.swift87.88%100%90%86.96%52–54
   BibleTextNode.swift92.86%100%75%95.83%
   BibleTextNodeParser.swift94.29%100%100%93.79%104, 150, 155, 173, 190, 44, 56–59
   BibleVersion.swift70.10%100%86.67%67.07%107–126, 61, 71–74, 80
   BibleVersionRepository.swift86.64%100%83.02%87.45%125–128, 212–217, 243, 248, 276–278, 71–74, 82–85
   DeprecatedBibleAPI.swift0%100%0%0%100, 102–104, 106–108, 110–112, 114–116, 119–121, 126, 128, 131–133, 138, 140, 142–144, 147–149, 27, 29–31, 36, 38, 40–42, 44–46, 48–50, 52–54, 56–58, 65–67, 69–71, 73–75, 77–79, 81–83, 85–87, 94–96, 98–99
/Users/runner/work/platform-sdk-swift/platform-sdk-swift/Sources/YouVersionPlatformCore/Logging
   YouVersionPlatformLogger.swift55.36%100%41.67%59.09%100, 49–51, 56–58, 77–79, 90, 92, 94, 98
/Users/runner/work/platform-sdk-swift/platform-sdk-swift/Sources/YouVersionPlatformCore/Utilities
   AbbreviationSplitting.swift100%100%100%100%
/Users/runner/work/platform-sdk-swift/platform-sdk-swift/Tests/YouVersionPlatformCoreTests
   AbbreviationSplittingTests.swift100%100%100%100%
   BibleChapterRepositoryTests.swift98.68%100%94.12%99.25%
   BibleContentStorageTests.swift100%100%100%100%
   BibleHighlightsCacheTests.swift100%100%100%100%
   BibleHighlightsRepositoryTests.swift99.52%100%100%99.48%56, 66
   BibleHighlightsViewModelTests.swift95.82%100%96.88%95.67%19–25, 30, 38, 46
   BibleMetadataAPITests.swift100%100%100%100%
   BibleReferenceTests.swift100%100%100%100%
   BibleReferenceTests_adjacency.swift100%100%100%100%
   BibleReferenceTests_codable.swift100%100%100%100%
   BibleReferenceTests_contains.swift100

@anthonyraj
anthonyraj marked this pull request as draft July 1, 2026 04:23
@anthonyraj anthonyraj closed this Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant