RNPushNotification.smali

.class public Lcom/dieam/reactnativepushnotification/modules/RNPushNotification;
.super Lcom/facebook/react/bridge/ReactContextBaseJavaModule;
.source "SourceFile"

# interfaces
.implements Lcom/facebook/react/bridge/ActivityEventListener;


# annotations
.annotation runtime Lcom/facebook/react/module/annotations/ReactModule;
    name = "RNPushNotification"
.end annotation


# static fields
.field public static final LOG_TAG:Ljava/lang/String; = "RNPushNotification"


# instance fields
.field private mJsDelivery:Lcom/dieam/reactnativepushnotification/modules/c;

.field private mRNPushNotificationHelper:Lcom/dieam/reactnativepushnotification/modules/b;

.field private final mRandomNumberGenerator:Ljava/util/Random;

.field private final receiver:Landroid/content/BroadcastReceiver;


# direct methods
.method public constructor <init>(Lcom/facebook/react/bridge/ReactApplicationContext;)V
    .registers 5

    .line 1
    invoke-direct {p0, p1}, Lcom/facebook/react/bridge/ReactContextBaseJavaModule;-><init>(Lcom/facebook/react/bridge/ReactApplicationContext;)V

    .line 2
    new-instance v0, Ljava/util/Random;

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

    move-result-wide v1

    invoke-direct {v0, v1, v2}, Ljava/util/Random;-><init>(J)V

    iput-object v0, p0, Lcom/dieam/reactnativepushnotification/modules/RNPushNotification;->mRandomNumberGenerator:Ljava/util/Random;

    .line 3
    new-instance v0, Lcom/dieam/reactnativepushnotification/modules/RNPushNotification$a;

    invoke-direct {v0, p0}, Lcom/dieam/reactnativepushnotification/modules/RNPushNotification$a;-><init>(Lcom/dieam/reactnativepushnotification/modules/RNPushNotification;)V

    iput-object v0, p0, Lcom/dieam/reactnativepushnotification/modules/RNPushNotification;->receiver:Landroid/content/BroadcastReceiver;

    .line 4
    invoke-virtual {p1, p0}, Lcom/facebook/react/bridge/ReactContext;->addActivityEventListener(Lcom/facebook/react/bridge/ActivityEventListener;)V

    .line 5
    invoke-virtual {p1}, Landroid/content/Context;->getApplicationContext()Landroid/content/Context;

    move-result-object v0

    check-cast v0, Landroid/app/Application;

    .line 6
    new-instance v1, Lcom/dieam/reactnativepushnotification/modules/b;

    invoke-direct {v1, v0}, Lcom/dieam/reactnativepushnotification/modules/b;-><init>(Landroid/app/Application;)V

    iput-object v1, p0, Lcom/dieam/reactnativepushnotification/modules/RNPushNotification;->mRNPushNotificationHelper:Lcom/dieam/reactnativepushnotification/modules/b;

    .line 7
    new-instance v0, Lcom/dieam/reactnativepushnotification/modules/c;

    invoke-direct {v0, p1}, Lcom/dieam/reactnativepushnotification/modules/c;-><init>(Lcom/facebook/react/bridge/ReactApplicationContext;)V

    iput-object v0, p0, Lcom/dieam/reactnativepushnotification/modules/RNPushNotification;->mJsDelivery:Lcom/dieam/reactnativepushnotification/modules/c;

    .line 8
    invoke-direct {p0}, Lcom/dieam/reactnativepushnotification/modules/RNPushNotification;->registerNotificationsRegistration()V

    return-void
.end method

.method public static synthetic access$000(Lcom/dieam/reactnativepushnotification/modules/RNPushNotification;)Lcom/dieam/reactnativepushnotification/modules/c;
    .registers 1

    iget-object p0, p0, Lcom/dieam/reactnativepushnotification/modules/RNPushNotification;->mJsDelivery:Lcom/dieam/reactnativepushnotification/modules/c;

    return-object p0
.end method

