Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/navigation architecture #35

Merged
merged 14 commits into from
Aug 19, 2024
Merged

Conversation

tonelli-m
Copy link
Collaborator

Description

Refactoring the current structure of the app to move towards MVVM design pattern.

Changes

  • New UI package structure looks like this:
    • a features package that should contain one sub package per "feature" of the app (generally a screen but can be an ensemble of screen in the case of an onboarding flow for instance)
      • one subpackage per feature (e.g. home, settings, login, etc) with UI components tied to this feature, and screen classes
    • a navigation package that should contain navigation related code such as routes and navigation logic
    • a components package for shared and reused UI components (there isn't any for now tho)
  • Migrated all views to use MVVM design pattern. Generally each view should be paired with a ViewModel class that takes care of providing the data to the presentation layer. The view itself should never access the data layer, and the view model should never directly update the presentation layer, only provide data updates that the view will subscribe to. View models are then injected using Koin to resolve needed dependencies. Each feature package contains a koin module that will be registerd in Koin.kt
  • I've made changes here and there, mainly to cleanup the code and split files that were too large in smaller, more maintainable chunks (see MeasurementsScreen for instance).
  • Coroutines are now using local scopes instead of using GlobalScope. This seems to fix the crash in the web implementation.

Linked issues

Remaining TODOs

Regarding #26, the current implementation seems stable but we will still need to add platform specific implementations to keep the measurement service running in the background (Foreground Service for Android and enabling Background audio capability on iOS)

Checklist

  • Code compiles correctly on all platforms
  • All pre-existing tests are passing
  • If needed, new tests have been added
  • Extended the README / documentation if necessary
  • Added code has been documented

@tonelli-m tonelli-m added the KMP Shared Kotlin code label Aug 7, 2024
@tonelli-m
Copy link
Collaborator Author

tonelli-m commented Aug 7, 2024

#31 Should be good for merging once this is done

@tonelli-m tonelli-m mentioned this pull request Aug 12, 2024
5 tasks
@tonelli-m tonelli-m changed the base branch from main to dev August 13, 2024 08:30
@nicolas-f nicolas-f merged commit 853cc0f into dev Aug 19, 2024
6 checks passed
@nicolas-f nicolas-f deleted the feature/navigation-architecture branch August 19, 2024 08:24
nicolas-f added a commit that referenced this pull request Aug 19, 2024
…io-source

# Description

Adds `AudioSource` implementation for iOS

⚠️ **This PR is built on top of #35! It should only be merged afterwards.** ⚠️ 

## Changes

- Implements the `AudioSource` interface for iOS using `AVAudioSession` and `AVAudioEngine`
- See Apple documentation for more details: [AVAudioSession](https://developer.apple.com/documentation/avfaudio/avaudiosession), [AVAudioEngine](https://developer.apple.com/documentation/avfaudio/avaudioengine)

## Linked issues

#34 

## Remaining TODOs

- The output level seems a little high compared to the Android equivalent (same for the web version btw). I think the gain value should be platform specific (currently `ANDROID_GAIN` is used by default everywhere)
- Currently the default microphone is picked up by default (same of other platforms atm), but in fine it should be possible for the user to switch microphones

## Checklist

- [x] Code compiles correctly on all platforms
- [x] All pre-existing tests are passing
- [x] If needed, new tests have been added
- [x] Extended the README / documentation if necessary
- [x] Added code has been documented
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
KMP Shared Kotlin code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants