区分分享优化需求范围,launcher不加此需求,独立app加此需求

This commit is contained in:
tongchenfei
2020-09-09 17:30:04 +08:00
parent 77b37219e0
commit 8600e2c3ac
4 changed files with 49 additions and 36 deletions

2
.idea/misc.xml generated
View File

@@ -4,7 +4,7 @@
<asm skipDebug="false" skipFrames="false" skipCode="false" expandFrames="false" />
<groovy codeStyle="LEGACY" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="JDK" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
</project>

View File

@@ -480,19 +480,17 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
return;
}
// 1.1.5的需求,上报即成功,去掉此处动画
// if (descriptor == StatusDescriptor.UPLOADING) {
// if (isTrue) {
// mUploading.setVisibility(View.VISIBLE);
// mUpload.setVisibility(View.GONE);
// mUploadButtonAnimatorController.doFrameAnimOnUploadButton();
// } else {
// mUploadButtonAnimatorController.stopAnimation();
// mUploading.setVisibility(View.GONE);
// mUpload.setVisibility(View.VISIBLE);
// }
// } else
if (descriptor == StatusDescriptor.DISPLAY_OVERVIEW) {
if (descriptor == StatusDescriptor.UPLOADING&&DebugConfig.isLauncher()) {
if (isTrue) {
mUploading.setVisibility(View.VISIBLE);
mUpload.setVisibility(View.GONE);
mUploadButtonAnimatorController.doFrameAnimOnUploadButton();
} else {
mUploadButtonAnimatorController.stopAnimation();
mUploading.setVisibility(View.GONE);
mUpload.setVisibility(View.VISIBLE);
}
} else if (descriptor == StatusDescriptor.DISPLAY_OVERVIEW) {
if (!mMogoNavi.isNaviing()) {
return;
}

View File

@@ -19,32 +19,45 @@ import com.mogo.utils.logger.Logger
* 上报工具类
*/
object UploadHelper {
fun upload(context:Context, type: TanluUploadParams,forcePlayVoice:Boolean = false) {
if(ServiceApisManager.serviceApis.statusManagerApi.isUploading){
// 上报即成功,当前还有正在上报的事件,仅做界面展示,不做具体操作
ServiceApisManager.serviceApis.tanluUiApi.shareSuccess(type.eventType, type.location)
// Logger.d("UploadHelper", "正在上报===")
// TipToast.tip("正在上报,请稍后重试")
}else {
// 判断当前网络状态
if(NetworkUtils.isConnected(context)) {
// 有网就正常上报
fun upload(context: Context, type: TanluUploadParams, forcePlayVoice: Boolean = false) {
if (DebugConfig.isLauncher()) {
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("感谢分享,正在上传")
// }
// 上报即成功
ServiceApisManager.serviceApis.tanluUiApi.shareSuccess(type.eventType, type.location)
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{
// 没网就直接提示失败
AIAssist.getInstance(context).speakTTSVoice("分享失败,请检查网络")
TipToast.tip("分享失败,请检查网络", TipDrawable(context.resources.getDrawable(R.drawable.module_share_upload_fail)))
}
} 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)))
}
}
}
}

View File

@@ -4,6 +4,7 @@ import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.util.Log
import com.mogo.commons.debug.DebugConfig
import com.mogo.module.tanlu.model.event.MarkerInfo
import org.greenrobot.eventbus.EventBus
@@ -20,8 +21,9 @@ class MarkerInfoReceiver : BroadcastReceiver() {
var lon = intent.getDoubleExtra("lon",0.0) //经度
var custom = intent.getBooleanExtra("custom", false)
Log.d("MarkerInfoReceiver", "type =" + type + "---->lat =" + lat + "----lon =" + lon + " --custom = " + custom + "---imageUrl =" + imageUrl)
// 此处不接收抓取完成的广播1.1.5的需求是触发即分享成功,所以此处逻辑暂时注释,待日后看情况放开
// EventBus.getDefault().post(MarkerInfo(type, imageUrl,lon, lat, custom, fromType))
if(DebugConfig.isLauncher()) {
EventBus.getDefault().post(MarkerInfo(type, imageUrl, lon, lat, custom, fromType))
}
}
}
}