Tidy up storage

This commit is contained in:
SessionHero01 2024-10-07 15:45:18 +11:00
parent d2a4f12c29
commit 79db7bdc5c
No known key found for this signature in database
3 changed files with 200 additions and 457 deletions

View File

@ -17,6 +17,7 @@ interface DatabaseComponent {
companion object { companion object {
@JvmStatic @JvmStatic
@Deprecated("Should use a properly DI instance of components")
fun get(context: Context) = ApplicationContext.getInstance(context).databaseComponent fun get(context: Context) = ApplicationContext.getInstance(context).databaseComponent
} }

View File

@ -139,19 +139,6 @@ object DatabaseModule {
@Singleton @Singleton
fun provideExpirationConfigurationDatabase(@ApplicationContext context: Context, openHelper: SQLCipherOpenHelper) = ExpirationConfigurationDatabase(context, openHelper) fun provideExpirationConfigurationDatabase(@ApplicationContext context: Context, openHelper: SQLCipherOpenHelper) = ExpirationConfigurationDatabase(context, openHelper)
@Provides
@Singleton
fun provideStorage(@ApplicationContext context: Context,
openHelper: SQLCipherOpenHelper,
configFactory: ConfigFactory,
threadDatabase: ThreadDatabase,
pollerFactory: PollerFactory,
): Storage {
val storage = Storage(context, openHelper, configFactory, pollerFactory)
threadDatabase.setUpdateListener(storage)
return storage
}
@Provides @Provides
@Singleton @Singleton
fun provideAttachmentProvider(@ApplicationContext context: Context, openHelper: SQLCipherOpenHelper): MessageDataProvider = DatabaseAttachmentProvider(context, openHelper) fun provideAttachmentProvider(@ApplicationContext context: Context, openHelper: SQLCipherOpenHelper): MessageDataProvider = DatabaseAttachmentProvider(context, openHelper)