Updated on 2026-08-14
This commit is contained in:
parent
cf28f21151
commit
5a54002bd6
3 changed files with 14 additions and 3 deletions
|
|
@ -459,6 +459,7 @@ internal class EditContactModel @Inject constructor(
|
|||
isEnabled = isEnabled,
|
||||
isLoading = isSaving,
|
||||
isColdWallet = selectedWallet.value is UserWallet.Cold,
|
||||
isNewContact = params.contactId == null,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<EditContactUM> {
|
||||
|
||||
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)
|
||||
},
|
||||
),
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue