NTP-55511 | PS | event bus fix (#15767)
This commit is contained in:
@@ -32,7 +32,6 @@ import com.navi.payment.nativepayment.router.NaviPaymentRouter
|
||||
import com.navi.payment.nativepayment.screens.NaviPaymentMainScreen
|
||||
import com.navi.payment.nativepayment.usecase.ModuleInstaller
|
||||
import com.navi.payment.nativepayment.utils.NaviPaymentEventHandler
|
||||
import com.navi.payment.nativepayment.utils.NaviPaymentsEventBus
|
||||
import com.navi.payment.nativepayment.viewmodel.NaviPaymentViewModel
|
||||
import com.navi.payment.utils.Constants.NATIVE_PAYMENT_SCREEN
|
||||
import com.navi.payment.utils.screenEnterTransition
|
||||
@@ -132,7 +131,7 @@ class NaviPaymentActivity : BaseActivity(), IPaymentExternalSdk by PaymentExtern
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
NaviPaymentsEventBus.getInstance().resetEventBus()
|
||||
eventHandler.naviPaymentsEventBus.resetEventBus()
|
||||
super.onDestroy()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,9 +14,7 @@ import javax.inject.Inject
|
||||
import kotlinx.coroutines.flow.filterIsInstance
|
||||
|
||||
@ActivityRetainedScoped
|
||||
class NaviPaymentEventHandler
|
||||
@Inject
|
||||
constructor(private val naviPaymentsEventBus: NaviPaymentsEventBus) {
|
||||
class NaviPaymentEventHandler @Inject constructor(val naviPaymentsEventBus: NaviPaymentsEventBus) {
|
||||
|
||||
suspend fun postErrorEvent(errorConfig: NaviPaymentErrorConfig) {
|
||||
postBottomSheetVisibilityEvent(
|
||||
|
||||
@@ -26,13 +26,4 @@ class NaviPaymentsEventBus @Inject constructor() {
|
||||
suspend fun triggerEvent(event: Any) {
|
||||
_events.emit(event)
|
||||
}
|
||||
|
||||
companion object {
|
||||
@Volatile private var instance: NaviPaymentsEventBus? = null
|
||||
|
||||
fun getInstance(): NaviPaymentsEventBus {
|
||||
return instance
|
||||
?: synchronized(this) { instance ?: NaviPaymentsEventBus().also { instance = it } }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,7 +81,6 @@ import com.navi.payment.nativepayment.usecase.PmsSendMoneyUseCase
|
||||
import com.navi.payment.nativepayment.utils.MPSScreenUtils
|
||||
import com.navi.payment.nativepayment.utils.NaviPaymentErrorConfig
|
||||
import com.navi.payment.nativepayment.utils.NaviPaymentRewardsEventBus
|
||||
import com.navi.payment.nativepayment.utils.NaviPaymentsEventBus
|
||||
import com.navi.payment.nativepayment.utils.PaymentCancelSource
|
||||
import com.navi.payment.nativepayment.utils.PaymentRewardsEvent
|
||||
import com.navi.payment.nativepayment.utils.getDiscountAdjustedAmount
|
||||
@@ -374,7 +373,7 @@ constructor(
|
||||
eventHandler.get().sendMoneyErrorEvent.collectLatest { event ->
|
||||
if (event.sourceDestination == NaviPaymentScreenType.MINI_PAYMENT_SCREEN.name) {
|
||||
isDismissAllowed = false
|
||||
NaviPaymentsEventBus.getInstance().resetEventBus()
|
||||
eventHandler.get().naviPaymentsEventBus.resetEventBus()
|
||||
val errorCode = event.response.errors?.firstOrNull()?.code.orEmpty()
|
||||
val errorBucket =
|
||||
paymentErrorHelper.getErrorBucket(
|
||||
|
||||
@@ -103,7 +103,6 @@ import com.navi.payment.nativepayment.usecase.NetBankingUseCase
|
||||
import com.navi.payment.nativepayment.usecase.PmsLinkedAccountUseCase
|
||||
import com.navi.payment.nativepayment.usecase.PmsSendMoneyUseCase
|
||||
import com.navi.payment.nativepayment.utils.NaviPaymentRewardsEventBus
|
||||
import com.navi.payment.nativepayment.utils.NaviPaymentsEventBus
|
||||
import com.navi.payment.nativepayment.utils.PaymentRewardsEvent
|
||||
import com.navi.payment.nativepayment.utils.getDiscountAdjustedAmount
|
||||
import com.navi.payment.nativepayment.utils.getEligibilityStateForUpiLiteAccount
|
||||
@@ -332,7 +331,7 @@ constructor(
|
||||
private suspend fun sendMoneyErrorListener() {
|
||||
eventHandler.get().sendMoneyErrorEvent.collectLatest { event ->
|
||||
if (event.sourceDestination == NaviPaymentScreenType.FULL_PAYMENT_SCREEN.name) {
|
||||
NaviPaymentsEventBus.getInstance().resetEventBus()
|
||||
eventHandler.get().naviPaymentsEventBus.resetEventBus()
|
||||
val errorCode = event.response.errors?.firstOrNull()?.code.orEmpty()
|
||||
val errorBucket =
|
||||
paymentErrorHelper.getErrorBucket(
|
||||
|
||||
@@ -54,7 +54,6 @@ import com.navi.payment.nativepayment.model.transactionStatusRequest.Transaction
|
||||
import com.navi.payment.nativepayment.model.transactionStatusRequest.TransactionStatusRequest
|
||||
import com.navi.payment.nativepayment.repository.PaymentRepository
|
||||
import com.navi.payment.nativepayment.usecase.PmsSendMoneyUseCase
|
||||
import com.navi.payment.nativepayment.utils.NaviPaymentsEventBus
|
||||
import com.navi.payment.nativepayment.utils.PaymentCancelSource
|
||||
import com.navi.payment.nativepayment.utils.toGenericErrorResponse
|
||||
import com.navi.payment.nativepayment.utils.toPaymentNaviPaymentErrorConfig
|
||||
@@ -144,7 +143,7 @@ constructor(
|
||||
private suspend fun sendMoneyErrorListener() {
|
||||
eventHandler.get().sendMoneyErrorEvent.collectLatest { event ->
|
||||
if (event.sourceDestination == NaviPaymentScreenType.ONE_CLICK_CHECKOUT_SCREEN.name) {
|
||||
NaviPaymentsEventBus.getInstance().resetEventBus()
|
||||
eventHandler.get().naviPaymentsEventBus.resetEventBus()
|
||||
val errorCode = event.response.errors?.firstOrNull()?.code.orEmpty()
|
||||
val errorBucket =
|
||||
paymentErrorHelper.getErrorBucket(
|
||||
|
||||
Reference in New Issue
Block a user