Skip to content

Feature/verse change encounters#262

Merged
develop4God merged 15 commits into
mainfrom
feature/verse-change-encounters
Jun 21, 2026
Merged

Feature/verse change encounters#262
develop4God merged 15 commits into
mainfrom
feature/verse-change-encounters

Conversation

@develop4God

Copy link
Copy Markdown
Owner

No description provided.

…JSON fallback

Add IVerseResolverService/VerseResolverService in bible_reader_core,
composing existing BibleVersionRegistry, BibleReferenceParser, and
BibleDbService to look up verse text in the user's selected Bible
version (DevocionalProvider.selectedVersion).

Add ResolvedVerseText widget in Encounters, used at 4 call sites
(ScriptureMomentCard, _ModernVerseOverlay, _ConnectionTile,
CompletionCard). Renders authored JSON text immediately and silently
swaps in resolved text if a matching SQLite version is found —
no loading state, since fallback text is never wrong.

No JSON content files modified. Bible reader and KeyVerseCard/Discovery
are explicitly untouched — Discovery wiring deferred to a follow-up.

- New: bible_reader_core/lib/src/i_verse_resolver_service.dart
- New: bible_reader_core/lib/src/verse_resolver_service.dart
- New: lib/widgets/encounter/resolved_verse_text.dart
- Modified: lib/services/service_locator.dart (DI registration)
- Modified: lib/widgets/encounter/encounter_card_widgets.dart (4 call sites)
- Tests: architecture/SOLID compliance tests added; CompletionCard tests
  updated to provide DevocionalProvider + fake resolver

Glory to God 🙏
- Create `verse_resolver_service_test.dart` to provide comprehensive coverage for Bible verse resolution
- Implement `_FakeBibleDbService` and `_TestableVerseResolver` to facilitate isolated testing without SQLite dependencies
- Add test cases for contract compliance, including null checks for unknown version codes and malformed references
- Verify matching logic for various Bible versions such as KJV, RVR1960, ESV, and NVI
- Ensure robust error handling for missing books, missing verses, and database initialization failures
- Apply `BibleTextNormalizer.clean` to resolved verse text in `VerseResolverService`
- Update `verse_resolver_service_test.dart` to reflect normalization changes in the test helper logic
- Use `selectedVersion` from `DevocionalProvider` instead of `study.bibleVersion` in `EncounterDetailPage`
- Wrap `EncounterDetailPage` and `CompletionCard` with `ChangeNotifierProvider` in unit tests to provide required `DevocionalProvider` dependency
- Add `debugPrint` statements to track database matches, parsing results, and resolution status
- Normalize verse references by removing trailing ranges (e.g., "-10") before parsing to ensure successful lookups
- Improve error visibility for missing books or failed database queries in `verse_resolver_service.dart`
- Add `debugPrint` for exceptions and stack traces in `getVerse` to improve error visibility during verse resolution.
- Remove 'NTV' from the Spanish versions list in `bibleVersionsByLanguage` as it is not yet available in the drawer
- Update documentation for `bibleVersionsByLanguage` to clarify its role as the single source of truth for version lists and menu options
- Update regex logic to capture end-verse boundaries in references (e.g., "1:1-3")
- Implement a loop to fetch and concatenate all verses within a specified range from the database
- Ensure all verses in a range are present; if any verse is missing, return `null` to trigger the JSON fallback
- Join multiple resolved verses with spaces and apply `BibleTextNormalizer.clean` to each segment
- Enhance debug logging to show the count of resolved verses or specific missing verse coordinates within a range
- Add logic to `_TestableVerseResolver` to parse and resolve verse ranges (e.g., "Genesis 1:1-3")
- Implement consecutive verse fetching and concatenation with space separation
- Ensure the resolver returns `null` if any single verse within a requested range is missing
- Update `_FakeBibleDbService` to support mocking multiple verses by verse number
- Add unit tests covering successful range resolution, partial range failures, and single-verse regression cases
…ests

- Add optional `versionProvider` to `VerseResolverService` constructor to allow injection of Bible versions, defaulting to `BibleVersionRegistry.getAllVersions`
- Remove `_TestableVerseResolver` subclass in unit tests, replacing it with the standard service using the new provider-based injection
- Update debug logging in `resolveVerseText` to include information about detected verse ranges
- Refactor test helper logic to use a factory function `_createTestResolver` for cleaner test setup
- Use `widget.bibleVersion` instead of `widget.card.completionVerse!.bibleVersion` for the Bible version label in `CompletionCard`
- Add a `Builder` with `debugPrint` to log and compare JSON-authored versions against the live `selectedVersion` during rendering
- Remove 'ESV' from the English language list in `bibleVersionsByLanguage` within `constants.dart`
- Update comments for Spanish and English entries to indicate that NTV and ESV are not yet available in the drawer menu
- Introduce a unified `VerseRef` model in `bible_reader_core` to replace redundant classes including `KeyVerse`, `ScriptureConnection`, `EncounterVerseOverlay`, and `EncounterCompletionVerse`
- Move `ResolvedVerseText` widget from `widgets/encounter` to `widgets/scripture` for shared use across the application
- Update `KeyVerseCard` and `DiscoveryDetailPage` to utilize `ResolvedVerseText`, enabling dynamic verse resolution based on the user's selected Bible version
- Refactor `DiscoveryCard`, `DiscoveryDevotional`, `EncounterCard`, and `EncounterStudy` models to use the consolidated `VerseRef` type
- Update unit and widget tests to reflect model changes and provide necessary `IVerseResolverService` stubs for components using `ResolvedVerseText`
…er cards

- Implement rendering logic for `verseOverlay` using `_ModernVerseOverlay` with a timed entry animation
- Add a "Deeper Connections" section to display `scriptureConnections` via `_ConnectionTile` components
- Adjust animation delays for `revelationKey` and new elements to ensure a staggered, sequential appearance
- Update `CompletionCard` unit tests to include the required `bibleVersion` parameter and increase `pump` duration to accommodate entry animations
…er cards

- Implement rendering logic for `verseOverlay` using `_ModernVerseOverlay` with a timed entry animation
- Add a "Deeper Connections" section to display `scriptureConnections` via `_ConnectionTile` components
- Adjust animation delays for `revelationKey` and new elements to ensure a staggered, sequential appearance
- Update `CompletionCard` unit tests to include the required `bibleVersion` parameter and increase `pump` duration to accommodate entry animations
@github-actions

Copy link
Copy Markdown
Contributor

🎉 CI Results for PR #262

🔄 Static Analysis:
🔄 Tests:

Coverage data unavailable

⚠️ Issues found - check the logs


Generated by GitHub Actions

@develop4God develop4God merged commit abb36eb into main Jun 21, 2026
11 checks passed
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