From 245d1339ebedad6f5b8350445f3c0c9920941ea0 Mon Sep 17 00:00:00 2001 From: lixiaopeng Date: Thu, 23 Dec 2021 14:31:38 +0800 Subject: [PATCH] opt --- modules/mogo-module-share/build.gradle | 3 - .../com/mogo/module/share/ShareControl.java | 4 - .../com/mogo/module/share/TanluManager.java | 8 +- .../com/mogo/module/share/VoiceCmdService.kt | 15 ++-- .../mogo/module/share/manager/UploadHelper.kt | 20 ----- .../module/share/net/TrafficApiService.java | 1 - .../com/mogo/module/share/utils/PdUtil.kt | 79 ------------------- 7 files changed, 11 insertions(+), 119 deletions(-) delete mode 100644 modules/mogo-module-share/src/main/java/com/mogo/module/share/utils/PdUtil.kt diff --git a/modules/mogo-module-share/build.gradle b/modules/mogo-module-share/build.gradle index 65fa5fa567..c5d2e47cf4 100644 --- a/modules/mogo-module-share/build.gradle +++ b/modules/mogo-module-share/build.gradle @@ -57,13 +57,10 @@ dependencies { implementation rootProject.ext.dependencies.rxjava implementation rootProject.ext.dependencies.rxandroid implementation rootProject.ext.dependencies.mogoaicloudtanlu - implementation rootProject.ext.dependencies.analytics implementation rootProject.ext.dependencies.eventbus implementation rootProject.ext.dependencies.coroutinescore implementation rootProject.ext.dependencies.coroutinesandroid -// implementation rootProject.ext.dependencies.retrofit -// implementation rootProject.ext.dependencies.retrofitconvertergson implementation 'com.zhidaoauto.controller:api:1.0.8' if (Boolean.valueOf(USE_MAVEN_PACKAGE)) { diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/ShareControl.java b/modules/mogo-module-share/src/main/java/com/mogo/module/share/ShareControl.java index 298fdf9712..d77925280e 100644 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/ShareControl.java +++ b/modules/mogo-module-share/src/main/java/com/mogo/module/share/ShareControl.java @@ -83,11 +83,7 @@ import io.reactivex.schedulers.Schedulers; @Route(path = MogoServicePaths.PATH_SHARE) public class ShareControl implements IMogoShareManager, Handler.Callback { private static final String TAG = "ShareControl"; -// private static final int MSG_REAL_QUERY_SHARE_CONFIG = 1001; -// private static final long QUERY_SHARE_CONFIG_DELAY = 3_000L; - private Context mContext; -// private LaucherShareDialog mShareDialog; private BaseFloatDialog mShareDialog; diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/TanluManager.java b/modules/mogo-module-share/src/main/java/com/mogo/module/share/TanluManager.java index 039549abf4..4206fb2d74 100644 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/TanluManager.java +++ b/modules/mogo-module-share/src/main/java/com/mogo/module/share/TanluManager.java @@ -81,7 +81,6 @@ import static com.mogo.module.share.constant.ShareConstants.VOICE_COMMAND_QUERY_ * @description 探路和新鲜事的view * @since 2020/5/19 */ - public class TanluManager implements IMogoMarkerClickListener, IMogoPoiSearchListener, IMogoGeoSearchListener { @@ -338,6 +337,7 @@ public class TanluManager implements IMogoMarkerClickListener, /** * 列表转换 + * * @param list * @return */ @@ -360,9 +360,9 @@ public class TanluManager implements IMogoMarkerClickListener, location.setLon(exploreWayCloud.getLocation().getLon()); location.setLat(exploreWayCloud.getLocation().getLat()); exploreWay.setLocation(location); - exploreWay.setDirection((int)exploreWayCloud.getDirection()); + exploreWay.setDirection((int) exploreWayCloud.getDirection()); exploreWay.setCanLive(exploreWayCloud.getCanLive()); - exploreWay.setFileType((int)exploreWayCloud.getFileType()); + exploreWay.setFileType((int) exploreWayCloud.getFileType()); exploreWay.setAddr(exploreWayCloud.getAddr()); exploreWay.setGenerateTime(exploreWayCloud.getGenerateTime()); exploreWay.setCityName(exploreWayCloud.getCityName()); @@ -498,7 +498,7 @@ public class TanluManager implements IMogoMarkerClickListener, Logger.d(TAG, "moveToMarcker lat = " + lat + " >>>>lon = " + lon); MogoLatLng latLng = new MogoLatLng(lat, lon); mMogoStatusManager.setUserInteractionStatus(TAG, true, false); - if(!mMogoStatusManager.isVrMode()){ + if (!mMogoStatusManager.isVrMode()) { mMApUIController.moveToCenter(latLng); } } diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/VoiceCmdService.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/VoiceCmdService.kt index ff2b90c445..8aa0e87937 100644 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/VoiceCmdService.kt +++ b/modules/mogo-module-share/src/main/java/com/mogo/module/share/VoiceCmdService.kt @@ -13,24 +13,23 @@ import com.mogo.utils.logger.Logger * * @author tongchenfei */ -class VoiceCmdService:Service() { - companion object{ +class VoiceCmdService : Service() { + companion object { private const val TAG = "VoiceCmdService" } - private val seekListener = object : ISeekHelpListener{ + private val seekListener = object : ISeekHelpListener { override fun onSeekHelpSuccess() { // 上报完成,关掉自己 - Logger.d(TAG,"上报完成,成功") + Logger.d(TAG, "上报完成,成功") stopSelf() } override fun onSeekHelpFail() { // 上报完成,关掉自己 - Logger.d(TAG,"上报完成,失败") + Logger.d(TAG, "上报完成,失败") stopSelf() } - } override fun onBind(intent: Intent?): IBinder? { @@ -39,10 +38,10 @@ class VoiceCmdService:Service() { override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int { intent?.let { - if (intent.getIntExtra(ShareConstants.VOICE_CMD_SERVICE_EVENT_KEY,0) == ShareConstants.VOICE_CMD_SERVICE_SEEK_HELP) { + if (intent.getIntExtra(ShareConstants.VOICE_CMD_SERVICE_EVENT_KEY, 0) == ShareConstants.VOICE_CMD_SERVICE_SEEK_HELP) { // 收到语音指令,准备上报求助 Logger.i(TAG, "收到语音指令,准备上报求助") - SeekHelpManager.seekHelp(this,seekListener,"2") + SeekHelpManager.seekHelp(this, seekListener, "2") } } return super.onStartCommand(intent, flags, startId) diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/manager/UploadHelper.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/manager/UploadHelper.kt index d474550c69..7cf21e554c 100644 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/manager/UploadHelper.kt +++ b/modules/mogo-module-share/src/main/java/com/mogo/module/share/manager/UploadHelper.kt @@ -18,24 +18,6 @@ import com.mogo.utils.storage.SharedPrefsMgr */ object UploadHelper { fun upload(context: Context, type: TanluUploadParams, forcePlayVoice: Boolean = false) { -// if (DebugConfig.isLauncher()) { //TODO launcher和独立应用 -// if (ServiceApisManager.serviceApis.statusManagerApi.isUploading) { -// // 上报即成功,当前还有正在上报的事件,仅做界面展示,不做具体操作 -// 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("感谢分享,正在上传") - -// 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 { if (ServiceApisManager.serviceApis.statusManagerApi.isUploading) { Logger.d("UploadHelper", "upload is going -- ") // 上报即成功,当前还有正在上报的事件,仅做界面展示,不做具体操作 @@ -46,7 +28,6 @@ object UploadHelper { // 有网就正常上报 ServiceApisManager.serviceApis.statusManagerApi.setUploadingStatus("CARD_TYPE_ROAD_CONDITION", true) // 上报即成功 -// TanluManager.getInstance(context).shareSuccess(type.eventType, type.location) ServiceApisManager.serviceApis.tanluUiApi.shareSuccess(type.eventType, type.location) val location = ServiceApisManager.serviceApis.mapServiceApi.getSingletonLocationClient(context).lastKnowLocation val latLon = com.mogo.eagle.core.data.map.MogoLatLng( @@ -58,7 +39,6 @@ object UploadHelper { ServiceApisManager.serviceApis.tanluApi.uploadRoadCondition(type) //语音播报 showVoiceTip(context, type.eventType) - } else { // 没网就直接提示失败 Logger.e("UploadHelper", "upload not net ") diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/net/TrafficApiService.java b/modules/mogo-module-share/src/main/java/com/mogo/module/share/net/TrafficApiService.java index 2fa1951d1c..c201b97c22 100644 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/net/TrafficApiService.java +++ b/modules/mogo-module-share/src/main/java/com/mogo/module/share/net/TrafficApiService.java @@ -12,7 +12,6 @@ import retrofit2.http.POST; public interface TrafficApiService { /** * 上报路况拥堵情况 - * */ @FormUrlEncoded @POST("/yycp-tmcServer/tmcServer/car/reportTraffic/v1") diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/utils/PdUtil.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/utils/PdUtil.kt deleted file mode 100644 index 351b509866..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/utils/PdUtil.kt +++ /dev/null @@ -1,79 +0,0 @@ -package com.mogo.module.share.utils - -import android.util.Log -import com.google.gson.JsonArray -import com.google.gson.JsonObject -import com.mogo.cloud.passport.MoGoAiCloudClientConfig -import com.mogo.commons.AbsMogoApplication -import com.mogo.module.share.bean.InformationBody -import com.mogo.module.share.bean.LocationInfo -import com.mogo.module.share.constant.INFO_TYPE_IMG -import com.mogo.module.share.constant.INFO_TYPE_VIDEO -import com.mogo.module.share.utils.StrategyPreferenceUtil.Companion.getStrategyType -import com.mogo.module.share.utils.StrategyPreferenceUtil.Companion.getStrategyValidity - - -fun getInformationBody( - types: Int, - urls: Map, - locationInfo: LocationInfo, - isCustom: Boolean, - trafficInfoType:String = "", - isShare:Boolean, - poiType: String, - mainInfoId: Long, - longitude: Double, - latitude: Double, - speed: Float, - fromType: String -): InformationBody { - val jsonArray = JsonArray() - val type: Int - type = if (types == INFO_TYPE_VIDEO) { - val videoObject = JsonObject() - videoObject.addProperty("thumbnail", urls["thumb"]) - videoObject.addProperty("url", urls["video"]) - jsonArray.add(videoObject) - INFO_TYPE_VIDEO - } else { - val urlObject = JsonObject() - urlObject.addProperty("url", urls["pic"]) - jsonArray.add(urlObject) - INFO_TYPE_IMG - } - val infoType = if (isCustom) 1 else 0 - Log.d("MainServiceController", "isCustom = $isCustom ---- infoType = $infoType") - return InformationBody( - jsonArray.toString(), - locationInfo.address, - locationInfo.areaCode, - locationInfo.areaName, - locationInfo.cityCode, - locationInfo.cityName, - System.currentTimeMillis(), - if (latitude == 0.0) locationInfo.latitude else latitude, - if (longitude == 0.0) locationInfo.longitude else longitude, - locationInfo.provinceName, - MoGoAiCloudClientConfig.getInstance().getSn(), - locationInfo.street, - type, - 0, - infoType, - getStrategyValidity(AbsMogoApplication.getApp().applicationContext, convertUploadTypeOfSP(type), getStrategyType(convertUploadTypeOfSP(type))), - trafficInfoType, - isShare, - locationInfo.direction, - poiType, - mainInfoId, - speed, - fromType - ) -} - -private fun convertUploadTypeOfSP(type: Int): String { - return when (type) { - INFO_TYPE_IMG -> "pic" - INFO_TYPE_VIDEO -> "video" - else -> "pic" - } -} \ No newline at end of file