Clean up repository structure
Some checks failed
iOS UniFFI Build / build-ios (push) Has been cancelled

Move build scripts, test scripts, examples, and generated files to scripts/ directory.
Update .gitignore to exclude scripts/ from future commits to keep repository clean.
This commit is contained in:
RTSDA 2025-08-16 19:28:17 -04:00
parent 4d6b23beb3
commit 0afe80ca8d
12 changed files with 4 additions and 912 deletions

5
.gitignore vendored
View file

@ -40,4 +40,7 @@ coverage/
# Temporary files
*.tmp
*.temp
*.temp
# Scripts directory (build scripts, test scripts, examples)
scripts/

View file

@ -1,32 +0,0 @@
#!/bin/bash
set -e
echo "Building iOS framework with UniFFI..."
# Add iOS targets
rustup target add aarch64-apple-ios
rustup target add aarch64-apple-ios-sim
rustup target add x86_64-apple-ios
# Build for iOS targets
cargo build --release --target aarch64-apple-ios --features uniffi
cargo build --release --target aarch64-apple-ios-sim --features uniffi
cargo build --release --target x86_64-apple-ios --features uniffi
# Create universal library
mkdir -p target/universal
lipo -create \
target/aarch64-apple-ios/release/libchurch_core.a \
target/aarch64-apple-ios-sim/release/libchurch_core.a \
target/x86_64-apple-ios/release/libchurch_core.a \
-output target/universal/libchurch_core.a
# Generate Swift bindings using cargo (this should work!)
cargo run --features uniffi --bin uniffi-bindgen generate --language swift --out-dir target/universal src/church_core.udl
# Copy to iOS project
cp target/universal/church_core.swift ../RTSDA-iOS/RTSDA/
cp target/universal/church_coreFFI.h ../RTSDA-iOS/RTSDA/
cp target/universal/libchurch_core.a ../RTSDA-iOS/RTSDA/
echo "Done! Generated files copied to iOS project."

View file

