NTP-7163 | Added Metric info for common module apis (#14036)

This commit is contained in:
shankar yadav
2024-12-09 15:29:13 +05:30
committed by GitHub
parent 7eff0e29ef
commit 93297ca748
8 changed files with 76 additions and 20 deletions

View File

@@ -70,6 +70,7 @@ class DeeplinkManager(
private const val IS_UPI_DYNAMIC_DEEP_LINK = "isUpiDynamicDeeplink"
private const val NAVI_PAY_HOME_PAGE_URL = "naviPayHomePageUrl"
const val DEEPLINK_TYPE = "deeplinkType"
const val DEEPLINK_MANAGER = "DeeplinkManager"
}
fun handleDeeplinkData(

View File

@@ -7,6 +7,7 @@
package com.naviapp.analytics.deeplink
import com.navi.common.checkmate.model.MetricInfo
import com.navi.common.model.ModuleName
import com.naviapp.models.request.OnboardingRequest
import com.naviapp.network.retrofit.ResponseCallback
@@ -19,9 +20,21 @@ class DeeplinkRepository : ResponseCallback() {
suspend fun sendReferralData(referralAuditingRequestData: OnboardingRequest) =
apiResponseCallback(
superAppRetrofitService().getOnboardingAction(referralAuditingRequestData)
response = superAppRetrofitService().getOnboardingAction(referralAuditingRequestData),
metricInfo =
MetricInfo.CommonMetric(
screen = DeeplinkManager.DEEPLINK_MANAGER,
isNae = { false }
)
)
suspend fun fetchCta(deeplinkRequest: OnboardingRequest) =
apiResponseCallback(superAppRetrofitService().getOnboardingAction(deeplinkRequest))
apiResponseCallback(
response = superAppRetrofitService().getOnboardingAction(deeplinkRequest),
metricInfo =
MetricInfo.CommonMetric(
screen = DeeplinkManager.DEEPLINK_MANAGER,
isNae = { false }
)
)
}

View File

@@ -1392,7 +1392,10 @@ class HomePageActivity :
paymentVM.getPaymentDetail(requestId, amount, repaymentType)
}
PAYMENT_STATUS -> {
paymentVM.fetchPgRepyamentStatusDetail(requestId)
paymentVM.fetchPgRepyamentStatusDetail(
requestId = requestId,
screenName = screenName
)
}
}
}

View File

@@ -643,7 +643,10 @@ abstract class PaymentBaseFragment : BaseFragment(), PaymentClickListener, Payme
paymentVM.getPaymentDetail(requestId, amount, repaymentType)
}
PAYMENT_STATUS -> {
paymentVM.fetchPgRepyamentStatusDetail(requestId)
paymentVM.fetchPgRepyamentStatusDetail(
requestId = requestId,
screenName = screenName
)
}
}
}

View File

@@ -7,6 +7,7 @@
package com.naviapp.payment.repositories
import com.navi.base.utils.isNull
import com.navi.common.checkmate.model.MetricInfo
import com.navi.common.model.AsyncRequestData
import com.navi.common.model.InitiateRescheduleLoanAgreementGenerationRequest
@@ -46,8 +47,15 @@ class PaymentRepository @Inject constructor() : ResponseCallback() {
): RepoResult<UploadDataAsyncResponse> =
apiResponseCallback(retrofitService().postPgRepaymentStatus(loanAccountNumber, data))
suspend fun fetchAsyncRequestData(requestId: String): RepoResult<UploadDataAsyncResponse> =
apiResponseCallback(retrofitService().fetchAsyncRequestWithError(requestId))
suspend fun fetchAsyncRequestData(
requestId: String,
screenName: String
): RepoResult<UploadDataAsyncResponse> =
apiResponseCallback(
retrofitService().fetchAsyncRequestWithError(requestId),
metricInfo =
MetricInfo.PMSMetric(screen = screenName, isNae = { it.error.isNull().not() })
)
suspend fun fetchSyncPaymentStatus(requestId: String): RepoResult<UploadDataAsyncResponse> =
apiResponseCallback(retrofitService().fetchSyncPaymentStatus(requestId))

View File

