NTP-1224 | AS | Fix for CommonLibManager.baseUrl null for PaymentNetw… (#11993)

This commit is contained in:
Ayushman Sharma
2024-08-05 01:08:01 +05:30
committed by GitHub
parent 58c0ae691c
commit d7fe717dea
2 changed files with 14 additions and 2 deletions

View File

@@ -1,6 +1,6 @@
/*
*
* * Copyright © 2021-2023 by Navi Technologies Limited
* * Copyright © 2021-2024 by Navi Technologies Limited
* * All rights reserved. Strictly confidential
*
*/
@@ -138,4 +138,8 @@ object CommonLibManager {
fun getHeaderInterceptorForReact(): Interceptor {
return reactHeaderInterceptor
}
fun isBaseUrlInitialized(): Boolean {
return this::baseUrl.isInitialized
}
}

View File

@@ -9,6 +9,7 @@ package com.navi.payment.network.di
import com.google.gson.Gson
import com.google.gson.GsonBuilder
import com.navi.base.utils.BaseUtils
import com.navi.common.CommonLibManager
import com.navi.common.model.ModuleNameV2
import com.navi.common.network.converter.EmptyBodyHandlingConverterFactory
@@ -134,8 +135,15 @@ object PaymentNetworkModule {
* Dynamic Feature module doesn't allow Hilt
*/
fun getPaymentRetrofitService(): RetrofitService {
val updatedBaseUrl =
if (CommonLibManager.isBaseUrlInitialized()) {
CommonLibManager.baseUrl
} else {
BaseUtils.getUpdatedBaseUrl()
}
return Retrofit.Builder()
.baseUrl(CommonLibManager.baseUrl)
.baseUrl(updatedBaseUrl)
.addConverterFactory(
EmptyBodyHandlingConverterFactory(ModuleNameV2.NAVI_PAYMENT_SCREEN.name)
)