Add Discord APKTool decompilation (Smali source for modding)

- Imported from https://github.com/supermegamestre/Project-Real-Resurrection-3
- APKTool decompilation (Smali bytecode) for modding and rebuilding APK
- Supports both 32-bit (armeabi-v7a) and 64-bit (arm64-v8a) architectures
- Includes full Smali source, resources, and native libraries
- Ready to rebuild APK after modifications with apktool b command
- Added comprehensive README-apktool.md with modding guide

This branch complements the JADX branches:
- Use JADX (main/discord-community) to UNDERSTAND code (readable Java)
- Use APKTool (this branch) to MODIFY and REBUILD APK (editable Smali)

Total: 44,417 files, 538.51 MB Smali source code
This commit is contained in:
2026-02-18 16:13:44 -08:00
parent c080f0d97f
commit f3960ee359
44288 changed files with 10998761 additions and 0 deletions

View File

@@ -0,0 +1,151 @@
.class public Lcom/helpshift/poller/ConversationPoller;
.super Ljava/lang/Object;
.source "SourceFile"
# instance fields
.field public pollerController:Lcom/helpshift/poller/PollerController;
.field public userManager:Lcom/helpshift/user/UserManager;
# direct methods
.method public constructor <init>(Lcom/helpshift/poller/PollerController;Lcom/helpshift/user/UserManager;)V
.locals 0
.line 17
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
iput-object p1, p0, Lcom/helpshift/poller/ConversationPoller;->pollerController:Lcom/helpshift/poller/PollerController;
iput-object p2, p0, Lcom/helpshift/poller/ConversationPoller;->userManager:Lcom/helpshift/user/UserManager;
return-void
.end method
# virtual methods
.method public declared-synchronized startPoller()V
.locals 5
monitor-enter p0
:try_start_0
iget-object v0, p0, Lcom/helpshift/poller/ConversationPoller;->userManager:Lcom/helpshift/user/UserManager;
.line 24
invoke-virtual {v0}, Lcom/helpshift/user/UserManager;->shouldPoll()Z
move-result v0
iget-object v1, p0, Lcom/helpshift/poller/ConversationPoller;->userManager:Lcom/helpshift/user/UserManager;
.line 25
invoke-virtual {v1}, Lcom/helpshift/user/UserManager;->isPushTokenSynced()Z
move-result v1
if-eqz v0, :cond_1
if-eqz v1, :cond_0
goto :goto_0
:cond_0
const-string v0, "ConvPolr"
const-string v1, "Starting poller."
.line 31
invoke-static {v0, v1}, Lcom/helpshift/log/HSLogger;->d(Ljava/lang/String;Ljava/lang/String;)V
iget-object v0, p0, Lcom/helpshift/poller/ConversationPoller;->pollerController:Lcom/helpshift/poller/PollerController;
.line 32
invoke-virtual {v0}, Lcom/helpshift/poller/PollerController;->start()V
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
.line 33
monitor-exit p0
return-void
:catchall_0
move-exception v0
goto :goto_1
:cond_1
:goto_0
:try_start_1
const-string v2, "ConvPolr"
.line 27
new-instance v3, Ljava/lang/StringBuilder;
invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V
const-string v4, "Not starting poller, shouldPoll: "
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v3, v0}, Ljava/lang/StringBuilder;->append(Z)Ljava/lang/StringBuilder;
const-string v0, ", push synced: "
invoke-virtual {v3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v3, v1}, Ljava/lang/StringBuilder;->append(Z)Ljava/lang/StringBuilder;
invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v0
invoke-static {v2, v0}, Lcom/helpshift/log/HSLogger;->d(Ljava/lang/String;Ljava/lang/String;)V
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
.line 28
monitor-exit p0
return-void
:goto_1
monitor-exit p0
throw v0
.end method
.method public declared-synchronized stopPoller()V
.locals 2
monitor-enter p0
:try_start_0
const-string v0, "ConvPolr"
const-string v1, "Stopping poller."
.line 36
invoke-static {v0, v1}, Lcom/helpshift/log/HSLogger;->d(Ljava/lang/String;Ljava/lang/String;)V
iget-object v0, p0, Lcom/helpshift/poller/ConversationPoller;->pollerController:Lcom/helpshift/poller/PollerController;
.line 37
invoke-virtual {v0}, Lcom/helpshift/poller/PollerController;->stop()V
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
.line 38
monitor-exit p0
return-void
:catchall_0
move-exception v0
monitor-exit p0
throw v0
.end method