@@ -186,9 +186,9 @@ class PaymentVM : BaseVM() {
}
}
fun fetchPgRepyamentStatusDetail(requestId: String) {
fun fetchPgRepyamentStatusDetail(requestId: String, screenName: String) {
coroutineScope.launch {
val response = repository.fetchAsyncRequestData(requestId)
val response = repository.fetchAsyncRequestData(requestId, screenName)
if (response.error == null) {
_paymentStatusData.value = response.data?.status
} else {

View File

@@ -10,7 +10,9 @@ package com.navi.chat.repositories
import com.navi.chat.models.request.NaviChatInitiateRequest
import com.navi.chat.models.request.NaviMarkConversationsReadRequest
import com.navi.chat.network.NaviChatApiInterface
import com.navi.chat.ui.fragments.NaviChatFragment
import com.navi.common.awsupload.AwsRepositoryInterface
import com.navi.common.checkmate.model.MetricInfo
import com.navi.common.network.retrofit.ResponseCallback
import java.util.UUID
import javax.inject.Inject
@@ -28,30 +30,51 @@ class NaviChatRepository @Inject constructor(private val chatApiInterface: NaviC
chatApiInterface.initiateChat(
naviChatInitiateRequest = naviChatInitiateRequest,
page = pageNo
)
),
metricInfo = MetricInfo.ChatMetric(screen = NaviChatFragment.TAG, isNae = { false })
)
suspend fun fetchChatConversations(conversationId: String, pageNo: Int) =
apiResponseCallback(
chatApiInterface.fetchChatConversations(conversationId = conversationId, page = pageNo)
chatApiInterface.fetchChatConversations(conversationId = conversationId, page = pageNo),
metricInfo = MetricInfo.ChatMetric(screen = NaviChatFragment.TAG, isNae = { false })
)
suspend fun getHelpCenterDetails() =
apiResponseCallback(chatApiInterface.getHelpCenterDetails())
apiResponseCallback(
chatApiInterface.getHelpCenterDetails(),
metricInfo = MetricInfo.ChatMetric(screen = NaviChatFragment.TAG, isNae = { false })
)
suspend fun getSupportScreenDetails(sourceScreenName: String) =
apiResponseCallback(chatApiInterface.getSupportScreenDetails(sourceScreenName))
apiResponseCallback(
chatApiInterface.getSupportScreenDetails(sourceScreenName),
metricInfo = MetricInfo.ChatMetric(screen = NaviChatFragment.TAG, isNae = { false })
)
suspend fun getConfig() = apiResponseCallback(chatApiInterface.getConfig())
suspend fun getConfig() =
apiResponseCallback(
chatApiInterface.getConfig(),
metricInfo = MetricInfo.ChatMetric(screen = NaviChatFragment.TAG, isNae = { false })
)
suspend fun generateUploadAWSPreSignedUrl(queryMap: HashMap<String, String>) =
apiResponseCallback(chatApiInterface.postUploadAWSPreSignedUrl(queryMap))
apiResponseCallback(
chatApiInterface.postUploadAWSPreSignedUrl(queryMap),
metricInfo = MetricInfo.ChatMetric(screen = NaviChatFragment.TAG, isNae = { false })
)
suspend fun checkIfActivityRedirectionIsValid(queryMap: HashMap<String, String>) =
apiResponseCallback(chatApiInterface.checkIfActivityRedirectionIsValid(queryMap))
apiResponseCallback(
chatApiInterface.checkIfActivityRedirectionIsValid(queryMap),
metricInfo = MetricInfo.ChatMetric(screen = NaviChatFragment.TAG, isNae = { false })
)
override suspend fun generateDownloadAWSPreSignedUrl(queryMap: HashMap<String, String>) =
apiResponseCallback(chatApiInterface.postDownloadAWSPreSignedUrl(queryMap))
apiResponseCallback(
chatApiInterface.postDownloadAWSPreSignedUrl(queryMap),
metricInfo = MetricInfo.ChatMetric(screen = NaviChatFragment.TAG, isNae = { false })
)
suspend fun uploadFile(
@Url url: String,
@@ -59,7 +82,8 @@ class NaviChatRepository @Inject constructor(private val chatApiInterface: NaviC
@Part file: MultipartBody.Part
) =
apiResponseCallback(
chatApiInterface.submitAWSData(url = url, awsPartMap = awsPartMap, file = file)
chatApiInterface.submitAWSData(url = url, awsPartMap = awsPartMap, file = file),
metricInfo = MetricInfo.ChatMetric(screen = NaviChatFragment.TAG, isNae = { false })
)
suspend fun updateReceipts(
@@ -79,11 +103,13 @@ class NaviChatRepository @Inject constructor(private val chatApiInterface: NaviC
readTimestamp = readTimestamp,
deliveredTimestamp = deliveredTimestamp
)
)
),
metricInfo = MetricInfo.ChatMetric(screen = NaviChatFragment.TAG, isNae = { false })
)
suspend fun fetchTicketDetails(pageNo: Int, pageSize: Int) =
apiResponseCallback(
chatApiInterface.fetchTicketDetails(pageNo = pageNo, pageSize = pageSize)
chatApiInterface.fetchTicketDetails(pageNo = pageNo, pageSize = pageSize),
metricInfo = MetricInfo.ChatMetric(screen = NaviChatFragment.TAG, isNae = { false })
)
}

View File

@@ -8,6 +8,7 @@
package com.navi.common.repo
import android.content.Context
import com.navi.common.checkmate.model.MetricInfo
import com.navi.common.model.PermissionVerticalType
import com.navi.common.model.SubmitPermissionRequestData
import com.navi.common.model.SubmitPermissionResponse
@@ -34,7 +35,8 @@ constructor(
verticalType = verticalType,
permissionList = getSubmitPermissionList(context)
)
)
),
metricInfo = MetricInfo.CommonMetric(screen = verticalType, isNae = { false })
)
}
}