diff --git a/features/txhistory/api/src/main/kotlin/com/tangem/features/txhistory/component/TxHistoryComponent.kt b/features/txhistory/api/src/main/kotlin/com/tangem/features/txhistory/component/TxHistoryComponent.kt index 8fa11c9c93..ce1b2ad241 100644 --- a/features/txhistory/api/src/main/kotlin/com/tangem/features/txhistory/component/TxHistoryComponent.kt +++ b/features/txhistory/api/src/main/kotlin/com/tangem/features/txhistory/component/TxHistoryComponent.kt @@ -16,8 +16,6 @@ interface TxHistoryComponent { fun LazyListScope.txHistoryContent(listState: LazyListState, state: TxHistoryUM) - fun reload() - data class Params( val userWalletId: UserWalletId, val currency: CryptoCurrency, diff --git a/features/txhistory/impl/src/main/kotlin/com/tangem/features/txhistory/component/DefaultTxHistoryComponent.kt b/features/txhistory/impl/src/main/kotlin/com/tangem/features/txhistory/component/DefaultTxHistoryComponent.kt index e3e25ebc5e..7ec4d11055 100644 --- a/features/txhistory/impl/src/main/kotlin/com/tangem/features/txhistory/component/DefaultTxHistoryComponent.kt +++ b/features/txhistory/impl/src/main/kotlin/com/tangem/features/txhistory/component/DefaultTxHistoryComponent.kt @@ -27,10 +27,6 @@ internal class DefaultTxHistoryComponent @AssistedInject constructor( txHistoryItems(listState, state) } - override fun reload() { - model.reload() - } - @AssistedFactory interface Factory : TxHistoryComponent.Factory { override fun create(context: AppComponentContext, params: TxHistoryComponent.Params): DefaultTxHistoryComponent diff --git a/features/txhistory/impl/src/main/kotlin/com/tangem/features/txhistory/model/TxHistoryModel.kt b/features/txhistory/impl/src/main/kotlin/com/tangem/features/txhistory/model/TxHistoryModel.kt index 593f171318..fc7568fafc 100644 --- a/features/txhistory/impl/src/main/kotlin/com/tangem/features/txhistory/model/TxHistoryModel.kt +++ b/features/txhistory/impl/src/main/kotlin/com/tangem/features/txhistory/model/TxHistoryModel.kt @@ -8,8 +8,8 @@ import com.tangem.core.decompose.model.ParamsContainer import com.tangem.core.navigation.url.UrlOpener import com.tangem.domain.balancehiding.GetBalanceHidingSettingsUseCase import com.tangem.domain.common.util.cardTypesResolver -import com.tangem.domain.tokens.error.CurrencyStatusError import com.tangem.domain.tokens.GetCurrencyStatusUpdatesUseCase +import com.tangem.domain.tokens.error.CurrencyStatusError import com.tangem.domain.tokens.model.CryptoCurrencyStatus import com.tangem.domain.txhistory.models.TxHistoryStateError import com.tangem.domain.txhistory.repository.TxHistoryRepositoryV2 @@ -66,6 +66,7 @@ internal class TxHistoryModel @Inject constructor( init { handleBalanceHiding() subscribeToUiItemChanges() + initListManager() loadTxInfo() subscribeToUpdateListener() subscribeOnCurrencyStatusUpdates() @@ -83,6 +84,10 @@ internal class TxHistoryModel @Inject constructor( .launchIn(modelScope) } + private fun initListManager() { + modelScope.launch { txHistoryListManager.init() } + } + private fun loadTxInfo() { _uiState.update { state -> getLoadingState(state.isBalanceHidden) } modelScope.launch { diff --git a/features/txhistory/impl/src/main/kotlin/com/tangem/features/txhistory/utils/TxHistoryListManager.kt b/features/txhistory/impl/src/main/kotlin/com/tangem/features/txhistory/utils/TxHistoryListManager.kt index 91894dd1d1..3998d36595 100644 --- a/features/txhistory/impl/src/main/kotlin/com/tangem/features/txhistory/utils/TxHistoryListManager.kt +++ b/features/txhistory/impl/src/main/kotlin/com/tangem/features/txhistory/utils/TxHistoryListManager.kt @@ -45,7 +45,7 @@ internal class TxHistoryListManager( val uiItems: Flow> = uiManager.items - suspend fun startLoading() = coroutineScope { + suspend fun init() = coroutineScope { val batchFlow = repository.getTxHistoryBatchFlow( context = TxHistoryListBatchingContext( actionsFlow = actionsFlow, @@ -59,7 +59,9 @@ internal class TxHistoryListManager( .flowOn(dispatchers.default) .launchIn(scope = this) .saveIn(jobHolder) + } + suspend fun startLoading() { actionsFlow.emit( BatchAction.Reload( requestParams = TxHistoryListConfig(userWalletId, currency, refresh = false),