diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java index db0bc24a44..e56e5f8bc6 100644 --- a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java +++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java @@ -82,6 +82,7 @@ import static com.mogo.module.share.constant.ShareConstants.KEY_SHARE_OUTER_GUID import static com.mogo.module.share.constant.ShareConstants.KEY_SHARE_OUTER_GUIDE_TIME; import static com.mogo.module.share.constant.ShareConstants.ONE_DAY_TIME; import static com.mogo.module.share.constant.ShareConstants.SEVEN_DAY_TIME; +import static com.mogo.module.share.constant.ShareConstants.VOICE_ALERT_COUNT; /** * @author congtaowang @@ -352,10 +353,14 @@ public class EntranceFragment extends MvpFragment { - playShareOuterGuideVoice(); - }, 5_000L - ); + boolean isShowGuide = SharedPrefsMgr.getInstance(AbsMogoApplication.getApp()).getBoolean(DebugConfig.getSpGuide(), false); + Logger.d(TAG, " isShowGuide = " + isShowGuide); + if (isShowGuide) { + UiThreadHandler.postDelayed(() -> { + playShareOuterGuideVoice(); + }, 5_000L + ); + } } Random random = new Random(); @@ -366,25 +371,23 @@ public class EntranceFragment extends MvpFragment>> time = " + time); if (intervalTime == 0) { - Log.d(TAG, " playShareGuideVoice -----1-----"); SharedPrefsMgr.getInstance(getContext()).putLong(KEY_CLICK_SHARE_TIME, time); SharedPrefsMgr.getInstance(getContext()).putInt(KEY_CLICK_SHARE_BUTTON, ++shareItemSum); AIAssist.getInstance(getContext()).speakTTSVoice(mClickShareVoiceStrings[0]); } else { - Log.d(TAG, " playShareGuideVoice else interval = " + (time - intervalTime)); + Logger.d(TAG, " playShareGuideVoice else interval = " + (time - intervalTime)); if ((time - intervalTime) > ONE_DAY_TIME) { SharedPrefsMgr.getInstance(getContext()).putLong(KEY_CLICK_SHARE_TIME, time); SharedPrefsMgr.getInstance(getContext()).putInt(KEY_CLICK_SHARE_BUTTON, ++shareItemSum); AIAssist.getInstance(getContext()).speakTTSVoice(mClickShareVoiceStrings[1]); } else { - Log.e(TAG, " playShareGuideVoice else < ONE_DAY_TIME "); + Logger.e(TAG, " playShareGuideVoice else < ONE_DAY_TIME "); } } } @@ -428,17 +428,15 @@ public class EntranceFragment extends MvpFragment $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) {