.class public Lcom/ali/auth/third/login/task/BindByUsernameTask;
.super Lcom/ali/auth/third/core/task/AbsAsyncTask;
.source "BindByUsernameTask.java"


# annotations
.annotation system Ldalvik/annotation/Signature;
    value = {
        "Lcom/ali/auth/third/core/task/AbsAsyncTask<",
        "Ljava/lang/String;",
        "Ljava/lang/Void;",
        "Ljava/lang/Void;",
        ">;"
    }
.end annotation


# static fields
.field private static final TAG:Ljava/lang/String; = "login"


# instance fields
.field private bridgeCallbackContext:Lcom/ali/auth/third/ui/context/BridgeCallbackContext;


# direct methods
.method public constructor <init>(Lcom/ali/auth/third/ui/context/BridgeCallbackContext;)V
    .locals 0

    .line 29
    invoke-direct {p0}, Lcom/ali/auth/third/core/task/AbsAsyncTask;-><init>()V

    .line 30
    iput-object p1, p0, Lcom/ali/auth/third/login/task/BindByUsernameTask;->bridgeCallbackContext:Lcom/ali/auth/third/ui/context/BridgeCallbackContext;

    return-void
.end method


# virtual methods
.method protected bridge synthetic asyncExecute([Ljava/lang/Object;)Ljava/lang/Object;
    .locals 0

    .line 22
    check-cast p1, [Ljava/lang/String;

    invoke-virtual {p0, p1}, Lcom/ali/auth/third/login/task/BindByUsernameTask;->asyncExecute([Ljava/lang/String;)Ljava/lang/Void;

    move-result-object p1

    return-object p1
.end method

.method protected varargs asyncExecute([Ljava/lang/String;)Ljava/lang/Void;
    .locals 5

    .line 35
    invoke-static {}, Lcom/ali/auth/third/core/util/CommonUtils;->isNetworkAvailable()Z

    move-result v0

    const/4 v1, 0x0

    if-nez v0, :cond_0

    .line 36
    new-instance p1, Lcom/ali/auth/third/core/model/RpcResponse;

    invoke-direct {p1}, Lcom/ali/auth/third/core/model/RpcResponse;-><init>()V

    const/4 v0, -0x1

    .line 37
    iput v0, p1, Lcom/ali/auth/third/core/model/RpcResponse;->code:I

    const-string v0, "com_taobao_tae_sdk_network_not_available_message"

    .line 38
    invoke-static {v0}, Lcom/ali/auth/third/core/util/ResourceUtils;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    iput-object v0, p1, Lcom/ali/auth/third/core/model/RpcResponse;->message:Ljava/lang/String;

    .line 39
    new-instance v0, Lorg/json/JSONObject;

    invoke-direct {v0}, Lorg/json/JSONObject;-><init>()V

    :try_start_0
    const-string v2, "code"

    .line 41
    iget v3, p1, Lcom/ali/auth/third/core/model/RpcResponse;->code:I

    invoke-virtual {v0, v2, v3}, Lorg/json/JSONObject;->put(Ljava/lang/String;I)Lorg/json/JSONObject;

    const-string v2, "message"

    .line 42
    iget-object p1, p1, Lcom/ali/auth/third/core/model/RpcResponse;->message:Ljava/lang/String;

    invoke-virtual {v0, v2, p1}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;
    :try_end_0
    .catch Lorg/json/JSONException; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    :catch_0
    move-exception p1

    .line 45
    invoke-virtual {p1}, Lorg/json/JSONException;->printStackTrace()V

    .line 47
    :goto_0
    iget-object p1, p0, Lcom/ali/auth/third/login/task/BindByUsernameTask;->bridgeCallbackContext:Lcom/ali/auth/third/ui/context/BridgeCallbackContext;

    invoke-virtual {v0}, Lorg/json/JSONObject;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p1, v0}, Lcom/ali/auth/third/ui/context/BridgeCallbackContext;->success(Ljava/lang/String;)V

    return-object v1

    .line 51
    :cond_0
    sget-object v0, Lcom/ali/auth/third/login/LoginComponent;->INSTANCE:Lcom/ali/auth/third/login/LoginComponent;

    const/4 v2, 0x0

    aget-object p1, p1, v2

    invoke-virtual {v0, p1}, Lcom/ali/auth/third/login/LoginComponent;->loginByUserName(Ljava/lang/String;)Lcom/ali/auth/third/core/model/RpcResponse;

    move-result-object p1

    if-nez p1, :cond_1

    .line 53
    iget-object p1, p0, Lcom/ali/auth/third/login/task/BindByUsernameTask;->bridgeCallbackContext:Lcom/ali/auth/third/ui/context/BridgeCallbackContext;

    const-string v0, ""

    invoke-virtual {p1, v0}, Lcom/ali/auth/third/ui/context/BridgeCallbackContext;->onFailure(Ljava/lang/String;)V

    return-object v1

    .line 58
    :cond_1
    :try_start_1
    iget v0, p1, Lcom/ali/auth/third/core/model/RpcResponse;->code:I

    const/16 v3, 0xbb8

    if-ne v0, v3, :cond_2

    .line 59
    sget-object v0, Lcom/ali/auth/third/login/context/LoginContext;->credentialService:Lcom/ali/auth/third/core/service/CredentialService;

    iget-object p1, p1, Lcom/ali/auth/third/core/model/RpcResponse;->returnValue:Ljava/lang/Object;

    check-cast p1, Lcom/ali/auth/third/core/model/LoginReturnData;

    invoke-interface {v0, p1}, Lcom/ali/auth/third/core/service/CredentialService;->refreshWhenLogin(Lcom/ali/auth/third/core/model/LoginReturnData;)V

    .line 60
    iget-object p1, p0, Lcom/ali/auth/third/login/task/BindByUsernameTask;->bridgeCallbackContext:Lcom/ali/auth/third/ui/context/BridgeCallbackContext;

    invoke-virtual {p1}, Lcom/ali/auth/third/ui/context/BridgeCallbackContext;->getActivity()Landroid/app/Activity;

    move-result-object p1

    sget-object v0, Lcom/ali/auth/third/core/model/ResultCode;->SUCCESS:Lcom/ali/auth/third/core/model/ResultCode;

    iget v0, v0, Lcom/ali/auth/third/core/model/ResultCode;->code:I

    invoke-virtual {p1, v0}, Landroid/app/Activity;->setResult(I)V

    .line 61
    iget-object p1, p0, Lcom/ali/auth/third/login/task/BindByUsernameTask;->bridgeCallbackContext:Lcom/ali/auth/third/ui/context/BridgeCallbackContext;

    invoke-virtual {p1}, Lcom/ali/auth/third/ui/context/BridgeCallbackContext;->getActivity()Landroid/app/Activity;

    move-result-object p1

    invoke-virtual {p1}, Landroid/app/Activity;->finish()V

    goto/16 :goto_1

    .line 62
    :cond_2
    iget v0, p1, Lcom/ali/auth/third/core/model/RpcResponse;->code:I

    const/16 v3, 0x32d2

    if-ne v0, v3, :cond_4

    .line 63
    new-instance v0, Lorg/json/JSONObject;

    invoke-direct {v0}, Lorg/json/JSONObject;-><init>()V

    const-string v3, "code"

    const/16 v4, 0x3ef

    .line 64
    invoke-virtual {v0, v3, v4}, Lorg/json/JSONObject;->put(Ljava/lang/String;I)Lorg/json/JSONObject;

    const-string v3, "message"

    .line 65
    iget-object v4, p1, Lcom/ali/auth/third/core/model/RpcResponse;->message:Ljava/lang/String;

    invoke-virtual {v0, v3, v4}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    const-string v3, "success"

    .line 66
    invoke-virtual {v0, v3, v2}, Lorg/json/JSONObject;->put(Ljava/lang/String;Z)Lorg/json/JSONObject;

    .line 67
    new-instance v2, Lorg/json/JSONObject;

    invoke-direct {v2}, Lorg/json/JSONObject;-><init>()V

    .line 68
    iget-object v3, p1, Lcom/ali/auth/third/core/model/RpcResponse;->returnValue:Ljava/lang/Object;

    if-eqz v3, :cond_3

    const-string v3, "checkCodeId"

    .line 69
    iget-object v4, p1, Lcom/ali/auth/third/core/model/RpcResponse;->returnValue:Ljava/lang/Object;

    check-cast v4, Lcom/ali/auth/third/core/model/LoginReturnData;

    iget-object v4, v4, Lcom/ali/auth/third/core/model/LoginReturnData;->checkCodeId:Ljava/lang/String;

    invoke-virtual {v2, v3, v4}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    const-string v3, "checkCodeUrl"

    .line 70
    iget-object p1, p1, Lcom/ali/auth/third/core/model/RpcResponse;->returnValue:Ljava/lang/Object;

    check-cast p1, Lcom/ali/auth/third/core/model/LoginReturnData;

    iget-object p1, p1, Lcom/ali/auth/third/core/model/LoginReturnData;->checkCodeUrl:Ljava/lang/String;

    invoke-virtual {v2, v3, p1}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    :cond_3
    const-string p1, "data"

    .line 72
    invoke-virtual {v0, p1, v2}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    .line 74
    iget-object p1, p0, Lcom/ali/auth/third/login/task/BindByUsernameTask;->bridgeCallbackContext:Lcom/ali/auth/third/ui/context/BridgeCallbackContext;

    invoke-virtual {v0}, Lorg/json/JSONObject;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p1, v0}, Lcom/ali/auth/third/ui/context/BridgeCallbackContext;->success(Ljava/lang/String;)V

    goto/16 :goto_1

    .line 76
    :cond_4
    iget v0, p1, Lcom/ali/auth/third/core/model/RpcResponse;->code:I

    const/16 v2, 0x32d3

    if-ne v0, v2, :cond_6

    .line 77
    new-instance v0, Lorg/json/JSONObject;

    invoke-direct {v0}, Lorg/json/JSONObject;-><init>()V

    const-string v2, "code"

    const/16 v3, 0x3f0

    .line 78
    invoke-virtual {v0, v2, v3}, Lorg/json/JSONObject;->put(Ljava/lang/String;I)Lorg/json/JSONObject;

    const-string v2, "message"

    .line 79
    iget-object v3, p1, Lcom/ali/auth/third/core/model/RpcResponse;->message:Ljava/lang/String;

    invoke-virtual {v0, v2, v3}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    .line 81
    new-instance v2, Lorg/json/JSONObject;

    invoke-direct {v2}, Lorg/json/JSONObject;-><init>()V

    .line 82
    iget-object v3, p1, Lcom/ali/auth/third/core/model/RpcResponse;->returnValue:Ljava/lang/Object;

    if-eqz v3, :cond_5

    const-string v3, "checkCodeId"

    .line 83
    iget-object v4, p1, Lcom/ali/auth/third/core/model/RpcResponse;->returnValue:Ljava/lang/Object;

    check-cast v4, Lcom/ali/auth/third/core/model/LoginReturnData;

    iget-object v4, v4, Lcom/ali/auth/third/core/model/LoginReturnData;->checkCodeId:Ljava/lang/String;

    invoke-virtual {v2, v3, v4}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    const-string v3, "checkCodeUrl"

    .line 84
    iget-object p1, p1, Lcom/ali/auth/third/core/model/RpcResponse;->returnValue:Ljava/lang/Object;

    check-cast p1, Lcom/ali/auth/third/core/model/LoginReturnData;

    iget-object p1, p1, Lcom/ali/auth/third/core/model/LoginReturnData;->checkCodeUrl:Ljava/lang/String;

    invoke-virtual {v2, v3, p1}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    :cond_5
    const-string p1, "data"

    .line 86
    invoke-virtual {v0, p1, v2}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    .line 88
    iget-object p1, p0, Lcom/ali/auth/third/login/task/BindByUsernameTask;->bridgeCallbackContext:Lcom/ali/auth/third/ui/context/BridgeCallbackContext;

    invoke-virtual {v0}, Lorg/json/JSONObject;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p1, v0}, Lcom/ali/auth/third/ui/context/BridgeCallbackContext;->success(Ljava/lang/String;)V

    goto/16 :goto_1

    .line 90
    :cond_6
    iget v0, p1, Lcom/ali/auth/third/core/model/RpcResponse;->code:I

    const/16 v2, 0x3304

    if-ne v0, v2, :cond_9

    .line 91
    new-instance v0, Lorg/json/JSONObject;

    invoke-direct {v0}, Lorg/json/JSONObject;-><init>()V

    const-string v2, "code"

    const/16 v3, 0x3f5

    .line 92
    invoke-virtual {v0, v2, v3}, Lorg/json/JSONObject;->put(Ljava/lang/String;I)Lorg/json/JSONObject;

    const-string v2, "message"

    .line 93
    iget-object v3, p1, Lcom/ali/auth/third/core/model/RpcResponse;->message:Ljava/lang/String;

    invoke-virtual {v0, v2, v3}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    .line 94
    new-instance v2, Lorg/json/JSONObject;

    invoke-direct {v2}, Lorg/json/JSONObject;-><init>()V

    .line 95
    iget-object v3, p1, Lcom/ali/auth/third/core/model/RpcResponse;->returnValue:Ljava/lang/Object;

    if-eqz v3, :cond_7

    const-string v3, "doubleCheckUrl"

    .line 96
    iget-object v4, p1, Lcom/ali/auth/third/core/model/RpcResponse;->returnValue:Ljava/lang/Object;

    check-cast v4, Lcom/ali/auth/third/core/model/LoginReturnData;

    iget-object v4, v4, Lcom/ali/auth/third/core/model/LoginReturnData;->h5Url:Ljava/lang/String;

    invoke-virtual {v2, v3, v4}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    :cond_7
    const-string v3, "data"

    .line 97
    invoke-virtual {v0, v3, v2}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    .line 98
    iget-object v2, p1, Lcom/ali/auth/third/core/model/RpcResponse;->returnValue:Ljava/lang/Object;

    if-eqz v2, :cond_8

    .line 99
    iget-object v2, p0, Lcom/ali/auth/third/login/task/BindByUsernameTask;->bridgeCallbackContext:Lcom/ali/auth/third/ui/context/BridgeCallbackContext;

    invoke-virtual {v2}, Lcom/ali/auth/third/ui/context/BridgeCallbackContext;->getActivity()Landroid/app/Activity;

    move-result-object v2

    check-cast v2, Lcom/ali/auth/third/ui/LoginWebViewActivity;

    iget-object v2, p1, Lcom/ali/auth/third/core/model/RpcResponse;->returnValue:Ljava/lang/Object;

    check-cast v2, Lcom/ali/auth/third/core/model/LoginReturnData;

    iget-object v2, v2, Lcom/ali/auth/third/core/model/LoginReturnData;->token:Ljava/lang/String;

    sput-object v2, Lcom/ali/auth/third/ui/LoginWebViewActivity;->token:Ljava/lang/String;

    .line 100
    iget-object v2, p0, Lcom/ali/auth/third/login/task/BindByUsernameTask;->bridgeCallbackContext:Lcom/ali/auth/third/ui/context/BridgeCallbackContext;

    invoke-virtual {v2}, Lcom/ali/auth/third/ui/context/BridgeCallbackContext;->getActivity()Landroid/app/Activity;

    move-result-object v2

    check-cast v2, Lcom/ali/auth/third/ui/LoginWebViewActivity;

    iget-object p1, p1, Lcom/ali/auth/third/core/model/RpcResponse;->returnValue:Ljava/lang/Object;

    check-cast p1, Lcom/ali/auth/third/core/model/LoginReturnData;

    iget-object p1, p1, Lcom/ali/auth/third/core/model/LoginReturnData;->scene:Ljava/lang/String;

    sput-object p1, Lcom/ali/auth/third/ui/LoginWebViewActivity;->scene:Ljava/lang/String;

    .line 102
    :cond_8
    iget-object p1, p0, Lcom/ali/auth/third/login/task/BindByUsernameTask;->bridgeCallbackContext:Lcom/ali/auth/third/ui/context/BridgeCallbackContext;

    invoke-virtual {v0}, Lorg/json/JSONObject;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p1, v0}, Lcom/ali/auth/third/ui/context/BridgeCallbackContext;->success(Ljava/lang/String;)V

    goto :goto_1

    .line 105
    :cond_9
    new-instance v0, Lorg/json/JSONObject;

    invoke-direct {v0}, Lorg/json/JSONObject;-><init>()V

    const-string v2, "code"

    .line 106
    iget v3, p1, Lcom/ali/auth/third/core/model/RpcResponse;->code:I

    invoke-virtual {v0, v2, v3}, Lorg/json/JSONObject;->put(Ljava/lang/String;I)Lorg/json/JSONObject;

    const-string v2, "message"

    .line 107
    iget-object p1, p1, Lcom/ali/auth/third/core/model/RpcResponse;->message:Ljava/lang/String;

    invoke-virtual {v0, v2, p1}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    .line 108
    iget-object p1, p0, Lcom/ali/auth/third/login/task/BindByUsernameTask;->bridgeCallbackContext:Lcom/ali/auth/third/ui/context/BridgeCallbackContext;

    invoke-virtual {v0}, Lorg/json/JSONObject;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p1, v0}, Lcom/ali/auth/third/ui/context/BridgeCallbackContext;->success(Ljava/lang/String;)V
    :try_end_1
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_1

    goto :goto_1

    :catch_1
    move-exception p1

    .line 111
    invoke-virtual {p1}, Ljava/lang/Exception;->printStackTrace()V

    :goto_1
    return-object v1
