How xlspring/hushhear works
Project Type and Purpose
• This is a cross-platform mobile application built with React Native (bare/ejected Expo workflow) targeting Android and iOS.
• Purpose: “HushHear” lets users silence unwanted sounds by connecting to headphones (likely over Bluetooth), adjusting EQ, toggling noise profiles, and managing user authentication and premium features.
File Structure Analysis
• Root
• App.js – entry point for the JS bundle
• package.json, babel.config.js, eas.json – configuration and build/deployment scripts
• android/, ios/ – native host projects generated by React Native CLI (Android: Gradle + Kotlin; iOS: Xcode Objective-C/Swift bridge)
• assets/ – fonts, images, sound files
• screens/ – screen definitions organized by feature area (login, app, menu)
• redux/ – state management (store, reducers for connection, headphones, login, menu)
• Key architectural choices
• UI composition via React components + screens
• Global state via Redux
• Native modules for headphone connectivity and audio control
• Metro bundler serves JS at runtime (embedded or via dev server)
a. Main Components
1. Mobile Client “HushHear”
• Presentation Layer: React Native UI (screens & components)
• State Layer: Redux store & reducers
• Business Logic: JS modules handling actions (connect, adjust EQ)
• Native Bridge: React Native native modules for Bluetooth/audio
2. Native Hosts
• Android: Kotlin/Java entry (MainActivity.kt), Gradle build
• iOS: Obj-C/Swift bridge (AppDelegate), Xcode project
3. External Systems
• Headphones (Bluetooth LE peripheral)
• Backend API (authentication, premium features, user data)
• Optional Analytics/Crash Reporting service
4. Build/Deployment Tools
• Metro bundler (JS bundling)
• EAS/App Store / Play Store pipelines
b. Relationships & Data Flows
• App.js initializes the Redux store, loads initial screen
• UI Screens dispatch Redux actions → reducers update state
• Thunks or direct calls go through Native Bridge to:
– Scan/Connect to headphone hardware
– Send EQ settings to headphone audio engine
• Network calls from JS → Backend API for login, account, premium checks
• State updates flow back to UI via Redux → re-render screens/components
c. Architectural Patterns & Principles
• Component-Based Architecture: separation of reusable UI pieces (components/) from feature screens (screens/)
• Unidirectional Data Flow (Redux): clear separation of actions, state, and views
• Native Module Pattern: encapsulate hardware-specific logic behind JS bridge interfaces
• Feature Folder Organization: group related screens, components, and state
d. Key Technologies & Frameworks
• React Native (JS runtime + native bridges)
• Redux (state container)
• Metro (bundler)
• Android SDK (Gradle, Kotlin/Java)
• iOS SDK (Xcode, Objective-C/Swift)
• Bluetooth LE libraries (native modules)
• Expo Application Services (EAS) for builds