opt
This commit is contained in:
@@ -112,6 +112,8 @@ public class ShareConstants {
|
||||
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";
|
||||
|
||||
public static final int VOICE_ALERT_COUNT = 3;
|
||||
|
||||
//1天的毫秒 TODO
|
||||
public static final long ONE_DAY_TIME = 86400000;
|
||||
// public static final long ONE_DAY_TIME = 60000;
|
||||
|
||||
@@ -2,12 +2,10 @@ 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
|
||||
@@ -31,32 +29,7 @@ object UploadHelper {
|
||||
// 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
|
||||
@@ -79,6 +52,9 @@ object UploadHelper {
|
||||
type.location = latLon
|
||||
Logger.d("UploadHelper", "upload ----> $type")
|
||||
ServiceApisManager.serviceApis.tanluApi.uploadRoadCondition(type)
|
||||
//语音播报
|
||||
showVoiceTip(context, type.eventType)
|
||||
|
||||
} else {
|
||||
// 没网就直接提示失败
|
||||
AIAssist.getInstance(context).speakTTSVoice("分享失败,请检查网络")
|
||||
@@ -88,6 +64,31 @@ object UploadHelper {
|
||||
// }
|
||||
}
|
||||
|
||||
private fun showVoiceTip(context: Context, type: String) {
|
||||
var shareItemSum = SharedPrefsMgr.getInstance(context).getInt(KEY_CLICK_SHARE_ITEM_BUTTON, 0)
|
||||
var intervalTime = SharedPrefsMgr.getInstance(context).getLong(KEY_CLICK_SHARE_ITEM_TIME, 0)
|
||||
if (shareItemSum < VOICE_ALERT_COUNT) {
|
||||
Log.d("UploadHelper", "shareItemSum = $shareItemSum --- intervalTime = $intervalTime --type = ${type}")
|
||||
var time = System.currentTimeMillis()
|
||||
Log.d("UploadHelper", "time = $time ")
|
||||
if (intervalTime == 0.toLong()) {
|
||||
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))
|
||||
} 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))
|
||||
} else {
|
||||
Log.e("UploadHelper", " else < ONE_DAY_TIME ")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private fun getTypeName(type: String): String? {
|
||||
var typeName = ""
|
||||
typeName = when (type) {
|
||||
|
||||
Reference in New Issue
Block a user