.class Lcom/moji/mjad/base/network/MojiAdAppDownload$3;
.super Landroid/content/BroadcastReceiver;
.source "MojiAdAppDownload.java"


# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/moji/mjad/base/network/MojiAdAppDownload;
.end annotation

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


# instance fields
.field final synthetic a:Lcom/moji/mjad/base/network/MojiAdAppDownload;


# direct methods
.method constructor <init>(Lcom/moji/mjad/base/network/MojiAdAppDownload;)V
    .locals 0

    .line 169
    iput-object p1, p0, Lcom/moji/mjad/base/network/MojiAdAppDownload$3;->a:Lcom/moji/mjad/base/network/MojiAdAppDownload;

    invoke-direct {p0}, Landroid/content/BroadcastReceiver;-><init>()V

    return-void
.end method


# virtual methods
.method public onReceive(Landroid/content/Context;Landroid/content/Intent;)V
    .locals 5

    if-nez p1, :cond_0

    return-void

    :cond_0
    const-string v0, "sea"

    .line 173
    new-instance v1, Ljava/lang/StringBuilder;

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

    const-string v2, "sea download app:"

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

    invoke-virtual {p2}, Landroid/content/Intent;->getAction()Ljava/lang/String;

    move-result-object v2

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

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

    move-result-object v1

    invoke-static {v0, v1}, Lcom/moji/tool/log/MJLogger;->b(Ljava/lang/String;Ljava/lang/String;)V

    const-string v0, "extra_download_id"

    const-wide/16 v1, 0x0

    .line 175
    invoke-virtual {p2, v0, v1, v2}, Landroid/content/Intent;->getLongExtra(Ljava/lang/String;J)J

    move-result-wide v3

    cmp-long v0, v3, v1

    if-nez v0, :cond_1

    return-void

    .line 178
    :cond_1
    iget-object v0, p0, Lcom/moji/mjad/base/network/MojiAdAppDownload$3;->a:Lcom/moji/mjad/base/network/MojiAdAppDownload;

    invoke-static {v0}, Lcom/moji/mjad/base/network/MojiAdAppDownload;->a(Lcom/moji/mjad/base/network/MojiAdAppDownload;)Ljava/util/HashMap;

    move-result-object v0

    invoke-static {v3, v4}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object v1

    invoke-virtual {v0, v1}, Ljava/util/HashMap;->containsKey(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_4

    .line 179
    iget-object v0, p0, Lcom/moji/mjad/base/network/MojiAdAppDownload$3;->a:Lcom/moji/mjad/base/network/MojiAdAppDownload;

    invoke-static {v0}, Lcom/moji/mjad/base/network/MojiAdAppDownload;->a(Lcom/moji/mjad/base/network/MojiAdAppDownload;)Ljava/util/HashMap;

    move-result-object v0

    invoke-static {v3, v4}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object v1

    invoke-virtual {v0, v1}, Ljava/util/HashMap;->remove(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/lang/String;

    .line 180
    new-instance v1, Ljava/io/File;

    invoke-direct {v1, v0}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    .line 181
    invoke-virtual {p2}, Landroid/content/Intent;->getAction()Ljava/lang/String;

    move-result-object p2

    const-string v0, "android.intent.action.DOWNLOAD_COMPLETE"

    if-ne p2, v0, :cond_4

    invoke-virtual {v1}, Ljava/io/File;->exists()Z

    move-result p2

    if-eqz p2, :cond_4

    .line 183
    :try_start_0
    new-instance p2, Landroid/content/Intent;

    const-string v0, "android.intent.action.VIEW"

    invoke-direct {p2, v0}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V

    const/high16 v0, 0x10000000

    .line 184
    invoke-virtual {p2, v0}, Landroid/content/Intent;->addFlags(I)Landroid/content/Intent;

    .line 186
    sget v0, Landroid/os/Build$VERSION;->SDK_INT:I

    const/16 v2, 0x18

    if-lt v0, v2, :cond_2

    const/4 v0, 0x1

    .line 187
    invoke-virtual {p2, v0}, Landroid/content/Intent;->setFlags(I)Landroid/content/Intent;

    .line 188
    invoke-static {}, Lcom/moji/tool/AppDelegate;->a()Landroid/content/Context;

    move-result-object v0

    new-instance v2, Ljava/lang/StringBuilder;

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

    invoke-static {}, Lcom/moji/tool/AppDelegate;->a()Landroid/content/Context;

    move-result-object v3

    invoke-virtual {v3}, Landroid/content/Context;->getPackageName()Ljava/lang/String;

    move-result-object v3

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

    const-string v3, ".storage.fileprovider"

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

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

    move-result-object v2

    invoke-static {v0, v2, v1}, Landroid/support/v4/content/FileProvider;->getUriForFile(Landroid/content/Context;Ljava/lang/String;Ljava/io/File;)Landroid/net/Uri;

    move-result-object v0

    goto :goto_0

    .line 190
    :cond_2
    invoke-static {v1}, Landroid/net/Uri;->fromFile(Ljava/io/File;)Landroid/net/Uri;

    move-result-object v0

    :goto_0
    if-eqz v0, :cond_3

    const-string v1, "application/vnd.android.package-archive"

    .line 193
    invoke-virtual {p2, v0, v1}, Landroid/content/Intent;->setDataAndType(Landroid/net/Uri;Ljava/lang/String;)Landroid/content/Intent;

    .line 194
    invoke-virtual {p1, p2}, Landroid/content/Context;->startActivity(Landroid/content/Intent;)V

    .line 196
    :cond_3
    iget-object p2, p0, Lcom/moji/mjad/base/network/MojiAdAppDownload$3;->a:Lcom/moji/mjad/base/network/MojiAdAppDownload;

    invoke-static {p2}, Lcom/moji/mjad/base/network/MojiAdAppDownload;->b(Lcom/moji/mjad/base/network/MojiAdAppDownload;)Lcom/moji/mjad/base/network/MojiAdAppDownload$OnDownloadSuccessListener;

    move-result-object p2

    if-eqz p2, :cond_4

    .line 197
    iget-object p2, p0, Lcom/moji/mjad/base/network/MojiAdAppDownload$3;->a:Lcom/moji/mjad/base/network/MojiAdAppDownload;

    invoke-static {p2}, Lcom/moji/mjad/base/network/MojiAdAppDownload;->b(Lcom/moji/mjad/base/network/MojiAdAppDownload;)Lcom/moji/mjad/base/network/MojiAdAppDownload$OnDownloadSuccessListener;

    move-result-object p2

    invoke-interface {p2}, Lcom/moji/mjad/base/network/MojiAdAppDownload$OnDownloadSuccessListener;->a()V
    :try_end_0
    .catch Ljava/lang/Throwable; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_1

    :catch_0
    move-exception p2

    const-string v0, "MojiAdAppDownload"

    .line 200
    invoke-static {v0, p2}, Lcom/moji/tool/log/MJLogger;->a(Ljava/lang/String;Ljava/lang/Throwable;)V

    :cond_4
    :goto_1
    const-string p2, "sea"

    .line 204
    new-instance v0, Ljava/lang/StringBuilder;

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

    const-string v1, "sea download app downloadIds size:"

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

    iget-object v1, p0, Lcom/moji/mjad/base/network/MojiAdAppDownload$3;->a:Lcom/moji/mjad/base/network/MojiAdAppDownload;

    invoke-static {v1}, Lcom/moji/mjad/base/network/MojiAdAppDownload;->a(Lcom/moji/mjad/base/network/MojiAdAppDownload;)Ljava/util/HashMap;

    move-result-object v1

    invoke-virtual {v1}, Ljava/util/HashMap;->size()I

    move-result v1

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

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

    move-result-object v0

    invoke-static {p2, v0}, Lcom/moji/tool/log/MJLogger;->b(Ljava/lang/String;Ljava/lang/String;)V

    .line 205
    iget-object p2, p0, Lcom/moji/mjad/base/network/MojiAdAppDownload$3;->a:Lcom/moji/mjad/base/network/MojiAdAppDownload;

    invoke-static {p2}, Lcom/moji/mjad/base/network/MojiAdAppDownload;->a(Lcom/moji/mjad/base/network/MojiAdAppDownload;)Ljava/util/HashMap;

    move-result-object p2

    invoke-virtual {p2}, Ljava/util/HashMap;->isEmpty()Z

    move-result p2

    if-eqz p2, :cond_5

    iget-object p2, p0, Lcom/moji/mjad/base/network/MojiAdAppDownload$3;->a:Lcom/moji/mjad/base/network/MojiAdAppDownload;

    invoke-static {p2}, Lcom/moji/mjad/base/network/MojiAdAppDownload;->c(Lcom/moji/mjad/base/network/MojiAdAppDownload;)Z

    move-result p2

    if-eqz p2, :cond_5

    const-string p2, "sea"

    const-string v0, "sea download app unregisterReceiver"

    .line 206
    invoke-static {p2, v0}, Lcom/moji/tool/log/MJLogger;->b(Ljava/lang/String;Ljava/lang/String;)V

    .line 207
    iget-object p2, p0, Lcom/moji/mjad/base/network/MojiAdAppDownload$3;->a:Lcom/moji/mjad/base/network/MojiAdAppDownload;

    const/4 v0, 0x0

    invoke-static {p2, v0}, Lcom/moji/mjad/base/network/MojiAdAppDownload;->a(Lcom/moji/mjad/base/network/MojiAdAppDownload;Z)Z

    if-eqz p1, :cond_5

    .line 209
    iget-object p2, p0, Lcom/moji/mjad/base/network/MojiAdAppDownload$3;->a:Lcom/moji/mjad/base/network/MojiAdAppDownload;

    invoke-static {p2}, Lcom/moji/mjad/base/network/MojiAdAppDownload;->d(Lcom/moji/mjad/base/network/MojiAdAppDownload;)Landroid/content/BroadcastReceiver;

    move-result-object p2

    invoke-virtual {p1, p2}, Landroid/content/Context;->unregisterReceiver(Landroid/content/BroadcastReceiver;)V

    :cond_5
    return-void
.end method
