TP-71295| Sidharth Bamba | events updated and retry to mmi incase of … (#11804)
This commit is contained in:
@@ -17,7 +17,7 @@ import com.navi.common.geocoding.model.DeviceLocation
|
||||
import com.navi.common.geocoding.model.network.GeocodingRequest
|
||||
import com.navi.common.network.models.isSuccessWithData
|
||||
import com.navi.common.utils.CommonNaviAnalytics
|
||||
import com.navi.common.utils.Constants.SOURCE_NATIVE_API
|
||||
import com.navi.common.utils.Constants.SOURCE_ANDROID_GEOCODER_API
|
||||
import com.navi.common.utils.Constants.SOURCE_NETWORK
|
||||
import com.navi.common.utils.MqttEventBus
|
||||
import java.math.RoundingMode
|
||||
@@ -54,20 +54,24 @@ class FetchGeocodingUseCase(
|
||||
|
||||
val deviceLocation =
|
||||
if (FirebaseRemoteConfigHelper.getBoolean(NATIVE_GEOLOCATION_ENABLED)) {
|
||||
geocodingEventTracker.sourceOfLocation(source = SOURCE_NATIVE_API)
|
||||
getDeviceLocationFromGeocoderApi(
|
||||
latitude = latitude,
|
||||
longitude = longitude,
|
||||
geocoder = geocoder
|
||||
)
|
||||
var deviceLocation =
|
||||
getDeviceLocationFromGeocoderApi(
|
||||
latitude = latitude,
|
||||
longitude = longitude,
|
||||
geocoder = geocoder
|
||||
)
|
||||
if (deviceLocation == null || deviceLocation.state.isBlank()) {
|
||||
deviceLocation = getDeviceLocationFromNetwork(latitude, longitude)
|
||||
}
|
||||
deviceLocation
|
||||
} else {
|
||||
geocodingEventTracker.sourceOfLocation(source = SOURCE_NETWORK)
|
||||
getDeviceLocationFromNetwork(latitude, longitude)
|
||||
}
|
||||
|
||||
geocodingEventTracker.onLocationFetched(
|
||||
deviceLocation = deviceLocation ?: DeviceLocation()
|
||||
)
|
||||
|
||||
deviceLocation?.let {
|
||||
PreferenceManager.saveObjectSecurely(
|
||||
CommonPrefConstants.DEVICE_LOCATION,
|
||||
@@ -132,7 +136,8 @@ class FetchGeocodingUseCase(
|
||||
city = geoCodingApiAddress.locality.orEmpty(),
|
||||
state = geoCodingApiAddress.adminArea.orEmpty(),
|
||||
district = geoCodingApiAddress.subAdminArea.orEmpty(),
|
||||
pincode = geoCodingApiAddress.postalCode.orEmpty()
|
||||
pincode = geoCodingApiAddress.postalCode.orEmpty(),
|
||||
source = SOURCE_ANDROID_GEOCODER_API
|
||||
)
|
||||
return deviceLocation
|
||||
}
|
||||
@@ -166,7 +171,8 @@ class FetchGeocodingUseCase(
|
||||
city = geocodingResponse.city.orEmpty(),
|
||||
state = geocodingResponse.state.orEmpty(),
|
||||
district = geocodingResponse.district.orEmpty(),
|
||||
pincode = geocodingResponse.pincode.orEmpty()
|
||||
pincode = geocodingResponse.pincode.orEmpty(),
|
||||
source = SOURCE_NETWORK
|
||||
)
|
||||
return deviceLocation
|
||||
}
|
||||
|
||||
@@ -18,4 +18,5 @@ data class DeviceLocation(
|
||||
val state: String = "",
|
||||
val district: String = "",
|
||||
val pincode: String = "",
|
||||
val source: String = "",
|
||||
)
|
||||
|
||||
@@ -324,7 +324,7 @@ object Constants {
|
||||
const val BUCKET_SIZE = "bucket_size"
|
||||
|
||||
// source of geocoding
|
||||
const val SOURCE_NATIVE_API = "Android Native API"
|
||||
const val SOURCE_ANDROID_GEOCODER_API = "ANDROID_GEOCODER_API"
|
||||
const val SOURCE_NETWORK = "MMI_API"
|
||||
|
||||
object ScreenLockConstants {
|
||||
|
||||
Reference in New Issue
Block a user