Skip to content

chore: Upgrade Kotlin side to match YouVersion Kotlin SDK 1.0.1#41

Open
sidorchukandrew wants to merge 5 commits intoas/expo-55-upgradefrom
as/new-kotlin-version
Open

chore: Upgrade Kotlin side to match YouVersion Kotlin SDK 1.0.1#41
sidorchukandrew wants to merge 5 commits intoas/expo-55-upgradefrom
as/new-kotlin-version

Conversation

@sidorchukandrew
Copy link
Collaborator

@sidorchukandrew sidorchukandrew commented Mar 17, 2026

Description

This PR does 2 things:

  1. It updates the YouVersion Kotlin SDK to 1.0.1 and fixes any changes because of that
  2. It fixes any changes required due to the Expo 55 upgrade

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.)

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
  • I have updated the appropriate section in documentation (if needed)

Open with Devin

@sidorchukandrew sidorchukandrew marked this pull request as draft March 17, 2026 11:45
@sidorchukandrew sidorchukandrew marked this pull request as ready for review March 19, 2026 15:14
@sidorchukandrew sidorchukandrew self-assigned this Mar 19, 2026
Copy link
Collaborator

@cameronapak cameronapak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 2 potential issues.

View 4 additional findings in Devin Review.

Open in Devin Review

const NativeView: React.ComponentType<NativeProps> =
requireNativeView("BibleReaderView");

const PlatformHost = Platform.OS === "ios" ? IosHost : AndroidHost;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Incomplete platform-specific Host migration — 3 of 5 TSX components still use iOS-only Host

The PR introduces the PlatformHost pattern in BibleReaderView.tsx and SignInWithYouVersionButton.tsx to select the correct Host component per platform (AndroidHost for Android, IosHost for iOS). However, the same transformation was not applied to src/components/BibleTextView.tsx:1, src/components/BibleWidgetView.tsx:1, and src/components/VotdView.tsx:1, which still import and use Host from @expo/ui/swift-ui (iOS-only). Since this PR also sets up all five Android Kotlin view files (e.g. YVPBibleTextView.kt, YVPBibleWidgetView.kt, YVPVotdView.kt), those three components will fail to render on Android because they wrap their native views in an iOS-only Host.

Prompt for agents
Apply the same platform-specific Host pattern used in src/components/BibleReaderView.tsx and src/components/SignInWithYouVersionButton.tsx to the three remaining component files:

1. src/components/BibleTextView.tsx (line 1): Replace `import { Host } from "@expo/ui/swift-ui";` with the AndroidHost/IosHost pattern, add Platform import, define PlatformHost, and use PlatformHost instead of Host in the JSX.

2. src/components/BibleWidgetView.tsx (line 1): Same changes — import both hosts, define PlatformHost, use PlatformHost instead of Host.

3. src/components/VotdView.tsx (line 1): Same changes — import both hosts, define PlatformHost, use PlatformHost instead of Host.

The pattern to follow is:
  import { Host as AndroidHost } from "@expo/ui/jetpack-compose";
  import { Host as IosHost } from "@expo/ui/swift-ui";
  import { Platform } from "react-native";
  const PlatformHost = Platform.OS === "ios" ? IosHost : AndroidHost;
Then replace all <Host .../> usages with <PlatformHost .../>.
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Comment on lines +30 to +37
val passageId = bibleReference.bookUSFM + "." + bibleReference.chapter.toString()

val response = YouVersionApi.bible.passage(
versionId = bibleReference.versionId,
passageId = passageId
)

return response
return response.content
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Unused context parameter in chapter() after switching to YouVersionApi.bible.passage()

The chapter() function was refactored to use YouVersionApi.bible.passage() which does not require an Android Context, but the context: Context parameter was left in the function signature. The caller at RNYouVersionPlatformModule.kt:59-66 still obtains and passes the ReactContext, which would throw IllegalStateException if ReactContext is not yet available — an unnecessary risk for a parameter that's no longer used. The now-unused BibleVersionRepository import at YVPBibleApi.kt:6 also remains.

Prompt for agents
In android/src/main/java/com/youversion/reactnativesdk/api/YVPBibleApi.kt:
1. Remove the unused import of BibleVersionRepository on line 6
2. Remove the unused import of android.content.Context on line 3
3. Change the chapter function signature on line 29 from `suspend fun chapter(bibleReference: BibleReferenceRecord, context: Context): String` to `suspend fun chapter(bibleReference: BibleReferenceRecord): String`

In android/src/main/java/com/youversion/reactnativesdk/RNYouVersionPlatformModule.kt:
1. On lines 59-66, remove the context-obtaining code and simplify to just: `return@Coroutine YVPBibleApi.chapter(bibleReference = bibleReference)`
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@cameronapak
Copy link
Collaborator

@greptileai, can you please review this PR?

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 20, 2026

Greptile Summary

This PR upgrades the YouVersion Kotlin SDK from 0.6.0 to 1.0.1 and adapts the React Native SDK bridge to the Expo 55 API changes. It introduces paginated fetching for Bible versions and languages, replaces the local BibleVersionRepository.chapter() call with YouVersionApi.bible.passage(), migrates all Android Compose views from the old Content(modifier: Modifier) signature to ComposableScope.Content(), and adds cross-platform Host selection in the TypeScript components.

