TP -35857 | Instant refund ay (#7375)

* TP-35857 | instant refunds

* TP-35857 | fixed flickering issue and the order status issue

* TP-35857 | resolved conflicts
This commit is contained in:
Ashutosh Y
2023-08-02 14:31:08 +05:30
committed by GitHub
parent 1189b91805
commit 858cdc33fd
6 changed files with 75 additions and 7 deletions

View File

@@ -1,8 +1,10 @@
package com.navi.amc.common.fragment
import android.content.Context
import android.graphics.Rect
import android.os.Bundle
import android.view.LayoutInflater
import android.view.TouchDelegate
import android.view.View
import android.view.ViewGroup
import androidx.core.view.isVisible
@@ -27,8 +29,10 @@ import com.navi.amc.utils.AmcAnalytics.AMC_PAYMENT_TOKEN_RECEIVED
import com.navi.amc.utils.AmcAnalytics.ORDER_STATUS_SCREEN
import com.navi.amc.utils.AmcAnalytics.SCREEN_NAME
import com.navi.amc.utils.Constant.DATA
import com.navi.amc.utils.Constant.HELP_BOTTOMSHEET
import com.navi.amc.utils.Constant.INIT_REFUND
import com.navi.amc.utils.Constant.ORDER_ID
import com.navi.amc.utils.Constant.SHOW_BOTTOMSHEET
import com.navi.amc.utils.Constant.THOUSAND
import com.navi.amc.utils.Constant.THREE
import com.navi.base.model.ActionData
@@ -45,6 +49,7 @@ import com.navi.common.firebasedb.FirebaseStatusType
import com.navi.common.listeners.FragmentInterchangeListener
import com.navi.common.listeners.HeaderInteractionListener
import com.navi.common.listeners.NewBottomSheetListener
import com.navi.common.model.HelpBottomSheetData
import com.navi.common.model.UploadDataAsyncResponse
import com.navi.common.utils.ApiPollScheduler
import com.navi.common.utils.CommonUtils.toMap
@@ -132,7 +137,7 @@ class OrderStatusFragment : AmcBaseFragment(), FooterInteractionListener, BackLi
response = it
}
timeline.setProperties(it.orderStatus, this@OrderStatusFragment)
statusNote.setProperties(it.statusNote)
statusNote.setProperties(it.statusNote, textListener = ::textListener)
note.setProperties(it.note)
it.toastMessage?.let { toast ->
com.navi.naviwidgets.utils.showToastMessage(context, toast)
@@ -156,6 +161,8 @@ class OrderStatusFragment : AmcBaseFragment(), FooterInteractionListener, BackLi
learnMoreNote.icon.setOnClickListener { view ->
handleOnClick(note.actionText?.action)
}
} ?: run {
binding.learnMoreNoteData = null
}
}
viewModel.isBackAllowed = it.content?.exitBottomSheetData.isNull() && it.content?.exitBottomSheetCta.isNull()
@@ -245,6 +252,20 @@ class OrderStatusFragment : AmcBaseFragment(), FooterInteractionListener, BackLi
}
}
private fun textListener(action: ActionData) {
if (action.url?.contains(SHOW_BOTTOMSHEET).orFalse()) {
val data = action.parameters?.getOrNull(0)
val key = data?.key
val value = data?.value
if (action.url == SHOW_BOTTOMSHEET) {
if (key == HELP_BOTTOMSHEET) {
val bottomSheetData = Gson().fromJson(value, HelpBottomSheetData::class.java)
headerInteractionListener?.onHelpClick(bottomSheetData)
}
}
}
}
private fun onPollingResponse(response: UploadDataAsyncResponse?) {
if (response?.status.isNullOrEmpty()) {
apiPollScheduler?.stopApiPoll()

View File

@@ -29,7 +29,11 @@ class InformationView(context: Context, attributeSet: AttributeSet? = null) :
layoutParams = LayoutParams(MATCH_PARENT, WRAP_CONTENT)
}
fun setProperties(data: InformationCardData?, action: ((ActionData) -> Unit)? = null) {
fun setProperties(
data: InformationCardData?,
action: ((ActionData) -> Unit)? = null,
textListener: ((ActionData) -> Unit)? = null
) {
if (data == null) {
isVisible = false
return
@@ -50,7 +54,7 @@ class InformationView(context: Context, attributeSet: AttributeSet? = null) :
isVisible = false
}
title.setSpannableString(data.title)
subTitle.setSpannableString(data.subtitle)
subTitle.setSpannableString(data.subtitle, textListener)
actionText.setSpannableString(data.actionText?.title)
actionText.setOnClickListener {
data.actionText?.action?.let { it -> action?.invoke(it) }

View File

@@ -139,5 +139,6 @@ object Constant {
const val THREE = 3
const val INVESTMENT_TYPE = "investment_type"
const val NUDGE_BOTTOMSHEET = "NUDGE_BOTTOMSHEET"
const val HELP_BOTTOMSHEET="helpBottomSheet"
const val INDIA_TIMEZONE = "UTC+05:30"
}

View File

@@ -672,6 +672,7 @@ object NaviWidgetIconUtils {
private const val OUTLINED_INFO_ICON_BLACK_LARGE = "OUTLINED_INFO_ICON_BLACK_LARGE"
private const val DOWNTIME_ICON_IMAGE = "DOWNTIME_ICON_IMAGE"
private const val GREEN_CHECK_MARK_24 = "GREEN_CHECK_MARK_24"
private const val REFUND_ICON = "REFUND_ICON"
private const val ICON_FINSERV_LOGO_PURPLE = "ICON_FINSERV_LOGO_PURPLE"
private const val ICON_HOME_BLACK = "ICON_HOME_BLACK"
@@ -1374,6 +1375,7 @@ object NaviWidgetIconUtils {
RIGHT_ARROW_WITH_YELLOW_CIRCLE_BG -> R.drawable.right_arrow_with_yellow_circle_bg
DOWNTIME_ICON_IMAGE -> R.drawable.down_time_icon
GREEN_CHECK_MARK_24 -> R.drawable.ic_check_mark_24
REFUND_ICON -> R.drawable.refund
ICON_FINSERV_LOGO_PURPLE -> R.drawable.finserv_logo_purple
ICON_HOME_BLACK -> R.drawable.ic_home_black
else -> -1

View File

@@ -9,12 +9,16 @@ package com.navi.naviwidgets.views
import android.content.Context
import android.graphics.Color
import android.os.Build
import android.util.AttributeSet
import android.view.LayoutInflater
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.databinding.DataBindingUtil
import com.navi.base.model.ActionData
import com.navi.design.textview.model.TextWithStyle
import com.navi.design.utils.dpToPxInInt
import com.navi.design.utils.getNaviDrawable
import com.navi.design.utils.parseColorSafe
import com.navi.design.utils.setSpannableString
import com.navi.naviwidgets.R
import com.navi.naviwidgets.callbacks.WidgetCallback
@@ -42,11 +46,18 @@ class ButtonViewLayout(context: Context, attributeSet: AttributeSet) :
binding.title.text = actionData?.title
binding.title.setTextColor(Color.parseColor(actionData?.titleColor))
}
post {
val radius = binding.rootLayout.height / 2.0
binding.rootLayout.setCornerRadius(radius)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
binding.rootLayout.background = getNaviDrawable(
cornerRadius = dpToPxInInt(24),
backgroundColor = actionData?.bgColor?.parseColorSafe()
)
} else {
post {
val radius = binding.rootLayout.height / 2.0
binding.rootLayout.setCornerRadius(radius)
binding.rootLayout.setBackgroundColor(actionData?.bgColor.parseColorSafe())
}
}
binding.rootLayout.setBackgroundColor(Color.parseColor(actionData?.bgColor))
binding.icon.showWhenDataIsAvailable(actionData?.imageUrl)
binding.lottie.showWhenDataIsAvailable(actionData?.lottieCode)
if (widgetCallback != null) {

View File

@@ -0,0 +1,29 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="32dp"
android:height="32dp"
android:viewportWidth="32"
android:viewportHeight="32">
<path
android:pathData="M4,0L28,0A4,4 0,0 1,32 4L32,28A4,4 0,0 1,28 32L4,32A4,4 0,0 1,0 28L0,4A4,4 0,0 1,4 0z"
android:fillColor="#ffffff"/>
<group>
<clip-path
android:pathData="M6,6h20v20h-20z"/>
<path
android:pathData="M6.963,18.143C7.465,20.261 8.697,22.136 10.441,23.439C12.185,24.742 14.332,25.39 16.506,25.271C18.68,25.152 20.743,24.273 22.335,22.787C23.926,21.301 24.945,19.303 25.213,17.142C25.481,14.981 24.981,12.795 23.801,10.965C22.62,9.136 20.834,7.779 18.755,7.133C16.676,6.486 14.436,6.591 12.426,7.428C10.417,8.266 8.765,9.783 7.76,11.714"
android:strokeWidth="1.42857"
android:fillColor="#00000000"
android:strokeColor="#1F002A"
android:strokeLineCap="round"/>
<path
android:pathData="M6.714,8.857V12.429H10.286"
android:strokeLineJoin="round"
android:strokeWidth="1.42857"
android:fillColor="#00000000"
android:strokeColor="#1F002A"
android:strokeLineCap="round"/>
<path
android:pathData="M18.192,21.6C17.99,21.6 17.802,21.498 17.692,21.329L15.537,18.034H13.583C13.261,18.034 13,17.773 13,17.451C13,17.129 13.261,16.869 13.583,16.869H15.88C17.114,16.869 17.869,16.32 18.074,15.566H13.549C13.246,15.566 13,15.32 13,15.017C13,14.714 13.246,14.469 13.549,14.469H18.074C17.869,13.714 17.114,13.166 15.88,13.166H13.571C13.256,13.166 13,12.91 13,12.595C13,12.266 13.266,12 13.595,12H19.848C20.156,12 20.406,12.25 20.406,12.557C20.406,12.893 20.133,13.166 19.798,13.166H18.691C19.034,13.509 19.24,13.989 19.309,14.469H19.857C20.16,14.469 20.406,14.714 20.406,15.017C20.406,15.32 20.16,15.566 19.857,15.566H19.309C19.103,16.731 18.211,17.623 16.84,17.897L18.689,20.671C18.954,21.068 18.669,21.6 18.192,21.6Z"
android:fillColor="#1F002A"/>
</group>
</vector>