diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/constant/ShareConstants.java b/modules/mogo-module-share/src/main/java/com/mogo/module/share/constant/ShareConstants.java index e55fcb61c9..7fca820c05 100644 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/constant/ShareConstants.java +++ b/modules/mogo-module-share/src/main/java/com/mogo/module/share/constant/ShareConstants.java @@ -86,4 +86,33 @@ public class ShareConstants { * 分享框配置本地缓存的key */ public static final String KEY_SHARE_CONFIG = "SHARE_BUTTON_CONFIG"; + + /** + * 外部触发 + */ + public static final String KEY_SHARE_OUTER_GUIDE = "KEY_SHARE_OUTER_GUIDE"; + public static final String KEY_SHARE_OUTER_GUIDE_TIME = "KEY_SHARE_OUTER_GUIDE_TIME"; + + /** + * 内部触发 + */ + public static final String KEY_SHARE_INNER_GUIDE = "KEY_SHARE_INNER_GUIDE"; + public static final String KEY_SHARE_INNER_GUIDE_TIME = "KEY_SHARE_INNER_GUIDE_TIME"; + + /** + * 点击分享 + */ + public static final String KEY_CLICK_SHARE_BUTTON = "KEY_CLICK_SHARE_BUTTON"; + public static final String KEY_CLICK_SHARE_TIME = "KEY_CLICK_SHARE_TIME"; + + /** + * 点击具体分享类别 + */ + public static final String KEY_CLICK_SHARE_ITEM_BUTTON = "KEY_CLICK_SHARE_ITEM_BUTTON"; + public static final String KEY_CLICK_SHARE_ITEM_TIME = "KEY_CLICK_SHARE_ITEM_TIME"; + + //1天的毫秒 TODO +// public static final long ONE_DAY_TIME = 86400000; + public static final long ONE_DAY_TIME = 120000; + } 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 855e5bfbbd..c0f0ba67f8 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 @@ -1,15 +1,20 @@ package com.mogo.module.share.manager import android.content.Context +import android.util.Log import com.mogo.commons.debug.DebugConfig import com.mogo.commons.voice.AIAssist import com.mogo.map.MogoLatLng +import com.mogo.module.common.entity.MarkerPoiTypeEnum import com.mogo.module.share.R +import com.mogo.module.share.constant.ShareConstants +import com.mogo.module.share.constant.ShareConstants.* import com.mogo.service.share.TanluUploadParams import com.mogo.utils.NetworkUtils import com.mogo.utils.TipDrawable import com.mogo.utils.TipToast import com.mogo.utils.logger.Logger +import com.mogo.utils.storage.SharedPrefsMgr /** * 上报工具类 @@ -25,8 +30,35 @@ object UploadHelper { ServiceApisManager.serviceApis.statusManagerApi.setUploadingStatus("CARD_TYPE_ROAD_CONDITION", true) if (DebugConfig.getAIType() == DebugConfig.AI_TYPE_TXZ || forcePlayVoice) { // 因为思必驰语音分享时,语音助手会自己播报一段文字 - AIAssist.getInstance(context).speakTTSVoice("感谢分享,正在上传") +// 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 > 2) { + //TODO + } else { + 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 @@ -57,4 +89,22 @@ object UploadHelper { } } } + + private fun getTypeName(type: String): String? { + var typeName = "" + typeName = when (type) { + MarkerPoiTypeEnum.TRAFFIC_CHECK -> "交通检查" + MarkerPoiTypeEnum.ROAD_CLOSED -> "封路" + MarkerPoiTypeEnum.FOURS_ROAD_WORK -> "施工" + MarkerPoiTypeEnum.FOURS_BLOCK_UP -> "拥堵" + MarkerPoiTypeEnum.FOURS_PONDING -> "道路积水" + MarkerPoiTypeEnum.FOURS_ICE -> "道路结冰" + MarkerPoiTypeEnum.FOURS_FOG -> "浓雾" + MarkerPoiTypeEnum.FOURS_ACCIDENT -> "交通事故" + MarkerPoiTypeEnum.FOURS_LIVING -> "实时路况" + else -> "实时路况" + } + return typeName + } + } \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/res/values/strings.xml b/modules/mogo-module-share/src/main/res/values/strings.xml index 94c5463011..a7116bdf5c 100644 --- a/modules/mogo-module-share/src/main/res/values/strings.xml +++ b/modules/mogo-module-share/src/main/res/values/strings.xml @@ -1,3 +1,24 @@ share + + + + 查路况您可以直接唤醒小智说“天安门附近堵不堵” + 出行路况早知道,试试唤醒小智说,“附近路况怎么样” + 提前看看出行路况,试试唤醒小智说,“中关村路况怎么样” + + + + + 查询路况,唤醒小智说“天安门附近路况怎么样” + 想知道出行路况,唤醒小智说“中关村堵车吗” + 出行路况早知道,唤醒小智说“长安街路况怎么样” + + + + + 您可以将当前的路况分享给其他车友,帮助他们获得最新的路况信息,试试对我说“上报路况” + 您的分享信息将会帮助更多车友,当您发现以下交通事件,可以直接对我说上报路况 + +