View File

@@ -0,0 +1,116 @@
.class public Lcom/helpshift/poller/ExponentialBackoff;
.super Ljava/lang/Object;
.source "SourceFile"
# instance fields
.field public baseInterval:I
.field public currentInterval:I
.field public maxInterval:I
# direct methods
.method public constructor <init>(II)V
.locals 0
.line 16
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
iput p1, p0, Lcom/helpshift/poller/ExponentialBackoff;->baseInterval:I
iput p2, p0, Lcom/helpshift/poller/ExponentialBackoff;->maxInterval:I
iput p1, p0, Lcom/helpshift/poller/ExponentialBackoff;->currentInterval:I
return-void
.end method
# virtual methods
.method public nextInterval(I)I
.locals 2
if-nez p1, :cond_0
iget p1, p0, Lcom/helpshift/poller/ExponentialBackoff;->currentInterval:I
return p1
:cond_0
const/16 v0, 0xc8
if-lt p1, v0, :cond_1
const/16 v0, 0x190
if-lt p1, v0, :cond_2
:cond_1
const/16 v0, 0x1f4
if-lt p1, v0, :cond_4
:cond_2
iget p1, p0, Lcom/helpshift/poller/ExponentialBackoff;->currentInterval:I
mul-int/lit8 v0, p1, 0x2
iget v1, p0, Lcom/helpshift/poller/ExponentialBackoff;->maxInterval:I
if-le v0, v1, :cond_3
goto :goto_0
:cond_3
mul-int/lit8 v1, p1, 0x2
:goto_0
iput v1, p0, Lcom/helpshift/poller/ExponentialBackoff;->currentInterval:I
goto :goto_1
:cond_4
const/4 p1, -0x1
iput p1, p0, Lcom/helpshift/poller/ExponentialBackoff;->currentInterval:I
:goto_1
iget p1, p0, Lcom/helpshift/poller/ExponentialBackoff;->currentInterval:I
return p1
.end method
.method public reconcileIntervals(II)V
.locals 1
iget v0, p0, Lcom/helpshift/poller/ExponentialBackoff;->baseInterval:I
if-ne v0, p1, :cond_0
iget v0, p0, Lcom/helpshift/poller/ExponentialBackoff;->maxInterval:I
if-ne v0, p2, :cond_0
return-void
:cond_0
iput p1, p0, Lcom/helpshift/poller/ExponentialBackoff;->baseInterval:I
iput p2, p0, Lcom/helpshift/poller/ExponentialBackoff;->maxInterval:I
iput p1, p0, Lcom/helpshift/poller/ExponentialBackoff;->currentInterval:I
return-void
.end method
.method public reset()V
.locals 1
iget v0, p0, Lcom/helpshift/poller/ExponentialBackoff;->baseInterval:I
iput v0, p0, Lcom/helpshift/poller/ExponentialBackoff;->currentInterval:I
return-void
.end method

View File

