NTP-27142 | Sohan Reddy | Added OE metric attributes to OffersRepo apis. (#14502)
This commit is contained in:
committed by
GitHub
parent
6ed07bafde
commit
d3d99af606
@@ -311,14 +311,26 @@ abstract class NaviBbpsBaseVM(open val naviBbpsVmData: NaviBbpsVmData) : BaseVM(
|
||||
tags = tags,
|
||||
attributes = attributes,
|
||||
requestId = requestId,
|
||||
metricInfo =
|
||||
MetricInfo.BBPSMetric(
|
||||
screen = naviBbpsVmData.screen.name,
|
||||
isNae = { false },
|
||||
),
|
||||
)
|
||||
.firstOrNull()
|
||||
}
|
||||
|
||||
val coinBurnDeferred = async {
|
||||
offersRepo.fetchCoinBurnOfferForProduct(product = product).firstOrNull {
|
||||
it.isSuccessWithData()
|
||||
}
|
||||
offersRepo
|
||||
.fetchCoinBurnOfferForProduct(
|
||||
product = product,
|
||||
metricInfo =
|
||||
MetricInfo.BBPSMetric(
|
||||
screen = naviBbpsVmData.screen.name,
|
||||
isNae = { false },
|
||||
),
|
||||
)
|
||||
.firstOrNull { it.isSuccessWithData() }
|
||||
}
|
||||
|
||||
// Await both responses
|
||||
@@ -354,7 +366,15 @@ abstract class NaviBbpsBaseVM(open val naviBbpsVmData: NaviBbpsVmData) : BaseVM(
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
try {
|
||||
offersRepo
|
||||
.fetchOffersForProductForMultipleRequests(product, offerRequestList)
|
||||
.fetchOffersForProductForMultipleRequests(
|
||||
product,
|
||||
offerRequestList,
|
||||
metricInfo =
|
||||
MetricInfo.BBPSMetric(
|
||||
screen = naviBbpsVmData.screen.name,
|
||||
isNae = { false },
|
||||
),
|
||||
)
|
||||
.collect { response ->
|
||||
if (response.isValidResponse()) {
|
||||
val mapper = OfferResponseToOfferDataMapper()
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
package com.navi.rr.common.repo
|
||||
|
||||
import com.navi.base.AppServiceManager
|
||||
import com.navi.common.checkmate.model.MetricInfo
|
||||
import com.navi.common.network.models.RepoResult
|
||||
import com.navi.common.utils.addKeyIfMissing
|
||||
import com.navi.rr.common.models.CoinBurnData
|
||||
@@ -36,29 +37,32 @@ constructor(
|
||||
tags: List<String>? = null,
|
||||
attributes: Map<String, Any>? = null,
|
||||
requestId: String? = null,
|
||||
metricInfo: MetricInfo<RepoResult<List<OfferResponse>>>,
|
||||
): Flow<RepoResult<List<OfferResponse>>> {
|
||||
return cacheHandlerProxy.fetchData<List<OfferResponse>>(
|
||||
fetchFromAlternativeSource = {
|
||||
responseHandler.handleResponse(
|
||||
retrofitService
|
||||
.fetchOffersForProduct(
|
||||
product = product,
|
||||
offerRequest =
|
||||
OfferRequest(
|
||||
tags = tags ?: listOf(ALL),
|
||||
attributes =
|
||||
attributes
|
||||
.addKeyIfMissing(
|
||||
APP_VERSION_CODE,
|
||||
AppServiceManager.appVersionCode,
|
||||
)
|
||||
.addKeyIfMissing(OS_TYPE, OFFERS_OS_TYPE_ANDROID),
|
||||
requestId = requestId,
|
||||
),
|
||||
offerType = ALL,
|
||||
strategy = CAMPAIGN_PRIORITY,
|
||||
)
|
||||
.toGenericResponse()
|
||||
response =
|
||||
retrofitService
|
||||
.fetchOffersForProduct(
|
||||
product = product,
|
||||
offerRequest =
|
||||
OfferRequest(
|
||||
tags = tags ?: listOf(ALL),
|
||||
attributes =
|
||||
attributes
|
||||
.addKeyIfMissing(
|
||||
APP_VERSION_CODE,
|
||||
AppServiceManager.appVersionCode,
|
||||
)
|
||||
.addKeyIfMissing(OS_TYPE, OFFERS_OS_TYPE_ANDROID),
|
||||
requestId = requestId,
|
||||
),
|
||||
offerType = ALL,
|
||||
strategy = CAMPAIGN_PRIORITY,
|
||||
)
|
||||
.toGenericResponse(),
|
||||
metricInfo = metricInfo,
|
||||
)
|
||||
}
|
||||
)
|
||||
@@ -69,28 +73,35 @@ constructor(
|
||||
offerRequestList: List<OfferRequest>? = emptyList(),
|
||||
offerType: String? = null,
|
||||
strategy: String? = null,
|
||||
metricInfo: MetricInfo<RepoResult<MultipleOffersResponse>>,
|
||||
): Flow<RepoResult<MultipleOffersResponse>> {
|
||||
return cacheHandlerProxy.fetchData<MultipleOffersResponse>(
|
||||
fetchFromAlternativeSource = {
|
||||
responseHandler.handleResponse(
|
||||
retrofitService
|
||||
.fetchOffersForProductsForMultipleRequests(
|
||||
product = product,
|
||||
offerRequest = offerRequestList ?: emptyList(),
|
||||
offerType = offerType ?: ALL,
|
||||
strategy = strategy ?: CAMPAIGN_PRIORITY,
|
||||
)
|
||||
.toGenericResponse()
|
||||
response =
|
||||
retrofitService
|
||||
.fetchOffersForProductsForMultipleRequests(
|
||||
product = product,
|
||||
offerRequest = offerRequestList ?: emptyList(),
|
||||
offerType = offerType ?: ALL,
|
||||
strategy = strategy ?: CAMPAIGN_PRIORITY,
|
||||
)
|
||||
.toGenericResponse(),
|
||||
metricInfo = metricInfo,
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
suspend fun fetchCoinBurnOfferForProduct(product: String): Flow<RepoResult<CoinBurnData>> {
|
||||
suspend fun fetchCoinBurnOfferForProduct(
|
||||
product: String,
|
||||
metricInfo: MetricInfo<RepoResult<CoinBurnData>>,
|
||||
): Flow<RepoResult<CoinBurnData>> {
|
||||
return cacheHandlerProxy.fetchData<CoinBurnData>(
|
||||
fetchFromAlternativeSource = {
|
||||
responseHandler.handleResponse(
|
||||
retrofitService.fetchCoinBurnOfferForProduct(product = product)
|
||||
response = retrofitService.fetchCoinBurnOfferForProduct(product = product),
|
||||
metricInfo = metricInfo,
|
||||
)
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user