NTP-54386 | Sohan | Moved Kruz Proxy api call post auth. (#15919)

This commit is contained in:
Sohan Reddy Atukula
2025-04-25 16:40:51 +05:30
committed by GitHub
parent f2b62eb7a1
commit d873b5d1a0

View File

@@ -8,6 +8,7 @@
package com.naviapp.registration.usecase
import com.navi.analytics.utils.NaviTrackEvent
import com.navi.base.utils.BaseUtils
import com.navi.base.utils.coroutine.CoroutineManager
import com.navi.common.model.ModuleName
import com.navi.common.utils.deviceId
@@ -34,26 +35,30 @@ constructor(
fun initSdks(naeScreenName: String) {
CoroutineManager.scope.launchOnIO {
val response =
configRepository.fetchKruzConfig(
ModuleName.KRUZ_PROXY.name,
naeScreenName = naeScreenName,
)
if (BaseUtils.isUserLoggedIn()) {
val response =
configRepository.fetchKruzConfig(
ModuleName.KRUZ_PROXY.name,
naeScreenName = naeScreenName,
)
if (!response.isValidResponse()) {
trackError(response.error?.message.orEmpty())
return@launchOnIO
if (!response.isValidResponse()) {
trackError(response.error?.message.orEmpty())
return@launchOnIO
}
val data =
response.data
?: run {
trackError(MSG_RESPONSE_DATA_NULL)
return@launchOnIO
}
setupMqttIfEnabled(data)
setupFcmTopics(data.fcmTopics)
} else {
setupFcmTopics(null)
}
val data =
response.data
?: run {
trackError(MSG_RESPONSE_DATA_NULL)
return@launchOnIO
}
setupMqttIfEnabled(data)
setupFcmTopics(data.fcmTopics)
}
}
@@ -70,7 +75,7 @@ constructor(
MqttManager.init(
NaviApplication.instance,
MqttSdkInitParams(
username = BuildConfig.MQTT_USERNAME,
username = data.username ?: BuildConfig.MQTT_USERNAME,
password = BuildConfig.MQTT_PASSWORD,
clientId = deviceId,
brokerIP = data.brokerIP.orEmpty(),