@@ -0,0 +1,372 @@
.class public Lcom/helpshift/poller/FetchNotificationUpdate;
.super Ljava/lang/Object;
.source "SourceFile"
# instance fields
.field public device:Lcom/helpshift/platform/Device;
.field public genericDataManager:Lcom/helpshift/storage/HSGenericDataManager;
.field public hsEventProxy:Lcom/helpshift/chat/HSEventProxy;
.field public httpTransport:Lcom/helpshift/network/HTTPTransport;
.field public notificationManager:Lcom/helpshift/notification/CoreNotificationManager;
.field public persistentStorage:Lcom/helpshift/storage/HSPersistentStorage;
.field public userManager:Lcom/helpshift/user/UserManager;
# direct methods
.method public constructor <init>(Lcom/helpshift/platform/Device;Lcom/helpshift/storage/HSPersistentStorage;Lcom/helpshift/storage/HSGenericDataManager;Lcom/helpshift/user/UserManager;Lcom/helpshift/notification/CoreNotificationManager;Lcom/helpshift/network/HTTPTransport;Lcom/helpshift/chat/HSEventProxy;)V
.locals 0
.line 49
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
iput-object p1, p0, Lcom/helpshift/poller/FetchNotificationUpdate;->device:Lcom/helpshift/platform/Device;
iput-object p2, p0, Lcom/helpshift/poller/FetchNotificationUpdate;->persistentStorage:Lcom/helpshift/storage/HSPersistentStorage;
iput-object p3, p0, Lcom/helpshift/poller/FetchNotificationUpdate;->genericDataManager:Lcom/helpshift/storage/HSGenericDataManager;
iput-object p4, p0, Lcom/helpshift/poller/FetchNotificationUpdate;->userManager:Lcom/helpshift/user/UserManager;
iput-object p5, p0, Lcom/helpshift/poller/FetchNotificationUpdate;->notificationManager:Lcom/helpshift/notification/CoreNotificationManager;
iput-object p6, p0, Lcom/helpshift/poller/FetchNotificationUpdate;->httpTransport:Lcom/helpshift/network/HTTPTransport;
iput-object p7, p0, Lcom/helpshift/poller/FetchNotificationUpdate;->hsEventProxy:Lcom/helpshift/chat/HSEventProxy;
return-void
.end method
# virtual methods
.method public execute()I
.locals 12
const-string v0, "Fetching notification count from network."
const-string v1, "ftchNotif"
.line 61
invoke-static {v1, v0}, Lcom/helpshift/log/HSLogger;->d(Ljava/lang/String;Ljava/lang/String;)V
iget-object v0, p0, Lcom/helpshift/poller/FetchNotificationUpdate;->genericDataManager:Lcom/helpshift/storage/HSGenericDataManager;
.line 62
invoke-virtual {v0}, Lcom/helpshift/storage/HSGenericDataManager;->getNetworkHeaders()Ljava/util/Map;
move-result-object v0
iget-object v2, p0, Lcom/helpshift/poller/FetchNotificationUpdate;->genericDataManager:Lcom/helpshift/storage/HSGenericDataManager;
.line 63
invoke-virtual {v2}, Lcom/helpshift/storage/HSGenericDataManager;->getPollingRoute()Ljava/lang/String;
move-result-object v2
iget-object v3, p0, Lcom/helpshift/poller/FetchNotificationUpdate;->userManager:Lcom/helpshift/user/UserManager;
.line 65
invoke-virtual {v3}, Lcom/helpshift/user/UserManager;->getActiveUserDataForNetworkCall()Ljava/util/Map;
move-result-object v3
.line 68
invoke-static {v3}, Lcom/helpshift/util/Utils;->isEmpty(Ljava/util/Map;)Z
move-result v4
const/4 v5, -0x1
if-nez v4, :cond_5
invoke-static {v0}, Lcom/helpshift/util/Utils;->isEmpty(Ljava/util/Map;)Z
move-result v4
if-nez v4, :cond_5
invoke-static {v2}, Lcom/helpshift/util/Utils;->isEmpty(Ljava/lang/String;)Z
move-result v4
if-eqz v4, :cond_0
goto/16 :goto_6
:cond_0
iget-object v4, p0, Lcom/helpshift/poller/FetchNotificationUpdate;->userManager:Lcom/helpshift/user/UserManager;
.line 73
invoke-virtual {v4}, Lcom/helpshift/user/UserManager;->getPollerCursor()J
move-result-wide v6
const-wide/16 v8, 0x0
cmp-long v4, v6, v8
if-eqz v4, :cond_1
const-string v4, "cursor"
.line 75
invoke-static {v6, v7}, Ljava/lang/String;->valueOf(J)Ljava/lang/String;
move-result-object v6
invoke-interface {v3, v4, v6}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
:cond_1
iget-object v4, p0, Lcom/helpshift/poller/FetchNotificationUpdate;->device:Lcom/helpshift/platform/Device;
.line 77
invoke-interface {v4}, Lcom/helpshift/platform/Device;->getDeviceId()Ljava/lang/String;
move-result-object v4
const-string v6, "did"
invoke-interface {v3, v6, v4}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
iget-object v4, p0, Lcom/helpshift/poller/FetchNotificationUpdate;->persistentStorage:Lcom/helpshift/storage/HSPersistentStorage;
.line 78
invoke-virtual {v4}, Lcom/helpshift/storage/HSPersistentStorage;->getPlatformId()Ljava/lang/String;
move-result-object v4
const-string v6, "platform-id"
invoke-interface {v3, v6, v4}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
.line 80
new-instance v4, Lcom/helpshift/network/GETNetwork;
iget-object v6, p0, Lcom/helpshift/poller/FetchNotificationUpdate;->httpTransport:Lcom/helpshift/network/HTTPTransport;
invoke-direct {v4, v6, v2}, Lcom/helpshift/network/GETNetwork;-><init>(Lcom/helpshift/network/HTTPTransport;Ljava/lang/String;)V
.line 81
new-instance v2, Lcom/helpshift/network/AuthenticationFailureNetwork;
invoke-direct {v2, v4}, Lcom/helpshift/network/AuthenticationFailureNetwork;-><init>(Lcom/helpshift/network/HSNetwork;)V
.line 83
new-instance v4, Lcom/helpshift/network/HSRequestData;
invoke-direct {v4, v0, v3}, Lcom/helpshift/network/HSRequestData;-><init>(Ljava/util/Map;Ljava/util/Map;)V
.line 86
:try_start_0
invoke-interface {v2, v4}, Lcom/helpshift/network/HSNetwork;->makeRequest(Lcom/helpshift/network/HSRequestData;)Lcom/helpshift/network/HSResponse;
move-result-object v0
.line 88
invoke-virtual {v0}, Lcom/helpshift/network/HSResponse;->getResponseString()Ljava/lang/String;
move-result-object v2
.line 89
new-instance v3, Lorg/json/JSONObject;
invoke-direct {v3, v2}, Lorg/json/JSONObject;-><init>(Ljava/lang/String;)V
const-string v2, "uc"
const/4 v4, 0x0
.line 91
invoke-virtual {v3, v2, v4}, Lorg/json/JSONObject;->optInt(Ljava/lang/String;I)I
move-result v2
const-string v6, "bpi"
const/16 v7, 0x1388
.line 92
invoke-virtual {v3, v6, v7}, Lorg/json/JSONObject;->optInt(Ljava/lang/String;I)I
move-result v6
const-string v7, "mpi"
const v10, 0xea60
.line 93
invoke-virtual {v3, v7, v10}, Lorg/json/JSONObject;->optInt(Ljava/lang/String;I)I
move-result v7
const-string v10, "cp"
.line 94
invoke-virtual {v3, v10, v4}, Lorg/json/JSONObject;->optBoolean(Ljava/lang/String;Z)Z
move-result v10
const-string v11, "c"
.line 95
invoke-virtual {v3, v11, v8, v9}, Lorg/json/JSONObject;->optLong(Ljava/lang/String;J)J
move-result-wide v8
iget-object v3, p0, Lcom/helpshift/poller/FetchNotificationUpdate;->userManager:Lcom/helpshift/user/UserManager;
.line 97
invoke-virtual {v3, v6}, Lcom/helpshift/user/UserManager;->setPollingBaseInterval(I)V
iget-object v3, p0, Lcom/helpshift/poller/FetchNotificationUpdate;->userManager:Lcom/helpshift/user/UserManager;
.line 98
invoke-virtual {v3, v7}, Lcom/helpshift/user/UserManager;->setPollingMaxInterval(I)V
iget-object v3, p0, Lcom/helpshift/poller/FetchNotificationUpdate;->userManager:Lcom/helpshift/user/UserManager;
.line 99
invoke-virtual {v3, v10}, Lcom/helpshift/user/UserManager;->setShouldPollFlag(Z)V
if-lez v2, :cond_2
iget-object v3, p0, Lcom/helpshift/poller/FetchNotificationUpdate;->userManager:Lcom/helpshift/user/UserManager;
.line 103
invoke-virtual {v3}, Lcom/helpshift/user/UserManager;->getUnreadNotificationCount()I
move-result v3
add-int/2addr v3, v2
iget-object v6, p0, Lcom/helpshift/poller/FetchNotificationUpdate;->userManager:Lcom/helpshift/user/UserManager;
.line 104
invoke-virtual {v6, v2}, Lcom/helpshift/user/UserManager;->updateUnreadCountBy(I)V
iget-object v2, p0, Lcom/helpshift/poller/FetchNotificationUpdate;->userManager:Lcom/helpshift/user/UserManager;
.line 108
invoke-virtual {v2}, Lcom/helpshift/user/UserManager;->isPushTokenSynced()Z
move-result v2
if-nez v2, :cond_2
iget-object v2, p0, Lcom/helpshift/poller/FetchNotificationUpdate;->notificationManager:Lcom/helpshift/notification/CoreNotificationManager;
iget-object v6, p0, Lcom/helpshift/poller/FetchNotificationUpdate;->genericDataManager:Lcom/helpshift/storage/HSGenericDataManager;
.line 110
invoke-virtual {v6, v3}, Lcom/helpshift/storage/HSGenericDataManager;->getNotificationStringForCount(I)Ljava/lang/String;
move-result-object v3
invoke-interface {v2, v3, v4}, Lcom/helpshift/notification/CoreNotificationManager;->showNotification(Ljava/lang/String;Z)V
goto :goto_0
:catch_0
move-exception v0
goto :goto_1
:catch_1
move-exception v0
goto :goto_2
:catch_2
move-exception v0
goto :goto_4
:cond_2
:goto_0
iget-object v2, p0, Lcom/helpshift/poller/FetchNotificationUpdate;->userManager:Lcom/helpshift/user/UserManager;
.line 116
invoke-virtual {v2, v8, v9}, Lcom/helpshift/user/UserManager;->setPollerCursor(J)V
.line 119
invoke-virtual {v0}, Lcom/helpshift/network/HSResponse;->getStatus()I
move-result v0
:try_end_0
.catch Lorg/json/JSONException; {:try_start_0 .. :try_end_0} :catch_2
.catch Lcom/helpshift/network/exception/HSRootApiException; {:try_start_0 .. :try_end_0} :catch_1
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
return v0
:goto_1
const-string v2, "Error in poller request"
.line 134
invoke-static {v1, v2, v0}, Lcom/helpshift/log/HSLogger;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V
goto :goto_5
:goto_2
iget-object v2, v0, Lcom/helpshift/network/exception/HSRootApiException;->exceptionType:Lcom/helpshift/network/exception/HSRootApiException$ExceptionType;
.line 125
sget-object v3, Lcom/helpshift/network/exception/NetworkException;->INVALID_AUTH_TOKEN:Lcom/helpshift/network/exception/NetworkException;
if-ne v2, v3, :cond_3
iget-object v2, p0, Lcom/helpshift/poller/FetchNotificationUpdate;->hsEventProxy:Lcom/helpshift/chat/HSEventProxy;
const-string v3, "invalid user auth token"
.line 126
invoke-virtual {v2, v3}, Lcom/helpshift/chat/HSEventProxy;->sendAuthFailureEvent(Ljava/lang/String;)V
goto :goto_3
.line 128
:cond_3
sget-object v3, Lcom/helpshift/network/exception/NetworkException;->AUTH_TOKEN_NOT_PROVIDED:Lcom/helpshift/network/exception/NetworkException;
if-ne v2, v3, :cond_4
iget-object v2, p0, Lcom/helpshift/poller/FetchNotificationUpdate;->hsEventProxy:Lcom/helpshift/chat/HSEventProxy;
const-string v3, "missing user auth token"
.line 129
invoke-virtual {v2, v3}, Lcom/helpshift/chat/HSEventProxy;->sendAuthFailureEvent(Ljava/lang/String;)V
:cond_4
:goto_3
const-string v2, "HSRootApiException in poller request"
.line 131
invoke-static {v1, v2, v0}, Lcom/helpshift/log/HSLogger;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V
goto :goto_5
:goto_4
const-string v2, "Error parsing poller response"
.line 122
invoke-static {v1, v2, v0}, Lcom/helpshift/log/HSLogger;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V
:goto_5
return v5
:cond_5
:goto_6
const-string v0, "Skipping notification count fetch. Invalid params for network call."
.line 69
invoke-static {v1, v0}, Lcom/helpshift/log/HSLogger;->d(Ljava/lang/String;Ljava/lang/String;)V
return v5
.end method

