384 lines
11 KiB
Smali
384 lines
11 KiB
Smali
.class public final Lcom/discord/workers/MessageAckWorker;
|
|
.super Landroidx/work/Worker;
|
|
.source "MessageAckWorker.kt"
|
|
|
|
|
|
# direct methods
|
|
.method public constructor <init>(Landroid/content/Context;Landroidx/work/WorkerParameters;)V
|
|
.locals 1
|
|
|
|
const/4 v0, 0x0
|
|
|
|
if-eqz p1, :cond_1
|
|
|
|
if-eqz p2, :cond_0
|
|
|
|
invoke-direct {p0, p1, p2}, Landroidx/work/Worker;-><init>(Landroid/content/Context;Landroidx/work/WorkerParameters;)V
|
|
|
|
return-void
|
|
|
|
:cond_0
|
|
const-string p1, "params"
|
|
|
|
invoke-static {p1}, Lj0/n/c/h;->c(Ljava/lang/String;)V
|
|
|
|
throw v0
|
|
|
|
:cond_1
|
|
const-string p1, "context"
|
|
|
|
invoke-static {p1}, Lj0/n/c/h;->c(Ljava/lang/String;)V
|
|
|
|
throw v0
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public doWork()Landroidx/work/ListenableWorker$Result;
|
|
.locals 22
|
|
|
|
const-class v1, Lcom/discord/workers/MessageAckWorker;
|
|
|
|
sget-object v2, Lcom/discord/app/AppLog;->d:Lcom/discord/app/AppLog;
|
|
|
|
invoke-virtual {v1}, Ljava/lang/Class;->getSimpleName()Ljava/lang/String;
|
|
|
|
move-result-object v3
|
|
|
|
const-string v8, "javaClass.simpleName"
|
|
|
|
invoke-static {v3, v8}, Lj0/n/c/h;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
new-instance v0, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
const-string v4, "Starting for ["
|
|
|
|
invoke-virtual {v0, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual/range {p0 .. p0}, Landroidx/work/ListenableWorker;->getInputData()Landroidx/work/Data;
|
|
|
|
move-result-object v4
|
|
|
|
const-string v5, "inputData"
|
|
|
|
invoke-static {v4, v5}, Lj0/n/c/h;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
invoke-virtual {v4}, Landroidx/work/Data;->getKeyValueMap()Ljava/util/Map;
|
|
|
|
move-result-object v4
|
|
|
|
invoke-virtual {v0, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
|
|
|
|
const/16 v4, 0x5d
|
|
|
|
invoke-virtual {v0, v4}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object v4
|
|
|
|
const/4 v5, 0x0
|
|
|
|
const/4 v6, 0x4
|
|
|
|
const/4 v7, 0x0
|
|
|
|
invoke-static/range {v2 .. v7}, Lcom/discord/utilities/logging/Logger;->i$default(Lcom/discord/utilities/logging/Logger;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;ILjava/lang/Object;)V
|
|
|
|
sget-object v0, Lcom/discord/utilities/fcm/NotificationClient;->INSTANCE:Lcom/discord/utilities/fcm/NotificationClient;
|
|
|
|
invoke-virtual {v0}, Lcom/discord/utilities/fcm/NotificationClient;->isAuthed()Z
|
|
|
|
move-result v0
|
|
|
|
const-string v2, "Result.failure()"
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
sget-object v9, Lcom/discord/app/AppLog;->d:Lcom/discord/app/AppLog;
|
|
|
|
invoke-virtual {v1}, Ljava/lang/Class;->getSimpleName()Ljava/lang/String;
|
|
|
|
move-result-object v10
|
|
|
|
invoke-static {v10, v8}, Lj0/n/c/h;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
const/4 v12, 0x0
|
|
|
|
const/4 v13, 0x4
|
|
|
|
const/4 v14, 0x0
|
|
|
|
const-string v11, "Not authenticated. Aborting job request."
|
|
|
|
invoke-static/range {v9 .. v14}, Lcom/discord/utilities/logging/Logger;->d$default(Lcom/discord/utilities/logging/Logger;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;ILjava/lang/Object;)V
|
|
|
|
invoke-static {}, Landroidx/work/ListenableWorker$Result;->failure()Landroidx/work/ListenableWorker$Result;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-static {v0, v2}, Lj0/n/c/h;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
return-object v0
|
|
|
|
:cond_0
|
|
sget-object v0, Lcom/discord/utilities/io/NetworkUtils;->INSTANCE:Lcom/discord/utilities/io/NetworkUtils;
|
|
|
|
invoke-virtual/range {p0 .. p0}, Landroidx/work/ListenableWorker;->getApplicationContext()Landroid/content/Context;
|
|
|
|
move-result-object v3
|
|
|
|
const-string v4, "applicationContext"
|
|
|
|
invoke-static {v3, v4}, Lj0/n/c/h;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
invoke-virtual {v0, v3}, Lcom/discord/utilities/io/NetworkUtils;->isDeviceConnected(Landroid/content/Context;)Z
|
|
|
|
move-result v0
|
|
|
|
const-string v3, "Result.retry()"
|
|
|
|
if-nez v0, :cond_1
|
|
|
|
invoke-static {}, Landroidx/work/ListenableWorker$Result;->retry()Landroidx/work/ListenableWorker$Result;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-static {v0, v3}, Lj0/n/c/h;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
return-object v0
|
|
|
|
:cond_1
|
|
invoke-virtual/range {p0 .. p0}, Landroidx/work/ListenableWorker;->getInputData()Landroidx/work/Data;
|
|
|
|
move-result-object v0
|
|
|
|
const-string v4, "com.discord.intent.extra.EXTRA_CHANNEL_ID"
|
|
|
|
const-wide/16 v5, -0x1
|
|
|
|
invoke-virtual {v0, v4, v5, v6}, Landroidx/work/Data;->getLong(Ljava/lang/String;J)J
|
|
|
|
move-result-wide v14
|
|
|
|
invoke-virtual/range {p0 .. p0}, Landroidx/work/ListenableWorker;->getInputData()Landroidx/work/Data;
|
|
|
|
move-result-object v0
|
|
|
|
const-string v4, "com.discord.intent.extra.EXTRA_MESSAGE_ID"
|
|
|
|
invoke-virtual {v0, v4, v5, v6}, Landroidx/work/Data;->getLong(Ljava/lang/String;J)J
|
|
|
|
move-result-wide v4
|
|
|
|
const/16 v6, 0x2d
|
|
|
|
:try_start_0
|
|
sget-object v0, Lcom/discord/utilities/rest/RestAPI;->Companion:Lcom/discord/utilities/rest/RestAPI$Companion;
|
|
|
|
invoke-virtual {v0}, Lcom/discord/utilities/rest/RestAPI$Companion;->getApi()Lcom/discord/utilities/rest/RestAPI;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-static {v4, v5}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;
|
|
|
|
move-result-object v7
|
|
|
|
new-instance v9, Lcom/discord/restapi/RestAPIParams$ChannelMessagesAck;
|
|
|
|
sget-object v10, Ljava/lang/Boolean;->FALSE:Ljava/lang/Boolean;
|
|
|
|
const/4 v11, 0x0
|
|
|
|
invoke-static {v11}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
|
|
|
|
move-result-object v11
|
|
|
|
invoke-direct {v9, v10, v11}, Lcom/discord/restapi/RestAPIParams$ChannelMessagesAck;-><init>(Ljava/lang/Boolean;Ljava/lang/Integer;)V
|
|
|
|
invoke-virtual {v0, v14, v15, v7, v9}, Lcom/discord/utilities/rest/RestAPI;->postChannelMessagesAck(JLjava/lang/Long;Lcom/discord/restapi/RestAPIParams$ChannelMessagesAck;)Lrx/Observable;
|
|
|
|
move-result-object v0
|
|
|
|
if-eqz v0, :cond_2
|
|
|
|
new-instance v7, Lr0/m/b;
|
|
|
|
invoke-direct {v7, v0}, Lr0/m/b;-><init>(Lrx/Observable;)V
|
|
|
|
invoke-virtual {v7}, Lr0/m/b;->a()Ljava/lang/Object;
|
|
|
|
sget-object v16, Lcom/discord/app/AppLog;->d:Lcom/discord/app/AppLog;
|
|
|
|
invoke-virtual/range {p0 .. p0}, Ljava/lang/Object;->getClass()Ljava/lang/Class;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {v0}, Ljava/lang/Class;->getSimpleName()Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-static {v0, v8}, Lj0/n/c/h;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
new-instance v7, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {v7}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
const-string v9, "Marked as read: "
|
|
|
|
invoke-virtual {v7, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v7, v14, v15}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v7, v6}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v7, v4, v5}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v7}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object v18
|
|
|
|
const/16 v19, 0x0
|
|
|
|
const/16 v20, 0x4
|
|
|
|
const/16 v21, 0x0
|
|
|
|
move-object/from16 v17, v0
|
|
|
|
invoke-static/range {v16 .. v21}, Lcom/discord/utilities/logging/Logger;->d$default(Lcom/discord/utilities/logging/Logger;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;ILjava/lang/Object;)V
|
|
|
|
sget-object v9, Lcom/discord/utilities/fcm/NotificationClient;->INSTANCE:Lcom/discord/utilities/fcm/NotificationClient;
|
|
|
|
invoke-virtual/range {p0 .. p0}, Landroidx/work/ListenableWorker;->getApplicationContext()Landroid/content/Context;
|
|
|
|
move-result-object v12
|
|
:try_end_0
|
|
.catchall {:try_start_0 .. :try_end_0} :catchall_1
|
|
|
|
const/4 v13, 0x0
|
|
|
|
const/4 v0, 0x4
|
|
|
|
const/4 v7, 0x0
|
|
|
|
move-wide v10, v14
|
|
|
|
move-object/from16 v17, v2
|
|
|
|
move-object/from16 v16, v3
|
|
|
|
move-wide v2, v14
|
|
|
|
move v14, v0
|
|
|
|
move-object v15, v7
|
|
|
|
:try_start_1
|
|
invoke-static/range {v9 .. v15}, Lcom/discord/utilities/fcm/NotificationClient;->clear$default(Lcom/discord/utilities/fcm/NotificationClient;JLandroid/content/Context;ZILjava/lang/Object;)V
|
|
|
|
sget-object v0, Lcom/discord/stores/StoreStream;->Companion:Lcom/discord/stores/StoreStream$Companion;
|
|
|
|
invoke-virtual {v0}, Lcom/discord/stores/StoreStream$Companion;->getAnalytics()Lcom/discord/stores/StoreAnalytics;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {v0, v2, v3}, Lcom/discord/stores/StoreAnalytics;->ackMessage(J)V
|
|
|
|
invoke-static {}, Landroidx/work/ListenableWorker$Result;->success()Landroidx/work/ListenableWorker$Result;
|
|
|
|
move-result-object v0
|
|
|
|
const-string v7, "Result.success()"
|
|
|
|
invoke-static {v0, v7}, Lj0/n/c/h;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
goto :goto_2
|
|
|
|
:catchall_0
|
|
move-exception v0
|
|
|
|
goto :goto_0
|
|
|
|
:cond_2
|
|
move-object/from16 v17, v2
|
|
|
|
move-object/from16 v16, v3
|
|
|
|
move-wide v2, v14
|
|
|
|
const/4 v0, 0x0
|
|
|
|
throw v0
|
|
:try_end_1
|
|
.catchall {:try_start_1 .. :try_end_1} :catchall_0
|
|
|
|
:catchall_1
|
|
move-exception v0
|
|
|
|
move-object/from16 v17, v2
|
|
|
|
move-object/from16 v16, v3
|
|
|
|
move-wide v2, v14
|
|
|
|
:goto_0
|
|
sget-object v7, Lcom/discord/app/AppLog;->d:Lcom/discord/app/AppLog;
|
|
|
|
invoke-virtual {v1}, Ljava/lang/Class;->getSimpleName()Ljava/lang/String;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-static {v1, v8}, Lj0/n/c/h;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
new-instance v8, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {v8}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
const-string v9, "Marked as read failure: "
|
|
|
|
invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v8, v2, v3}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v8, v6}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v8, v4, v5}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v8}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object v2
|
|
|
|
invoke-virtual {v7, v1, v2, v0}, Lcom/discord/app/AppLog;->w(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V
|
|
|
|
invoke-virtual/range {p0 .. p0}, Landroidx/work/ListenableWorker;->getRunAttemptCount()I
|
|
|
|
move-result v0
|
|
|
|
const/4 v1, 0x5
|
|
|
|
if-ge v0, v1, :cond_3
|
|
|
|
invoke-static {}, Landroidx/work/ListenableWorker$Result;->retry()Landroidx/work/ListenableWorker$Result;
|
|
|
|
move-result-object v0
|
|
|
|
move-object/from16 v1, v16
|
|
|
|
goto :goto_1
|
|
|
|
:cond_3
|
|
invoke-static {}, Landroidx/work/ListenableWorker$Result;->failure()Landroidx/work/ListenableWorker$Result;
|
|
|
|
move-result-object v0
|
|
|
|
move-object/from16 v1, v17
|
|
|
|
:goto_1
|
|
invoke-static {v0, v1}, Lj0/n/c/h;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
:goto_2
|
|
return-object v0
|
|
.end method
|