.end method

.method protected doFinally()V
    .locals 0

    return-void
.end method

.method protected doWhenException(Ljava/lang/Throwable;)V
    .locals 2

    const/4 v0, 0x1

    .line 121
    new-array v0, v0, [Ljava/lang/Object;

    invoke-virtual {p1}, Ljava/lang/Throwable;->getMessage()Ljava/lang/String;

    move-result-object p1

    const/4 v1, 0x0

    aput-object p1, v0, v1

    const/16 p1, 0x271a

    invoke-static {p1, v0}, Lcom/ali/auth/third/core/message/MessageUtils;->createMessage(I[Ljava/lang/Object;)Lcom/ali/auth/third/core/message/Message;

    move-result-object p1

    const-string v0, "login"

    .line 122
    invoke-virtual {p1}, Ljava/lang/Object;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v0, v1}, Lcom/ali/auth/third/core/trace/SDKLogger;->d(Ljava/lang/String;Ljava/lang/String;)V

    .line 123
    iget-object v0, p0, Lcom/ali/auth/third/login/task/BindByUsernameTask;->bridgeCallbackContext:Lcom/ali/auth/third/ui/context/BridgeCallbackContext;

    iget v1, p1, Lcom/ali/auth/third/core/message/Message;->code:I

    iget-object p1, p1, Lcom/ali/auth/third/core/message/Message;->message:Ljava/lang/String;

    invoke-virtual {v0, v1, p1}, Lcom/ali/auth/third/ui/context/BridgeCallbackContext;->onFailure(ILjava/lang/String;)V

    return-void
.end method
