This commit is contained in:
2026-09-02 23:47:00 +03:00
parent b4d0b0c8e9
commit a8830bcd91
77 changed files with 2998 additions and 0 deletions
@@ -0,0 +1,45 @@
package agzam.vyatsu.di
import agzam.vyatsu.data.local.AppDatabase
import agzam.vyatsu.data.local.ScheduleCodec
import agzam.vyatsu.data.remote.GroupsParser
import agzam.vyatsu.data.remote.VyatsuHttpClient
import agzam.vyatsu.data.repository.GroupRepositoryImpl
import agzam.vyatsu.data.repository.PreferencesRepositoryImpl
import agzam.vyatsu.data.repository.ScheduleRepositoryImpl
import agzam.vyatsu.domain.repository.GroupRepository
import agzam.vyatsu.domain.repository.PreferencesRepository
import agzam.vyatsu.domain.repository.ScheduleRepository
import android.content.Context
import androidx.room.Room
import com.squareup.moshi.Moshi
class AppContainer(context: Context) {
private val moshi: Moshi = Moshi.Builder().build()
private val database: AppDatabase = Room.databaseBuilder(
context.applicationContext,
AppDatabase::class.java,
"vyatsu_schedule.db"
).build()
private val codec: ScheduleCodec = ScheduleCodec(moshi)
val groupRepository: GroupRepository by lazy {
GroupRepositoryImpl(
groupDao = database.groupDao(),
)
}
val scheduleRepository: ScheduleRepository by lazy {
ScheduleRepositoryImpl(
scheduleDao = database.scheduleDao(),
groupDao = database.groupDao(),
codec = codec
)
}
val preferencesRepository: PreferencesRepository by lazy {
PreferencesRepositoryImpl(database.preferencesDao())
}
}