Updated on 2026-08-14
This commit is contained in:
commit
06a81d009f
3 changed files with 17 additions and 2 deletions
|
|
@ -268,6 +268,7 @@ class WalletFragment : Fragment(R.layout.fragment_wallet), SafeStoreSubscriber<W
|
|||
private fun refreshWalletData() {
|
||||
Analytics.send(Portfolio.Refreshed())
|
||||
store.dispatch(WalletAction.LoadData.Refresh)
|
||||
learn2earnViewModel.onMainScreenRefreshed()
|
||||
}
|
||||
|
||||
private fun showWarningsIfPresent(warnings: List<WarningMessage>) {
|
||||
|
|
|
|||
|
|
@ -48,8 +48,18 @@ class DefaultLearn2earnInteractor(
|
|||
override suspend fun isNeedToShowViewOnMainScreen(): Boolean {
|
||||
if (!promotionIsActive()) return false
|
||||
|
||||
val response = repository.validate(userWalletManager.getWalletId())
|
||||
return response.valid == true
|
||||
val promoCode = repository.getUserData().promoCode
|
||||
val userWalletId = userWalletManager.getWalletId()
|
||||
return if (promoCode == null) {
|
||||
val response = repository.validate(userWalletId)
|
||||
response.valid == true
|
||||
} else {
|
||||
val response = repository.validateCode(userWalletId, promoCode)
|
||||
when (val error = response.error?.toDomainError()) {
|
||||
null -> response.valid == true
|
||||
else -> error !is PromotionError.CodeWasNotAppliedInShop
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun isUserRegisteredInPromotion(): Boolean {
|
||||
|
|
|
|||
|
|
@ -45,6 +45,10 @@ class Learn2earnViewModel @Inject constructor(
|
|||
updateMainScreenViews()
|
||||
}
|
||||
|
||||
fun onMainScreenRefreshed() {
|
||||
updateMainScreenViews()
|
||||
}
|
||||
|
||||
private fun updateMainScreenViews() {
|
||||
viewModelScope.launch(dispatchers.io) {
|
||||
if (interactor.isNeedToShowViewOnMainScreen()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue