mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-23 20:54:13 -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
|
@Module
|
||||||
class DatabaseModule {
|
class DatabaseModule {
|
||||||
@Provides @Singleton fun providesBoxStore(context: Context): BoxStore =
|
companion object {
|
||||||
MyObjectBox.builder().androidContext(context.applicationContext).build()
|
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 =
|
@Provides @Singleton fun providesNewDownloadDao(boxStore: BoxStore): NewDownloadDao =
|
||||||
NewDownloadDao(boxStore.boxFor())
|
NewDownloadDao(boxStore.boxFor())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user