NTP-69433 | Owais | add new upi id validation fix (#16661)
This commit is contained in:
@@ -174,6 +174,28 @@ class DigitalGoldSellUpiFragment :
|
||||
}
|
||||
widgetResponse.contentWidget?.let { listOfWidgets ->
|
||||
naviAdapter.setData(listOfWidgets)
|
||||
|
||||
for (widget in listOfWidgets) {
|
||||
if (
|
||||
widget is InputWidgetModel &&
|
||||
widget.widgetNameForBaseAdapter == "LABELED_TEXT_INPUT_WIDGET_V2"
|
||||
) {
|
||||
binding.rvItems.post {
|
||||
for (i in 0 until binding.rvItems.childCount) {
|
||||
val viewHolder =
|
||||
binding.rvItems.getChildViewHolder(
|
||||
binding.rvItems.getChildAt(i)
|
||||
)
|
||||
val itemView = viewHolder.itemView
|
||||
if (itemView is LabeledTextInputWidgetV2) {
|
||||
itemView.setValidateOnlyAfterAtSymbol(true)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
widgetResponse.extraData?.let { extraData ->
|
||||
extraData.screenName?.let { screenName ->
|
||||
|
||||
@@ -74,9 +74,13 @@ constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
|
||||
private const val ALPHA_SIXTY_PERCENT = 0.6f
|
||||
private const val ALPHA_FIFTY_PERCENT = 0.5f
|
||||
private const val ALPHA_HUNDRED_PERCENT = 1f
|
||||
private var validateOnlyAfterAtSymbol = false
|
||||
}
|
||||
|
||||
override fun updateData(inputWidgetModel: InputWidgetModel, widgetCallback: WidgetCallback?) {
|
||||
if (validateOnlyAfterAtSymbol) {
|
||||
setError(null)
|
||||
}
|
||||
super.updateData(inputWidgetModel, widgetCallback)
|
||||
this.widgetCallback = widgetCallback ?: EmptyWidgetCallback()
|
||||
this.widgetModel = inputWidgetModel as LabeledTextInputWidgetModelV2
|
||||
@@ -237,7 +241,9 @@ constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
|
||||
.textChanges()
|
||||
.debounce(widgetModel.widgetData?.validationDelay?.toLong() ?: QUERY_DELAY)
|
||||
.onEach { charSequence ->
|
||||
if (charSequence.toString().isNotNullAndNotEmpty()) {
|
||||
val skipValidation =
|
||||
validateOnlyAfterAtSymbol && !charSequence.toString().contains("@")
|
||||
if (charSequence.toString().isNotNullAndNotEmpty() && !skipValidation) {
|
||||
val resultText: String? = getUserInputPostValidation()
|
||||
if (resultText == false.toString()) {
|
||||
widgetBinding.cvVerify.apply {
|
||||
@@ -363,4 +369,8 @@ constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
|
||||
widgetCallback.widgetUserData(key = it, value = getUserInputPostValidation().toString())
|
||||
}
|
||||
}
|
||||
|
||||
fun setValidateOnlyAfterAtSymbol(enable: Boolean) {
|
||||
validateOnlyAfterAtSymbol = enable
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user