opt upload

This commit is contained in:
lixiaopeng
2020-09-16 20:33:10 +08:00
parent a8cb951b29
commit 749b721720

View File

@@ -4,6 +4,7 @@ import android.content.Intent
import android.util.Log
import com.google.gson.Gson
import com.mogo.commons.AbsMogoApplication
import com.mogo.utils.TipToast
import com.zhidao.cosupload.DbPriorityConfig
import com.zhidao.cosupload.callback.CosStatusCallback
import com.zhidao.cosupload.manager.CosUploadManagerImpl
@@ -142,20 +143,18 @@ class CosStatusController : CosStatusCallback {
val locationStr: String = Gson().toJson(locationInfo)
Log.d(TAG, "locationStr = " + locationStr)
//如果失败,需要提示失败弹框
if (locationInfo.address.isNullOrEmpty() || locationInfo.cityName.isNullOrEmpty() || locationInfo.cityCode.isNullOrEmpty()
|| locationInfo.latitude == 0.0 || locationInfo.areaName.isNullOrEmpty() || locationInfo.street.isNullOrEmpty()
|| locationInfo.areaCode.isNullOrEmpty() || locationInfo.provinceName.isNullOrEmpty()
) {
if (entity?.isCustom && mFromType != UPLOAD_FROM_STRATEGY_ACCIDENT_AUTO) {
sendGetInfoFailedReceiver("100")
}
} else {
//分享成功并打点如果是上报拥堵需要takeVideo
LatLngStickyEventBus.getInstance()
.postSticky(GetImageSuccessEvent(downloadUrl, mType))
//上传录像以及缩略图成功
sendInformation(INFO_TYPE_VIDEO, videoAndThumbMap)
}
// if (locationInfo.address.isNullOrEmpty() || locationInfo.cityName.isNullOrEmpty() || locationInfo.cityCode.isNullOrEmpty()
// || locationInfo.latitude == 0.0 || locationInfo.areaName.isNullOrEmpty() || locationInfo.street.isNullOrEmpty()
// || locationInfo.areaCode.isNullOrEmpty() || locationInfo.provinceName.isNullOrEmpty()
// ) {
// if (entity?.isCustom && mFromType != UPLOAD_FROM_STRATEGY_ACCIDENT_AUTO) {
// sendGetInfoFailedReceiver("100")
// }
// } else {
//上传录像以及缩略图成功
sendInformation(INFO_TYPE_VIDEO, videoAndThumbMap)
// }
} else {
trackUploadCos(5)
}
@@ -204,20 +203,37 @@ class CosStatusController : CosStatusCallback {
//开始上传
entity?.isCustom?.let {
mainServiceHttpModel.sendInformationMessage(
type = type,
url = map,
isCustom = it,
poiType = poiType,
mainInfoId = mainInfoId,
longitude = longitude,
latitude = latitude
) { success ->
CosCallbackMapController.unregisterCallbacks(map)
CosCallbackMapController.mainService?.let {
CosCallbackMapController.mainService?.sendCustomResult(success)
type = type,
url = map,
isCustom = it,
poiType = poiType,
mainInfoId = mainInfoId,
longitude = longitude,
latitude = latitude
) { success ->
CosCallbackMapController.unregisterCallbacks(map)
CosCallbackMapController.mainService?.let {
CosCallbackMapController.mainService?.sendCustomResult(success)
}
Log.d(TAG, "type = $type ----success = $success")
if (success) {
//分享成功并打点如果是上报拥堵需要takeVideo
if (type == INFO_TYPE_VIDEO) {
try {
LatLngStickyEventBus.getInstance()
.postSticky(GetImageSuccessEvent("", poiType))
} catch (e: java.lang.Exception) {
e.printStackTrace()
}
}
} else {
if (type == INFO_TYPE_VIDEO) {
TipToast.shortTip("分享失败,请检查网络")
}
}
}
}
}
}
override fun onProgress(localPath: String?, progress: Float) {