Updated on 2026-08-14
This commit is contained in:
parent
950dc41662
commit
dfa6798f07
16 changed files with 220 additions and 82 deletions
|
|
@ -135,7 +135,7 @@ internal class TesterActivity : ComposeActivity() {
|
|||
|
||||
composable(route = TesterScreen.BLOCKCHAIN_PROVIDERS.name) {
|
||||
val viewModel = hiltViewModel<BlockchainProvidersViewModel>().apply {
|
||||
setupNavigation(innerTesterRouter)
|
||||
setupNavigation(innerTesterRouter, appFinisher)
|
||||
}
|
||||
|
||||
val state by viewModel.state.collectAsStateWithLifecycle()
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ internal data class BlockchainProvidersUM(
|
|||
val topBar: TopBarWithRefreshUM,
|
||||
val searchBar: SearchBarUM,
|
||||
val blockchainProviders: ImmutableList<ProvidersUM>,
|
||||
val onRestartAppClick: () -> Unit,
|
||||
) {
|
||||
|
||||
@Immutable
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ import androidx.compose.ui.util.fastForEachIndexed
|
|||
import com.tangem.blockchain.common.network.providers.ProviderType
|
||||
import com.tangem.core.ui.components.AdditionalTextInputDialogUM
|
||||
import com.tangem.core.ui.components.DialogButtonUM
|
||||
import com.tangem.core.ui.components.PrimaryButton
|
||||
import com.tangem.core.ui.components.TextInputDialog
|
||||
import com.tangem.core.ui.components.fields.SearchBar
|
||||
import com.tangem.core.ui.components.fields.entity.SearchBarUM
|
||||
|
|
@ -59,7 +60,7 @@ internal fun BlockchainProvidersScreen(state: BlockchainProvidersUM) {
|
|||
.fillMaxSize()
|
||||
.background(TangemTheme.colors.background.primary),
|
||||
) {
|
||||
LazyColumn {
|
||||
LazyColumn(contentPadding = PaddingValues(bottom = 64.dp)) {
|
||||
stickyHeader {
|
||||
Header(topBar = state.topBar, searchBar = state.searchBar)
|
||||
}
|
||||
|
|
@ -85,6 +86,15 @@ internal fun BlockchainProvidersScreen(state: BlockchainProvidersUM) {
|
|||
itemContent = { BlockchainProvidersItem(it) },
|
||||
)
|
||||
}
|
||||
|
||||
PrimaryButton(
|
||||
text = stringResourceSafe(id = R.string.restart_app),
|
||||
onClick = state.onRestartAppClick,
|
||||
modifier = Modifier
|
||||
.align(Alignment.BottomCenter)
|
||||
.fillMaxWidth()
|
||||
.padding(TangemTheme.dimens.spacing16),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -427,6 +437,7 @@ private fun Preview_BlockchainProvidersScreen() {
|
|||
),
|
||||
),
|
||||
),
|
||||
onRestartAppClick = {},
|
||||
),
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import com.tangem.blockchain.common.Blockchain
|
|||
import com.tangem.blockchain.common.network.providers.ProviderType
|
||||
import com.tangem.blockchainsdk.providers.BlockchainProvidersTypesManager
|
||||
import com.tangem.blockchainsdk.providers.MutableBlockchainProvidersTypesManager
|
||||
import com.tangem.core.navigation.finisher.AppFinisher
|
||||
import com.tangem.core.ui.components.fields.entity.SearchBarUM
|
||||
import com.tangem.core.ui.extensions.resourceReference
|
||||
import com.tangem.feature.tester.impl.R
|
||||
|
|
@ -46,6 +47,7 @@ internal class BlockchainProvidersViewModel @Inject constructor(
|
|||
onActiveChange = {},
|
||||
),
|
||||
blockchainProviders = persistentListOf(),
|
||||
onRestartAppClick = {},
|
||||
),
|
||||
)
|
||||
|
||||
|
|
@ -57,10 +59,11 @@ internal class BlockchainProvidersViewModel @Inject constructor(
|
|||
subscribeOnBlockchainProviderTypesUpdates()
|
||||
}
|
||||
|
||||
fun setupNavigation(router: InnerTesterRouter) {
|
||||
fun setupNavigation(router: InnerTesterRouter, appFinisher: AppFinisher) {
|
||||
_state.update { state ->
|
||||
state.copy(
|
||||
topBar = state.topBar.copy(onBackClick = router::back),
|
||||
onRestartAppClick = appFinisher::restart,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -116,7 +119,7 @@ internal class BlockchainProvidersViewModel @Inject constructor(
|
|||
|
||||
private fun onRefreshClick() {
|
||||
viewModelScope.launch {
|
||||
manager.update()
|
||||
manager.recoverInitialState()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue