Skip to content

Commit

Permalink
prevent adding RECENTS phrases to database
Browse files Browse the repository at this point in the history
  • Loading branch information
cinadia committed May 24, 2024
1 parent edcad95 commit c19919b
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions app/src/main/java/com/willowtree/vocable/PhrasesUseCase.kt
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,15 @@ class PhrasesUseCase(
}

override suspend fun addPhrase(localizedUtterance: LocalesWithText, parentCategoryId: String) {
storedPhrasesRepository.addPhrase(PhraseDto(
phraseId = uuidProvider.randomUUIDString(),
parentCategoryId = parentCategoryId,
creationDate = dateProvider.currentTimeMillis(),
lastSpokenDate = null,
localizedUtterance = localizedUtterance,
sortOrder = legacyPhrasesRepository.getPhrasesForCategory(parentCategoryId).size
))
if (parentCategoryId != PresetCategories.RECENTS.id) {
storedPhrasesRepository.addPhrase(PhraseDto(
phraseId = uuidProvider.randomUUIDString(),
parentCategoryId = parentCategoryId,
creationDate = dateProvider.currentTimeMillis(),
lastSpokenDate = null,
localizedUtterance = localizedUtterance,
sortOrder = legacyPhrasesRepository.getPhrasesForCategory(parentCategoryId).size
))
}
}
}

0 comments on commit c19919b

Please sign in to comment.