Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Commit

Permalink
fix(school): remove ReminderStorage
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreaBrighi committed Jun 15, 2023
1 parent ec14179 commit 2d5abb4
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 68 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,10 @@ class ReminderDomainRepositoryImpl(
withContext(Dispatchers.IO) {
localDataSource.deleteData()
val year = remoteDataSource.downloadYear()
localDataSource.saveYear(year)
val subjects = remoteDataSource.downloadSubjects()
localDataSource.insertSubjects(subjects.map { it.fromRemoteToDB() })
val lessons = remoteDataSource.downloadLessonsForStudent(user.email, year)
if (lessons.isNotEmpty()) {
localDataSource.saveCalendarId(lessons[0].idCalendario)
localDataSource.saveLessons(lessons.map { it.fromRemoteToDB() })
lessons.map { lesson ->
val dbLesson = lesson.fromRemoteToDB()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@ interface ReminderLocalDataSource {
subjects.forEach { insertSubject(it) }
}

suspend fun saveYear(year: String)

suspend fun getYear(): String

suspend fun saveCalendarId(calendarId: Int)

suspend fun getCalendarId(): Int

suspend fun saveLesson(lesson: Lesson)

suspend fun saveLessons(lessons: List<Lesson>) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@ import com.intelligentbackpack.reminderdata.db.ReminderDatabase
import com.intelligentbackpack.reminderdata.db.entities.Lesson
import com.intelligentbackpack.reminderdata.db.entities.Reminder
import com.intelligentbackpack.reminderdata.db.entities.Subject
import com.intelligentbackpack.reminderdata.storage.ReminderStorage
import java.time.LocalDate
import java.time.LocalTime

class ReminderLocalDataSourceImpl(
private val database: ReminderDatabase,
private val storage: ReminderStorage,
) : ReminderLocalDataSource {
override suspend fun getSubjects(): List<Subject> {
return database.reminderDao().getSubjects()
Expand All @@ -20,18 +18,6 @@ class ReminderLocalDataSourceImpl(
database.reminderDao().insertSubject(subject)
}

override suspend fun saveYear(year: String) {
storage.saveYear(year)
}

override suspend fun getYear(): String = storage.getYear()

override suspend fun saveCalendarId(calendarId: Int) {
storage.saveCalendarId(calendarId)
}

override suspend fun getCalendarId(): Int = storage.getCalendarId()

override suspend fun saveLesson(lesson: Lesson) {
database.reminderDao().insertLesson(lesson)
}
Expand Down

This file was deleted.

This file was deleted.

0 comments on commit 2d5abb4

Please sign in to comment.