How myzel394/alibi works
Project type and purpose
• Mobile, offline-first Android application
• Core feature: continuous circular buffering of audio & video
• Exposes UI (Jetpack Compose) for configuration, preview, and saving clips
• Background recording implemented as Android Services
Main architectural layers & components
1. Presentation Layer (UI)
– MainActivity + Jetpack Compose screens & Navigation
– UI components organized by feature (RecorderScreen, SettingsScreen, etc.)
– ViewModels / Models: AudioRecorderModel, VideoRecorderModel, BaseRecorderModel
2. Domain / Business Logic
– RecorderService, AudioRecorderService, VideoRecorderService, IntervalRecorderService
– Helpers: MediaConverter, BatchesFolder (AudioBatchesFolder & VideoBatchesFolder), Doctor, AppLockHelper
– Notification helpers: NotificationHelper, RecorderNotificationHelper
3. Data Layer
– AppSettings persisted via custom serializer (AppSettingsSerializer) into a local file or DataStore
– File System storage: circular buffer folders on device (managed by BatchesFolder classes)
– SQLite or DataStore for settings (AppSettings.kt)
4. Platform / OS
– Android OS: MediaRecorder / Camera2 / AudioRecord APIs
– BroadcastReceiver (LocalChangeReceiver) for detecting system changes (e.g., storage availability)
– Notification channels for foreground service compliance
Relationships & interactions
• UI → Domain: user taps “Start”, UI sends an Intent or ViewModel call to start the appropriate RecorderService
• Domain → Storage: RecorderService writes media chunks into rotating batch folders (AudioBatchesFolder, VideoBatchesFolder)
• Domain → Notification: RecorderNotificationHelper updates the foreground service notification with recording status
• UI / Settings → Data Layer: reading/writing AppSettings via AppSettingsSerializer
• BroadcastReceiver → Domain / UI: LocalChangeReceiver listens for storage changes and forwards events to UI or service
• Save-on-demand flow: UI triggers “save last 30 min” → Domain logic copies files from batch folders to user’s export directory via MediaConverter
Architectural patterns & design principles
• Layered separation (Presentation / Domain / Data / Platform)
• MVVM-style organization (Models + UI composables)
• Dependency inversion (services interact via interfaces/helpers)
• Single responsibility (each folder/helper/service has one focused role)
• Resource management pattern: circular file buffer to bound storage
Technologies & frameworks
• Kotlin + Android SDK
• Jetpack Compose (UI, Navigation)
• Android Services + BroadcastReceiver
• Local file I/O (batch folders) & local persistence (DataStore or custom serialization)
• fastlane & GitHub Actions (CI/CD – you may show this as a side note or deployment pipeline if desired)
Essential elements
• Clear, human-readable labels on each component
• A note on retention policy: “keep last N minutes, purge older files”