Updated on 2026-08-14

This commit is contained in:
Tangem 2026-07-29 13:45:09 +01:00
parent 6aec7efdd6
commit 21eee91053
6 changed files with 149 additions and 8 deletions

View file

@ -74,10 +74,18 @@ internal class AddressBookChildFactory @Inject constructor(
)
}
/** Builds the address attached up-front in WithContactCreation mode, when both the address and network are known. */
/**
* Builds the address attached up-front in WithContactCreation mode, when both the address and network are known.
* The memo rides along when one was provided; `ContactAddressEntriesConverter` drops it on save if the network has
* no transaction extras.
*/
private fun buildPredefinedAddress(route: AddressBookRoute.EditContact): ValidatedAddress? {
val address = route.predefinedAddress ?: return null
val networkId = route.predefinedNetworkId ?: return null
return ValidatedAddress(address = address, networkIds = persistentListOf(networkId))
return ValidatedAddress(
address = address,
networkIds = persistentListOf(networkId),
memo = route.predefinedMemo,
)
}
}

View file

@ -139,6 +139,7 @@ internal class DefaultAddressBookComponent @AssistedInject constructor(
AddressBookRoute.EditContact(
predefinedAddress = mode.address,
predefinedNetworkId = mode.networkId,
predefinedMemo = mode.memo,
),
)
}

View file

@ -16,15 +16,17 @@ internal sealed class AddressBookRoute {
/**
* if [contactId] is not null we should fetch existing contact.
*
* [predefinedAddress] and [predefinedNetworkId] are set only when the feature is opened in
* [predefinedAddress], [predefinedNetworkId] and [predefinedMemo] are set only when the feature is opened in
* [com.tangem.common.routing.entity.AddressBookOpenMode.WithContactCreation] mode the address and its
* network are already known, so the new contact is opened with that address already attached.
* network are already known, so the new contact is opened with that address already attached. [predefinedMemo]
* stays null when the network has no transaction extras or no memo was entered.
*/
@Serializable
data class EditContact(
val contactId: String? = null,
val predefinedAddress: String? = null,
val predefinedNetworkId: String? = null,
val predefinedMemo: String? = null,
) : AddressBookRoute()
/**