.method private registerNotificationsReceiveNotificationActions(Lcom/facebook/react/bridge/ReadableArray;)V
    .registers 7

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

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

    const/4 v1, 0x0

    .line 2
    :goto_6
    invoke-interface {p1}, Lcom/facebook/react/bridge/ReadableArray;->size()I

    move-result v2

    if-ge v1, v2, :cond_32

    .line 3
    invoke-interface {p1, v1}, Lcom/facebook/react/bridge/ReadableArray;->getString(I)Ljava/lang/String;

    move-result-object v2

    .line 4
    new-instance v3, Ljava/lang/StringBuilder;

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

    invoke-virtual {p0}, Lcom/facebook/react/bridge/ReactContextBaseJavaModule;->getReactApplicationContext()Lcom/facebook/react/bridge/ReactApplicationContext;

    move-result-object v4

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

    move-result-object v4

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

    const-string v4, "."

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

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

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

    move-result-object v2

    invoke-virtual {v0, v2}, Landroid/content/IntentFilter;->addAction(Ljava/lang/String;)V

    add-int/lit8 v1, v1, 0x1

    goto :goto_6

    .line 5
    :cond_32
    invoke-virtual {p0}, Lcom/facebook/react/bridge/ReactContextBaseJavaModule;->getReactApplicationContext()Lcom/facebook/react/bridge/ReactApplicationContext;

    move-result-object p1

    new-instance v1, Lcom/dieam/reactnativepushnotification/modules/RNPushNotification$b;

    invoke-direct {v1, p0}, Lcom/dieam/reactnativepushnotification/modules/RNPushNotification$b;-><init>(Lcom/dieam/reactnativepushnotification/modules/RNPushNotification;)V

    invoke-virtual {p1, v1, v0}, Landroid/content/Context;->registerReceiver(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;)Landroid/content/Intent;

    return-void
.end method

.method private registerNotificationsRegistration()V
    .registers 4

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

    new-instance v1, Ljava/lang/StringBuilder;

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

    invoke-virtual {p0}, Lcom/facebook/react/bridge/ReactContextBaseJavaModule;->getReactApplicationContext()Lcom/facebook/react/bridge/ReactApplicationContext;

    move-result-object v2

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

    move-result-object v2

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

    const-string v2, ".RNPushNotificationRegisteredToken"

    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-direct {v0, v1}, Landroid/content/IntentFilter;-><init>(Ljava/lang/String;)V

    .line 2
    invoke-virtual {p0}, Lcom/facebook/react/bridge/ReactContextBaseJavaModule;->getReactApplicationContext()Lcom/facebook/react/bridge/ReactApplicationContext;

    move-result-object v1

    iget-object v2, p0, Lcom/dieam/reactnativepushnotification/modules/RNPushNotification;->receiver:Landroid/content/BroadcastReceiver;

    invoke-virtual {v1, v2, v0}, Landroid/content/Context;->registerReceiver(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;)Landroid/content/Intent;

    return-void
.end method

