Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Verified Commit 07b2c1e0 authored by Fahim M. Choudhury's avatar Fahim M. Choudhury
Browse files

refactor(install): move install persistence DI to data module

parent 087d90cd
Loading
Loading
Loading
Loading
+0 −26
Original line number Diff line number Diff line
package foundation.e.apps.data.di.db

import android.content.Context
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.android.qualifiers.ApplicationContext
import dagger.hilt.components.SingletonComponent
import foundation.e.apps.data.installation.local.AppInstallDAO
import foundation.e.apps.data.installation.local.AppInstallDatabase
import javax.inject.Singleton

@Module
@InstallIn(SingletonComponent::class)
object DatabaseModule {
    @Singleton
    @Provides
    fun provideDatabaseInstance(@ApplicationContext context: Context): AppInstallDatabase {
        return AppInstallDatabase.getInstance(context)
    }

    @Singleton
    @Provides
    fun provideFusedDaoInstance(appInstallDatabase: AppInstallDatabase): AppInstallDAO {
        return appInstallDatabase.fusedDownloadDao()
    }
}
+27 −0
Original line number Diff line number Diff line
package foundation.e.apps.data.installation.di

import android.content.Context
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.android.qualifiers.ApplicationContext
import dagger.hilt.components.SingletonComponent
import foundation.e.apps.data.installation.local.AppInstallDAO
import foundation.e.apps.data.installation.local.AppInstallDatabase
import javax.inject.Singleton

@Module
@InstallIn(SingletonComponent::class)
object AppInstallPersistenceModule {
    @Singleton
    @Provides
    fun provideDatabaseInstance(@ApplicationContext context: Context): AppInstallDatabase {
        return AppInstallDatabase.getInstance(context)
    }

    @Singleton
    @Provides
    fun provideFusedDaoInstance(appInstallDatabase: AppInstallDatabase): AppInstallDAO {
        return appInstallDatabase.fusedDownloadDao()
    }
}