Key changes:

  • Pagination: YVPBibleApi.versions() and YVPLanguagesApi.languages() now loop through all pages using a do-while on nextPageToken, transparently aggregating results for callers.
  • Chapter API: BibleVersionRepository (a local/offline API) is replaced by YouVersionApi.bible.passage() (network API); passage ID is constructed as bookUSFM.chapter (e.g. "GEN.1").
  • Expo 55 view API: All five Compose views migrate to ComposableScope.Content() and drop the modifier parameter; placeholder views switch to Modifier directly.
  • Cross-platform hosts: BibleReaderView.tsx and SignInWithYouVersionButton.tsx now conditionally use AndroidHost (@expo/ui/jetpack-compose) on Android and IosHost (@expo/ui/swift-ui) on iOS.
  • Null safety: Several LanguageRecord fields (including id and language) are now nullable, reflecting changes in the Language model in SDK 1.0.1.
  • Stale code: The context: Context parameter in YVPBibleApi.chapter() and its associated imports (BibleReference, BibleVersionRepository) are no longer used and should be removed.

Confidence Score: 4/5

  • This PR is safe to merge after addressing the unused context parameter cleanup; no functional regressions detected.
  • The changes are well-scoped SDK and framework upgrades with a consistent migration pattern across all views. The pagination logic is correct, and the cross-platform host selection is appropriate. Two minor issues lower the score slightly: the unused context parameter and stale imports in YVPBibleApi.kt, and the SwiftUI-only fixedSize() modifier being silently ignored on Android — both are style/cleanup concerns rather than functional bugs.
  • android/src/main/java/com/youversion/reactnativesdk/api/YVPBibleApi.kt (unused parameter/imports) and src/components/SignInWithYouVersionButton.tsx (SwiftUI modifier on cross-platform view)

Important Files Changed

Filename Overview
android/build.gradle Bumps all three YouVersion platform SDK dependencies from 0.6.0 to 1.0.1; straightforward version bump.
android/src/main/java/com/youversion/reactnativesdk/api/YVPBibleApi.kt Adds do-while pagination loop for versions(); replaces local BibleVersionRepository.chapter() call with YouVersionApi.bible.passage(). The context: Context parameter and two imports (BibleReference, BibleVersionRepository) are now unused and should be removed.
android/src/main/java/com/youversion/reactnativesdk/api/YVPRecords.kt Makes several LanguageRecord fields nullable to match SDK 1.0.1 model changes, including id and language. Consumers that previously relied on these fields being non-null will need null-safe access.
android/src/main/java/com/youversion/reactnativesdk/views/YVPSignInWithYouVersionButton.kt Migrates to ComposableScope.Content() (Expo 55 API) and removes AutoSizingComposable wrapper; button sizing on Android now relies entirely on ComposableScope — verify rendering is correct.
src/components/BibleReaderView.tsx Replaces the iOS-only Host with a platform-conditional PlatformHost (IosHost / AndroidHost); correct cross-platform adaptation for Expo 55.
src/components/SignInWithYouVersionButton.tsx Switches to PlatformHost and simplifies matchContents to a boolean; fixedSize() (SwiftUI-only modifier) is still passed to the cross-platform NativeView and will be silently ignored on Android.

Sequence Diagram

sequenceDiagram
    participant RN as React Native
    participant API as YVPBibleApi / YVPLanguagesApi
    participant YV as YouVersionApi (SDK 1.0.1)

    Note over API,YV: Paginated versions fetch (new)
    RN->>API: versions(languageTag)
    loop while nextPageToken != null
        API->>YV: bible.versions(languageTag, pageToken)
        YV-->>API: { data, nextPageToken }
        API->>API: allResults.addAll(data)
    end
    API-->>RN: List<BibleVersionRecord>

    Note over API,YV: Chapter fetch (refactored)
    RN->>API: chapter(bibleReference, context)
    API->>YV: bible.passage(versionId, passageId)
    YV-->>API: { content, ... }
    API-->>RN: String (HTML content)
Loading

Last reviewed commit: "chore: use appropria..."

@@ -19,14 +27,13 @@ object YVPBibleApi {
}

suspend fun chapter(bibleReference: BibleReferenceRecord, context: Context): String {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Unused context parameter and stale imports

The refactored chapter() function no longer uses the context: Context parameter or the two domain imports that were needed by the old BibleVersionRepository-based implementation. These should be cleaned up to avoid dead code and potential compiler warnings.

Suggested change
suspend fun chapter(bibleReference: BibleReferenceRecord, context: Context): String {
suspend fun chapter(bibleReference: BibleReferenceRecord): String {

Also remove the two now-unused import lines at the top of the file:

import com.youversion.platform.core.bibles.domain.BibleReference
import com.youversion.platform.core.bibles.domain.BibleVersionRepository

@@ -71,6 +74,6 @@ export function SignInWithYouVersionButton({
onTap={onPress}
modifiers={[fixedSize()]}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 SwiftUI-only fixedSize() modifier applied on Android

fixedSize() is imported from @expo/ui/swift-ui/modifiers and has no Android equivalent. On iOS, combined with the old AutoSizingComposable wrapper (which has since been removed from the Kotlin side), it controlled button sizing. Now that AutoSizingComposable is gone and Android uses AndroidHost, this modifier will be silently ignored on Android.

Please verify that the SignInWithYouVersionButton renders and sizes correctly on Android without this modifier taking effect. If auto-sizing on Android is handled entirely by the new ComposableScope API, a comment here explaining that would help future readers understand why a SwiftUI modifier is still present in a cross-platform component.

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.

2 participants