diff --git a/android/navi-common/src/main/java/com/navi/common/geonetwork/model/network/CellularInfoEntity.kt b/android/navi-common/src/main/java/com/navi/common/geonetwork/model/network/CellularInfoEntity.kt index 48bd4436a8..5d95ba12ff 100644 --- a/android/navi-common/src/main/java/com/navi/common/geonetwork/model/network/CellularInfoEntity.kt +++ b/android/navi-common/src/main/java/com/navi/common/geonetwork/model/network/CellularInfoEntity.kt @@ -34,14 +34,14 @@ data class CellularInfoEntity( val cellInfoType: String = "", val isRegistered: Boolean = false, val cellConnectionStatus: String = "", - val ci: Int = 0, - val pci: Int = 0, - val tac: Int = 0, - val mcc: Int = 0, - val mnc: Int = 0, - val rssi: Int = 0, - val rsrp: Int = 0, - val rsrq: Int = 0, + val ci: String = "", + val pci: String = "", + val tac: String = "", + val mcc: String = "", + val mnc: String = "", + val rssi: String = "", + val rsrp: String = "", + val rsrq: String = "", val isInternetSource: Boolean = false, ) diff --git a/android/navi-common/src/main/java/com/navi/common/geonetwork/model/network/GeoNetworkSignatureCoreRequest.kt b/android/navi-common/src/main/java/com/navi/common/geonetwork/model/network/GeoNetworkSignatureCoreRequest.kt index 4b551740b9..b463d6ca05 100644 --- a/android/navi-common/src/main/java/com/navi/common/geonetwork/model/network/GeoNetworkSignatureCoreRequest.kt +++ b/android/navi-common/src/main/java/com/navi/common/geonetwork/model/network/GeoNetworkSignatureCoreRequest.kt @@ -20,14 +20,14 @@ data class CellularInfo( @SerializedName("cellInfoType") val cellInfoType: String, @SerializedName("isRegistered") val isRegistered: Boolean, @SerializedName("cellConnectionStatus") val cellConnectionStatus: String, - @SerializedName("ci") val ci: Int, - @SerializedName("pci") val pci: Int, - @SerializedName("tac") val tac: Int, - @SerializedName("mcc") val mcc: Int, - @SerializedName("mnc") val mnc: Int, - @SerializedName("rssi") val rssi: Int, - @SerializedName("rsrp") val rsrp: Int, - @SerializedName("rsrq") val rsrq: Int, + @SerializedName("ci") val ci: String, + @SerializedName("pci") val pci: String, + @SerializedName("tac") val tac: String, + @SerializedName("mcc") val mcc: String, + @SerializedName("mnc") val mnc: String, + @SerializedName("rssi") val rssi: String, + @SerializedName("rsrp") val rsrp: String, + @SerializedName("rsrq") val rsrq: String, @SerializedName("isInternetSource") val isInternetSource: Boolean, ) @@ -39,6 +39,6 @@ data class WifiInfo( ) data class Geolocation( - @SerializedName("latitude") val latitude: String? = null, - @SerializedName("longitude") val longitude: String? = null, + @SerializedName("latitude") val latitude: Double? = null, + @SerializedName("longitude") val longitude: Double? = null, ) diff --git a/android/navi-common/src/main/java/com/navi/common/geonetwork/usecase/GeoNetworkSignatureUseCase.kt b/android/navi-common/src/main/java/com/navi/common/geonetwork/usecase/GeoNetworkSignatureUseCase.kt index 0fdeabbab3..6f77959e48 100644 --- a/android/navi-common/src/main/java/com/navi/common/geonetwork/usecase/GeoNetworkSignatureUseCase.kt +++ b/android/navi-common/src/main/java/com/navi/common/geonetwork/usecase/GeoNetworkSignatureUseCase.kt @@ -11,6 +11,7 @@ import com.navi.analytics.utils.NaviTrackEvent import com.navi.base.cache.model.NaviCacheEntity import com.navi.base.cache.repository.NaviCacheRepository import com.navi.base.utils.TrustedTimeAccessor +import com.navi.base.utils.toDoubleWithSafe import com.navi.common.checkmate.model.MetricInfo import com.navi.common.constants.GEO_NETWORK_SIGNATURE_LAST_SYNC_TS_KEY import com.navi.common.firebaseremoteconfig.FirebaseRemoteConfigHelper @@ -110,8 +111,8 @@ constructor( geolocation = if (isLocationPermissionAvailable) { Geolocation( - latitude = CommonUtils.getUserLocation()?.latitude, - longitude = CommonUtils.getUserLocation()?.longitude, + latitude = CommonUtils.getUserLocation()?.latitude?.toDoubleWithSafe(), + longitude = CommonUtils.getUserLocation()?.longitude?.toDoubleWithSafe(), ) } else null, ) diff --git a/android/navi-common/src/main/java/com/navi/common/geonetwork/util/MagicLocationUtil.kt b/android/navi-common/src/main/java/com/navi/common/geonetwork/util/MagicLocationUtil.kt index a1ac990620..3a2f5ab032 100644 --- a/android/navi-common/src/main/java/com/navi/common/geonetwork/util/MagicLocationUtil.kt +++ b/android/navi-common/src/main/java/com/navi/common/geonetwork/util/MagicLocationUtil.kt @@ -33,32 +33,32 @@ fun CellInfoLte.getCellularInfoEntity(context: Context): CellularInfoEntity { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { this.cellConnectionStatus.toString() } else "Unknown", - ci = cellIdentity.ci, - pci = cellIdentity.pci, - tac = cellIdentity.tac, + ci = cellIdentity.ci.toString(), + pci = cellIdentity.pci.toString(), + tac = cellIdentity.tac.toString(), mcc = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { - cellIdentity.mccString?.toInt() ?: 0 + cellIdentity.mccString ?: "" } else { val mcc = cellIdentity.mcc - if (mcc != Integer.MAX_VALUE && mcc != -1) mcc else 0 + if (mcc != Integer.MAX_VALUE && mcc != -1) mcc.toString() else "" }, mnc = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { - cellIdentity.mncString?.toInt() ?: 0 + cellIdentity.mncString ?: "" } else { val mcc = cellIdentity.mnc - if (mcc != Integer.MAX_VALUE && mcc != -1) mcc else 0 + if (mcc != Integer.MAX_VALUE && mcc != -1) mcc.toString() else "" }, - rssi = signalStrength.dbm, + rssi = signalStrength.dbm.toString(), rsrp = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - signalStrength.rsrp - } else 0, + signalStrength.rsrp.toString() + } else "", rsrq = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - signalStrength.rsrq - } else 0, + signalStrength.rsrq.toString() + } else "", isInternetSource = getIsCellularInternetSource(context), ) } @@ -89,26 +89,26 @@ fun CellInfoGsm.getCellularInfoEntity(context: Context): CellularInfoEntity { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { this.cellConnectionStatus.toString() } else "Unknown", - ci = cellIdentity.cid, + ci = cellIdentity.cid.toString(), tac = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { - cellIdentity.lac - } else 0, + cellIdentity.lac.toString() + } else "", mcc = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { - cellIdentity.mccString?.toInt() ?: 0 + cellIdentity.mccString ?: "" } else { val mcc = cellIdentity.mcc - if (mcc != Integer.MAX_VALUE && mcc != -1) mcc else 0 + if (mcc != Integer.MAX_VALUE && mcc != -1) mcc.toString() else "" }, mnc = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { - cellIdentity.mncString?.toInt() ?: 0 + cellIdentity.mncString ?: "" } else { val mcc = cellIdentity.mnc - if (mcc != Integer.MAX_VALUE && mcc != -1) mcc else 0 + if (mcc != Integer.MAX_VALUE && mcc != -1) mcc.toString() else "" }, - rssi = signalStrength.dbm, + rssi = signalStrength.dbm.toString(), isInternetSource = getIsCellularInternetSource(context), ) } @@ -124,27 +124,27 @@ fun CellInfoWcdma.getCellularInfoEntity(context: Context): CellularInfoEntity { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { this.cellConnectionStatus.toString() } else "Unknown", - ci = cellIdentity.cid, - pci = cellIdentity.psc, + ci = cellIdentity.cid.toString(), + pci = cellIdentity.psc.toString(), tac = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { - cellIdentity.lac - } else 0, + cellIdentity.lac.toString() + } else "", mcc = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { - cellIdentity.mccString?.toInt() ?: 0 + cellIdentity.mccString ?: "" } else { val mcc = cellIdentity.mcc - if (mcc != Integer.MAX_VALUE && mcc != -1) mcc else 0 + if (mcc != Integer.MAX_VALUE && mcc != -1) mcc.toString() else "" }, mnc = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { - cellIdentity.mncString?.toInt() ?: 0 + cellIdentity.mncString ?: "" } else { val mcc = cellIdentity.mnc - if (mcc != Integer.MAX_VALUE && mcc != -1) mcc else 0 + if (mcc != Integer.MAX_VALUE && mcc != -1) mcc.toString() else "" }, - rssi = signalStrength.dbm, + rssi = signalStrength.dbm.toString(), isInternetSource = getIsCellularInternetSource(context), ) } @@ -160,9 +160,9 @@ fun CellInfoCdma.getCellularInfoEntity(context: Context): CellularInfoEntity { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { this.cellConnectionStatus.toString() } else "Unknown", - ci = cellIdentity.basestationId, - pci = cellIdentity.networkId, - rssi = signalStrength.dbm, + ci = cellIdentity.basestationId.toString(), + pci = cellIdentity.networkId.toString(), + rssi = signalStrength.dbm.toString(), isInternetSource = getIsCellularInternetSource(context), ) } @@ -176,12 +176,12 @@ fun CellInfoTdscdma.getCellularInfoEntity(context: Context): CellularInfoEntity cellInfoType = CellInfoTdscdma::class.java.simpleName, isRegistered = this.isRegistered, cellConnectionStatus = this.cellConnectionStatus.toString(), - ci = cellIdentity.cid, - pci = cellIdentity.cpid, - tac = cellIdentity.lac, - mcc = cellIdentity.mccString?.toInt() ?: 0, - mnc = cellIdentity.mncString?.toInt() ?: 0, - rssi = signalStrength.dbm, + ci = cellIdentity.cid.toString(), + pci = cellIdentity.cpid.toString(), + tac = cellIdentity.lac.toString(), + mcc = cellIdentity.mccString ?: "", + mnc = cellIdentity.mncString ?: "", + rssi = signalStrength.dbm.toString(), isInternetSource = getIsCellularInternetSource(context), ) } @@ -195,14 +195,14 @@ fun CellInfoNr.getCellularInfoEntity(context: Context): CellularInfoEntity { cellInfoType = CellInfoNr::class.java.simpleName, isRegistered = this.isRegistered, cellConnectionStatus = this.cellConnectionStatus.toString(), - ci = cellIdentity.nci.toInt(), - pci = cellIdentity.pci, - tac = cellIdentity.tac, - mcc = cellIdentity.mccString?.toInt() ?: 0, - mnc = cellIdentity.mncString?.toInt() ?: 0, - rsrp = signalStrength.csiRsrp, - rsrq = signalStrength.csiRsrq, - rssi = signalStrength.dbm, + ci = cellIdentity.nci.toString(), + pci = cellIdentity.pci.toString(), + tac = cellIdentity.tac.toString(), + mcc = cellIdentity.mccString ?: "", + mnc = cellIdentity.mncString ?: "", + rsrp = signalStrength.csiRsrp.toString(), + rsrq = signalStrength.csiRsrq.toString(), + rssi = signalStrength.dbm.toString(), isInternetSource = getIsCellularInternetSource(context), ) }