Replace module interfaces with objects

Change-Id: Ieab7533120e7b8d5a770963e37b9db405e229630
pull/2/head
Adetunji Dahunsi 3 years ago
parent 8b1852cf5e
commit e089012a8d

@ -28,26 +28,24 @@ import dagger.hilt.components.SingletonComponent
@Module
@InstallIn(SingletonComponent::class)
interface DaosModule {
companion object {
@Provides
fun providesAuthorDao(
database: NiADatabase,
): AuthorDao = database.authorDao()
object DaosModule {
@Provides
fun providesAuthorDao(
database: NiADatabase,
): AuthorDao = database.authorDao()
@Provides
fun providesTopicsDao(
database: NiADatabase,
): TopicDao = database.topicDao()
@Provides
fun providesTopicsDao(
database: NiADatabase,
): TopicDao = database.topicDao()
@Provides
fun providesEpisodeDao(
database: NiADatabase,
): EpisodeDao = database.episodeDao()
@Provides
fun providesEpisodeDao(
database: NiADatabase,
): EpisodeDao = database.episodeDao()
@Provides
fun providesNewsResourceDao(
database: NiADatabase,
): NewsResourceDao = database.newsResourceDao()
}
@Provides
fun providesNewsResourceDao(
database: NiADatabase,
): NewsResourceDao = database.newsResourceDao()
}

@ -28,16 +28,14 @@ import javax.inject.Singleton
@Module
@InstallIn(SingletonComponent::class)
interface DatabaseModule {
companion object {
@Provides
@Singleton
fun providesNiADatabase(
@ApplicationContext context: Context,
): NiADatabase = Room.databaseBuilder(
context,
NiADatabase::class.java,
"nia-database"
).build()
}
object DatabaseModule {
@Provides
@Singleton
fun providesNiADatabase(
@ApplicationContext context: Context,
): NiADatabase = Room.databaseBuilder(
context,
NiADatabase::class.java,
"nia-database"
).build()
}

Loading…
Cancel
Save