m.smali

.class final Lcom/sandboxol/gameblocky/web/m;
.super Lcom/sandboxol/common/base/web/OnResponseListener;
.source "BlockyGameApi.java"


# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
    value = Lcom/sandboxol/gameblocky/web/q;->a(Landroid/content/Context;JLjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;JLjava/lang/String;Lcom/sandboxol/common/base/web/OnResponseListener;)V
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x8
    name = null
.end annotation

.annotation system Ldalvik/annotation/Signature;
    value = {
        "Lcom/sandboxol/common/base/web/OnResponseListener<",
        "Lcom/sandboxol/center/entity/MiniGameToken;",
        ">;"
    }
.end annotation


# instance fields
.field final synthetic a:[Lcom/sandboxol/center/entity/MiniGameToken;

.field final synthetic b:Ljava/util/Map;

.field final synthetic c:Ljava/lang/String;

.field final synthetic d:J

.field final synthetic e:Lcom/sandboxol/common/base/web/OnResponseListener;


# direct methods
.method constructor <init>([Lcom/sandboxol/center/entity/MiniGameToken;Ljava/util/Map;Ljava/lang/String;JLcom/sandboxol/common/base/web/OnResponseListener;)V
    .registers 7

    .line 1
    iput-object p1, p0, Lcom/sandboxol/gameblocky/web/m;->a:[Lcom/sandboxol/center/entity/MiniGameToken;

    iput-object p2, p0, Lcom/sandboxol/gameblocky/web/m;->b:Ljava/util/Map;

    iput-object p3, p0, Lcom/sandboxol/gameblocky/web/m;->c:Ljava/lang/String;

    iput-wide p4, p0, Lcom/sandboxol/gameblocky/web/m;->d:J

    iput-object p6, p0, Lcom/sandboxol/gameblocky/web/m;->e:Lcom/sandboxol/common/base/web/OnResponseListener;

    invoke-direct {p0}, Lcom/sandboxol/common/base/web/OnResponseListener;-><init>()V

    return-void
.end method

.method static synthetic a(Lcom/sandboxol/common/base/web/HttpResponse;)V
    .registers 1

    .line 11
    invoke-virtual {p0}, Lcom/sandboxol/common/base/web/HttpResponse;->getCode()I

    move-result p0

    invoke-static {p0}, Lcom/sandboxol/common/utils/HttpUtils;->throwException(I)V

    return-void
.end method

.method static synthetic a([Lcom/sandboxol/center/entity/MiniGameToken;Lcom/sandboxol/center/web/GameRetryWithDelay;Ljava/util/Map;Lcom/sandboxol/common/base/web/HttpResponse;)V
    .registers 7

    .line 1
    invoke-virtual {p3}, Lcom/sandboxol/common/base/web/HttpResponse;->getData()Ljava/lang/Object;

    move-result-object v0

    if-eqz v0, :cond_45

    .line 2
    invoke-virtual {p3}, Lcom/sandboxol/common/base/web/HttpResponse;->getData()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/sandboxol/center/entity/Dispatch;

    .line 3
    invoke-virtual {p3}, Lcom/sandboxol/common/base/web/HttpResponse;->isSuccess()Z

    move-result p3

    if-eqz p3, :cond_2b

    const/4 p3, 0x0

    .line 4
    aget-object v1, p0, p3

    invoke-virtual {v1}, Lcom/sandboxol/center/entity/MiniGameToken;->getDispUrl()Ljava/lang/String;

    move-result-object v1

    iput-object v1, v0, Lcom/sandboxol/center/entity/Dispatch;->dispUrl:Ljava/lang/String;

    .line 5
    aget-object v1, p0, p3

    invoke-virtual {v1}, Lcom/sandboxol/center/entity/MiniGameToken;->getSignature()Ljava/lang/String;

    move-result-object v1

    iput-object v1, v0, Lcom/sandboxol/center/entity/Dispatch;->signature:Ljava/lang/String;

    .line 6
    aget-object p0, p0, p3

    invoke-virtual {p0}, Lcom/sandboxol/center/entity/MiniGameToken;->getTimestamp()J

    move-result-wide v1

    iput-wide v1, v0, Lcom/sandboxol/center/entity/Dispatch;->timestamp:J

    .line 7
    :cond_2b
    iget-boolean p0, v0, Lcom/sandboxol/center/entity/Dispatch;->retry:Z

    if-eqz p0, :cond_34

    const/4 p0, 0x5

    .line 8
    invoke-virtual {p1, p0}, Lcom/sandboxol/center/web/GameRetryWithDelay;->setMoreRetries(I)V

    goto :goto_38

    :cond_34
    const/4 p0, -0x1

    .line 9
    invoke-virtual {p1, p0}, Lcom/sandboxol/center/web/GameRetryWithDelay;->setMoreRetries(I)V

    .line 10
    :goto_38
    invoke-virtual {p1}, Lcom/sandboxol/center/web/GameRetryWithDelay;->getRetryCount()I

    move-result p0

    invoke-static {p0}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object p0

    const-string p1, "retryCount"

    invoke-interface {p2, p1, p0}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    :cond_45
    return-void
.end method


# virtual methods
.method public onError(ILjava/lang/String;)V
    .registers 4

    .line 1
    iget-object v0, p0, Lcom/sandboxol/gameblocky/web/m;->e:Lcom/sandboxol/common/base/web/OnResponseListener;

    invoke-virtual {v0, p1, p2}, Lcom/sandboxol/common/base/web/OnResponseListener;->onError(ILjava/lang/String;)V

    return-void
.end method

.method public onServerError(I)V
    .registers 3

    .line 1
    iget-object v0, p0, Lcom/sandboxol/gameblocky/web/m;->e:Lcom/sandboxol/common/base/web/OnResponseListener;

    invoke-virtual {v0, p1}, Lcom/sandboxol/common/base/web/OnResponseListener;->onServerError(I)V

    return-void
.end method

.method public onSuccess(Lcom/sandboxol/center/entity/MiniGameToken;)V
    .registers 7

    if-eqz p1, :cond_a4

    .line 2
    invoke-virtual {p1}, Lcom/sandboxol/center/entity/MiniGameToken;->getDispUrl()Ljava/lang/String;

    move-result-object v0

    invoke-static {v0}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v0

    if-nez v0, :cond_a4

    .line 3
    iget-object v0, p0, Lcom/sandboxol/gameblocky/web/m;->a:[Lcom/sandboxol/center/entity/MiniGameToken;

    const/4 v1, 0x0

    aput-object p1, v0, v1

    .line 4
    iget-object v0, p0, Lcom/sandboxol/gameblocky/web/m;->b:Ljava/util/Map;

    invoke-virtual {p1}, Lcom/sandboxol/center/entity/MiniGameToken;->getRegion()I

    move-result v1

    invoke-static {v1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v1

    const-string v2, "rid"

    invoke-interface {v0, v2, v1}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    .line 5
    iget-object v0, p0, Lcom/sandboxol/gameblocky/web/m;->b:Ljava/util/Map;

    iget-object v1, p0, Lcom/sandboxol/gameblocky/web/m;->c:Ljava/lang/String;

    const-string v2, "attributesJson"

    invoke-interface {v0, v2, v1}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    .line 6
    invoke-virtual {p1}, Lcom/sandboxol/center/entity/MiniGameToken;->getCountry()Ljava/lang/String;

    move-result-object v0

    invoke-static {v0}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v0

    if-nez v0, :cond_3e

    .line 7
    iget-object v0, p0, Lcom/sandboxol/gameblocky/web/m;->b:Ljava/util/Map;

    invoke-virtual {p1}, Lcom/sandboxol/center/entity/MiniGameToken;->getCountry()Ljava/lang/String;

    move-result-object v1

    const-string v2, "country"

    invoke-interface {v0, v2, v1}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    .line 8
    :cond_3e
    new-instance v0, Lcom/sandboxol/center/web/GameRetryWithDelay;

    invoke-direct {v0}, Lcom/sandboxol/center/web/GameRetryWithDelay;-><init>()V

    .line 9
    iget-object v1, p0, Lcom/sandboxol/gameblocky/web/m;->b:Ljava/util/Map;

    invoke-virtual {v0}, Lcom/sandboxol/center/web/GameRetryWithDelay;->getRetryCount()I

    move-result v2

    invoke-static {v2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v2

    const-string v3, "retryCount"

    invoke-interface {v1, v3, v2}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    .line 10
    invoke-virtual {p1}, Lcom/sandboxol/center/entity/MiniGameToken;->getDispUrl()Ljava/lang/String;

    move-result-object v1

    const-class v2, Lcom/sandboxol/gameblocky/web/IBlockyGameApi;

    invoke-static {v1, v2}, Lcom/sandboxol/common/retrofit/RetrofitFactory;->create(Ljava/lang/String;Ljava/lang/Class;)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lcom/sandboxol/gameblocky/web/IBlockyGameApi;

    iget-object v2, p0, Lcom/sandboxol/gameblocky/web/m;->b:Ljava/util/Map;

    iget-wide v3, p0, Lcom/sandboxol/gameblocky/web/m;->d:J

    .line 11
    invoke-virtual {p1}, Lcom/sandboxol/center/entity/MiniGameToken;->getToken()Ljava/lang/String;

    move-result-object p1

    invoke-interface {v1, v2, v3, v4, p1}, Lcom/sandboxol/gameblocky/web/IBlockyGameApi;->newMiniGameDispatcher(Ljava/util/Map;JLjava/lang/String;)Lrx/Observable;

    move-result-object p1

    .line 12
    invoke-static {}, Lrx/schedulers/Schedulers;->io()Lrx/Scheduler;

    move-result-object v1

    invoke-virtual {p1, v1}, Lrx/Observable;->subscribeOn(Lrx/Scheduler;)Lrx/Observable;

    move-result-object p1

    .line 13
    invoke-static {}, Lrx/android/schedulers/AndroidSchedulers;->mainThread()Lrx/Scheduler;

    move-result-object v1

    invoke-virtual {p1, v1}, Lrx/Observable;->observeOn(Lrx/Scheduler;)Lrx/Observable;

    move-result-object p1

    iget-object v1, p0, Lcom/sandboxol/gameblocky/web/m;->a:[Lcom/sandboxol/center/entity/MiniGameToken;

    iget-object v2, p0, Lcom/sandboxol/gameblocky/web/m;->b:Ljava/util/Map;

    new-instance v3, Lcom/sandboxol/gameblocky/web/c;

    invoke-direct {v3, v1, v0, v2}, Lcom/sandboxol/gameblocky/web/c;-><init>([Lcom/sandboxol/center/entity/MiniGameToken;Lcom/sandboxol/center/web/GameRetryWithDelay;Ljava/util/Map;)V

    .line 14
    invoke-virtual {p1, v3}, Lrx/Observable;->doOnNext(Lrx/functions/Action1;)Lrx/Observable;

    move-result-object p1

    sget-object v1, Lcom/sandboxol/gameblocky/web/d;->a:Lcom/sandboxol/gameblocky/web/d;

    .line 15
    invoke-virtual {p1, v1}, Lrx/Observable;->doOnNext(Lrx/functions/Action1;)Lrx/Observable;

    move-result-object p1

    .line 16
    invoke-virtual {p1, v0}, Lrx/Observable;->retryWhen(Lrx/functions/Func1;)Lrx/Observable;

    move-result-object p1

    .line 17
    invoke-static {}, Lrx/android/schedulers/AndroidSchedulers;->mainThread()Lrx/Scheduler;

    move-result-object v0

    invoke-virtual {p1, v0}, Lrx/Observable;->observeOn(Lrx/Scheduler;)Lrx/Observable;

    move-result-object p1

    new-instance v0, Lcom/sandboxol/gameblocky/web/l;

    iget-object v1, p0, Lcom/sandboxol/gameblocky/web/m;->e:Lcom/sandboxol/common/base/web/OnResponseListener;

    invoke-direct {v0, p0, v1}, Lcom/sandboxol/gameblocky/web/l;-><init>(Lcom/sandboxol/gameblocky/web/m;Lcom/sandboxol/common/base/web/OnResponseListener;)V

    .line 18
    invoke-virtual {p1, v0}, Lrx/Observable;->subscribe(Lrx/Subscriber;)Lrx/Subscription;

    goto :goto_ab

    .line 19
    :cond_a4
    iget-object p1, p0, Lcom/sandboxol/gameblocky/web/m;->e:Lcom/sandboxol/common/base/web/OnResponseListener;

    const/16 v0, 0x1ad

    invoke-virtual {p1, v0}, Lcom/sandboxol/common/base/web/OnResponseListener;->onServerError(I)V

    :goto_ab
    return-void
.end method

.method public bridge synthetic onSuccess(Ljava/lang/Object;)V
    .registers 2

    .line 1
    check-cast p1, Lcom/sandboxol/center/entity/MiniGameToken;

    invoke-virtual {p0, p1}, Lcom/sandboxol/gameblocky/web/m;->onSuccess(Lcom/sandboxol/center/entity/MiniGameToken;)V

    return-void
.end method