调整passport调用

This commit is contained in:
董宏宇
2021-01-20 19:53:16 +08:00
parent 0f7d60a77d
commit 5196d4f926

View File

@@ -7,7 +7,6 @@ import androidx.annotation.Keep;
import com.mogo.cloud.httpdns.MogoHttpDnsClient;
import com.mogo.cloud.httpdns.MogoHttpDnsConfig;
import com.mogo.cloud.httpdns.bean.HttpDnsSimpleLocation;
import com.zhidao.tcloginsdk.LoginManager;
import com.zhidao.tcloginsdk.model.ThirdLoginParam;
import com.zhidao.tcloginsdk.model.TokenData;
@@ -68,45 +67,57 @@ public class MoGoAiCloudClient {
if (mAiCloudClientConfig != null) {
ThirdLoginParam thirdLoginParam = ThirdLoginParam.of(
mAiCloudClientConfig.getThirdPartyDeviceId(),
mAiCloudClientConfig.getThirdPartyAppKey(),
mAiCloudClientConfig.getThirdPartySignSecret()
mAiCloudClientConfig.getThirdPartyAppKey()
);
LoginCallback loginCallback = new LoginCallback() {
@Override
public void onSuccess(TokenData.TokenResult result) {
Log.i(TAG, "═════════════════════════════════════");
Log.i(TAG, "║ MoGo鉴权成功 ");
Log.i(TAG, "║ SN" + result.sn);
Log.i(TAG, "║ Token" + result.token);
Log.i(TAG, "═════════════════════════════════════");
if (tokenCallback != null) {
tokenCallback.onTokenGot(result.token, result.sn);
}
// 变量赋值
if (mAiCloudClientConfig != null) {
mAiCloudClientConfig.sn = result.sn;
mAiCloudClientConfig.token = result.token;
}
// 初始化HttpDNS
mHttpDnsConfig =
new MogoHttpDnsConfig()
.setContext(mContext)
.setSn(mAiCloudClientConfig.sn)
.setEnv(mAiCloudClientConfig.getNetMode())
.setShowDebugLog(mAiCloudClientConfig.isShowDebugLog())
.setCurrentLocation(mAiCloudClientConfig.getIHttpDnsCurrentLocation())
.setLoopCheckDelay(mAiCloudClientConfig.getLoopCheckDelay());
MogoHttpDnsClient.INSTANCE.init(mHttpDnsConfig);
}
@Override
public void onFailure(int code, String msg) {
Log.e(TAG, "═════════════════════════════════════");
Log.e(TAG, "║ MoGo鉴权失败 ");
Log.e(TAG, "║ ErrorCode" + code);
Log.e(TAG, "║ ErrorMessage" + msg);
Log.e(TAG, "═════════════════════════════════════");
if (tokenCallback != null) {
tokenCallback.onError(code, msg);
}
}
};
Log.w(TAG, "loginCallback" + loginCallback);
LoginManager.getInstance(mContext).login(
mAiCloudClientConfig.isThirdLogin(),
thirdLoginParam,
new LoginCallback() {
@Override
public void onSuccess(TokenData.TokenResult result) {
if (tokenCallback != null) {
tokenCallback.onTokenGot(result.token, result.sn);
}
// 变量赋值
if (mAiCloudClientConfig != null) {
mAiCloudClientConfig.sn = result.sn;
mAiCloudClientConfig.token = result.token;
}
// 初始化HttpDNS
mHttpDnsConfig =
new MogoHttpDnsConfig()
.setContext(mContext)
.setSn(mAiCloudClientConfig.sn)
.setEnv(mAiCloudClientConfig.getNetMode())
.setShowDebugLog(mAiCloudClientConfig.isShowDebugLog())
.setCurrentLocation(mAiCloudClientConfig.getIHttpDnsCurrentLocation())
.setLoopCheckDelay(mAiCloudClientConfig.getLoopCheckDelay());
MogoHttpDnsClient.INSTANCE.init(mHttpDnsConfig);
}
@Override
public void onFailure(int code, String msg) {
if (tokenCallback != null) {
tokenCallback.onError(code, msg);
}
}
});
thirdLoginParam, loginCallback);
} else {
Log.e(TAG, "SDK MoGoAiCloudClientConfig 为 null请检查");
}