.method private resolver(Lcom/facebook/react/bridge/Promise;Ljava/lang/Object;)V
    .registers 4

    sget-object v0, Lcom/shopee/addon/common/b;->a:Lcom/google/gson/i;

    invoke-virtual {v0, p2}, Lcom/google/gson/i;->p(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object p2

    invoke-interface {p1, p2}, Lcom/facebook/react/bridge/Promise;->resolve(Ljava/lang/Object;)V

    return-void
.end method

.method private sendScheduleLocalNotification(Lcom/facebook/react/bridge/ReadableMap;)V
    .registers 3

    .line 1
    invoke-static {p1}, Lcom/facebook/react/bridge/Arguments;->toBundle(Lcom/facebook/react/bridge/ReadableMap;)Landroid/os/Bundle;

    move-result-object p1

    .line 2
    invoke-direct {p0, p1}, Lcom/dieam/reactnativepushnotification/modules/RNPushNotification;->setFallbackBundleId(Landroid/os/Bundle;)V

    .line 3
    iget-object v0, p0, Lcom/dieam/reactnativepushnotification/modules/RNPushNotification;->mRNPushNotificationHelper:Lcom/dieam/reactnativepushnotification/modules/b;

    invoke-virtual {v0, p1}, Lcom/dieam/reactnativepushnotification/modules/b;->i(Landroid/os/Bundle;)V

    return-void
.end method

.method private setFallbackBundleId(Landroid/os/Bundle;)V
    .registers 5

    const-string v0, "id"

    .line 1
    invoke-virtual {p1, v0}, Landroid/os/BaseBundle;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    if-nez v1, :cond_16

    .line 2
    iget-object v1, p0, Lcom/dieam/reactnativepushnotification/modules/RNPushNotification;->mRandomNumberGenerator:Ljava/util/Random;

    invoke-virtual {v1}, Ljava/util/Random;->nextInt()I

    move-result v1

    invoke-static {v1}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {p1, v0, v1}, Landroid/os/BaseBundle;->putString(Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_26

    .line 3
    :cond_16
    invoke-static {v1}, Ljava/lang/Long;->parseLong(Ljava/lang/String;)J

    move-result-wide v1

    long-to-int v2, v1

    const v1, 0x7fffffff

    rem-int/2addr v2, v1

    .line 4
    invoke-static {v2}, Ljava/lang/Integer;->toString(I)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {p1, v0, v1}, Landroid/os/BaseBundle;->putString(Ljava/lang/String;Ljava/lang/String;)V

    :goto_26
    return-void
.end method


# virtual methods
.method public cancelAllLocalNotifications()V
    .registers 4
    .annotation runtime Lcom/facebook/react/bridge/ReactMethod;
    .end annotation

    .line 1
    iget-object v0, p0, Lcom/dieam/reactnativepushnotification/modules/RNPushNotification;->mRNPushNotificationHelper:Lcom/dieam/reactnativepushnotification/modules/b;

    .line 2
    iget-object v1, v0, Lcom/dieam/reactnativepushnotification/modules/b;->b:Landroid/content/SharedPreferences;

    invoke-interface {v1}, Landroid/content/SharedPreferences;->getAll()Ljava/util/Map;

    move-result-object v1

    invoke-interface {v1}, Ljava/util/Map;->keySet()Ljava/util/Set;

    move-result-object v1

    invoke-interface {v1}, Ljava/util/Set;->iterator()Ljava/util/Iterator;

    move-result-object v1

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

    move-result v2

    if-eqz v2, :cond_20

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

    move-result-object v2

    check-cast v2, Ljava/lang/String;

    .line 3
    invoke-virtual {v0, v2}, Lcom/dieam/reactnativepushnotification/modules/b;->c(Ljava/lang/String;)V

    goto :goto_10

    .line 4
    :cond_20
    iget-object v0, p0, Lcom/dieam/reactnativepushnotification/modules/RNPushNotification;->mRNPushNotificationHelper:Lcom/dieam/reactnativepushnotification/modules/b;

    .line 5
    invoke-virtual {v0}, Lcom/dieam/reactnativepushnotification/modules/b;->g()Landroid/app/NotificationManager;

    move-result-object v0

    .line 6
    invoke-virtual {v0}, Landroid/app/NotificationManager;->cancelAll()V

    return-void
.end method

.method public cancelLocalNotifications(Lcom/facebook/react/bridge/ReadableMap;)V
    .registers 3
    .annotation runtime Lcom/facebook/react/bridge/ReactMethod;
    .end annotation

    iget-object v0, p0, Lcom/dieam/reactnativepushnotification/modules/RNPushNotification;->mRNPushNotificationHelper:Lcom/dieam/reactnativepushnotification/modules/b;

    invoke-virtual {v0, p1}, Lcom/dieam/reactnativepushnotification/modules/b;->b(Lcom/facebook/react/bridge/ReadableMap;)V

    return-void
.end method

.method public getConstants()Ljava/util/Map;
    .registers 2
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()",
            "Ljava/util/Map<",
            "Ljava/lang/String;",
            "Ljava/lang/Object;",
            ">;"
        }
    .end annotation

    new-instance v0, Ljava/util/HashMap;

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

    return-object v0
.end method

.method public getInitialNotification(Lcom/facebook/react/bridge/Promise;)V
    .registers 6
    .annotation runtime Lcom/facebook/react/bridge/ReactMethod;
    .end annotation

    .line 1
    invoke-static {}, Lcom/facebook/react/bridge/Arguments;->createMap()Lcom/facebook/react/bridge/WritableMap;

    move-result-object v0

    .line 2
    invoke-virtual {p0}, Lcom/facebook/react/bridge/ReactContextBaseJavaModule;->getCurrentActivity()Landroid/app/Activity;

    move-result-object v1

    if-eqz v1, :cond_27

    .line 3
    invoke-virtual {v1}, Landroid/app/Activity;->getIntent()Landroid/content/Intent;

    move-result-object v1

    const-string v2, "notification"

    .line 4
    invoke-virtual {v1, v2}, Landroid/content/Intent;->getBundleExtra(Ljava/lang/String;)Landroid/os/Bundle;

    move-result-object v1

    if-eqz v1, :cond_27

    const/4 v2, 0x0

    const-string v3, "foreground"

    .line 5
    invoke-virtual {v1, v3, v2}, Landroid/os/Bundle;->putBoolean(Ljava/lang/String;Z)V

    .line 6
    iget-object v2, p0, Lcom/dieam/reactnativepushnotification/modules/RNPushNotification;->mJsDelivery:Lcom/dieam/reactnativepushnotification/modules/c;

    invoke-virtual {v2, v1}, Lcom/dieam/reactnativepushnotification/modules/c;->a(Landroid/os/Bundle;)Ljava/lang/String;

    move-result-object v1

    const-string v2, "dataJSON"

    .line 7
    invoke-interface {v0, v2, v1}, Lcom/facebook/react/bridge/WritableMap;->putString(Ljava/lang/String;Ljava/lang/String;)V

    .line 8
    :cond_27
    invoke-interface {p1, v0}, Lcom/facebook/react/bridge/Promise;->resolve(Ljava/lang/Object;)V

    return-void
.end method

.method public getName()Ljava/lang/String;
    .registers 2

    const-string v0, "RNPushNotification"

    return-object v0
.end method

.method public onActivityResult(IILandroid/content/Intent;)V
    .registers 4

    return-void
.end method

.method public onActivityResult(Landroid/app/Activity;IILandroid/content/Intent;)V
    .registers 5

    invoke-virtual {p0, p2, p3, p4}, Lcom/dieam/reactnativepushnotification/modules/RNPushNotification;->onActivityResult(IILandroid/content/Intent;)V

    return-void
.end method

.method public onCatalystInstanceDestroy()V
    .registers 3

    invoke-virtual {p0}, Lcom/facebook/react/bridge/ReactContextBaseJavaModule;->getReactApplicationContext()Lcom/facebook/react/bridge/ReactApplicationContext;

    move-result-object v0

    iget-object v1, p0, Lcom/dieam/reactnativepushnotification/modules/RNPushNotification;->receiver:Landroid/content/BroadcastReceiver;

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

    return-void
.end method

.method public onNewIntent(Landroid/content/Intent;)V
    .registers 6

    const-string v0, "notification"

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

    move-result v1

    if-eqz v1, :cond_29

    .line 2
    invoke-virtual {p1, v0}, Landroid/content/Intent;->getBundleExtra(Ljava/lang/String;)Landroid/os/Bundle;

    move-result-object v1

    const/4 v2, 0x0

    const-string v3, "foreground"

    .line 3
    invoke-virtual {v1, v3, v2}, Landroid/os/Bundle;->putBoolean(Ljava/lang/String;Z)V

    .line 4
    invoke-virtual {p1, v0, v1}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Landroid/os/Bundle;)Landroid/content/Intent;

    .line 5
    iget-object p1, p0, Lcom/dieam/reactnativepushnotification/modules/RNPushNotification;->mJsDelivery:Lcom/dieam/reactnativepushnotification/modules/c;

    .line 6
    invoke-virtual {p1, v1}, Lcom/dieam/reactnativepushnotification/modules/c;->a(Landroid/os/Bundle;)Ljava/lang/String;

    move-result-object v0

    .line 7
    invoke-static {}, Lcom/facebook/react/bridge/Arguments;->createMap()Lcom/facebook/react/bridge/WritableMap;

    move-result-object v1

    const-string v2, "dataJSON"

    .line 8
    invoke-interface {v1, v2, v0}, Lcom/facebook/react/bridge/WritableMap;->putString(Ljava/lang/String;Ljava/lang/String;)V

    const-string v0, "remoteNotificationReceived"

    .line 9
    invoke-virtual {p1, v0, v1}, Lcom/dieam/reactnativepushnotification/modules/c;->c(Ljava/lang/String;Ljava/lang/Object;)V

    :cond_29
    return-void
