diff --git a/app/src/main/java/com/tangem/tap/features/send/redux/reducers/TransactionExtrasReducer.kt b/app/src/main/java/com/tangem/tap/features/send/redux/reducers/TransactionExtrasReducer.kt
index 7688e47496..ed44869f90 100644
--- a/app/src/main/java/com/tangem/tap/features/send/redux/reducers/TransactionExtrasReducer.kt
+++ b/app/src/main/java/com/tangem/tap/features/send/redux/reducers/TransactionExtrasReducer.kt
@@ -68,7 +68,8 @@ class TransactionExtrasReducer : SendInternalReducer {
// }
is XlmMemo.HandleUserInput -> {
val inputViewValue = InputViewValue(action.data, true)
- var memo = infoState.xlmMemo?.copy(viewFieldValue = inputViewValue) ?: XlmMemoState(inputViewValue)
+ var memo = infoState.xlmMemo?.copy(viewFieldValue = inputViewValue)
+ ?: XlmMemoState(inputViewValue)
memo = clearMemo(memo)
memo = when (infoState.xlmMemo?.selectedMemoType) {
XlmMemoType.TEXT -> memo.copy(text = StellarMemo.Text(action.data))
@@ -93,7 +94,12 @@ class TransactionExtrasReducer : SendInternalReducer {
is XrpDestinationTag.HandleUserInput -> {
val tag = action.data.toLongOrNull()
if (tag != null) {
- val tagState = XrpDestinationTagState(InputViewValue(action.data, true), tag)
+ val input = InputViewValue(action.data, true)
+ val tagState = if (tag <= XrpDestinationTagState.MAX_NUMBER){
+ XrpDestinationTagState(input, tag)
+ } else {
+ XrpDestinationTagState(input, error = XrpDestinationTagError.INVALID_TAG)
+ }
infoState.copy(xrpDestinationTag = tagState)
} else {
infoState
diff --git a/app/src/main/java/com/tangem/tap/features/send/redux/states/AddressPayIdState.kt b/app/src/main/java/com/tangem/tap/features/send/redux/states/AddressPayIdState.kt
index 68ead3b454..877f277ab3 100644
--- a/app/src/main/java/com/tangem/tap/features/send/redux/states/AddressPayIdState.kt
+++ b/app/src/main/java/com/tangem/tap/features/send/redux/states/AddressPayIdState.kt
@@ -50,5 +50,14 @@ data class XlmMemoState(
// tag must contains only digits
data class XrpDestinationTagState(
val viewFieldValue: InputViewValue = InputViewValue(""),
- val tag: Long? = null
-)
\ No newline at end of file
+ val tag: Long? = null,
+ val error: XrpDestinationTagError? = null
+) {
+ companion object {
+ const val MAX_NUMBER: Long = 4294967295
+ }
+}
+
+enum class XrpDestinationTagError {
+ INVALID_TAG
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/tangem/tap/features/send/ui/stateSubscribers/SendStateSubscriber.kt b/app/src/main/java/com/tangem/tap/features/send/ui/stateSubscribers/SendStateSubscriber.kt
index 6d13047f73..0578e51cf2 100644
--- a/app/src/main/java/com/tangem/tap/features/send/ui/stateSubscribers/SendStateSubscriber.kt
+++ b/app/src/main/java/com/tangem/tap/features/send/ui/stateSubscribers/SendStateSubscriber.kt
@@ -72,7 +72,16 @@ class SendStateSubscriber(fragment: BaseStoreFragment) : FragmentStateSubscriber
if (!it.viewFieldValue.isFromUserInput) fg.etMemo.setText(it.viewFieldValue.value)
}
infoState.xrpDestinationTag?.let {
- if (!it.viewFieldValue.isFromUserInput) fg.etDestinationTag.setText(it.viewFieldValue.value)
+ if (infoState.xrpDestinationTag.error != null) {
+ if (infoState.xrpDestinationTag.error == XrpDestinationTagError.INVALID_TAG) {
+ fg.tilDestinationTag.error = fg.getText(R.string.send_error_invalid_destination_tag)
+ }
+ } else {
+ fg.tilDestinationTag.error = null
+ }
+ if (!it.viewFieldValue.isFromUserInput) {
+ fg.etDestinationTag.setText(it.viewFieldValue.value)
+ }
}
}
diff --git a/app/src/main/res/values/strings_untranslated.xml b/app/src/main/res/values/strings_untranslated.xml
index ea6b9f43bf..a93def7b54 100644
--- a/app/src/main/res/values/strings_untranslated.xml
+++ b/app/src/main/res/values/strings_untranslated.xml
@@ -35,5 +35,7 @@ this wallet.
Memo
Destination tag
+ Invalid destination tag. It won\'t be added to the transaction
+