View File

@@ -0,0 +1,58 @@
.class public Lcom/helpshift/poller/PollerController$1;
.super Ljava/lang/Object;
.source "SourceFile"
# interfaces
.implements Ljava/lang/Runnable;
# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
value = Lcom/helpshift/poller/PollerController;->scheduleNextPoll(I)V
.end annotation
.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x1
name = null
.end annotation
# instance fields
.field public final synthetic this$0:Lcom/helpshift/poller/PollerController;
# direct methods
.method public constructor <init>(Lcom/helpshift/poller/PollerController;)V
.locals 0
iput-object p1, p0, Lcom/helpshift/poller/PollerController$1;->this$0:Lcom/helpshift/poller/PollerController;
.line 85
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
# virtual methods
.method public run()V
.locals 2
iget-object v0, p0, Lcom/helpshift/poller/PollerController$1;->this$0:Lcom/helpshift/poller/PollerController;
.line 88
invoke-static {v0}, Lcom/helpshift/poller/PollerController;->access$000(Lcom/helpshift/poller/PollerController;)Lcom/helpshift/poller/FetchNotificationUpdate;
move-result-object v0
invoke-virtual {v0}, Lcom/helpshift/poller/FetchNotificationUpdate;->execute()I
move-result v0
iget-object v1, p0, Lcom/helpshift/poller/PollerController$1;->this$0:Lcom/helpshift/poller/PollerController;
.line 89
invoke-static {v1, v0}, Lcom/helpshift/poller/PollerController;->access$100(Lcom/helpshift/poller/PollerController;I)V
return-void
.end method