@ -1,120 +0,0 @@
#!/bin/bash
# UniFFI Android Build Script
# Generates Kotlin bindings and Android libraries
set -e
echo "🤖 Building UniFFI Android Library..."
# Clean previous Android builds
echo "🧹 Cleaning previous Android builds..."
rm -rf bindings/android/
mkdir -p bindings/android
# Install required tools
if ! command -v uniffi-bindgen &> /dev/null; then
echo "📦 Installing uniffi_bindgen..."
cargo install uniffi_bindgen --bin uniffi-bindgen
fi
if ! command -v cargo-ndk &> /dev/null; then
echo "📦 Installing cargo-ndk..."
cargo install cargo-ndk
fi
# Android targets for cargo-ndk
ANDROID_ABIS=(
"arm64-v8a" # ARM64 devices
"armeabi-v7a" # ARM32 devices
"x86_64" # x86_64 emulator
"x86" # x86 emulator
)
echo "🔧 Building Rust library for Android targets using cargo-ndk..."
for abi in "${ANDROID_ABIS[@]}"; do
echo "Building for $abi..."
cargo ndk --target $abi --platform 21 build --release --features uniffi
done
echo "⚡ Generating Kotlin bindings..."
# Find the first available library for binding generation
if [ -f "target/aarch64-linux-android/release/libchurch_core.so" ]; then
LIB_FILE="target/aarch64-linux-android/release/libchurch_core.so"
else
# Find any available library
LIB_FILE=$(find target -name "libchurch_core.so" -type f | head -1)
fi
# Generate Kotlin bindings using uniffi_bindgen
uniffi-bindgen generate \
src/church_core.udl \
--language kotlin \
--out-dir bindings/android \
--lib-file "$LIB_FILE"
echo "📁 Organizing Android libraries..."
# Create JNI library structure
mkdir -p bindings/android/jniLibs/arm64-v8a
mkdir -p bindings/android/jniLibs/armeabi-v7a
mkdir -p bindings/android/jniLibs/x86_64
mkdir -p bindings/android/jniLibs/x86
# Copy libraries to JNI structure (cargo-ndk puts them in different locations)
if [ -f "target/aarch64-linux-android/release/libchurch_core.so" ]; then
cp target/aarch64-linux-android/release/libchurch_core.so bindings/android/jniLibs/arm64-v8a/
fi
if [ -f "target/armv7-linux-androideabi/release/libchurch_core.so" ]; then
cp target/armv7-linux-androideabi/release/libchurch_core.so bindings/android/jniLibs/armeabi-v7a/
fi
if [ -f "target/x86_64-linux-android/release/libchurch_core.so" ]; then
cp target/x86_64-linux-android/release/libchurch_core.so bindings/android/jniLibs/x86_64/
fi
if [ -f "target/i686-linux-android/release/libchurch_core.so" ]; then
cp target/i686-linux-android/release/libchurch_core.so bindings/android/jniLibs/x86/
fi
echo "📦 Creating Android README..."
cat > bindings/android/README.md << EOF
# Church Core Android Bindings
This directory contains the generated Kotlin bindings and native libraries for the church-core Rust crate.
## Files:
- \`uniffi/\` - Generated Kotlin bindings
- \`jniLibs/\` - Native libraries for Android architectures
- \`arm64-v8a/\` - ARM64 devices (modern phones)
- \`armeabi-v7a/\` - ARM32 devices (older phones)
- \`x86_64/\` - x86_64 emulator
- \`x86/\` - x86 emulator
## Integration:
1. Copy the Kotlin files from \`uniffi/\` to your Android project's \`src/main/java/\` directory
2. Copy the \`jniLibs/\` directory to your Android project's \`src/main/\` directory
3. Add JNA dependency to your \`build.gradle\`:
```gradle
implementation 'net.java.dev.jna:jna:5.13.0@aar'
```
## Usage:
```kotlin
import uniffi.church_core.*
// Fetch events
val eventsJson = fetchEventsJson()
// Fetch sermons
val sermonsJson = fetchSermonsJson()
// All other functions from the UDL file are available
```
EOF
echo "✅ UniFFI Android library build complete!"
echo "📁 Generated files in bindings/android/:"
echo " - uniffi/ (Kotlin bindings)"
echo " - jniLibs/ (Native libraries for all Android architectures)"
echo " - README.md (Integration instructions)"
echo ""
echo "🎯 Ready for Android integration!"
echo "💡 Follow the README.md instructions to integrate into your Android project"

View file

@ -1,114 +0,0 @@
#!/bin/bash
# UniFFI iOS Build Script
# Generates Swift bindings and universal iOS framework without Python dependencies
set -e
echo "🔨 Building UniFFI iOS Framework..."
# Clean previous builds
echo "🧹 Cleaning previous builds..."
rm -rf target/
rm -rf bindings/
mkdir -p bindings/ios
# Install uniffi_bindgen if not present
if ! command -v uniffi-bindgen &> /dev/null; then
echo "📦 Installing uniffi_bindgen..."
cargo install uniffi_bindgen --bin uniffi-bindgen
fi
# iOS and Mac Catalyst targets
IOS_TARGETS=(
"aarch64-apple-ios" # iOS device (ARM64)
"aarch64-apple-ios-sim" # iOS simulator (Apple Silicon)
"aarch64-apple-ios-macabi" # Mac Catalyst (Apple Silicon)
"x86_64-apple-ios-macabi" # Mac Catalyst (Intel)
)
echo "📱 Installing iOS targets..."
for target in "${IOS_TARGETS[@]}"; do
rustup target add "$target"
done
echo "🔧 Building Rust library for iOS targets..."
for target in "${IOS_TARGETS[@]}"; do
echo "Building for $target..."
cargo build --release --target "$target" --features uniffi
done
echo "⚡ Generating Swift bindings..."
# Generate Swift bindings using uniffi_bindgen
uniffi-bindgen generate \
src/church_core.udl \
--language swift \
--out-dir bindings/ios \
--lib-file target/aarch64-apple-ios/release/libchurch_core.a
echo "📋 Generating module map..."
# Create module map for Swift integration
cat > bindings/ios/church_coreFFI.modulemap << EOF
module church_coreFFI {
header "church_coreFFI.h"
export *
}
EOF
echo "🔗 Preparing libraries..."
# Simulator library (Apple Silicon only)
cp target/aarch64-apple-ios-sim/release/libchurch_core.a bindings/ios/libchurch_core_sim.a
# Device library (ARM64 device)
cp target/aarch64-apple-ios/release/libchurch_core.a bindings/ios/libchurch_core_device.a
# Mac Catalyst libraries
cp target/aarch64-apple-ios-macabi/release/libchurch_core.a bindings/ios/libchurch_core_mac_arm64.a
cp target/x86_64-apple-ios-macabi/release/libchurch_core.a bindings/ios/libchurch_core_mac_x86_64.a
# Create universal Mac Catalyst library
lipo -create \
bindings/ios/libchurch_core_mac_arm64.a \
bindings/ios/libchurch_core_mac_x86_64.a \
-output bindings/ios/libchurch_core_mac_catalyst.a
echo "🔗 Creating XCFramework..."
# Create separate header directories for each library
mkdir -p bindings/ios/device-headers
mkdir -p bindings/ios/sim-headers
mkdir -p bindings/ios/mac-arm64-headers
mkdir -p bindings/ios/mac-x86_64-headers
cp bindings/ios/church_coreFFI.h bindings/ios/device-headers/
cp bindings/ios/church_coreFFI.h bindings/ios/sim-headers/
cp bindings/ios/church_coreFFI.h bindings/ios/mac-arm64-headers/
cp bindings/ios/church_coreFFI.h bindings/ios/mac-x86_64-headers/
# Create XCFramework with Mac Catalyst support
# Using universal Mac Catalyst library built from -macabi targets
xcodebuild -create-xcframework \
-library bindings/ios/libchurch_core_device.a \
-headers bindings/ios/device-headers \
-library bindings/ios/libchurch_core_sim.a \
-headers bindings/ios/sim-headers \
-library bindings/ios/libchurch_core_mac_catalyst.a \
-headers bindings/ios/mac-arm64-headers \
-output bindings/ios/ChurchCore.xcframework
echo "📦 Moving files to iOS project..."
# Copy generated files to iOS project
IOS_PROJECT_DIR="../RTSDA-iOS/RTSDA"
cp bindings/ios/church_core.swift "$IOS_PROJECT_DIR/"
cp bindings/ios/church_coreFFI.h "$IOS_PROJECT_DIR/"
cp bindings/ios/church_coreFFI.modulemap "$IOS_PROJECT_DIR/"
cp -r bindings/ios/ChurchCore.xcframework "$IOS_PROJECT_DIR/"
echo "✅ UniFFI iOS framework build complete!"
echo "📁 Generated files:"
echo " - church_core.swift (Swift bindings)"
echo " - church_coreFFI.h (C header)"
echo " - church_coreFFI.modulemap (Module map)"
echo " - ChurchCore.xcframework (Universal XCFramework)"
echo ""
echo "🎯 Files copied to: $IOS_PROJECT_DIR"
echo "💡 Add ChurchCore.xcframework to your Xcode project and you're good to go!"
echo "📱 Supports: iOS Device (ARM64), iOS Simulator (Apple Silicon), Mac Catalyst (Intel + Apple Silicon)"

View file

@ -1,124 +0,0 @@
#!/bin/bash
# UniFFI iOS and tvOS Build Script
# Generates Swift bindings and universal framework for both iOS and tvOS
set -e
echo "🔨 Building UniFFI iOS and tvOS Framework..."
# Clean previous builds
echo "🧹 Cleaning previous builds..."
rm -rf target/
rm -rf bindings/
mkdir -p bindings/ios
# Install nightly toolchain for tvOS support
echo "🌙 Installing nightly toolchain for tvOS support..."
rustup toolchain install nightly
rustup component add rust-std --toolchain nightly --target aarch64-apple-tvos
rustup component add rust-std --toolchain nightly --target aarch64-apple-tvos-sim
rustup component add rust-std --toolchain nightly --target x86_64-apple-tvos
# Install uniffi_bindgen if not present
if ! command -v uniffi-bindgen &> /dev/null; then
echo "📦 Installing uniffi_bindgen..."
cargo install uniffi_bindgen --bin uniffi-bindgen
fi
# iOS targets
IOS_TARGETS=(
"aarch64-apple-ios" # iOS device (ARM64)
"x86_64-apple-ios" # iOS simulator (Intel)
)
# tvOS targets
TVOS_TARGETS=(
"aarch64-apple-tvos" # tvOS device (ARM64)
"aarch64-apple-tvos-sim" # tvOS simulator (Apple Silicon)
"x86_64-apple-tvos" # tvOS simulator (Intel)
)
echo "📱 Installing iOS targets..."
for target in "${IOS_TARGETS[@]}"; do
rustup target add "$target"
done
echo "📺 Installing tvOS targets..."
for target in "${TVOS_TARGETS[@]}"; do
rustup target add "$target" --toolchain nightly
done
echo "🔧 Building Rust library for iOS targets..."
for target in "${IOS_TARGETS[@]}"; do
echo "Building for $target..."
cargo build --release --target "$target" --features uniffi
done
echo "🔧 Building Rust library for tvOS targets..."
for target in "${TVOS_TARGETS[@]}"; do
echo "Building for $target..."
cargo +nightly build --release --target "$target" --features uniffi
done
echo "🔗 Creating universal libraries..."
# Create iOS universal library
lipo -create \
target/aarch64-apple-ios/release/libchurch_core.a \
target/x86_64-apple-ios/release/libchurch_core.a \
-output bindings/ios/libchurch_core_ios.a
# Create tvOS universal library
lipo -create \
target/aarch64-apple-tvos/release/libchurch_core.a \
target/aarch64-apple-tvos-sim/release/libchurch_core.a \
target/x86_64-apple-tvos/release/libchurch_core.a \
-output bindings/ios/libchurch_core_tvos.a
# Create combined universal library for Xcode (it will pick the right slice)
lipo -create \
target/aarch64-apple-ios/release/libchurch_core.a \
target/x86_64-apple-ios/release/libchurch_core.a \
target/aarch64-apple-tvos/release/libchurch_core.a \
target/x86_64-apple-tvos/release/libchurch_core.a \
-output bindings/ios/libchurch_core_universal.a
echo "⚡ Generating Swift bindings..."
# Generate Swift bindings using uniffi_bindgen
uniffi-bindgen generate \
src/church_core.udl \
--language swift \
--out-dir bindings/ios \
--lib-file target/aarch64-apple-ios/release/libchurch_core.a
echo "📋 Generating module map..."
# Create module map for Swift integration
cat > bindings/ios/church_coreFFI.modulemap << EOF
module church_coreFFI {
header "church_coreFFI.h"
export *
}
EOF
echo "📦 Moving files to iOS project..."
# Copy generated files to iOS project
IOS_PROJECT_DIR="../RTSDA-iOS/RTSDA"
cp bindings/ios/church_core.swift "$IOS_PROJECT_DIR/"
cp bindings/ios/church_coreFFI.h "$IOS_PROJECT_DIR/"
cp bindings/ios/church_coreFFI.modulemap "$IOS_PROJECT_DIR/"
cp bindings/ios/libchurch_core_universal.a "$IOS_PROJECT_DIR/libchurch_core.a"
echo "✅ UniFFI iOS and tvOS framework build complete!"
echo "📁 Generated files:"
echo " - church_core.swift (Swift bindings)"
echo " - church_coreFFI.h (C header)"
echo " - church_coreFFI.modulemap (Module map)"
echo " - libchurch_core.a (Universal static library - iOS + tvOS)"
echo ""
echo "🎯 Files copied to: $IOS_PROJECT_DIR"
echo "💡 You can now build your iOS/tvOS project in Xcode!"
echo ""
echo "📺 Libraries also available separately:"
echo " - bindings/ios/libchurch_core_ios.a (iOS only)"
echo " - bindings/ios/libchurch_core_tvos.a (tvOS only)"

View file

@ -1,105 +0,0 @@
#!/bin/bash
# UniFFI iOS and tvOS Build Script using -Zbuild-std
# Uses nightly cargo with -Zbuild-std to build tvOS targets
set -e
echo "🔨 Building UniFFI iOS and tvOS Framework with -Zbuild-std..."
# Clean previous builds
echo "🧹 Cleaning previous builds..."
rm -rf target/
rm -rf bindings/
mkdir -p bindings/ios
# Install nightly toolchain
echo "🌙 Installing nightly toolchain..."
rustup toolchain install nightly
rustup component add rust-src --toolchain nightly
# Install uniffi_bindgen if not present
if ! command -v uniffi-bindgen &> /dev/null; then
echo "📦 Installing uniffi_bindgen..."
cargo install uniffi_bindgen --bin uniffi-bindgen
fi
# iOS targets (stable)
IOS_TARGETS=(
"aarch64-apple-ios" # iOS device (ARM64)
"x86_64-apple-ios" # iOS simulator (Intel)
)
# tvOS targets (require -Zbuild-std)
TVOS_TARGETS=(
"aarch64-apple-tvos" # tvOS device (ARM64)
"x86_64-apple-tvos" # tvOS simulator (Intel)
)
echo "📱 Installing iOS targets..."
for target in "${IOS_TARGETS[@]}"; do
rustup target add "$target"
done
echo "🔧 Building Rust library for iOS targets..."
for target in "${IOS_TARGETS[@]}"; do
echo "Building for $target..."
cargo build --release --target "$target" --features uniffi
done
echo "📺 Building Rust library for tvOS targets with -Zbuild-std..."
for target in "${TVOS_TARGETS[@]}"; do
echo "Building for $target..."
cargo +nightly build --release --target "$target" --features uniffi -Zbuild-std
done
echo "🔗 Creating separate libraries..."
# iOS universal library
lipo -create \
target/aarch64-apple-ios/release/libchurch_core.a \
target/x86_64-apple-ios/release/libchurch_core.a \
-output bindings/ios/libchurch_core_ios.a
# tvOS universal library
lipo -create \
target/aarch64-apple-tvos/release/libchurch_core.a \
target/x86_64-apple-tvos/release/libchurch_core.a \
-output bindings/ios/libchurch_core_tvos.a
# Default to iOS library
cp bindings/ios/libchurch_core_ios.a bindings/ios/libchurch_core_universal.a
echo "⚡ Generating Swift bindings..."
uniffi-bindgen generate \
src/church_core.udl \
--language swift \
--out-dir bindings/ios \
--lib-file target/aarch64-apple-ios/release/libchurch_core.a
echo "📋 Generating module map..."
cat > bindings/ios/church_coreFFI.modulemap << EOF
module church_coreFFI {
header "church_coreFFI.h"
export *
}
EOF
echo "📦 Moving files to iOS project..."
IOS_PROJECT_DIR="../RTSDA-iOS/RTSDA"
cp bindings/ios/church_core.swift "$IOS_PROJECT_DIR/"
cp bindings/ios/church_coreFFI.h "$IOS_PROJECT_DIR/"
cp bindings/ios/church_coreFFI.modulemap "$IOS_PROJECT_DIR/"
cp bindings/ios/libchurch_core_universal.a "$IOS_PROJECT_DIR/libchurch_core.a"
# Also copy the separate libraries for manual swapping if needed
cp bindings/ios/libchurch_core_ios.a "$IOS_PROJECT_DIR/"
cp bindings/ios/libchurch_core_tvos.a "$IOS_PROJECT_DIR/"
echo "✅ UniFFI iOS and tvOS framework build complete!"
echo "📁 Generated separate libraries:"
echo " - libchurch_core.a (default: iOS)"
echo " - libchurch_core_ios.a (iOS only)"
echo " - libchurch_core_tvos.a (tvOS only)"
echo "🎯 Files copied to: $IOS_PROJECT_DIR"
echo "💡 If tvOS build fails, manually swap to libchurch_core_tvos.a"

View file

@ -1,24 +0,0 @@
use std::path::Path;
use uniffi_bindgen::library_mode::generate_bindings;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let lib_path = "target/aarch64-apple-ios/release/libchurch_core.a";
let out_dir = Path::new("bindings/ios");
// Create output directory if it doesn't exist
std::fs::create_dir_all(out_dir)?;
// Generate Swift bindings
generate_bindings(
&uniffi_bindgen::bindings::swift::SwiftBindingGenerator,
lib_path,
None, // no UDL file
None, // default config
None, // no config file
out_dir,
false, // not a library mode
)?;
println!("Swift bindings generated in {:?}", out_dir);
Ok(())
}

View file

@ -1,144 +0,0 @@
#!/bin/bash
# Generate Kotlin bindings only (without native compilation)
# This gives you the Kotlin interface code to use when you set up Android development
set -e
echo "🤖 Generating Kotlin bindings for Android..."
# Clean previous Android bindings
echo "🧹 Cleaning previous Android bindings..."
rm -rf bindings/android/
mkdir -p bindings/android
# Install uniffi_bindgen if not present
if ! command -v uniffi-bindgen &> /dev/null; then
echo "📦 Installing uniffi_bindgen..."
cargo install uniffi_bindgen --bin uniffi-bindgen
fi
echo "⚡ Generating Kotlin bindings..."
# Use an existing iOS library file for binding generation (they're compatible)
if [ -f "bindings/ios/libchurch_core_device.a" ]; then
LIB_FILE="bindings/ios/libchurch_core_device.a"
elif [ -f "target/aarch64-apple-ios/release/libchurch_core.a" ]; then
LIB_FILE="target/aarch64-apple-ios/release/libchurch_core.a"
else
echo "❌ No existing library found. Please run ./build_ios.sh first."
exit 1
fi
# Generate Kotlin bindings using uniffi_bindgen
uniffi-bindgen generate \
src/church_core.udl \
--language kotlin \
--out-dir bindings/android \
--lib-file "$LIB_FILE"
echo "📦 Creating Android integration README..."
cat > bindings/android/README.md << 'EOF'
# 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
EOF
echo "✅ Kotlin bindings generated!"
echo "📁 Generated files in bindings/android/:"
ls -la bindings/android/
echo ""
echo "📖 See bindings/android/README.md for integration instructions"
echo "💡 You'll need Android SDK/NDK to compile the native libraries"
echo "🎯 But the Kotlin interface code is ready to use!"

View file

@ -1,40 +0,0 @@
#!/bin/bash
set -e
echo "🔨 Simple UniFFI iOS build..."
# Add targets if needed
rustup target add aarch64-apple-ios aarch64-apple-ios-sim x86_64-apple-ios
# Build for all iOS targets
echo "Building for iOS..."
cargo build --release --target aarch64-apple-ios --features uniffi
cargo build --release --target aarch64-apple-ios-sim --features uniffi
cargo build --release --target x86_64-apple-ios --features uniffi
# Create fat binary (iOS device + Intel simulator, skip ARM sim for now)
echo "Creating universal library..."
lipo -create \
target/aarch64-apple-ios/release/libchurch_core.a \
target/x86_64-apple-ios/release/libchurch_core.a \
-output libchurch_core_universal.a
# Generate bindings directly with uniffi_bindgen
echo "Generating Swift bindings..."
uniffi-bindgen generate src/church_core.udl --language swift --out-dir .
# Copy everything to iOS project
echo "Copying to iOS project..."
cp church_core.swift ../RTSDA-iOS/RTSDA/
cp church_coreFFI.h ../RTSDA-iOS/RTSDA/
cp libchurch_core_universal.a ../RTSDA-iOS/RTSDA/libchurch_core.a
# Create modulemap
cat > ../RTSDA-iOS/RTSDA/church_coreFFI.modulemap << EOF
module church_coreFFI {
header "church_coreFFI.h"
export *
}
EOF
echo "✅ Done! Build your iOS app in Xcode."

View file

@ -1,138 +0,0 @@
// Swift Usage Example for New Config Functions
// This shows how to use the new RTSDA-compliant config functions in iOS
import Foundation
// WRONG - Old way (violates RTSDA architecture)
/*
private func loadChurchConfig() {
let configJson = fetchConfigJson() // Gets raw JSON from Rust
// THIS IS BUSINESS LOGIC AND SHOULD BE IN RUST!
if let configData = configJson.data(using: .utf8),
let config = try? JSONDecoder().decode(ChurchConfig.self, from: configData) {
self.churchConfig = config
} else {
print("Failed to load church config")
}
}
*/
// RIGHT - New way (follows RTSDA architecture)
class ChurchConfigManager: ObservableObject {
@Published var churchName: String = ""
@Published var contactPhone: String = ""
@Published var contactEmail: String = ""
@Published var brandColor: String = ""
@Published var aboutText: String = ""
@Published var donationUrl: String = ""
@Published var churchAddress: String = ""
@Published var coordinates: [Double] = [0.0, 0.0]
@Published var websiteUrl: String = ""
@Published var facebookUrl: String = ""
@Published var youtubeUrl: String = ""
@Published var instagramUrl: String = ""
@Published var missionStatement: String = ""
func loadConfig() {
// ALL business logic (JSON parsing, error handling, fallbacks) is in Rust
// Swift just calls Rust functions and gets parsed values directly
self.churchName = getChurchName()
self.contactPhone = getContactPhone()
self.contactEmail = getContactEmail()
self.brandColor = getBrandColor()
self.aboutText = getAboutText()
self.donationUrl = getDonationUrl()
self.churchAddress = getChurchAddress()
self.coordinates = getCoordinates()
self.websiteUrl = getWebsiteUrl()
self.facebookUrl = getFacebookUrl()
self.youtubeUrl = getYoutubeUrl()
self.instagramUrl = getInstagramUrl()
self.missionStatement = getMissionStatement()
}
}
// Example SwiftUI View
struct ConfigDisplayView: View {
@StateObject private var configManager = ChurchConfigManager()
var body: some View {
VStack(alignment: .leading, spacing: 8) {
Text(configManager.churchName)
.font(.title)
.foregroundColor(Color(hex: configManager.brandColor))
Text(configManager.aboutText)
.font(.body)
Text("Contact: \(configManager.contactPhone)")
Text("Email: \(configManager.contactEmail)")
Text("Address: \(configManager.churchAddress)")
if !configManager.donationUrl.isEmpty {
Link("Donate", destination: URL(string: configManager.donationUrl)!)
.foregroundColor(Color(hex: configManager.brandColor))
}
}
.padding()
.onAppear {
configManager.loadConfig()
}
}
}
extension Color {
init(hex: String) {
let hex = hex.trimmingCharacters(in: CharacterSet.alphanumerics.inverted)
var int: UInt64 = 0
Scanner(string: hex).scanHexInt64(&int)
let a, r, g, b: UInt64
switch hex.count {
case 3: // RGB (12-bit)
(a, r, g, b) = (255, (int >> 8) * 17, (int >> 4 & 0xF) * 17, (int & 0xF) * 17)
case 6: // RGB (24-bit)
(a, r, g, b) = (255, int >> 16, int >> 8 & 0xFF, int & 0xFF)
case 8: // ARGB (32-bit)
(a, r, g, b) = (int >> 24, int >> 16 & 0xFF, int >> 8 & 0xFF, int & 0xFF)
default:
(a, r, g, b) = (1, 1, 1, 0)
}
self.init(
.sRGB,
red: Double(r) / 255,
green: Double(g) / 255,
blue: Double(b) / 255,
opacity: Double(a) / 255
)
}
}
/*
Benefits of this approach:
1. RTSDA Compliant - ALL business logic in Rust
2. No JSON parsing in Swift - Rust handles it all
3. Proper error handling with fallbacks in Rust
4. Consistent behavior across iOS and Android
5. Easy to test - just call Rust functions
6. No model synchronization issues
7. Automatic fallback values if config fails to load
8. Cleaner Swift code - just UI logic
Functions available:
- getChurchName() -> String
- getContactPhone() -> String
- getContactEmail() -> String
- getBrandColor() -> String
- getAboutText() -> String
- getDonationUrl() -> String
- getChurchAddress() -> String
- getCoordinates() -> [Double] // [latitude, longitude]
- getWebsiteUrl() -> String
- getFacebookUrl() -> String
- getYoutubeUrl() -> String
- getInstagramUrl() -> String
- getMissionStatement() -> String
*/

View file

@ -1,39 +0,0 @@
// Test script for new config functions
use church_core::uniffi_wrapper::{
get_church_name,
get_contact_phone,
get_contact_email,
get_brand_color,
get_about_text,
get_donation_url,
get_church_address,
get_coordinates,
get_website_url,
get_facebook_url,
get_youtube_url,
get_instagram_url,
get_mission_statement,
};
fn main() {
println!("🔍 Testing church-core config functions...\n");
println!("Church Name: {}", get_church_name());
println!("Contact Phone: {}", get_contact_phone());
println!("Contact Email: {}", get_contact_email());
println!("Brand Color: {}", get_brand_color());
println!("About Text: {}", get_about_text());
println!("Donation URL: {}", get_donation_url());
println!("Church Address: {}", get_church_address());
let coords = get_coordinates();
println!("Coordinates: [{}, {}]", coords[0], coords[1]);
println!("Website URL: {}", get_website_url());
println!("Facebook URL: {}", get_facebook_url());
println!("YouTube URL: {}", get_youtube_url());
println!("Instagram URL: {}", get_instagram_url());
println!("Mission Statement: {}", get_mission_statement());
println!("\n✅ All config functions working properly with fallback values!");
}

View file

@ -1,31 +0,0 @@
use church_core::{ChurchApiClient, ChurchCoreConfig};
#[tokio::main]
async fn main() {
let config = ChurchCoreConfig::new();
match ChurchApiClient::new(config) {
Ok(client) => {
match client.get_recent_sermons(Some(5)).await {
Ok(sermons) => {
let client_sermons: Vec<church_core::ClientSermon> = sermons
.into_iter()
.map(church_core::ClientSermon::from)
.collect();
println!("🎬 Raw JSON output:");
match serde_json::to_string_pretty(&client_sermons) {
Ok(json) => println!("{}", json),
Err(e) => println!("❌ JSON serialization error: {}", e),
}
},
Err(e) => {
println!("❌ Failed to get sermons: {}", e);
}
}
}
Err(e) => {
println!("❌ Failed to create client: {}", e);
}
}
}