mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-22 20:24:03 -04:00
#1449 hack for ZimManageActivity test to present 2 separate application components creating boxStores
This commit is contained in:
parent
aa61a937bf
commit
a629fd8a47
@ -33,8 +33,16 @@ import javax.inject.Singleton
|
||||
|
||||
@Module
|
||||
class DatabaseModule {
|
||||
@Provides @Singleton fun providesBoxStore(context: Context): BoxStore =
|
||||
MyObjectBox.builder().androidContext(context.applicationContext).build()
|
||||
companion object {
|
||||
var boxStore: BoxStore? = null
|
||||
}
|
||||
|
||||
@Provides @Singleton fun providesBoxStore(context: Context): BoxStore {
|
||||
if (boxStore == null) {
|
||||
boxStore = MyObjectBox.builder().androidContext(context.applicationContext).build()
|
||||
}
|
||||
return boxStore!!
|
||||
}
|
||||
|
||||
@Provides @Singleton fun providesNewDownloadDao(boxStore: BoxStore): NewDownloadDao =
|
||||
NewDownloadDao(boxStore.boxFor())
|
||||
|
Loading…
x
Reference in New Issue
Block a user