View File

@@ -0,0 +1,243 @@
.class public Lcom/helpshift/poller/PollerController;
.super Ljava/lang/Object;
.source "SourceFile"
# instance fields
.field public exponentialBackoff:Lcom/helpshift/poller/ExponentialBackoff;
.field public isRunning:Z
.field public pollFunction:Lcom/helpshift/poller/FetchNotificationUpdate;
.field public scheduledThreadPoolExecutor:Ljava/util/concurrent/ScheduledThreadPoolExecutor;
.field public shouldStop:Z
.field public userManager:Lcom/helpshift/user/UserManager;
# direct methods
.method public constructor <init>(Lcom/helpshift/poller/FetchNotificationUpdate;Lcom/helpshift/user/UserManager;Lcom/helpshift/poller/ExponentialBackoff;Ljava/util/concurrent/ScheduledThreadPoolExecutor;)V
.locals 0
.line 29
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
iput-object p1, p0, Lcom/helpshift/poller/PollerController;->pollFunction:Lcom/helpshift/poller/FetchNotificationUpdate;
iput-object p2, p0, Lcom/helpshift/poller/PollerController;->userManager:Lcom/helpshift/user/UserManager;
iput-object p3, p0, Lcom/helpshift/poller/PollerController;->exponentialBackoff:Lcom/helpshift/poller/ExponentialBackoff;
iput-object p4, p0, Lcom/helpshift/poller/PollerController;->scheduledThreadPoolExecutor:Ljava/util/concurrent/ScheduledThreadPoolExecutor;
return-void
.end method
.method public static synthetic access$000(Lcom/helpshift/poller/PollerController;)Lcom/helpshift/poller/FetchNotificationUpdate;
.locals 0
.line 14
iget-object p0, p0, Lcom/helpshift/poller/PollerController;->pollFunction:Lcom/helpshift/poller/FetchNotificationUpdate;
return-object p0
.end method
.method public static synthetic access$100(Lcom/helpshift/poller/PollerController;I)V
.locals 0
.line 14
invoke-virtual {p0, p1}, Lcom/helpshift/poller/PollerController;->scheduleNextPoll(I)V
return-void
.end method
# virtual methods
.method public final scheduleNextPoll(I)V
.locals 5
iget-boolean v0, p0, Lcom/helpshift/poller/PollerController;->shouldStop:Z
const-string v1, "PolerCntlr"
if-nez v0, :cond_2
iget-object v0, p0, Lcom/helpshift/poller/PollerController;->userManager:Lcom/helpshift/user/UserManager;
.line 66
invoke-virtual {v0}, Lcom/helpshift/user/UserManager;->shouldPoll()Z
move-result v0
if-eqz v0, :cond_2
const/4 v0, -0x1
if-ne p1, v0, :cond_0
goto :goto_1
:cond_0
iget-object v2, p0, Lcom/helpshift/poller/PollerController;->userManager:Lcom/helpshift/user/UserManager;
.line 71
invoke-virtual {v2}, Lcom/helpshift/user/UserManager;->getPollingBaseInterval()I
move-result v2
iget-object v3, p0, Lcom/helpshift/poller/PollerController;->userManager:Lcom/helpshift/user/UserManager;
.line 72
invoke-virtual {v3}, Lcom/helpshift/user/UserManager;->getPollingMaxInterval()I
move-result v3
iget-object v4, p0, Lcom/helpshift/poller/PollerController;->exponentialBackoff:Lcom/helpshift/poller/ExponentialBackoff;
.line 75
invoke-virtual {v4, v2, v3}, Lcom/helpshift/poller/ExponentialBackoff;->reconcileIntervals(II)V
iget-object v2, p0, Lcom/helpshift/poller/PollerController;->exponentialBackoff:Lcom/helpshift/poller/ExponentialBackoff;
.line 76
invoke-virtual {v2, p1}, Lcom/helpshift/poller/ExponentialBackoff;->nextInterval(I)I
move-result p1
if-ne p1, v0, :cond_1
const-string p1, "Stopping poller, request failed"
.line 79
invoke-static {v1, p1}, Lcom/helpshift/log/HSLogger;->d(Ljava/lang/String;Ljava/lang/String;)V
return-void
.line 83
:cond_1
new-instance v0, Ljava/lang/StringBuilder;
invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
const-string v2, "Scheduling next poll with interval: "
invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v0, p1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v0
invoke-static {v1, v0}, Lcom/helpshift/log/HSLogger;->d(Ljava/lang/String;Ljava/lang/String;)V
:try_start_0
iget-object v0, p0, Lcom/helpshift/poller/PollerController;->scheduledThreadPoolExecutor:Ljava/util/concurrent/ScheduledThreadPoolExecutor;
.line 85
new-instance v2, Lcom/helpshift/util/SafeWrappedRunnable;
new-instance v3, Lcom/helpshift/poller/PollerController$1;
invoke-direct {v3, p0}, Lcom/helpshift/poller/PollerController$1;-><init>(Lcom/helpshift/poller/PollerController;)V
invoke-direct {v2, v3}, Lcom/helpshift/util/SafeWrappedRunnable;-><init>(Ljava/lang/Runnable;)V
int-to-long v3, p1
sget-object p1, Ljava/util/concurrent/TimeUnit;->MILLISECONDS:Ljava/util/concurrent/TimeUnit;
invoke-virtual {v0, v2, v3, v4, p1}, Ljava/util/concurrent/ScheduledThreadPoolExecutor;->schedule(Ljava/lang/Runnable;JLjava/util/concurrent/TimeUnit;)Ljava/util/concurrent/ScheduledFuture;
:try_end_0
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
goto :goto_0
:catch_0
move-exception p1
const-string v0, "Error in scheduling next poll"
.line 94
invoke-static {v1, v0, p1}, Lcom/helpshift/log/HSLogger;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V
:goto_0
return-void
:cond_2
:goto_1
const-string p1, "Stopping poller, shouldPoll is false or STOP_POLLING received."
.line 67
invoke-static {v1, p1}, Lcom/helpshift/log/HSLogger;->d(Ljava/lang/String;Ljava/lang/String;)V
return-void
.end method
.method public start()V
.locals 2
const/4 v0, 0x0
iput-boolean v0, p0, Lcom/helpshift/poller/PollerController;->shouldStop:Z
iget-boolean v1, p0, Lcom/helpshift/poller/PollerController;->isRunning:Z
if-nez v1, :cond_0
.line 41
invoke-virtual {p0, v0}, Lcom/helpshift/poller/PollerController;->scheduleNextPoll(I)V
const/4 v0, 0x1
iput-boolean v0, p0, Lcom/helpshift/poller/PollerController;->isRunning:Z
:cond_0
return-void
.end method
.method public stop()V
.locals 3
const/4 v0, 0x1
iput-boolean v0, p0, Lcom/helpshift/poller/PollerController;->shouldStop:Z
const/4 v0, 0x0
iput-boolean v0, p0, Lcom/helpshift/poller/PollerController;->isRunning:Z
iget-object v0, p0, Lcom/helpshift/poller/PollerController;->exponentialBackoff:Lcom/helpshift/poller/ExponentialBackoff;
.line 49
invoke-virtual {v0}, Lcom/helpshift/poller/ExponentialBackoff;->reset()V
:try_start_0
iget-object v0, p0, Lcom/helpshift/poller/PollerController;->scheduledThreadPoolExecutor:Ljava/util/concurrent/ScheduledThreadPoolExecutor;
.line 54
invoke-virtual {v0}, Ljava/util/concurrent/ScheduledThreadPoolExecutor;->getQueue()Ljava/util/concurrent/BlockingQueue;
move-result-object v0
invoke-interface {v0}, Ljava/util/Collection;->clear()V
:try_end_0
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
goto :goto_0
:catch_0
move-exception v0
const-string v1, "PolerCntlr"
const-string v2, "Error in clearing the polling queue."
.line 57
invoke-static {v1, v2, v0}, Lcom/helpshift/log/HSLogger;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V
:goto_0
return-void
.end method