.end method

.method public presentLocalNotification(Lcom/facebook/react/bridge/ReadableMap;)V
    .registers 3
    .annotation runtime Lcom/facebook/react/bridge/ReactMethod;
    .end annotation

    .line 1
    invoke-static {p1}, Lcom/facebook/react/bridge/Arguments;->toBundle(Lcom/facebook/react/bridge/ReadableMap;)Landroid/os/Bundle;

    move-result-object p1

    .line 2
    invoke-direct {p0, p1}, Lcom/dieam/reactnativepushnotification/modules/RNPushNotification;->setFallbackBundleId(Landroid/os/Bundle;)V

    .line 3
    iget-object v0, p0, Lcom/dieam/reactnativepushnotification/modules/RNPushNotification;->mRNPushNotificationHelper:Lcom/dieam/reactnativepushnotification/modules/b;

    invoke-virtual {v0, p1}, Lcom/dieam/reactnativepushnotification/modules/b;->k(Landroid/os/Bundle;)V

    return-void
.end method

.method public registerNotificationActions(Lcom/facebook/react/bridge/ReadableArray;)V
    .registers 2
    .annotation runtime Lcom/facebook/react/bridge/ReactMethod;
    .end annotation

    invoke-direct {p0, p1}, Lcom/dieam/reactnativepushnotification/modules/RNPushNotification;->registerNotificationsReceiveNotificationActions(Lcom/facebook/react/bridge/ReadableArray;)V

    return-void
