Updated on 2026-08-14
This commit is contained in:
parent
3fb6cfbaab
commit
982bd4130e
6 changed files with 8 additions and 11 deletions
|
|
@ -61,17 +61,15 @@ class DefaultLearn2earnInteractor(
|
|||
return repository.getUserData().isRegisteredInPromotion
|
||||
}
|
||||
|
||||
override fun getAwardAmount(): Pair<Int, String> {
|
||||
override fun getAwardAmount(): Int {
|
||||
val userInfo = repository.getUserData()
|
||||
val promotionInfo = promotion.getPromotionInfo()
|
||||
|
||||
val awardAmount = if (userInfo.promoCode == null) {
|
||||
return if (userInfo.promoCode == null) {
|
||||
promotionInfo.awardForOldCard
|
||||
} else {
|
||||
promotionInfo.awardForNewCard
|
||||
}.toInt()
|
||||
|
||||
return awardAmount to awardAmount.toString()
|
||||
}
|
||||
|
||||
@Throws(IllegalArgumentException::class)
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ interface Learn2earnInteractor : WebViewRedirectHandler {
|
|||
|
||||
fun isUserRegisteredInPromotion(): Boolean
|
||||
|
||||
fun getAwardAmount(): Pair<Int, String>
|
||||
fun getAwardAmount(): Int
|
||||
|
||||
@Throws(IllegalArgumentException::class)
|
||||
suspend fun requestAward(): Result<Unit>
|
||||
|
|
|
|||
|
|
@ -109,8 +109,7 @@ class Learn2earnViewModel @Inject constructor(
|
|||
return if (interactor.isUserRegisteredInPromotion()) {
|
||||
MainScreenState.Description.GetBonus
|
||||
} else {
|
||||
val (count, award) = interactor.getAwardAmount()
|
||||
MainScreenState.Description.Learn(count, award)
|
||||
MainScreenState.Description.Learn(interactor.getAwardAmount())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ private fun OneInchStoriesContentPreview_Dark() {
|
|||
private fun makePreviewState(): MainScreenState = MainScreenState(
|
||||
isVisible = true,
|
||||
onClick = {},
|
||||
description = MainScreenState.Description.Learn(0, "0"),
|
||||
description = MainScreenState.Description.Learn(0),
|
||||
logoState = MainScreenState.LogoState.Idle,
|
||||
showProgress = false,
|
||||
)
|
||||
|
|
@ -36,9 +36,9 @@ data class MainScreenState(
|
|||
|
||||
sealed class Description(val title: TextReference, val subtitle: TextReference) {
|
||||
|
||||
class Learn(count: Int, award: String) : Description(
|
||||
class Learn(award: Int) : Description(
|
||||
TextReference.Res(R.string.main_learn_title),
|
||||
TextReference.PluralRes(R.plurals.main_learn_subtitle, count, WrappedList(listOf(award))),
|
||||
TextReference.PluralRes(R.plurals.main_learn_subtitle, award, WrappedList(listOf(award))),
|
||||
)
|
||||
|
||||
object GetBonus : Description(
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ internal fun Learn2earnState.Companion.init(uiActions: UiActions): Learn2earnSta
|
|||
mainScreenState = MainScreenState(
|
||||
isVisible = false,
|
||||
onClick = uiActions.buttonMainClick,
|
||||
description = MainScreenState.Description.Learn(0, "0"),
|
||||
description = MainScreenState.Description.Learn(0),
|
||||
logoState = MainScreenState.LogoState.Idle,
|
||||
showProgress = false,
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue