diff --git a/.idea/misc.xml b/.idea/misc.xml index cd77a1f062..21e99e2dc0 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -4,7 +4,7 @@ - + \ No newline at end of file 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 eb70cab35d..5b524654c0 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 @@ -134,11 +134,11 @@ public class ShareControl implements IMogoShareManager, IMogoIntentListener, private void realShowDialog() { if (mShareDialog == null) { Logger.d(TAG, "realShowDialog context : " + mContext); - if(DebugConfig.isLauncher()){ - mShareDialog = new LaucherShareDialog(mContext); - }else { - mShareDialog = new GridFixableShareDialog(mContext); - } +// if(DebugConfig.isLauncher()){ +// mShareDialog = new LaucherShareDialog(mContext); +// }else { + mShareDialog = new GridFixableShareDialog(mContext); +// } mShareDialog.setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { @@ -215,21 +215,22 @@ public class ShareControl implements IMogoShareManager, IMogoIntentListener, }); } - if (!DebugConfig.isLauncher()) { - ServiceApisManager.serviceApis.getStatusManagerApi().registerStatusChangedListener(TAG, StatusDescriptor.ACC_STATUS, new IMogoStatusChangedListener() { - @Override - public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) { - if (isTrue) { - queryShareConfigRetryTime = 0; - queryShareButtonConfig(); - } +// if (!DebugConfig.isLauncher()) { + ServiceApisManager.serviceApis.getStatusManagerApi().registerStatusChangedListener(TAG, + StatusDescriptor.ACC_STATUS, new IMogoStatusChangedListener() { + @Override + public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) { + if (isTrue) { + queryShareConfigRetryTime = 0; + queryShareButtonConfig(); } - }); + } + }); - // 获取分享框配置信息 - queryShareConfigRetryTime = 0; - queryShareButtonConfig(); - } + // 获取分享框配置信息 + queryShareConfigRetryTime = 0; + queryShareButtonConfig(); +// } Logger.d(TAG, "init over===="); } diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/StrategyShareProvider.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/StrategyShareProvider.kt index a09b3a53c0..f7c667d3fa 100644 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/StrategyShareProvider.kt +++ b/modules/mogo-module-share/src/main/java/com/mogo/module/share/StrategyShareProvider.kt @@ -27,12 +27,12 @@ class StrategyShareProvider : IProvider { blockStrategy = BlockStrategy(context, apis) // 注册事故 apis.getSocketManagerApi(context).registerOnMessageListener(ACCIDENT_STRATEGY_SHARE_PUSH_TYPE, AccidentStrategyReceiver(apis)) - if(!DebugConfig.isLauncher()) { - apis.registerCenterApi.registerMogoLocationListener(MogoServicePaths.PATH_STRATEGY_SHARE) { +// if(!DebugConfig.isLauncher()) { + apis.registerCenterApi.registerMogoLocationListener(MogoServicePaths.PATH_STRATEGY_SHARE) { // Logger.d(S_TAG,"定位发生变化,准备记录速度: ${it.speed}") - blockStrategy.recordSpeed(it.speed * 3.6F) - } + blockStrategy.recordSpeed(it.speed * 3.6F) } +// } } } \ No newline at end of file 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 cdd00f8bc8..dc0d235f3f 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 @@ -21,71 +21,71 @@ 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 { +// 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("感谢分享,正在上传") +// +// var shareItemSum = SharedPrefsMgr.getInstance(context).getInt(KEY_CLICK_SHARE_ITEM_BUTTON, 0) +// var intervalTime = SharedPrefsMgr.getInstance(context).getLong(KEY_CLICK_SHARE_ITEM_TIME, 0) +// Log.d("UploadHelper", "shareItemSum = $shareItemSum --- intervalTime = $intervalTime --type = ${type.eventType}") +// +// if (shareItemSum < 3) { +// var time = System.currentTimeMillis() +// Log.d("UploadHelper", "time = $time ") +// if (intervalTime == 0.toLong()) { +// Log.d("UploadHelper", " -----1-----") +// SharedPrefsMgr.getInstance(context).putLong(KEY_CLICK_SHARE_ITEM_TIME, time) +// SharedPrefsMgr.getInstance(context).putInt(KEY_CLICK_SHARE_ITEM_BUTTON, ++shareItemSum) +// AIAssist.getInstance(context).speakTTSVoice("下次可以直接对我说 上报" + getTypeName(type.eventType)) +// } else { +// Log.d("UploadHelper", " else interval = " + (time - intervalTime)) +// if ((time - intervalTime) > ONE_DAY_TIME) { +// SharedPrefsMgr.getInstance(context).putLong(KEY_CLICK_SHARE_ITEM_TIME, time) +// SharedPrefsMgr.getInstance(context).putInt(KEY_CLICK_SHARE_ITEM_BUTTON, ++shareItemSum) +// AIAssist.getInstance(context).speakTTSVoice("下次可以直接对我说 上报" + getTypeName(type.eventType)) +// } else { +// Log.e("UploadHelper", " else < ONE_DAY_TIME ") +// } +// } +// } +// } +// +// 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) { + // 上报即成功,当前还有正在上报的事件,仅做界面展示,不做具体操作 + ServiceApisManager.serviceApis.tanluUiApi.shareSuccess(type.eventType, type.location) + } else { + // 判断当前网络状态 + 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("感谢分享,正在上传") - - var shareItemSum = SharedPrefsMgr.getInstance(context).getInt(KEY_CLICK_SHARE_ITEM_BUTTON, 0) - var intervalTime = SharedPrefsMgr.getInstance(context).getLong(KEY_CLICK_SHARE_ITEM_TIME, 0) - Log.d("UploadHelper", "shareItemSum = $shareItemSum --- intervalTime = $intervalTime --type = ${type.eventType}") - - if (shareItemSum < 3) { - var time = System.currentTimeMillis() - Log.d("UploadHelper", "time = $time ") - if (intervalTime == 0.toLong()) { - Log.d("UploadHelper", " -----1-----") - SharedPrefsMgr.getInstance(context).putLong(KEY_CLICK_SHARE_ITEM_TIME, time) - SharedPrefsMgr.getInstance(context).putInt(KEY_CLICK_SHARE_ITEM_BUTTON, ++shareItemSum) - AIAssist.getInstance(context).speakTTSVoice("下次可以直接对我说 上报" + getTypeName(type.eventType)) - } else { - Log.d("UploadHelper", " else interval = " + (time - intervalTime)) - if ((time - intervalTime) > ONE_DAY_TIME) { - SharedPrefsMgr.getInstance(context).putLong(KEY_CLICK_SHARE_ITEM_TIME, time) - SharedPrefsMgr.getInstance(context).putInt(KEY_CLICK_SHARE_ITEM_BUTTON, ++shareItemSum) - AIAssist.getInstance(context).speakTTSVoice("下次可以直接对我说 上报" + getTypeName(type.eventType)) - } else { - Log.e("UploadHelper", " else < ONE_DAY_TIME ") - } - } - } - } - + // 上报即成功 + ServiceApisManager.serviceApis.tanluUiApi.shareSuccess(type.eventType, type.location) 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) { - // 上报即成功,当前还有正在上报的事件,仅做界面展示,不做具体操作 - ServiceApisManager.serviceApis.tanluUiApi.shareSuccess(type.eventType, type.location) } else { - // 判断当前网络状态 - if (NetworkUtils.isConnected(context)) { - // 有网就正常上报 - ServiceApisManager.serviceApis.statusManagerApi.setUploadingStatus("CARD_TYPE_ROAD_CONDITION", true) - // 上报即成功 - ServiceApisManager.serviceApis.tanluUiApi.shareSuccess(type.eventType, type.location) - 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("分享失败,请检查网络") - TipToast.tip("分享失败,请检查网络", TipDrawable(context.resources.getDrawable(R.drawable.module_share_upload_fail))) - } + // 没网就直接提示失败 + AIAssist.getInstance(context).speakTTSVoice("分享失败,请检查网络") + TipToast.tip("分享失败,请检查网络", TipDrawable(context.resources.getDrawable(R.drawable.module_share_upload_fail))) } } +// } } private fun getTypeName(type: String): String? {