From ef9064aab5d728a3fd7fccbe1522eb7b0bedb91e Mon Sep 17 00:00:00 2001 From: Andrew Sidorchuk Date: Tue, 13 Jan 2026 21:06:28 -0500 Subject: [PATCH 1/6] chore: match all new fields from Swift SDK --- ios/APIs/YVPBibleAPI.swift | 32 +++++++++------- ios/APIs/YVPLanguagesAPI.swift | 4 +- ios/Views/YVPBibleTextView.swift | 11 +++--- ios/YVPAuthAPI.swift | 25 +++++-------- src/api/users.ts | 5 +-- src/native.ts | 2 +- src/types.ts | 63 +++++++++++++++----------------- 7 files changed, 67 insertions(+), 75 deletions(-) diff --git a/ios/APIs/YVPBibleAPI.swift b/ios/APIs/YVPBibleAPI.swift index 052c9f4..b78be96 100644 --- a/ios/APIs/YVPBibleAPI.swift +++ b/ios/APIs/YVPBibleAPI.swift @@ -68,10 +68,10 @@ internal struct BibleVersionRecord: Record { var abbreviation: String? @Field - var copyrightLong: String? + var promotionalContent: String? @Field - var copyrightShort: String? + var copyright: String? @Field var languageTag: String? @@ -94,6 +94,9 @@ internal struct BibleVersionRecord: Record { @Field var bookCodes: [String]? + @Field + var organizationId: String? + @Field var books: [BibleBookRecord]? @@ -105,14 +108,15 @@ internal struct BibleVersionRecord: Record { init(bibleVersion: BibleVersion) { self.id = bibleVersion.id self.abbreviation = bibleVersion.abbreviation - self.copyrightLong = bibleVersion.copyrightLong - self.copyrightShort = bibleVersion.copyrightShort + self.promotionalContent = bibleVersion.promotionalContent + self.copyright = bibleVersion.copyright self.languageTag = bibleVersion.languageTag self.localizedAbbreviation = bibleVersion.localizedAbbreviation self.localizedTitle = bibleVersion.localizedTitle self.readerFooter = bibleVersion.readerFooter self.readerFooterUrl = bibleVersion.readerFooterUrl self.title = bibleVersion.title + self.organizationId = bibleVersion.organizationId self.bookCodes = bibleVersion.bookCodes if let bibleVersionBooks = bibleVersion.books { @@ -125,7 +129,7 @@ internal struct BibleVersionRecord: Record { internal struct BibleBookRecord: Record { @Field - var usfm: String? + var id: String? @Field var abbreviation: String? @@ -134,18 +138,22 @@ internal struct BibleBookRecord: Record { var title: String? @Field - var titleLong: String? + var fullTitle: String? @Field var chapters: [BibleChapterRecord]? + @Field + var canon: String? + init() { } init(bibleBook: BibleBook) { - self.usfm = bibleBook.usfm + self.id = bibleBook.id self.abbreviation = bibleBook.abbreviation self.title = bibleBook.title - self.titleLong = bibleBook.titleLong + self.fullTitle = bibleBook.fullTitle + self.canon = bibleBook.canon if let bibleBookChapters = bibleBook.chapters { self.chapters = bibleBookChapters.map(BibleChapterRecord.init) @@ -155,10 +163,7 @@ internal struct BibleBookRecord: Record { internal struct BibleChapterRecord: Record { @Field - var bookUSFM: String? - - @Field - var isCanonical: Bool? + var id: String? @Field var passageId: String? @@ -169,8 +174,7 @@ internal struct BibleChapterRecord: Record { init() { } init(bibleChapter: BibleChapter) { - self.bookUSFM = bibleChapter.bookUSFM - self.isCanonical = bibleChapter.isCanonical + self.id = bibleChapter.id self.passageId = bibleChapter.passageId self.title = bibleChapter.title } diff --git a/ios/APIs/YVPLanguagesAPI.swift b/ios/APIs/YVPLanguagesAPI.swift index 6aa8153..4e0c7dc 100644 --- a/ios/APIs/YVPLanguagesAPI.swift +++ b/ios/APIs/YVPLanguagesAPI.swift @@ -52,7 +52,7 @@ internal struct LanguageRecord: Record { var textDirection: String @Field - var defaultBibleVersionId: Int? + var defaultBibleId: Int? init(_ response: LanguageOverview) { self.id = response.id @@ -65,6 +65,6 @@ internal struct LanguageRecord: Record { self.variants = response.variants self.countries = response.countries self.textDirection = response.textDirection - self.defaultBibleVersionId = response.defaultBibleVersionId + self.defaultBibleId = response.defaultBibleId } } diff --git a/ios/Views/YVPBibleTextView.swift b/ios/Views/YVPBibleTextView.swift index 819f776..7c59158 100644 --- a/ios/Views/YVPBibleTextView.swift +++ b/ios/Views/YVPBibleTextView.swift @@ -38,10 +38,10 @@ struct YVPBibleTextView: ExpoSwiftUI.View, ExpoSwiftUI.WithHostingView { BibleTextView( bibleReference(), textOptions: textOptions(), - onVerseTap: { bibleRef, point in + onVerseTap: { bibleRef, urlScheme, footnotes in props.onTap([ "bibleReference": toJsBibleReference(bibleRef), - "point": toJsPoint(point) + "urlScheme": urlScheme ]) } ) @@ -57,10 +57,7 @@ struct YVPBibleTextView: ExpoSwiftUI.View, ExpoSwiftUI.WithHostingView { "type": "verse" ] } - - func toJsPoint(_ point: CGPoint) -> [String: CGFloat] { - ["x": point.x, "y": point.y] - } + func bibleReference() -> BibleReference { if let start = props.verseStart, let end = props.verseEnd { @@ -108,6 +105,8 @@ struct YVPBibleTextView: ExpoSwiftUI.View, ExpoSwiftUI.WithHostingView { case "none": .none case "inline": .inline case "marker": .marker + case "letters": .letters + case "image": .image default: .none } } diff --git a/ios/YVPAuthAPI.swift b/ios/YVPAuthAPI.swift index b8da651..0a56243 100644 --- a/ios/YVPAuthAPI.swift +++ b/ios/YVPAuthAPI.swift @@ -23,7 +23,8 @@ struct YVPAuthAPI { "refreshToken": response.refreshToken, "name": response.name, "profilePicture": response.profilePicture, - "email": response.email + "email": response.email, + "idToken": response.idToken, ]) } catch { promise.reject(error) @@ -37,21 +38,13 @@ struct YVPAuthAPI { } } - static func userInfo(accessToken: String?, promise: Promise) { - Task { - do { - let response = try await YouVersionAPI.Users.userInfo(accessToken: accessToken) - - promise.resolve([ - "firstName": response.firstName, - "lastName": response.lastName, - "userId": response.userId, - "avatarUrl": response.avatarUrl?.absoluteString - ]) - } catch { - promise.reject(error) - } - } + static func userInfo(promise: Promise) { + promise.resolve([ + "name": YouVersionAPI.Users.currentUserName, + "email": YouVersionAPI.Users.currentUserEmail, + "id": YouVersionAPI.Users.currentUserId, + "profilePicture": YouVersionAPI.Users.currentUserProfilePicture + ]) } } diff --git a/src/api/users.ts b/src/api/users.ts index 1ac5c14..39ac386 100644 --- a/src/api/users.ts +++ b/src/api/users.ts @@ -26,10 +26,9 @@ export const UsersAPI = { /** * Retrieves user information for the authenticated user using the provided access token. * - * @param accessToken - Optionally provide an accessToken, or use the one stored in the SDK after the user signs in * @returns A promise that resolves to the user information as a {@link YouVersionUserInfo} object. */ - userInfo(accessToken?: string): Promise { - return Module.userInfo(accessToken); + userInfo(): Promise { + return Module.userInfo(); }, }; diff --git a/src/native.ts b/src/native.ts index eab1346..a4a86d0 100644 --- a/src/native.ts +++ b/src/native.ts @@ -19,7 +19,7 @@ declare class RNYouVersionPlatformModule extends NativeModule { signOut(): Promise; - userInfo(accessToken?: string): Promise; + userInfo(): Promise; verseOfTheDay(dayOfYear: number): Promise; diff --git a/src/types.ts b/src/types.ts index 67444fc..47a323b 100644 --- a/src/types.ts +++ b/src/types.ts @@ -9,20 +9,16 @@ export type SignInWithYouVersionResult = { name?: string; profilePicture?: string; email?: string; + idToken?: string; }; -export type SignInWithYouVersionPermission = - | "bibles" - | "highlights" - | "votd" - | "demographics" - | "bible_activity"; +export type SignInWithYouVersionPermission = "openid" | "email" | "profile"; export interface YouVersionUserInfo { - firstName?: string; - lastName?: string; - userId?: string; - avatarUrl?: string; + name?: string; + email?: string; + id?: string; + profilePicture?: string; } export interface YouVersionVerseOfTheDay { @@ -88,7 +84,12 @@ export interface BibleTextOptions { renderVerseNumbers?: boolean | null | undefined; } -export type BibleTextFootnoteMode = "none" | "inline" | "marker"; +export type BibleTextFootnoteMode = + | "none" + | "inline" + | "marker" + | "letters" + | "image"; export interface BibleReferenceBase { /** The ID of the Bible version */ @@ -139,12 +140,7 @@ export type BibleReference = export interface OnBibleTextPressEvent { /** A reference to the Bible verse that was pressed */ bibleReference: BibleReferenceVerse; - - /** The coordinates of the press event */ - point: { - x: number; - y: number; - }; + urlScheme: string; } export interface LanguageOverview { @@ -222,7 +218,7 @@ export interface LanguageOverview { * * @example 111 */ - defaultBibleVersionId?: number; + defaultBibleId?: number; } export interface HighlightResponse { @@ -273,14 +269,14 @@ export interface BibleVersion { * * @example "

Biblica is the worldwide publisher and translation sponsor of the New International Version—one of the most widely read contemporary English versions of the Bible.

At Biblica, we believe that with God, all things are possible. Partnering with other ministries and people like you, we are reaching the world with God’s Word, providing Bibles that are easier to understand and faster to receive. When God’s Word is put into someone’s hands, it has the power to change everything.

To learn more, visit biblica.com and facebook.com/Biblica.

" */ - copyrightLong?: string; + promotionalContent?: string; /** * Short version of the copyright text provided by the publisher for the given Bible version. * * @example "The Holy Bible, New International Version® NIV® Copyright © 1973, 1978, 1984, 2011 by Biblica, Inc.® Used by Permission of Biblica, Inc.® All rights reserved worldwide." */ - copyrightShort?: string; + copyright?: string; /** * BCP47 canonical language tag for this Bible version @@ -329,15 +325,18 @@ export interface BibleVersion { * @example "ltr" */ textDirection?: string; + + /** uuid */ + organizationId?: string; } export interface BibleBook { /** - * Standard book identifier for the Unified Scripture Format Markup (USFM) used in Scripture text processing + * Book identifier * * @example "GEN" */ - usfm?: string; + id?: string; /** * Book name abbreviation if provided by the publisher @@ -353,12 +352,19 @@ export interface BibleBook { */ title?: string; + /** + * Full book title if available + * + * @example "The Book of Genesis" + */ + fullTitle?: string; + /** * Indicates if this is Old Testament, New Testament, or Deuterocanonical * - * @example "ot" + * @example "new_testament" */ - canon?: "nt" | "ot" | "dc"; + canon?: "new_testament" | "old_testament" | "deuterocanon"; chapters?: BibleChapter[]; } @@ -371,15 +377,6 @@ export interface BibleChapter { */ id?: string; - /** - * Book identifier - * - * @example "GEN" - */ - bookUSFM?: string; - - isCanonical?: boolean; - /** * Canonical representation of the passage * From a709d280fd97ff9780f6b605d10db022623cbdb6 Mon Sep 17 00:00:00 2001 From: Andrew Sidorchuk Date: Tue, 13 Jan 2026 21:07:14 -0500 Subject: [PATCH 2/6] chore: add unimplemented footnotes type This will be temporary until we figure out how to create a representation of footnotes that can be cross platform. --- src/types.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/types.ts b/src/types.ts index 47a323b..bd15411 100644 --- a/src/types.ts +++ b/src/types.ts @@ -141,6 +141,8 @@ export interface OnBibleTextPressEvent { /** A reference to the Bible verse that was pressed */ bibleReference: BibleReferenceVerse; urlScheme: string; + /** Not implemented yet */ + footnotes: unknown[]; } export interface LanguageOverview { From 174b47cfda0debcfde8d9ba5fda23f5ccc601730 Mon Sep 17 00:00:00 2001 From: Andrew Sidorchuk Date: Tue, 13 Jan 2026 21:07:46 -0500 Subject: [PATCH 3/6] chore: update example app with new fields --- example/src/screens/ProfileScreen.tsx | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/example/src/screens/ProfileScreen.tsx b/example/src/screens/ProfileScreen.tsx index 48168d3..61610c6 100644 --- a/example/src/screens/ProfileScreen.tsx +++ b/example/src/screens/ProfileScreen.tsx @@ -4,7 +4,7 @@ import { YouVersionPlatform, YouVersionUserInfo, } from "@youversion/platform-sdk-reactnative"; -import { useEffect, useLayoutEffect, useState } from "react"; +import { useLayoutEffect, useState } from "react"; import { ActivityIndicator, Alert, @@ -41,8 +41,12 @@ export function ProfileScreen() { async function handleSignIn() { try { - const signInResult = await YouVersionAPI.Users.signIn(["bibles"]); - console.log("Sign-in result:", signInResult); + const signInResult = await YouVersionAPI.Users.signIn([ + "email", + "profile", + "openid", + ]); + console.log("Sign-in result:", JSON.stringify(signInResult, null, 2)); } catch (error) { Alert.alert("Error signing in"); console.error("Error signing in:", error); @@ -76,13 +80,11 @@ export function ProfileScreen() { {currentUser && ( <> - - You are signed in as {currentUser.firstName || "(no firstname)"}{" "} - {currentUser.lastName || "(no lastname)"} - + You are signed in as {currentUser.name || "(no name)"} + {currentUser.email || "(no email)"}