519 lines
16 KiB
Smali
519 lines
16 KiB
Smali
.class public final Lcom/discord/workers/MessageSendWorker;
|
|
.super Landroidx/work/Worker;
|
|
.source "MessageSendWorker.kt"
|
|
|
|
|
|
# annotations
|
|
.annotation system Ldalvik/annotation/MemberClasses;
|
|
value = {
|
|
Lcom/discord/workers/MessageSendWorker$a;
|
|
}
|
|
.end annotation
|
|
|
|
|
|
# static fields
|
|
.field public static final a:Lcom/discord/workers/MessageSendWorker$a;
|
|
|
|
|
|
# direct methods
|
|
.method public static constructor <clinit>()V
|
|
.locals 2
|
|
|
|
new-instance v0, Lcom/discord/workers/MessageSendWorker$a;
|
|
|
|
const/4 v1, 0x0
|
|
|
|
invoke-direct {v0, v1}, Lcom/discord/workers/MessageSendWorker$a;-><init>(Lkotlin/jvm/internal/DefaultConstructorMarker;)V
|
|
|
|
sput-object v0, Lcom/discord/workers/MessageSendWorker;->a:Lcom/discord/workers/MessageSendWorker$a;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.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}, Lz/u/b/j;->a(Ljava/lang/String;)V
|
|
|
|
throw v0
|
|
|
|
:cond_1
|
|
const-string p1, "context"
|
|
|
|
invoke-static {p1}, Lz/u/b/j;->a(Ljava/lang/String;)V
|
|
|
|
throw v0
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public doWork()Landroidx/work/ListenableWorker$Result;
|
|
.locals 24
|
|
|
|
const-class v1, Lcom/discord/workers/MessageSendWorker;
|
|
|
|
sget-object v2, Lcom/discord/app/AppLog;->c: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}, Lz/u/b/j;->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}, Lz/u/b/j;->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;->c:Lcom/discord/app/AppLog;
|
|
|
|
invoke-virtual {v1}, Ljava/lang/Class;->getSimpleName()Ljava/lang/String;
|
|
|
|
move-result-object v10
|
|
|
|
invoke-static {v10, v8}, Lz/u/b/j;->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}, Lz/u/b/j;->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}, Lz/u/b/j;->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
|
|
|
|
if-nez v0, :cond_2
|
|
|
|
invoke-virtual/range {p0 .. p0}, Landroidx/work/ListenableWorker;->getRunAttemptCount()I
|
|
|
|
move-result v0
|
|
|
|
const/4 v1, 0x3
|
|
|
|
if-ge v0, v1, :cond_1
|
|
|
|
invoke-static {}, Landroidx/work/ListenableWorker$Result;->retry()Landroidx/work/ListenableWorker$Result;
|
|
|
|
move-result-object v0
|
|
|
|
const-string v1, "Result.retry()"
|
|
|
|
invoke-static {v0, v1}, Lz/u/b/j;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
goto :goto_0
|
|
|
|
:cond_1
|
|
invoke-static {}, Landroidx/work/ListenableWorker$Result;->failure()Landroidx/work/ListenableWorker$Result;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-static {v0, v2}, Lz/u/b/j;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
:goto_0
|
|
return-object v0
|
|
|
|
:cond_2
|
|
invoke-virtual/range {p0 .. p0}, Landroidx/work/ListenableWorker;->getInputData()Landroidx/work/Data;
|
|
|
|
move-result-object v0
|
|
|
|
const-wide/16 v5, -0x1
|
|
|
|
const-string v3, "com.discord.intent.extra.EXTRA_CHANNEL_ID"
|
|
|
|
invoke-virtual {v0, v3, v5, v6}, Landroidx/work/Data;->getLong(Ljava/lang/String;J)J
|
|
|
|
move-result-wide v5
|
|
|
|
invoke-virtual/range {p0 .. p0}, Landroidx/work/ListenableWorker;->getInputData()Landroidx/work/Data;
|
|
|
|
move-result-object v0
|
|
|
|
const-string v3, "com.discord.intent.extra.EXTRA_CHANNEL_NAME"
|
|
|
|
invoke-virtual {v0, v3}, Landroidx/work/Data;->getString(Ljava/lang/String;)Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
if-eqz v0, :cond_3
|
|
|
|
goto :goto_1
|
|
|
|
:cond_3
|
|
const-string v0, ""
|
|
|
|
:goto_1
|
|
move-object v3, v0
|
|
|
|
invoke-virtual/range {p0 .. p0}, Landroidx/work/ListenableWorker;->getInputData()Landroidx/work/Data;
|
|
|
|
move-result-object v0
|
|
|
|
const-string v7, "MESSAGE_CONTENT"
|
|
|
|
invoke-virtual {v0, v7}, Landroidx/work/Data;->getString(Ljava/lang/String;)Ljava/lang/String;
|
|
|
|
move-result-object v10
|
|
|
|
const-string v0, "Result.success()"
|
|
|
|
if-eqz v10, :cond_6
|
|
|
|
invoke-virtual/range {p0 .. p0}, Landroidx/work/ListenableWorker;->getInputData()Landroidx/work/Data;
|
|
|
|
move-result-object v7
|
|
|
|
const-string v9, "com.discord.intent.extra.EXTRA_MESSAGE_ID"
|
|
|
|
invoke-virtual {v7, v9}, Landroidx/work/Data;->getString(Ljava/lang/String;)Ljava/lang/String;
|
|
|
|
move-result-object v11
|
|
|
|
:try_start_0
|
|
sget-object v9, Lcom/discord/utilities/rest/RestAPI;->Companion:Lcom/discord/utilities/rest/RestAPI$Companion;
|
|
|
|
invoke-virtual {v9}, Lcom/discord/utilities/rest/RestAPI$Companion;->getApi()Lcom/discord/utilities/rest/RestAPI;
|
|
|
|
move-result-object v15
|
|
|
|
new-instance v14, Lcom/discord/restapi/RestAPIParams$Message;
|
|
:try_end_0
|
|
.catchall {:try_start_0 .. :try_end_0} :catchall_1
|
|
|
|
const/4 v12, 0x0
|
|
|
|
const/4 v13, 0x0
|
|
|
|
const/16 v16, 0xc
|
|
|
|
const/16 v17, 0x0
|
|
|
|
move-object v9, v14
|
|
|
|
move-object v7, v14
|
|
|
|
move/from16 v14, v16
|
|
|
|
move-object/from16 v16, v3
|
|
|
|
move-object v3, v15
|
|
|
|
move-object/from16 v15, v17
|
|
|
|
:try_start_1
|
|
invoke-direct/range {v9 .. v15}, Lcom/discord/restapi/RestAPIParams$Message;-><init>(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Long;Lcom/discord/restapi/RestAPIParams$Message$Activity;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
|
|
|
|
invoke-virtual {v3, v5, v6, v7}, Lcom/discord/utilities/rest/RestAPI;->sendMessage(JLcom/discord/restapi/RestAPIParams$Message;)Lrx/Observable;
|
|
|
|
move-result-object v3
|
|
|
|
const/4 v7, 0x0
|
|
|
|
invoke-static {v3, v7}, Lcom/discord/utilities/rx/ObservableExtensionsKt;->restSubscribeOn(Lrx/Observable;Z)Lrx/Observable;
|
|
|
|
move-result-object v9
|
|
|
|
const-wide/16 v10, 0x0
|
|
|
|
const/4 v12, 0x0
|
|
|
|
const/4 v13, 0x3
|
|
|
|
const/4 v14, 0x0
|
|
|
|
invoke-static/range {v9 .. v14}, Lcom/discord/utilities/rx/ObservableExtensionsKt;->takeSingleUntilTimeout$default(Lrx/Observable;JZILjava/lang/Object;)Lrx/Observable;
|
|
|
|
move-result-object v3
|
|
|
|
invoke-virtual {v3}, Lrx/Observable;->i()Lh0/n/b;
|
|
|
|
move-result-object v3
|
|
|
|
invoke-virtual {v3}, Lh0/n/b;->a()Ljava/lang/Object;
|
|
|
|
move-result-object v3
|
|
|
|
check-cast v3, Lcom/discord/models/domain/ModelMessage;
|
|
|
|
sget-object v7, Lcom/discord/utilities/fcm/NotificationCache;->INSTANCE:Lcom/discord/utilities/fcm/NotificationCache;
|
|
|
|
invoke-virtual {v7, v5, v6}, Lcom/discord/utilities/fcm/NotificationCache;->get(J)Lcom/discord/utilities/fcm/NotificationData$DisplayPayload;
|
|
|
|
move-result-object v7
|
|
|
|
if-eqz v7, :cond_5
|
|
|
|
invoke-virtual {v7}, Lcom/discord/utilities/fcm/NotificationData$DisplayPayload;->getExtras()Ljava/util/List;
|
|
|
|
move-result-object v7
|
|
|
|
invoke-static {v7}, Lz/q/l;->lastOrNull(Ljava/util/List;)Ljava/lang/Object;
|
|
|
|
move-result-object v7
|
|
|
|
check-cast v7, Lcom/discord/utilities/fcm/NotificationData;
|
|
|
|
if-eqz v7, :cond_4
|
|
|
|
const-string v9, "message"
|
|
|
|
invoke-static {v3, v9}, Lz/u/b/j;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
invoke-virtual {v7, v3}, Lcom/discord/utilities/fcm/NotificationData;->copyForDirectReply(Lcom/discord/models/domain/ModelMessage;)Lcom/discord/utilities/fcm/NotificationData;
|
|
|
|
move-result-object v7
|
|
|
|
sget-object v9, Lcom/discord/utilities/fcm/NotificationRenderer;->INSTANCE:Lcom/discord/utilities/fcm/NotificationRenderer;
|
|
|
|
invoke-virtual/range {p0 .. p0}, Landroidx/work/ListenableWorker;->getApplicationContext()Landroid/content/Context;
|
|
|
|
move-result-object v10
|
|
|
|
invoke-static {v10, v4}, Lz/u/b/j;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
sget-object v4, Lcom/discord/utilities/fcm/NotificationClient;->INSTANCE:Lcom/discord/utilities/fcm/NotificationClient;
|
|
|
|
invoke-virtual {v4}, Lcom/discord/utilities/fcm/NotificationClient;->getSettings$app_productionDiscordExternalRelease()Lcom/discord/utilities/fcm/NotificationClient$SettingsV2;
|
|
|
|
move-result-object v4
|
|
|
|
invoke-virtual {v9, v10, v7, v4}, Lcom/discord/utilities/fcm/NotificationRenderer;->display(Landroid/content/Context;Lcom/discord/utilities/fcm/NotificationData;Lcom/discord/utilities/fcm/NotificationClient$SettingsV2;)V
|
|
|
|
sget-object v18, Lcom/discord/app/AppLog;->c:Lcom/discord/app/AppLog;
|
|
|
|
invoke-virtual/range {p0 .. p0}, Ljava/lang/Object;->getClass()Ljava/lang/Class;
|
|
|
|
move-result-object v4
|
|
|
|
invoke-virtual {v4}, Ljava/lang/Class;->getSimpleName()Ljava/lang/String;
|
|
|
|
move-result-object v4
|
|
|
|
invoke-static {v4, v8}, Lz/u/b/j;->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, "Direct reply: "
|
|
|
|
invoke-virtual {v7, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v7, v5, v6}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;
|
|
|
|
const/16 v9, 0x2d
|
|
|
|
invoke-virtual {v7, v9}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v3}, Lcom/discord/models/domain/ModelMessage;->getId()J
|
|
|
|
move-result-wide v9
|
|
|
|
invoke-virtual {v7, v9, v10}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v7}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object v20
|
|
|
|
const/16 v21, 0x0
|
|
|
|
const/16 v22, 0x4
|
|
|
|
const/16 v23, 0x0
|
|
|
|
move-object/from16 v19, v4
|
|
|
|
invoke-static/range {v18 .. v23}, 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 v3, Lcom/discord/stores/StoreStream;->Companion:Lcom/discord/stores/StoreStream$Companion;
|
|
|
|
invoke-virtual {v3}, Lcom/discord/stores/StoreStream$Companion;->getAnalytics()Lcom/discord/stores/StoreAnalytics;
|
|
|
|
move-result-object v3
|
|
|
|
invoke-virtual {v3, v5, v6}, Lcom/discord/stores/StoreAnalytics;->ackMessage(J)V
|
|
|
|
invoke-static {}, Landroidx/work/ListenableWorker$Result;->success()Landroidx/work/ListenableWorker$Result;
|
|
|
|
move-result-object v3
|
|
|
|
invoke-static {v3, v0}, Lz/u/b/j;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
move-object v0, v3
|
|
|
|
move-object/from16 v3, p0
|
|
|
|
goto :goto_3
|
|
|
|
:cond_4
|
|
invoke-static {}, Landroidx/work/ListenableWorker$Result;->failure()Landroidx/work/ListenableWorker$Result;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-static {v0, v2}, Lz/u/b/j;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
return-object v0
|
|
|
|
:cond_5
|
|
invoke-static {}, Landroidx/work/ListenableWorker$Result;->failure()Landroidx/work/ListenableWorker$Result;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-static {v0, v2}, Lz/u/b/j;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
:try_end_1
|
|
.catchall {:try_start_1 .. :try_end_1} :catchall_0
|
|
|
|
return-object v0
|
|
|
|
:catchall_0
|
|
move-exception v0
|
|
|
|
goto :goto_2
|
|
|
|
:catchall_1
|
|
move-exception v0
|
|
|
|
move-object/from16 v16, v3
|
|
|
|
:goto_2
|
|
sget-object v3, Lcom/discord/app/AppLog;->c:Lcom/discord/app/AppLog;
|
|
|
|
invoke-virtual {v1}, Ljava/lang/Class;->getSimpleName()Ljava/lang/String;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-static {v1, v8}, Lz/u/b/j;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
new-instance v4, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {v4}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
const-string v7, "Direct reply failure: "
|
|
|
|
invoke-virtual {v4, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v4, v5, v6}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object v4
|
|
|
|
invoke-virtual {v3, v1, v4, v0}, Lcom/discord/app/AppLog;->w(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V
|
|
|
|
sget-object v0, Lcom/discord/utilities/fcm/NotificationCache;->INSTANCE:Lcom/discord/utilities/fcm/NotificationCache;
|
|
|
|
new-instance v1, Lcom/discord/workers/MessageSendWorker$b;
|
|
|
|
move-object/from16 v3, p0
|
|
|
|
move-object/from16 v4, v16
|
|
|
|
invoke-direct {v1, v3, v5, v6, v4}, Lcom/discord/workers/MessageSendWorker$b;-><init>(Lcom/discord/workers/MessageSendWorker;JLjava/lang/String;)V
|
|
|
|
const/4 v4, 0x0
|
|
|
|
invoke-virtual {v0, v5, v6, v4, v1}, Lcom/discord/utilities/fcm/NotificationCache;->remove(JZLkotlin/jvm/functions/Function1;)V
|
|
|
|
invoke-static {}, Landroidx/work/ListenableWorker$Result;->failure()Landroidx/work/ListenableWorker$Result;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-static {v0, v2}, Lz/u/b/j;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
:goto_3
|
|
return-object v0
|
|
|
|
:cond_6
|
|
move-object/from16 v3, p0
|
|
|
|
invoke-static {}, Landroidx/work/ListenableWorker$Result;->success()Landroidx/work/ListenableWorker$Result;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-static {v1, v0}, Lz/u/b/j;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
return-object v1
|
|
.end method
|