Updated on 2026-08-14

This commit is contained in:
Tangem 2025-02-26 15:43:23 +05:00
parent cf1f3c8b30
commit 8459eb743b
8 changed files with 30 additions and 54 deletions

View file

@ -44,15 +44,15 @@ internal class DefaultPromoRepository(
}
override fun getStoryById(id: String): Flow<StoryContent?> = isReadyToShowStories(id).mapLatest {
getStoryByIdSync(id)
getStoryByIdSync(id = id, refresh = false)
}
override suspend fun getStoryByIdSync(id: String): StoryContent? = withContext(dispatchers.io) {
override suspend fun getStoryByIdSync(id: String, refresh: Boolean): StoryContent? = withContext(dispatchers.io) {
if (!isReadyToShowStoriesSync(id)) return@withContext null
val storedPromo = promoStoriesStore.getSyncOrNull(storyId = id)
// Get last stored promo by id if possible or get from network
val story = if (storedPromo == null) {
val story = if (storedPromo == null && refresh) {
val storyContent = runCatching {
// Important to return
withTimeoutOrNull(STORIES_LOAD_DELAY) {