Merge branch 'dev_MogoAP_eagle-220_211207_8.0.15'
This commit is contained in:
@@ -3,10 +3,10 @@ package com.mogo.eagle.core.function.check.net
|
||||
import android.content.Context
|
||||
import com.elegant.network.ParamsBuilder
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.commons.network.SubscribeImpl
|
||||
import com.mogo.eagle.core.function.check.api.ICheckResultCallBack
|
||||
import com.mogo.eagle.core.network.RequestOptions
|
||||
import com.mogo.eagle.core.network.SubscribeImpl
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.utils.network.RequestOptions
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ import com.mogo.eagle.core.function.call.map.CallerSmpManager
|
||||
import com.mogo.eagle.core.function.call.obu.CallerOBUManager
|
||||
import com.mogo.eagle.core.function.call.obu.CallerObuListenerManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.LogLevel
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.utilcode.util.AppUtils
|
||||
@@ -39,7 +40,6 @@ import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.map.MogoMap
|
||||
import com.mogo.utils.DeviceIdUtils
|
||||
import com.mogo.utils.UiThreadHandler
|
||||
import com.mogo.utils.network.utils.GsonUtil
|
||||
import com.mogo.utils.storage.SharedPrefsMgr
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.*
|
||||
|
||||
|
||||
@@ -6,10 +6,10 @@ import android.util.Log;
|
||||
import com.mogo.eagle.core.data.notice.NoticeNormalData;
|
||||
import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData;
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.service.cloud.socket.IMogoOnMessageListener;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
/**
|
||||
* @author Jing
|
||||
|
||||
@@ -1,30 +1,23 @@
|
||||
package com.mogo.eagle.core.function.notice.network;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.ArrayMap;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.mogo.cloud.network.NetConstants;
|
||||
import com.mogo.cloud.network.RetrofitFactory;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClient;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.network.ParamsProvider;
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
import com.mogo.eagle.core.data.notice.NoticeNormalDetail;
|
||||
import com.mogo.eagle.core.data.notice.NoticeTrafficStyleInfo;
|
||||
|
||||
import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData;
|
||||
import com.mogo.eagle.core.function.api.notice.NoticeNetCallBack;
|
||||
import com.mogo.module.common.drawer.PushRoadConditionDrawer;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.Scheduler;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.annotations.NonNull;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
@@ -56,7 +56,6 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.adasHigh
|
||||
|
||||
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
|
||||
implementation rootProject.ext.dependencies.mogoutils //TODO 待将util中网络请求部分转移完毕后解除依赖关系
|
||||
implementation rootProject.ext.dependencies.modulecommon
|
||||
|
||||
implementation rootProject.ext.dependencies.mogo_core_data
|
||||
@@ -64,7 +63,6 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.mogo_core_function_api
|
||||
implementation rootProject.ext.dependencies.mogo_core_function_call
|
||||
} else {
|
||||
implementation project(":foudations:mogo-utils") //TODO 待将util中网络请求部分转移完毕后解除依赖关系
|
||||
implementation project(':modules:mogo-module-common')
|
||||
|
||||
implementation project(':core:mogo-core-data')
|
||||
|
||||
@@ -4,11 +4,12 @@ import com.google.gson.Gson
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.eagle.core.data.BaseResponse
|
||||
import com.mogo.eagle.core.data.trafficlight.*
|
||||
import com.mogo.eagle.core.network.apiCall
|
||||
import com.mogo.eagle.core.network.cancel
|
||||
import com.mogo.eagle.core.network.request
|
||||
import com.mogo.module.common.MogoApisHandler
|
||||
import com.mogo.module.common.constants.HostConst.CITY_HOST
|
||||
import com.mogo.utils.network.apiCall
|
||||
import com.mogo.utils.network.cancel
|
||||
import com.mogo.utils.network.request
|
||||
|
||||
|
||||
class TrafficLightNetWorkModel {
|
||||
|
||||
|
||||
@@ -3,10 +3,11 @@ package com.mogo.eagle.core.function.v2x.vip.network
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.eagle.core.data.BaseResponse
|
||||
import com.mogo.eagle.core.data.v2x.VipRequest
|
||||
import com.mogo.eagle.core.network.apiCall
|
||||
import com.mogo.eagle.core.network.request
|
||||
import com.mogo.module.common.MogoApisHandler
|
||||
import com.mogo.module.common.constants.HostConst.DATA_SERVICE_HOST
|
||||
import com.mogo.utils.network.apiCall
|
||||
import com.mogo.utils.network.request
|
||||
|
||||
|
||||
class VipNetWorkModel {
|
||||
|
||||
|
||||
@@ -44,7 +44,6 @@ dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation rootProject.ext.dependencies.kotlinstdlibjdk7
|
||||
|
||||
implementation rootProject.ext.dependencies.kotlinstdlibjdk7
|
||||
implementation rootProject.ext.dependencies.androidxccorektx
|
||||
implementation rootProject.ext.dependencies.androidxappcompat
|
||||
implementation rootProject.ext.dependencies.androidxrecyclerview
|
||||
@@ -55,10 +54,20 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.videojava
|
||||
implementation rootProject.ext.dependencies.livesdk
|
||||
|
||||
implementation rootProject.ext.dependencies.glideokhttp3
|
||||
implementation rootProject.ext.dependencies.gson
|
||||
implementation rootProject.ext.dependencies.androidxappcompat
|
||||
implementation rootProject.ext.dependencies.coroutinescore
|
||||
implementation rootProject.ext.dependencies.coroutinesandroid
|
||||
|
||||
api rootProject.ext.dependencies.mogoaicloudnetwork
|
||||
|
||||
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
|
||||
implementation rootProject.ext.dependencies.mogo_core_utils
|
||||
implementation rootProject.ext.dependencies.mogo_core_data
|
||||
} else {
|
||||
implementation project(':core:mogo-core-utils')
|
||||
implementation project(':core:mogo-core-data')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mogo.eagle.core.network">
|
||||
package="com.haoyisheng.mobile.mogo_core_network">
|
||||
|
||||
</manifest>
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.commons.network;
|
||||
package com.mogo.eagle.core.network;
|
||||
|
||||
import javax.net.ssl.HostnameVerifier;
|
||||
import javax.net.ssl.SSLSession;
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.mogo.utils.network;
|
||||
package com.mogo.eagle.core.network;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
@@ -1,10 +1,10 @@
|
||||
package com.mogo.utils.network;
|
||||
package com.mogo.eagle.core.network;
|
||||
|
||||
|
||||
|
||||
public class CallerNotAliveException extends Exception {
|
||||
|
||||
public CallerNotAliveException( String message){
|
||||
public CallerNotAliveException(String message){
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.utils.network;
|
||||
package com.mogo.eagle.core.network;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.utils.network;
|
||||
package com.mogo.eagle.core.network;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.commons.network;
|
||||
package com.mogo.eagle.core.network;
|
||||
|
||||
public interface Constants {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package com.mogo.utils.network
|
||||
package com.mogo.eagle.core.network
|
||||
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import com.mogo.eagle.core.data.BaseResponse
|
||||
import com.mogo.utils.network.exception.ApiException
|
||||
import com.mogo.utils.network.exception.CommonException.Companion.NETWORK_EXCEPTION
|
||||
import com.mogo.utils.network.exception.CommonException.Companion.NULL_EXCEPTION
|
||||
import com.mogo.utils.network.exception.CommonException.Companion.NULL_REQUEST_DATA_API_EXCEPTION
|
||||
import com.mogo.eagle.core.network.exception.ApiException
|
||||
import com.mogo.eagle.core.network.exception.CommonException.Companion.NETWORK_EXCEPTION
|
||||
import com.mogo.eagle.core.network.exception.CommonException.Companion.NULL_EXCEPTION
|
||||
import com.mogo.eagle.core.network.exception.CommonException.Companion.NULL_REQUEST_DATA_API_EXCEPTION
|
||||
import kotlinx.coroutines.*
|
||||
import java.net.SocketTimeoutException
|
||||
import java.net.UnknownHostException
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.utils.network;
|
||||
package com.mogo.eagle.core.network;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
@@ -1,4 +1,5 @@
|
||||
package com.mogo.utils.network;
|
||||
package com.mogo.eagle.core.network;
|
||||
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
@@ -1,11 +1,8 @@
|
||||
package com.mogo.commons.network;
|
||||
package com.mogo.eagle.core.network;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.BaseParams;
|
||||
import com.mogo.utils.network.HttpParams;
|
||||
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
|
||||
/**
|
||||
* Created by congtaowang on 2018/10/21.
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.commons.network;
|
||||
package com.mogo.eagle.core.network;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -1,25 +1,27 @@
|
||||
package com.mogo.utils.network;
|
||||
package com.mogo.eagle.core.network;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.cloud.passport.SpStorage;
|
||||
|
||||
import androidx.collection.ArraySet;
|
||||
|
||||
import java.security.SecureRandom;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.net.ssl.HostnameVerifier;
|
||||
import javax.net.ssl.SSLContext;
|
||||
import javax.net.ssl.SSLSession;
|
||||
import javax.net.ssl.TrustManager;
|
||||
|
||||
import okhttp3.Interceptor;
|
||||
import okhttp3.internal.tls.OkHostnameVerifier;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* This is a configuration class provided for clients.For better extension and customization,client can set customized parameters of network
|
||||
* based on their own application. However you should set these parameters before you get the global instance
|
||||
* of {@link okhttp3.OkHttpClient} by {@link OkHttpFactory} for the first time.<p/>
|
||||
* <p>
|
||||
* Some of the parameters have default values, so there is not a must to use this class.<p/>
|
||||
*/
|
||||
@@ -31,6 +33,7 @@ public final class NetConfig {
|
||||
|
||||
private final Set< Interceptor > interceptors = new ArraySet<>();
|
||||
private final Set< Interceptor > networkInterceptors = new ArraySet<>();
|
||||
|
||||
private final HostnameVerifier allowAllHostnameVerifier = new HostnameVerifier() {
|
||||
@Override
|
||||
public boolean verify( String hostname, SSLSession session ) {
|
||||
@@ -55,6 +58,7 @@ public final class NetConfig {
|
||||
private static final NetConfig INSTANCE = new NetConfig();
|
||||
}
|
||||
|
||||
|
||||
public static NetConfig instance() {
|
||||
return SingletonHolder.INSTANCE;
|
||||
}
|
||||
@@ -152,8 +156,16 @@ public final class NetConfig {
|
||||
return appContext;
|
||||
}
|
||||
|
||||
public synchronized SSLContext getSslContext() {
|
||||
return sslContext;
|
||||
/**
|
||||
* 忽略 https 验证
|
||||
* @return {@link SSLContext}
|
||||
* @throws Exception
|
||||
*/
|
||||
public static SSLContext getSslContext() throws Exception {
|
||||
SSLContext sc;
|
||||
sc = SSLContext.getInstance("SSL");
|
||||
sc.init(null, new TrustManager[]{new X509TrustManagerImpl()}, new SecureRandom());
|
||||
return sc;
|
||||
}
|
||||
|
||||
public synchronized void setSslContext( SSLContext sslContext ) {
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.utils.network;
|
||||
package com.mogo.eagle.core.network;
|
||||
|
||||
|
||||
public class NetConstants {
|
||||
@@ -1,15 +1,13 @@
|
||||
package com.mogo.utils.network;
|
||||
package com.mogo.eagle.core.network;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.KeyEvent;
|
||||
|
||||
|
||||
import com.mogo.utils.network.utils.Util;
|
||||
import com.mogo.eagle.core.network.utils.Util;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
public class RequestOptions {
|
||||
private static final String DEFAULT_LOADING_MESSAGE = "正在加载中...";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.utils.network;
|
||||
package com.mogo.eagle.core.network;
|
||||
|
||||
|
||||
import retrofit2.Retrofit;
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.commons.network;
|
||||
package com.mogo.eagle.core.network;
|
||||
|
||||
class ServerParam {
|
||||
public class ServerParam {
|
||||
public static final String SIGNATURE = "sig";
|
||||
|
||||
public static final String LAT = "lat";
|
||||
public static final String LNG = "lng";
|
||||
@@ -44,4 +45,5 @@ class ServerParam {
|
||||
public static final String PHONE = "phone";
|
||||
public static final String TICKET = "ticket";
|
||||
|
||||
|
||||
}
|
||||
@@ -1,9 +1,8 @@
|
||||
package com.mogo.commons.network;
|
||||
package com.mogo.eagle.core.network;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.RequestOptions;
|
||||
import com.mogo.utils.network.utils.Util;
|
||||
import com.mogo.eagle.core.network.utils.Util;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
@@ -19,11 +18,11 @@ public abstract class SubscribeImpl< T extends BaseData> implements Observer< T
|
||||
private static final String TAG = "SubscribeImpl";
|
||||
private boolean mAutoTipMsg = true;
|
||||
|
||||
public SubscribeImpl( RequestOptions requestOptions ) {
|
||||
public SubscribeImpl(RequestOptions requestOptions ) {
|
||||
mRequestOptions = requestOptions;
|
||||
}
|
||||
|
||||
public SubscribeImpl( RequestOptions requestOptions, boolean autoTipMsg ) {
|
||||
public SubscribeImpl(RequestOptions requestOptions, boolean autoTipMsg ) {
|
||||
this( requestOptions );
|
||||
mAutoTipMsg = autoTipMsg;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.commons.network;
|
||||
package com.mogo.eagle.core.network;
|
||||
|
||||
import java.security.cert.CertificateException;
|
||||
import java.security.cert.X509Certificate;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.utils.network.exception
|
||||
package com.mogo.eagle.core.network.exception
|
||||
|
||||
class ApiException : CommonException {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.utils.network.exception
|
||||
package com.mogo.eagle.core.network.exception
|
||||
|
||||
open class CommonException :Exception{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
package com.mogo.utils.network.utils;
|
||||
package com.mogo.eagle.core.network.utils;
|
||||
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
@@ -10,7 +11,6 @@ import org.json.JSONObject;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class GsonUtil {
|
||||
|
||||
private static volatile Gson gson;
|
||||
@@ -56,7 +56,7 @@ public class GsonUtil {
|
||||
}
|
||||
|
||||
|
||||
public static <T> List<T> arrayFromJson( String json, Class<T> clazz) {
|
||||
public static <T> List<T> arrayFromJson(String json, Class<T> clazz) {
|
||||
List<T> list = new ArrayList<T>();
|
||||
if ( TextUtils.isEmpty(json)) {
|
||||
return null;
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.mogo.utils.network.utils;
|
||||
package com.mogo.eagle.core.network.utils;
|
||||
|
||||
|
||||
import com.mogo.utils.digest.DigestUtils;
|
||||
import com.mogo.utils.network.HttpParams;
|
||||
import com.mogo.eagle.core.network.HttpParams;
|
||||
import com.mogo.eagle.core.network.utils.digest.DigestUtils;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
@@ -14,7 +14,6 @@ import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
|
||||
public class SignUtil {
|
||||
|
||||
private static class StrSortTreeMap extends TreeMap< String, Object > {
|
||||
@@ -30,7 +29,7 @@ public class SignUtil {
|
||||
}
|
||||
}
|
||||
|
||||
public static String createSign( Map< String, Object > map, String key) {
|
||||
public static String createSign(Map< String, Object > map, String key) {
|
||||
if (map == null || map.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
package com.mogo.utils.network.utils;
|
||||
package com.mogo.eagle.core.network.utils;
|
||||
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
@@ -10,22 +11,22 @@ import android.os.Looper;
|
||||
import android.view.View;
|
||||
import android.widget.PopupWindow;
|
||||
|
||||
import com.mogo.utils.network.CallerNotAliveException;
|
||||
import com.mogo.eagle.core.network.CallerNotAliveException;
|
||||
|
||||
public class Util {
|
||||
|
||||
public static boolean checkAlive( Object caller ) {
|
||||
if ( caller instanceof Activity ) {
|
||||
if ( caller instanceof Activity) {
|
||||
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 ? !( ( Activity ) caller ).isDestroyed() : !( ( Activity ) caller ).isFinishing();
|
||||
} else if ( caller instanceof Fragment ) {
|
||||
} else if ( caller instanceof Fragment) {
|
||||
return ( ( Fragment ) caller ).isAdded();
|
||||
} else if ( caller instanceof androidx.fragment.app.Fragment ) {
|
||||
return ( ( androidx.fragment.app.Fragment ) caller ).isAdded();
|
||||
} else if ( caller instanceof View ) {
|
||||
} else if ( caller instanceof View) {
|
||||
return true;
|
||||
} else if ( caller instanceof Dialog ) {
|
||||
} else if ( caller instanceof Dialog) {
|
||||
return ( ( Dialog ) caller ).getWindow() != null;
|
||||
} else if ( caller instanceof PopupWindow ) {
|
||||
} else if ( caller instanceof PopupWindow) {
|
||||
return ( ( PopupWindow ) caller ).getContentView() != null;
|
||||
}
|
||||
return caller != null;
|
||||
@@ -37,7 +38,7 @@ public class Util {
|
||||
}
|
||||
}
|
||||
|
||||
public static Context getContext( Object object ) {
|
||||
public static Context getContext(Object object ) {
|
||||
if ( object instanceof Activity ) {
|
||||
return ( Activity ) object;
|
||||
} else if ( object instanceof Fragment ) {
|
||||
@@ -52,7 +53,7 @@ public class Util {
|
||||
if ( ( ( PopupWindow ) object ).getContentView() != null )
|
||||
return ( ( PopupWindow ) object ).getContentView().getContext();
|
||||
else return null;
|
||||
} else if ( object instanceof ContextWrapper ) {
|
||||
} else if ( object instanceof ContextWrapper) {
|
||||
return ( ( ContextWrapper ) object ).getBaseContext();
|
||||
} else {
|
||||
return null;
|
||||
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.mogo.utils.digest;
|
||||
package com.mogo.eagle.core.network.utils.digest;
|
||||
|
||||
/**
|
||||
* Defines common decoding methods for byte array decoders.
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.mogo.eagle.core.network.utils.digest;
|
||||
|
||||
public interface BinaryEncoder extends Encoder {
|
||||
|
||||
/**
|
||||
* Encodes a byte array and return the encoded data as a byte array.
|
||||
*
|
||||
* @param source
|
||||
* Data to be encoded
|
||||
* @return A byte array containing the encoded data
|
||||
* @throws EncoderException
|
||||
* thrown if the Encoder encounters a failure condition during the encoding process.
|
||||
*/
|
||||
byte[] encode( byte[] source ) throws EncoderException;
|
||||
}
|
||||
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.mogo.utils.digest;
|
||||
package com.mogo.eagle.core.network.utils.digest;
|
||||
|
||||
/**
|
||||
* Character encoding names required of every implementation of the Java platform.
|
||||
@@ -14,7 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.mogo.utils.digest;
|
||||
package com.mogo.eagle.core.network.utils.digest;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.mogo.utils.digest;
|
||||
package com.mogo.eagle.core.network.utils.digest;
|
||||
|
||||
/**
|
||||
* Provides the highest level of abstraction for Decoders.
|
||||
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.mogo.utils.digest;
|
||||
package com.mogo.eagle.core.network.utils.digest;
|
||||
|
||||
/**
|
||||
* Thrown when there is a failure condition during the decoding process. This exception is thrown when a {@link Decoder}
|
||||
@@ -66,7 +66,7 @@ public class DecoderException extends Exception {
|
||||
* value is permitted, and indicates that the cause is nonexistent or unknown.
|
||||
* @since 1.4
|
||||
*/
|
||||
public DecoderException( final String message, final Throwable cause) {
|
||||
public DecoderException(final String message, final Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.mogo.utils.digest;
|
||||
package com.mogo.eagle.core.network.utils.digest;
|
||||
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -44,7 +44,7 @@ public class DigestUtils {
|
||||
* @throws IOException
|
||||
* On error reading from the stream
|
||||
*/
|
||||
private static byte[] digest( final MessageDigest digest, final InputStream data) throws IOException {
|
||||
private static byte[] digest(final MessageDigest digest, final InputStream data) throws IOException {
|
||||
return updateDigest(digest, data).digest();
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.mogo.utils.digest;
|
||||
package com.mogo.eagle.core.network.utils.digest;
|
||||
|
||||
/**
|
||||
* Provides the highest level of abstraction for Encoders.
|
||||
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.mogo.utils.digest;
|
||||
package com.mogo.eagle.core.network.utils.digest;
|
||||
|
||||
/**
|
||||
* Thrown when there is a failure condition during the encoding process. This exception is thrown when an
|
||||
@@ -69,7 +69,7 @@ public class EncoderException extends Exception {
|
||||
* value is permitted, and indicates that the cause is nonexistent or unknown.
|
||||
* @since 1.4
|
||||
*/
|
||||
public EncoderException( final String message, final Throwable cause) {
|
||||
public EncoderException(final String message, final Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
@@ -15,11 +15,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.mogo.utils.digest;
|
||||
package com.mogo.eagle.core.network.utils.digest;
|
||||
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
import kotlin.text.Charsets;
|
||||
|
||||
/**
|
||||
* Converts hexadecimal Strings. The charset used for certain operation can be set, the default is set in
|
||||
* {@link #DEFAULT_CHARSET_NAME}
|
||||
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.mogo.utils.digest;
|
||||
package com.mogo.eagle.core.network.utils.digest;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
|
||||
@@ -15,12 +15,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.mogo.utils.digest;
|
||||
|
||||
package com.mogo.eagle.core.network.utils.digest;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
import kotlin.text.Charsets;
|
||||
|
||||
/**
|
||||
* Converts String to and from bytes using the encodings required by the Java specification. These encodings are
|
||||
* specified in <a href="http://download.oracle.com/javase/6/docs/api/java/nio/charset/Charset.html">
|
||||
@@ -52,6 +52,7 @@ dependencies {
|
||||
|
||||
implementation rootProject.ext.dependencies.mogo_core_data
|
||||
implementation rootProject.ext.dependencies.mogo_core_utils
|
||||
api rootProject.ext.dependencies.mogo_core_network
|
||||
} else {
|
||||
implementation project(":foudations:mogo-utils")
|
||||
api project(":foudations:mogo-aicloud-services-sdk")
|
||||
@@ -59,6 +60,8 @@ dependencies {
|
||||
|
||||
implementation project(':core:mogo-core-utils')
|
||||
implementation project(':core:mogo-core-data')
|
||||
api project(':core:mogo-core-network')
|
||||
|
||||
}
|
||||
api 'org.greenrobot:eventbus:3.1.1'
|
||||
}
|
||||
|
||||
@@ -19,24 +19,12 @@ import com.mogo.commons.analytics.AnalyticsUtils;
|
||||
import com.mogo.commons.crash.FinalizeCrashFixer;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.device.Devices;
|
||||
import com.mogo.commons.network.AllAllowedHostnameVerifier;
|
||||
import com.mogo.commons.network.Constants;
|
||||
import com.mogo.commons.network.ParamsUtil;
|
||||
import com.mogo.commons.network.X509TrustManagerImpl;
|
||||
import com.mogo.commons.storage.SpStorage;
|
||||
import com.mogo.commons.network.NetConfigUtils;
|
||||
import com.mogo.eagle.core.utilcode.mogo.toast.TipDrawable;
|
||||
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast;
|
||||
import com.mogo.eagle.core.utilcode.util.Utils;
|
||||
import com.mogo.utils.ThreadPoolService;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.NetConfig;
|
||||
|
||||
import java.security.SecureRandom;
|
||||
|
||||
import javax.net.ssl.SSLContext;
|
||||
import javax.net.ssl.TrustManager;
|
||||
|
||||
import okhttp3.Request;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -135,25 +123,14 @@ public abstract class AbsMogoApplication extends Application {
|
||||
return contentView;
|
||||
}
|
||||
|
||||
/**
|
||||
* 忽略 https 验证
|
||||
*
|
||||
* @return {@link SSLContext}
|
||||
* @throws Exception
|
||||
*/
|
||||
private static SSLContext getSslContext() throws Exception {
|
||||
SSLContext sc = null;
|
||||
sc = SSLContext.getInstance("SSL");
|
||||
sc.init(null, new TrustManager[]{new X509TrustManagerImpl()}, new SecureRandom());
|
||||
return sc;
|
||||
}
|
||||
|
||||
/**
|
||||
* 异步初始化
|
||||
*/
|
||||
protected void asyncInit() {
|
||||
ThreadPoolService.execute(() -> {
|
||||
initNetConfig();
|
||||
|
||||
//初始化网络配置
|
||||
NetConfigUtils.init(sApis);
|
||||
// 初始化埋点
|
||||
AnalyticsUtils.init(sApp);
|
||||
if (DebugConfig.getCarMachineType() == CAR_MACHINE_TYPE_SELF_INNOVATE) {
|
||||
@@ -171,39 +148,7 @@ public abstract class AbsMogoApplication extends Application {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化网络配置
|
||||
*/
|
||||
private static void initNetConfig() {
|
||||
try {
|
||||
SSLContext sc = getSslContext();
|
||||
NetConfig.instance().setSslContext(sc);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
NetConfig.instance().setSignaturePrefix(Constants.SIGN_PREFIX)
|
||||
.setPublicParams(ParamsUtil.getStaticParams())
|
||||
.setHostnameVerifier(new AllAllowedHostnameVerifier())
|
||||
.addNetworkInterceptor(chain -> {
|
||||
Request original = chain.request();
|
||||
Request request = original.newBuilder()
|
||||
.header("token", SpStorage.getTicket())
|
||||
.method(original.method(), original.body())
|
||||
.build();
|
||||
return chain.proceed(request);
|
||||
})
|
||||
// 增加域名->域名的转换方式,暂时去掉httpdns方式
|
||||
.addInterceptor(chain -> {
|
||||
Request request = chain.request();
|
||||
String path = request.url().encodedPath();
|
||||
String host = "http://" + sApis.syncGetHttpDns(request.url().host().replace("http://", "").replace("https://", ""), HTTP_DNS_ADDRESS_TYPE_HTTP, true);
|
||||
String url = host + path;
|
||||
Logger.d("DomainExchange", "oriHost: " + request.url().host() + " newHost: " + host + " \r\n newUrl: " + url);
|
||||
return chain.proceed(request.newBuilder().url(url).build());
|
||||
})
|
||||
.setHttpDns(null)
|
||||
.setLoggable(DebugConfig.isDebug());
|
||||
}
|
||||
|
||||
|
||||
// 缓存IP地址
|
||||
private String cacheIp = null;
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
package com.mogo.commons.analytics;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.Keep;
|
||||
import android.content.Context;
|
||||
|
||||
import com.elegant.analytics.Analytics;
|
||||
import com.elegant.analytics.AnalyticsConfig;
|
||||
@@ -14,6 +13,8 @@ import com.mogo.commons.network.ParamsUtil;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import androidx.annotation.Keep;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-23
|
||||
@@ -29,7 +30,7 @@ public class AnalyticsUtils {
|
||||
AnalyticsConfig.getInstance( context ).setAppKey( "6bbe7e0e1ecd8e2f8dc336e1678a2791" );
|
||||
AnalyticsConfig.getInstance( context ).setUploadMode( DebugConfig.isDebug() ? UploadMode.instant : UploadMode.cache );
|
||||
AnalyticsConfig.getInstance( context ).setShouldLog( DebugConfig.isDebug() );
|
||||
AnalyticsConfig.getInstance( AbsMogoApplication.getApp() ).setParamsProvider( new IAnalyticsParamsProvider() {
|
||||
AnalyticsConfig.getInstance( AbsMogoApplication.getApp() ).setParamsProvider(new IAnalyticsParamsProvider() {
|
||||
@Override
|
||||
public Map< String, Object > staticParams() {
|
||||
return ParamsUtil.getAnalyticsCustomParams();
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.mogo.commons.network;
|
||||
|
||||
import com.mogo.aicloud.services.httpdns.IMogoHttpDns;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.storage.SpStorage;
|
||||
import com.mogo.eagle.core.network.AllAllowedHostnameVerifier;
|
||||
import com.mogo.eagle.core.network.Constants;
|
||||
import com.mogo.eagle.core.network.NetConfig;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
|
||||
import javax.net.ssl.SSLContext;
|
||||
|
||||
import okhttp3.Request;
|
||||
|
||||
import static com.mogo.aicloud.services.httpdns.HttpDnsConst.HTTP_DNS_ADDRESS_TYPE_HTTP;
|
||||
|
||||
/**
|
||||
* @author xuxinchao
|
||||
* @description 网络配置工具
|
||||
* @since: 2021/12/20
|
||||
*/
|
||||
public class NetConfigUtils {
|
||||
|
||||
/**
|
||||
* 网络配置初始化
|
||||
* @param iMogoHttpDns Http DNS转换实现
|
||||
*/
|
||||
public static void init(IMogoHttpDns iMogoHttpDns){
|
||||
try {
|
||||
SSLContext sc = NetConfig.getSslContext();
|
||||
NetConfig.instance().setSslContext(sc);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
NetConfig.instance().setSignaturePrefix(Constants.SIGN_PREFIX)
|
||||
.setPublicParams(ParamsUtil.getStaticParams())
|
||||
.setHostnameVerifier(new AllAllowedHostnameVerifier())
|
||||
.addNetworkInterceptor(chain -> {
|
||||
Request original = chain.request();
|
||||
Request request = original.newBuilder()
|
||||
.header("token", SpStorage.getTicket())
|
||||
.method(original.method(), original.body())
|
||||
.build();
|
||||
return chain.proceed(request);
|
||||
})
|
||||
// 增加域名->域名的转换方式,暂时去掉httpdns方式
|
||||
.addInterceptor(chain -> {
|
||||
Request request = chain.request();
|
||||
String path = request.url().encodedPath();
|
||||
String host = "http://" + iMogoHttpDns.syncGetHttpDns(request.url().host().replace("http://", "").replace("https://", ""), HTTP_DNS_ADDRESS_TYPE_HTTP, true);
|
||||
String url = host + path;
|
||||
Logger.d("DomainExchange", "oriHost: " + request.url().host() + " newHost: " + host + " \r\n newUrl: " + url);
|
||||
return chain.proceed(request.newBuilder().url(url).build());
|
||||
})
|
||||
.setHttpDns(null)
|
||||
.setLoggable(DebugConfig.isDebug());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,11 +2,13 @@ package com.mogo.commons.network;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.utils.CheckUtils;
|
||||
import com.mogo.utils.network.HttpParams;
|
||||
import com.mogo.utils.network.NetConfig;
|
||||
import com.mogo.utils.network.ServerParam;
|
||||
import com.mogo.utils.network.utils.SignUtil;
|
||||
import com.elegant.utils.CheckUtils;
|
||||
import com.mogo.eagle.core.network.Constants;
|
||||
import com.mogo.eagle.core.network.HttpParams;
|
||||
import com.mogo.eagle.core.network.HttpParamsEx;
|
||||
import com.mogo.eagle.core.network.NetConfig;
|
||||
import com.mogo.eagle.core.network.ServerParam;
|
||||
import com.mogo.eagle.core.network.utils.SignUtil;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -3,24 +3,26 @@ package com.mogo.commons.network;
|
||||
import android.os.Build;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.collection.ArrayMap;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.storage.SpStorage;
|
||||
import com.mogo.eagle.core.network.Constants;
|
||||
import com.mogo.eagle.core.network.LocationHelper;
|
||||
import com.mogo.eagle.core.network.ServerParam;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.utils.CommonUtils;
|
||||
import com.mogo.utils.DeviceIdUtils;
|
||||
import com.mogo.utils.WindowUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.collection.ArrayMap;
|
||||
import okhttp3.RequestBody;
|
||||
|
||||
public class ParamsUtil {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.mogo.commons.network;
|
||||
|
||||
|
||||
import android.Manifest;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.mogo.utils.digest;
|
||||
|
||||
/**
|
||||
* Defines common encoding methods for byte array encoders.
|
||||
*
|
||||
* @version $Id: BinaryEncoder.java 1379145 2012-08-30 21:02:52Z tn $
|
||||
*/
|
||||
public interface BinaryEncoder extends Encoder {
|
||||
|
||||
/**
|
||||
* Encodes a byte array and return the encoded data as a byte array.
|
||||
*
|
||||
* @param source
|
||||
* Data to be encoded
|
||||
* @return A byte array containing the encoded data
|
||||
* @throws EncoderException
|
||||
* thrown if the Encoder encounters a failure condition during the encoding process.
|
||||
*/
|
||||
byte[] encode( byte[] source ) throws EncoderException;
|
||||
}
|
||||
|
||||
@@ -1,156 +0,0 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.mogo.utils.digest;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
/**
|
||||
* Charsets required of every implementation of the Java platform.
|
||||
*
|
||||
* From the Java documentation <a href="http://docs.oracle.com/javase/6/docs/api/java/nio/charset/Charset.html">Standard
|
||||
* charsets</a>:
|
||||
* <p>
|
||||
* <cite>Every implementation of the Java platform is required to support the following character encodings. Consult the
|
||||
* release documentation for your implementation to see if any other encodings are supported. Consult the release
|
||||
* documentation for your implementation to see if any other encodings are supported. </cite>
|
||||
* </p>
|
||||
*
|
||||
* <ul>
|
||||
* <li><code>US-ASCII</code><br>
|
||||
* Seven-bit ASCII, a.k.a. ISO646-US, a.k.a. the Basic Latin block of the Unicode character set.</li>
|
||||
* <li><code>ISO-8859-1</code><br>
|
||||
* ISO Latin Alphabet No. 1, a.k.a. ISO-LATIN-1.</li>
|
||||
* <li><code>UTF-8</code><br>
|
||||
* Eight-bit Unicode Transformation Format.</li>
|
||||
* <li><code>UTF-16BE</code><br>
|
||||
* Sixteen-bit Unicode Transformation Format, big-endian byte order.</li>
|
||||
* <li><code>UTF-16LE</code><br>
|
||||
* Sixteen-bit Unicode Transformation Format, little-endian byte order.</li>
|
||||
* <li><code>UTF-16</code><br>
|
||||
* Sixteen-bit Unicode Transformation Format, byte order specified by a mandatory initial byte-order mark (either order
|
||||
* accepted on input, big-endian used on output.)</li>
|
||||
* </ul>
|
||||
*
|
||||
* This perhaps would best belong in the Commons Lang project. Even if a similar class is defined in Commons Lang, it is
|
||||
* not foreseen that Commons Codec would be made to depend on Commons Lang.
|
||||
*
|
||||
* <p>
|
||||
* This class is immutable and thread-safe.
|
||||
* </p>
|
||||
*
|
||||
* @see <a href="http://docs.oracle.com/javase/6/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
|
||||
* @since 1.7
|
||||
* @version $Id: CharEncoding.java 1173287 2011-09-20 18:16:19Z ggregory $
|
||||
*/
|
||||
public class Charsets {
|
||||
|
||||
//
|
||||
// This class should only contain Charset instances for required encodings. This guarantees that it will load
|
||||
// correctly and without delay on all Java platforms.
|
||||
//
|
||||
|
||||
/**
|
||||
* Returns the given Charset or the default Charset if the given Charset is null.
|
||||
*
|
||||
* @param charset
|
||||
* A charset or null.
|
||||
* @return the given Charset or the default Charset if the given Charset is null
|
||||
*/
|
||||
public static Charset toCharset( final Charset charset) {
|
||||
return charset == null ? Charset.defaultCharset() : charset;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a Charset for the named charset. If the name is null, return the default Charset.
|
||||
*
|
||||
* @param charset
|
||||
* The name of the requested charset, may be null.
|
||||
* @return a Charset for the named charset
|
||||
* @throws java.nio.charset.UnsupportedCharsetException
|
||||
* If the named charset is unavailable
|
||||
*/
|
||||
public static Charset toCharset( final String charset) {
|
||||
return charset == null ? Charset.defaultCharset() : Charset.forName(charset);
|
||||
}
|
||||
|
||||
/**
|
||||
* CharEncodingISO Latin Alphabet No. 1, a.k.a. ISO-LATIN-1.
|
||||
* <p>
|
||||
* Every implementation of the Java platform is required to support this character encoding.
|
||||
*
|
||||
* @see <a href="http://docs.oracle.com/javase/6/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
|
||||
* @deprecated Use Java 7's {@link java.nio.charset.StandardCharsets}
|
||||
*/
|
||||
@Deprecated
|
||||
public static final Charset ISO_8859_1 = Charset.forName(CharEncoding.ISO_8859_1);
|
||||
|
||||
/**
|
||||
* Seven-bit ASCII, also known as ISO646-US, also known as the Basic Latin block of the Unicode character set.
|
||||
* <p>
|
||||
* Every implementation of the Java platform is required to support this character encoding.
|
||||
*
|
||||
* @see <a href="http://docs.oracle.com/javase/6/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
|
||||
* @deprecated Use Java 7's {@link java.nio.charset.StandardCharsets}
|
||||
*/
|
||||
@Deprecated
|
||||
public static final Charset US_ASCII = Charset.forName(CharEncoding.US_ASCII);
|
||||
|
||||
/**
|
||||
* Sixteen-bit Unicode Transformation Format, The byte order specified by a mandatory initial byte-order mark
|
||||
* (either order accepted on input, big-endian used on output)
|
||||
* <p>
|
||||
* Every implementation of the Java platform is required to support this character encoding.
|
||||
*
|
||||
* @see <a href="http://docs.oracle.com/javase/6/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
|
||||
* @deprecated Use Java 7's {@link java.nio.charset.StandardCharsets}
|
||||
*/
|
||||
@Deprecated
|
||||
public static final Charset UTF_16 = Charset.forName(CharEncoding.UTF_16);
|
||||
|
||||
/**
|
||||
* Sixteen-bit Unicode Transformation Format, big-endian byte order.
|
||||
* <p>
|
||||
* Every implementation of the Java platform is required to support this character encoding.
|
||||
*
|
||||
* @see <a href="http://docs.oracle.com/javase/6/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
|
||||
* @deprecated Use Java 7's {@link java.nio.charset.StandardCharsets}
|
||||
*/
|
||||
@Deprecated
|
||||
public static final Charset UTF_16BE = Charset.forName(CharEncoding.UTF_16BE);
|
||||
|
||||
/**
|
||||
* Sixteen-bit Unicode Transformation Format, little-endian byte order.
|
||||
* <p>
|
||||
* Every implementation of the Java platform is required to support this character encoding.
|
||||
*
|
||||
* @see <a href="http://docs.oracle.com/javase/6/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
|
||||
* @deprecated Use Java 7's {@link java.nio.charset.StandardCharsets}
|
||||
*/
|
||||
@Deprecated
|
||||
public static final Charset UTF_16LE = Charset.forName(CharEncoding.UTF_16LE);
|
||||
|
||||
/**
|
||||
* Eight-bit Unicode Transformation Format.
|
||||
* <p>
|
||||
* Every implementation of the Java platform is required to support this character encoding.
|
||||
*
|
||||
* @see <a href="http://docs.oracle.com/javase/6/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
|
||||
* @deprecated Use Java 7's {@link java.nio.charset.StandardCharsets}
|
||||
*/
|
||||
@Deprecated
|
||||
public static final Charset UTF_8 = Charset.forName(CharEncoding.UTF_8);
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.mogo.utils.digest;
|
||||
|
||||
/**
|
||||
* Defines common encoding methods for String encoders.
|
||||
*
|
||||
* @version $Id: StringEncoder.java 1379145 2012-08-30 21:02:52Z tn $
|
||||
*/
|
||||
public interface StringEncoder extends Encoder {
|
||||
|
||||
/**
|
||||
* Encodes a String and returns a String.
|
||||
*
|
||||
* @param source
|
||||
* the String to encode
|
||||
* @return the encoded String
|
||||
* @throws EncoderException
|
||||
* thrown if there is an error condition during the encoding process.
|
||||
*/
|
||||
String encode( String source ) throws EncoderException;
|
||||
}
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
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,24 +0,0 @@
|
||||
package com.mogo.utils.network;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.utils.CheckUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import okhttp3.Interceptor;
|
||||
import okhttp3.Response;
|
||||
|
||||
|
||||
final class NetworkMonitorInterceptor implements Interceptor {
|
||||
private static final String TAG = "NetworkMonitorInterceptor";
|
||||
|
||||
@Override
|
||||
public Response intercept(Chain chain) throws IOException {
|
||||
final Context appContext = NetConfig.instance().getAppContext();
|
||||
if(appContext != null && !CheckUtils.isNetworkConnected(appContext)){
|
||||
throw new NetworkUnavailableException("Network is unavailable");
|
||||
}
|
||||
return chain.proceed(chain.request());
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package com.mogo.utils.network;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import okhttp3.Interceptor;
|
||||
|
||||
/**
|
||||
* An exception occurs whenever network is not reachable, it's threw by {@link NetworkMonitorInterceptor}
|
||||
* during {@link NetworkMonitorInterceptor#intercept(Interceptor.Chain)} method.
|
||||
*
|
||||
*/
|
||||
|
||||
public class NetworkUnavailableException extends IOException {
|
||||
|
||||
public NetworkUnavailableException( String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
package com.mogo.utils.network;
|
||||
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import okhttp3.ConnectionPool;
|
||||
import okhttp3.Dns;
|
||||
import okhttp3.Interceptor;
|
||||
import okhttp3.OkHttpClient;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Before getting an global instance of {@link OkHttpClient}, you can use {@link NetConfig} to set some
|
||||
* parameters of network. Note that network configuration must be first set before you get an instance of {@link OkHttpClient},
|
||||
* for the first time, otherwise configuration is invalid<p/>
|
||||
*
|
||||
*/
|
||||
public final class OkHttpFactory {
|
||||
|
||||
private static volatile OkHttpClient sInstance;
|
||||
|
||||
private OkHttpFactory() {
|
||||
}
|
||||
|
||||
public static OkHttpClient getInstance() {
|
||||
if (sInstance == null) {
|
||||
synchronized (OkHttpClient.class) {
|
||||
if (sInstance == null) {
|
||||
final OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
||||
builder.addInterceptor(new NetworkMonitorInterceptor());
|
||||
builder.addInterceptor(new RequestLogInterceptor());
|
||||
builder.addInterceptor(new ResponseLogInterceptor());
|
||||
builder.hostnameVerifier(NetConfig.instance().getHostnameVerifier());
|
||||
if ( NetConfig.instance().getSslContext() != null ) {
|
||||
builder.sslSocketFactory( NetConfig.instance().getSslContext().getSocketFactory());
|
||||
}
|
||||
builder.connectTimeout(NetConfig.instance().getConnectTimeout(), TimeUnit.MILLISECONDS);
|
||||
builder.readTimeout(NetConfig.instance().getReadTimeout(), TimeUnit.MILLISECONDS);
|
||||
builder.writeTimeout(NetConfig.instance().getWriteTimeout(), TimeUnit.MILLISECONDS);
|
||||
final Set<Interceptor> interceptors = NetConfig.instance().getInterceptors();
|
||||
for(Interceptor interceptor : interceptors){
|
||||
builder.addInterceptor(interceptor);
|
||||
}
|
||||
|
||||
final Set<Interceptor> networkInterceptors = NetConfig.instance().getNetworkInterceptors();
|
||||
for(Interceptor networkInterceptor : networkInterceptors){
|
||||
builder.addNetworkInterceptor(networkInterceptor);
|
||||
}
|
||||
|
||||
HttpDns httpDns = NetConfig.instance().getHttpDns();
|
||||
if ( httpDns != null ) {
|
||||
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 );
|
||||
} );
|
||||
}
|
||||
|
||||
sInstance = builder.build();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return sInstance;
|
||||
}
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
package com.mogo.utils.network;
|
||||
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
import okhttp3.Interceptor;
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.Protocol;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.RequestBody;
|
||||
import okhttp3.Response;
|
||||
import okio.Buffer;
|
||||
|
||||
|
||||
final class RequestLogInterceptor implements Interceptor {
|
||||
private static final String TAG = "RequestLogInterceptor";
|
||||
|
||||
@Override
|
||||
public Response intercept(Chain chain) throws IOException {
|
||||
Request request = chain.request();
|
||||
RequestBody requestBody = request.body();
|
||||
boolean hasRequestBody = requestBody != null;
|
||||
|
||||
String protocol = Protocol.HTTP_1_1.toString();
|
||||
if(chain.connection() != null && chain.connection().protocol() != null){
|
||||
protocol = chain.connection().protocol().toString();
|
||||
}
|
||||
|
||||
StringBuilder logMsg = new StringBuilder();
|
||||
logMsg.append("--> ");
|
||||
logMsg.append(protocol).append(", ");
|
||||
logMsg.append(request.method()).append(", ");
|
||||
logMsg.append("Request Headers: ").append(request.headers()).append("\r\n");
|
||||
logMsg.append(request.url()).append("\r\n");
|
||||
if(hasRequestBody){
|
||||
logMsg.append("Content-Type: ").append(requestBody.contentType()).append(", ");
|
||||
logMsg.append("\r\nContent-Length: ").append(requestBody.contentLength());
|
||||
try {
|
||||
String body = null;
|
||||
Charset UTF8 = Charset.forName("UTF-8");
|
||||
Buffer buffer = new Buffer();
|
||||
requestBody.writeTo(buffer);
|
||||
Charset charset = UTF8;
|
||||
MediaType contentType = requestBody.contentType();
|
||||
if (contentType != null) {
|
||||
charset = contentType.charset(UTF8);
|
||||
}
|
||||
if (charset != null) {
|
||||
body = buffer.readString(charset);
|
||||
}
|
||||
logMsg.append("\r\nContent-body: ").append(body);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
logMsg.append("\r\n<-- end http request");
|
||||
|
||||
if(NetConfig.instance().isLoggable()){
|
||||
Logger.d(TAG, logMsg.toString());
|
||||
}
|
||||
|
||||
return chain.proceed(request);
|
||||
}
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
package com.mogo.utils.network;
|
||||
|
||||
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import okhttp3.Interceptor;
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.Response;
|
||||
import okhttp3.ResponseBody;
|
||||
|
||||
|
||||
final class ResponseLogInterceptor implements Interceptor {
|
||||
private static final String TAG = "ResponseLogInterceptor";
|
||||
|
||||
@Override
|
||||
public Response intercept( Chain chain ) throws IOException {
|
||||
long startTime = System.nanoTime();
|
||||
Response response = chain.proceed( chain.request() );
|
||||
long endTime = TimeUnit.NANOSECONDS.toMillis( System.nanoTime() - startTime );
|
||||
|
||||
ResponseBody responseBody = response.body();
|
||||
String responseContent = null;
|
||||
String bodySize = null;
|
||||
MediaType contentType = null;
|
||||
boolean consumedResponse = false;
|
||||
|
||||
StringBuilder logMsg = new StringBuilder();
|
||||
|
||||
if ( responseBody != null ) {
|
||||
long contentLength = responseBody.contentLength();
|
||||
bodySize = contentLength != -1L ? contentLength + "-byte" : "unknown-length";
|
||||
contentType = responseBody.contentType();
|
||||
responseContent = responseBody.string();
|
||||
consumedResponse = true;
|
||||
}
|
||||
|
||||
logMsg.append( "--> " );
|
||||
logMsg.append( response.code() ).append( " " );
|
||||
logMsg.append( response.message() ).append( " " );
|
||||
logMsg.append( response.protocol() ).append( " " );
|
||||
logMsg.append( response.request().url() ).append( "\r\n" );
|
||||
logMsg.append( "Response Content: " ).append( responseContent ).append( "\r\n" );
|
||||
logMsg.append( "Content-Type: " ).append( contentType ).append( ", " );
|
||||
logMsg.append( "Content-Length: " ).append( bodySize ).append( ", " );
|
||||
logMsg.append( " (" ).append( endTime ).append( "ms)" );
|
||||
logMsg.append( " <-- end http response" );
|
||||
|
||||
if ( NetConfig.instance().isLoggable() ) {
|
||||
Logger.d( TAG, logMsg.toString() );
|
||||
}
|
||||
|
||||
return consumedResponse ?
|
||||
response.newBuilder().body( ResponseBody.create( contentType, responseContent ) ).build() :
|
||||
response;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package com.mogo.utils.network;
|
||||
|
||||
public class ServerParam {
|
||||
public static final String SIGNATURE = "sig";
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
package com.mogo.utils.network.ui;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
|
||||
public class ProgressDialog {
|
||||
|
||||
private static final String TAG = "ProgressDialog";
|
||||
|
||||
public static final String LOADING_DIALOG_TAG = "loading_dialog_tag";
|
||||
|
||||
private ProgressDialogFragment mProgressDialogFragment;
|
||||
private FragmentManager mFragmentManager;
|
||||
|
||||
public void showLoadingDialog( @NonNull Context context, CharSequence loadingMassage) {
|
||||
showLoadingDialog(context, loadingMassage, true);
|
||||
}
|
||||
|
||||
public void showLoadingDialog( @NonNull Context context, CharSequence loadingMassage, boolean cancelable) {
|
||||
showLoadingDialog(context, loadingMassage, cancelable, false);
|
||||
}
|
||||
|
||||
public void showLoadingDialog( Context context, CharSequence loadingMassage, boolean cancelable, boolean cancelableOnTouchOutSide) {
|
||||
if (context != null && context instanceof FragmentActivity )
|
||||
mFragmentManager = ((FragmentActivity) context).getSupportFragmentManager();
|
||||
|
||||
if (mFragmentManager == null)
|
||||
return;
|
||||
|
||||
mProgressDialogFragment = new ProgressDialogFragment();
|
||||
mProgressDialogFragment.setContent(loadingMassage, cancelable, cancelableOnTouchOutSide);
|
||||
|
||||
try {
|
||||
FragmentTransaction fragmentTransaction = mFragmentManager.beginTransaction();
|
||||
fragmentTransaction.add( mProgressDialogFragment, LOADING_DIALOG_TAG );
|
||||
fragmentTransaction.add(mProgressDialogFragment, LOADING_DIALOG_TAG);
|
||||
fragmentTransaction.commitAllowingStateLoss();
|
||||
} catch ( IllegalStateException e) {
|
||||
Logger.e(TAG, e, e.getMessage());
|
||||
mFragmentManager = null;
|
||||
mProgressDialogFragment = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void removeLoadingDialog() {
|
||||
if (mProgressDialogFragment != null) {
|
||||
try {
|
||||
mProgressDialogFragment.dismissAllowingStateLoss();
|
||||
} catch ( Exception e) {
|
||||
Logger.e(TAG, "dialog 取消异常");
|
||||
} finally {
|
||||
mProgressDialogFragment = null;
|
||||
mFragmentManager = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
package com.mogo.utils.network.ui;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.app.ProgressDialog;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
|
||||
|
||||
public class ProgressDialogFragment extends DialogFragment {
|
||||
|
||||
/**
|
||||
* Progress显示的文字
|
||||
*/
|
||||
private CharSequence mMessage;
|
||||
|
||||
private boolean mCancelableOnTouchOutSide;
|
||||
|
||||
/**
|
||||
* 设置dialog内容
|
||||
*
|
||||
* @param message 显示的文字
|
||||
* @param cancelable 是否可以被取消 例如back键取消
|
||||
*/
|
||||
public void setContent( CharSequence message, boolean cancelable, boolean cancelableOnTouchOutSide) {
|
||||
mMessage = message;
|
||||
mCancelableOnTouchOutSide = cancelableOnTouchOutSide;
|
||||
setCancelable(cancelable);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Dialog onCreateDialog( Bundle savedInstanceState) {
|
||||
ProgressDialog dialog = new ProgressDialog(getActivity());
|
||||
dialog.setMessage(mMessage);
|
||||
dialog.setCanceledOnTouchOutside(mCancelableOnTouchOutSide);
|
||||
return dialog;
|
||||
}
|
||||
}
|
||||
@@ -1,134 +0,0 @@
|
||||
package com.mogo.utils.network.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
import android.net.wifi.WifiInfo;
|
||||
import android.net.wifi.WifiManager;
|
||||
import android.os.Build;
|
||||
import android.telephony.PhoneStateListener;
|
||||
import android.telephony.SignalStrength;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.utils.CommonUtils;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
* @description 网络状态监听
|
||||
* @since: 7/29/21
|
||||
*/
|
||||
public class NetworkStatusUtil {
|
||||
|
||||
private static PhoneStatListener phoneStatListener;
|
||||
private static int mSignalStrength;
|
||||
private static SignalStrength signal;
|
||||
private static NetWorkStatus netWorkStatus1 = new NetWorkStatus();
|
||||
|
||||
/**
|
||||
* 监听网络强度
|
||||
*/
|
||||
public static NetWorkStatus networkState(Context context) {
|
||||
ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
NetworkInfo info = connectivityManager.getActiveNetworkInfo();
|
||||
String netWorkStatus = CommonUtils.getNetworkType(context);
|
||||
netWorkStatus1.status = netWorkStatus;
|
||||
if (info != null && info.isAvailable()) {
|
||||
netWorkStatus1.status = netWorkStatus;
|
||||
switch (info.getType()) {
|
||||
case ConnectivityManager.TYPE_WIFI:
|
||||
//wifi
|
||||
WifiManager manager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
|
||||
WifiInfo connectionInfo = manager.getConnectionInfo();
|
||||
mSignalStrength = connectionInfo.getRssi();
|
||||
if (mSignalStrength > -90) {
|
||||
Log.e("CheckActivity", "getNetWorkInfo: 信号强度强");
|
||||
} else {
|
||||
Log.e("CheckActivity", "getNetWorkInfo: 信号强度弱");
|
||||
}
|
||||
netWorkStatus1.mSignalStrength = mSignalStrength;
|
||||
return netWorkStatus1;
|
||||
case ConnectivityManager.TYPE_MOBILE:
|
||||
TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
|
||||
if (telephonyManager == null) {
|
||||
telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
|
||||
}
|
||||
if (phoneStatListener == null) {
|
||||
phoneStatListener = new PhoneStatListener();
|
||||
}
|
||||
telephonyManager.listen(phoneStatListener, PhoneStatListener.LISTEN_SIGNAL_STRENGTHS);
|
||||
//移动网络,可以通过TelephonyManager来获取具体细化的网络类型
|
||||
if (netWorkStatus != "UNKNOWN") {
|
||||
try {
|
||||
if (signal == null) {
|
||||
Log.e("CheckActivity", "getNetWorkInfo: signal为空");
|
||||
break;
|
||||
}
|
||||
Method method = signal.getClass().getMethod("getDbm");
|
||||
mSignalStrength = (int) method.invoke(signal);
|
||||
} catch (NoSuchMethodException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else {
|
||||
if (signal == null) {
|
||||
break;
|
||||
}
|
||||
mSignalStrength = signal.getGsmSignalStrength();
|
||||
}
|
||||
netWorkStatus1.mSignalStrength = mSignalStrength;
|
||||
return netWorkStatus1;
|
||||
}
|
||||
} else {
|
||||
return netWorkStatus1;
|
||||
}
|
||||
return netWorkStatus1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 监听非WiFi网络信号强度变化
|
||||
*/
|
||||
static class PhoneStatListener extends PhoneStateListener {
|
||||
@Override
|
||||
public void onSignalStrengthsChanged(SignalStrength signalStrength) {
|
||||
//获取信号强度变化
|
||||
super.onSignalStrengthsChanged(signalStrength);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
mSignalStrength = signalStrength.getLevel();
|
||||
return;
|
||||
}
|
||||
mSignalStrength = signalStrength.getGsmSignalStrength();
|
||||
}
|
||||
}
|
||||
|
||||
static public class NetWorkStatus implements Serializable {
|
||||
String status;
|
||||
int mSignalStrength;
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public int getSignalStrength() {
|
||||
return mSignalStrength;
|
||||
}
|
||||
|
||||
public void setSignalStrength(int signalStrength) {
|
||||
mSignalStrength = signalStrength;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ public class CustomMapApiBuilder implements IMogoMapApiBuilder {
|
||||
|
||||
NavAutoApi.INSTANCE.init(context, mapParams, NavParams.Companion.init());
|
||||
MapAutoView mapAutoView = new MapAutoView(context);
|
||||
mapAutoView.registerRenderListener(l -> Log.i(TAG, "renderTime: " + l));
|
||||
//mapAutoView.registerRenderListener(l -> Log.i(TAG, "renderTime: " + l));
|
||||
IMogoMapView mapView = new AMapViewWrapper(mapAutoView);
|
||||
return mapView;
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||
import com.mogo.module.adas.entity.DispatchAdasAutoPilotLocReceiverBean;
|
||||
import com.mogo.module.adas.entity.DispatchData;
|
||||
@@ -29,7 +30,6 @@ import com.mogo.module.adas.view.DispatchRemindDialog;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.service.cloud.socket.IMogoOnMessageListener;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
import com.zhidao.support.adas.high.bean.AutopilotRoute;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -21,11 +21,11 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarStatusListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
|
||||
import com.mogo.module.adas.model.AdasServiceModel;
|
||||
import com.mogo.module.common.drawer.IdentifyDataDrawer;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
import com.zhidao.autopilotservice.model.AdasAIDLAutopilotStateModel;
|
||||
import com.zhidao.support.adas.high.AdasManager;
|
||||
import com.zhidao.support.adas.high.OnAdasMsgConnectStatusListener;
|
||||
|
||||
@@ -6,7 +6,7 @@ import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotWarnMessage
|
||||
import com.mogo.eagle.core.data.enums.TrafficTypeEnum
|
||||
import com.mogo.eagle.core.data.traffic.TrafficData
|
||||
import com.mogo.utils.network.utils.GsonUtil
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil
|
||||
import com.zhidao.support.adas.high.bean.AutopilotRoute
|
||||
import com.zhidao.support.adas.high.bean.CarStateInfo
|
||||
import com.zhidao.support.adas.high.bean.RectInfo.RectBean
|
||||
|
||||
@@ -2,8 +2,10 @@ package com.mogo.module.adas.model;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
import com.mogo.commons.network.SubscribeImpl;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
|
||||
import com.mogo.eagle.core.network.RequestOptions;
|
||||
import com.mogo.eagle.core.network.SubscribeImpl;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.module.adas.entity.AutonomousDriveStatusBean;
|
||||
import com.mogo.module.adas.entity.ReportDispatchResult;
|
||||
import com.mogo.module.adas.entity.ReportSiteBean;
|
||||
@@ -11,8 +13,6 @@ import com.mogo.module.adas.entity.ReportedRoute;
|
||||
import com.mogo.module.adas.network.IAdasApiService;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.RequestOptions;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
import com.zhidao.support.adas.high.bean.AutopilotRoute;
|
||||
import com.zhidao.support.adas.high.bean.AutopilotStatus;
|
||||
|
||||
|
||||
@@ -4,13 +4,13 @@ import android.content.Context;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.map.overlay.IMogoOverlayManager;
|
||||
import com.mogo.map.overlay.IMogoPolyline;
|
||||
import com.mogo.map.overlay.MogoPolylineOptions;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.utils.ColorUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -3,10 +3,10 @@ package com.mogo.module.adas.receiver;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.module.adas.overlay.LineOverlayManager;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import com.mogo.chat.model.bean.toSns
|
||||
import com.mogo.chat.util.UserInfoHelper
|
||||
import com.mogo.chat.util.log
|
||||
import com.mogo.eagle.core.data.BaseResponse
|
||||
import com.mogo.utils.network.request
|
||||
import com.mogo.eagle.core.network.request
|
||||
|
||||
open class BaseController {
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ import com.mogo.chat.util.sp.saveRoomId
|
||||
import com.mogo.chat.util.trackCall
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.eagle.core.data.BaseResponse
|
||||
import com.mogo.utils.network.request
|
||||
import com.mogo.eagle.core.network.request
|
||||
|
||||
|
||||
object ChatController : BaseController(), IGMEEventCallBack {
|
||||
|
||||
@@ -14,7 +14,7 @@ import com.mogo.chat.util.*
|
||||
import com.mogo.chat.util.audio.AudioFocusUtil
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.eagle.core.data.BaseResponse
|
||||
import com.mogo.utils.network.request
|
||||
import com.mogo.eagle.core.network.request
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
@@ -13,7 +13,8 @@ import com.mogo.chat.util.log
|
||||
import com.mogo.chat.util.sp.getRoomId
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.eagle.core.data.BaseResponse
|
||||
import com.mogo.utils.network.request
|
||||
import com.mogo.eagle.core.network.request
|
||||
|
||||
|
||||
object VehicleTeamController : BaseController(), IGMEEventCallBack {
|
||||
|
||||
|
||||
@@ -22,7 +22,8 @@ import com.mogo.chat.util.sp.setCarOnLineStatus
|
||||
import com.mogo.chat.util.trackHangUp
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.eagle.core.data.BaseResponse
|
||||
import com.mogo.utils.network.request
|
||||
import com.mogo.eagle.core.network.request
|
||||
|
||||
|
||||
object ChatServiceHandler : BaseController() {
|
||||
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
package com.mogo.module.common.utils;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.ArrayMap;
|
||||
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.module.common.R;
|
||||
import com.mogo.module.common.enums.EventTypeEnum;
|
||||
import com.mogo.module.common.marker.PoiWrapper;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
import com.mogo.utils.storage.SharedPrefsMgr;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.eagle.core.network.utils.digest.DigestUtils;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.constants.HostConst;
|
||||
import com.mogo.module.extensions.R;
|
||||
@@ -27,7 +28,6 @@ import com.mogo.eagle.core.data.constants.MogoServicePaths;
|
||||
import com.mogo.service.network.IMogoNetwork;
|
||||
import com.mogo.service.statusmanager.IMogoMsgCenter;
|
||||
import com.mogo.service.statusmanager.IMogoMsgCenterListener;
|
||||
import com.mogo.utils.digest.DigestUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.storage.SharedPrefsMgr;
|
||||
|
||||
|
||||
@@ -7,13 +7,13 @@ import android.os.SystemClock;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
import com.mogo.commons.network.SubscribeImpl;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.network.RequestOptions;
|
||||
import com.mogo.eagle.core.network.SubscribeImpl;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.utils.NetworkUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.RequestOptions;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import okhttp3.MediaType;
|
||||
|
||||
@@ -10,13 +10,13 @@ import android.widget.Toast;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.context.ContextHolderUtil;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.eagle.core.network.NetConfig;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.service.cloud.socket.IMogoOnMessageListener;
|
||||
import com.mogo.service.monitor.IMogoMonitorLog;
|
||||
import com.mogo.utils.logger.LogLevel;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.NetConfig;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
import com.zhidao.mogo.module.monitor.MogoMonitorConst;
|
||||
import com.zhidao.mogo.module.monitor.bean.RemoteLogPushContent;
|
||||
import com.zhidao.mogo.module.monitor.dialog.ILogDialogListener;
|
||||
|
||||
@@ -3,9 +3,8 @@ package com.zhidao.mogo.module.obu.obu
|
||||
import android.content.Context
|
||||
import android.os.Handler
|
||||
import android.os.Message
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil
|
||||
import com.mogo.utils.logger.Logger
|
||||
import com.mogo.utils.network.utils.GsonUtil
|
||||
import com.zhidao.mogo.module.obu.ObuConstant.TYPE_OPTIMAL_SPEED_ADVISORY
|
||||
import com.zhidao.mogo.module.obu.ObuConstant.TYPE_ROAD_USER_COLLISION_WARNING
|
||||
import com.zhidao.mogo.module.obu.obu.bean.MogoObuEventInfo
|
||||
import com.zhidao.mogo.module.obu.obu.bean.MogoObuTrafficLightInfo
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package com.mogo.module.service.autopilot;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters;
|
||||
import com.mogo.service.cloud.socket.IMogoOnMessageListener;
|
||||
import com.mogo.service.cloud.socket.IMogoSocketManager;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
public
|
||||
/**
|
||||
|
||||
@@ -1,19 +1,16 @@
|
||||
package com.mogo.module.service.dispatch.model;
|
||||
|
||||
import static com.mogo.commons.context.ContextHolderUtil.getContext;
|
||||
import static com.mogo.module.common.constants.HostConst.DATA_SERVICE_HOST;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
import com.mogo.commons.network.SubscribeImpl;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatus;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatus;
|
||||
import com.mogo.eagle.core.network.RequestOptions;
|
||||
import com.mogo.eagle.core.network.SubscribeImpl;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.service.dispatch.bean.ReportDispatchResult;
|
||||
import com.mogo.module.service.dispatch.bean.ReportedRoute;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.RequestOptions;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -22,6 +19,11 @@ import java.util.Map;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
import static com.mogo.commons.context.ContextHolderUtil.getContext;
|
||||
import static com.mogo.module.common.constants.HostConst.DATA_SERVICE_HOST;
|
||||
|
||||
|
||||
|
||||
public class DispatchServiceModel {
|
||||
|
||||
private static final String TAG = "DispatchServiceModel";
|
||||
|
||||
@@ -7,8 +7,10 @@ import android.text.TextUtils;
|
||||
|
||||
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.eagle.core.network.RequestOptions;
|
||||
import com.mogo.eagle.core.network.SubscribeImpl;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.constants.HostConst;
|
||||
import com.mogo.module.service.MogoServices;
|
||||
@@ -18,8 +20,6 @@ import com.mogo.module.service.network.bean.HomeCompanyDistanceForPushData;
|
||||
import com.mogo.module.service.network.bean.HomeCompanyDistanceForPushResponse;
|
||||
import com.mogo.module.service.onlinecar.panel.NavigationTargetInfo;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.RequestOptions;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@@ -5,12 +5,12 @@ import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotCarStateInfo;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.module.common.datacenter.SnapshotLocationDataCenter;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.module.service.receiver.MogoReceiver;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters;
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.data.traffic.TrafficData;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
@@ -48,7 +49,6 @@ import com.mogo.service.entrance.ButtonIndex;
|
||||
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast;
|
||||
import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
import com.mogo.utils.storage.SharedPrefsMgr;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
@@ -3,9 +3,9 @@ package com.mogo.module.service.intent;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import com.mogo.eagle.core.network.NetConfig;
|
||||
import com.mogo.utils.logger.LogLevel;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.NetConfig;
|
||||
|
||||
public
|
||||
/**
|
||||
|
||||
@@ -5,9 +5,7 @@ import android.content.Intent;
|
||||
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.utils.NetworkUtils;
|
||||
import com.mogo.utils.logger.LogLevel;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.NetConfig;
|
||||
|
||||
public
|
||||
/**
|
||||
|
||||
@@ -10,10 +10,12 @@ import android.text.TextUtils;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.network.ParamsProvider;
|
||||
import com.mogo.commons.network.SubscribeImpl;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.network.RequestOptions;
|
||||
import com.mogo.eagle.core.network.SubscribeImpl;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.service.R;
|
||||
@@ -26,8 +28,6 @@ import com.mogo.service.cloud.passport.IMogoTicketCallback;
|
||||
import com.mogo.utils.AppUtils;
|
||||
import com.mogo.utils.NetworkUtils;
|
||||
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.ArrayList;
|
||||
|
||||
@@ -4,15 +4,15 @@ import android.content.Context;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.network.ParamsProvider;
|
||||
import com.mogo.commons.network.SubscribeImpl;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.network.RequestOptions;
|
||||
import com.mogo.eagle.core.network.SubscribeImpl;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
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.utils.logger.Logger;
|
||||
import com.mogo.utils.network.RequestOptions;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.commons.storage.SpStorage;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.map.IDestroyable;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.map.navi.IMogoNaviListener2;
|
||||
@@ -15,7 +16,6 @@ import com.mogo.module.common.entity.MarkerResponse;
|
||||
import com.mogo.module.service.network.RefreshCallback;
|
||||
import com.mogo.module.service.network.RefreshModel;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
|
||||
@@ -11,7 +11,9 @@ import androidx.annotation.RequiresApi;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.cloud.socket.entity.SocketDownData;
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
import com.mogo.commons.network.SubscribeImpl;
|
||||
import com.mogo.eagle.core.network.RequestOptions;
|
||||
import com.mogo.eagle.core.network.SubscribeImpl;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.datacenter.SnapshotLocationDataCenter;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
@@ -24,8 +26,6 @@ import com.mogo.service.adas.IMogoADASController;
|
||||
import com.mogo.service.cloud.socket.IMogoOnMessageListener;
|
||||
import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.RequestOptions;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
@@ -4,12 +4,12 @@ import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.network.SubscribeImpl;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.eagle.core.network.RequestOptions;
|
||||
import com.mogo.eagle.core.network.SubscribeImpl;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.constants.HostConst;
|
||||
import com.mogo.module.service.network.bean.TtsConfigEntity;
|
||||
import com.mogo.utils.network.RequestOptions;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.util.Log;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.map.navi.IMogoAimlessModeListener;
|
||||
import com.mogo.map.navi.MogoCongestionInfo;
|
||||
import com.mogo.map.navi.MogoCongestionLink;
|
||||
@@ -15,7 +16,6 @@ import com.mogo.module.common.entity.RoadTrafficStatus;
|
||||
import com.mogo.module.common.entity.UploadTrafficEntity;
|
||||
import com.mogo.module.share.net.TrafficModelData;
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -39,9 +39,11 @@ import android.util.ArrayMap;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.network.SubscribeImpl;
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.network.RequestOptions;
|
||||
import com.mogo.eagle.core.network.SubscribeImpl;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.module.common.constants.HostConst;
|
||||
import com.mogo.module.common.dialog.BaseFloatDialog;
|
||||
import com.mogo.module.common.utils.CloudPoiManager;
|
||||
@@ -61,8 +63,6 @@ import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
import com.mogo.utils.NetworkUtils;
|
||||
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 org.json.JSONObject;
|
||||
|
||||
@@ -13,8 +13,8 @@ import com.mogo.module.share.strategyreceiver.AccidentStrategyReceiver
|
||||
import com.mogo.module.share.strategyreceiver.BlockStrategy
|
||||
import com.mogo.service.IMogoServiceApis
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil
|
||||
import com.mogo.utils.logger.Logger
|
||||
import com.mogo.utils.network.utils.GsonUtil
|
||||
import org.json.JSONObject
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.mogo.module.share.bean
|
||||
|
||||
import com.mogo.utils.network.utils.GsonUtil
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil
|
||||
|
||||
/**
|
||||
* 故障求助接口请求参数
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.mogo.module.share.bean
|
||||
|
||||
import com.mogo.utils.network.utils.GsonUtil
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil
|
||||
|
||||
class ShareConfigRequest(val sn:String,val adCode:String) {
|
||||
fun toJson():String{
|
||||
|
||||
@@ -7,13 +7,13 @@ import android.widget.GridLayout
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil
|
||||
import com.mogo.module.share.R
|
||||
import com.mogo.module.share.bean.FixableButton
|
||||
import com.mogo.module.share.constant.ShareConstants
|
||||
import com.mogo.service.share.IMogoTanluProvider
|
||||
import com.mogo.utils.glide.GlideApp
|
||||
import com.mogo.utils.logger.Logger
|
||||
import com.mogo.utils.network.utils.GsonUtil
|
||||
import com.mogo.utils.storage.SharedPrefsMgr
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,9 +7,10 @@ import android.util.ArrayMap
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.commons.analytics.AnalyticsUtils
|
||||
import com.mogo.eagle.core.data.BaseData
|
||||
import com.mogo.commons.network.SubscribeImpl
|
||||
import com.mogo.commons.voice.AIAssist
|
||||
import com.mogo.commons.voice.IMogoVoiceCmdCallBack
|
||||
import com.mogo.eagle.core.network.RequestOptions
|
||||
import com.mogo.eagle.core.network.SubscribeImpl
|
||||
import com.mogo.module.common.constants.HostConst
|
||||
import com.mogo.module.share.bean.SeekRecord
|
||||
import com.mogo.module.share.bean.SeekRequest
|
||||
@@ -17,7 +18,6 @@ import com.mogo.module.share.bean.getJson
|
||||
import com.mogo.module.share.net.ShareRtlApiService
|
||||
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast
|
||||
import com.mogo.utils.logger.Logger
|
||||
import com.mogo.utils.network.RequestOptions
|
||||
import com.mogo.utils.storage.SharedPrefsMgr
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
@@ -164,7 +164,8 @@ object SeekHelpManager {
|
||||
properties["from"] = from
|
||||
AnalyticsUtils.track("v2x_share_type", properties)
|
||||
|
||||
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)) {
|
||||
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,改变自车图标
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user