[6.2.4] fix bug npe of bindcar
This commit is contained in:
@@ -4,10 +4,10 @@ import android.content.Context
|
||||
import com.mogo.commons.constants.HostConst
|
||||
import com.mogo.commons.constants.SharedPrefsConstants
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.eagle.core.data.config.HdMapBuildConfig
|
||||
import com.mogo.eagle.core.data.deva.bindingcar.BindingCarInfo
|
||||
import com.mogo.eagle.core.data.deva.bindingcar.BindingCarRequest
|
||||
import com.mogo.eagle.core.data.deva.bindingcar.ModifyBindingcarInfo
|
||||
import com.mogo.eagle.core.data.config.HdMapBuildConfig
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showBindingCarDialog
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showModifyBindingCarDialog
|
||||
@@ -74,8 +74,19 @@ class BindingCarNetWorkManager private constructor() {
|
||||
.subscribe(object : Observer<BindingCarInfo> {
|
||||
override fun onSubscribe(d: Disposable) {}
|
||||
override fun onNext(info: BindingCarInfo) {
|
||||
if (info != null && info.getData() != null) {
|
||||
bindLog(mapOf("bindResult" to true,"carType" to getDefaultId(),"msg" to info))
|
||||
if (info?.getData() != null) {
|
||||
if ((info.code != 0 && info.code != 200)) {
|
||||
bindLog(mapOf("bindResult" to false, "msg" to info.toString()))
|
||||
return
|
||||
}
|
||||
|
||||
bindLog(
|
||||
mapOf(
|
||||
"bindResult" to true,
|
||||
"carType" to getDefaultId(),
|
||||
"msg" to info
|
||||
)
|
||||
)
|
||||
SharedPrefsMgr.getInstance(context).putString(
|
||||
SharedPrefsConstants.CAR_INFO,
|
||||
GsonUtils.toJson(info.getData())
|
||||
@@ -87,15 +98,22 @@ class BindingCarNetWorkManager private constructor() {
|
||||
}
|
||||
updateCarVrIconRes(info.getData().brandId)
|
||||
} else {
|
||||
SharedPrefsMgr.getInstance(context).putString(SharedPrefsConstants.CAR_INFO, "")
|
||||
e(SceneConstant.M_DEVA + TAG, "getBindingCarInfo data = null ---getDefaultId() : ${getDefaultId()} ")
|
||||
SharedPrefsMgr.getInstance(context)
|
||||
.putString(SharedPrefsConstants.CAR_INFO, "")
|
||||
e(
|
||||
SceneConstant.M_DEVA + TAG,
|
||||
"getBindingCarInfo data = null ---getDefaultId() : ${getDefaultId()} "
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onError(e: Throwable) {
|
||||
SharedPrefsMgr.getInstance(context).putString(SharedPrefsConstants.CAR_INFO, "")
|
||||
bindLog(mapOf("bindResult" to false,"msg" to e.toString()))
|
||||
e(SceneConstant.M_DEVA + TAG, "getBindingCarInfo onError e = " + e.toString() + "---e.getMessage = " + e.message + "---getDefaultId() : ${getDefaultId()}")
|
||||
bindLog(mapOf("bindResult" to false, "msg" to e.toString()))
|
||||
e(
|
||||
SceneConstant.M_DEVA + TAG,
|
||||
"getBindingCarInfo onError e = " + e.toString() + "---e.getMessage = " + e.message + "---getDefaultId() : ${getDefaultId()}"
|
||||
)
|
||||
}
|
||||
|
||||
override fun onComplete() {}
|
||||
@@ -131,14 +149,18 @@ class BindingCarNetWorkManager private constructor() {
|
||||
override fun onSubscribe(d: Disposable) {}
|
||||
override fun onNext(info: ModifyBindingcarInfo) {
|
||||
if (info != null) {
|
||||
if ((info.code != 0 && info.code != 200)) {
|
||||
bindLog(mapOf("bindingStatus" to false, "bindMsg" to info.toString()))
|
||||
return
|
||||
}
|
||||
callBack.invoke(info)
|
||||
bindLog(mapOf("bindingStatus" to true,"bindMsg" to info))
|
||||
bindLog(mapOf("bindingStatus" to true, "bindMsg" to info))
|
||||
updateCarVrIconRes(info.data.brandId)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onError(e: Throwable) {
|
||||
bindLog(mapOf("bindingStatus" to false,"bindMsg" to e.toString()))
|
||||
bindLog(mapOf("bindingStatus" to false, "bindMsg" to e.toString()))
|
||||
}
|
||||
|
||||
override fun onComplete() {}
|
||||
@@ -147,7 +169,7 @@ class BindingCarNetWorkManager private constructor() {
|
||||
|
||||
private fun updateCarVrIconRes(brandId: String?) {
|
||||
d(SceneConstant.M_DEVA + TAG, "CarModelChange : ${DebugConfig.isCarModelChange()}")
|
||||
if(!DebugConfig.isCarModelChange()){
|
||||
if (!DebugConfig.isCarModelChange()) {
|
||||
return
|
||||
}
|
||||
if (brandId == null || brandId.isEmpty()) {
|
||||
@@ -188,7 +210,7 @@ class BindingCarNetWorkManager private constructor() {
|
||||
nodeAliasCode = ChainConstant.CHAIN_CODE_BINDING_CAR,
|
||||
paramIndexes = [0]
|
||||
)
|
||||
private fun bindLog(msg:Map<String,Any>){
|
||||
private fun bindLog(msg: Map<String, Any>) {
|
||||
d(SceneConstant.M_DEVA + TAG, "bindLog : $msg")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user