opt compile warn
This commit is contained in:
@@ -45,7 +45,7 @@ object CosCallbackMapController : CosStatusCallback {
|
||||
|
||||
fun unregisterCallbacks(paths: Map<String, String>?) {
|
||||
paths?.let {
|
||||
it?.keys?.let { keys ->
|
||||
it.keys.let { keys ->
|
||||
keys.forEach { path ->
|
||||
unregisterCallback(path)
|
||||
}
|
||||
@@ -54,9 +54,7 @@ object CosCallbackMapController : CosStatusCallback {
|
||||
}
|
||||
|
||||
override fun onStartUpload(eventId: String?, localPath: String?) {
|
||||
map[localPath]?.let {
|
||||
it.onStartUpload(eventId, localPath)
|
||||
}
|
||||
map[localPath]?.onStartUpload(eventId, localPath)
|
||||
}
|
||||
|
||||
override fun uploadCosFailed(cosPath: String?, eventId: String?, localPath: String?) {
|
||||
|
||||
@@ -75,7 +75,7 @@ class CosStatusController : CosStatusCallback {
|
||||
|
||||
private fun sendGetInfoFailedReceiver(type: String) {
|
||||
Log.d(CarCorderController.TAG, "sendGetInfoFailedReceiver ------>")
|
||||
var intent = Intent()
|
||||
val intent = Intent()
|
||||
intent.action = "com.zhidao.roadcondition.getinfo.failed"
|
||||
intent.putExtra("type", type)
|
||||
AbsMogoApplication.getApp().applicationContext.sendBroadcast(intent)
|
||||
@@ -95,11 +95,11 @@ class CosStatusController : CosStatusCallback {
|
||||
// }
|
||||
// }
|
||||
} else {
|
||||
if (localPath!!.endsWith("mp4") || localPath!!.contains("Thumbnail")) {
|
||||
if (localPath!!.endsWith("mp4") || localPath.contains("Thumbnail")) {
|
||||
CosCallbackMapController.uploadFailed?.invoke()
|
||||
}
|
||||
CosCallbackMapController.unregisterCallback(localPath)
|
||||
InformationUploadController.release(entity?.id)
|
||||
InformationUploadController.release(entity.id)
|
||||
// deletePicFile(localPath)
|
||||
}
|
||||
}
|
||||
@@ -114,7 +114,7 @@ class CosStatusController : CosStatusCallback {
|
||||
Log.d(TAG, "uploadCosCompleted downloadUrl = $downloadUrl")
|
||||
Log.d(TAG, "uploadCosCompleted cosPath = $cosPath")
|
||||
trackUploadCos(1)
|
||||
if (localPath!!.endsWith("mp4") || localPath!!.contains("Thumbnail")) {
|
||||
if (localPath!!.endsWith("mp4") || localPath.contains("Thumbnail")) {
|
||||
//如果是视频文件或者缩略图文件
|
||||
if (localPath.endsWith("mp4")) {
|
||||
videoAndThumbMap["video"] = downloadUrl!!
|
||||
@@ -127,7 +127,7 @@ class CosStatusController : CosStatusCallback {
|
||||
if (videoAndThumbMap.size == 2) {
|
||||
trackUploadCos(4)
|
||||
Log.d(TAG, "videoAndThumbMap.size == 2 ")
|
||||
var locationInfo = LocationUtil.getInstance().getLocationInfo()
|
||||
val locationInfo = LocationUtil.getInstance().getLocationInfo()
|
||||
val locationStr: String = Gson().toJson(locationInfo)
|
||||
Log.d(TAG, "locationStr = $locationStr")
|
||||
//上传录像以及缩略图成功
|
||||
@@ -155,7 +155,7 @@ class CosStatusController : CosStatusCallback {
|
||||
}
|
||||
|
||||
private fun sendInformation(type: Int, map: Map<String, String>) {
|
||||
Log.d(TAG, "isCustomSend = ${entity?.isCustom}")
|
||||
Log.d(TAG, "isCustomSend = ${entity.isCustom}")
|
||||
// if (entity?.isCustom) {
|
||||
// InformationUploadController.cosResourceReady(type, map, entity?.isCustom, entity?.id) {
|
||||
// CosCallbackMapController.mainService?.sendCustomResult(it)
|
||||
|
||||
@@ -75,7 +75,7 @@ object InformationUploadController {
|
||||
}
|
||||
}
|
||||
|
||||
private fun tryUploadInformation(ir: InformationResource?) {
|
||||
// private fun tryUploadInformation(ir: InformationResource?) {
|
||||
// synchronized(locker) {
|
||||
// ir?.let {
|
||||
// if (!it.isReady()) {
|
||||
@@ -106,7 +106,7 @@ object InformationUploadController {
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
// }
|
||||
|
||||
fun release(id: Long) {
|
||||
val target = informationCache.remove(id)
|
||||
|
||||
@@ -132,11 +132,10 @@ class MainService : Service() {
|
||||
if (p1.action == alarmBroadAction) {
|
||||
if (p1.getIntExtra("AlarmType", 1) == AlarmTypePic) {
|
||||
//拍照
|
||||
var number = p1.getLongExtra("number", 1)
|
||||
takePhoto(number, true)
|
||||
takePhoto(true)
|
||||
} else {
|
||||
//录像
|
||||
var duration = p1.getIntExtra("duration", 3)
|
||||
val duration = p1.getIntExtra("duration", 3)
|
||||
takeVideo(duration, true)
|
||||
}
|
||||
}
|
||||
@@ -211,7 +210,7 @@ class MainService : Service() {
|
||||
// )
|
||||
}
|
||||
|
||||
private fun sendMarkerInfoReceiver(lat: Double, lon: Double, imageUrl: String?, type: String?) {
|
||||
// private fun sendMarkerInfoReceiver(lat: Double, lon: Double, imageUrl: String?, type: String?) {
|
||||
// Log.e("MainService", "sendMarkerInfoReceiver ------> type = $type ")
|
||||
// Log.e("MainService", "sendMarkerInfoReceiver ------> fromType = $fromType ")
|
||||
// Log.e("MainService", "sendMarkerInfoReceiver ------> isCustom = $isCustom ")
|
||||
@@ -224,7 +223,7 @@ class MainService : Service() {
|
||||
// intent.putExtra("custom", isCustom)
|
||||
// intent.putExtra("fromType", fromType)
|
||||
// sendBroadcast(intent)
|
||||
}
|
||||
// }
|
||||
|
||||
/**
|
||||
* 初始化定位监听
|
||||
@@ -266,7 +265,7 @@ class MainService : Service() {
|
||||
Log.d("MainService", "handleReportStrategy picType = $picType ---videoType = $videoType")
|
||||
shareType = TANLU_ROAD_CURRENT
|
||||
if (picType == 1) {
|
||||
takePhoto(1)
|
||||
takePhoto()
|
||||
} else if (picType == 2) {
|
||||
postPhotoAlarmTask(true)
|
||||
}
|
||||
@@ -291,7 +290,7 @@ class MainService : Service() {
|
||||
}
|
||||
|
||||
//获取图片
|
||||
private fun takePhoto(picNum: Long, isInterval: Boolean = false, isCustom: Boolean = false) {
|
||||
private fun takePhoto( isInterval: Boolean = false, isCustom: Boolean = false) {
|
||||
Log.d("MainService", "takePhoto -----1----->")
|
||||
//判断是否授权
|
||||
// if (isAuthorization(BaseApplication.getAppContext())) {
|
||||
|
||||
@@ -18,7 +18,7 @@ import kotlinx.coroutines.runBlocking
|
||||
class MainServiceController {
|
||||
|
||||
companion object {
|
||||
var TAG = this.javaClass.name
|
||||
var TAG = this::class.java.name
|
||||
}
|
||||
|
||||
//逆地理编码是否重试
|
||||
@@ -57,69 +57,69 @@ class MainServiceController {
|
||||
}
|
||||
|
||||
//将数据同步到sharePreference中
|
||||
fun syncStrategiesData(strategy: CityStrategy) {
|
||||
if (strategy?.pic != null && strategy.video!=null) {
|
||||
setStrategyType(AbsMogoApplication.getApp().applicationContext, strategy.pic.strategyType, "pic")
|
||||
setStrategyType(AbsMogoApplication.getApp().applicationContext, strategy.video.strategyType, "video")
|
||||
private fun syncStrategiesData(strategy: CityStrategy) {
|
||||
if (strategy.pic != null && strategy.video!=null) {
|
||||
setStrategyType(AbsMogoApplication.getApp().applicationContext, strategy.pic!!.strategyType, "pic")
|
||||
setStrategyType(AbsMogoApplication.getApp().applicationContext, strategy.video!!.strategyType, "video")
|
||||
setStrategyFrequency(
|
||||
AbsMogoApplication.getApp().applicationContext,
|
||||
strategy.pic.strategyType,
|
||||
strategy.pic!!.strategyType,
|
||||
"pic",
|
||||
strategy.pic.reportType
|
||||
strategy.pic!!.reportType
|
||||
)
|
||||
setStrategyFrequency(
|
||||
AbsMogoApplication.getApp().applicationContext,
|
||||
strategy.video.strategyType,
|
||||
strategy.video!!.strategyType,
|
||||
"video",
|
||||
strategy.video.reportType
|
||||
strategy.video!!.reportType
|
||||
)
|
||||
setStrategyInterval(
|
||||
AbsMogoApplication.getApp().applicationContext,
|
||||
strategy.pic.strategyType,
|
||||
strategy.pic!!.strategyType,
|
||||
"pic",
|
||||
strategy.pic.reportTimeInterval * 60 * 1000L
|
||||
strategy.pic!!.reportTimeInterval * 60 * 1000L
|
||||
)
|
||||
setStrategyInterval(
|
||||
AbsMogoApplication.getApp().applicationContext,
|
||||
strategy.video.strategyType,
|
||||
strategy.video!!.strategyType,
|
||||
"video",
|
||||
strategy.video.reportTimeInterval * 60 * 1000L
|
||||
strategy.video!!.reportTimeInterval * 60 * 1000L
|
||||
)
|
||||
setStrategyValidity(
|
||||
AbsMogoApplication.getApp().applicationContext,
|
||||
strategy.pic.strategyType,
|
||||
strategy.pic!!.strategyType,
|
||||
"pic",
|
||||
strategy.pic.infoTimeout
|
||||
strategy.pic!!.infoTimeout
|
||||
)
|
||||
setStrategyValidity(
|
||||
AbsMogoApplication.getApp().applicationContext,
|
||||
strategy.video.strategyType,
|
||||
strategy.video!!.strategyType,
|
||||
"video",
|
||||
strategy.video.infoTimeout
|
||||
strategy.video!!.infoTimeout
|
||||
)
|
||||
setStrategyMaxSpeed(
|
||||
AbsMogoApplication.getApp().applicationContext,
|
||||
strategy.pic.strategyType,
|
||||
strategy.pic!!.strategyType,
|
||||
"pic",
|
||||
strategy.pic.getMaxSpeed()
|
||||
strategy.pic!!.getMaxSpeed()
|
||||
)
|
||||
setStrategyMaxSpeed(
|
||||
AbsMogoApplication.getApp().applicationContext,
|
||||
strategy.video.strategyType,
|
||||
strategy.video!!.strategyType,
|
||||
"video",
|
||||
strategy.video.getMaxSpeed()
|
||||
strategy.video!!.getMaxSpeed()
|
||||
)
|
||||
setStrategyMinSpeed(
|
||||
AbsMogoApplication.getApp().applicationContext,
|
||||
strategy.pic.strategyType,
|
||||
strategy.pic!!.strategyType,
|
||||
"pic",
|
||||
strategy.pic.minSpeed
|
||||
strategy.pic!!.minSpeed
|
||||
)
|
||||
setStrategyMinSpeed(
|
||||
AbsMogoApplication.getApp().applicationContext,
|
||||
strategy.video.strategyType,
|
||||
strategy.video!!.strategyType,
|
||||
"video",
|
||||
strategy.video.minSpeed
|
||||
strategy.video!!.minSpeed
|
||||
)
|
||||
} else {
|
||||
Log.d(TAG, "strategy Data is null")
|
||||
@@ -145,8 +145,8 @@ class MainServiceController {
|
||||
mFromType = fromType
|
||||
mPoiType = poiType
|
||||
|
||||
var locationInfo = LocationUtil.getInstance().getLocationInfo()
|
||||
if (locationInfo.address.isNullOrEmpty()) {
|
||||
val locationInfo = LocationUtil.getInstance().getLocationInfo()
|
||||
if (locationInfo.address.isEmpty()) {
|
||||
Log.d(TAG, " sendInformationMessage locationInfo.address = $locationInfo.address")
|
||||
trackUploadGeo(1)
|
||||
geoLocation(type, url, locationInfo, isCustom,trafficInfoType, isShare, customSend,poiType,mainInfoId,speed, longitude,latitude)
|
||||
@@ -210,11 +210,9 @@ class MainServiceController {
|
||||
strategyeModel.uploadInformation(informationBody)
|
||||
}
|
||||
onSuccess {
|
||||
if (it.result != null) {
|
||||
Log.i(TAG, "upload success id = " + it.result.id)
|
||||
if (mFromType == "6") {
|
||||
sendUgcStatusReceiver(it.result.id, mPoiType, mFromType)
|
||||
}
|
||||
Log.i(TAG, "upload success id = " + it.result.id)
|
||||
if (mFromType == "6") {
|
||||
sendUgcStatusReceiver(it.result.id, mPoiType, mFromType)
|
||||
}
|
||||
trackUploadServer(1)
|
||||
customSend?.invoke(true)
|
||||
|
||||
Reference in New Issue
Block a user