From 8600e2c3ac16c3b2043650d32900b2f29514aa21 Mon Sep 17 00:00:00 2001 From: tongchenfei Date: Wed, 9 Sep 2020 17:30:04 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8C=BA=E5=88=86=E5=88=86=E4=BA=AB=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E9=9C=80=E6=B1=82=E8=8C=83=E5=9B=B4=EF=BC=8Clauncher?= =?UTF-8?q?=E4=B8=8D=E5=8A=A0=E6=AD=A4=E9=9C=80=E6=B1=82=EF=BC=8C=E7=8B=AC?= =?UTF-8?q?=E7=AB=8Bapp=E5=8A=A0=E6=AD=A4=E9=9C=80=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/misc.xml | 2 +- .../extensions/entrance/EntranceFragment.java | 24 ++++----- .../mogo/module/share/manager/UploadHelper.kt | 53 ++++++++++++------- .../tanlu/receiver/MarkerInfoReceiver.kt | 6 ++- 4 files changed, 49 insertions(+), 36 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index 21e99e2dc0..cd77a1f062 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-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 0d9a233eaf..3aff44bc6e 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 @@ -480,19 +480,17 @@ public class EntranceFragment extends MvpFragment $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))) + } } } } diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/receiver/MarkerInfoReceiver.kt b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/receiver/MarkerInfoReceiver.kt index b6c54e352f..8edf51634c 100644 --- a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/receiver/MarkerInfoReceiver.kt +++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/receiver/MarkerInfoReceiver.kt @@ -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)) + } } } }