You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
package org.tasks.injection
|
|
|
|
|
|
|
|
import android.app.Application
|
|
|
|
import androidx.room.Room
|
|
|
|
import com.todoroo.astrid.dao.Database
|
|
|
|
import dagger.Module
|
|
|
|
import dagger.Provides
|
|
|
|
import org.tasks.db.Migrations
|
|
|
|
import org.tasks.preferences.Preferences
|
|
|
|
|
|
|
|
@Module(includes = [ApplicationModule::class])
|
|
|
|
internal class ProductionModule {
|
|
|
|
@Provides
|
|
|
|
@ApplicationScope
|
|
|
|
fun getAppDatabase(context: Application): Database {
|
|
|
|
return Room.databaseBuilder(context, Database::class.java, Database.NAME)
|
|
|
|
.allowMainThreadQueries() // TODO: remove me
|
|
|
|
.addMigrations(*Migrations.MIGRATIONS)
|
|
|
|
.build()
|
|
|
|
}
|
|
|
|
|
|
|
|
@Provides
|
|
|
|
fun getPreferences(context: Application): Preferences {
|
|
|
|
return Preferences(context)
|
|
|
|
}
|
|
|
|
}
|