.end method

.method public requestPermissions(Ljava/lang/String;)V
    .registers 2
    .annotation runtime Lcom/facebook/react/bridge/ReactMethod;
    .end annotation

    return-void
.end method

.method public scheduleExactLocalNotification(Lcom/facebook/react/bridge/ReadableMap;Lcom/facebook/react/bridge/Promise;)V
    .registers 4
    .annotation runtime Lcom/facebook/react/bridge/ReactMethod;
    .end annotation

    .line 1
    :try_start_0
    iget-object v0, p0, Lcom/dieam/reactnativepushnotification/modules/RNPushNotification;->mRNPushNotificationHelper:Lcom/dieam/reactnativepushnotification/modules/b;

    invoke-virtual {v0}, Lcom/dieam/reactnativepushnotification/modules/b;->a()Z

    move-result v0

    if-nez v0, :cond_12

    const-string p1, "Permission denied!"

    .line 2
    invoke-static {p1}, Lcom/shopee/addon/common/a;->c(Ljava/lang/String;)Lcom/shopee/addon/common/a;

    move-result-object p1

    invoke-direct {p0, p2, p1}, Lcom/dieam/reactnativepushnotification/modules/RNPushNotification;->resolver(Lcom/facebook/react/bridge/Promise;Ljava/lang/Object;)V

    return-void

    .line 3
    :cond_12
    invoke-direct {p0, p1}, Lcom/dieam/reactnativepushnotification/modules/RNPushNotification;->sendScheduleLocalNotification(Lcom/facebook/react/bridge/ReadableMap;)V

    .line 4
    invoke-static {}, Lcom/shopee/addon/common/a;->g()Lcom/shopee/addon/common/a;

    move-result-object p1

    invoke-direct {p0, p2, p1}, Lcom/dieam/reactnativepushnotification/modules/RNPushNotification;->resolver(Lcom/facebook/react/bridge/Promise;Ljava/lang/Object;)V
    :try_end_1c
    .catchall {:try_start_0 .. :try_end_1c} :catchall_1d

    goto :goto_32

    :catchall_1d
    move-exception p1

    .line 5
    invoke-virtual {p1}, Ljava/lang/Throwable;->getMessage()Ljava/lang/String;

    move-result-object v0

    if-nez v0, :cond_27

    const-string p1, ""

    goto :goto_2b

    :cond_27
    invoke-virtual {p1}, Ljava/lang/Throwable;->getMessage()Ljava/lang/String;

    move-result-object p1

    .line 6
    :goto_2b
    invoke-static {p1}, Lcom/shopee/addon/common/a;->c(Ljava/lang/String;)Lcom/shopee/addon/common/a;

    move-result-object p1

    invoke-direct {p0, p2, p1}, Lcom/dieam/reactnativepushnotification/modules/RNPushNotification;->resolver(Lcom/facebook/react/bridge/Promise;Ljava/lang/Object;)V

    :goto_32
    return-void
