iteratehq / iterate-android

Iterate Android SDK
MIT License
3 stars 1 forks source link

Create a manual dependency injection #12

Closed endruuu closed 3 years ago

endruuu commented 3 years ago

Create a manual dependency injection.

Normally we use Dagger or Koin for dependency injection. However, it turns out that:

Since they are not possible, I just created a very simple manual dependency injection. Usage:

// Initialize DI
val iterateDI = IterateDI(context)

// To get the repository
iterateDI.iterateRepository

Reference: https://developer.android.com/training/dependency-injection/manual#dependencies-container

endruuu commented 3 years ago

I checked that Stripe uses Dagger, but it doesn't enforce users to initialize the dependency injection within their Application file. Let me check it again later. I will close this PR first.