- package keijumt.devandroid.di.module
-
- import android.app.Application
- import android.content.Context
- import dagger.Module
- import dagger.Provides
- import keijumt.devandroid.api.PostalCodeApi
- import keijumt.devandroid.repository.PostalCodeDataRepository
- import keijumt.devandroid.repository.PostalCodeRepository
- import javax.inject.Singleton
-
- /**
- * Module: Application 定義
- */
- @Module(includes = arrayOf(
- ViewModelModule::class
- ))
- class AppModule {
-
- @Singleton
- @Provides
- fun provideContext(application: Application): Context {
- return application.applicationContext
- }
-
- @Singleton
- @Provides
- fun providePostalCodeRepository(postalCodeApi: PostalCodeApi): PostalCodeRepository =
- PostalCodeDataRepository(postalCodeApi)
- }