Skip to content

AdwaitVaidya/Rflctn_Kotlin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Rflctn Kotlin Multiplatform

A Kotlin Multiplatform (KMP) recreation of the Rflctn iOS app, focusing on Recording and Subscription functionality with shared business logic for Android and iOS.

🎯 Project Scope

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

πŸ—οΈ Architecture

β”œβ”€β”€ 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

πŸ› οΈ Tech Stack

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

πŸ“‹ Prerequisites

Before starting, ensure you have:

Development Environment

  • Android Studio: Latest stable version
  • Xcode: 15.0+ (for iOS development)
  • JDK: 17 or higher
  • Kotlin: 2.0.20+

API Keys Required

  1. RevenueCat API Key
  2. Mixpanel Project Token

πŸš€ Setup Instructions

Step 1: Install Java and Android SDK

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):

  1. Download from developer.android.com
  2. Install and open Android Studio
  3. Follow setup wizard to install Android SDK
  4. Note the SDK path (usually ~/Library/Android/sdk)
  5. Add to shell profile:
export ANDROID_HOME=~/Library/Android/sdk
export PATH="$ANDROID_HOME/platform-tools:$PATH"

Step 2: Clone and Setup Project

cd /Users/adwaitvaidya/Projects/Rflctn_Kotlin

# Build the project to generate SQLDelight code
./gradlew build

Step 2: RevenueCat Configuration

2.1 Create RevenueCat Account

  1. Go to RevenueCat Dashboard
  2. Create new project: "Rflctn"
  3. Note your API Key from Project Settings

2.2 Configure Products

Create these subscription products:

  • Premium Monthly: rflct_premium_monthly - $4.99/month
  • Pro Monthly: rflct_pro_monthly - $9.99/month

2.3 Configure Entitlements

Create these entitlements:

  • premium_features (linked to Premium Monthly)
  • pro_features (linked to Pro Monthly)

2.4 Add API Keys

Android: Update RflctnApplication.kt:

single { SubscriptionServiceImpl(get(), "rcat_YOUR_API_KEY_HERE") }

iOS: Add to your iOS app's configuration

Step 3: Mixpanel Configuration

3.1 Create Mixpanel Project

  1. Go to Mixpanel
  2. Create project: "Rflctn"
  3. Copy your Project Token

3.2 Add Project Token

Update both platform implementations with your Mixpanel token.

Step 4: Android Studio Setup

  1. Open project in Android Studio
  2. Sync Gradle files
  3. Run on Android device/emulator:
    ./gradlew :composeApp:installDebug

Step 5: iOS Setup (Optional)

If you want to test iOS shared code:

  1. Open project in Xcode:

    cd shared
    ./gradlew :shared:podPublishXCFramework
  2. Integrate generated framework with existing iOS app

🎯 Key Features Implemented

1. Audio Recording Service

  • Android: MediaRecorder integration
  • iOS: AVAudioRecorder integration
  • Permissions: Platform-specific microphone permissions
  • Background: Support for background recording

2. Subscription Service

  • RevenueCat: Cross-platform subscription management
  • Usage Tracking: Monthly recording limits
  • Feature Gates: Premium/Pro feature access
  • Paywall Logic: Subscription upgrade prompts

3. Database Layer

  • SQLDelight: Type-safe SQL for KMP
  • Repository Pattern: Clean data access layer
  • Auto-migration: Schema versioning support

4. Android UI

  • Jetpack Compose: Modern declarative UI
  • Material 3: Latest design system
  • Navigation: Bottom tab navigation
  • Permissions: Runtime permission handling

πŸ”§ Development Workflow

Building

# Build all targets
./gradlew build

# Android only
./gradlew :composeApp:build

# iOS framework only  
./gradlew :shared:podPublishXCFramework

Testing

# Run shared tests
./gradlew :shared:test

# Run Android tests
./gradlew :composeApp:testDebugUnitTest

πŸ“± App Flow

Recording Flow

  1. Check Permissions β†’ Request microphone access
  2. Check Subscription β†’ Verify recording limits
  3. Start Recording β†’ Platform-specific recording
  4. Save Recording β†’ Store in local database
  5. Update Usage β†’ Increment monthly counter

Subscription Flow

  1. Check Status β†’ Load current subscription
  2. Show Paywall β†’ When limits reached
  3. Purchase Flow β†’ RevenueCat integration
  4. Update Features β†’ Enable premium features

🚨 Important Notes

Transcription TODO

  • WhisperKit replacement needed for Android
  • Options: OpenAI API, Vosk, or cloud services
  • Marked as TODO in current implementation

Background Processing

  • Android: Foreground service required for long recordings
  • iOS: Background app refresh limitations apply

File Storage

  • Android: App-specific external storage
  • iOS: Documents directory
  • Cloud sync: Implement with subscription tiers

πŸ” Troubleshooting

Common Issues

Build Errors:

# Clean and rebuild
./gradlew clean build

SQLDelight Issues:

# Regenerate database code
./gradlew :shared:generateSqlDelightInterface

RevenueCat Issues:

  • Verify API keys are correct
  • Check product IDs match exactly
  • Ensure entitlements are configured

Platform-Specific Issues

Android:

  • Enable developer options and USB debugging
  • Grant microphone permissions manually if needed

iOS:

  • Check microphone permissions in Settings
  • Verify RevenueCat pod integration

πŸ“ˆ Next Steps

Phase 2: Transcription Integration

  1. Choose transcription service (OpenAI API recommended)
  2. Implement background transcription
  3. Add language detection
  4. Create transcript UI

Phase 3: AI Insights

  1. Integrate AI service for insights
  2. Add summary generation
  3. Create insights UI
  4. Add export functionality

Phase 4: Advanced Features

  1. Cloud sync
  2. Team features (Pro tier)
  3. Real-time transcription
  4. Multiple AI models

🀝 Contributing

  1. Follow existing code patterns
  2. Update both platform implementations
  3. Add tests for new features
  4. Update documentation

πŸ“„ License

This project follows the same license as the original Rflctn iOS app.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors