Skip to content

Commit

Permalink
Remove unused code (#2025)
Browse files Browse the repository at this point in the history
  • Loading branch information
shobhitagarwal1612 authored Oct 30, 2023
1 parent 8bc3f9a commit bbbb4da
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package com.google.android.ground.persistence.local.room.dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.Update
import io.reactivex.Completable

/**
* Base interface for DAOs that implement operations on a specific entity type.
Expand All @@ -27,18 +26,13 @@ import io.reactivex.Completable
*/
interface BaseDao<E> {

/** Insert entity into local db. Main-safe. */
@Insert suspend fun insert(entity: E)

/** Update entity in local db. Main-safe. */
@Update suspend fun update(entity: E): Int

@Update suspend fun updateAll(entities: List<E>)

@Deprecated("Replace usage with deleteSuspend") @Delete fun delete(entity: E): Completable

// TODO(#1581): Rename to delete once all existing usages are migrated to coroutine.
@Delete suspend fun deleteSuspend(entity: E)
@Delete suspend fun delete(entity: E)
}

/** Try to update the specified entity, and if it doesn't yet exist, create it. Main-safe. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class RoomLocationOfInterestStore @Inject internal constructor() : LocalLocation
override suspend fun deleteLocationOfInterest(locationOfInterestId: String) {
Timber.d("Deleting local location of interest : $locationOfInterestId")
locationOfInterestDao.findByIdSuspend(locationOfInterestId)?.let {
locationOfInterestDao.deleteSuspend(it)
locationOfInterestDao.delete(it)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ class RoomSubmissionStore @Inject internal constructor() : LocalSubmissionStore
}

override suspend fun deleteSubmission(submissionId: String) {
submissionDao.findByIdSuspend(submissionId)?.let { submissionDao.deleteSuspend(it) }
submissionDao.findByIdSuspend(submissionId)?.let { submissionDao.delete(it) }
}

override fun getSubmissionMutationsByLocationOfInterestIdOnceAndStream(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class RoomSurveyStore @Inject internal constructor() : LocalSurveyStore {

/** Deletes the provided [Survey] from the local database, if it exists in the database. */
override suspend fun deleteSurvey(survey: Survey) =
surveyDao.deleteSuspend(survey.toLocalDataStoreObject())
surveyDao.delete(survey.toLocalDataStoreObject())

private suspend fun insertOrUpdateOption(taskId: String, option: Option) =
optionDao.insertOrUpdate(option.toLocalDataStoreObject(taskId))
Expand Down

0 comments on commit bbbb4da

Please sign in to comment.