opt'
This commit is contained in:
@@ -1,10 +1,8 @@
|
||||
package com.mogo.commons;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.bumptech.glide.load.model.GlideUrl;
|
||||
import com.elegant.analytics.Analytics;
|
||||
import com.elegant.analytics.AnalyticsConfig;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
@@ -22,14 +20,12 @@ import com.zhidao.account.sdk.callback.TicketInfoCallback;
|
||||
import com.zhidao.account.sdk.network.NetEnvironManager;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.security.SecureRandom;
|
||||
|
||||
import javax.net.ssl.SSLContext;
|
||||
import javax.net.ssl.TrustManager;
|
||||
|
||||
import okhttp3.Interceptor;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
|
||||
@@ -62,23 +58,57 @@ public class AbsMogoApplication extends Application {
|
||||
}
|
||||
|
||||
private void syncInit(){
|
||||
// 初始化埋点
|
||||
Analytics.getInstance().start( sApp );
|
||||
Analytics.getInstance().setAppKey( "6bbe7e0e1ecd8e2f8dc336e1678a2791" );
|
||||
// 0 - debug 近实时上报,积累一条埋点上报,或者积累3秒上报一次。
|
||||
// 2 - 本地缓存,聚合上报,积累30条埋点上报,或者积累60秒上报一次。
|
||||
AnalyticsConfig.getInstance( sApp ).setMode( DebugConfig.isDebug() ? 2 : 2 );
|
||||
AnalyticsConfig.getInstance( sApp ).shouldLog( DebugConfig.isDebug() );
|
||||
|
||||
// 初始化 arouter
|
||||
if ( DebugConfig.isDebug() ) {
|
||||
ARouter.openDebug();
|
||||
ARouter.openLog();
|
||||
}
|
||||
ARouter.init( sApp );
|
||||
}
|
||||
|
||||
initNetConfig();
|
||||
initAccountSdk();
|
||||
/**
|
||||
* 忽略 https 验证
|
||||
*
|
||||
* @return
|
||||
* @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;
|
||||
}
|
||||
|
||||
private void asyncInit(){
|
||||
ThreadPoolService.execute( ()->{
|
||||
initNetConfig();
|
||||
initAccountSdk();
|
||||
// 初始化toast
|
||||
TipToast.init( sApp, null );
|
||||
// 初始化埋点
|
||||
Analytics.getInstance().start( sApp );
|
||||
Analytics.getInstance().setAppKey( "6bbe7e0e1ecd8e2f8dc336e1678a2791" );
|
||||
// 0 - debug 近实时上报,积累一条埋点上报,或者积累3秒上报一次。
|
||||
// 2 - 本地缓存,聚合上报,积累30条埋点上报,或者积累60秒上报一次。
|
||||
AnalyticsConfig.getInstance( sApp ).setMode( DebugConfig.isDebug() ? 2 : 2 );
|
||||
AnalyticsConfig.getInstance( sApp ).shouldLog( DebugConfig.isDebug() );
|
||||
} );
|
||||
}
|
||||
|
||||
private static void initAccountSdk() {
|
||||
AccountClientManager.init( sApp, DebugConfig.getNetMode(), NetEnvironManager.OS_2C, "os2.0-launcher" );
|
||||
AccountClientManager.getTicket( new TicketInfoCallback() {
|
||||
@Override
|
||||
public void onSuccess( String ticket ) {
|
||||
SpStorage.setTicket( ticket );
|
||||
Logger.w( TAG, "request ticket success" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure( int code, String msg ) {
|
||||
Logger.w( TAG, "request ticket error code = %d, msg = %s", code, msg );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
private static void initNetConfig() {
|
||||
@@ -105,41 +135,4 @@ public class AbsMogoApplication extends Application {
|
||||
} )
|
||||
.setLoggable( DebugConfig.isDebug() );
|
||||
}
|
||||
|
||||
/**
|
||||
* 忽略 https 验证
|
||||
*
|
||||
* @return
|
||||
* @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;
|
||||
}
|
||||
|
||||
private void asyncInit(){
|
||||
ThreadPoolService.execute( ()->{
|
||||
initAccountSdk();
|
||||
// 初始化toast
|
||||
TipToast.init( sApp, null );
|
||||
} );
|
||||
}
|
||||
|
||||
private static void initAccountSdk() {
|
||||
AccountClientManager.init( sApp, DebugConfig.getNetMode(), NetEnvironManager.OS_2C, "os2.0-launcher" );
|
||||
AccountClientManager.getTicket( new TicketInfoCallback() {
|
||||
@Override
|
||||
public void onSuccess( String ticket ) {
|
||||
SpStorage.setTicket( ticket );
|
||||
Logger.w( TAG, "request ticket success" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure( int code, String msg ) {
|
||||
Logger.w( TAG, "request ticket error code = %d, msg = %s", code, msg );
|
||||
}
|
||||
} );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user