
Some checks are pending
iOS UniFFI Build / build-ios (push) Waiting to run
Add church management API library with cross-platform support for iOS, Android, and WASM. Features include event management, bulletin handling, contact forms, and authentication.
96 lines
2.8 KiB
Markdown
96 lines
2.8 KiB
Markdown
# Church Core Android Bindings
|
|
|
|
This directory contains the generated Kotlin bindings for the church-core Rust crate.
|
|
|
|
## Files:
|
|
- `uniffi/church_core/` - Generated Kotlin bindings
|
|
|
|
## What's Missing:
|
|
- Native libraries (.so files) - You need to compile these with Android NDK
|
|
- JNI library structure - Will be created when you compile native libraries
|
|
|
|
## To Complete Android Setup:
|
|
|
|
### 1. Install Android Development Tools:
|
|
```bash
|
|
# Install Android SDK/NDK (via Android Studio or command line tools)
|
|
# Set environment variables:
|
|
export ANDROID_SDK_ROOT=/path/to/android/sdk
|
|
export ANDROID_NDK_HOME=$ANDROID_SDK_ROOT/ndk/[version]
|
|
```
|
|
|
|
### 2. Install cargo-ndk:
|
|
```bash
|
|
cargo install cargo-ndk
|
|
```
|
|
|
|
### 3. Build native libraries:
|
|
```bash
|
|
# From church-core directory
|
|
cargo ndk --target arm64-v8a --platform 21 build --release --features uniffi
|
|
cargo ndk --target armeabi-v7a --platform 21 build --release --features uniffi
|
|
cargo ndk --target x86_64 --platform 21 build --release --features uniffi
|
|
cargo ndk --target x86 --platform 21 build --release --features uniffi
|
|
```
|
|
|
|
### 4. Create JNI structure:
|
|
```bash
|
|
mkdir -p jniLibs/{arm64-v8a,armeabi-v7a,x86_64,x86}
|
|
cp target/aarch64-linux-android/release/libchurch_core.so jniLibs/arm64-v8a/
|
|
cp target/armv7-linux-androideabi/release/libchurch_core.so jniLibs/armeabi-v7a/
|
|
cp target/x86_64-linux-android/release/libchurch_core.so jniLibs/x86_64/
|
|
cp target/i686-linux-android/release/libchurch_core.so jniLibs/x86/
|
|
```
|
|
|
|
## Integration in Android Project:
|
|
|
|
### 1. Add JNA dependency to your `build.gradle`:
|
|
```gradle
|
|
implementation 'net.java.dev.jna:jna:5.13.0@aar'
|
|
```
|
|
|
|
### 2. Copy files to your Android project:
|
|
- Copy `uniffi/church_core/` to `src/main/java/`
|
|
- Copy `jniLibs/` to `src/main/`
|
|
|
|
### 3. Usage in Kotlin:
|
|
```kotlin
|
|
import uniffi.church_core.*
|
|
|
|
class ChurchRepository {
|
|
fun fetchEvents(): String {
|
|
return fetchEventsJson()
|
|
}
|
|
|
|
fun fetchSermons(): String {
|
|
return fetchSermonsJson()
|
|
}
|
|
|
|
fun fetchBulletins(): String {
|
|
return fetchBulletinsJson()
|
|
}
|
|
|
|
// All other functions from the UDL file are available
|
|
}
|
|
```
|
|
|
|
## Functions Available:
|
|
All functions defined in `src/church_core.udl` are available in Kotlin:
|
|
- `fetchEventsJson()`
|
|
- `fetchSermonsJson()`
|
|
- `fetchBulletinsJson()`
|
|
- `fetchBibleVerseJson(query: String)`
|
|
- `fetchRandomBibleVerseJson()`
|
|
- `submitContactV2Json(...)`
|
|
- `fetchCachedImageBase64(url: String)`
|
|
- `getOptimalStreamingUrl(mediaId: String)`
|
|
- `parseEventsFromJson(eventsJson: String)`
|
|
- `parseSermonsFromJson(sermonsJson: String)`
|
|
- And many more...
|
|
|
|
## Architecture Notes:
|
|
- All business logic is in Rust (networking, parsing, validation, etc.)
|
|
- Kotlin only handles UI and calls Rust functions
|
|
- Same RTSDA architecture as iOS version
|
|
- JSON responses from Rust, parse to data classes in Kotlin
|