Updated on 2026-08-14
This commit is contained in:
parent
552da5be18
commit
4addc9601e
15 changed files with 204 additions and 3 deletions
|
|
@ -0,0 +1,28 @@
|
|||
package com.tangem.domain.promo.models
|
||||
|
||||
data class StoryContent(
|
||||
val imageHost: String,
|
||||
val story: Story,
|
||||
) {
|
||||
data class Story(
|
||||
val id: String,
|
||||
val title: String?,
|
||||
val slides: List<StorySlide>,
|
||||
)
|
||||
|
||||
data class StorySlide(
|
||||
val id: String,
|
||||
)
|
||||
|
||||
fun getImageUrls(): List<String> {
|
||||
return story.slides.map { slide -> imageHost + slide.id + WEBP_EXTENSION }
|
||||
}
|
||||
|
||||
private companion object {
|
||||
const val WEBP_EXTENSION = ".webp"
|
||||
}
|
||||
}
|
||||
|
||||
enum class StoryContentIds(val id: String) {
|
||||
STORY_FIRST_TIME_SWAP("first-time-swap"),
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package com.tangem.domain.promo
|
||||
|
||||
import arrow.core.Either
|
||||
import com.tangem.domain.promo.models.StoryContent
|
||||
|
||||
class GetStoryContentUseCase(
|
||||
private val promoRepository: PromoRepository,
|
||||
) {
|
||||
|
||||
suspend operator fun invoke(id: String): Either<Throwable, StoryContent> = Either.catch {
|
||||
promoRepository.getStoryById(id)
|
||||
}
|
||||
}
|
||||
|
|
@ -1,9 +1,11 @@
|
|||
package com.tangem.domain.promo
|
||||
|
||||
import com.tangem.domain.promo.models.StoryContent
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
interface PromoRepository {
|
||||
|
||||
// region Promo
|
||||
fun isReadyToShowWalletSwapPromo(): Flow<Boolean>
|
||||
|
||||
fun isReadyToShowTokenSwapPromo(): Flow<Boolean>
|
||||
|
|
@ -11,10 +13,15 @@ interface PromoRepository {
|
|||
suspend fun setNeverToShowWalletSwapPromo()
|
||||
|
||||
suspend fun setNeverToShowTokenSwapPromo()
|
||||
// endregion
|
||||
|
||||
// region Stories
|
||||
suspend fun getStoryById(id: String): StoryContent
|
||||
|
||||
fun isReadyToShowSwapStories(): Flow<Boolean>
|
||||
|
||||
suspend fun isReadyToShowSwapStoriesSync(): Boolean
|
||||
|
||||
suspend fun setNeverToShowSwapStories()
|
||||
// endregion
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue