GameRetryWithDelay.smali

.class public Lcom/sandboxol/center/web/GameRetryWithDelay;
.super Ljava/lang/Object;
.source "GameRetryWithDelay.java"

# interfaces
.implements Lrx/functions/Func1;


# annotations
.annotation system Ldalvik/annotation/Signature;
    value = {
        "Ljava/lang/Object;",
        "Lrx/functions/Func1<",
        "Lrx/Observable<",
        "+",
        "Ljava/lang/Throwable;",
        ">;",
        "Lrx/Observable<",
        "*>;>;"
    }
.end annotation


# static fields
.field private static final DEFAULT_MAX_RETYIES:I = 0x1

.field private static final DEFAULT_RETRY_DELAY:I = 0x1388


# instance fields
.field private final maxRetries:I

.field private moreRetries:I

.field private retryCount:I

.field private final retryDelayMillis:I


# direct methods
.method public constructor <init>()V
    .registers 3

    const/4 v0, 0x1

    const/16 v1, 0x1388

    .line 1
    invoke-direct {p0, v0, v1}, Lcom/sandboxol/center/web/GameRetryWithDelay;-><init>(II)V

    return-void
.end method

.method public constructor <init>(II)V
    .registers 3

    .line 2
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 3
    iput p1, p0, Lcom/sandboxol/center/web/GameRetryWithDelay;->maxRetries:I

    .line 4
    iput p2, p0, Lcom/sandboxol/center/web/GameRetryWithDelay;->retryDelayMillis:I

    const/4 p1, 0x0

    .line 5
    iput p1, p0, Lcom/sandboxol/center/web/GameRetryWithDelay;->retryCount:I

    const/4 p1, -0x1

    .line 6
    iput p1, p0, Lcom/sandboxol/center/web/GameRetryWithDelay;->moreRetries:I

    return-void
.end method

.method private checkCode(Lretrofit2/HttpException;)Z
    .registers 3

    .line 1
    invoke-virtual {p1}, Lretrofit2/HttpException;->code()I

    move-result p1

    const/16 v0, 0x1ad

    if-eq p1, v0, :cond_12

    const/16 v0, 0x1f4

    if-eq p1, v0, :cond_12

    const/16 v0, 0x1f8

    if-eq p1, v0, :cond_12

    const/4 p1, 0x0

    return p1

    :cond_12
    const/4 p1, 0x1

    return p1
.end method


# virtual methods
.method public synthetic a(Ljava/lang/Throwable;)Lrx/Observable;
    .registers 4

    .line 1
    iget v0, p0, Lcom/sandboxol/center/web/GameRetryWithDelay;->maxRetries:I

    iget v1, p0, Lcom/sandboxol/center/web/GameRetryWithDelay;->moreRetries:I

    invoke-static {v0, v1}, Ljava/lang/Math;->max(II)I

    move-result v0

    .line 2
    iget v1, p0, Lcom/sandboxol/center/web/GameRetryWithDelay;->retryCount:I

    add-int/lit8 v1, v1, 0x1

    iput v1, p0, Lcom/sandboxol/center/web/GameRetryWithDelay;->retryCount:I

    if-gt v1, v0, :cond_3c

    .line 3
    instance-of v1, p1, Lretrofit2/HttpException;

    if-eqz v1, :cond_22

    move-object v1, p1

    check-cast v1, Lretrofit2/HttpException;

    invoke-direct {p0, v1}, Lcom/sandboxol/center/web/GameRetryWithDelay;->checkCode(Lretrofit2/HttpException;)Z

    move-result v1

    if-eqz v1, :cond_22

    .line 4
    invoke-static {p1}, Lrx/Observable;->error(Ljava/lang/Throwable;)Lrx/Observable;

    move-result-object p1

    return-object p1

    .line 5
    :cond_22
    iget p1, p0, Lcom/sandboxol/center/web/GameRetryWithDelay;->retryDelayMillis:I

    add-int/lit8 v1, v0, 0x1

    mul-int v1, v1, v0

    .line 6
    div-int/lit8 v1, v1, 0x2

    mul-int v1, v1, p1

    const/16 v0, 0x7530

    if-ge v1, v0, :cond_34

    .line 7
    iget v0, p0, Lcom/sandboxol/center/web/GameRetryWithDelay;->retryCount:I

    mul-int p1, p1, v0

    :cond_34
    int-to-long v0, p1

    .line 8
    sget-object p1, Ljava/util/concurrent/TimeUnit;->MILLISECONDS:Ljava/util/concurrent/TimeUnit;

    invoke-static {v0, v1, p1}, Lrx/Observable;->timer(JLjava/util/concurrent/TimeUnit;)Lrx/Observable;

    move-result-object p1

    return-object p1

    .line 9
    :cond_3c
    invoke-static {p1}, Lrx/Observable;->error(Ljava/lang/Throwable;)Lrx/Observable;

    move-result-object p1

    return-object p1
.end method

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

    .line 1
    check-cast p1, Lrx/Observable;

    invoke-virtual {p0, p1}, Lcom/sandboxol/center/web/GameRetryWithDelay;->call(Lrx/Observable;)Lrx/Observable;

    move-result-object p1

    return-object p1
.end method

.method public call(Lrx/Observable;)Lrx/Observable;
    .registers 3
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Lrx/Observable<",
            "+",
            "Ljava/lang/Throwable;",
            ">;)",
            "Lrx/Observable<",
            "*>;"
        }
    .end annotation

    .line 2
    new-instance v0, Lcom/sandboxol/center/web/W;

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

    invoke-virtual {p1, v0}, Lrx/Observable;->flatMap(Lrx/functions/Func1;)Lrx/Observable;

    move-result-object p1

    return-object p1
.end method

.method public getMoreRetries()I
    .registers 2

    .line 1
    iget v0, p0, Lcom/sandboxol/center/web/GameRetryWithDelay;->moreRetries:I

    return v0
.end method

.method public getRetryCount()I
    .registers 2

    .line 1
    iget v0, p0, Lcom/sandboxol/center/web/GameRetryWithDelay;->retryCount:I

    return v0
.end method

.method public setMoreRetries(I)V
    .registers 2

    .line 1
    iput p1, p0, Lcom/sandboxol/center/web/GameRetryWithDelay;->moreRetries:I

    return-void
.end method