opt
This commit is contained in:
@@ -20,13 +20,17 @@ import com.zhidao.account.sdk.AccountClientManager;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -86,6 +90,17 @@ public class AbsMogoApplication extends Application {
|
||||
NetConfig.instance().setSignaturePrefix( Constants.SIGN_PREFIX )
|
||||
.setPublicParams( ParamsUtil.getStaticParams() )
|
||||
.setHostnameVerifier( new AllAllowedHostnameVerifier() )
|
||||
.addNetworkInterceptor( new Interceptor() {
|
||||
@Override
|
||||
public Response intercept( Chain chain ) throws IOException {
|
||||
Request original = chain.request();
|
||||
Request request = original.newBuilder()
|
||||
.header( "token", SpStorage.getTicket() )
|
||||
.method( original.method(), original.body() )
|
||||
.build();
|
||||
return chain.proceed( request );
|
||||
}
|
||||
} )
|
||||
.setLoggable( DebugConfig.isDebug() );
|
||||
}
|
||||
|
||||
@@ -103,11 +118,12 @@ public class AbsMogoApplication extends Application {
|
||||
}
|
||||
|
||||
private static void initAccountSdk() {
|
||||
AccountClientManager.init( sApp, NetEnvironManager.QA, NetEnvironManager.OS_2C, "os2.0-launcher" );
|
||||
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
|
||||
|
||||
@@ -33,6 +33,13 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack {
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
if ( mCmdMap != null && !mCmdMap.isEmpty() && mVoiceClient != null ) {
|
||||
for ( String cmd : mCmdMap.keySet() ) {
|
||||
mVoiceClient.unRegisterCustomWakeupCmd( cmd );
|
||||
}
|
||||
}
|
||||
mVoiceMap.clear();
|
||||
mVoiceClient.release();
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
@@ -204,7 +211,7 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack {
|
||||
callBacks.remove( callBack );
|
||||
}
|
||||
|
||||
public static void startAssistant(Context context) {
|
||||
public static void startAssistant( Context context ) {
|
||||
final Intent intent = new Intent();
|
||||
intent.setFlags( Intent.FLAG_INCLUDE_STOPPED_PACKAGES );
|
||||
intent.setAction( "pvetec.intent.action.txz.switch" );
|
||||
|
||||
Reference in New Issue
Block a user