diff --git a/features/address-book/impl/src/main/kotlin/com/tangem/features/addressbook/editcontact/model/EditContactModel.kt b/features/address-book/impl/src/main/kotlin/com/tangem/features/addressbook/editcontact/model/EditContactModel.kt index 6d4c27302b..51f5cd6ed1 100644 --- a/features/address-book/impl/src/main/kotlin/com/tangem/features/addressbook/editcontact/model/EditContactModel.kt +++ b/features/address-book/impl/src/main/kotlin/com/tangem/features/addressbook/editcontact/model/EditContactModel.kt @@ -459,6 +459,7 @@ internal class EditContactModel @Inject constructor( isEnabled = isEnabled, isLoading = isSaving, isColdWallet = selectedWallet.value is UserWallet.Cold, + isNewContact = params.contactId == null, ), ) } diff --git a/features/address-book/impl/src/main/kotlin/com/tangem/features/addressbook/editcontact/state/transformers/UpdateSaveButtonTransformer.kt b/features/address-book/impl/src/main/kotlin/com/tangem/features/addressbook/editcontact/state/transformers/UpdateSaveButtonTransformer.kt index 1949b41713..56c0380b37 100644 --- a/features/address-book/impl/src/main/kotlin/com/tangem/features/addressbook/editcontact/state/transformers/UpdateSaveButtonTransformer.kt +++ b/features/address-book/impl/src/main/kotlin/com/tangem/features/addressbook/editcontact/state/transformers/UpdateSaveButtonTransformer.kt @@ -1,15 +1,18 @@ package com.tangem.features.addressbook.editcontact.state.transformers import com.tangem.core.ui.ds.image.TangemIconUM +import com.tangem.core.ui.extensions.resourceReference import com.tangem.core.ui.res.generated.icons.Icons import com.tangem.core.ui.res.generated.icons.ic_logo_tangem_24 import com.tangem.features.addressbook.editcontact.ui.state.EditContactUM +import com.tangem.features.addressbook.impl.R import com.tangem.utils.transformer.Transformer internal class UpdateSaveButtonTransformer( private val isEnabled: Boolean, private val isLoading: Boolean, private val isColdWallet: Boolean, + private val isNewContact: Boolean, ) : Transformer { override fun transform(prevState: EditContactUM): EditContactUM { @@ -18,6 +21,11 @@ internal class UpdateSaveButtonTransformer( isEnabled = isEnabled, isLoading = isLoading, tangemIconUM = TangemIconUM.Icon(imageVector = Icons.ic_logo_tangem_24).takeIf { isColdWallet }, + text = if (isNewContact) { + resourceReference(R.string.address_book_add_address) + } else { + resourceReference(R.string.address_book_save_contact) + }, ), ) } diff --git a/features/address-book/impl/src/main/kotlin/com/tangem/features/addressbook/editcontact/ui/EditContactContent.kt b/features/address-book/impl/src/main/kotlin/com/tangem/features/addressbook/editcontact/ui/EditContactContent.kt index 8533712849..1ef9542af5 100644 --- a/features/address-book/impl/src/main/kotlin/com/tangem/features/addressbook/editcontact/ui/EditContactContent.kt +++ b/features/address-book/impl/src/main/kotlin/com/tangem/features/addressbook/editcontact/ui/EditContactContent.kt @@ -56,6 +56,7 @@ import kotlinx.collections.immutable.toImmutableList @Composable internal fun EditContactContent(state: EditContactUM, modifier: Modifier = Modifier) { + val density = LocalDensity.current Box( modifier = modifier .fillMaxSize() @@ -63,8 +64,9 @@ internal fun EditContactContent(state: EditContactUM, modifier: Modifier = Modif ) { var topBarHeightPx by remember { mutableIntStateOf(0) } var saveButtonHeightPx by remember { mutableIntStateOf(0) } - val topBarHeight = with(LocalDensity.current) { topBarHeightPx.toDp() } - val saveButtonHeight = with(LocalDensity.current) { saveButtonHeightPx.toDp() } + val topBarHeight = with(density) { topBarHeightPx.toDp() } + val saveButtonHeight = with(density) { saveButtonHeightPx.toDp() } + val bottomNavHeight = with(density) { WindowInsets.navigationBars.getBottom(this).toDp() } Column( modifier = Modifier @@ -74,7 +76,7 @@ internal fun EditContactContent(state: EditContactUM, modifier: Modifier = Modif .imePadding() .verticalScroll(rememberScrollState()) .padding(horizontal = 16.dp) - .padding(top = topBarHeight + 12.dp, bottom = saveButtonHeight + 12.dp), + .padding(top = topBarHeight + 12.dp, bottom = saveButtonHeight + 12.dp + bottomNavHeight), verticalArrangement = Arrangement.spacedBy(16.dp), ) { ContactSummary(state = state)