waseefakhtar / dose-android

💊⏰ Dose is a medication reminder app for Android, built entirely using Kotlin and Jetpack Compose with MVVM + Clean Architecture
https://play.google.com/store/apps/details?id=com.waseefakhtar.doseapp
MIT License
510 stars 83 forks source link

Inject AnalyticsHelper with Hilt #74

Closed waseefakhtar closed 7 months ago

ankur141295 commented 10 months ago

@waseefakhtar I can work on this issue and I have two ideas in mind and I want your opinion on this.

1st Approach --> Inject AnalyticsHelper in MainActivity and pass it down to DoseApp --> DoseNavHost --> and to each composable.

2nd Approach --> Inject AnalyticsHelper into ViewModel and wherever in composables AnalyticsHelper is required call the viewModel function to log the events.

waseefakhtar commented 10 months ago

@waseefakhtar I can work on this issue and I have two ideas in mind and I want your opinion on this.

1st Approach --> Inject AnalyticsHelper in MainActivity and pass it down to DoseApp --> DoseNavHost --> and to each composable.

2nd Approach --> Inject AnalyticsHelper into ViewModel and wherever in composables AnalyticsHelper is required call the viewModel function to log the events.

Sure you can! I meant to use our dependency injection, Hilt, to inject it everywhere. We already have Hilt set up and use it for some dependencies. You can find examples of it in /di directory

waseefakhtar commented 7 months ago

Resolved in #118