Merge dev_mogo_httpdns
there are some conflicts:
both modified: foudations/mogo-commons/src/main/java/com/mogo/commons/AbsMogoApplication.java
both modified: gradle.properties
both modified: modules/mogo-module-share/consumer-rules.pro
both modified: modules/mogo-module-share/src/main/java/com/mogo/module/share/strategyreceiver/BlockStrategy.kt
This commit is contained in:
@@ -486,7 +486,7 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.moduleextensions
|
||||
implementation rootProject.ext.dependencies.modulemap
|
||||
implementation rootProject.ext.dependencies.moduleSmallMap
|
||||
implementation rootProject.ext.dependencies.httpdnsnoop
|
||||
implementation rootProject.ext.dependencies.httpdnsmogo
|
||||
} else {
|
||||
implementation project(':foudations:mogo-commons')
|
||||
implementation project(':foudations:mogo-base-websocket-sdk')
|
||||
@@ -504,7 +504,7 @@ dependencies {
|
||||
implementation project(':modules:mogo-module-extensions')
|
||||
implementation project(':modules:mogo-module-map')
|
||||
implementation project(':modules:mogo-module-smp')
|
||||
implementation project(':foudations:httpdns-noop')
|
||||
implementation project(':foudations:httpdns-mogo')
|
||||
}
|
||||
|
||||
apply from: "./functions/basedmap.gradle"
|
||||
|
||||
@@ -2,28 +2,12 @@
|
||||
|
||||
project.dependencies {
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
bydautoImplementation rootProject.ext.dependencies.httpdnsnoop
|
||||
d82xImplementation rootProject.ext.dependencies.httpdnsnoop
|
||||
em1Implementation rootProject.ext.dependencies.httpdnsnoop
|
||||
d8xxImplementation rootProject.ext.dependencies.httpdnsnoop
|
||||
d80xImplementation rootProject.ext.dependencies.httpdnsnoop
|
||||
em4Implementation rootProject.ext.dependencies.httpdnsnoop
|
||||
e8xxImplementation rootProject.ext.dependencies.httpdnsnoop
|
||||
f8xxImplementation rootProject.ext.dependencies.httpdnsnoop
|
||||
f80xImplementation rootProject.ext.dependencies.httpdnsnoop
|
||||
f8AmapImplementation rootProject.ext.dependencies.httpdnsnoop
|
||||
em3Implementation rootProject.ext.dependencies.httpdnsnoop
|
||||
qaImplementation rootProject.ext.dependencies.httpdnsnoop
|
||||
demoImplementation rootProject.ext.dependencies.httpdnsnoop
|
||||
onlineImplementation rootProject.ext.dependencies.httpdnsmogo
|
||||
} else {
|
||||
bydautoImplementation project(':foudations:httpdns-noop')
|
||||
d82xImplementation project(':foudations:httpdns-noop')
|
||||
em1Implementation project(':foudations:httpdns-noop')
|
||||
d8xxImplementation project(':foudations:httpdns-noop')
|
||||
d80xImplementation project(':foudations:httpdns-noop')
|
||||
em4Implementation project(':foudations:httpdns-noop')
|
||||
e8xxImplementation project(':foudations:httpdns-noop')
|
||||
f8xxImplementation project(':foudations:httpdns-noop')
|
||||
f80xImplementation project(':foudations:httpdns-noop')
|
||||
f8AmapImplementation project(':foudations:httpdns-noop')
|
||||
em3Implementation project(':foudations:httpdns-noop')
|
||||
qaImplementation project(':foudations:httpdns-mogo')
|
||||
demoImplementation project(':foudations:httpdns-mogo')
|
||||
onlineImplementation project(':foudations:httpdns-mogo')
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ import com.bytedance.boost_multidex.BoostMultiDex;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.network.Utils;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.module.authorize.authprovider.invoke.AuthorizeConstant;
|
||||
import com.mogo.module.carchatting.card.CallChatConstant;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
@@ -30,6 +31,7 @@ import com.mogo.service.passport.IMogoTicketCallback;
|
||||
import com.mogo.test.crashreport.ITestCrashReportProvider;
|
||||
import com.mogo.utils.ProcessUtils;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.httpdns.HttpSimpleLocation;
|
||||
import com.mogo.utils.logger.LogLevel;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.storage.SharedPrefsMgr;
|
||||
@@ -157,6 +159,16 @@ public class MogoApplication extends AbsMogoApplication {
|
||||
prepareBaseService( apis, 2_000L );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected HttpSimpleLocation getCurrentLocation() {
|
||||
MogoLocation location = MogoApisHandler.getInstance().getApis().getMapServiceApi().getSingletonLocationClient(this).getLastKnowLocation();
|
||||
if (location == null) {
|
||||
return null;
|
||||
}else {
|
||||
return new HttpSimpleLocation(location.getCityCode(), location.getLatitude(), location.getLongitude());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 基础服务:passport、location、socket
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.mogo.httpdns;
|
||||
|
||||
import android.location.Location;
|
||||
|
||||
import com.mogo.utils.httpdns.HttpSimpleLocation;
|
||||
|
||||
public interface IHttpDnsLocationChanged {
|
||||
/**
|
||||
* 获取当前定位
|
||||
* @return 当前定位
|
||||
*/
|
||||
HttpSimpleLocation getLocation();
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.mogo.httpdns;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.Keep;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
@@ -95,4 +97,12 @@ public interface IMogoHttpDns extends IProvider {
|
||||
*/
|
||||
@Keep
|
||||
void removeHttpDnsTtlCallback(String host,int type);
|
||||
|
||||
/**
|
||||
* 初始化
|
||||
*
|
||||
* @param context 上下文
|
||||
* @param locationChanged 定位发生变化
|
||||
*/
|
||||
void init(Context context, IHttpDnsLocationChanged locationChanged);
|
||||
}
|
||||
|
||||
@@ -32,16 +32,14 @@ dependencies {
|
||||
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
annotationProcessor rootProject.ext.dependencies.aroutercompiler
|
||||
implementation 'com.mogo.httpdns:httpdns-helper:1.0.6'
|
||||
implementation 'com.mogo.httpdns:httpdns-helper:1.0.17'
|
||||
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
implementation rootProject.ext.dependencies.httpdnsbase
|
||||
implementation rootProject.ext.dependencies.mogocommons
|
||||
implementation rootProject.ext.dependencies.modulecommon
|
||||
} else {
|
||||
implementation project(':foudations:httpdns-base')
|
||||
implementation project(':foudations:mogo-commons')
|
||||
implementation project(':modules:mogo-module-common')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,22 +8,24 @@ import androidx.annotation.Keep;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.network.Utils;
|
||||
import com.mogo.httpdns.HttpDnsConst;
|
||||
import com.mogo.httpdns.IHttpDnsCallback;
|
||||
import com.mogo.httpdns.IHttpDnsLocationChanged;
|
||||
import com.mogo.httpdns.IHttpDnsTtlCallback;
|
||||
import com.mogo.httpdns.IMogoHttpDns;
|
||||
import com.mogo.httpdnshelper.sdk.HttpDnsHelper;
|
||||
import com.mogo.httpdnshelper.sdk.bean.HttpDnsSimpleLocation;
|
||||
import com.mogo.httpdnshelper.sdk.listener.IHttpDnsCurrentLocation;
|
||||
import com.mogo.httpdnshelper.sdk.listener.OnAddressChangedListener;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.utils.httpdns.HttpSimpleLocation;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.HttpDns;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -49,6 +51,8 @@ public class MogoHttpDns implements IMogoHttpDns, HttpDns, OnAddressChangedListe
|
||||
|
||||
@Override
|
||||
public void getHttpDnsIp(String host, int type, boolean useCache, IHttpDnsCallback callback) {
|
||||
Logger.d("MogoHttpDns", "getHttpDnsIp host: " + host + " type: " + type);
|
||||
Map<String, String> map = httpDnsHelper.getAllAddress();
|
||||
if (useCache) {
|
||||
String address = httpDnsHelper.getHttpDnsCachedAddress(type, host);
|
||||
if (address != null) {
|
||||
@@ -61,28 +65,38 @@ public class MogoHttpDns implements IMogoHttpDns, HttpDns, OnAddressChangedListe
|
||||
}
|
||||
}
|
||||
|
||||
private final Map<String, IHttpDnsTtlCallback> ttlCallbackMap = new ArrayMap<>();
|
||||
private final Map<String, List<IHttpDnsTtlCallback>> ttlCallbackMap = new ArrayMap<>();
|
||||
|
||||
@Override
|
||||
public void addHttpDnsTtlCallback(String host, int type, IHttpDnsTtlCallback callback) {
|
||||
ttlCallbackMap.put(type + "-" + host, callback);
|
||||
|
||||
Logger.d("MogoHttpDns", "addHttpDnsTtlCallback: host: " + host + " type: " + type);
|
||||
if (ttlCallbackMap.get(type + "-" + host) == null) {
|
||||
ttlCallbackMap.put(type + "-" + host, new ArrayList<IHttpDnsTtlCallback>());
|
||||
}
|
||||
ttlCallbackMap.get(type + "-" + host).add(callback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeHttpDnsTtlCallback(String host, int type) {
|
||||
ttlCallbackMap.remove(type + "-" + host);
|
||||
// 先不实现
|
||||
// ttlCallbackMap.remove(type + "-" + host);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(final Context context) {
|
||||
httpDnsHelper = new HttpDnsHelper.Builder().setContext(context).setSn(Utils.getSn()).setShowDebugLog(true).setLoopCheckDelay(15 * 60 * 1000).setCurrentLocation(new IHttpDnsCurrentLocation() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Context context, final IHttpDnsLocationChanged locationChanged) {
|
||||
// .setDefaultUrl("dzt.zhidaozhixing.com")
|
||||
httpDnsHelper = new HttpDnsHelper.Builder().setContext(context).setEnv(DebugConfig.getNetMode()).setSn(Utils.getSn()).setShowDebugLog(true).setLoopCheckDelay(15 * 60 * 1000).setCurrentLocation(new IHttpDnsCurrentLocation() {
|
||||
@org.jetbrains.annotations.Nullable
|
||||
@Override
|
||||
public HttpDnsSimpleLocation getCurrentLocation() {
|
||||
MogoLocation last = MogoApisHandler.getInstance().getApis().getMapServiceApi().getSingletonLocationClient(context).getLastKnowLocation();
|
||||
if (last != null) {
|
||||
return new HttpDnsSimpleLocation(last.getCityCode(), last.getLatitude(), last.getLongitude());
|
||||
HttpSimpleLocation simpleLocation = locationChanged.getLocation();
|
||||
if (simpleLocation != null) {
|
||||
return new HttpDnsSimpleLocation("0734", simpleLocation.getLat(), simpleLocation.getLon());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -93,7 +107,18 @@ public class MogoHttpDns implements IMogoHttpDns, HttpDns, OnAddressChangedListe
|
||||
@Override
|
||||
public List<InetAddress> lookup(String hostname) throws UnknownHostException {
|
||||
String cacheIp = httpDnsHelper.getHttpDnsCachedAddress(HTTP_DNS_ADDRESS_TYPE_HTTP, hostname);
|
||||
Logger.d("MogoHttpDnsLook", "lookup host: " + hostname + " cacheIp: " + cacheIp);
|
||||
if (cacheIp == null || TextUtils.isEmpty(cacheIp)) {
|
||||
cacheIp = httpDnsHelper.getHttpDnsAddress(HttpDnsHelper.HTTP_DNS_TYPE_HTTP, hostname);
|
||||
Logger.d("MogoHttpDnsLook", "==== lookup host: " + hostname + " cacheIp: " + cacheIp);
|
||||
if (!TextUtils.isEmpty(cacheIp)) {
|
||||
String[] info = cacheIp.split(":");
|
||||
if (info.length > 1) {
|
||||
return Arrays.asList(InetAddress.getAllByName(info[0]));
|
||||
} else {
|
||||
return Arrays.asList(InetAddress.getAllByName(cacheIp));
|
||||
}
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
String[] info = cacheIp.split(":");
|
||||
@@ -105,13 +130,15 @@ public class MogoHttpDns implements IMogoHttpDns, HttpDns, OnAddressChangedListe
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAddressChanged(@org.jetbrains.annotations.Nullable Map<String, String> map) {
|
||||
public void onAddressChanged(Map<String, String> map) {
|
||||
if (map != null) {
|
||||
for (String key : map.keySet()) {
|
||||
IHttpDnsTtlCallback callback = ttlCallbackMap.get(key);
|
||||
if (callback != null) {
|
||||
callback.onTtl();
|
||||
}else{
|
||||
if (ttlCallbackMap.get(key) != null) {
|
||||
Logger.d("MogoHttpDns", "onAddressChanged key: " + key);
|
||||
for (IHttpDnsTtlCallback callback : ttlCallbackMap.get(key)) {
|
||||
callback.onTtl();
|
||||
}
|
||||
} else {
|
||||
Logger.d("MogoHttpDns", "callback is null: " + key);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,12 +21,6 @@ public class WebSocketConstant {
|
||||
@Keep
|
||||
public static final String PROTOCOL = "ws://";
|
||||
|
||||
private static final String DOMAIN_DEV = "dzt-city.zhidaozhixing.com";
|
||||
private static final String DOMAIN_QA = "dzt-city.zhidaozhixing.com";
|
||||
private static final String DOMAIN_DEMO = "dzt-city.zhidaozhixing.com";
|
||||
@Keep
|
||||
private static final String DOMAIN_RELEASE = "dzt-city.zhidaozhixing.com";
|
||||
|
||||
public static String getSocketServer() {
|
||||
switch (DebugConfig.getNetMode()) {
|
||||
case DebugConfig.NET_MODE_DEV:
|
||||
@@ -41,19 +35,6 @@ public class WebSocketConstant {
|
||||
}
|
||||
}
|
||||
|
||||
public static String getDomain(){
|
||||
switch (DebugConfig.getNetMode()) {
|
||||
case DebugConfig.NET_MODE_DEV:
|
||||
return DOMAIN_DEV;
|
||||
case DebugConfig.NET_MODE_QA:
|
||||
return DOMAIN_QA;
|
||||
case DebugConfig.NET_MODE_DEMO:
|
||||
return DOMAIN_DEMO;
|
||||
case DebugConfig.NET_MODE_RELEASE:
|
||||
default:
|
||||
return DOMAIN_RELEASE;
|
||||
}
|
||||
}
|
||||
|
||||
// public static String getSocketPort() {
|
||||
// return PORT;
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package com.mogo.base.websocket;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.httpdns.HttpDnsConst;
|
||||
import com.mogo.httpdns.IMogoHttpDns;
|
||||
import com.mogo.httpdns.MogoHttpDnsHandler;
|
||||
import com.mogo.module.common.constants.HostConst;
|
||||
import com.mogo.utils.ThreadPoolService;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
@@ -27,17 +28,17 @@ public class WebSocketDnsManager {
|
||||
|
||||
public void getHttpDnsIp(WebSocketDns webSocketDns) {
|
||||
this.webSocketDns = webSocketDns;
|
||||
IMogoHttpDns mogoHttpDns = ARouter.getInstance().navigation(IMogoHttpDns.class);
|
||||
ThreadPoolService.execute(() -> mogoHttpDns.getHttpDnsIp(WebSocketConstant.getDomain(), HttpDnsConst.HTTP_DNS_ADDRESS_TYPE_WS,false, ip -> {
|
||||
IMogoHttpDns mogoHttpDns = MogoHttpDnsHandler.getHttpDnsApi();
|
||||
ThreadPoolService.execute(() -> mogoHttpDns.getHttpDnsIp(HostConst.WEBSOCKET_DOMAIN, HttpDnsConst.HTTP_DNS_ADDRESS_TYPE_WS, false, ip -> {
|
||||
Logger.d(TAG, "getHttpDnsIp ip : " + ip + " , 得到Dns IP,准备回调 初始化webSocket");
|
||||
this.cacheIp = ip;
|
||||
this.webSocketDns.getDnsIp((cacheIp != null ?
|
||||
WebSocketConstant.PROTOCOL + ip + WebSocketConstant.PATH :
|
||||
WebSocketConstant.getSocketServer() + WebSocketConstant.PORT));
|
||||
}));
|
||||
mogoHttpDns.addHttpDnsTtlCallback(WebSocketConstant.getDomain(), HttpDnsConst.HTTP_DNS_ADDRESS_TYPE_WS, () -> {
|
||||
mogoHttpDns.addHttpDnsTtlCallback(HostConst.WEBSOCKET_DOMAIN, HttpDnsConst.HTTP_DNS_ADDRESS_TYPE_WS, () -> {
|
||||
Logger.d(TAG, "ttl callBack ,ready to getCache Dns IP");
|
||||
String dnsCacheIp = mogoHttpDns.getCachedHttpDnsIps(WebSocketConstant.getDomain(),HttpDnsConst.HTTP_DNS_ADDRESS_TYPE_WS);
|
||||
String dnsCacheIp = mogoHttpDns.getCachedHttpDnsIps(HostConst.WEBSOCKET_DOMAIN, HttpDnsConst.HTTP_DNS_ADDRESS_TYPE_WS);
|
||||
if (dnsCacheIp == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -79,6 +79,9 @@ public class WebSocketManager implements IMogoWebSocketManager, ISocketMsgSettin
|
||||
@Override
|
||||
public void ttlIp(String url) {
|
||||
Logger.d(TAG,"ttlIp url : " + url);
|
||||
if(!WebSocketInstanceHolder.getClientProxy().isOpen()){
|
||||
return;
|
||||
}
|
||||
WebSocketInstanceHolder.getClientProxy().stop();
|
||||
WebSocketInstanceHolder.getClientProxy().disConnect();
|
||||
Logger.d(TAG,"ready to re initWebSocket : " + url);
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.mogo.utils.ThreadPoolService;
|
||||
import com.mogo.utils.TipDrawable;
|
||||
import com.mogo.utils.TipToast;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.httpdns.HttpSimpleLocation;
|
||||
import com.mogo.utils.network.NetConfig;
|
||||
|
||||
import java.security.SecureRandom;
|
||||
@@ -88,6 +89,7 @@ public abstract class AbsMogoApplication extends Application {
|
||||
}
|
||||
|
||||
private void syncInit() {
|
||||
MogoHttpDnsHandler.getHttpDnsApi().init(this, this::getCurrentLocation);
|
||||
TipToast.init( this, ( ( context, message, tipDrawable ) -> {
|
||||
if ( TextUtils.isEmpty( message ) ) {
|
||||
return null;
|
||||
@@ -101,6 +103,10 @@ public abstract class AbsMogoApplication extends Application {
|
||||
} ) );
|
||||
}
|
||||
|
||||
protected HttpSimpleLocation getCurrentLocation(){
|
||||
return null;
|
||||
}
|
||||
|
||||
private View generateToastView( Context context, String message, TipDrawable tipDrawable){
|
||||
View contentView;
|
||||
if(tipDrawable==null) {
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.mogo.utils.httpdns;
|
||||
|
||||
public class HttpSimpleLocation {
|
||||
private String cityCode;
|
||||
private double lat;
|
||||
private double lon;
|
||||
|
||||
public HttpSimpleLocation(String cityCode, double lat, double lon) {
|
||||
this.cityCode = cityCode;
|
||||
this.lat = lat;
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
public String getCityCode() {
|
||||
return cityCode;
|
||||
}
|
||||
|
||||
public void setCityCode(String cityCode) {
|
||||
this.cityCode = cityCode;
|
||||
}
|
||||
|
||||
public double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public void setLat(double lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
public void setLon(double lon) {
|
||||
this.lon = lon;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.mogo.utils.network;
|
||||
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
@@ -54,8 +56,10 @@ public final class OkHttpFactory {
|
||||
builder.dns( hostname -> {
|
||||
List< InetAddress > addresses = httpDns.lookup( hostname );
|
||||
if ( addresses != null && !addresses.isEmpty() ) {
|
||||
Logger.d("OkHttpFactory","look up hostname: "+hostname+" address: "+addresses.get(0).getHostAddress());
|
||||
return addresses;
|
||||
}
|
||||
Logger.d("OkHttpFactory","hostname: "+hostname+" no address");
|
||||
return Dns.SYSTEM.lookup( hostname );
|
||||
} );
|
||||
}
|
||||
|
||||
@@ -134,14 +134,14 @@ MOGO_MODULES_SMALL_MAP=1.0.0
|
||||
# httpdns
|
||||
HTTPDNS_TENCENT_VERSION = 2.0.12
|
||||
HTTPDNS_MOGO_VERSION=2.0.12
|
||||
HTTPDNS_BASE_VERSION = 2.0.12
|
||||
HTTPDNS_BASE_VERSION = 2.0.13
|
||||
HTTPDNS_NOOP_VERSION = 2.0.12
|
||||
|
||||
######## 外部依赖引用
|
||||
# 车聊聊
|
||||
CARCHATTING_VERSION=2.2.59
|
||||
CARCHATTING_VERSION=2.2.70
|
||||
# 车聊聊接口
|
||||
CARCHATTINGPROVIDER_VERSION=1.1.10
|
||||
CARCHATTINGPROVIDER_VERSION=1.1.11
|
||||
# websocket
|
||||
WEBSOCKET_VERSION=1.1.7
|
||||
# loglib
|
||||
|
||||
@@ -19,15 +19,6 @@ class HttpConstants {
|
||||
}
|
||||
}
|
||||
|
||||
// fun getBaseUrl1(): String {
|
||||
// return when (BuildConfig.BUILD_TYPE) {
|
||||
// "debug" -> DEV_BASE_URL_OWNER
|
||||
// "qa" -> DEV_BASE_URL_OWNER
|
||||
// "release" -> RELEASE_BASE_URL_OWNER
|
||||
// "show" -> SHOW_BASE_URL_OWNER
|
||||
// else -> RELEASE_BASE_URL_OWNER
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.zhidao.roadcondition.model
|
||||
import android.util.Log
|
||||
import com.google.gson.Gson
|
||||
import com.mogo.commons.network.Utils
|
||||
import com.mogo.module.common.constants.HostConst
|
||||
import com.zhidao.roadcondition.base.BaseRepository
|
||||
import com.zhidao.roadcondition.net.HttpClient
|
||||
import com.zhidao.roadcondition.util.LocationUtil
|
||||
@@ -21,7 +22,7 @@ class StrategyServiceModel : BaseRepository() {
|
||||
locInfo.cityCode
|
||||
)
|
||||
)
|
||||
HttpClient.getInstance().getHttpApi().getCityStrategy(map)
|
||||
HttpClient.getInstance(HostConst.GEOFENCE_HOST).getHttpApi().getCityStrategy(map)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +30,7 @@ class StrategyServiceModel : BaseRepository() {
|
||||
return apiCall {
|
||||
val informationBodyStr = Gson().toJson(informationBody)
|
||||
Log.d("MainServiceController", "uploadInformation informationBody = $informationBodyStr")
|
||||
HttpClient.getInstance().getHttpApi()
|
||||
HttpClient.getInstance(HostConst.DEVA_HOST).getHttpApi()
|
||||
.uploadInformation(mapOf("sn" to Utils.getSn(), "data" to informationBodyStr))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,8 +22,4 @@ interface HttpApi {
|
||||
@POST("/deva/car/path/no/addInfomation/v2")
|
||||
suspend fun uploadInformation(@FieldMap information: Map<String, String>): BaseResponse<UploadResult>
|
||||
|
||||
//获取所有配置
|
||||
@GET("dataService/car/customConfig/no/getAll/v1")
|
||||
suspend fun getAllCommonConfig(@QueryMap commonConfigBody: Map<String, String>):BaseResponse<CommonConfig>
|
||||
|
||||
}
|
||||
@@ -1,8 +1,11 @@
|
||||
package com.zhidao.roadcondition.net
|
||||
|
||||
import android.util.Log
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.utils.network.NetConfig
|
||||
import com.zhidao.roadcondition.constant.HttpConstants
|
||||
import okhttp3.Cache
|
||||
import okhttp3.Dns
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.logging.HttpLoggingInterceptor
|
||||
import retrofit2.Retrofit
|
||||
@@ -67,11 +70,25 @@ class HttpClient private constructor(baseUrl: String) {
|
||||
}
|
||||
|
||||
private fun getOkHttpClient(): OkHttpClient {
|
||||
val builder = OkHttpClient.Builder()
|
||||
val httpLoggingInterceptor = HttpLoggingInterceptor()
|
||||
httpLoggingInterceptor.level = HttpLoggingInterceptor.Level.BODY
|
||||
val cacheFile = File(AbsMogoApplication.getApp().applicationContext.cacheDir, "cache")
|
||||
val cache = Cache(cacheFile, 1024 * 1024 * 50)
|
||||
return OkHttpClient.Builder()
|
||||
|
||||
val httpDns = NetConfig.instance().httpDns
|
||||
if (httpDns != null) {
|
||||
builder.dns(Dns { hostname: String? ->
|
||||
val addresses = httpDns.lookup(hostname)
|
||||
// Log.d("liyz", "addresses 1 = $addresses")
|
||||
if (addresses != null && !addresses.isEmpty()) {
|
||||
return@Dns addresses
|
||||
}
|
||||
Dns.SYSTEM.lookup(hostname)
|
||||
})
|
||||
}
|
||||
|
||||
return builder
|
||||
.addInterceptor(httpLoggingInterceptor)
|
||||
.cache(cache)
|
||||
.connectTimeout(DEFAULT_CONNECT_TIME, TimeUnit.SECONDS)
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.mogo.module.authorize.model
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.mogo.module.authorize.constant.HttpConstant
|
||||
import com.mogo.module.authorize.net.AuthorizeApi
|
||||
import com.mogo.module.common.constants.HostConst
|
||||
import com.mogo.service.IMogoServiceApis
|
||||
import com.mogo.service.MogoServicePaths
|
||||
|
||||
@@ -18,6 +19,6 @@ open class BaseRepository {
|
||||
if (mogoService is IMogoServiceApis) {
|
||||
serviceApi = mogoService
|
||||
}
|
||||
return serviceApi!!.networkApi.createNoCallAdapter(AuthorizeApi::class.java, HttpConstant.getNetHost())
|
||||
return serviceApi!!.networkApi.createNoCallAdapter(AuthorizeApi::class.java, HostConst.CHANNEL_MANAGER_HOST)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.mogo.module.common.constants;
|
||||
|
||||
/**
|
||||
* 通用接口请求host
|
||||
*
|
||||
* @author tong
|
||||
*/
|
||||
public class HostConst {
|
||||
public static final String DEVA_HOST = "http://dzt-deva.zhidaozhixing.com";
|
||||
public static final String IM_HOST = "http://dzt-im.zhidaozhixing.com";
|
||||
public static final String LAUNCHER_SNAPSHOT_HOST = "http://dzt-launcherSnapshot.zhidaozhixing.com";
|
||||
public static final String CHANNEL_MANAGER_HOST = "http://dzt-channelManager.zhidaozhixing.com";
|
||||
public static final String DATA_SERVICE_HOST = "http://dzt-dataService.zhidaozhixing.com";
|
||||
public static final String REALTIME_LOCATION_HOST = "http://dzt-realtimeLocation.zhidaozhixing.com";
|
||||
public static final String INSTANT_HOST = "http://dzt-Instant.zhidaozhixing.com";
|
||||
public static final String GEOFENCE_HOST = "http://dzt-geoFenceCarService.zhidaozhixing.com";
|
||||
public static final String CARLIFE_HOST = "http://dzt-carlife.zhidaozhixing.com";
|
||||
public static final String STRATEGY_PUSH_HOST = "http://dzt-strategyPush.zhidaozhixing.com";
|
||||
public static final String TRAVEL_CONDITION_HOST = "http://dzt-travelCondition.zhidaozhixing.com";
|
||||
public static final String TMC_HOST = "http://dzt-tmcServer.zhidaozhixing.com";
|
||||
|
||||
public static final String IM_SOCKET_DOMAIN = "dzt-im.zhidaozhixing.com";
|
||||
public static final String WEBSOCKET_DOMAIN = "dzt-Instant.zhidaozhixing.com";
|
||||
|
||||
|
||||
}
|
||||
@@ -1062,7 +1062,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
public void onMsgReceived(String obj) {
|
||||
if (mStatusManager.isSeekHelping()) {
|
||||
int seekNum = SharedPrefsMgr.getInstance(getContext()).getInt("seek_help_num", 0);
|
||||
final int finalSeekNum = seekNum++;
|
||||
final int finalSeekNum = ++seekNum;
|
||||
SharedPrefsMgr.getInstance(getContext()).putInt("seek_help_num", seekNum);
|
||||
handler.post(() -> {
|
||||
seekHelpGroup.setVisibility(localIsVrMode ? View.INVISIBLE : View.VISIBLE);
|
||||
|
||||
@@ -9,36 +9,28 @@ import androidx.lifecycle.LifecycleOwner;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.commons.network.SubscribeImpl;
|
||||
import com.mogo.commons.network.Utils;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.constants.HostConst;
|
||||
import com.mogo.module.extensions.R;
|
||||
import com.mogo.module.extensions.bean.CommonConfig;
|
||||
import com.mogo.module.extensions.bean.CommonConfigResponse;
|
||||
import com.mogo.module.extensions.net.DztHttpConstant;
|
||||
import com.mogo.module.extensions.net.GetConfigApiServices;
|
||||
import com.mogo.module.extensions.net.UserInfoNetApiServices;
|
||||
import com.mogo.module.extensions.userinfo.CarModelListResponse;
|
||||
import com.mogo.module.extensions.userinfo.UserInfo;
|
||||
import com.mogo.module.extensions.userinfo.UserInfoConstant;
|
||||
import com.mogo.module.extensions.userinfo.UserInfoResponse;
|
||||
import com.mogo.module.extensions.weather.Phenomena;
|
||||
import com.mogo.module.extensions.weather.WeatherCallback;
|
||||
import com.mogo.module.extensions.weather.WeatherInfo;
|
||||
import com.mogo.module.extensions.weather.WeatherModel;
|
||||
import com.mogo.module.share.constant.HttpConstant;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.network.IMogoNetwork;
|
||||
import com.mogo.service.statusmanager.IMogoMsgCenter;
|
||||
import com.mogo.service.statusmanager.IMogoMsgCenterListener;
|
||||
import com.mogo.utils.DeviceIdUtils;
|
||||
import com.mogo.utils.digest.DigestUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.RequestOptions;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
import com.mogo.utils.storage.SharedPrefsMgr;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.SingleObserver;
|
||||
@@ -143,7 +135,7 @@ public class EntrancePresenter extends Presenter<EntranceView> implements Weathe
|
||||
public void getCommonConfig() {
|
||||
Map<String, Object> params = new ArrayMap<>();
|
||||
params.put("sn", Utils.getSn());
|
||||
mNetWork.create(GetConfigApiServices.class, UserInfoConstant.getUserInfoBaseUrl())
|
||||
mNetWork.create(GetConfigApiServices.class, HostConst.DATA_SERVICE_HOST)
|
||||
.getConfig(params)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
@@ -196,7 +188,7 @@ public class EntrancePresenter extends Presenter<EntranceView> implements Weathe
|
||||
params.put("source", "2");
|
||||
String sign = createSign(params, "JGqZw9");
|
||||
params.put("sig", sign);
|
||||
mNetWork.create(UserInfoNetApiServices.class, UserInfoConstant.getUserInfoBaseUrl()).requestUserInfo(params).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new SingleObserver<UserInfoResponse>() {
|
||||
mNetWork.create(UserInfoNetApiServices.class, HostConst.CARLIFE_HOST).requestUserInfo(params).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new SingleObserver<UserInfoResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
}
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
package com.mogo.module.extensions.net;
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
|
||||
/**
|
||||
* dzt base url
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class DztHttpConstant {
|
||||
public static final String HOST_DEV = "http://dzt-test.zhidaozhixing.com";
|
||||
public static final String HOST_TEST = "http://dzt-test.zhidaozhixing.com";
|
||||
public static final String HOST_DEMO = "http://dzt-show.zhidaozhixing.com";
|
||||
public static final String HOST_PRODUCT = "http://dzt.zhidaozhixing.com";
|
||||
|
||||
public static String getBaseUrl(){
|
||||
switch ( DebugConfig.getNetMode() ) {
|
||||
case DebugConfig.NET_MODE_DEV:
|
||||
return HOST_DEV;
|
||||
case DebugConfig.NET_MODE_QA:
|
||||
return HOST_TEST;
|
||||
case DebugConfig.NET_MODE_DEMO:
|
||||
return HOST_DEMO;
|
||||
default:
|
||||
return HOST_PRODUCT;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package com.mogo.module.extensions.userinfo;
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
|
||||
/**
|
||||
* 个人信息相关常量
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class UserInfoConstant {
|
||||
private static final String DEV_BASE_URL = "http://carlife-dev.zhidaohulian.com/";
|
||||
private static final String QA_BASE_URL = "http://carlife-test.zhidaohulian.com/";
|
||||
private static final String NORMAL_BASE_URL = "http://api.zhidaohulian.com/";
|
||||
|
||||
public static String getUserInfoBaseUrl(){
|
||||
switch (DebugConfig.getNetMode()) {
|
||||
case DebugConfig.NET_MODE_DEV:
|
||||
return DEV_BASE_URL;
|
||||
case DebugConfig.NET_MODE_RELEASE:
|
||||
return NORMAL_BASE_URL;
|
||||
default:
|
||||
return QA_BASE_URL;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,8 +9,11 @@ import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.network.ParamsProvider;
|
||||
import com.mogo.commons.network.SubscribeImpl;
|
||||
import com.mogo.commons.storage.SpStorage;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.constants.HostConst;
|
||||
import com.mogo.module.service.MogoServices;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.module.service.network.RefreshApiService;
|
||||
import com.mogo.module.service.network.bean.HomeCompanyDistanceForPushData;
|
||||
import com.mogo.module.service.network.bean.HomeCompanyDistanceForPushResponse;
|
||||
import com.mogo.module.service.onlinecar.panel.NavigationTargetInfo;
|
||||
@@ -86,7 +89,7 @@ abstract class MainLooperHandler extends Handler {
|
||||
|
||||
final Map< String, Object > query = new ParamsProvider.Builder( AbsMogoApplication.getApp() ).build();
|
||||
query.put( "data", GsonUtil.jsonFromObject( data ) );
|
||||
MogoServices.getInstance().getRefreshModel().getRefreshApiService().calculationNotHomeCompanyDistanceForPush( query )
|
||||
MogoApisHandler.getInstance().getApis().getNetworkApi().create(RefreshApiService.class, HostConst.TRAVEL_CONDITION_HOST).calculationNotHomeCompanyDistanceForPush( query )
|
||||
.subscribeOn( Schedulers.io() )
|
||||
.observeOn( AndroidSchedulers.mainThread() )
|
||||
.subscribe( new SubscribeImpl< HomeCompanyDistanceForPushResponse >( RequestOptions.create( AbsMogoApplication.getApp() ) ) {
|
||||
|
||||
@@ -9,6 +9,8 @@ import com.mogo.commons.network.ParamsProvider;
|
||||
import com.mogo.commons.network.SubscribeImpl;
|
||||
import com.mogo.commons.network.Utils;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.constants.HostConst;
|
||||
import com.mogo.module.common.entity.MarkerResponse;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
@@ -34,37 +36,18 @@ public class RefreshModel {
|
||||
|
||||
private static final String TAG = "RefreshModel";
|
||||
|
||||
public static final String HOST_DEV = "http://dzt-test.zhidaozhixing.com";
|
||||
public static final String HOST_TEST = "http://dzt-test.zhidaozhixing.com";
|
||||
public static final String HOST_DEMO = "http://dzt-show.zhidaozhixing.com";
|
||||
public static final String HOST_PRODUCT = "http://dzt.zhidaozhixing.com";
|
||||
|
||||
private final Context mContext;
|
||||
private RefreshApiService mRefreshApiService;
|
||||
private final RefreshApiService mRefreshApiService;
|
||||
|
||||
public RefreshModel( Context context ) {
|
||||
this.mContext = context;
|
||||
IMogoNetwork network = ( IMogoNetwork ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICES_NETWORK ).navigation( context );
|
||||
this.mRefreshApiService = network.create( RefreshApiService.class, getNetHost() );
|
||||
this.mRefreshApiService = MogoApisHandler.getInstance().getApis().getNetworkApi().create( RefreshApiService.class, HostConst.LAUNCHER_SNAPSHOT_HOST);
|
||||
}
|
||||
|
||||
public RefreshApiService getRefreshApiService() {
|
||||
return mRefreshApiService;
|
||||
}
|
||||
|
||||
public static String getNetHost() {
|
||||
switch ( DebugConfig.getNetMode() ) {
|
||||
case DebugConfig.NET_MODE_DEV:
|
||||
return HOST_DEV;
|
||||
case DebugConfig.NET_MODE_QA:
|
||||
return HOST_TEST;
|
||||
case DebugConfig.NET_MODE_DEMO:
|
||||
return HOST_DEMO;
|
||||
default:
|
||||
return HOST_PRODUCT;
|
||||
}
|
||||
}
|
||||
|
||||
public void refreshExplorerWayData( MogoLatLng latLng, int radius, int limit, final RefreshCallback callback ) {
|
||||
if ( mRefreshApiService != null ) {
|
||||
final Map< String, Object > query = new ParamsProvider.Builder( mContext ).build();
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.mogo.commons.network.ParamsProvider;
|
||||
import com.mogo.commons.network.SubscribeImpl;
|
||||
import com.mogo.commons.network.Utils;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.module.common.constants.HostConst;
|
||||
import com.mogo.module.common.entity.MarkerResponse;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
@@ -33,34 +34,14 @@ public class ZhidaoRefreshModel {
|
||||
|
||||
private static final String TAG = "RefreshModel";
|
||||
|
||||
public static final String HOST_DEV = "http://carlife-test.zhidaohulian.com";
|
||||
public static final String HOST_TEST = "http://carlife-test.zhidaohulian.com";
|
||||
public static final String HOST_DEMO = "http://carlife-test.zhidaohulian.com";
|
||||
public static final String HOST_PRODUCT = "https://api.zhidaohulian.com";
|
||||
|
||||
private final Context mContext;
|
||||
private ZhidaoApiService mRefreshApiService;
|
||||
private final ZhidaoApiService mRefreshApiService;
|
||||
|
||||
public ZhidaoRefreshModel( Context context ) {
|
||||
this.mContext = context;
|
||||
IMogoNetwork network = ( IMogoNetwork ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICES_NETWORK ).navigation( context );
|
||||
this.mRefreshApiService = network.create( ZhidaoApiService.class, getNetHost() );
|
||||
this.mRefreshApiService = network.create( ZhidaoApiService.class, HostConst.CARLIFE_HOST);
|
||||
}
|
||||
|
||||
public ZhidaoApiService getRefreshApiService() {
|
||||
return mRefreshApiService;
|
||||
}
|
||||
|
||||
public static String getNetHost() {
|
||||
switch ( DebugConfig.getNetMode() ) {
|
||||
case DebugConfig.NET_MODE_DEV:
|
||||
return HOST_DEV;
|
||||
case DebugConfig.NET_MODE_QA:
|
||||
return HOST_TEST;
|
||||
case DebugConfig.NET_MODE_DEMO:
|
||||
return HOST_DEMO;
|
||||
default:
|
||||
return HOST_PRODUCT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.network.SubscribeImpl;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.constants.HostConst;
|
||||
import com.mogo.module.service.network.RefreshModel;
|
||||
import com.mogo.module.service.network.bean.TtsConfigEntity;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
@@ -29,8 +31,7 @@ public class TtsConfigModleData {
|
||||
|
||||
|
||||
public TtsConfigModleData() {
|
||||
IMogoNetwork network = (IMogoNetwork) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICES_NETWORK).navigation(getApp().getApplicationContext());
|
||||
mTtsConfigApiService = network.create(TtsConfigApiService.class, RefreshModel.getNetHost());
|
||||
mTtsConfigApiService = MogoApisHandler.getInstance().getApis().getNetworkApi().create(TtsConfigApiService.class, HostConst.DATA_SERVICE_HOST);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
5
modules/mogo-module-share/proguard-rules.pro
vendored
5
modules/mogo-module-share/proguard-rules.pro
vendored
@@ -24,4 +24,7 @@
|
||||
-keep class com.mogo.module.share.bean.**{*;}
|
||||
-keep class com.mogo.module.share.constant.**{*;}
|
||||
-keep class com.mogo.module.share.manager.ISeekHelpListener
|
||||
-keep class com.mogo.module.share.net.ShareApiService
|
||||
-keep class com.mogo.module.share.net.ShareDevaApiService
|
||||
-keep class com.mogo.module.share.net.ShareLsApiService
|
||||
-keep class com.mogo.module.share.net.ShareRtlApiService
|
||||
#-keep class com.mogo.module.share.net.ShareApiService
|
||||
@@ -16,6 +16,7 @@ import com.mogo.module.authorize.authprovider.invoke.AuthorizeConstant;
|
||||
import com.mogo.module.authorize.authprovider.invoke.AuthorizeInvokerConstant;
|
||||
import com.mogo.module.authorize.authprovider.module.IMogoAcquireAuthorizeListener;
|
||||
import com.mogo.module.authorize.authprovider.module.IMogoAuthorizeModuleManager;
|
||||
import com.mogo.module.common.constants.HostConst;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.dialog.BaseFloatDialog;
|
||||
import com.mogo.module.common.utils.CloudPoiManager;
|
||||
@@ -28,7 +29,7 @@ import com.mogo.module.share.constant.ShareConstants;
|
||||
import com.mogo.module.share.dialog.GridFixableShareDialog;
|
||||
import com.mogo.module.share.manager.ServiceApisManager;
|
||||
import com.mogo.module.share.manager.UploadHelper;
|
||||
import com.mogo.module.share.net.ShareApiService;
|
||||
import com.mogo.module.share.net.ShareDevaApiService;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.share.IMogoShareManager;
|
||||
import com.mogo.service.share.IMogoTanluProvider;
|
||||
@@ -458,8 +459,8 @@ public class ShareControl implements IMogoShareManager, Handler.Callback {
|
||||
ShareConfigRequest request = new ShareConfigRequest(Utils.getSn(),
|
||||
location.getAdCode());
|
||||
params.put("data", request.toJson());
|
||||
ServiceApisManager.serviceApis.getNetworkApi().create(ShareApiService.class,
|
||||
HttpConstant.Companion.getNetHost()).queryShareButtonConfig(params).subscribeOn(Schedulers.io()).observeOn(Schedulers.io()).subscribe(new SubscribeImpl<ShareButtonConfigResponse>(RequestOptions.create(mContext)) {
|
||||
ServiceApisManager.serviceApis.getNetworkApi().create(ShareDevaApiService.class,
|
||||
HostConst.DEVA_HOST).queryShareButtonConfig(params).subscribeOn(Schedulers.io()).observeOn(Schedulers.io()).subscribe(new SubscribeImpl<ShareButtonConfigResponse>(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onSuccess(ShareButtonConfigResponse o) {
|
||||
super.onSuccess(o);
|
||||
|
||||
@@ -10,6 +10,10 @@ class HttpConstant {
|
||||
const val HOST_DEMO = "http://dzt-show.zhidaozhixing.com"
|
||||
const val HOST_PRODUCT = "http://dzt.zhidaozhixing.com"
|
||||
|
||||
const val DEVA_HOST = "http://dzt-deva.zhidaozhixing.com"
|
||||
const val RTL_HOST = "http://dzt-realtimeLocation.zhidaozhixing.com"
|
||||
const val LS_HOST = "http://dzt-launcherSnapshot.zhidaozhixing.com"
|
||||
|
||||
|
||||
@JvmStatic
|
||||
fun getNetHost(): String {
|
||||
|
||||
@@ -10,11 +10,12 @@ import com.mogo.commons.network.SubscribeImpl
|
||||
import com.mogo.commons.network.Utils
|
||||
import com.mogo.commons.voice.AIAssist
|
||||
import com.mogo.commons.voice.IMogoVoiceCmdCallBack
|
||||
import com.mogo.module.common.constants.HostConst
|
||||
import com.mogo.module.share.bean.SeekRecord
|
||||
import com.mogo.module.share.bean.SeekRequest
|
||||
import com.mogo.module.share.bean.getJson
|
||||
import com.mogo.module.share.constant.HttpConstant
|
||||
import com.mogo.module.share.net.ShareApiService
|
||||
import com.mogo.module.share.net.ShareRtlApiService
|
||||
import com.mogo.utils.TipToast
|
||||
import com.mogo.utils.logger.Logger
|
||||
import com.mogo.utils.network.RequestOptions
|
||||
@@ -164,7 +165,7 @@ object SeekHelpManager {
|
||||
properties["from"] = from
|
||||
AnalyticsUtils.track("v2x_share_type", properties)
|
||||
|
||||
ServiceApisManager.serviceApis.networkApi.create(ShareApiService::class.java, HttpConstant.getNetHost()).sendHelpSignal(param).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(object : SubscribeImpl<BaseData>(RequestOptions.create(context)) {
|
||||
ServiceApisManager.serviceApis.networkApi.create(ShareRtlApiService::class.java, HostConst.REALTIME_LOCATION_HOST).sendHelpSignal(param).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(object : SubscribeImpl<BaseData>(RequestOptions.create(context)) {
|
||||
override fun onSuccess(o: BaseData?) {
|
||||
super.onSuccess(o)
|
||||
// 接口请求成功,内部同步v2x状态,通知adas,改变自车图标
|
||||
@@ -222,7 +223,7 @@ object SeekHelpManager {
|
||||
fun debugCancelSeek() {
|
||||
val seekRequest = SeekRequest(Utils.getSn(), 0)
|
||||
val param = mutableMapOf("data" to seekRequest.getJson())
|
||||
ServiceApisManager.serviceApis.networkApi.create(ShareApiService::class.java, HttpConstant.getNetHost()).sendHelpSignal(param).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(object : SubscribeImpl<BaseData>(RequestOptions.create(context)) {
|
||||
ServiceApisManager.serviceApis.networkApi.create(ShareRtlApiService::class.java, HostConst.REALTIME_LOCATION_HOST).sendHelpSignal(param).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(object : SubscribeImpl<BaseData>(RequestOptions.create(context)) {
|
||||
override fun onSuccess(o: BaseData?) {
|
||||
super.onSuccess(o)
|
||||
// 接口请求成功,内部同步v2x状态,通知adas,改变自车图标
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
package com.mogo.module.share.net
|
||||
|
||||
import com.mogo.commons.data.BaseData
|
||||
import com.mogo.module.share.bean.AverateSpeedResponse
|
||||
import com.mogo.module.share.bean.BaseDataCompat
|
||||
import com.mogo.module.share.bean.RoadInfos
|
||||
import com.mogo.module.share.bean.ShareButtonConfigResponse
|
||||
import io.reactivex.Observable
|
||||
import okhttp3.RequestBody
|
||||
import retrofit2.http.*
|
||||
|
||||
/**
|
||||
* 分享用到的api接口
|
||||
*/
|
||||
interface ShareApiService {
|
||||
/**
|
||||
* 发起求助接口
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/yycp-realtimeLocations/vehicleTypeManage/car/updateVehicleType/v1")
|
||||
fun sendHelpSignal(@FieldMap param: Map<String, String>): Observable<BaseData>
|
||||
|
||||
/**
|
||||
* 拥堵策略,上报平均速度
|
||||
*/
|
||||
@Headers("Content-type:application/json;charset=UTF-8")
|
||||
@POST("/deva/car/path/no/poiStrategyCheck/v1")
|
||||
fun sendAverageSpeedForBlockStrategy(@Body request: RequestBody, @Query("sn") sn: String): Observable<AverateSpeedResponse>
|
||||
|
||||
/**
|
||||
* 获取分享框服务端配置
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/deva/car/poiType/no/poiTypeList")
|
||||
fun queryShareButtonConfig(@FieldMap param: Map<String, String>): Observable<ShareButtonConfigResponse>
|
||||
|
||||
/**
|
||||
* 查询(搜索)道路事件信息
|
||||
* 接口文档:http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=42305842
|
||||
* 文档中有些参数暂时没有用到,包括radius,limit
|
||||
* @return
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/yycp-launcherSnapshot/launcherSnapshot/searchRoadEventsSync")
|
||||
fun queryRoadInfos(@FieldMap params: Map<String, Any>): Observable<BaseDataCompat<RoadInfos>>
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.mogo.module.share.net;
|
||||
|
||||
import com.mogo.module.share.bean.AverateSpeedResponse;
|
||||
import com.mogo.module.share.bean.ShareButtonConfigResponse;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import okhttp3.RequestBody;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.FieldMap;
|
||||
import retrofit2.http.FormUrlEncoded;
|
||||
import retrofit2.http.Headers;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public interface ShareDevaApiService {
|
||||
/**
|
||||
* 拥堵策略,上报平均速度
|
||||
*/
|
||||
@Headers("Content-type:application/json;charset=UTF-8")
|
||||
@POST("/deva/car/path/no/poiStrategyCheck/v1")
|
||||
Observable<AverateSpeedResponse> sendAverageSpeedForBlockStrategy(@Body RequestBody request, @Query("sn")String sn);
|
||||
|
||||
/**
|
||||
* 获取分享框服务端配置
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/deva/car/poiType/no/poiTypeList")
|
||||
Observable<ShareButtonConfigResponse> queryShareButtonConfig(@FieldMap Map<String, String> param);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.mogo.module.share.net;
|
||||
|
||||
import com.mogo.module.share.bean.BaseDataCompat;
|
||||
import com.mogo.module.share.bean.RoadInfos;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.FieldMap;
|
||||
import retrofit2.http.FormUrlEncoded;
|
||||
import retrofit2.http.POST;
|
||||
|
||||
public interface ShareLsApiService {
|
||||
/**
|
||||
* 查询(搜索)道路事件信息
|
||||
* 接口文档:http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=42305842
|
||||
* 文档中有些参数暂时没有用到,包括radius,limit
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/yycp-launcherSnapshot/launcherSnapshot/searchRoadEventsSync")
|
||||
Observable<BaseDataCompat<RoadInfos>> queryRoadInfos(@FieldMap Map<String, Object> params);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.mogo.module.share.net;
|
||||
|
||||
import com.mogo.commons.data.BaseData;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.FieldMap;
|
||||
import retrofit2.http.FormUrlEncoded;
|
||||
import retrofit2.http.POST;
|
||||
|
||||
public interface ShareRtlApiService {
|
||||
/**
|
||||
* 发起求助接口
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/yycp-realtimeLocations/vehicleTypeManage/car/updateVehicleType/v1")
|
||||
Observable<BaseData> sendHelpSignal(@FieldMap Map<String, String> param );
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import com.mogo.map.search.geo.MogoPoiItem;
|
||||
import com.mogo.map.search.poisearch.IMogoPoiSearch;
|
||||
import com.mogo.map.search.poisearch.MogoPoiResult;
|
||||
import com.mogo.map.search.poisearch.query.MogoPoiSearchQuery;
|
||||
import com.mogo.module.common.constants.HostConst;
|
||||
import com.mogo.module.share.TanluServiceManager;
|
||||
import com.mogo.module.share.bean.BaseDataCompat;
|
||||
import com.mogo.module.share.bean.Location;
|
||||
@@ -54,7 +55,7 @@ public class TanluModelData {
|
||||
public TanluModelData(Context context) {
|
||||
this.mContext = context;
|
||||
IMogoNetwork network = (IMogoNetwork) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICES_NETWORK).navigation(context);
|
||||
mShareApiService = network.create(TanluApiService.class, getBaseUrl());
|
||||
mShareApiService = network.create(TanluApiService.class, HostConst.LAUNCHER_SNAPSHOT_HOST);
|
||||
}
|
||||
|
||||
private String getBaseUrl() {
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.mogo.commons.data.BaseData;
|
||||
import com.mogo.commons.network.ParamsProvider;
|
||||
import com.mogo.commons.network.SubscribeImpl;
|
||||
import com.mogo.commons.network.Utils;
|
||||
import com.mogo.module.common.constants.HostConst;
|
||||
import com.mogo.module.common.entity.RoadTrafficStatus;
|
||||
import com.mogo.module.common.entity.UploadTrafficEntity;
|
||||
import com.mogo.module.share.constant.HttpConstant;
|
||||
@@ -29,7 +30,7 @@ public class TrafficModelData {
|
||||
|
||||
public TrafficModelData() {
|
||||
IMogoNetwork network = (IMogoNetwork) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICES_NETWORK).navigation(getApp().getApplicationContext());
|
||||
mTrafficApiService = network.create(TrafficApiService.class, HttpConstant.getNetHost());
|
||||
mTrafficApiService = network.create(TrafficApiService.class, HostConst.TMC_HOST);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
package com.mogo.module.v2x.network
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
|
||||
class HttpConstant {
|
||||
|
||||
companion object {
|
||||
const val HOST_DEV = "http://dzt-test.zhidaozhixing.com"
|
||||
const val HOST_TEST = "http://dzt-test.zhidaozhixing.com"
|
||||
const val HOST_DEMO = "http://dzt-show.zhidaozhixing.com"
|
||||
const val HOST_PRODUCT = "http://dzt.zhidaozhixing.com"
|
||||
|
||||
fun getNetHost(): String {
|
||||
return when (DebugConfig.getNetMode()) {
|
||||
DebugConfig.NET_MODE_DEV -> HOST_DEV
|
||||
DebugConfig.NET_MODE_QA -> HOST_TEST
|
||||
DebugConfig.NET_MODE_DEMO -> HOST_DEMO
|
||||
else -> HOST_PRODUCT
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
package com.mogo.module.v2x.network;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.module.common.constants.HostConst;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.network.IMogoNetwork;
|
||||
|
||||
/**
|
||||
* 应对不同接口对应不同服务域名的工厂累
|
||||
*/
|
||||
public class V2XApiServiceFactory {
|
||||
|
||||
private static V2XApiService mDevaApiService;
|
||||
private static V2XApiService mDataApiService;
|
||||
private static V2XApiService mLauncherSnapshotApiService;
|
||||
private static V2XApiService mGeoFenceCarServiceApiService;
|
||||
private static V2XApiService mRealtimeLocationApiService;
|
||||
private static V2XApiService mDataServiceApiService;
|
||||
|
||||
/**
|
||||
* 获取指定域名下的 API 服务
|
||||
*/
|
||||
public static V2XApiService getApiService(Context context, String netHost) {
|
||||
IMogoNetwork network = (IMogoNetwork) ARouter.getInstance()
|
||||
.build(MogoServicePaths.PATH_SERVICES_NETWORK)
|
||||
.navigation(context);
|
||||
return network.create(V2XApiService.class, netHost);
|
||||
}
|
||||
|
||||
public static V2XApiService getDevaApiService(Context context) {
|
||||
if (mDevaApiService == null) {
|
||||
synchronized (V2XApiServiceFactory.class) {
|
||||
if (mDevaApiService == null) {
|
||||
mDevaApiService = getApiService(context, HostConst.DEVA_HOST);
|
||||
}
|
||||
}
|
||||
}
|
||||
return mDevaApiService;
|
||||
}
|
||||
|
||||
public static V2XApiService getDataApiService(Context context) {
|
||||
if (mDataApiService == null) {
|
||||
synchronized (V2XApiServiceFactory.class) {
|
||||
if (mDataApiService == null) {
|
||||
mDataApiService = getApiService(context, HostConst.DATA_SERVICE_HOST);
|
||||
}
|
||||
}
|
||||
}
|
||||
return mDataApiService;
|
||||
}
|
||||
|
||||
public static V2XApiService getLauncherSnapshotApiService(Context context) {
|
||||
if (mLauncherSnapshotApiService == null) {
|
||||
synchronized (V2XApiServiceFactory.class) {
|
||||
if (mLauncherSnapshotApiService == null) {
|
||||
mLauncherSnapshotApiService = getApiService(context, HostConst.LAUNCHER_SNAPSHOT_HOST);
|
||||
}
|
||||
}
|
||||
}
|
||||
return mLauncherSnapshotApiService;
|
||||
}
|
||||
|
||||
public static V2XApiService getGeoFenceCarServiceApiService(Context context) {
|
||||
if (mGeoFenceCarServiceApiService == null) {
|
||||
synchronized (V2XApiServiceFactory.class) {
|
||||
if (mGeoFenceCarServiceApiService == null) {
|
||||
mGeoFenceCarServiceApiService = getApiService(context, HostConst.GEOFENCE_HOST);
|
||||
}
|
||||
}
|
||||
}
|
||||
return mGeoFenceCarServiceApiService;
|
||||
}
|
||||
|
||||
public static V2XApiService getRealtimeLocationApiService(Context context) {
|
||||
if (mRealtimeLocationApiService == null) {
|
||||
synchronized (V2XApiServiceFactory.class) {
|
||||
if (mRealtimeLocationApiService == null) {
|
||||
mRealtimeLocationApiService = getApiService(context, HostConst.REALTIME_LOCATION_HOST);
|
||||
}
|
||||
}
|
||||
}
|
||||
return mRealtimeLocationApiService;
|
||||
}
|
||||
|
||||
public static V2XApiService getDataServiceApiService(Context context) {
|
||||
if (mDataServiceApiService == null) {
|
||||
synchronized (V2XApiServiceFactory.class) {
|
||||
if (mDataServiceApiService == null) {
|
||||
mDataServiceApiService = getApiService(context, HostConst.DATA_SERVICE_HOST);
|
||||
}
|
||||
}
|
||||
}
|
||||
return mDataServiceApiService;
|
||||
}
|
||||
public static V2XApiService getStrategyPushApiService(Context context) {
|
||||
if (mDataServiceApiService == null) {
|
||||
synchronized (V2XApiServiceFactory.class) {
|
||||
if (mDataServiceApiService == null) {
|
||||
mDataServiceApiService = getApiService(context, HostConst.STRATEGY_PUSH_HOST);
|
||||
}
|
||||
}
|
||||
}
|
||||
return mDataServiceApiService;
|
||||
}
|
||||
}
|
||||
@@ -85,74 +85,70 @@ public class V2XRefreshModel {
|
||||
|
||||
private void init(Context context) {
|
||||
this.mContext = context;
|
||||
IMogoNetwork network = (IMogoNetwork) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICES_NETWORK).navigation(context);
|
||||
this.mV2XApiService = network.create(V2XApiService.class, HttpConstant.Companion.getNetHost());
|
||||
// IMogoNetwork network = (IMogoNetwork) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICES_NETWORK).navigation(context);
|
||||
// this.mV2XApiService = network.create(V2XApiService.class, HttpConstant.Companion.getNetHost());
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新地图点数据,同步获取
|
||||
*/
|
||||
public void querySnapshotAsync(MogoLatLng latLng, int radius, int limit) {
|
||||
if (mV2XApiService != null) {
|
||||
final Map<String, Object> query = new ParamsProvider.Builder(mContext).build();
|
||||
final RefreshBody refreshBody = new RefreshBody();
|
||||
refreshBody.limit = limit;
|
||||
refreshBody.location = new RefreshBody.LatLon(latLng.lat, latLng.lon);
|
||||
refreshBody.radius = radius;
|
||||
refreshBody.dataType.add(ServiceConst.CARD_TYPE_ROAD_CONDITION);
|
||||
refreshBody.viewPush = true;
|
||||
query.put("data", GsonUtil.jsonFromObject(refreshBody));
|
||||
mV2XApiService.querySnapshotAsync(query)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
super.onSuccess(o);
|
||||
}
|
||||
final Map<String, Object> query = new ParamsProvider.Builder(mContext).build();
|
||||
final RefreshBody refreshBody = new RefreshBody();
|
||||
refreshBody.limit = limit;
|
||||
refreshBody.location = new RefreshBody.LatLon(latLng.lat, latLng.lon);
|
||||
refreshBody.radius = radius;
|
||||
refreshBody.dataType.add(ServiceConst.CARD_TYPE_ROAD_CONDITION);
|
||||
refreshBody.viewPush = true;
|
||||
query.put("data", GsonUtil.jsonFromObject(refreshBody));
|
||||
V2XApiServiceFactory.getLauncherSnapshotApiService(mContext).querySnapshotAsync(query)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
super.onSuccess(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
}
|
||||
});
|
||||
}
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新地图点数据,同步获取
|
||||
*/
|
||||
public void querySnapshotSync(MogoLatLng latLng, int radius, int limit, final V2XRefreshCallback<MarkerResponse> callback) {
|
||||
if (mV2XApiService != null) {
|
||||
final Map<String, Object> query = new ParamsProvider.Builder(mContext).build();
|
||||
final RefreshBody refreshBody = new RefreshBody();
|
||||
refreshBody.limit = limit;
|
||||
refreshBody.location = new RefreshBody.LatLon(latLng.lat, latLng.lon);
|
||||
refreshBody.radius = radius;
|
||||
refreshBody.dataType.add(ServiceConst.CARD_TYPE_ROAD_CONDITION);
|
||||
refreshBody.viewPush = true;
|
||||
query.put("data", GsonUtil.jsonFromObject(refreshBody));
|
||||
mV2XApiService.querySnapshotSync(query)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<MarkerResponse>(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onSuccess(MarkerResponse o) {
|
||||
super.onSuccess(o);
|
||||
if (callback != null) {
|
||||
callback.onSuccess(o);
|
||||
}
|
||||
final Map<String, Object> query = new ParamsProvider.Builder(mContext).build();
|
||||
final RefreshBody refreshBody = new RefreshBody();
|
||||
refreshBody.limit = limit;
|
||||
refreshBody.location = new RefreshBody.LatLon(latLng.lat, latLng.lon);
|
||||
refreshBody.radius = radius;
|
||||
refreshBody.dataType.add(ServiceConst.CARD_TYPE_ROAD_CONDITION);
|
||||
refreshBody.viewPush = true;
|
||||
query.put("data", GsonUtil.jsonFromObject(refreshBody));
|
||||
V2XApiServiceFactory.getLauncherSnapshotApiService(mContext).querySnapshotSync(query)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<MarkerResponse>(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onSuccess(MarkerResponse o) {
|
||||
super.onSuccess(o);
|
||||
if (callback != null) {
|
||||
callback.onSuccess(o);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
if (callback != null) {
|
||||
callback.onFail(message);
|
||||
}
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
if (callback != null) {
|
||||
callback.onFail(message);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -163,34 +159,32 @@ public class V2XRefreshModel {
|
||||
* @param callback 回调
|
||||
*/
|
||||
public void refreshHeartBeat(String sn, String videoChannel, final V2XRefreshCallback callback) {
|
||||
if (mV2XApiService != null) {
|
||||
final Map<String, Object> liveBroadcast = new ParamsProvider.Builder(mContext).build();
|
||||
liveBroadcast.put("sn", sn);
|
||||
liveBroadcast.put("data", GsonUtil.getGson().toJson(new V2XLiveCarBroadcastReq(sn, videoChannel)));
|
||||
mV2XApiService.refreshHeartBeat(liveBroadcast)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
super.onSuccess(o);
|
||||
if (callback != null) {
|
||||
callback.onSuccess(o);
|
||||
}
|
||||
final Map<String, Object> liveBroadcast = new ParamsProvider.Builder(mContext).build();
|
||||
liveBroadcast.put("sn", sn);
|
||||
liveBroadcast.put("data", GsonUtil.getGson().toJson(new V2XLiveCarBroadcastReq(sn, videoChannel)));
|
||||
V2XApiServiceFactory.getDataApiService(mContext).refreshHeartBeat(liveBroadcast)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
super.onSuccess(o);
|
||||
if (callback != null) {
|
||||
callback.onSuccess(o);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
if (callback != null) {
|
||||
if (TextUtils.isEmpty(message)) {
|
||||
message = "网络错误,请稍后重试";
|
||||
}
|
||||
callback.onFail(message);
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
if (callback != null) {
|
||||
if (TextUtils.isEmpty(message)) {
|
||||
message = "网络错误,请稍后重试";
|
||||
}
|
||||
callback.onFail(message);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -200,34 +194,32 @@ public class V2XRefreshModel {
|
||||
* @param callback 回调
|
||||
*/
|
||||
public void giveLikeLiveVideo(final V2XRefreshCallback callback, String snStr) {
|
||||
if (mV2XApiService != null) {
|
||||
Logger.d(V2XConst.MODULE_NAME, "点赞车机:" + snStr);
|
||||
final Map<String, Object> query = new ParamsProvider.Builder(mContext).build();
|
||||
query.put("data", "{\"sn\":" + snStr + "}");
|
||||
mV2XApiService.giveLikeLiveVideo(query)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
super.onSuccess(o);
|
||||
if (callback != null) {
|
||||
callback.onSuccess(o);
|
||||
}
|
||||
Logger.d(V2XConst.MODULE_NAME, "点赞车机:" + snStr);
|
||||
final Map<String, Object> query = new ParamsProvider.Builder(mContext).build();
|
||||
query.put("data", "{\"sn\":" + snStr + "}");
|
||||
V2XApiServiceFactory.getGeoFenceCarServiceApiService(mContext).giveLikeLiveVideo(query)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
super.onSuccess(o);
|
||||
if (callback != null) {
|
||||
callback.onSuccess(o);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
if (callback != null) {
|
||||
if (TextUtils.isEmpty(message)) {
|
||||
message = "网络错误,请稍后重试";
|
||||
}
|
||||
callback.onFail(message);
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
if (callback != null) {
|
||||
if (TextUtils.isEmpty(message)) {
|
||||
message = "网络错误,请稍后重试";
|
||||
}
|
||||
callback.onFail(message);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -236,35 +228,33 @@ public class V2XRefreshModel {
|
||||
* @param sn 目标车机SN
|
||||
*/
|
||||
public void queryUserInfoBySn(String sn, final V2XRefreshCallback<V2XUserInfoRes> callback) {
|
||||
if (mV2XApiService != null) {
|
||||
RequestBody body = RequestBody.create(
|
||||
okhttp3.MediaType.parse("application/json; charset=utf-8"),
|
||||
"{\"sn\":\"" + sn + "\"}");
|
||||
RequestBody body = RequestBody.create(
|
||||
okhttp3.MediaType.parse("application/json; charset=utf-8"),
|
||||
"{\"sn\":\"" + sn + "\"}");
|
||||
|
||||
mV2XApiService.queryUserInfoBySn(body)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<V2XUserInfoRes>(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onSuccess(V2XUserInfoRes o) {
|
||||
super.onSuccess(o);
|
||||
if (callback != null) {
|
||||
callback.onSuccess(o);
|
||||
}
|
||||
V2XApiServiceFactory.getRealtimeLocationApiService(mContext).queryUserInfoBySn(body)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<V2XUserInfoRes>(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onSuccess(V2XUserInfoRes o) {
|
||||
super.onSuccess(o);
|
||||
if (callback != null) {
|
||||
callback.onSuccess(o);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
if (callback != null) {
|
||||
if (TextUtils.isEmpty(message)) {
|
||||
message = "网络错误,请稍后重试";
|
||||
}
|
||||
callback.onFail(message);
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
if (callback != null) {
|
||||
if (TextUtils.isEmpty(message)) {
|
||||
message = "网络错误,请稍后重试";
|
||||
}
|
||||
callback.onFail(message);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -274,49 +264,47 @@ public class V2XRefreshModel {
|
||||
*/
|
||||
public void queryNearbyVehicleLiveByLocation(
|
||||
V2XRefreshCallback<V2XLiveCarRes> callback, double lon, double lat) {
|
||||
if (mV2XApiService != null) {
|
||||
final Map<String, Object> query = new ParamsProvider.Builder(mContext).build();
|
||||
final Map<String, Object> query = new ParamsProvider.Builder(mContext).build();
|
||||
|
||||
StringBuffer dataStr = new StringBuffer();
|
||||
dataStr.append("{");
|
||||
dataStr.append("\"lon\":");
|
||||
dataStr.append(lon);
|
||||
dataStr.append(",");
|
||||
dataStr.append("\"lat\":");
|
||||
dataStr.append(lat);
|
||||
dataStr.append(",");
|
||||
dataStr.append("\"radius\":");
|
||||
dataStr.append(0.5);
|
||||
dataStr.append(",");
|
||||
dataStr.append("\"size\":");
|
||||
dataStr.append(5);
|
||||
dataStr.append("}");
|
||||
StringBuffer dataStr = new StringBuffer();
|
||||
dataStr.append("{");
|
||||
dataStr.append("\"lon\":");
|
||||
dataStr.append(lon);
|
||||
dataStr.append(",");
|
||||
dataStr.append("\"lat\":");
|
||||
dataStr.append(lat);
|
||||
dataStr.append(",");
|
||||
dataStr.append("\"radius\":");
|
||||
dataStr.append(0.5);
|
||||
dataStr.append(",");
|
||||
dataStr.append("\"size\":");
|
||||
dataStr.append(5);
|
||||
dataStr.append("}");
|
||||
|
||||
query.put("data", dataStr.toString());
|
||||
mV2XApiService.queryNearbyVehicleLiveByLocation(query)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<V2XLiveCarRes>(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onSuccess(V2XLiveCarRes o) {
|
||||
super.onSuccess(o);
|
||||
if (callback != null) {
|
||||
callback.onSuccess(o);
|
||||
}
|
||||
query.put("data", dataStr.toString());
|
||||
V2XApiServiceFactory.getRealtimeLocationApiService(mContext).queryNearbyVehicleLiveByLocation(query)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<V2XLiveCarRes>(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onSuccess(V2XLiveCarRes o) {
|
||||
super.onSuccess(o);
|
||||
if (callback != null) {
|
||||
callback.onSuccess(o);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
if (callback != null) {
|
||||
if (TextUtils.isEmpty(message)) {
|
||||
message = "网络错误,请稍后重试";
|
||||
}
|
||||
callback.onFail(message);
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
if (callback != null) {
|
||||
if (TextUtils.isEmpty(message)) {
|
||||
message = "网络错误,请稍后重试";
|
||||
}
|
||||
callback.onFail(message);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -325,38 +313,36 @@ public class V2XRefreshModel {
|
||||
* @param callback 回调
|
||||
*/
|
||||
public void livePush(V2XRefreshCallback<V2XLivePushVoRes> callback, String sn, int playType) {
|
||||
if (mV2XApiService != null) {
|
||||
final Map<String, Object> query = new ParamsProvider.Builder(mContext).build();
|
||||
query.put("data", "{" +
|
||||
"\"eventId\": \"yycp\"," +
|
||||
"\"sn\": \"" + sn + "\"," +
|
||||
"\"type\": \"" + playType + "\"," +
|
||||
"\"videoChannel\": \"C_1\"" +
|
||||
"}");
|
||||
mV2XApiService.livePush(query)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<V2XLivePushVoRes>(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onSuccess(V2XLivePushVoRes o) {
|
||||
super.onSuccess(o);
|
||||
if (callback != null) {
|
||||
callback.onSuccess(o);
|
||||
}
|
||||
final Map<String, Object> query = new ParamsProvider.Builder(mContext).build();
|
||||
query.put("data", "{" +
|
||||
"\"eventId\": \"yycp\"," +
|
||||
"\"sn\": \"" + sn + "\"," +
|
||||
"\"type\": \"" + playType + "\"," +
|
||||
"\"videoChannel\": \"C_1\"" +
|
||||
"}");
|
||||
V2XApiServiceFactory.getDataApiService(mContext).livePush(query)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<V2XLivePushVoRes>(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onSuccess(V2XLivePushVoRes o) {
|
||||
super.onSuccess(o);
|
||||
if (callback != null) {
|
||||
callback.onSuccess(o);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
if (callback != null) {
|
||||
if (TextUtils.isEmpty(message)) {
|
||||
message = "网络错误,请稍后重试";
|
||||
}
|
||||
callback.onFail(message);
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
if (callback != null) {
|
||||
if (TextUtils.isEmpty(message)) {
|
||||
message = "网络错误,请稍后重试";
|
||||
}
|
||||
callback.onFail(message);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -365,40 +351,37 @@ public class V2XRefreshModel {
|
||||
* @param callback
|
||||
*/
|
||||
public void cancelHelpSignal(V2XRefreshCallback<BaseData> callback) {
|
||||
if (mV2XApiService != null) {
|
||||
final Map<String, Object> map = new ParamsProvider.Builder(mContext).build();
|
||||
String json = new StringBuilder()
|
||||
.append("{")
|
||||
.append("\"sn\":").append(Utils.getSn())
|
||||
.append(",")
|
||||
.append("\"vehicleType\":")
|
||||
.append(0)
|
||||
.append("}").toString();
|
||||
map.put("data", json);
|
||||
mV2XApiService.sendHelpSignal(map).subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
super.onSuccess(o);
|
||||
if (callback != null) {
|
||||
callback.onSuccess(o);
|
||||
}
|
||||
final Map<String, Object> map = new ParamsProvider.Builder(mContext).build();
|
||||
String json = new StringBuilder()
|
||||
.append("{")
|
||||
.append("\"sn\":").append(Utils.getSn())
|
||||
.append(",")
|
||||
.append("\"vehicleType\":")
|
||||
.append(0)
|
||||
.append("}").toString();
|
||||
map.put("data", json);
|
||||
V2XApiServiceFactory.getRealtimeLocationApiService(mContext).sendHelpSignal(map).subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
super.onSuccess(o);
|
||||
if (callback != null) {
|
||||
callback.onSuccess(o);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
if (callback != null) {
|
||||
if (TextUtils.isEmpty(message)) {
|
||||
message = "网络错误,请稍后重试";
|
||||
}
|
||||
callback.onFail(message);
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
if (callback != null) {
|
||||
if (TextUtils.isEmpty(message)) {
|
||||
message = "网络错误,请稍后重试";
|
||||
}
|
||||
callback.onFail(message);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -407,33 +390,30 @@ public class V2XRefreshModel {
|
||||
* @param callback
|
||||
*/
|
||||
public void getHelpSignal(V2XRefreshCallback<V2XSeekHelpRes> callback) {
|
||||
if (mV2XApiService != null) {
|
||||
final Map<String, Object> map = new ParamsProvider.Builder(mContext).build();
|
||||
map.put("sn", Utils.getSn());
|
||||
mV2XApiService.queryHelpSignal(map).subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<V2XSeekHelpRes>(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onSuccess(V2XSeekHelpRes o) {
|
||||
super.onSuccess(o);
|
||||
if (callback != null) {
|
||||
callback.onSuccess(o);
|
||||
}
|
||||
final Map<String, Object> map = new ParamsProvider.Builder(mContext).build();
|
||||
map.put("sn", Utils.getSn());
|
||||
V2XApiServiceFactory.getRealtimeLocationApiService(mContext).queryHelpSignal(map).subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<V2XSeekHelpRes>(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onSuccess(V2XSeekHelpRes o) {
|
||||
super.onSuccess(o);
|
||||
if (callback != null) {
|
||||
callback.onSuccess(o);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
if (callback != null) {
|
||||
if (TextUtils.isEmpty(message)) {
|
||||
message = "网络错误,请稍后重试";
|
||||
}
|
||||
callback.onFail(message);
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
if (callback != null) {
|
||||
if (TextUtils.isEmpty(message)) {
|
||||
message = "网络错误,请稍后重试";
|
||||
}
|
||||
callback.onFail(message);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -442,94 +422,88 @@ public class V2XRefreshModel {
|
||||
* @param callback
|
||||
*/
|
||||
public void getMockUserInfos(V2XRefreshCallback<V2XDemoUserInfoRes> callback) {
|
||||
if (mV2XApiService != null) {
|
||||
mV2XApiService.getMockUserInfos().subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<V2XDemoUserInfoRes>(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onSuccess(V2XDemoUserInfoRes o) {
|
||||
super.onSuccess(o);
|
||||
if (callback != null) {
|
||||
callback.onSuccess(o);
|
||||
}
|
||||
V2XApiServiceFactory.getLauncherSnapshotApiService(mContext).getMockUserInfos().subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<V2XDemoUserInfoRes>(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onSuccess(V2XDemoUserInfoRes o) {
|
||||
super.onSuccess(o);
|
||||
if (callback != null) {
|
||||
callback.onSuccess(o);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
if (callback != null) {
|
||||
if (TextUtils.isEmpty(message)) {
|
||||
message = "网络错误,请稍后重试";
|
||||
}
|
||||
callback.onFail(message);
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
if (callback != null) {
|
||||
if (TextUtils.isEmpty(message)) {
|
||||
message = "网络错误,请稍后重试";
|
||||
}
|
||||
callback.onFail(message);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据名称获取策略详情
|
||||
*/
|
||||
public void getStrategyPush(V2XRefreshCallback<V2XStrategyPushRes> callback) {
|
||||
if (mV2XApiService != null) {
|
||||
mV2XApiService.getStrategyPush().subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<V2XStrategyPushRes>(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onSuccess(V2XStrategyPushRes o) {
|
||||
super.onSuccess(o);
|
||||
if (callback != null) {
|
||||
callback.onSuccess(o);
|
||||
}
|
||||
V2XApiServiceFactory.getStrategyPushApiService(mContext).getStrategyPush().subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<V2XStrategyPushRes>(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onSuccess(V2XStrategyPushRes o) {
|
||||
super.onSuccess(o);
|
||||
if (callback != null) {
|
||||
callback.onSuccess(o);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
if (callback != null) {
|
||||
if (TextUtils.isEmpty(message)) {
|
||||
message = "网络错误,请稍后重试";
|
||||
}
|
||||
callback.onFail(message);
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
if (callback != null) {
|
||||
if (TextUtils.isEmpty(message)) {
|
||||
message = "网络错误,请稍后重试";
|
||||
}
|
||||
callback.onFail(message);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 违章地段查询接口
|
||||
*/
|
||||
public void queryIllegalPark(V2XRefreshCallback<MarkerResponse> callback, double lon, double lat) {
|
||||
if (mV2XApiService != null) {
|
||||
final Map<String, Object> map = new ParamsProvider.Builder(mContext).build();
|
||||
String json = "{\"location\":{\"lat\":" + lat + ",\"lon\":" + lon + "},\"radius\":50}";
|
||||
final Map<String, Object> map = new ParamsProvider.Builder(mContext).build();
|
||||
String json = "{\"location\":{\"lat\":" + lat + ",\"lon\":" + lon + "},\"radius\":50}";
|
||||
// String json = "{\"location\":{\"lat\":39.968139,\"lon\":116.380476},\"radius\":1000}";
|
||||
map.put("data", json);
|
||||
mV2XApiService.queryIllegalPark(map).subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<MarkerResponse>(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onSuccess(MarkerResponse o) {
|
||||
super.onSuccess(o);
|
||||
if (callback != null) {
|
||||
callback.onSuccess(o);
|
||||
}
|
||||
map.put("data", json);
|
||||
V2XApiServiceFactory.getLauncherSnapshotApiService(mContext).queryIllegalPark(map).subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<MarkerResponse>(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onSuccess(MarkerResponse o) {
|
||||
super.onSuccess(o);
|
||||
if (callback != null) {
|
||||
callback.onSuccess(o);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
if (callback != null) {
|
||||
if (TextUtils.isEmpty(message)) {
|
||||
message = "网络错误,请稍后重试";
|
||||
}
|
||||
callback.onFail(message);
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
if (callback != null) {
|
||||
if (TextUtils.isEmpty(message)) {
|
||||
message = "网络错误,请稍后重试";
|
||||
}
|
||||
callback.onFail(message);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -539,42 +513,40 @@ public class V2XRefreshModel {
|
||||
String infoId,
|
||||
String poiType,
|
||||
int likeOrDislike) {
|
||||
if (mV2XApiService != null) {
|
||||
final Map<String, Object> map = new ParamsProvider.Builder(mContext).build();
|
||||
String json = new StringBuilder()
|
||||
.append("{")
|
||||
.append("\"infoId\":").append(infoId)
|
||||
.append(",")
|
||||
.append("\"poiType\":").append(poiType)
|
||||
.append(",")
|
||||
.append("\"likeOrdislike\":").append(likeOrDislike)
|
||||
.append(",")
|
||||
.append("\"sn\":").append(Utils.getSn())
|
||||
.append("}").toString();
|
||||
map.put("data", json);
|
||||
mV2XApiService.addPoiInfoFabulous(map).subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
super.onSuccess(o);
|
||||
if (callback != null) {
|
||||
callback.onSuccess(o);
|
||||
}
|
||||
final Map<String, Object> map = new ParamsProvider.Builder(mContext).build();
|
||||
String json = new StringBuilder()
|
||||
.append("{")
|
||||
.append("\"infoId\":").append(infoId)
|
||||
.append(",")
|
||||
.append("\"poiType\":").append(poiType)
|
||||
.append(",")
|
||||
.append("\"likeOrdislike\":").append(likeOrDislike)
|
||||
.append(",")
|
||||
.append("\"sn\":").append(Utils.getSn())
|
||||
.append("}").toString();
|
||||
map.put("data", json);
|
||||
V2XApiServiceFactory.getDevaApiService(mContext).addPoiInfoFabulous(map).subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
super.onSuccess(o);
|
||||
if (callback != null) {
|
||||
callback.onSuccess(o);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
if (callback != null) {
|
||||
if (TextUtils.isEmpty(message)) {
|
||||
message = "网络错误,请稍后重试";
|
||||
}
|
||||
callback.onFail(message);
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
if (callback != null) {
|
||||
if (TextUtils.isEmpty(message)) {
|
||||
message = "网络错误,请稍后重试";
|
||||
}
|
||||
callback.onFail(message);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -583,29 +555,27 @@ public class V2XRefreshModel {
|
||||
* "enthusiasticSn":"testSn02",响应求助SN
|
||||
*/
|
||||
public void respondingToHelp(String seekHelpSn) {
|
||||
if (mV2XApiService != null) {
|
||||
final Map<String, Object> map = new ParamsProvider.Builder(mContext).build();
|
||||
String json = new StringBuilder()
|
||||
.append("{")
|
||||
.append("\"seekHelpSn\":").append(seekHelpSn)
|
||||
.append(",")
|
||||
.append("\"enthusiasticSn\":").append(Utils.getSn())
|
||||
.append("}").toString();
|
||||
map.put("data", json);
|
||||
mV2XApiService.respondingToHelp(map).subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
super.onSuccess(o);
|
||||
}
|
||||
final Map<String, Object> map = new ParamsProvider.Builder(mContext).build();
|
||||
String json = new StringBuilder()
|
||||
.append("{")
|
||||
.append("\"seekHelpSn\":").append(seekHelpSn)
|
||||
.append(",")
|
||||
.append("\"enthusiasticSn\":").append(Utils.getSn())
|
||||
.append("}").toString();
|
||||
map.put("data", json);
|
||||
V2XApiServiceFactory.getDevaApiService(mContext).respondingToHelp(map).subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
super.onSuccess(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
}
|
||||
});
|
||||
}
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -617,62 +587,58 @@ public class V2XRefreshModel {
|
||||
public void manualMarkingTrafficJam(String id,
|
||||
int status,
|
||||
String helpId) {
|
||||
if (mV2XApiService != null) {
|
||||
final Map<String, Object> map = new ParamsProvider.Builder(mContext).build();
|
||||
String json = "{" + "\"id\":\"" + id + "\"," + "\"sn\":\"" + Utils.getSn() + "\"," + "\"status\":" + status + "," + "\"helpId\":\"" + helpId + "\"}";
|
||||
map.put("data", json);
|
||||
mV2XApiService.manualMarkingTrafficJam(map).subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
super.onSuccess(o);
|
||||
}
|
||||
final Map<String, Object> map = new ParamsProvider.Builder(mContext).build();
|
||||
String json = "{" + "\"id\":\"" + id + "\"," + "\"sn\":\"" + Utils.getSn() + "\"," + "\"status\":" + status + "," + "\"helpId\":\"" + helpId + "\"}";
|
||||
map.put("data", json);
|
||||
V2XApiServiceFactory.getDevaApiService(mContext).manualMarkingTrafficJam(map).subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
super.onSuccess(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
}
|
||||
});
|
||||
}
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void queryCrossRoadsLive(V2XRefreshCallback<V2XLiveCrossRoad> callback) {
|
||||
if (mV2XApiService != null) {
|
||||
final Map<String, Object> map = new ParamsProvider.Builder(mContext).build();
|
||||
MogoLocation lastKnowLocation = V2XServiceManager.getMapService().getSingletonLocationClient(AbsMogoApplication.getApp()).getLastKnowLocation();
|
||||
double lat = lastKnowLocation.getLatitude();
|
||||
double lon = lastKnowLocation.getLongitude();
|
||||
String tmpLat = String.valueOf(lat);
|
||||
String tmpLon = String.valueOf(lon);
|
||||
float bearing = lastKnowLocation.getBearing();
|
||||
String json = "{\"lat\":" + tmpLat + ",\"lon\":" + tmpLon + ",\"direction\":" + bearing + "}";
|
||||
map.put("sn", Utils.getSn());
|
||||
map.put("data", json);
|
||||
mV2XApiService.queryCrossRoadsLive(map)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<V2XLiveCrossRoad>(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onSuccess(V2XLiveCrossRoad o) {
|
||||
super.onSuccess(o);
|
||||
if (callback != null) {
|
||||
callback.onSuccess(o);
|
||||
}
|
||||
final Map<String, Object> map = new ParamsProvider.Builder(mContext).build();
|
||||
MogoLocation lastKnowLocation = V2XServiceManager.getMapService().getSingletonLocationClient(AbsMogoApplication.getApp()).getLastKnowLocation();
|
||||
double lat = lastKnowLocation.getLatitude();
|
||||
double lon = lastKnowLocation.getLongitude();
|
||||
String tmpLat = String.valueOf(lat);
|
||||
String tmpLon = String.valueOf(lon);
|
||||
float bearing = lastKnowLocation.getBearing();
|
||||
String json = "{\"lat\":" + tmpLat + ",\"lon\":" + tmpLon + ",\"direction\":" + bearing + "}";
|
||||
map.put("sn", Utils.getSn());
|
||||
map.put("data", json);
|
||||
V2XApiServiceFactory.getGeoFenceCarServiceApiService(mContext).queryCrossRoadsLive(map)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<V2XLiveCrossRoad>(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onSuccess(V2XLiveCrossRoad o) {
|
||||
super.onSuccess(o);
|
||||
if (callback != null) {
|
||||
callback.onSuccess(o);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
if (callback != null) {
|
||||
if (TextUtils.isEmpty(message)) {
|
||||
message = "网络错误,请稍后重试";
|
||||
}
|
||||
callback.onFail(message);
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
if (callback != null) {
|
||||
if (TextUtils.isEmpty(message)) {
|
||||
message = "网络错误,请稍后重试";
|
||||
}
|
||||
callback.onFail(message);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2,13 +2,10 @@ package com.mogo.module.v2x.network;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.data.BaseData;
|
||||
import com.mogo.commons.network.ParamsProvider;
|
||||
import com.mogo.commons.network.SubscribeImpl;
|
||||
import com.mogo.commons.network.Utils;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.network.IMogoNetwork;
|
||||
import com.mogo.utils.network.RequestOptions;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
@@ -26,21 +23,18 @@ import io.reactivex.functions.Function;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
public class V2XShareNetworkModel {
|
||||
private final Context mContext;
|
||||
private V2XApiService mRefreshApiService;
|
||||
private static final String TAG = "V2XShareNetworkModel";
|
||||
private final Context mContext;
|
||||
|
||||
public V2XShareNetworkModel(Context context) {
|
||||
this.mContext = context;
|
||||
IMogoNetwork network = (IMogoNetwork) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICES_NETWORK).navigation(context);
|
||||
this.mRefreshApiService = network.create(V2XApiService.class, HttpConstant.Companion.getNetHost());
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* 两个任务串行
|
||||
* 1.分享次数,热心指数
|
||||
* 2.分享列表
|
||||
* */
|
||||
*/
|
||||
public void getShareEventResponse(int page, int size, V2XRefreshCallback callback) {
|
||||
|
||||
Observable<String> indexObservable = Observable.create(new ObservableOnSubscribe<String>() {
|
||||
@@ -99,9 +93,9 @@ public class V2XShareNetworkModel {
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* 热心指数
|
||||
* */
|
||||
*/
|
||||
public void getShareIndex(V2XRefreshCallback callback) {
|
||||
final ParamsProvider.Builder builder = new ParamsProvider.Builder(mContext);
|
||||
HashMap<String, Object> hashMap = new HashMap<>();
|
||||
@@ -109,7 +103,7 @@ public class V2XShareNetworkModel {
|
||||
builder.append("data", GsonUtil.jsonFromObject(hashMap));
|
||||
Map<String, Object> parameters = builder.build();
|
||||
//热心指数
|
||||
mRefreshApiService.getEnthusiasmIndex(parameters)
|
||||
V2XApiServiceFactory.getDevaApiService(mContext).getEnthusiasmIndex(parameters)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create((mContext))) {
|
||||
@@ -140,9 +134,9 @@ public class V2XShareNetworkModel {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* 分享列表
|
||||
* */
|
||||
*/
|
||||
public void getShareEventList(int page, int size, V2XRefreshCallback callback) {
|
||||
|
||||
final ParamsProvider.Builder builder = new ParamsProvider.Builder(mContext);
|
||||
@@ -153,7 +147,7 @@ public class V2XShareNetworkModel {
|
||||
builder.append("data", GsonUtil.jsonFromObject(hashMap));
|
||||
Map<String, Object> parameters = builder.build();
|
||||
|
||||
mRefreshApiService.getShareEventList(parameters)
|
||||
V2XApiServiceFactory.getDevaApiService(mContext).getShareEventList(parameters)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(mContext)) {
|
||||
|
||||
@@ -12,11 +12,11 @@ import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.commons.network.SubscribeImpl;
|
||||
import com.mogo.commons.network.Utils;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.module.common.constants.HostConst;
|
||||
import com.mogo.module.v2x.entity.panel.Center;
|
||||
import com.mogo.module.v2x.entity.panel.SurroundingRequest;
|
||||
import com.mogo.module.v2x.entity.panel.SurroundingResponse;
|
||||
import com.mogo.module.v2x.network.HttpConstant;
|
||||
import com.mogo.module.v2x.network.V2XApiService;
|
||||
import com.mogo.module.v2x.network.V2XApiServiceFactory;
|
||||
import com.mogo.module.v2x.view.SurroundingEventView;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
@@ -38,7 +38,6 @@ public class SurroundingEventPresenter extends Presenter<SurroundingEventView> {
|
||||
private Context mContext;
|
||||
private IMogoNetwork mNetWork;
|
||||
private IMogoServiceApis mApis;
|
||||
private V2XApiService eventApiService;
|
||||
private static final String TAG = "V2XSurroundingFragment";
|
||||
|
||||
|
||||
@@ -48,7 +47,6 @@ public class SurroundingEventPresenter extends Presenter<SurroundingEventView> {
|
||||
mNetWork =
|
||||
((IMogoServiceApis) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(view.getContext())).getNetworkApi();
|
||||
mApis = (IMogoServiceApis) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(getContext());
|
||||
this.eventApiService = mNetWork.create(V2XApiService.class, HttpConstant.Companion.getNetHost());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -65,7 +63,7 @@ public class SurroundingEventPresenter extends Presenter<SurroundingEventView> {
|
||||
String[] poiTypes = {"10002", "10003", "10006", "10007", "10008", "10010", "10011", "10013", "10015"};
|
||||
SurroundingRequest request = new SurroundingRequest(center, poiTypes, 5, 300);
|
||||
|
||||
eventApiService.getSurroundingEventList(Utils.getSn(), convert(GsonUtil.jsonFromObject(request)))
|
||||
V2XApiServiceFactory.getDevaApiService(mContext).getSurroundingEventList(Utils.getSn(), convert(GsonUtil.jsonFromObject(request)))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<SurroundingResponse>(RequestOptions.create(getContext())) {
|
||||
|
||||
Reference in New Issue
Block a user