483 lines
14 KiB
Smali
483 lines
14 KiB
Smali
.class public final Lcom/discord/workers/TimedMuteWorker;
|
|
.super Landroidx/work/Worker;
|
|
.source "TimedMuteWorker.kt"
|
|
|
|
|
|
# instance fields
|
|
.field public a:Lcom/discord/utilities/time/Clock;
|
|
|
|
|
|
# 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
|
|
|
|
invoke-static {}, Lcom/discord/utilities/time/ClockFactory;->get()Lcom/discord/utilities/time/Clock;
|
|
|
|
move-result-object p1
|
|
|
|
iput-object p1, p0, Lcom/discord/workers/TimedMuteWorker;->a:Lcom/discord/utilities/time/Clock;
|
|
|
|
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-string v1, " until "
|
|
|
|
const-class v2, Lcom/discord/workers/TimedMuteWorker;
|
|
|
|
sget-object v3, Lcom/discord/app/AppLog;->c:Lcom/discord/app/AppLog;
|
|
|
|
invoke-virtual {v2}, Ljava/lang/Class;->getSimpleName()Ljava/lang/String;
|
|
|
|
move-result-object v4
|
|
|
|
const-string v9, "javaClass.simpleName"
|
|
|
|
invoke-static {v4, v9}, 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 v5, "Starting for ["
|
|
|
|
invoke-virtual {v0, v5}, 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 v5
|
|
|
|
const-string v6, "inputData"
|
|
|
|
invoke-static {v5, v6}, Lj0/n/c/h;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
invoke-virtual {v5}, Landroidx/work/Data;->getKeyValueMap()Ljava/util/Map;
|
|
|
|
move-result-object v5
|
|
|
|
invoke-virtual {v0, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
|
|
|
|
const/16 v5, 0x5d
|
|
|
|
invoke-virtual {v0, v5}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object v5
|
|
|
|
const/4 v6, 0x0
|
|
|
|
const/4 v7, 0x4
|
|
|
|
const/4 v8, 0x0
|
|
|
|
invoke-static/range {v3 .. v8}, 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 v3, "Result.failure()"
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
sget-object v10, Lcom/discord/app/AppLog;->c:Lcom/discord/app/AppLog;
|
|
|
|
invoke-virtual {v2}, Ljava/lang/Class;->getSimpleName()Ljava/lang/String;
|
|
|
|
move-result-object v11
|
|
|
|
invoke-static {v11, v9}, Lj0/n/c/h;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
const/4 v13, 0x0
|
|
|
|
const/4 v14, 0x4
|
|
|
|
const/4 v15, 0x0
|
|
|
|
const-string v12, "Not authenticated. Aborting job request."
|
|
|
|
invoke-static/range {v10 .. v15}, 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, v3}, 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 v4
|
|
|
|
const-string v5, "applicationContext"
|
|
|
|
invoke-static {v4, v5}, Lj0/n/c/h;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
invoke-virtual {v0, v4}, Lcom/discord/utilities/io/NetworkUtils;->isDeviceConnected(Landroid/content/Context;)Z
|
|
|
|
move-result v0
|
|
|
|
const-string v4, "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, v4}, 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 v5, "com.discord.intent.extra.EXTRA_GUILD_ID"
|
|
|
|
const-wide/16 v6, -0x1
|
|
|
|
invoke-virtual {v0, v5, v6, v7}, Landroidx/work/Data;->getLong(Ljava/lang/String;J)J
|
|
|
|
move-result-wide v10
|
|
|
|
invoke-virtual/range {p0 .. p0}, Landroidx/work/ListenableWorker;->getInputData()Landroidx/work/Data;
|
|
|
|
move-result-object v0
|
|
|
|
const-string v5, "com.discord.intent.extra.EXTRA_CHANNEL_ID"
|
|
|
|
invoke-virtual {v0, v5, v6, v7}, Landroidx/work/Data;->getLong(Ljava/lang/String;J)J
|
|
|
|
move-result-wide v13
|
|
|
|
invoke-virtual/range {p0 .. p0}, Landroidx/work/ListenableWorker;->getInputData()Landroidx/work/Data;
|
|
|
|
move-result-object v0
|
|
|
|
const-wide/16 v6, 0x0
|
|
|
|
const-string v5, "com.discord.intent.extra.EXTRA_UNTIL_TIMESTAMP_MS"
|
|
|
|
invoke-virtual {v0, v5, v6, v7}, Landroidx/work/Data;->getLong(Ljava/lang/String;J)J
|
|
|
|
move-result-wide v5
|
|
|
|
const-wide/16 v7, -0x1
|
|
|
|
cmp-long v0, v10, v7
|
|
|
|
if-eqz v0, :cond_6
|
|
|
|
cmp-long v0, v13, v7
|
|
|
|
if-nez v0, :cond_2
|
|
|
|
goto/16 :goto_3
|
|
|
|
:cond_2
|
|
move-object/from16 v7, p0
|
|
|
|
iget-object v0, v7, Lcom/discord/workers/TimedMuteWorker;->a:Lcom/discord/utilities/time/Clock;
|
|
|
|
invoke-interface {v0}, Lcom/discord/utilities/time/Clock;->currentTimeMillis()J
|
|
|
|
move-result-wide v15
|
|
|
|
const-string v0, "Result.success()"
|
|
|
|
cmp-long v8, v15, v5
|
|
|
|
if-lez v8, :cond_3
|
|
|
|
invoke-static {}, Landroidx/work/ListenableWorker$Result;->success()Landroidx/work/ListenableWorker$Result;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-static {v1, v0}, Lj0/n/c/h;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
return-object v1
|
|
|
|
:cond_3
|
|
invoke-static {v5, v6}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;
|
|
|
|
move-result-object v5
|
|
|
|
const/4 v6, 0x2
|
|
|
|
const/4 v8, 0x0
|
|
|
|
invoke-static {v5, v8, v6, v8}, Lcom/discord/utilities/time/TimeUtils;->toUTCDateTime$default(Ljava/lang/Long;Ljava/lang/String;ILjava/lang/Object;)Ljava/lang/String;
|
|
|
|
move-result-object v5
|
|
|
|
new-instance v6, Lcom/discord/restapi/RestAPIParams$UserGuildSettings;
|
|
|
|
new-instance v12, Lcom/discord/restapi/RestAPIParams$UserGuildSettings$ChannelOverride;
|
|
|
|
sget-object v16, Ljava/lang/Boolean;->TRUE:Ljava/lang/Boolean;
|
|
|
|
new-instance v15, Lcom/discord/models/domain/ModelMuteConfig;
|
|
|
|
invoke-direct {v15, v5}, Lcom/discord/models/domain/ModelMuteConfig;-><init>(Ljava/lang/String;)V
|
|
|
|
const/16 v18, 0x0
|
|
|
|
const/16 v19, 0x4
|
|
|
|
const/16 v20, 0x0
|
|
|
|
move-object/from16 v17, v15
|
|
|
|
move-object v15, v12
|
|
|
|
invoke-direct/range {v15 .. v20}, Lcom/discord/restapi/RestAPIParams$UserGuildSettings$ChannelOverride;-><init>(Ljava/lang/Boolean;Lcom/discord/models/domain/ModelMuteConfig;Ljava/lang/Integer;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
|
|
|
|
invoke-direct {v6, v13, v14, v12}, Lcom/discord/restapi/RestAPIParams$UserGuildSettings;-><init>(JLcom/discord/restapi/RestAPIParams$UserGuildSettings$ChannelOverride;)V
|
|
|
|
:try_start_0
|
|
sget-object v12, Lcom/discord/utilities/rest/RestAPI;->Companion:Lcom/discord/utilities/rest/RestAPI$Companion;
|
|
|
|
invoke-virtual {v12}, Lcom/discord/utilities/rest/RestAPI$Companion;->getApi()Lcom/discord/utilities/rest/RestAPI;
|
|
|
|
move-result-object v12
|
|
|
|
invoke-virtual {v12, v10, v11, v6}, Lcom/discord/utilities/rest/RestAPI;->updateUserGuildSettings(JLcom/discord/restapi/RestAPIParams$UserGuildSettings;)Lrx/Observable;
|
|
|
|
move-result-object v6
|
|
|
|
if-eqz v6, :cond_4
|
|
|
|
new-instance v8, Lr0/m/b;
|
|
|
|
invoke-direct {v8, v6}, Lr0/m/b;-><init>(Lrx/Observable;)V
|
|
|
|
invoke-virtual {v8}, Lr0/m/b;->a()Ljava/lang/Object;
|
|
|
|
move-result-object v6
|
|
|
|
check-cast v6, Lcom/discord/models/domain/ModelNotificationSettings;
|
|
|
|
sget-object v16, Lcom/discord/app/AppLog;->c:Lcom/discord/app/AppLog;
|
|
|
|
invoke-virtual/range {p0 .. p0}, Ljava/lang/Object;->getClass()Ljava/lang/Class;
|
|
|
|
move-result-object v8
|
|
|
|
invoke-virtual {v8}, Ljava/lang/Class;->getSimpleName()Ljava/lang/String;
|
|
|
|
move-result-object v8
|
|
|
|
invoke-static {v8, v9}, Lj0/n/c/h;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
new-instance v12, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {v12}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
const-string v15, "Muted: "
|
|
|
|
invoke-virtual {v12, v15}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v12, v10, v11}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;
|
|
|
|
const/16 v15, 0x2d
|
|
|
|
invoke-virtual {v12, v15}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v12, v13, v14}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v12, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v12, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v12}, 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, v8
|
|
|
|
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 v12, 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 v8
|
|
:try_end_0
|
|
.catchall {:try_start_0 .. :try_end_0} :catchall_1
|
|
|
|
const/16 v16, 0x0
|
|
|
|
const/16 v17, 0x4
|
|
|
|
const/16 v18, 0x0
|
|
|
|
move-wide/from16 v19, v13
|
|
|
|
const/16 v7, 0x2d
|
|
|
|
move-object v15, v8
|
|
|
|
:try_start_1
|
|
invoke-static/range {v12 .. v18}, Lcom/discord/utilities/fcm/NotificationClient;->clear$default(Lcom/discord/utilities/fcm/NotificationClient;JLandroid/content/Context;ZILjava/lang/Object;)V
|
|
|
|
sget-object v8, Lcom/discord/stores/StoreStream;->Companion:Lcom/discord/stores/StoreStream$Companion;
|
|
|
|
invoke-virtual {v8}, Lcom/discord/stores/StoreStream$Companion;->getAnalytics()Lcom/discord/stores/StoreAnalytics;
|
|
|
|
move-result-object v8
|
|
|
|
const-string v12, "notifSettings"
|
|
|
|
invoke-static {v6, v12}, Lj0/n/c/h;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
invoke-static/range {v19 .. v20}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;
|
|
|
|
move-result-object v12
|
|
|
|
invoke-virtual {v8, v6, v12}, Lcom/discord/stores/StoreAnalytics;->onNotificationSettingsUpdated(Lcom/discord/models/domain/ModelNotificationSettings;Ljava/lang/Long;)V
|
|
|
|
invoke-static {}, Landroidx/work/ListenableWorker$Result;->success()Landroidx/work/ListenableWorker$Result;
|
|
|
|
move-result-object v6
|
|
|
|
invoke-static {v6, v0}, Lj0/n/c/h;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
goto :goto_2
|
|
|
|
:catchall_0
|
|
move-exception v0
|
|
|
|
goto :goto_0
|
|
|
|
:cond_4
|
|
move-wide/from16 v19, v13
|
|
|
|
const/16 v7, 0x2d
|
|
|
|
throw v8
|
|
:try_end_1
|
|
.catchall {:try_start_1 .. :try_end_1} :catchall_0
|
|
|
|
:catchall_1
|
|
move-exception v0
|
|
|
|
move-wide/from16 v19, v13
|
|
|
|
const/16 v7, 0x2d
|
|
|
|
:goto_0
|
|
sget-object v6, Lcom/discord/app/AppLog;->c:Lcom/discord/app/AppLog;
|
|
|
|
invoke-virtual {v2}, Ljava/lang/Class;->getSimpleName()Ljava/lang/String;
|
|
|
|
move-result-object v2
|
|
|
|
invoke-static {v2, v9}, 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, "Mute failure: "
|
|
|
|
invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v8, v10, v11}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v8, v7}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;
|
|
|
|
move-wide/from16 v9, v19
|
|
|
|
invoke-virtual {v8, v9, v10}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v8, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v8, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v8}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {v6, v2, v1, 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, 0x3
|
|
|
|
if-ge v0, v1, :cond_5
|
|
|
|
invoke-static {}, Landroidx/work/ListenableWorker$Result;->retry()Landroidx/work/ListenableWorker$Result;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-static {v0, v4}, Lj0/n/c/h;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
goto :goto_1
|
|
|
|
:cond_5
|
|
invoke-static {}, Landroidx/work/ListenableWorker$Result;->failure()Landroidx/work/ListenableWorker$Result;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-static {v0, v3}, Lj0/n/c/h;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
:goto_1
|
|
move-object v6, v0
|
|
|
|
:goto_2
|
|
return-object v6
|
|
|
|
:cond_6
|
|
:goto_3
|
|
invoke-static {}, Landroidx/work/ListenableWorker$Result;->failure()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
|
|
.end method
|