Skip to content

Commit

Permalink
Merge pull request #3236 from CruGlobal/GT-2216-downloadLessonsForPin…
Browse files Browse the repository at this point in the history
…nedLanguages

GT-2216 download lessons for a language when it is pinned
  • Loading branch information
frett authored Nov 20, 2023
2 parents b1dcdaa + 1a65196 commit ab51d83
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ class GodToolsDownloadManager @VisibleForTesting internal constructor(
private fun Flow<Collection<Locale>>.downloadFavoriteTranslations() = toolsRepository.getFavoriteToolsFlow()
.downloadTranslations(this)

private fun Flow<Collection<Locale>>.downloadAllToolTranslations() = toolsRepository.getNormalToolsFlow()
private fun Flow<Collection<Locale>>.downloadAllToolTranslations() = toolsRepository.getAllToolsFlow()
.downloadTranslations(this)

private fun Flow<Set<Long>>.downloadAttachments() = this
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ class GodToolsDownloadManagerDispatcherTest {
private val attachmentsFlow = MutableSharedFlow<List<Attachment>>(replay = 1)
private val downloadedFilesFlow = MutableSharedFlow<List<DownloadedFile>>(replay = 1)
private val favoriteToolsFlow = MutableSharedFlow<List<Tool>>(replay = 1)
private val resourcesFlow = MutableSharedFlow<List<Tool>>(replay = 1)
private val toolsFlow = MutableSharedFlow<List<Tool>>(replay = 1)

private val attachmentsRepository: AttachmentsRepository = mockk {
Expand All @@ -61,9 +60,8 @@ class GodToolsDownloadManagerDispatcherTest {
}
private val toolsRepository: ToolsRepository by lazy {
mockk {
every { getAllToolsFlow() } returns resourcesFlow
every { getAllToolsFlow() } returns toolsFlow
every { getFavoriteToolsFlow() } returns favoriteToolsFlow
every { getNormalToolsFlow() } returns toolsFlow
}
}
private val translationsRepository: TranslationsRepository by lazy {
Expand Down Expand Up @@ -234,7 +232,7 @@ class GodToolsDownloadManagerDispatcherTest {
}

attachmentsFlow.emit(attachments)
resourcesFlow.emit(listOf(tool1, tool2))
toolsFlow.emit(listOf(tool1, tool2))
runCurrent()
coVerify(exactly = 1) {
downloadManager.downloadAttachment(attachments[3].id)
Expand Down

0 comments on commit ab51d83

Please sign in to comment.