PushCenter$4.smali

.class Lcom/tradplus/ads/pushcenter/PushCenter$4;
.super Ljava/lang/Object;

# interfaces
.implements Ljava/lang/Runnable;


# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
    value = Lcom/tradplus/ads/pushcenter/PushCenter;->sendMeesageToServer(Landroid/content/Context;I)V
.end annotation

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


# instance fields
.field final synthetic a:Landroid/content/Context;

.field final synthetic b:I

.field final synthetic c:Lcom/tradplus/ads/pushcenter/PushCenter;


# direct methods
.method constructor <init>(Lcom/tradplus/ads/pushcenter/PushCenter;Landroid/content/Context;I)V
    .registers 4

    iput-object p1, p0, Lcom/tradplus/ads/pushcenter/PushCenter$4;->c:Lcom/tradplus/ads/pushcenter/PushCenter;

    iput-object p2, p0, Lcom/tradplus/ads/pushcenter/PushCenter$4;->a:Landroid/content/Context;

    iput p3, p0, Lcom/tradplus/ads/pushcenter/PushCenter$4;->b:I

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

    return-void
.end method


# virtual methods
.method public run()V
    .registers 6

    invoke-static {}, Lcom/tradplus/ads/mobileads/api/TPMessageManager;->getInstance()Lcom/tradplus/ads/mobileads/api/TPMessageManager;

    move-result-object v0

    invoke-virtual {v0}, Lcom/tradplus/ads/mobileads/api/TPMessageManager;->isCanUploadMessage()Z

    move-result v0

    if-nez v0, :cond_b

    return-void

    :cond_b
    iget-object v0, p0, Lcom/tradplus/ads/pushcenter/PushCenter$4;->a:Landroid/content/Context;

    if-eqz v0, :cond_55

    invoke-static {v0}, Lcom/tradplus/ads/common/util/DeviceUtils;->isNetworkAvailable(Landroid/content/Context;)Z

    move-result v0

    if-eqz v0, :cond_55

    invoke-static {}, Lcom/tradplus/ads/pushcenter/utils/PushMessageUtils;->getInstance()Lcom/tradplus/ads/pushcenter/utils/PushMessageUtils;

    move-result-object v0

    iget-object v1, p0, Lcom/tradplus/ads/pushcenter/PushCenter$4;->a:Landroid/content/Context;

    iget v2, p0, Lcom/tradplus/ads/pushcenter/PushCenter$4;->b:I

    invoke-virtual {v0, v1, v2}, Lcom/tradplus/ads/pushcenter/utils/PushMessageUtils;->getPushMessageArray(Landroid/content/Context;I)Lorg/json/JSONArray;

    move-result-object v0

    invoke-virtual {v0}, Lorg/json/JSONArray;->length()I

    move-result v1

    if-lez v1, :cond_4a

    const/16 v1, 0x64

    invoke-static {v0, v1}, Lcom/tradplus/ads/pushcenter/PushCenter;->fixedGrouping(Lorg/json/JSONArray;I)Ljava/util/List;

    move-result-object v0

    invoke-interface {v0}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object v0

    :goto_31
    invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z

    move-result v1

    if-eqz v1, :cond_4a

    invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lorg/json/JSONArray;

    new-instance v2, Lcom/tradplus/ads/pushcenter/http/PushCenterHttpUtils;

    invoke-direct {v2}, Lcom/tradplus/ads/pushcenter/http/PushCenterHttpUtils;-><init>()V

    iget-object v3, p0, Lcom/tradplus/ads/pushcenter/PushCenter$4;->a:Landroid/content/Context;

    iget v4, p0, Lcom/tradplus/ads/pushcenter/PushCenter$4;->b:I

    invoke-virtual {v2, v3, v1, v4}, Lcom/tradplus/ads/pushcenter/http/PushCenterHttpUtils;->push(Landroid/content/Context;Lorg/json/JSONArray;I)V

    goto :goto_31

    :cond_4a
    invoke-static {}, Lcom/tradplus/ads/pushcenter/utils/PushMessageUtils;->getInstance()Lcom/tradplus/ads/pushcenter/utils/PushMessageUtils;

    move-result-object v0

    iget-object v1, p0, Lcom/tradplus/ads/pushcenter/PushCenter$4;->a:Landroid/content/Context;

    iget v2, p0, Lcom/tradplus/ads/pushcenter/PushCenter$4;->b:I

    invoke-virtual {v0, v1, v2}, Lcom/tradplus/ads/pushcenter/utils/PushMessageUtils;->initPushMessageArray(Landroid/content/Context;I)V

    :cond_55
    return-void
.end method