@youversion/platform-react-native 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.releaserc.json +104 -0
- package/CHANGELOG.md +29 -0
- package/CONTRIBUTING.md +319 -0
- package/LICENSE +201 -0
- package/README.md +562 -0
- package/RELEASING.md +85 -0
- package/android/build.gradle +43 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/assets/github-reactNative-sdk-banner.png +0 -0
- package/build/api/bible.d.ts +26 -0
- package/build/api/bible.d.ts.map +1 -0
- package/build/api/bible.js +32 -0
- package/build/api/bible.js.map +1 -0
- package/build/api/highlights.d.ts +109 -0
- package/build/api/highlights.d.ts.map +1 -0
- package/build/api/highlights.js +49 -0
- package/build/api/highlights.js.map +1 -0
- package/build/api/index.d.ts +27 -0
- package/build/api/index.d.ts.map +1 -0
- package/build/api/index.js +13 -0
- package/build/api/index.js.map +1 -0
- package/build/api/languages.d.ts +11 -0
- package/build/api/languages.d.ts.map +1 -0
- package/build/api/languages.js +13 -0
- package/build/api/languages.js.map +1 -0
- package/build/api/users.d.ts +20 -0
- package/build/api/users.d.ts.map +1 -0
- package/build/api/users.js +26 -0
- package/build/api/users.js.map +1 -0
- package/build/api/votd.d.ts +15 -0
- package/build/api/votd.d.ts.map +1 -0
- package/build/api/votd.js +13 -0
- package/build/api/votd.js.map +1 -0
- package/build/components/BibleReaderView.d.ts +22 -0
- package/build/components/BibleReaderView.d.ts.map +1 -0
- package/build/components/BibleReaderView.js +18 -0
- package/build/components/BibleReaderView.js.map +1 -0
- package/build/components/BibleTextView.d.ts +18 -0
- package/build/components/BibleTextView.d.ts.map +1 -0
- package/build/components/BibleTextView.js +25 -0
- package/build/components/BibleTextView.js.map +1 -0
- package/build/components/BibleWidgetView.d.ts +23 -0
- package/build/components/BibleWidgetView.d.ts.map +1 -0
- package/build/components/BibleWidgetView.js +17 -0
- package/build/components/BibleWidgetView.js.map +1 -0
- package/build/components/SignInWithYouVersionButton.d.ts +37 -0
- package/build/components/SignInWithYouVersionButton.d.ts.map +1 -0
- package/build/components/SignInWithYouVersionButton.js +12 -0
- package/build/components/SignInWithYouVersionButton.js.map +1 -0
- package/build/components/VotdView.d.ts +11 -0
- package/build/components/VotdView.d.ts.map +1 -0
- package/build/components/VotdView.js +12 -0
- package/build/components/VotdView.js.map +1 -0
- package/build/components/index.d.ts +6 -0
- package/build/components/index.d.ts.map +1 -0
- package/build/components/index.js +6 -0
- package/build/components/index.js.map +1 -0
- package/build/index.d.ts +5 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +6 -0
- package/build/index.js.map +1 -0
- package/build/native.d.ts +22 -0
- package/build/native.d.ts.map +1 -0
- package/build/native.js +3 -0
- package/build/native.js.map +1 -0
- package/build/platform.d.ts +21 -0
- package/build/platform.d.ts.map +1 -0
- package/build/platform.js +28 -0
- package/build/platform.js.map +1 -0
- package/build/types.d.ts +320 -0
- package/build/types.d.ts.map +1 -0
- package/build/types.js +2 -0
- package/build/types.js.map +1 -0
- package/commitlint.config.js +23 -0
- package/dist/youversion-platform-react-native-0.7.2.tgz +0 -0
- package/eslint.config.js +4 -0
- package/expo-module.config.json +17 -0
- package/ios/APIs/YVPBibleAPI.swift +197 -0
- package/ios/APIs/YVPHighlightsAPI.swift +105 -0
- package/ios/APIs/YVPLanguagesAPI.swift +70 -0
- package/ios/RNBibleReaderViewModule.swift +9 -0
- package/ios/RNBibleTextViewModule.swift +9 -0
- package/ios/RNBibleWidgetViewModule.swift +9 -0
- package/ios/RNSignInWithYouVersionButtonModule.swift +9 -0
- package/ios/RNVotdViewModule.swift +9 -0
- package/ios/RNYouVersionPlatformModule.swift +79 -0
- package/ios/Views/YVPBibleReaderView.swift +57 -0
- package/ios/Views/YVPBibleTextView.swift +114 -0
- package/ios/Views/YVPBibleWidgetView.swift +64 -0
- package/ios/Views/YVPSignInWithYouVersionButton.swift +52 -0
- package/ios/Views/YVPVotdView.swift +35 -0
- package/ios/YVPAuthAPI.swift +77 -0
- package/ios/YVPVotdAPI.swift +20 -0
- package/ios/YVPlatform.swift +17 -0
- package/ios/YouVersionReactNative.podspec +33 -0
- package/mocks/RNYouVersionPlatform.ts +146 -0
- package/package.json +58 -0
- package/scripts/release-local.sh +224 -0
- package/scripts/sync-android-version.js +75 -0
- package/src/api/bible.ts +35 -0
- package/src/api/highlights.ts +145 -0
- package/src/api/index.ts +13 -0
- package/src/api/languages.ts +14 -0
- package/src/api/users.ts +35 -0
- package/src/api/votd.ts +20 -0
- package/src/components/BibleReaderView.tsx +52 -0
- package/src/components/BibleTextView.tsx +63 -0
- package/src/components/BibleWidgetView.tsx +45 -0
- package/src/components/SignInWithYouVersionButton.tsx +70 -0
- package/src/components/VotdView.tsx +36 -0
- package/src/components/index.ts +5 -0
- package/src/index.ts +5 -0
- package/src/native.ts +58 -0
- package/src/platform.ts +30 -0
- package/src/types.ts +382 -0
- package/tsconfig.json +9 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
|
|
2
|
+
import ExpoModulesCore
|
|
3
|
+
import YouVersionPlatform
|
|
4
|
+
import SwiftUI
|
|
5
|
+
|
|
6
|
+
class BibleWidgetViewProps: ExpoSwiftUI.ViewProps {
|
|
7
|
+
// Bible reference
|
|
8
|
+
@Field var versionId: Int
|
|
9
|
+
@Field var bookUSFM: String
|
|
10
|
+
@Field var chapter: Int
|
|
11
|
+
@Field var verse: Int?
|
|
12
|
+
@Field var verseStart: Int?
|
|
13
|
+
@Field var verseEnd: Int?
|
|
14
|
+
|
|
15
|
+
@Field var fontSize: Float?
|
|
16
|
+
@Field var colorScheme: String?
|
|
17
|
+
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
struct YVPBibleWidgetView: ExpoSwiftUI.View, ExpoSwiftUI.WithHostingView {
|
|
21
|
+
@ObservedObject var props: BibleWidgetViewProps
|
|
22
|
+
@EnvironmentObject var shadowNodeProxy: ExpoSwiftUI.ShadowNodeProxy
|
|
23
|
+
@Environment(\.colorScheme) var environmentColorScheme
|
|
24
|
+
|
|
25
|
+
init(props: BibleWidgetViewProps) {
|
|
26
|
+
self.props = props
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
var body: some View {
|
|
30
|
+
ExpoSwiftUI.AutoSizingStack(shadowNodeProxy: shadowNodeProxy, axis: .vertical) {
|
|
31
|
+
BibleWidgetView(
|
|
32
|
+
reference: bibleReference(),
|
|
33
|
+
fontSize: CGFloat(props.fontSize ?? 23)
|
|
34
|
+
).environment(\.colorScheme, colorScheme())
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
func colorScheme() -> ColorScheme {
|
|
39
|
+
switch props.colorScheme?.lowercased() {
|
|
40
|
+
case "dark": return .dark
|
|
41
|
+
case "light": return .light
|
|
42
|
+
default: return environmentColorScheme
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
func bibleReference() -> BibleReference {
|
|
47
|
+
if let start = props.verseStart, let end = props.verseEnd {
|
|
48
|
+
return BibleReference(
|
|
49
|
+
versionId: props.versionId,
|
|
50
|
+
bookUSFM: props.bookUSFM,
|
|
51
|
+
chapter: props.chapter,
|
|
52
|
+
verseStart: start,
|
|
53
|
+
verseEnd: end
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return BibleReference(
|
|
58
|
+
versionId: props.versionId,
|
|
59
|
+
bookUSFM: props.bookUSFM,
|
|
60
|
+
chapter: props.chapter,
|
|
61
|
+
verse: props.verse
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import ExpoModulesCore
|
|
2
|
+
import YouVersionPlatform
|
|
3
|
+
import SwiftUI
|
|
4
|
+
|
|
5
|
+
class SignInWithYouVersionButtonProps: ExpoSwiftUI.ViewProps {
|
|
6
|
+
@Field var mode: String = "full"
|
|
7
|
+
@Field var shape: String = "capsule"
|
|
8
|
+
@Field var isStroked: Bool = true
|
|
9
|
+
@Field var colorScheme: String?
|
|
10
|
+
var onTap = EventDispatcher()
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
struct YVPSignInWithYouVersionButton: ExpoSwiftUI.View, ExpoSwiftUI.WithHostingView {
|
|
14
|
+
@ObservedObject var props: SignInWithYouVersionButtonProps
|
|
15
|
+
@EnvironmentObject var shadowNodeProxy: ExpoSwiftUI.ShadowNodeProxy
|
|
16
|
+
@Environment(\.colorScheme) var environmentColorScheme
|
|
17
|
+
|
|
18
|
+
init(props: SignInWithYouVersionButtonProps) {
|
|
19
|
+
self.props = props
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
var body: some View {
|
|
23
|
+
ExpoSwiftUI.AutoSizingStack (shadowNodeProxy: shadowNodeProxy, axis: .both) {
|
|
24
|
+
SignInWithYouVersionButton(
|
|
25
|
+
shape: shape(),
|
|
26
|
+
mode: mode(),
|
|
27
|
+
isStroked: props.isStroked
|
|
28
|
+
) {
|
|
29
|
+
props.onTap()
|
|
30
|
+
}.environment(\.colorScheme, colorScheme())
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
func shape() -> SignInWithYouVersionButton.ButtonShape {
|
|
35
|
+
switch(props.shape) {
|
|
36
|
+
case "capsule": return .capsule
|
|
37
|
+
default: return .rectangle
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
func mode() -> SignInWithYouVersionButton.Mode {
|
|
42
|
+
return SignInWithYouVersionButton.Mode(rawValue: props.mode) ?? SignInWithYouVersionButton.Mode.full
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
func colorScheme() -> ColorScheme {
|
|
46
|
+
switch props.colorScheme?.lowercased() {
|
|
47
|
+
case "dark": return .dark
|
|
48
|
+
case "light": return .light
|
|
49
|
+
default: return environmentColorScheme
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
|
|
2
|
+
import ExpoModulesCore
|
|
3
|
+
import YouVersionPlatform
|
|
4
|
+
import SwiftUI
|
|
5
|
+
|
|
6
|
+
class VotdViewProps: ExpoSwiftUI.ViewProps {
|
|
7
|
+
@Field var bibleVersionId: Int?
|
|
8
|
+
@Field var colorScheme: String? = nil
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
struct YVPVotdView: ExpoSwiftUI.View, ExpoSwiftUI.WithHostingView {
|
|
12
|
+
@ObservedObject var props: VotdViewProps
|
|
13
|
+
@EnvironmentObject var shadowNodeProxy: ExpoSwiftUI.ShadowNodeProxy
|
|
14
|
+
@Environment(\.colorScheme) var environmentColorScheme
|
|
15
|
+
|
|
16
|
+
init(props: VotdViewProps) {
|
|
17
|
+
self.props = props
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
var body: some View {
|
|
21
|
+
ExpoSwiftUI.AutoSizingStack(shadowNodeProxy: shadowNodeProxy, axis: .vertical) {
|
|
22
|
+
VotdView(
|
|
23
|
+
bibleVersionId: props.bibleVersionId ?? 111
|
|
24
|
+
).environment(\.colorScheme, colorScheme())
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
func colorScheme() -> ColorScheme {
|
|
29
|
+
switch props.colorScheme?.lowercased() {
|
|
30
|
+
case "dark": return .dark
|
|
31
|
+
case "light": return .light
|
|
32
|
+
default: return environmentColorScheme
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import ExpoModulesCore
|
|
2
|
+
import YouVersionPlatform
|
|
3
|
+
import AuthenticationServices
|
|
4
|
+
|
|
5
|
+
struct YVPAuthAPI {
|
|
6
|
+
static func signIn(permissions: [String], promise: Promise) {
|
|
7
|
+
let permissionsSet = Set<SignInWithYouVersionPermission>(
|
|
8
|
+
permissions.compactMap(SignInWithYouVersionPermission.init(rawValue:))
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
Task {
|
|
12
|
+
do {
|
|
13
|
+
let response = try await YouVersionAPI.Users.signIn(
|
|
14
|
+
permissions: permissionsSet,
|
|
15
|
+
contextProvider: ContextProvider()
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
promise.resolve([
|
|
19
|
+
"accessToken": response.accessToken,
|
|
20
|
+
"permissions": response.permissions.map(\.rawValue),
|
|
21
|
+
"yvpUserId": response.yvpUserId,
|
|
22
|
+
"expiryDate": formatExpiryDate(response.expiryDate),
|
|
23
|
+
"refreshToken": response.refreshToken,
|
|
24
|
+
"name": response.name,
|
|
25
|
+
"profilePicture": response.profilePicture,
|
|
26
|
+
"email": response.email
|
|
27
|
+
])
|
|
28
|
+
} catch {
|
|
29
|
+
promise.reject(error)
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
static func signOut() async {
|
|
35
|
+
await MainActor.run {
|
|
36
|
+
YouVersionAPI.Users.signOut()
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
static func userInfo(accessToken: String?, promise: Promise) {
|
|
41
|
+
Task {
|
|
42
|
+
do {
|
|
43
|
+
let response = try await YouVersionAPI.Users.userInfo(accessToken: accessToken)
|
|
44
|
+
|
|
45
|
+
promise.resolve([
|
|
46
|
+
"firstName": response.firstName,
|
|
47
|
+
"lastName": response.lastName,
|
|
48
|
+
"userId": response.userId,
|
|
49
|
+
"avatarUrl": response.avatarUrl?.absoluteString
|
|
50
|
+
])
|
|
51
|
+
} catch {
|
|
52
|
+
promise.reject(error)
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
private let isoFormatter: ISO8601DateFormatter = {
|
|
59
|
+
let f = ISO8601DateFormatter()
|
|
60
|
+
f.formatOptions = [.withInternetDateTime, .withFractionalSeconds]
|
|
61
|
+
return f
|
|
62
|
+
}()
|
|
63
|
+
|
|
64
|
+
func formatExpiryDate(_ expiryDate: Date?) -> String? {
|
|
65
|
+
expiryDate.map { isoFormatter.string(from: $0) }
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class ContextProvider: NSObject, ASWebAuthenticationPresentationContextProviding {
|
|
70
|
+
func presentationAnchor(for session: ASWebAuthenticationSession) -> ASPresentationAnchor {
|
|
71
|
+
guard let scene = UIApplication.shared.connectedScenes.first as? UIWindowScene,
|
|
72
|
+
let window = scene.windows.first else {
|
|
73
|
+
return ASPresentationAnchor()
|
|
74
|
+
}
|
|
75
|
+
return window
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import ExpoModulesCore
|
|
2
|
+
import YouVersionPlatform
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
struct YVPVotdAPI {
|
|
6
|
+
static func verseOfTheDay(dayOfYear: Int, promise: Promise) {
|
|
7
|
+
Task { @MainActor in
|
|
8
|
+
do {
|
|
9
|
+
let response = try await YouVersionAPI.VOTD.verseOfTheDay(dayOfYear: dayOfYear)
|
|
10
|
+
|
|
11
|
+
promise.resolve([
|
|
12
|
+
"passageId": response.passageId,
|
|
13
|
+
"day": response.day
|
|
14
|
+
])
|
|
15
|
+
} catch {
|
|
16
|
+
promise.reject(error)
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import YouVersionPlatform
|
|
2
|
+
|
|
3
|
+
struct YVPlatform {
|
|
4
|
+
static func configure(appKey: String) async {
|
|
5
|
+
await MainActor.run {
|
|
6
|
+
YouVersionPlatform.configure(appKey: appKey)
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
static func setApiHost(apiHost: String) {
|
|
11
|
+
YouVersionPlatformConfiguration.apiHost = apiHost
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
static func getAccessToken() -> String? {
|
|
15
|
+
return YouVersionPlatformConfiguration.accessToken
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, '..', 'package.json')))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = 'YouVersionReactNative'
|
|
7
|
+
s.version = package['version']
|
|
8
|
+
s.summary = package['description']
|
|
9
|
+
s.description = package['description']
|
|
10
|
+
s.license = package['license']
|
|
11
|
+
s.author = package['author']
|
|
12
|
+
s.homepage = package['homepage']
|
|
13
|
+
s.platforms = {
|
|
14
|
+
:ios => '17.0',
|
|
15
|
+
:tvos => '17.0'
|
|
16
|
+
}
|
|
17
|
+
s.swift_version = '5.9'
|
|
18
|
+
s.source = { git: 'https://github.com/youversion/platform-sdk-reactnative' }
|
|
19
|
+
s.static_framework = true
|
|
20
|
+
|
|
21
|
+
s.dependency 'ExpoModulesCore'
|
|
22
|
+
s.dependency 'YouVersionPlatform', '0.1.0'
|
|
23
|
+
s.dependency 'YouVersionPlatformCore', '0.1.0'
|
|
24
|
+
s.dependency 'YouVersionPlatformUI', '0.1.0'
|
|
25
|
+
s.dependency 'YouVersionPlatformReader', '0.1.0'
|
|
26
|
+
|
|
27
|
+
# Swift/Objective-C compatibility
|
|
28
|
+
s.pod_target_xcconfig = {
|
|
29
|
+
'DEFINES_MODULE' => 'YES',
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
s.source_files = "**/*.{h,m,mm,swift,hpp,cpp}"
|
|
33
|
+
end
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BibleReference,
|
|
3
|
+
BibleVersion,
|
|
4
|
+
HighlightResponse,
|
|
5
|
+
LanguageOverview,
|
|
6
|
+
SignInWithYouVersionPermission,
|
|
7
|
+
SignInWithYouVersionResult,
|
|
8
|
+
YouVersionUserInfo,
|
|
9
|
+
YouVersionVerseOfTheDay,
|
|
10
|
+
} from "../src";
|
|
11
|
+
|
|
12
|
+
export function configure(_appKey: string) {}
|
|
13
|
+
export function setApiHost(_apiHost: string) {}
|
|
14
|
+
export function getAccessToken(): string | null {
|
|
15
|
+
return "existing-access-token";
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function signIn(
|
|
19
|
+
requiredPermissions: SignInWithYouVersionPermission[] = [],
|
|
20
|
+
optionalPermissions: SignInWithYouVersionPermission[] = [],
|
|
21
|
+
): Promise<SignInWithYouVersionResult> {
|
|
22
|
+
return Promise.resolve({
|
|
23
|
+
accessToken: "mock-access-token",
|
|
24
|
+
permissions: [...requiredPermissions, ...optionalPermissions],
|
|
25
|
+
yvpUserId: "mock-yvp-user-id",
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function signOut(): Promise<void> {
|
|
30
|
+
return Promise.resolve();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function userInfo(_accessToken?: string): Promise<YouVersionUserInfo> {
|
|
34
|
+
return Promise.resolve({
|
|
35
|
+
avatarUrl: "https://example.com/avatar.png",
|
|
36
|
+
firstName: "Mock",
|
|
37
|
+
lastName: "User",
|
|
38
|
+
yvpUserId: "mock-yvp-user-id",
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function verseOfTheDay(
|
|
43
|
+
dayOfYear: number,
|
|
44
|
+
): Promise<YouVersionVerseOfTheDay> {
|
|
45
|
+
return Promise.resolve({
|
|
46
|
+
day: dayOfYear,
|
|
47
|
+
passageId: "GEN.1.1",
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function versions(_languageTag?: string): Promise<BibleVersion[]> {
|
|
52
|
+
const versions: BibleVersion[] = [
|
|
53
|
+
{
|
|
54
|
+
id: 1,
|
|
55
|
+
abbreviation: "KJV",
|
|
56
|
+
languageTag: "en",
|
|
57
|
+
bookCodes: ["GEN", "EXO", "LEV"],
|
|
58
|
+
copyrightLong: "King James Version Copyright",
|
|
59
|
+
copyrightShort: "KJV Copyright",
|
|
60
|
+
localizedAbbreviation: "KJV",
|
|
61
|
+
localizedTitle: "King James Version",
|
|
62
|
+
textDirection: "ltr",
|
|
63
|
+
title: "King James Version",
|
|
64
|
+
},
|
|
65
|
+
];
|
|
66
|
+
|
|
67
|
+
return Promise.resolve(versions);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export function version(versionId: number): Promise<BibleVersion> {
|
|
71
|
+
return Promise.resolve({
|
|
72
|
+
id: versionId,
|
|
73
|
+
abbreviation: "KJV",
|
|
74
|
+
languageTag: "en",
|
|
75
|
+
bookCodes: ["GEN", "EXO", "LEV"],
|
|
76
|
+
copyrightLong: "King James Version Copyright",
|
|
77
|
+
copyrightShort: "KJV Copyright",
|
|
78
|
+
localizedAbbreviation: "KJV",
|
|
79
|
+
localizedTitle: "King James Version",
|
|
80
|
+
textDirection: "ltr",
|
|
81
|
+
title: "King James Version",
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export function chapter(bibleReference: BibleReference): Promise<string> {
|
|
86
|
+
return Promise.resolve(
|
|
87
|
+
"In the beginning God created the heaven and the earth.",
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export function languages(_country?: string): Promise<LanguageOverview[]> {
|
|
92
|
+
const languages: LanguageOverview[] = [
|
|
93
|
+
{
|
|
94
|
+
id: "EN",
|
|
95
|
+
aliases: ["en"],
|
|
96
|
+
language: "English",
|
|
97
|
+
displayNames: {
|
|
98
|
+
en: "English",
|
|
99
|
+
},
|
|
100
|
+
scripts: ["Latn"],
|
|
101
|
+
variants: [],
|
|
102
|
+
countries: ["US", "GB"],
|
|
103
|
+
textDirection: "ltr",
|
|
104
|
+
},
|
|
105
|
+
];
|
|
106
|
+
|
|
107
|
+
return Promise.resolve(languages);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export function createHighlight(
|
|
111
|
+
_versionId: number,
|
|
112
|
+
_passageId: string,
|
|
113
|
+
_color: string,
|
|
114
|
+
): Promise<boolean> {
|
|
115
|
+
return Promise.resolve(true);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export function getHighlights(
|
|
119
|
+
versionId: number,
|
|
120
|
+
passageId: string,
|
|
121
|
+
): Promise<HighlightResponse[]> {
|
|
122
|
+
const highlights: HighlightResponse[] = [
|
|
123
|
+
{
|
|
124
|
+
passageId,
|
|
125
|
+
color: "#FFFF00",
|
|
126
|
+
bibleId: versionId,
|
|
127
|
+
},
|
|
128
|
+
];
|
|
129
|
+
|
|
130
|
+
return Promise.resolve(highlights);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export function updateHighlight(
|
|
134
|
+
_versionId: number,
|
|
135
|
+
_passageId: string,
|
|
136
|
+
_color: string,
|
|
137
|
+
): Promise<boolean> {
|
|
138
|
+
return Promise.resolve(true);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export function deleteHighlight(
|
|
142
|
+
_versionId: number,
|
|
143
|
+
_passageId: string,
|
|
144
|
+
): Promise<boolean> {
|
|
145
|
+
return Promise.resolve(true);
|
|
146
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@youversion/platform-react-native",
|
|
3
|
+
"version": "0.7.2",
|
|
4
|
+
"description": "React Native SDK for YouVersion Platform",
|
|
5
|
+
"main": "build/index.js",
|
|
6
|
+
"types": "build/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "expo-module build",
|
|
9
|
+
"clean": "expo-module clean",
|
|
10
|
+
"lint": "expo-module lint",
|
|
11
|
+
"test": "expo-module test",
|
|
12
|
+
"prepare": "expo-module prepare && rm .eslintrc.js && husky > /dev/null 2>&1 || true",
|
|
13
|
+
"prepublishOnly": "expo-module prepublishOnly",
|
|
14
|
+
"typecheck": "npx tsc --noEmit",
|
|
15
|
+
"expo-module": "expo-module",
|
|
16
|
+
"open:ios": "xed example/ios",
|
|
17
|
+
"open:android": "open -a \"Android Studio\" example/android",
|
|
18
|
+
"release": "semantic-release",
|
|
19
|
+
"release:dry-run": "semantic-release --dry-run"
|
|
20
|
+
},
|
|
21
|
+
"keywords": [
|
|
22
|
+
"react-native",
|
|
23
|
+
"expo",
|
|
24
|
+
"@youversion/platform-react-native",
|
|
25
|
+
"Bible",
|
|
26
|
+
"YouVersion"
|
|
27
|
+
],
|
|
28
|
+
"repository": "git@github.com:youversion/platform-sdk-reactnative.git",
|
|
29
|
+
"bugs": {
|
|
30
|
+
"url": "https://github.com/youversion/platform-sdk-reactnative/issues"
|
|
31
|
+
},
|
|
32
|
+
"author": "YouVersion (https://github.com/youversion/platform-sdk-reactnative)",
|
|
33
|
+
"license": "Apache-2.0",
|
|
34
|
+
"homepage": "https://github.com/youversion/platform-sdk-reactnative#readme",
|
|
35
|
+
"jest": {
|
|
36
|
+
"preset": "expo-module-scripts"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@commitlint/cli": "^19.6.0",
|
|
41
|
+
"@commitlint/config-conventional": "^19.6.0",
|
|
42
|
+
"@semantic-release/changelog": "^6.0.3",
|
|
43
|
+
"@semantic-release/exec": "^6.0.3",
|
|
44
|
+
"@semantic-release/git": "^10.0.1",
|
|
45
|
+
"@types/invariant": "^2.2.37",
|
|
46
|
+
"@types/react": "~19.1.0",
|
|
47
|
+
"expo": "^54.0.10",
|
|
48
|
+
"expo-module-scripts": "^5.0.7",
|
|
49
|
+
"husky": "^9.1.7",
|
|
50
|
+
"react-native": "0.81.4",
|
|
51
|
+
"semantic-release": "^24.2.0"
|
|
52
|
+
},
|
|
53
|
+
"peerDependencies": {
|
|
54
|
+
"expo": ">=54.0.0",
|
|
55
|
+
"react": "*",
|
|
56
|
+
"react-native": "*"
|
|
57
|
+
}
|
|
58
|
+
}
|