.end method

.method public scheduleLocalNotification(Lcom/facebook/react/bridge/ReadableMap;)V
    .registers 2
    .annotation runtime Lcom/facebook/react/bridge/ReactMethod;
    .end annotation

    invoke-direct {p0, p1}, Lcom/dieam/reactnativepushnotification/modules/RNPushNotification;->sendScheduleLocalNotification(Lcom/facebook/react/bridge/ReadableMap;)V

    return-void
.end method

.method public setApplicationIconBadgeNumber(I)V
    .registers 10
    .annotation runtime Lcom/facebook/react/bridge/ReactMethod;
    .end annotation

    .line 1
    sget-object v0, Lcom/dieam/reactnativepushnotification/helpers/a;->d:Lcom/dieam/reactnativepushnotification/helpers/a;

    invoke-virtual {p0}, Lcom/facebook/react/bridge/ReactContextBaseJavaModule;->getReactApplicationContext()Lcom/facebook/react/bridge/ReactApplicationContext;

    move-result-object v1

    .line 2
    iget-object v2, v0, Lcom/dieam/reactnativepushnotification/helpers/a;->c:Landroid/content/ComponentName;

    if-nez v2, :cond_1c

    .line 3
    invoke-virtual {v1}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;

    move-result-object v2

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

    move-result-object v3

    invoke-virtual {v2, v3}, Landroid/content/pm/PackageManager;->getLaunchIntentForPackage(Ljava/lang/String;)Landroid/content/Intent;

    move-result-object v2

    invoke-virtual {v2}, Landroid/content/Intent;->getComponent()Landroid/content/ComponentName;

    move-result-object v2

    iput-object v2, v0, Lcom/dieam/reactnativepushnotification/helpers/a;->c:Landroid/content/ComponentName;

    .line 4
    :cond_1c
    iget-object v2, v0, Lcom/dieam/reactnativepushnotification/helpers/a;->a:Ljava/lang/Boolean;

    const-string v3, "ApplicationBadgeHelper"

    const/4 v4, 0x1

    const/4 v5, 0x0

    if-nez v2, :cond_44

    .line 5
    sget-object v2, Lme/leolin/shortcutbadger/c;->a:Ljava/util/LinkedList;

    .line 6
    :try_start_26
    invoke-static {v1, p1}, Lme/leolin/shortcutbadger/c;->a(Landroid/content/Context;I)V
    :try_end_29
    .catch Lme/leolin/shortcutbadger/b; {:try_start_26 .. :try_end_29} :catch_2b

    const/4 v2, 0x1

    goto :goto_2c

    :catch_2b
    const/4 v2, 0x0

    .line 7
    :goto_2c
    invoke-static {v2}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;

    move-result-object v2

    iput-object v2, v0, Lcom/dieam/reactnativepushnotification/helpers/a;->a:Ljava/lang/Boolean;

    .line 8
    invoke-virtual {v2}, Ljava/lang/Boolean;->booleanValue()Z

    move-result v2

    if-eqz v2, :cond_3e

    const-string v2, "First attempt to use automatic badger succeeded; permanently enabling method."

    .line 9
    invoke-static {v3, v2}, Lcom/facebook/common/logging/FLog;->i(Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_52

    :cond_3e
    const-string v2, "First attempt to use automatic badger failed; permanently disabling method."

    .line 10
    invoke-static {v3, v2}, Lcom/facebook/common/logging/FLog;->i(Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_52

    .line 11
    :cond_44
    invoke-virtual {v2}, Ljava/lang/Boolean;->booleanValue()Z

    move-result v2

    if-nez v2, :cond_4b

    goto :goto_52

    .line 12
    :cond_4b
    sget-object v2, Lme/leolin/shortcutbadger/c;->a:Ljava/util/LinkedList;

    .line 13
    :try_start_4d
    invoke-static {v1, p1}, Lme/leolin/shortcutbadger/c;->a(Landroid/content/Context;I)V
    :try_end_50
    .catch Lme/leolin/shortcutbadger/b; {:try_start_4d .. :try_end_50} :catch_51

    goto :goto_52

    :catch_51
    nop

    .line 14
    :goto_52
    iget-object v2, v0, Lcom/dieam/reactnativepushnotification/helpers/a;->b:Ljava/lang/Boolean;

    if-nez v2, :cond_b7

    .line 15
    new-instance v2, Landroid/content/Intent;

    const-string v6, "android.intent.action.MAIN"

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

    const-string v6, "android.intent.category.HOME"

    .line 16
    invoke-virtual {v2, v6}, Landroid/content/Intent;->addCategory(Ljava/lang/String;)Landroid/content/Intent;

    .line 17
    invoke-virtual {v1}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;

    move-result-object v6

    const/high16 v7, 0x10000

    invoke-virtual {v6, v2, v7}, Landroid/content/pm/PackageManager;->resolveActivity(Landroid/content/Intent;I)Landroid/content/pm/ResolveInfo;

    move-result-object v2

    if-eqz v2, :cond_94

    .line 18
    iget-object v6, v2, Landroid/content/pm/ResolveInfo;->activityInfo:Landroid/content/pm/ActivityInfo;

    iget-object v6, v6, Landroid/content/pm/ActivityInfo;->name:Ljava/lang/String;

    invoke-virtual {v6}, Ljava/lang/String;->toLowerCase()Ljava/lang/String;

    move-result-object v6

    const-string v7, "resolver"

    invoke-virtual {v6, v7}, Ljava/lang/String;->contains(Ljava/lang/CharSequence;)Z

    move-result v6

    if-eqz v6, :cond_7f

    goto :goto_94

    .line 19
    :cond_7f
    iget-object v2, v2, Landroid/content/pm/ResolveInfo;->activityInfo:Landroid/content/pm/ActivityInfo;

    iget-object v2, v2, Landroid/content/pm/ActivityInfo;->packageName:Ljava/lang/String;

    const-string v6, "com.sec.android.app.launcher"

    const-string v7, "com.sec.android.app.twlauncher"

    .line 20
    filled-new-array {v6, v7}, [Ljava/lang/String;

    move-result-object v6

    invoke-static {v6}, Ljava/util/Arrays;->asList([Ljava/lang/Object;)Ljava/util/List;

    move-result-object v6

    .line 21
    invoke-interface {v6, v2}, Ljava/util/List;->contains(Ljava/lang/Object;)Z

    move-result v2

    goto :goto_95

    :cond_94
    :goto_94
    const/4 v2, 0x0

    :goto_95
    if-eqz v2, :cond_9e

    .line 22
    invoke-virtual {v0, v1, p1}, Lcom/dieam/reactnativepushnotification/helpers/a;->a(Landroid/content/Context;I)Z

    move-result p1

    if-eqz p1, :cond_9e

    goto :goto_9f

    :cond_9e
    const/4 v4, 0x0

    :goto_9f
    invoke-static {v4}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;

    move-result-object p1

    iput-object p1, v0, Lcom/dieam/reactnativepushnotification/helpers/a;->b:Ljava/lang/Boolean;

    .line 23
    invoke-virtual {p1}, Ljava/lang/Boolean;->booleanValue()Z

    move-result p1

    if-eqz p1, :cond_b1

    const-string p1, "First attempt to use legacy Samsung badger succeeded; permanently enabling method."

    .line 24
    invoke-static {v3, p1}, Lcom/facebook/common/logging/FLog;->i(Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_c1

    :cond_b1
    const-string p1, "First attempt to use legacy Samsung badger failed; permanently disabling method."

    .line 25
    invoke-static {v3, p1}, Lcom/facebook/common/logging/FLog;->w(Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_c1

    .line 26
    :cond_b7
    invoke-virtual {v2}, Ljava/lang/Boolean;->booleanValue()Z

    move-result v2

    if-nez v2, :cond_be

    goto :goto_c1

    .line 27
    :cond_be
    invoke-virtual {v0, v1, p1}, Lcom/dieam/reactnativepushnotification/helpers/a;->a(Landroid/content/Context;I)Z

    :goto_c1
    return-void
.end method