@youversion/platform-react-native 0.7.2 → 0.9.0
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 +1 -0
- package/AGENTS.md +86 -0
- package/CHANGELOG.md +22 -0
- package/android/build.gradle +25 -2
- package/android/src/main/java/com/youversion/reactnativesdk/RNBibleReaderViewModule.kt +13 -0
- package/android/src/main/java/com/youversion/reactnativesdk/RNBibleTextViewModule.kt +15 -0
- package/android/src/main/java/com/youversion/reactnativesdk/RNBibleWidgetViewModule.kt +13 -0
- package/android/src/main/java/com/youversion/reactnativesdk/RNSignInWithYouVersionButtonModule.kt +15 -0
- package/android/src/main/java/com/youversion/reactnativesdk/RNVotdViewModule.kt +13 -0
- package/android/src/main/java/com/youversion/reactnativesdk/RNYouVersionPlatformModule.kt +99 -0
- package/android/src/main/java/com/youversion/reactnativesdk/api/YVPBibleApi.kt +32 -0
- package/android/src/main/java/com/youversion/reactnativesdk/api/YVPHighlightsApi.kt +44 -0
- package/android/src/main/java/com/youversion/reactnativesdk/api/YVPLanguagesApi.kt +11 -0
- package/android/src/main/java/com/youversion/reactnativesdk/api/YVPRecords.kt +185 -0
- package/android/src/main/java/com/youversion/reactnativesdk/api/YVPVotdApi.kt +12 -0
- package/android/src/main/java/com/youversion/reactnativesdk/views/YVPBibleReaderView.kt +55 -0
- package/android/src/main/java/com/youversion/reactnativesdk/views/YVPBibleTextView.kt +60 -0
- package/android/src/main/java/com/youversion/reactnativesdk/views/YVPBibleWidgetView.kt +60 -0
- package/android/src/main/java/com/youversion/reactnativesdk/views/YVPSignInWithYouVersionButton.kt +75 -0
- package/android/src/main/java/com/youversion/reactnativesdk/views/YVPVotdView.kt +49 -0
- package/build/api/bible.d.ts +4 -4
- package/build/api/bible.d.ts.map +1 -1
- package/build/api/bible.js +2 -2
- package/build/api/bible.js.map +1 -1
- package/build/api/index.d.ts +2 -2
- package/build/api/users.d.ts +1 -2
- package/build/api/users.d.ts.map +1 -1
- package/build/api/users.js +2 -3
- package/build/api/users.js.map +1 -1
- package/build/native.d.ts +3 -3
- package/build/native.d.ts.map +1 -1
- package/build/native.js.map +1 -1
- package/build/types.d.ts +33 -23
- package/build/types.d.ts.map +1 -1
- package/build/types.js.map +1 -1
- package/dist/{youversion-platform-react-native-0.7.2.tgz → youversion-platform-react-native-0.9.0.tgz} +0 -0
- package/expo-module.config.json +9 -2
- package/ios/APIs/YVPBibleAPI.swift +18 -14
- package/ios/APIs/YVPLanguagesAPI.swift +2 -2
- package/ios/Views/YVPBibleTextView.swift +5 -6
- package/ios/YVPAuthAPI.swift +9 -16
- package/ios/YouVersionReactNative.podspec +4 -4
- package/mocks/RNYouVersionPlatform.ts +7 -7
- package/package.json +2 -3
- package/src/api/bible.ts +4 -4
- package/src/api/users.ts +2 -3
- package/src/native.ts +3 -3
- package/src/types.ts +42 -29
package/.releaserc.json
CHANGED
package/AGENTS.md
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# AI Agent Instructions
|
|
2
|
+
|
|
3
|
+
This document provides guidelines and instructions for AI agents working with this codebase.
|
|
4
|
+
|
|
5
|
+
## Review Guidelines
|
|
6
|
+
|
|
7
|
+
When conducting code reviews, AI agents should systematically evaluate the following aspects:
|
|
8
|
+
|
|
9
|
+
### Code Standards and Conventions
|
|
10
|
+
- Do the changes follow the established conventions and patterns used throughout the codebase?
|
|
11
|
+
- Is the code style consistent with existing code (indentation, naming conventions, file organization)?
|
|
12
|
+
- Are the appropriate design patterns being used where applicable?
|
|
13
|
+
- Does the code follow the project's established architecture and structure?
|
|
14
|
+
|
|
15
|
+
### Security Assessment
|
|
16
|
+
- Do the changes introduce any security vulnerabilities or risks?
|
|
17
|
+
- Are user inputs properly validated and sanitized?
|
|
18
|
+
- Is sensitive data properly handled and protected?
|
|
19
|
+
- Are authentication and authorization checks properly implemented?
|
|
20
|
+
- Are there any exposed API keys, credentials, or sensitive configuration data?
|
|
21
|
+
- Are network requests using appropriate security protocols (HTTPS, proper headers)?
|
|
22
|
+
|
|
23
|
+
### Performance Considerations
|
|
24
|
+
- Do the changes introduce potential performance bottlenecks?
|
|
25
|
+
- Are there any inefficient algorithms or data structures being used?
|
|
26
|
+
- Is there unnecessary re-rendering or state updates in React components?
|
|
27
|
+
- Are large lists properly virtualized where appropriate?
|
|
28
|
+
- Is lazy loading implemented for heavy resources?
|
|
29
|
+
- Are bundle sizes kept reasonable (no unnecessary dependencies)?
|
|
30
|
+
- Are database queries optimized and avoiding N+1 problems?
|
|
31
|
+
- Is proper caching implemented where beneficial?
|
|
32
|
+
|
|
33
|
+
### Platform-Specific Best Practices
|
|
34
|
+
|
|
35
|
+
#### React Native
|
|
36
|
+
- Are components properly optimized using React.memo, useMemo, and useCallback where appropriate?
|
|
37
|
+
- Is the SDK using the appropriate React Native APIs for the target architecture version?
|
|
38
|
+
- Are platform-specific code paths properly handled?
|
|
39
|
+
- Are native modules properly linked and configured?
|
|
40
|
+
|
|
41
|
+
#### Kotlin (Android)
|
|
42
|
+
- Does the code follow Kotlin idioms and best practices?
|
|
43
|
+
- Are coroutines used properly for asynchronous operations?
|
|
44
|
+
- Is proper null safety maintained throughout?
|
|
45
|
+
- Are Android lifecycle methods properly handled?
|
|
46
|
+
- Is memory management appropriate (avoiding leaks)?
|
|
47
|
+
|
|
48
|
+
#### Swift (iOS)
|
|
49
|
+
- Does the code follow Swift conventions and best practices?
|
|
50
|
+
- Is proper memory management used (weak/unowned references where appropriate)?
|
|
51
|
+
- Are optionals handled safely?
|
|
52
|
+
- Is the code taking advantage of Swift's type safety?
|
|
53
|
+
- Are iOS-specific considerations handled (app states, background tasks)?
|
|
54
|
+
|
|
55
|
+
### Functional Verification
|
|
56
|
+
- Does the code actually implement what the PR description claims?
|
|
57
|
+
- Are all acceptance criteria from the related issue/ticket met?
|
|
58
|
+
- Are edge cases properly handled?
|
|
59
|
+
- Is error handling comprehensive and user-friendly?
|
|
60
|
+
- Are all promised features fully implemented and working?
|
|
61
|
+
|
|
62
|
+
### Testing and Documentation
|
|
63
|
+
- Are appropriate tests included for new functionality?
|
|
64
|
+
- Do existing tests still pass?
|
|
65
|
+
- Is the code self-documenting with clear variable and function names?
|
|
66
|
+
- Are complex logic sections properly commented?
|
|
67
|
+
- Are API changes documented?
|
|
68
|
+
- Are breaking changes clearly identified?
|
|
69
|
+
|
|
70
|
+
### Dependencies and Compatibility
|
|
71
|
+
- Are new dependencies necessary and well-maintained?
|
|
72
|
+
- Are version requirements appropriate?
|
|
73
|
+
- Is backward compatibility maintained where expected?
|
|
74
|
+
- Are deprecated APIs avoided?
|
|
75
|
+
- Are platform version requirements respected?
|
|
76
|
+
|
|
77
|
+
### Accessibility
|
|
78
|
+
- Are accessibility features properly implemented (screen readers, keyboard navigation)?
|
|
79
|
+
- Are appropriate accessibility labels and hints provided?
|
|
80
|
+
- Do UI changes maintain or improve accessibility?
|
|
81
|
+
|
|
82
|
+
### User Experience
|
|
83
|
+
- Do the changes provide a smooth and intuitive user experience?
|
|
84
|
+
- Are loading states and error messages user-friendly?
|
|
85
|
+
- Is feedback provided for user actions?
|
|
86
|
+
- Are animations and transitions smooth and purposeful?
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,28 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## 0.9.0 (2026-01-31)
|
|
6
|
+
|
|
7
|
+
* feat: Update Kotlin SDK and fix all breaking changes (#36) ([0e03b0e](https://github.com/youversion/platform-sdk-reactnative/commit/0e03b0e)), closes [#36](https://github.com/youversion/platform-sdk-reactnative/issues/36)
|
|
8
|
+
* feat (android): add view module stubs for RN bridging (#31) ([66cf642](https://github.com/youversion/platform-sdk-reactnative/commit/66cf642)), closes [#31](https://github.com/youversion/platform-sdk-reactnative/issues/31)
|
|
9
|
+
|
|
10
|
+
## 0.8.0 (2026-01-16)
|
|
11
|
+
|
|
12
|
+
* chore: Depend on most recent Swift SDK version and update breaking changes (#27) ([a042211](https://github.com/youversion/platform-sdk-reactnative/commit/a042211)), closes [#27](https://github.com/youversion/platform-sdk-reactnative/issues/27)
|
|
13
|
+
* chore(ci): Disable NPM tokens in release workflow (#28) ([c63c21a](https://github.com/youversion/platform-sdk-reactnative/commit/c63c21a)), closes [#28](https://github.com/youversion/platform-sdk-reactnative/issues/28)
|
|
14
|
+
* chore(ci): update semantic-release to support OIDC workflow (#29) ([de337dc](https://github.com/youversion/platform-sdk-reactnative/commit/de337dc)), closes [#29](https://github.com/youversion/platform-sdk-reactnative/issues/29)
|
|
15
|
+
* chore(ci): YPE-1050 Modify release.yml for permissions and Node.js version ([2c86c6f](https://github.com/youversion/platform-sdk-reactnative/commit/2c86c6f))
|
|
16
|
+
* Add NODE_AUTH_TOKEN to release workflow ([2bdc89c](https://github.com/youversion/platform-sdk-reactnative/commit/2bdc89c))
|
|
17
|
+
* Add provenance option to npm release configuration ([d746acf](https://github.com/youversion/platform-sdk-reactnative/commit/d746acf))
|
|
18
|
+
* Enable NPM_CONFIG_PROVENANCE in release workflow ([e027853](https://github.com/youversion/platform-sdk-reactnative/commit/e027853))
|
|
19
|
+
* Update Node.js version and add NPM upgrade step ([ee94aa2](https://github.com/youversion/platform-sdk-reactnative/commit/ee94aa2))
|
|
20
|
+
* feat: add support for `configure` in Kotlin (#16) ([d9bca2d](https://github.com/youversion/platform-sdk-reactnative/commit/d9bca2d)), closes [#16](https://github.com/youversion/platform-sdk-reactnative/issues/16)
|
|
21
|
+
* feat: implement `setApiHost` and `getAccessToken` in Kotlin (#17) ([a4ee43c](https://github.com/youversion/platform-sdk-reactnative/commit/a4ee43c)), closes [#17](https://github.com/youversion/platform-sdk-reactnative/issues/17)
|
|
22
|
+
* feat: Implement `SignInWithYouVersionButton` for Kotlin (#26) ([5072471](https://github.com/youversion/platform-sdk-reactnative/commit/5072471)), closes [#26](https://github.com/youversion/platform-sdk-reactnative/issues/26)
|
|
23
|
+
* feat: Implement API utils for Kotlin/Android (#25) ([9a88926](https://github.com/youversion/platform-sdk-reactnative/commit/9a88926)), closes [#25](https://github.com/youversion/platform-sdk-reactnative/issues/25)
|
|
24
|
+
* feat: implement votd API endpoint for Kotlin (#19) ([59e6874](https://github.com/youversion/platform-sdk-reactnative/commit/59e6874)), closes [#19](https://github.com/youversion/platform-sdk-reactnative/issues/19)
|
|
25
|
+
* docs: add AI agent code review guidelines (#23) ([8218cec](https://github.com/youversion/platform-sdk-reactnative/commit/8218cec)), closes [#23](https://github.com/youversion/platform-sdk-reactnative/issues/23)
|
|
26
|
+
|
|
5
27
|
## <small>0.7.2 (2025-11-24)</small>
|
|
6
28
|
|
|
7
29
|
* fix(release): update package name to align to SDK naming (#24) ([9d4a1d7](https://github.com/youversion/platform-sdk-reactnative/commit/9d4a1d7)), closes [#24](https://github.com/youversion/platform-sdk-reactnative/issues/24)
|
package/android/build.gradle
CHANGED
|
@@ -1,10 +1,20 @@
|
|
|
1
|
+
buildscript {
|
|
2
|
+
repositories {
|
|
3
|
+
mavenCentral()
|
|
4
|
+
}
|
|
5
|
+
dependencies {
|
|
6
|
+
classpath("org.jetbrains.kotlin.plugin.compose:org.jetbrains.kotlin.plugin.compose.gradle.plugin:${kotlinVersion}")
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
1
10
|
apply plugin: 'com.android.library'
|
|
2
11
|
|
|
3
12
|
group = 'com.youversion.reactnativesdk'
|
|
4
|
-
version = '0.
|
|
13
|
+
version = '0.9.0'
|
|
5
14
|
|
|
6
15
|
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
7
16
|
apply from: expoModulesCorePlugin
|
|
17
|
+
apply plugin: 'org.jetbrains.kotlin.plugin.compose'
|
|
8
18
|
applyKotlinExpoModulesCorePlugin()
|
|
9
19
|
useCoreDependencies()
|
|
10
20
|
useExpoPublishing()
|
|
@@ -35,9 +45,22 @@ android {
|
|
|
35
45
|
namespace "com.youversion.reactnativesdk"
|
|
36
46
|
defaultConfig {
|
|
37
47
|
versionCode 1
|
|
38
|
-
versionName "0.
|
|
48
|
+
versionName "0.9.0"
|
|
49
|
+
}
|
|
50
|
+
buildFeatures {
|
|
51
|
+
compose true
|
|
39
52
|
}
|
|
40
53
|
lintOptions {
|
|
41
54
|
abortOnError false
|
|
42
55
|
}
|
|
43
56
|
}
|
|
57
|
+
|
|
58
|
+
dependencies {
|
|
59
|
+
implementation 'androidx.compose.ui:ui-android:1.9.1'
|
|
60
|
+
implementation 'androidx.compose.foundation:foundation-android:1.9.1'
|
|
61
|
+
implementation 'androidx.compose.material3:material3-android:1.3.2'
|
|
62
|
+
|
|
63
|
+
implementation 'com.youversion.platform:platform-core:0.6.0'
|
|
64
|
+
implementation 'com.youversion.platform:platform-ui:0.6.0'
|
|
65
|
+
implementation 'com.youversion.platform:platform-reader:0.6.0'
|
|
66
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
package com.youversion.reactnativesdk
|
|
2
|
+
|
|
3
|
+
import com.youversion.reactnativesdk.views.YVPBibleReaderView
|
|
4
|
+
import expo.modules.kotlin.modules.Module
|
|
5
|
+
import expo.modules.kotlin.modules.ModuleDefinition
|
|
6
|
+
|
|
7
|
+
class RNBibleReaderViewModule : Module() {
|
|
8
|
+
override fun definition() = ModuleDefinition {
|
|
9
|
+
Name("BibleReaderView")
|
|
10
|
+
|
|
11
|
+
View(YVPBibleReaderView::class)
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
package com.youversion.reactnativesdk
|
|
2
|
+
|
|
3
|
+
import com.youversion.reactnativesdk.views.YVPBibleTextView
|
|
4
|
+
import expo.modules.kotlin.modules.Module
|
|
5
|
+
import expo.modules.kotlin.modules.ModuleDefinition
|
|
6
|
+
|
|
7
|
+
class RNBibleTextViewModule : Module() {
|
|
8
|
+
override fun definition() = ModuleDefinition {
|
|
9
|
+
Name("BibleTextView")
|
|
10
|
+
|
|
11
|
+
View(YVPBibleTextView::class) {
|
|
12
|
+
Events("onTap")
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
package com.youversion.reactnativesdk
|
|
2
|
+
|
|
3
|
+
import com.youversion.reactnativesdk.views.YVPBibleWidgetView
|
|
4
|
+
import expo.modules.kotlin.modules.Module
|
|
5
|
+
import expo.modules.kotlin.modules.ModuleDefinition
|
|
6
|
+
|
|
7
|
+
class RNBibleWidgetViewModule : Module() {
|
|
8
|
+
override fun definition() = ModuleDefinition {
|
|
9
|
+
Name("BibleWidgetView")
|
|
10
|
+
|
|
11
|
+
View(YVPBibleWidgetView::class)
|
|
12
|
+
}
|
|
13
|
+
}
|
package/android/src/main/java/com/youversion/reactnativesdk/RNSignInWithYouVersionButtonModule.kt
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
package com.youversion.reactnativesdk
|
|
2
|
+
|
|
3
|
+
import com.youversion.reactnativesdk.views.YVPSignInWithYouVersionButton
|
|
4
|
+
import expo.modules.kotlin.modules.Module
|
|
5
|
+
import expo.modules.kotlin.modules.ModuleDefinition
|
|
6
|
+
|
|
7
|
+
class RNSignInWithYouVersionButtonModule : Module() {
|
|
8
|
+
override fun definition() = ModuleDefinition {
|
|
9
|
+
Name("SignInWithYouVersionButton")
|
|
10
|
+
|
|
11
|
+
View(YVPSignInWithYouVersionButton::class) {
|
|
12
|
+
Events("onTap")
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
package com.youversion.reactnativesdk
|
|
2
|
+
|
|
3
|
+
import com.youversion.reactnativesdk.views.YVPVotdView
|
|
4
|
+
import expo.modules.kotlin.modules.Module
|
|
5
|
+
import expo.modules.kotlin.modules.ModuleDefinition
|
|
6
|
+
|
|
7
|
+
class RNVotdViewModule : Module() {
|
|
8
|
+
override fun definition() = ModuleDefinition {
|
|
9
|
+
Name("VotdView")
|
|
10
|
+
|
|
11
|
+
View(YVPVotdView::class)
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
package com.youversion.reactnativesdk
|
|
2
|
+
|
|
3
|
+
import com.youversion.platform.core.YouVersionPlatformConfiguration
|
|
4
|
+
import com.youversion.reactnativesdk.api.BibleReferenceRecord
|
|
5
|
+
import com.youversion.reactnativesdk.api.YVPBibleApi
|
|
6
|
+
import com.youversion.reactnativesdk.api.YVPHighlightsApi
|
|
7
|
+
import com.youversion.reactnativesdk.api.YVPLanguagesApi
|
|
8
|
+
import com.youversion.reactnativesdk.api.YVPVotdApi
|
|
9
|
+
import expo.modules.kotlin.modules.Module
|
|
10
|
+
import expo.modules.kotlin.modules.ModuleDefinition
|
|
11
|
+
import expo.modules.kotlin.functions.Coroutine
|
|
12
|
+
|
|
13
|
+
class RNYouVersionPlatformModule : Module() {
|
|
14
|
+
override fun definition() = ModuleDefinition {
|
|
15
|
+
Name("RNYouVersionPlatform")
|
|
16
|
+
|
|
17
|
+
Function("configure") { appKey: String ->
|
|
18
|
+
val context = appContext.reactContext
|
|
19
|
+
?: throw IllegalStateException("ReactContext is not available yet")
|
|
20
|
+
|
|
21
|
+
YouVersionPlatformConfiguration.configure(
|
|
22
|
+
context = context,
|
|
23
|
+
appKey = appKey,
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
Function("setApiHost") { apiHost: String ->
|
|
28
|
+
YouVersionPlatformConfiguration.setApiHost(apiHost)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
Function("getAccessToken") {
|
|
32
|
+
YouVersionPlatformConfiguration.accessToken
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
AsyncFunction("verseOfTheDay") Coroutine { dayOfYear: Int ->
|
|
36
|
+
return@Coroutine YVPVotdApi.verseOfTheDay(
|
|
37
|
+
dayOfYear = dayOfYear
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
AsyncFunction("languages") Coroutine { country: String? ->
|
|
42
|
+
return@Coroutine YVPLanguagesApi.languages(
|
|
43
|
+
country = country
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
AsyncFunction("versions") Coroutine { languageTag: String? ->
|
|
48
|
+
return@Coroutine YVPBibleApi.versions(
|
|
49
|
+
languageTag = languageTag
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
AsyncFunction("version") Coroutine { versionId: Int ->
|
|
54
|
+
return@Coroutine YVPBibleApi.version(
|
|
55
|
+
versionId = versionId
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
AsyncFunction("chapter") Coroutine { bibleReference: BibleReferenceRecord ->
|
|
60
|
+
val context = appContext.reactContext
|
|
61
|
+
?: throw IllegalStateException("ReactContext is not available yet")
|
|
62
|
+
|
|
63
|
+
return@Coroutine YVPBibleApi.chapter(
|
|
64
|
+
bibleReference = bibleReference,
|
|
65
|
+
context = context
|
|
66
|
+
)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
AsyncFunction("createHighlight") Coroutine { bibleId: Int, passageId: String, color: String ->
|
|
70
|
+
return@Coroutine YVPHighlightsApi.createHighlight(
|
|
71
|
+
bibleId = bibleId,
|
|
72
|
+
passageId = passageId,
|
|
73
|
+
color = color
|
|
74
|
+
)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
AsyncFunction("getHighlights") Coroutine { bibleId: Int, passageId: String ->
|
|
78
|
+
return@Coroutine YVPHighlightsApi.getHighlights(
|
|
79
|
+
bibleId = bibleId,
|
|
80
|
+
passageId = passageId,
|
|
81
|
+
)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
AsyncFunction("updateHighlight") Coroutine { bibleId: Int, passageId: String, color: String ->
|
|
85
|
+
return@Coroutine YVPHighlightsApi.updateHighlight(
|
|
86
|
+
bibleId = bibleId,
|
|
87
|
+
passageId = passageId,
|
|
88
|
+
color = color
|
|
89
|
+
)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
AsyncFunction("deleteHighlight") Coroutine { bibleId: Int, passageId: String ->
|
|
93
|
+
return@Coroutine YVPHighlightsApi.deleteHighlight(
|
|
94
|
+
bibleId = bibleId,
|
|
95
|
+
passageId = passageId
|
|
96
|
+
)
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
package com.youversion.reactnativesdk.api
|
|
2
|
+
|
|
3
|
+
import android.content.Context
|
|
4
|
+
import com.youversion.platform.core.api.YouVersionApi
|
|
5
|
+
import com.youversion.platform.core.bibles.domain.BibleReference
|
|
6
|
+
import com.youversion.platform.core.bibles.domain.BibleVersionRepository
|
|
7
|
+
|
|
8
|
+
object YVPBibleApi {
|
|
9
|
+
suspend fun versions(languageTag: String?): List<BibleVersionRecord> {
|
|
10
|
+
val response = YouVersionApi.bible.versions(languageTag)
|
|
11
|
+
val records = response.map { BibleVersionRecord(it) }
|
|
12
|
+
return records
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
suspend fun version(versionId: Int): BibleVersionRecord {
|
|
16
|
+
val response = YouVersionApi.bible.version(versionId)
|
|
17
|
+
val record = BibleVersionRecord(response)
|
|
18
|
+
return record
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
suspend fun chapter(bibleReference: BibleReferenceRecord, context: Context): String {
|
|
22
|
+
val response = BibleVersionRepository(context).chapter(
|
|
23
|
+
reference = BibleReference(
|
|
24
|
+
versionId = bibleReference.versionId,
|
|
25
|
+
bookUSFM = bibleReference.bookUSFM,
|
|
26
|
+
chapter = bibleReference.chapter,
|
|
27
|
+
)
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
return response
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
package com.youversion.reactnativesdk.api
|
|
2
|
+
|
|
3
|
+
import com.youversion.platform.core.api.YouVersionApi
|
|
4
|
+
|
|
5
|
+
object YVPHighlightsApi {
|
|
6
|
+
suspend fun createHighlight(bibleId: Int, passageId: String, color: String): Boolean {
|
|
7
|
+
val response = YouVersionApi.highlights.createHighlight(
|
|
8
|
+
versionId = bibleId,
|
|
9
|
+
passageId = passageId,
|
|
10
|
+
color = color
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
return response
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
suspend fun getHighlights(bibleId: Int, passageId: String): List<HighlightRecord> {
|
|
17
|
+
val response = YouVersionApi.highlights.highlights(
|
|
18
|
+
versionId = bibleId,
|
|
19
|
+
passageId = passageId
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
val records = response.map { HighlightRecord(it) }
|
|
23
|
+
return records
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
suspend fun updateHighlight(bibleId: Int, passageId: String, color: String): Boolean {
|
|
27
|
+
val response = YouVersionApi.highlights.updateHighlight(
|
|
28
|
+
versionId = bibleId,
|
|
29
|
+
passageId = passageId,
|
|
30
|
+
color = color
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
return response
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
suspend fun deleteHighlight(bibleId: Int, passageId: String): Boolean {
|
|
37
|
+
val response = YouVersionApi.highlights.deleteHighlight(
|
|
38
|
+
versionId = bibleId,
|
|
39
|
+
passageId = passageId,
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
return response
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
package com.youversion.reactnativesdk.api
|
|
2
|
+
|
|
3
|
+
import com.youversion.platform.core.api.YouVersionApi
|
|
4
|
+
|
|
5
|
+
object YVPLanguagesApi {
|
|
6
|
+
suspend fun languages(country: String?): List<LanguageRecord> {
|
|
7
|
+
val response = YouVersionApi.languages.languages(country)
|
|
8
|
+
val records = response.map { LanguageRecord(it) }
|
|
9
|
+
return records
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
package com.youversion.reactnativesdk.api
|
|
2
|
+
|
|
3
|
+
import com.youversion.platform.core.bibles.models.BibleBook
|
|
4
|
+
import com.youversion.platform.core.bibles.models.BibleChapter
|
|
5
|
+
import com.youversion.platform.core.bibles.models.BibleVersion
|
|
6
|
+
import com.youversion.platform.core.highlights.models.Highlight
|
|
7
|
+
import com.youversion.platform.core.languages.models.Language
|
|
8
|
+
import com.youversion.platform.core.votd.models.YouVersionVerseOfTheDay
|
|
9
|
+
import expo.modules.kotlin.records.Field
|
|
10
|
+
import expo.modules.kotlin.records.Record
|
|
11
|
+
|
|
12
|
+
data class YouVersionVerseOfTheDayRecord(
|
|
13
|
+
@Field
|
|
14
|
+
val passageId: String,
|
|
15
|
+
@Field
|
|
16
|
+
val day: Int
|
|
17
|
+
) : Record {
|
|
18
|
+
constructor(votd: YouVersionVerseOfTheDay) : this(
|
|
19
|
+
passageId = votd.passageUsfm,
|
|
20
|
+
day = votd.day
|
|
21
|
+
)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
data class LanguageRecord(
|
|
25
|
+
@Field
|
|
26
|
+
val id: String,
|
|
27
|
+
@Field
|
|
28
|
+
val language: String,
|
|
29
|
+
@Field
|
|
30
|
+
val script: String?,
|
|
31
|
+
@Field
|
|
32
|
+
val scriptName: String?,
|
|
33
|
+
@Field
|
|
34
|
+
val aliases: List<String>,
|
|
35
|
+
@Field
|
|
36
|
+
val displayNames: Map<String, String>,
|
|
37
|
+
@Field
|
|
38
|
+
val scripts: List<String>,
|
|
39
|
+
@Field
|
|
40
|
+
val variants: List<String>,
|
|
41
|
+
@Field
|
|
42
|
+
val countries: List<String>,
|
|
43
|
+
@Field
|
|
44
|
+
val textDirection: String,
|
|
45
|
+
@Field
|
|
46
|
+
val defaultBibleId: Int?
|
|
47
|
+
|
|
48
|
+
) : Record {
|
|
49
|
+
constructor(language: Language) : this(
|
|
50
|
+
id = language.id,
|
|
51
|
+
language = language.language,
|
|
52
|
+
script = language.script,
|
|
53
|
+
scriptName = language.scriptName,
|
|
54
|
+
aliases = language.aliases,
|
|
55
|
+
displayNames = language.displayNames,
|
|
56
|
+
scripts = language.scripts,
|
|
57
|
+
variants = language.variants,
|
|
58
|
+
countries = language.countries,
|
|
59
|
+
textDirection = language.textDirection,
|
|
60
|
+
defaultBibleId = language.defaultBibleVersionId
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
data class BibleVersionRecord(
|
|
65
|
+
@Field
|
|
66
|
+
val id: Int,
|
|
67
|
+
@Field
|
|
68
|
+
val abbreviation: String?,
|
|
69
|
+
@Field
|
|
70
|
+
val promotionalContent: String?,
|
|
71
|
+
@Field
|
|
72
|
+
val copyright: String?,
|
|
73
|
+
@Field
|
|
74
|
+
val languageTag: String?,
|
|
75
|
+
@Field
|
|
76
|
+
val localizedAbbreviation: String?,
|
|
77
|
+
@Field
|
|
78
|
+
val localizedTitle: String?,
|
|
79
|
+
@Field
|
|
80
|
+
val readerFooter: String?,
|
|
81
|
+
@Field
|
|
82
|
+
val readerFooterUrl: String?,
|
|
83
|
+
@Field
|
|
84
|
+
val title: String?,
|
|
85
|
+
@Field
|
|
86
|
+
val bookCodes: List<String>?,
|
|
87
|
+
@Field
|
|
88
|
+
val books: List<BibleBookRecord>?,
|
|
89
|
+
@Field
|
|
90
|
+
val textDirection: String?,
|
|
91
|
+
@Field
|
|
92
|
+
val organizationId: String?
|
|
93
|
+
) : Record {
|
|
94
|
+
constructor(bibleVersion: BibleVersion) : this(
|
|
95
|
+
id = bibleVersion.id,
|
|
96
|
+
abbreviation = bibleVersion.abbreviation,
|
|
97
|
+
promotionalContent = bibleVersion.promotionalContent,
|
|
98
|
+
copyright = bibleVersion.copyright,
|
|
99
|
+
languageTag = bibleVersion.languageTag,
|
|
100
|
+
localizedAbbreviation = bibleVersion.localizedAbbreviation,
|
|
101
|
+
localizedTitle = bibleVersion.localizedTitle,
|
|
102
|
+
readerFooter = bibleVersion.readerFooter,
|
|
103
|
+
readerFooterUrl = bibleVersion.readerFooterUrl,
|
|
104
|
+
title = bibleVersion.title,
|
|
105
|
+
bookCodes = bibleVersion.bookCodes,
|
|
106
|
+
books = bibleVersion.books?.map { BibleBookRecord(it) },
|
|
107
|
+
textDirection = bibleVersion.textDirection,
|
|
108
|
+
organizationId = bibleVersion.organizationId
|
|
109
|
+
)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
data class BibleBookRecord(
|
|
113
|
+
@Field
|
|
114
|
+
val id: String?,
|
|
115
|
+
@Field
|
|
116
|
+
val title: String?,
|
|
117
|
+
@Field
|
|
118
|
+
val abbreviation: String?,
|
|
119
|
+
@Field
|
|
120
|
+
val canon: String?,
|
|
121
|
+
@Field
|
|
122
|
+
val chapters: List<BibleChapterRecord>?,
|
|
123
|
+
@Field
|
|
124
|
+
val fullTitle: String?
|
|
125
|
+
) : Record {
|
|
126
|
+
constructor(bibleBook: BibleBook) : this(
|
|
127
|
+
id = bibleBook.id,
|
|
128
|
+
title = bibleBook.title,
|
|
129
|
+
abbreviation = bibleBook.abbreviation,
|
|
130
|
+
canon = bibleBook.canon,
|
|
131
|
+
chapters = bibleBook.chapters?.map { BibleChapterRecord(it) },
|
|
132
|
+
fullTitle = bibleBook.fullTitle
|
|
133
|
+
)
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
data class BibleChapterRecord(
|
|
137
|
+
@Field
|
|
138
|
+
val id: String?,
|
|
139
|
+
@Field
|
|
140
|
+
val passageId: String?,
|
|
141
|
+
@Field
|
|
142
|
+
val title: String?
|
|
143
|
+
) : Record {
|
|
144
|
+
constructor(bibleChapter: BibleChapter) : this(
|
|
145
|
+
id = bibleChapter.id,
|
|
146
|
+
passageId = bibleChapter.passageId,
|
|
147
|
+
title = bibleChapter.title
|
|
148
|
+
)
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
data class BibleReferenceRecord(
|
|
152
|
+
@Field
|
|
153
|
+
val versionId: Int,
|
|
154
|
+
@Field
|
|
155
|
+
val bookUSFM: String,
|
|
156
|
+
@Field
|
|
157
|
+
val chapter: Int,
|
|
158
|
+
) : Record
|
|
159
|
+
|
|
160
|
+
data class HighlightRecord(
|
|
161
|
+
@Field
|
|
162
|
+
val id: String?,
|
|
163
|
+
@Field
|
|
164
|
+
val bibleId: Int,
|
|
165
|
+
@Field
|
|
166
|
+
val passageId: String,
|
|
167
|
+
@Field
|
|
168
|
+
val color: String,
|
|
169
|
+
@Field
|
|
170
|
+
val userId: String?,
|
|
171
|
+
@Field
|
|
172
|
+
val createTime: String?,
|
|
173
|
+
@Field
|
|
174
|
+
val updateTime: String?
|
|
175
|
+
) : Record {
|
|
176
|
+
constructor(highlight: Highlight) : this(
|
|
177
|
+
id = highlight.id,
|
|
178
|
+
bibleId = highlight.versionId,
|
|
179
|
+
passageId = highlight.passageId,
|
|
180
|
+
color = highlight.color,
|
|
181
|
+
userId = highlight.userId,
|
|
182
|
+
createTime = highlight.createTime,
|
|
183
|
+
updateTime = highlight.updateTime
|
|
184
|
+
)
|
|
185
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
package com.youversion.reactnativesdk.api
|
|
2
|
+
|
|
3
|
+
import com.youversion.platform.core.api.YouVersionApi
|
|
4
|
+
|
|
5
|
+
object YVPVotdApi {
|
|
6
|
+
suspend fun verseOfTheDay(dayOfYear: Int): YouVersionVerseOfTheDayRecord {
|
|
7
|
+
val votd = YouVersionApi.votd
|
|
8
|
+
.verseOfTheDay(dayOfTheYear = dayOfYear)
|
|
9
|
+
|
|
10
|
+
return YouVersionVerseOfTheDayRecord(votd)
|
|
11
|
+
}
|
|
12
|
+
}
|