GlobalNotificationReceiver.smali

.class public Lcom/taboola/android/globalNotifications/GlobalNotificationReceiver;
.super Landroid/content/BroadcastReceiver;
.source "GlobalNotificationReceiver.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/taboola/android/globalNotifications/GlobalNotificationReceiver$OnGlobalNotificationsListener;
    }
.end annotation


# static fields
.field public static final GLOBAL_NOTIFICATIONS_KEY:Ljava/lang/String; = "com.taboola.android.GLOBAL_NOTIFICATIONS_KEY"

.field public static final GLOBAL_NOTIFICATIONS_MESSAGES_KEY:Ljava/lang/String; = "GLOBAL_NOTIFICATIONS_MESSAGES_KEY"

.field public static final GLOBAL_NOTIFICATIONS_VALUE_KEY:Ljava/lang/String; = "GLOBAL_NOTIFICATIONS_VALUE_KEY"

.field public static final GLOBAL_NOTIFICATIONS_WIDGET_KEY:Ljava/lang/String; = "GLOBAL_NOTIFICATIONS_WIDGET_KEY"

.field public static final TABOOLA_DID_FAIL_AD:Ljava/lang/String; = "TABOOLA_DID_FAIL_AD"

.field public static final TABOOLA_DID_RECEIVE_AD:Ljava/lang/String; = "TABOOLA_DID_RECEIVE_AD"

.field public static final TABOOLA_ITEM_DID_CLICK:Ljava/lang/String; = "TABOOLA_ITEM_DID_CLICK"

.field public static final TABOOLA_VIEW_RESIZED:Ljava/lang/String; = "TABOOLA_VIEW_RESIZED"

.field private static final TAG:Ljava/lang/String;


# instance fields
.field private mIntentFilter:Landroid/content/IntentFilter;

.field private mOnGlobalNotificationsListener:Lcom/taboola/android/globalNotifications/GlobalNotificationReceiver$OnGlobalNotificationsListener;


# direct methods
.method static constructor <clinit>()V
    .registers 1

    .line 33
    const-class v0, Lcom/taboola/android/globalNotifications/GlobalNotificationReceiver;

    invoke-virtual {v0}, Ljava/lang/Class;->getSimpleName()Ljava/lang/String;

    move-result-object v0

    sput-object v0, Lcom/taboola/android/globalNotifications/GlobalNotificationReceiver;->TAG:Ljava/lang/String;

    return-void
.end method

.method public constructor <init>()V
    .registers 3

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

    .line 46
    new-instance v0, Landroid/content/IntentFilter;

    const-string v1, "com.taboola.android.GLOBAL_NOTIFICATIONS_KEY"

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

    iput-object v0, p0, Lcom/taboola/android/globalNotifications/GlobalNotificationReceiver;->mIntentFilter:Landroid/content/IntentFilter;

    return-void
.end method


# virtual methods
.method public getOnGlobalNotificationsListener()Lcom/taboola/android/globalNotifications/GlobalNotificationReceiver$OnGlobalNotificationsListener;
    .registers 2

    .line 96
    iget-object v0, p0, Lcom/taboola/android/globalNotifications/GlobalNotificationReceiver;->mOnGlobalNotificationsListener:Lcom/taboola/android/globalNotifications/GlobalNotificationReceiver$OnGlobalNotificationsListener;

    return-object v0
.end method

