Skip to content

Commit 051272b

Browse files
frettclaude
andcommitted
Sync featured tools alongside tool order in ToolsPresenter
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 28fc773 commit 051272b

2 files changed

Lines changed: 15 additions & 3 deletions

File tree

app/src/main/kotlin/org/cru/godtools/ui/dashboard/tools/ToolsPresenter.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ import dagger.assisted.AssistedFactory
2222
import dagger.assisted.AssistedInject
2323
import dagger.hilt.components.SingletonComponent
2424
import java.util.Locale
25+
import kotlinx.coroutines.coroutineScope
2526
import kotlinx.coroutines.flow.first
27+
import kotlinx.coroutines.launch
2628
import org.ccci.gto.android.common.sync.SyncTracker
2729
import org.cru.godtools.analytics.model.OpenAnalyticsActionEvent
2830
import org.cru.godtools.analytics.model.OpenAnalyticsActionEvent.Companion.ACTION_OPEN_TOOL_DETAILS
@@ -197,7 +199,10 @@ class ToolsPresenter @AssistedInject internal constructor(
197199

198200
private fun SyncTracker.syncData(locale: Locale, force: Boolean = false) = launchSync {
199201
val country = settings.getCountrySettingFlow().first()
200-
syncService.syncToolOrder(locale, country, force)
202+
coroutineScope {
203+
launch { syncService.syncFeaturedTools(locale, country, force) }
204+
launch { syncService.syncToolOrder(locale, country, force) }
205+
}
201206
}
202207

203208
@AssistedFactory

app/src/testDebug/kotlin/org/cru/godtools/ui/dashboard/tools/ToolsPresenterTest.kt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ class ToolsPresenterTest {
7373
}
7474
private val syncService: GodToolsSyncService = mockk {
7575
coEvery { syncToolOrder(any(), any(), any()) } coAnswers { toolOrderSync.receive() }
76+
coEvery { syncFeaturedTools(any(), any(), any()) } returns true
7677
}
7778
private val favoriteToolsBannerPresenter = FakeBannerPresenter<FavoriteToolsBannerPresenter.UiState>(null)
7879
private val featuredToolsFlowProducer: FeaturedToolsFlowProducer = mockk {
@@ -265,7 +266,10 @@ class ToolsPresenterTest {
265266
presenter.test {
266267
awaitInitialItem()
267268
toolOrderSync.send(true)
268-
coVerifyAll { syncService.syncToolOrder(Locale.ENGLISH, "US", false) }
269+
coVerifyAll {
270+
syncService.syncToolOrder(Locale.ENGLISH, "US", false)
271+
syncService.syncFeaturedTools(Locale.ENGLISH, "US", false)
272+
}
269273
}
270274
}
271275

@@ -278,7 +282,10 @@ class ToolsPresenterTest {
278282
presenter.test {
279283
awaitInitialItem()
280284
toolOrderSync.send(true)
281-
coVerifyAll { syncService.syncToolOrder(Locale.FRENCH, "US", false) }
285+
coVerifyAll {
286+
syncService.syncToolOrder(Locale.FRENCH, "US", false)
287+
syncService.syncFeaturedTools(Locale.FRENCH, "US", false)
288+
}
282289
}
283290
}
284291

0 commit comments

Comments
 (0)