@youversion/platform-react-native 0.7.2 → 0.8.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 +17 -0
- package/android/build.gradle +16 -2
- package/android/src/main/java/com/youversion/reactnativesdk/RNSignInWithYouVersionButtonModule.kt +15 -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/YVPSignInWithYouVersionButton.kt +76 -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.8.0.tgz} +0 -0
- package/expo-module.config.json +5 -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,23 @@
|
|
|
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.8.0 (2026-01-16)
|
|
6
|
+
|
|
7
|
+
* 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)
|
|
8
|
+
* 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)
|
|
9
|
+
* 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)
|
|
10
|
+
* chore(ci): YPE-1050 Modify release.yml for permissions and Node.js version ([2c86c6f](https://github.com/youversion/platform-sdk-reactnative/commit/2c86c6f))
|
|
11
|
+
* Add NODE_AUTH_TOKEN to release workflow ([2bdc89c](https://github.com/youversion/platform-sdk-reactnative/commit/2bdc89c))
|
|
12
|
+
* Add provenance option to npm release configuration ([d746acf](https://github.com/youversion/platform-sdk-reactnative/commit/d746acf))
|
|
13
|
+
* Enable NPM_CONFIG_PROVENANCE in release workflow ([e027853](https://github.com/youversion/platform-sdk-reactnative/commit/e027853))
|
|
14
|
+
* Update Node.js version and add NPM upgrade step ([ee94aa2](https://github.com/youversion/platform-sdk-reactnative/commit/ee94aa2))
|
|
15
|
+
* 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)
|
|
16
|
+
* 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)
|
|
17
|
+
* 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)
|
|
18
|
+
* 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)
|
|
19
|
+
* 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)
|
|
20
|
+
* 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)
|
|
21
|
+
|
|
5
22
|
## <small>0.7.2 (2025-11-24)</small>
|
|
6
23
|
|
|
7
24
|
* 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,11 @@
|
|
|
1
1
|
apply plugin: 'com.android.library'
|
|
2
2
|
|
|
3
3
|
group = 'com.youversion.reactnativesdk'
|
|
4
|
-
version = '0.
|
|
4
|
+
version = '0.8.0'
|
|
5
5
|
|
|
6
6
|
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
7
7
|
apply from: expoModulesCorePlugin
|
|
8
|
+
apply plugin: 'org.jetbrains.kotlin.plugin.compose'
|
|
8
9
|
applyKotlinExpoModulesCorePlugin()
|
|
9
10
|
useCoreDependencies()
|
|
10
11
|
useExpoPublishing()
|
|
@@ -35,9 +36,22 @@ android {
|
|
|
35
36
|
namespace "com.youversion.reactnativesdk"
|
|
36
37
|
defaultConfig {
|
|
37
38
|
versionCode 1
|
|
38
|
-
versionName "0.
|
|
39
|
+
versionName "0.8.0"
|
|
40
|
+
}
|
|
41
|
+
buildFeatures {
|
|
42
|
+
compose true
|
|
39
43
|
}
|
|
40
44
|
lintOptions {
|
|
41
45
|
abortOnError false
|
|
42
46
|
}
|
|
43
47
|
}
|
|
48
|
+
|
|
49
|
+
dependencies {
|
|
50
|
+
implementation 'androidx.compose.ui:ui-android:1.9.1'
|
|
51
|
+
implementation 'androidx.compose.foundation:foundation-android:1.9.1'
|
|
52
|
+
implementation 'androidx.compose.material3:material3-android:1.3.2'
|
|
53
|
+
|
|
54
|
+
implementation 'com.youversion.platform:platform-core:0.5.0'
|
|
55
|
+
implementation 'com.youversion.platform:platform-ui:0.5.0'
|
|
56
|
+
implementation 'com.youversion.platform:platform-reader:0.5.0'
|
|
57
|
+
}
|
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,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.language.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 defaultBibleVersionId: 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
|
+
defaultBibleVersionId = 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 copyrightLong: String?,
|
|
71
|
+
@Field
|
|
72
|
+
val copyrightShort: 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
|
+
) : Record {
|
|
92
|
+
constructor(bibleVersion: BibleVersion) : this(
|
|
93
|
+
id = bibleVersion.id,
|
|
94
|
+
abbreviation = bibleVersion.abbreviation,
|
|
95
|
+
copyrightLong = bibleVersion.copyrightLong,
|
|
96
|
+
copyrightShort = bibleVersion.copyrightShort,
|
|
97
|
+
languageTag = bibleVersion.languageTag,
|
|
98
|
+
localizedAbbreviation = bibleVersion.localizedAbbreviation,
|
|
99
|
+
localizedTitle = bibleVersion.localizedTitle,
|
|
100
|
+
readerFooter = bibleVersion.readerFooter,
|
|
101
|
+
readerFooterUrl = bibleVersion.readerFooterUrl,
|
|
102
|
+
title = bibleVersion.title,
|
|
103
|
+
bookCodes = bibleVersion.bookCodes,
|
|
104
|
+
books = bibleVersion.books?.map { BibleBookRecord(it) },
|
|
105
|
+
textDirection = bibleVersion.textDirection
|
|
106
|
+
)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
data class BibleBookRecord(
|
|
110
|
+
@Field
|
|
111
|
+
val usfm: String?,
|
|
112
|
+
@Field
|
|
113
|
+
val title: String?,
|
|
114
|
+
@Field
|
|
115
|
+
val abbreviation: String?,
|
|
116
|
+
@Field
|
|
117
|
+
val canon: String?,
|
|
118
|
+
@Field
|
|
119
|
+
val chapters: List<BibleChapterRecord>?
|
|
120
|
+
) : Record {
|
|
121
|
+
constructor(bibleBook: BibleBook) : this(
|
|
122
|
+
usfm = bibleBook.usfm,
|
|
123
|
+
title = bibleBook.title,
|
|
124
|
+
abbreviation = bibleBook.abbreviation,
|
|
125
|
+
canon = bibleBook.canon,
|
|
126
|
+
chapters = bibleBook.chapters?.map { BibleChapterRecord(it) }
|
|
127
|
+
)
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
data class BibleChapterRecord(
|
|
131
|
+
@Field
|
|
132
|
+
val id: String?,
|
|
133
|
+
@Field
|
|
134
|
+
val bookUSFM: String?,
|
|
135
|
+
@Field
|
|
136
|
+
val isCanonical: Boolean?,
|
|
137
|
+
@Field
|
|
138
|
+
val passageId: String?,
|
|
139
|
+
@Field
|
|
140
|
+
val title: String?
|
|
141
|
+
) : Record {
|
|
142
|
+
constructor(bibleChapter: BibleChapter) : this(
|
|
143
|
+
id = bibleChapter.id,
|
|
144
|
+
bookUSFM = bibleChapter.bookUSFM,
|
|
145
|
+
isCanonical = bibleChapter.isCanonical,
|
|
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
|
+
}
|
package/android/src/main/java/com/youversion/reactnativesdk/views/YVPSignInWithYouVersionButton.kt
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
package com.youversion.reactnativesdk.views
|
|
2
|
+
|
|
3
|
+
import android.content.Context
|
|
4
|
+
import androidx.compose.foundation.isSystemInDarkTheme
|
|
5
|
+
import androidx.compose.runtime.Composable
|
|
6
|
+
import androidx.compose.runtime.MutableState
|
|
7
|
+
import androidx.compose.runtime.mutableStateOf
|
|
8
|
+
import androidx.compose.ui.Modifier
|
|
9
|
+
import androidx.compose.ui.graphics.Shape
|
|
10
|
+
import com.youversion.platform.ui.views.SignInWithYouVersionButton
|
|
11
|
+
import com.youversion.platform.ui.views.SignInWithYouVersionButtonDefaults
|
|
12
|
+
import com.youversion.platform.ui.views.SignInWithYouVersionButtonMode
|
|
13
|
+
import expo.modules.kotlin.AppContext
|
|
14
|
+
import expo.modules.kotlin.viewevent.EventDispatcher
|
|
15
|
+
import expo.modules.kotlin.views.AutoSizingComposable
|
|
16
|
+
import expo.modules.kotlin.views.ComposeProps
|
|
17
|
+
import expo.modules.kotlin.views.Direction
|
|
18
|
+
import expo.modules.kotlin.views.ExpoComposeView
|
|
19
|
+
import java.util.EnumSet
|
|
20
|
+
|
|
21
|
+
data class SignInWithYouVersionButtonProps(
|
|
22
|
+
val mode: MutableState<String?> = mutableStateOf("full"),
|
|
23
|
+
val shape: MutableState<String?> = mutableStateOf("capsule"),
|
|
24
|
+
val isStroked: MutableState<Boolean?> = mutableStateOf(true),
|
|
25
|
+
val colorScheme: MutableState<String?> = mutableStateOf(null)
|
|
26
|
+
) : ComposeProps
|
|
27
|
+
|
|
28
|
+
class YVPSignInWithYouVersionButton(context: Context, appContext: AppContext) :
|
|
29
|
+
ExpoComposeView<SignInWithYouVersionButtonProps>(context, appContext, withHostingView = true) {
|
|
30
|
+
override val props = SignInWithYouVersionButtonProps()
|
|
31
|
+
private val onTap by EventDispatcher()
|
|
32
|
+
|
|
33
|
+
@Composable
|
|
34
|
+
override fun Content(modifier: Modifier) {
|
|
35
|
+
AutoSizingComposable(shadowNodeProxy, axis = EnumSet.of(Direction.HORIZONTAL, Direction.VERTICAL)) {
|
|
36
|
+
SignInWithYouVersionButton(
|
|
37
|
+
onClick = { onTap(mapOf()) },
|
|
38
|
+
mode = mode(),
|
|
39
|
+
stroked = stroked(),
|
|
40
|
+
shape = shape(),
|
|
41
|
+
dark = isDark()
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
fun mode(): SignInWithYouVersionButtonMode {
|
|
47
|
+
return when (props.mode.value) {
|
|
48
|
+
"full" -> SignInWithYouVersionButtonMode.FULL
|
|
49
|
+
"compact" -> SignInWithYouVersionButtonMode.COMPACT
|
|
50
|
+
"iconOnly" -> SignInWithYouVersionButtonMode.ICON_ONLY
|
|
51
|
+
else -> SignInWithYouVersionButtonMode.FULL
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
fun stroked(): Boolean {
|
|
56
|
+
return props.isStroked.value ?: true
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@Composable
|
|
60
|
+
fun shape(): Shape {
|
|
61
|
+
return when (props.shape.value) {
|
|
62
|
+
"capsule" -> SignInWithYouVersionButtonDefaults.capsuleShape
|
|
63
|
+
"rectangle" -> SignInWithYouVersionButtonDefaults.rectangleShape
|
|
64
|
+
else -> SignInWithYouVersionButtonDefaults.capsuleShape
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
@Composable
|
|
69
|
+
fun isDark(): Boolean {
|
|
70
|
+
return when (props.colorScheme.value) {
|
|
71
|
+
"dark" -> true
|
|
72
|
+
"light" -> false
|
|
73
|
+
else -> isSystemInDarkTheme()
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
package/build/api/bible.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BibleReferenceBase, BibleVersion } from "../types";
|
|
2
2
|
export declare const BibleAPI: {
|
|
3
3
|
/**
|
|
4
|
-
* Retrieves a list of Bible versions available for a specified language
|
|
4
|
+
* Retrieves a list of Bible versions available for a specified language tag (like "eng").
|
|
5
5
|
*
|
|
6
6
|
* @param languageTag - An optional language code per BCP 47 for filtering available Bible versions. If `nil`
|
|
7
7
|
* the function returns versions for all languages.
|
|
@@ -18,9 +18,9 @@ export declare const BibleAPI: {
|
|
|
18
18
|
/**
|
|
19
19
|
* Retrieves the content of a single Bible chapter from the server as an HTML string.
|
|
20
20
|
*
|
|
21
|
-
* @param bibleReference - A {@link
|
|
21
|
+
* @param bibleReference - A {@link BibleReferenceBase} object specifying the reference to retrieve.
|
|
22
22
|
* @returns The chapter content as an HTML string.
|
|
23
23
|
*/
|
|
24
|
-
getChapter(bibleReference:
|
|
24
|
+
getChapter(bibleReference: BibleReferenceBase): Promise<string>;
|
|
25
25
|
};
|
|
26
26
|
//# sourceMappingURL=bible.d.ts.map
|
package/build/api/bible.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bible.d.ts","sourceRoot":"","sources":["../../src/api/bible.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"bible.d.ts","sourceRoot":"","sources":["../../src/api/bible.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE5D,eAAO,MAAM,QAAQ;IACnB;;;;;;OAMG;8BACuB,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC,EAAE,CAAC;IAIzE;;;;;OAKG;0BACmB,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAIpD;;;;;OAKG;+BACwB,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;CAGhE,CAAC"}
|