.method public onReceive(Landroid/content/Context;Landroid/content/Intent;)V
    .registers 9

    .line 50
    sget-object p1, Lcom/taboola/android/globalNotifications/GlobalNotificationReceiver;->TAG:Ljava/lang/String;

    new-instance v0, Ljava/lang/StringBuilder;

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

    const-string v1, "receive global notification"

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

    const-string v1, "GLOBAL_NOTIFICATIONS_MESSAGES_KEY"

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

    move-result-object v2

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

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

    move-result-object v0

    .line 50
    invoke-static {p1, v0}, Lcom/taboola/android/utils/Logger;->d(Ljava/lang/String;Ljava/lang/String;)V

    .line 54
    invoke-virtual {p2}, Landroid/content/Intent;->getExtras()Landroid/os/Bundle;

    move-result-object p1

    if-eqz p1, :cond_35

    const-string p1, "GLOBAL_NOTIFICATIONS_WIDGET_KEY"

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

    move-result v0

    if-eqz v0, :cond_35

    .line 55
    invoke-virtual {p2, p1}, Landroid/content/Intent;->getSerializableExtra(Ljava/lang/String;)Ljava/io/Serializable;

    move-result-object p1

    .line 56
    check-cast p1, Lcom/taboola/android/utils/TaboolaSerializable;

    invoke-virtual {p1}, Lcom/taboola/android/utils/TaboolaSerializable;->getTaboolaWidget()Lcom/taboola/android/TaboolaWidget;

    move-result-object p1

    goto :goto_36

    :cond_35
    const/4 p1, 0x0

    :goto_36
    if-eqz p1, :cond_c1

    .line 60
    invoke-virtual {p2}, Landroid/content/Intent;->getExtras()Landroid/os/Bundle;

    move-result-object v0

    const-string v2, "GLOBAL_NOTIFICATIONS_VALUE_KEY"

    invoke-virtual {v0, v2}, Landroid/os/Bundle;->get(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

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

    move-result-object p2

    const/4 v1, -0x1

    invoke-virtual {p2}, Ljava/lang/String;->hashCode()I

    move-result v2

    const/4 v3, 0x3

    const/4 v4, 0x2

    const/4 v5, 0x1

    sparse-switch v2, :sswitch_data_c2

    goto :goto_79

    :sswitch_52
    const-string v2, "TABOOLA_DID_RECEIVE_AD"

    invoke-virtual {p2, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result p2

    if-eqz p2, :cond_79

    const/4 v1, 0x0

    goto :goto_79

    :sswitch_5c
    const-string v2, "TABOOLA_VIEW_RESIZED"

    invoke-virtual {p2, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result p2

    if-eqz p2, :cond_79

    const/4 v1, 0x1

    goto :goto_79

    :sswitch_66
    const-string v2, "TABOOLA_DID_FAIL_AD"

    invoke-virtual {p2, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result p2

    if-eqz p2, :cond_79

    const/4 v1, 0x3

    goto :goto_79

    :sswitch_70
    const-string v2, "TABOOLA_ITEM_DID_CLICK"

    invoke-virtual {p2, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result p2

    if-eqz p2, :cond_79

    const/4 v1, 0x2

    :cond_79
    :goto_79
    if-eqz v1, :cond_b4

    if-eq v1, v5, :cond_a0

    if-eq v1, v4, :cond_92

    if-eq v1, v3, :cond_82

    goto :goto_c1

    .line 78
    :cond_82
    invoke-virtual {p0}, Lcom/taboola/android/globalNotifications/GlobalNotificationReceiver;->getOnGlobalNotificationsListener()Lcom/taboola/android/globalNotifications/GlobalNotificationReceiver$OnGlobalNotificationsListener;

    move-result-object p2

    if-eqz p2, :cond_c1

    .line 79
    invoke-virtual {p0}, Lcom/taboola/android/globalNotifications/GlobalNotificationReceiver;->getOnGlobalNotificationsListener()Lcom/taboola/android/globalNotifications/GlobalNotificationReceiver$OnGlobalNotificationsListener;

    move-result-object p2

    check-cast v0, Ljava/lang/String;

    invoke-interface {p2, p1, v0}, Lcom/taboola/android/globalNotifications/GlobalNotificationReceiver$OnGlobalNotificationsListener;->taboolaDidFailAd(Lcom/taboola/android/TaboolaWidget;Ljava/lang/String;)V

    goto :goto_c1

    .line 73
    :cond_92
    invoke-virtual {p0}, Lcom/taboola/android/globalNotifications/GlobalNotificationReceiver;->getOnGlobalNotificationsListener()Lcom/taboola/android/globalNotifications/GlobalNotificationReceiver$OnGlobalNotificationsListener;

    move-result-object p2

    if-eqz p2, :cond_c1

    .line 74
    invoke-virtual {p0}, Lcom/taboola/android/globalNotifications/GlobalNotificationReceiver;->getOnGlobalNotificationsListener()Lcom/taboola/android/globalNotifications/GlobalNotificationReceiver$OnGlobalNotificationsListener;

    move-result-object p2

    invoke-interface {p2, p1}, Lcom/taboola/android/globalNotifications/GlobalNotificationReceiver$OnGlobalNotificationsListener;->taboolaItemDidClick(Lcom/taboola/android/TaboolaWidget;)V

    goto :goto_c1

    .line 68
    :cond_a0
    invoke-virtual {p0}, Lcom/taboola/android/globalNotifications/GlobalNotificationReceiver;->getOnGlobalNotificationsListener()Lcom/taboola/android/globalNotifications/GlobalNotificationReceiver$OnGlobalNotificationsListener;

    move-result-object p2

    if-eqz p2, :cond_c1

    .line 69
    invoke-virtual {p0}, Lcom/taboola/android/globalNotifications/GlobalNotificationReceiver;->getOnGlobalNotificationsListener()Lcom/taboola/android/globalNotifications/GlobalNotificationReceiver$OnGlobalNotificationsListener;

    move-result-object p2

    check-cast v0, Ljava/lang/Integer;

    invoke-virtual {v0}, Ljava/lang/Integer;->intValue()I

    move-result v0

    invoke-interface {p2, p1, v0}, Lcom/taboola/android/globalNotifications/GlobalNotificationReceiver$OnGlobalNotificationsListener;->taboolaViewResized(Lcom/taboola/android/TaboolaWidget;I)V

    goto :goto_c1

    .line 63
    :cond_b4
    invoke-virtual {p0}, Lcom/taboola/android/globalNotifications/GlobalNotificationReceiver;->getOnGlobalNotificationsListener()Lcom/taboola/android/globalNotifications/GlobalNotificationReceiver$OnGlobalNotificationsListener;

    move-result-object p2

    if-eqz p2, :cond_c1

    .line 64
    invoke-virtual {p0}, Lcom/taboola/android/globalNotifications/GlobalNotificationReceiver;->getOnGlobalNotificationsListener()Lcom/taboola/android/globalNotifications/GlobalNotificationReceiver$OnGlobalNotificationsListener;

    move-result-object p2

    invoke-interface {p2, p1}, Lcom/taboola/android/globalNotifications/GlobalNotificationReceiver$OnGlobalNotificationsListener;->taboolaDidReceiveAd(Lcom/taboola/android/TaboolaWidget;)V

    :cond_c1
    :goto_c1
    return-void

    :sswitch_data_c2
    .sparse-switch
        -0x5d6e640f -> :sswitch_70
        0xdf59c8f -> :sswitch_66
        0x2f2e804b -> :sswitch_5c
        0x37a57394 -> :sswitch_52
    .end sparse-switch
.end method

.method public registerNotificationsListener(Lcom/taboola/android/globalNotifications/GlobalNotificationReceiver$OnGlobalNotificationsListener;)V
    .registers 2

    .line 103
    iput-object p1, p0, Lcom/taboola/android/globalNotifications/GlobalNotificationReceiver;->mOnGlobalNotificationsListener:Lcom/taboola/android/globalNotifications/GlobalNotificationReceiver$OnGlobalNotificationsListener;

    return-void
.end method

.method public registerReceiver(Landroid/content/Context;)V
    .registers 3

    .line 88
    invoke-static {p1}, Landroidx/localbroadcastmanager/content/LocalBroadcastManager;->getInstance(Landroid/content/Context;)Landroidx/localbroadcastmanager/content/LocalBroadcastManager;

    move-result-object p1

    iget-object v0, p0, Lcom/taboola/android/globalNotifications/GlobalNotificationReceiver;->mIntentFilter:Landroid/content/IntentFilter;

    invoke-virtual {p1, p0, v0}, Landroidx/localbroadcastmanager/content/LocalBroadcastManager;->registerReceiver(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;)V

    return-void
.end method

.method public unregisterNotificationsListener()V
    .registers 2

    const/4 v0, 0x0

    .line 107
    iput-object v0, p0, Lcom/taboola/android/globalNotifications/GlobalNotificationReceiver;->mOnGlobalNotificationsListener:Lcom/taboola/android/globalNotifications/GlobalNotificationReceiver$OnGlobalNotificationsListener;

    return-void
.end method

.method public unregisterReceiver(Landroid/content/Context;)V
    .registers 2

    .line 92
    invoke-static {p1}, Landroidx/localbroadcastmanager/content/LocalBroadcastManager;->getInstance(Landroid/content/Context;)Landroidx/localbroadcastmanager/content/LocalBroadcastManager;

    move-result-object p1

    invoke-virtual {p1, p0}, Landroidx/localbroadcastmanager/content/LocalBroadcastManager;->unregisterReceiver(Landroid/content/BroadcastReceiver;)V

    return-void
.end method