更新passport版本,分发onMapLoaded事件
This commit is contained in:
@@ -53,7 +53,7 @@ class PassportManager implements IMogoPassportManager {
|
||||
Logger.d( TAG, "success" );
|
||||
SpStorage.setTicket( ticket );
|
||||
if ( callback != null ) {
|
||||
callback.onSuccess( ticket );
|
||||
callback.onTicketGot( ticket );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ dependencies {
|
||||
// 长链
|
||||
implementation 'com.zhidao.socket:built-in-socket:1.0.15'
|
||||
// passport
|
||||
implementation 'com.zhidao.tcloginsdk:tclogin:1.0.9'
|
||||
implementation 'com.zhidao.tcloginsdk:tclogin:1.1.0'
|
||||
|
||||
annotationProcessor 'com.elegant.spi:compiler:1.0.3'
|
||||
|
||||
|
||||
@@ -11,8 +11,9 @@ import com.mogo.service.passport.IMogoTicketCallback;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidao.accountsdk.manager.CarPadClientManagerImpl;
|
||||
import com.zhidao.accountsdk.manager.TicketInfoCallback;
|
||||
import com.zhidao.accountsdk.network.NetEnvironManager;
|
||||
import com.zhidao.tcloginsdk.LoginManager;
|
||||
import com.zhidao.tcloginsdk.model.TokenData;
|
||||
import com.zhidao.tcloginsdk.network.LoginCallback;
|
||||
|
||||
public
|
||||
/**
|
||||
@@ -29,13 +30,14 @@ class PassportManager implements IMogoPassportManager {
|
||||
|
||||
private static volatile PassportManager sInstance;
|
||||
|
||||
private PassportManager(){}
|
||||
private PassportManager() {
|
||||
}
|
||||
|
||||
@Keep
|
||||
public static PassportManager getInstance(){
|
||||
if( sInstance == null ){
|
||||
synchronized( PassportManager.class ) {
|
||||
if( sInstance == null ){
|
||||
public static PassportManager getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( PassportManager.class ) {
|
||||
if ( sInstance == null ) {
|
||||
sInstance = new PassportManager();
|
||||
}
|
||||
}
|
||||
@@ -43,30 +45,46 @@ class PassportManager implements IMogoPassportManager {
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release(){
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void requestTicket( final IMogoTicketCallback callback ) {
|
||||
getTicket( new TicketInfoCallback() {
|
||||
LoginManager.getInstance( mContext ).login( DebugConfig.getCarMachineType() != DebugConfig.CAR_MACHINE_TYPE_SELF_INNOVATE, DebugConfig.getProductFlavor(), new LoginCallback() {
|
||||
@Override
|
||||
public void onSuccess( String ticket ) {
|
||||
Logger.d( TAG, "success" );
|
||||
SpStorage.setTicket( ticket );
|
||||
public void onSuccess( TokenData.TokenResult result ) {
|
||||
if ( callback != null ) {
|
||||
callback.onSuccess( ticket );
|
||||
callback.onLoginSuccess( result.token, result.sn );
|
||||
}
|
||||
getTicket( new TicketInfoCallback() {
|
||||
@Override
|
||||
public void onSuccess( String ticket ) {
|
||||
Logger.d( TAG, "success" );
|
||||
SpStorage.setTicket( ticket );
|
||||
if ( callback != null ) {
|
||||
callback.onTicketGot( ticket );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure( int code ) {
|
||||
Logger.d( TAG, "fail" );
|
||||
if ( callback != null ) {
|
||||
callback.onError( code, "getTicket error." );
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure( int code ) {
|
||||
Logger.d( TAG, "fail" );
|
||||
public void onFailure( int code, String msg ) {
|
||||
if ( callback != null ) {
|
||||
callback.onError( code, "error." );
|
||||
callback.onError( code, "login: " + msg );
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
}
|
||||
|
||||
private void getTicket( TicketInfoCallback callback ) {
|
||||
@@ -96,6 +114,5 @@ class PassportManager implements IMogoPassportManager {
|
||||
mode = DebugConfig.NET_MODE_QA;
|
||||
}
|
||||
LoginManager.getInstance( context ).setNetEnviron( mode );
|
||||
LoginManager.getInstance( context ).login(DebugConfig.getCarMachineType() != DebugConfig.CAR_MACHINE_TYPE_SELF_INNOVATE, DebugConfig.getProductFlavor());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,35 +110,6 @@ public class AbsMogoApplication extends Application {
|
||||
|
||||
}
|
||||
|
||||
// private static void initAccountSdk() {
|
||||
// int mode = DebugConfig.getNetMode();
|
||||
// if ( mode == DebugConfig.NET_MODE_DEMO ) {
|
||||
// // 演示环境用 qa 的
|
||||
// mode = DebugConfig.NET_MODE_QA;
|
||||
// }
|
||||
// AccountClientManager.init( sApp, mode, NetEnvironManager.OS_2C, "os2.0-launcher" );
|
||||
// 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 getTicket( TicketInfoCallback callback ) {
|
||||
// if ( DebugConfig.isLauncher() ) {
|
||||
// AccountClientManager.getTicket( callback );
|
||||
// } else {
|
||||
// AccountClientManager.getAppTicket( callback );
|
||||
// }
|
||||
// }
|
||||
|
||||
private static void initNetConfig() {
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user