A Kotlin Multiplatform (KMP) recreation of the Rflctn iOS app, focusing on Recording and Subscription functionality with shared business logic for Android and iOS.
This KMP implementation includes:
- β Audio Recording: Platform-specific recording with shared business logic
- β Subscription Management: RevenueCat integration for Premium/Pro tiers
- β Local Database: SQLDelight for recordings storage
- β Usage Tracking: Monthly limits and analytics integration
- π Transcription: Marked as TODO for future implementation
- π AI Insights: Marked as TODO for future implementation
βββ shared/ # Shared business logic
β βββ src/commonMain/kotlin/
β β βββ models/ # Data models (Recording, Subscription)
β β βββ services/ # Platform-specific service interfaces
β β βββ repository/ # Data repository layer
β β βββ di/ # Dependency injection
β βββ src/androidMain/kotlin/ # Android-specific implementations
β βββ src/iosMain/kotlin/ # iOS-specific implementations
βββ composeApp/ # Android Compose UI
| Component | Technology | Purpose |
|---|---|---|
| Shared Logic | Kotlin Multiplatform | Business logic sharing |
| Database | SQLDelight | Cross-platform local storage |
| DI | Koin | Dependency injection |
| Subscriptions | RevenueCat | In-app purchases |
| Analytics | Mixpanel | Usage tracking |
| Android UI | Jetpack Compose | Modern Android UI |
| iOS UI | SwiftUI | Keep existing iOS app |
Before starting, ensure you have:
- Android Studio: Latest stable version
- Xcode: 15.0+ (for iOS development)
- JDK: 17 or higher
- Kotlin: 2.0.20+
- RevenueCat API Key
- Mixpanel Project Token
Install Java 17+:
# Using Homebrew (recommended)
brew install openjdk@17
# Add to your shell profile (~/.zshrc or ~/.bash_profile)
export JAVA_HOME=/opt/homebrew/opt/openjdk@17/libexec/openjdk.jdk/Contents/Home
export PATH="$JAVA_HOME/bin:$PATH"Install Android Studio (includes Android SDK):
- Download from developer.android.com
- Install and open Android Studio
- Follow setup wizard to install Android SDK
- Note the SDK path (usually ~/Library/Android/sdk)
- Add to shell profile:
export ANDROID_HOME=~/Library/Android/sdk
export PATH="$ANDROID_HOME/platform-tools:$PATH"cd /Users/adwaitvaidya/Projects/Rflctn_Kotlin
# Build the project to generate SQLDelight code
./gradlew build- Go to RevenueCat Dashboard
- Create new project: "Rflctn"
- Note your API Key from Project Settings
Create these subscription products:
- Premium Monthly:
rflct_premium_monthly- $4.99/month - Pro Monthly:
rflct_pro_monthly- $9.99/month
Create these entitlements:
premium_features(linked to Premium Monthly)pro_features(linked to Pro Monthly)
Android: Update RflctnApplication.kt:
single { SubscriptionServiceImpl(get(), "rcat_YOUR_API_KEY_HERE") }iOS: Add to your iOS app's configuration
- Go to Mixpanel
- Create project: "Rflctn"
- Copy your Project Token
Update both platform implementations with your Mixpanel token.
- Open project in Android Studio
- Sync Gradle files
- Run on Android device/emulator:
./gradlew :composeApp:installDebug
If you want to test iOS shared code:
-
Open project in Xcode:
cd shared ./gradlew :shared:podPublishXCFramework -
Integrate generated framework with existing iOS app
- Android: MediaRecorder integration
- iOS: AVAudioRecorder integration
- Permissions: Platform-specific microphone permissions
- Background: Support for background recording
- RevenueCat: Cross-platform subscription management
- Usage Tracking: Monthly recording limits
- Feature Gates: Premium/Pro feature access
- Paywall Logic: Subscription upgrade prompts
- SQLDelight: Type-safe SQL for KMP
- Repository Pattern: Clean data access layer
- Auto-migration: Schema versioning support
- Jetpack Compose: Modern declarative UI
- Material 3: Latest design system
- Navigation: Bottom tab navigation
- Permissions: Runtime permission handling
# Build all targets
./gradlew build
# Android only
./gradlew :composeApp:build
# iOS framework only
./gradlew :shared:podPublishXCFramework# Run shared tests
./gradlew :shared:test
# Run Android tests
./gradlew :composeApp:testDebugUnitTest- Check Permissions β Request microphone access
- Check Subscription β Verify recording limits
- Start Recording β Platform-specific recording
- Save Recording β Store in local database
- Update Usage β Increment monthly counter
- Check Status β Load current subscription
- Show Paywall β When limits reached
- Purchase Flow β RevenueCat integration
- Update Features β Enable premium features
- WhisperKit replacement needed for Android
- Options: OpenAI API, Vosk, or cloud services
- Marked as TODO in current implementation
- Android: Foreground service required for long recordings
- iOS: Background app refresh limitations apply
- Android: App-specific external storage
- iOS: Documents directory
- Cloud sync: Implement with subscription tiers
Build Errors:
# Clean and rebuild
./gradlew clean buildSQLDelight Issues:
# Regenerate database code
./gradlew :shared:generateSqlDelightInterfaceRevenueCat Issues:
- Verify API keys are correct
- Check product IDs match exactly
- Ensure entitlements are configured
Android:
- Enable developer options and USB debugging
- Grant microphone permissions manually if needed
iOS:
- Check microphone permissions in Settings
- Verify RevenueCat pod integration
- Choose transcription service (OpenAI API recommended)
- Implement background transcription
- Add language detection
- Create transcript UI
- Integrate AI service for insights
- Add summary generation
- Create insights UI
- Add export functionality
- Cloud sync
- Team features (Pro tier)
- Real-time transcription
- Multiple AI models
- Follow existing code patterns
- Update both platform implementations
- Add tests for new features
- Update documentation
This project follows the same license as the original Rflctn iOS app.