coin home caching fix (#8774)
This commit is contained in:
@@ -28,6 +28,7 @@ import kotlinx.coroutines.flow.MutableSharedFlow
|
||||
import kotlinx.coroutines.flow.asSharedFlow
|
||||
import kotlinx.coroutines.flow.collectLatest
|
||||
import kotlinx.coroutines.launch
|
||||
import orVal
|
||||
import timber.log.Timber
|
||||
import javax.inject.Inject
|
||||
|
||||
@@ -135,10 +136,12 @@ class CoinHomeScreenVM @Inject constructor(
|
||||
}
|
||||
}
|
||||
|
||||
private fun fetchAndSaveCoinHistoryScreen(){
|
||||
private fun fetchAndSaveCoinHistoryScreen() {
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
val coinResponse = coinHistoryScreenRepo.fetchCoinHistoryScreenCoinBalanceUiTronConfigs()
|
||||
val cashResponse = coinHistoryScreenRepo.fetchCoinHistoryScreenCashRewardsUiTronConfigs()
|
||||
val coinResponse =
|
||||
coinHistoryScreenRepo.fetchCoinHistoryScreenCoinBalanceUiTronConfigs()
|
||||
val cashResponse =
|
||||
coinHistoryScreenRepo.fetchCoinHistoryScreenCashRewardsUiTronConfigs()
|
||||
coinResponse.isValidResponse().let {
|
||||
if (it) {
|
||||
cacheCoinHomeImages(coinResponse.data?.screenStructure)
|
||||
@@ -151,6 +154,7 @@ class CoinHomeScreenVM @Inject constructor(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun fetchAndSaveCoinHomeScreen() {
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
val response = coinHomeScreenRepo.fetchCoinHomeScreenUiTronConfigs()
|
||||
@@ -160,7 +164,8 @@ class CoinHomeScreenVM @Inject constructor(
|
||||
NaviCacheEntity(
|
||||
key = COIN_HOME_SCREEN_CACHE_KEY,
|
||||
value = getGsonBuilders().toJson(response.data).orEmpty(),
|
||||
version = 1
|
||||
version = CommonLibManager.buildConfigDetails.appVersionCode.toIntOrNull()
|
||||
.orVal(1)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user