PushCenter$10.smali

.class Lcom/tradplus/ads/pushcenter/PushCenter$10;
.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;Ljava/lang/Object;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:Ljava/lang/Object;

.field final synthetic c:I

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


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

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

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

    iput-object p3, p0, Lcom/tradplus/ads/pushcenter/PushCenter$10;->b:Ljava/lang/Object;

    iput p4, p0, Lcom/tradplus/ads/pushcenter/PushCenter$10;->c:I

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

    return-void
.end method


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

    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$10;->a:Landroid/content/Context;

    if-eqz v0, :cond_7d

    new-instance v0, Lorg/json/JSONArray;

    invoke-direct {v0}, Lorg/json/JSONArray;-><init>()V

    iget-object v1, p0, Lcom/tradplus/ads/pushcenter/PushCenter$10;->b:Ljava/lang/Object;

    invoke-static {v1}, Lcom/tradplus/ads/pushcenter/reqeust/RequestFactory;->createData(Ljava/lang/Object;)Lorg/json/JSONObject;

    move-result-object v1

    :try_start_1a
    const-string v2, "createtime"

    invoke-virtual {v1, v2}, Lorg/json/JSONObject;->getLong(Ljava/lang/String;)J

    move-result-wide v2

    const-string v4, "time"

    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v5

    sub-long/2addr v5, v2

    const-wide/16 v2, 0x3e8

    div-long/2addr v5, v2

    invoke-virtual {v1, v4, v5, v6}, Lorg/json/JSONObject;->put(Ljava/lang/String;J)Lorg/json/JSONObject;
    :try_end_2d
    .catch Lorg/json/JSONException; {:try_start_1a .. :try_end_2d} :catch_2e

    goto :goto_32

    :catch_2e
    move-exception v2

    invoke-virtual {v2}, Lorg/json/JSONException;->printStackTrace()V

    :goto_32
    invoke-virtual {v1}, Lorg/json/JSONObject;->toString()Ljava/lang/String;

    move-result-object v2

    new-instance v3, Ljava/lang/StringBuilder;

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

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

    move-result-object v4

    iget v5, p0, Lcom/tradplus/ads/pushcenter/PushCenter$10;->c:I

    invoke-virtual {v4, v5}, Lcom/tradplus/ads/pushcenter/utils/PushMessageUtils;->getCacheType(I)Ljava/lang/String;

    move-result-object v4

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    const-string v4, " : PUSHMESSAGEARRAY"

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v3

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

    invoke-virtual {v0, v1}, Lorg/json/JSONArray;->put(Ljava/lang/Object;)Lorg/json/JSONArray;

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

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

    move-result v1

    if-eqz v1, :cond_72

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

    move-result v1

    if-lez v1, :cond_7d

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

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

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

    iget v3, p0, Lcom/tradplus/ads/pushcenter/PushCenter$10;->c:I

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

    goto :goto_7d

    :cond_72
    invoke-static {}, Lcom/tradplus/ads/pushcenter/PushCenter;->getInstance()Lcom/tradplus/ads/pushcenter/PushCenter;

    move-result-object v1

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

    iget v3, p0, Lcom/tradplus/ads/pushcenter/PushCenter$10;->c:I

    invoke-virtual {v1, v2, v0, v3}, Lcom/tradplus/ads/pushcenter/PushCenter;->sendMessageToCenter(Landroid/content/Context;Lorg/json/JSONArray;I)V

    :cond_7d
    :goto_7d
    return-void
.end method