RetryWithDelay.smali
.class public Lcom/sandboxol/common/base/web/RetryWithDelay;
.super Ljava/lang/Object;
.source "RetryWithDelay.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
# instance fields
.field private final maxRetries:I
.field private retryCount:I
.field private final retryDelayMillis:I
.field private final retryTotalTime:I
# direct methods
.method public constructor <init>(II)V
.registers 4
.line 1
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
const/16 v0, 0x7530
.line 2
iput v0, p0, Lcom/sandboxol/common/base/web/RetryWithDelay;->retryTotalTime:I
.line 3
iput p1, p0, Lcom/sandboxol/common/base/web/RetryWithDelay;->maxRetries:I
.line 4
iput p2, p0, Lcom/sandboxol/common/base/web/RetryWithDelay;->retryDelayMillis:I
const/4 p1, 0x0
.line 5
iput p1, p0, Lcom/sandboxol/common/base/web/RetryWithDelay;->retryCount: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/common/base/web/RetryWithDelay;->retryCount:I
add-int/lit8 v0, v0, 0x1
iput v0, p0, Lcom/sandboxol/common/base/web/RetryWithDelay;->retryCount:I
iget v1, p0, Lcom/sandboxol/common/base/web/RetryWithDelay;->maxRetries:I
if-gt v0, v1, :cond_38
.line 2
instance-of v0, p1, Lretrofit2/HttpException;
if-eqz v0, :cond_1c
move-object v0, p1
check-cast v0, Lretrofit2/HttpException;
invoke-direct {p0, v0}, Lcom/sandboxol/common/base/web/RetryWithDelay;->checkCode(Lretrofit2/HttpException;)Z
move-result v0
if-eqz v0, :cond_1c
.line 3
invoke-static {p1}, Lrx/Observable;->error(Ljava/lang/Throwable;)Lrx/Observable;
move-result-object p1
return-object p1
.line 4
:cond_1c
iget p1, p0, Lcom/sandboxol/common/base/web/RetryWithDelay;->retryDelayMillis:I
.line 5
iget v0, p0, Lcom/sandboxol/common/base/web/RetryWithDelay;->maxRetries:I
add-int/lit8 v1, v0, 0x1
mul-int v1, v1, v0
div-int/lit8 v1, v1, 0x2
mul-int v1, v1, p1
const/16 v0, 0x7530
if-ge v1, v0, :cond_30
.line 6
iget v0, p0, Lcom/sandboxol/common/base/web/RetryWithDelay;->retryCount:I
mul-int p1, p1, v0
:cond_30
int-to-long v0, p1
.line 7
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 8
:cond_38
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/common/base/web/RetryWithDelay;->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/common/base/web/a;
invoke-direct {v0, p0}, Lcom/sandboxol/common/base/web/a;-><init>(Lcom/sandboxol/common/base/web/RetryWithDelay;)V
invoke-virtual {p1, v0}, Lrx/Observable;->flatMap(Lrx/functions/Func1;)Lrx/Observable;
move-result-object p1
return-object p1
.end method