RequestManager.smali

.class public abstract Lcom/tradplus/ads/network/RequestManager;
.super Ljava/lang/Object;


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/tradplus/ads/network/RequestManager$RequestFactory;
    }
.end annotation

.annotation system Ldalvik/annotation/Signature;
    value = {
        "<T::",
        "Lcom/tradplus/ads/network/RequestManager$RequestFactory;",
        ">",
        "Ljava/lang/Object;"
    }
.end annotation


# instance fields
.field protected a:Lcom/tradplus/ads/volley/Request;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Lcom/tradplus/ads/volley/Request<",
            "*>;"
        }
    .end annotation
.end field

.field protected b:Lcom/tradplus/ads/network/RequestManager$RequestFactory;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "TT;"
        }
    .end annotation
.end field

.field protected c:Lcom/tradplus/ads/network/BackoffPolicy;

.field protected d:Landroid/os/Handler;


# direct methods
.method public constructor <init>(Landroid/os/Looper;)V
    .registers 3

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

    new-instance v0, Landroid/os/Handler;

    invoke-direct {v0, p1}, Landroid/os/Handler;-><init>(Landroid/os/Looper;)V

    iput-object v0, p0, Lcom/tradplus/ads/network/RequestManager;->d:Landroid/os/Handler;

    return-void
.end method


# virtual methods
.method abstract a()Lcom/tradplus/ads/volley/Request;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()",
            "Lcom/tradplus/ads/volley/Request<",
            "*>;"
        }
    .end annotation
.end method

.method b()V
    .registers 4
    .annotation build Lcom/tradplus/ads/common/VisibleForTesting;
    .end annotation

    invoke-virtual {p0}, Lcom/tradplus/ads/network/RequestManager;->a()Lcom/tradplus/ads/volley/Request;

    move-result-object v0

    iput-object v0, p0, Lcom/tradplus/ads/network/RequestManager;->a:Lcom/tradplus/ads/volley/Request;

    invoke-static {}, Lcom/tradplus/ads/network/Networking;->getRequestQueue()Lcom/tradplus/ads/network/FSMoPubRequestQueue;

    move-result-object v0

    if-nez v0, :cond_15

    const-string v0, "MoPubRequest queue is null. Clearing request."

    invoke-static {v0}, Lcom/tradplus/ads/common/util/LogUtil;->show(Ljava/lang/String;)V

    invoke-virtual {p0}, Lcom/tradplus/ads/network/RequestManager;->c()V

    return-void

    :cond_15
    iget-object v1, p0, Lcom/tradplus/ads/network/RequestManager;->c:Lcom/tradplus/ads/network/BackoffPolicy;

    invoke-virtual {v1}, Lcom/tradplus/ads/network/BackoffPolicy;->getRetryCount()I

    move-result v1

    if-nez v1, :cond_23

    iget-object v1, p0, Lcom/tradplus/ads/network/RequestManager;->a:Lcom/tradplus/ads/volley/Request;

    invoke-virtual {v0, v1}, Lcom/tradplus/ads/volley/RequestQueue;->add(Lcom/tradplus/ads/volley/Request;)Lcom/tradplus/ads/volley/Request;

    goto :goto_2e

    :cond_23
    iget-object v1, p0, Lcom/tradplus/ads/network/RequestManager;->a:Lcom/tradplus/ads/volley/Request;

    iget-object v2, p0, Lcom/tradplus/ads/network/RequestManager;->c:Lcom/tradplus/ads/network/BackoffPolicy;

    invoke-virtual {v2}, Lcom/tradplus/ads/network/BackoffPolicy;->getBackoffMs()I

    move-result v2

    invoke-virtual {v0, v1, v2}, Lcom/tradplus/ads/network/FSMoPubRequestQueue;->addDelayedRequest(Lcom/tradplus/ads/volley/Request;I)V

    :goto_2e
    return-void
.end method

.method c()V
    .registers 2
    .annotation build Lcom/tradplus/ads/common/VisibleForTesting;
    .end annotation

    const/4 v0, 0x0

    iput-object v0, p0, Lcom/tradplus/ads/network/RequestManager;->a:Lcom/tradplus/ads/volley/Request;

    iput-object v0, p0, Lcom/tradplus/ads/network/RequestManager;->b:Lcom/tradplus/ads/network/RequestManager$RequestFactory;

    iput-object v0, p0, Lcom/tradplus/ads/network/RequestManager;->c:Lcom/tradplus/ads/network/BackoffPolicy;

    return-void
.end method

.method public cancelRequest()V
    .registers 3

    invoke-static {}, Lcom/tradplus/ads/network/Networking;->getRequestQueue()Lcom/tradplus/ads/network/FSMoPubRequestQueue;

    move-result-object v0

    if-eqz v0, :cond_d

    iget-object v1, p0, Lcom/tradplus/ads/network/RequestManager;->a:Lcom/tradplus/ads/volley/Request;

    if-eqz v1, :cond_d

    invoke-virtual {v0, v1}, Lcom/tradplus/ads/network/FSMoPubRequestQueue;->cancel(Lcom/tradplus/ads/volley/Request;)V

    :cond_d
    invoke-virtual {p0}, Lcom/tradplus/ads/network/RequestManager;->c()V

    return-void
.end method

.method public isAtCapacity()Z
    .registers 2

    iget-object v0, p0, Lcom/tradplus/ads/network/RequestManager;->a:Lcom/tradplus/ads/volley/Request;

    if-eqz v0, :cond_6

    const/4 v0, 0x1

    goto :goto_7

    :cond_6
    const/4 v0, 0x0

    :goto_7
    return v0
.end method

.method public makeRequest(Lcom/tradplus/ads/network/RequestManager$RequestFactory;Lcom/tradplus/ads/network/BackoffPolicy;)V
    .registers 3
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(TT;",
            "Lcom/tradplus/ads/network/BackoffPolicy;",
            ")V"
        }
    .end annotation

    invoke-static {p1}, Lcom/tradplus/ads/common/Preconditions;->checkNotNull(Ljava/lang/Object;)V

    invoke-static {p2}, Lcom/tradplus/ads/common/Preconditions;->checkNotNull(Ljava/lang/Object;)V

    invoke-virtual {p0}, Lcom/tradplus/ads/network/RequestManager;->cancelRequest()V

    iput-object p1, p0, Lcom/tradplus/ads/network/RequestManager;->b:Lcom/tradplus/ads/network/RequestManager$RequestFactory;

    iput-object p2, p0, Lcom/tradplus/ads/network/RequestManager;->c:Lcom/tradplus/ads/network/BackoffPolicy;

    invoke-virtual {p0}, Lcom/tradplus/ads/network/RequestManager;->b()V

    return-void
.end method