添加 上报失败,检查网络提示

This commit is contained in:
tongchenfei
2020-08-31 10:40:18 +08:00
parent 7fdc5e8a2e
commit 108dd30e38

View File

@@ -9,6 +9,7 @@ import com.mogo.map.location.MogoLocation
import com.mogo.module.share.ShareControl
import com.mogo.module.share.dialog.LaucherShareDialog
import com.mogo.service.tanlu.TanluUploadParams
import com.mogo.utils.NetworkUtils
import com.mogo.utils.TipToast
import com.mogo.utils.logger.Logger
@@ -21,21 +22,22 @@ object UploadHelper {
Logger.d("UploadHelper", "正在上报===")
TipToast.tip("正在上报,请稍后重试")
}else {
ServiceApisManager.serviceApis.statusManagerApi.setUploadingStatus("CARD_TYPE_ROAD_CONDITION", true)
if(DebugConfig.getAIType() == DebugConfig.AI_TYPE_TXZ||forcePlayVoice) {
AIAssist.getInstance(context).speakTTSVoice("感谢分享,正在上传")
// 判断当前网络状态
if(NetworkUtils.isConnected(context)) {
// 有网就正常上报
ServiceApisManager.serviceApis.statusManagerApi.setUploadingStatus("CARD_TYPE_ROAD_CONDITION", true)
if (DebugConfig.getAIType() == DebugConfig.AI_TYPE_TXZ || forcePlayVoice) {
AIAssist.getInstance(context).speakTTSVoice("感谢分享,正在上传")
}
val location = ServiceApisManager.serviceApis.mapServiceApi.getSingletonLocationClient(context).lastKnowLocation
val latLon = MogoLatLng(location.latitude, location.longitude)
type.location = latLon
Logger.d("UploadHelper", "upload ----> $type")
ServiceApisManager.serviceApis.tanluApi.uploadRoadCondition(type)
}else{
// 没网就直接提示失败
AIAssist.getInstance(context).speakTTSVoice("分享失败,请检查网络")
}
val location = ServiceApisManager.serviceApis.mapServiceApi.getSingletonLocationClient(context).lastKnowLocation
val latLon = MogoLatLng(location.latitude, location.longitude)
type.location = latLon
Logger.d("UploadHelper", "upload ----> $type")
ServiceApisManager.serviceApis.tanluApi.uploadRoadCondition(type)
// val intent = Intent()
// intent.action = "com.zhidao.share.roadcondition.action"
// intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND)
// intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES)
// intent.putExtra("type", type)
// context.sendBroadcast(intent)
}
}
}