Merge remote-tracking branch 'origin/dev_1.1.9' into dev_1.1.9

This commit is contained in:
wujifei
2020-12-24 17:42:11 +08:00
38 changed files with 1038 additions and 586 deletions

View File

@@ -0,0 +1,64 @@
package com.mogo.module.common.utils;
import android.content.Context;
import com.mogo.commons.network.Utils;
import com.mogo.httpdnshelper.sdk.HttpDnsHelper;
import com.mogo.httpdnshelper.sdk.IHttpDnsConfig;
import com.mogo.httpdnshelper.sdk.bean.HttpDnsSimpleLocation;
import com.mogo.map.location.MogoLocation;
import com.mogo.module.common.MogoApisHandler;
import org.jetbrains.annotations.NotNull;
/**
* MogoHttpDnsHelper包装类
*
* @author tongchenfei
*/
public class MogoHttpDnsUtil {
private MogoHttpDnsUtil(){
}
private final static MogoHttpDnsUtil INSTANCE = new MogoHttpDnsUtil();
public static MogoHttpDnsUtil getInstance(){
return INSTANCE;
}
public void init(Context context){
HttpDnsHelper.INSTANCE.init(context, new IHttpDnsConfig() {
@NotNull
@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());
}
return null;
}
@Override
public boolean showDebugLog() {
return true;
}
@NotNull
@Override
public String getSn() {
return Utils.getSn();
}
});
}
public String getHttpAddress(){
return HttpDnsHelper.INSTANCE.getHttpDnsAddress(HttpDnsHelper.HTTP_DNS_TYPE_HTTP);
}
public String getWsAddress(){
return HttpDnsHelper.INSTANCE.getHttpDnsAddress(HttpDnsHelper.HTTP_DNS_TYPE_WS);
}
public void release(){
HttpDnsHelper.INSTANCE.release();
}
}