Updated on 2026-08-14

This commit is contained in:
Tangem 2025-07-07 14:49:17 +05:00
parent 776d00eb57
commit a352aea4d2
4 changed files with 23 additions and 2 deletions

View file

@ -65,8 +65,12 @@ internal fun QrScanningContent(
TangemTopAppBar(
modifier = Modifier.statusBarsPadding(),
title = null,
startButton = TopAppBarButtonUM.Back(uiState.onBackClick),
title = uiState.topBarConfig.title?.resolveReference(),
startButton = TopAppBarButtonUM(
iconRes = uiState.topBarConfig.startIcon,
onIconClicked = uiState.onBackClick,
),
textColor = TangemTheme.colors.text.constantWhite,
iconTint = TangemColorPalette.White,
containerColor = Color.Transparent,
endContent = {

View file

@ -1,11 +1,13 @@
package com.tangem.feature.qrscanning.presentation
import androidx.annotation.DrawableRes
import androidx.compose.runtime.Immutable
import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfig
import com.tangem.core.ui.extensions.TextReference
@Immutable
internal data class QrScanningState(
val topBarConfig: TopBarConfig,
val message: TextReference?,
val onQrScanned: (String) -> Unit,
val onBackClick: () -> Unit,
@ -14,6 +16,8 @@ internal data class QrScanningState(
val bottomSheetConfig: TangemBottomSheetConfig? = null,
)
internal data class TopBarConfig(val title: TextReference?, @DrawableRes val startIcon: Int)
@Immutable
internal sealed interface PasteAction {
data object None : PasteAction

View file

@ -26,6 +26,7 @@ internal class QrScanningStateController @Inject constructor() {
private fun getInitialState(): QrScanningState {
return QrScanningState(
topBarConfig = TopBarConfig(title = null, startIcon = 0),
message = null,
onBackClick = {},
onQrScanned = {},

View file

@ -9,6 +9,7 @@ import com.tangem.feature.qrscanning.impl.R
import com.tangem.feature.qrscanning.model.QrScanningClickIntents
import com.tangem.feature.qrscanning.presentation.PasteAction
import com.tangem.feature.qrscanning.presentation.QrScanningState
import com.tangem.feature.qrscanning.presentation.TopBarConfig
private const val WC_SCHEME = "wc"
@ -26,6 +27,7 @@ internal class InitializeQrScanningStateTransformer(
}
return QrScanningState(
topBarConfig = constructTopBarConfig(),
message = message,
onBackClick = clickIntents::onBackClick,
onQrScanned = clickIntents::onQrScanned,
@ -34,6 +36,16 @@ internal class InitializeQrScanningStateTransformer(
)
}
private fun constructTopBarConfig(): TopBarConfig {
return when (source) {
SourceType.SEND -> TopBarConfig(title = null, startIcon = R.drawable.ic_back_24)
SourceType.WALLET_CONNECT -> TopBarConfig(
title = resourceReference(R.string.wc_new_connection),
startIcon = R.drawable.ic_close_24,
)
}
}
private fun constructPasteAction(): PasteAction {
val uri = clipboardManager.getText()
return if (source == SourceType.WALLET_CONNECT && uri != null && isWalletConnectUri(uri)) {