1025 lines
28 KiB
Smali
1025 lines
28 KiB
Smali
.class public final Lcom/discord/widgets/chat/MessageManager;
|
|
.super Ljava/lang/Object;
|
|
.source "MessageManager.kt"
|
|
|
|
|
|
# annotations
|
|
.annotation system Ldalvik/annotation/MemberClasses;
|
|
value = {
|
|
Lcom/discord/widgets/chat/MessageManager$MessageSendResult;,
|
|
Lcom/discord/widgets/chat/MessageManager$AttachmentsRequest;,
|
|
Lcom/discord/widgets/chat/MessageManager$AttachmentValidationResult;,
|
|
Lcom/discord/widgets/chat/MessageManager$ContentValidationResult;
|
|
}
|
|
.end annotation
|
|
|
|
|
|
# instance fields
|
|
.field public final context:Landroid/content/Context;
|
|
|
|
.field public final defaultMessageResultHandler:Lkotlin/jvm/functions/Function1;
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"Lkotlin/jvm/functions/Function1<",
|
|
"Lcom/discord/widgets/chat/MessageManager$MessageSendResult;",
|
|
"Lkotlin/Unit;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
.end field
|
|
|
|
.field public final logger:Lcom/discord/utilities/logging/Logger;
|
|
|
|
.field public final storeChannelsSelected:Lcom/discord/stores/StoreChannelsSelected;
|
|
|
|
.field public final storeGuilds:Lcom/discord/stores/StoreGuilds;
|
|
|
|
.field public final storeMessages:Lcom/discord/stores/StoreMessages;
|
|
|
|
.field public final storeSlowMode:Lcom/discord/stores/StoreSlowMode;
|
|
|
|
.field public final storeUser:Lcom/discord/stores/StoreUser;
|
|
|
|
|
|
# direct methods
|
|
.method public constructor <init>(Landroid/content/Context;Lcom/discord/stores/StoreMessages;Lcom/discord/stores/StoreUser;Lcom/discord/stores/StoreChannelsSelected;Lcom/discord/stores/StoreSlowMode;Lcom/discord/stores/StoreGuilds;Lcom/discord/utilities/logging/Logger;)V
|
|
.locals 1
|
|
|
|
const-string v0, "context"
|
|
|
|
invoke-static {p1, v0}, Lk0/n/c/i;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
const-string v0, "storeMessages"
|
|
|
|
invoke-static {p2, v0}, Lk0/n/c/i;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
const-string v0, "storeUser"
|
|
|
|
invoke-static {p3, v0}, Lk0/n/c/i;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
const-string v0, "storeChannelsSelected"
|
|
|
|
invoke-static {p4, v0}, Lk0/n/c/i;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
const-string v0, "storeSlowMode"
|
|
|
|
invoke-static {p5, v0}, Lk0/n/c/i;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
const-string v0, "storeGuilds"
|
|
|
|
invoke-static {p6, v0}, Lk0/n/c/i;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
const-string v0, "logger"
|
|
|
|
invoke-static {p7, v0}, Lk0/n/c/i;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
iput-object p1, p0, Lcom/discord/widgets/chat/MessageManager;->context:Landroid/content/Context;
|
|
|
|
iput-object p2, p0, Lcom/discord/widgets/chat/MessageManager;->storeMessages:Lcom/discord/stores/StoreMessages;
|
|
|
|
iput-object p3, p0, Lcom/discord/widgets/chat/MessageManager;->storeUser:Lcom/discord/stores/StoreUser;
|
|
|
|
iput-object p4, p0, Lcom/discord/widgets/chat/MessageManager;->storeChannelsSelected:Lcom/discord/stores/StoreChannelsSelected;
|
|
|
|
iput-object p5, p0, Lcom/discord/widgets/chat/MessageManager;->storeSlowMode:Lcom/discord/stores/StoreSlowMode;
|
|
|
|
iput-object p6, p0, Lcom/discord/widgets/chat/MessageManager;->storeGuilds:Lcom/discord/stores/StoreGuilds;
|
|
|
|
iput-object p7, p0, Lcom/discord/widgets/chat/MessageManager;->logger:Lcom/discord/utilities/logging/Logger;
|
|
|
|
new-instance p1, Lcom/discord/widgets/chat/MessageManager$defaultMessageResultHandler$1;
|
|
|
|
invoke-direct {p1, p0}, Lcom/discord/widgets/chat/MessageManager$defaultMessageResultHandler$1;-><init>(Lcom/discord/widgets/chat/MessageManager;)V
|
|
|
|
iput-object p1, p0, Lcom/discord/widgets/chat/MessageManager;->defaultMessageResultHandler:Lkotlin/jvm/functions/Function1;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public synthetic constructor <init>(Landroid/content/Context;Lcom/discord/stores/StoreMessages;Lcom/discord/stores/StoreUser;Lcom/discord/stores/StoreChannelsSelected;Lcom/discord/stores/StoreSlowMode;Lcom/discord/stores/StoreGuilds;Lcom/discord/utilities/logging/Logger;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
|
|
.locals 6
|
|
|
|
and-int/lit8 v0, p8, 0x2
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
sget-object v0, Lcom/discord/stores/StoreStream;->Companion:Lcom/discord/stores/StoreStream$Companion;
|
|
|
|
invoke-virtual {v0}, Lcom/discord/stores/StoreStream$Companion;->getMessages()Lcom/discord/stores/StoreMessages;
|
|
|
|
move-result-object v0
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
move-object v0, p2
|
|
|
|
:goto_0
|
|
and-int/lit8 v1, p8, 0x4
|
|
|
|
if-eqz v1, :cond_1
|
|
|
|
sget-object v1, Lcom/discord/stores/StoreStream;->Companion:Lcom/discord/stores/StoreStream$Companion;
|
|
|
|
invoke-virtual {v1}, Lcom/discord/stores/StoreStream$Companion;->getUsers()Lcom/discord/stores/StoreUser;
|
|
|
|
move-result-object v1
|
|
|
|
goto :goto_1
|
|
|
|
:cond_1
|
|
move-object v1, p3
|
|
|
|
:goto_1
|
|
and-int/lit8 v2, p8, 0x8
|
|
|
|
if-eqz v2, :cond_2
|
|
|
|
sget-object v2, Lcom/discord/stores/StoreStream;->Companion:Lcom/discord/stores/StoreStream$Companion;
|
|
|
|
invoke-virtual {v2}, Lcom/discord/stores/StoreStream$Companion;->getChannelsSelected()Lcom/discord/stores/StoreChannelsSelected;
|
|
|
|
move-result-object v2
|
|
|
|
goto :goto_2
|
|
|
|
:cond_2
|
|
move-object v2, p4
|
|
|
|
:goto_2
|
|
and-int/lit8 v3, p8, 0x10
|
|
|
|
if-eqz v3, :cond_3
|
|
|
|
sget-object v3, Lcom/discord/stores/StoreStream;->Companion:Lcom/discord/stores/StoreStream$Companion;
|
|
|
|
invoke-virtual {v3}, Lcom/discord/stores/StoreStream$Companion;->getSlowMode()Lcom/discord/stores/StoreSlowMode;
|
|
|
|
move-result-object v3
|
|
|
|
goto :goto_3
|
|
|
|
:cond_3
|
|
move-object v3, p5
|
|
|
|
:goto_3
|
|
and-int/lit8 v4, p8, 0x20
|
|
|
|
if-eqz v4, :cond_4
|
|
|
|
sget-object v4, Lcom/discord/stores/StoreStream;->Companion:Lcom/discord/stores/StoreStream$Companion;
|
|
|
|
invoke-virtual {v4}, Lcom/discord/stores/StoreStream$Companion;->getGuilds()Lcom/discord/stores/StoreGuilds;
|
|
|
|
move-result-object v4
|
|
|
|
goto :goto_4
|
|
|
|
:cond_4
|
|
move-object v4, p6
|
|
|
|
:goto_4
|
|
and-int/lit8 v5, p8, 0x40
|
|
|
|
if-eqz v5, :cond_5
|
|
|
|
sget-object v5, Lcom/discord/app/AppLog;->d:Lcom/discord/app/AppLog;
|
|
|
|
goto :goto_5
|
|
|
|
:cond_5
|
|
move-object v5, p7
|
|
|
|
:goto_5
|
|
move-object p2, p0
|
|
|
|
move-object p3, p1
|
|
|
|
move-object p4, v0
|
|
|
|
move-object p5, v1
|
|
|
|
move-object p6, v2
|
|
|
|
move-object p7, v3
|
|
|
|
move-object p8, v4
|
|
|
|
move-object p9, v5
|
|
|
|
invoke-direct/range {p2 .. p9}, Lcom/discord/widgets/chat/MessageManager;-><init>(Landroid/content/Context;Lcom/discord/stores/StoreMessages;Lcom/discord/stores/StoreUser;Lcom/discord/stores/StoreChannelsSelected;Lcom/discord/stores/StoreSlowMode;Lcom/discord/stores/StoreGuilds;Lcom/discord/utilities/logging/Logger;)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public static final synthetic access$getContext$p(Lcom/discord/widgets/chat/MessageManager;)Landroid/content/Context;
|
|
.locals 0
|
|
|
|
iget-object p0, p0, Lcom/discord/widgets/chat/MessageManager;->context:Landroid/content/Context;
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static final synthetic access$getStoreMessages$p(Lcom/discord/widgets/chat/MessageManager;)Lcom/discord/stores/StoreMessages;
|
|
.locals 0
|
|
|
|
iget-object p0, p0, Lcom/discord/widgets/chat/MessageManager;->storeMessages:Lcom/discord/stores/StoreMessages;
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static synthetic editMessage$default(Lcom/discord/widgets/chat/MessageManager;JJLjava/lang/String;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Z
|
|
.locals 7
|
|
|
|
and-int/lit8 p7, p7, 0x8
|
|
|
|
if-eqz p7, :cond_0
|
|
|
|
const/4 p6, 0x0
|
|
|
|
:cond_0
|
|
move-object v6, p6
|
|
|
|
move-object v0, p0
|
|
|
|
move-wide v1, p1
|
|
|
|
move-wide v3, p3
|
|
|
|
move-object v5, p5
|
|
|
|
invoke-virtual/range {v0 .. v6}, Lcom/discord/widgets/chat/MessageManager;->editMessage(JJLjava/lang/String;Lkotlin/jvm/functions/Function2;)Z
|
|
|
|
move-result p0
|
|
|
|
return p0
|
|
.end method
|
|
|
|
.method public static sendMessage$default(Lcom/discord/widgets/chat/MessageManager;Ljava/lang/String;Ljava/util/List;Lcom/discord/widgets/chat/MessageManager$AttachmentsRequest;Ljava/lang/Long;Ljava/util/List;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Z
|
|
.locals 9
|
|
|
|
move/from16 v0, p9
|
|
|
|
and-int/lit8 v1, v0, 0x1
|
|
|
|
if-eqz v1, :cond_0
|
|
|
|
const-string v1, ""
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
move-object v1, p1
|
|
|
|
:goto_0
|
|
and-int/lit8 v2, v0, 0x2
|
|
|
|
const/4 v3, 0x0
|
|
|
|
if-eqz v2, :cond_1
|
|
|
|
move-object v2, v3
|
|
|
|
goto :goto_1
|
|
|
|
:cond_1
|
|
move-object v2, p2
|
|
|
|
:goto_1
|
|
and-int/lit8 v4, v0, 0x4
|
|
|
|
if-eqz v4, :cond_2
|
|
|
|
move-object v4, v3
|
|
|
|
goto :goto_2
|
|
|
|
:cond_2
|
|
move-object v4, p3
|
|
|
|
:goto_2
|
|
and-int/lit8 v5, v0, 0x8
|
|
|
|
if-eqz v5, :cond_3
|
|
|
|
move-object v5, v3
|
|
|
|
goto :goto_3
|
|
|
|
:cond_3
|
|
move-object v5, p4
|
|
|
|
:goto_3
|
|
and-int/lit8 v6, v0, 0x10
|
|
|
|
if-eqz v6, :cond_4
|
|
|
|
sget-object v6, Lk0/i/l;->d:Lk0/i/l;
|
|
|
|
goto :goto_4
|
|
|
|
:cond_4
|
|
move-object v6, p5
|
|
|
|
:goto_4
|
|
and-int/lit8 v7, v0, 0x20
|
|
|
|
if-eqz v7, :cond_5
|
|
|
|
move-object v7, v3
|
|
|
|
goto :goto_5
|
|
|
|
:cond_5
|
|
move-object v7, p6
|
|
|
|
:goto_5
|
|
and-int/lit8 v8, v0, 0x40
|
|
|
|
if-eqz v8, :cond_6
|
|
|
|
goto :goto_6
|
|
|
|
:cond_6
|
|
move-object/from16 v3, p7
|
|
|
|
:goto_6
|
|
and-int/lit16 v0, v0, 0x80
|
|
|
|
if-eqz v0, :cond_7
|
|
|
|
move-object v0, p0
|
|
|
|
iget-object v8, v0, Lcom/discord/widgets/chat/MessageManager;->defaultMessageResultHandler:Lkotlin/jvm/functions/Function1;
|
|
|
|
goto :goto_7
|
|
|
|
:cond_7
|
|
move-object v0, p0
|
|
|
|
move-object/from16 v8, p8
|
|
|
|
:goto_7
|
|
move-object p1, v1
|
|
|
|
move-object p2, v2
|
|
|
|
move-object p3, v4
|
|
|
|
move-object p4, v5
|
|
|
|
move-object p5, v6
|
|
|
|
move-object p6, v7
|
|
|
|
move-object/from16 p7, v3
|
|
|
|
move-object/from16 p8, v8
|
|
|
|
invoke-virtual/range {p0 .. p8}, Lcom/discord/widgets/chat/MessageManager;->sendMessage(Ljava/lang/String;Ljava/util/List;Lcom/discord/widgets/chat/MessageManager$AttachmentsRequest;Ljava/lang/Long;Ljava/util/List;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;)Z
|
|
|
|
move-result v0
|
|
|
|
return v0
|
|
.end method
|
|
|
|
.method private final validateAttachments(Lcom/discord/widgets/chat/MessageManager$AttachmentsRequest;)Lcom/discord/widgets/chat/MessageManager$AttachmentValidationResult;
|
|
.locals 2
|
|
|
|
if-nez p1, :cond_0
|
|
|
|
sget-object p1, Lcom/discord/widgets/chat/MessageManager$AttachmentValidationResult$EmptyAttachments;->INSTANCE:Lcom/discord/widgets/chat/MessageManager$AttachmentValidationResult$EmptyAttachments;
|
|
|
|
return-object p1
|
|
|
|
:cond_0
|
|
invoke-virtual {p1}, Lcom/discord/widgets/chat/MessageManager$AttachmentsRequest;->getAttachments()Ljava/util/List;
|
|
|
|
move-result-object v0
|
|
|
|
if-eqz v0, :cond_3
|
|
|
|
invoke-interface {v0}, Ljava/util/List;->isEmpty()Z
|
|
|
|
move-result v0
|
|
|
|
if-eqz v0, :cond_1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_1
|
|
invoke-virtual {p1}, Lcom/discord/widgets/chat/MessageManager$AttachmentsRequest;->getCurrentFileSizeMB()F
|
|
|
|
move-result v0
|
|
|
|
invoke-virtual {p1}, Lcom/discord/widgets/chat/MessageManager$AttachmentsRequest;->getMaxFileSizeMB()I
|
|
|
|
move-result v1
|
|
|
|
int-to-float v1, v1
|
|
|
|
cmpl-float v0, v0, v1
|
|
|
|
if-ltz v0, :cond_2
|
|
|
|
new-instance v0, Lcom/discord/widgets/chat/MessageManager$AttachmentValidationResult$FilesTooLarge;
|
|
|
|
invoke-direct {v0, p1}, Lcom/discord/widgets/chat/MessageManager$AttachmentValidationResult$FilesTooLarge;-><init>(Lcom/discord/widgets/chat/MessageManager$AttachmentsRequest;)V
|
|
|
|
goto :goto_1
|
|
|
|
:cond_2
|
|
sget-object v0, Lcom/discord/widgets/chat/MessageManager$AttachmentValidationResult$Success;->INSTANCE:Lcom/discord/widgets/chat/MessageManager$AttachmentValidationResult$Success;
|
|
|
|
goto :goto_1
|
|
|
|
:cond_3
|
|
:goto_0
|
|
sget-object v0, Lcom/discord/widgets/chat/MessageManager$AttachmentValidationResult$EmptyAttachments;->INSTANCE:Lcom/discord/widgets/chat/MessageManager$AttachmentValidationResult$EmptyAttachments;
|
|
|
|
:goto_1
|
|
return-object v0
|
|
.end method
|
|
|
|
.method private final validateMessageContent(Ljava/lang/String;Ljava/util/List;)Lcom/discord/widgets/chat/MessageManager$ContentValidationResult;
|
|
.locals 3
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Ljava/lang/String;",
|
|
"Ljava/util/List<",
|
|
"Lcom/discord/models/dsti/dto/ModelDsti;",
|
|
">;)",
|
|
"Lcom/discord/widgets/chat/MessageManager$ContentValidationResult;"
|
|
}
|
|
.end annotation
|
|
|
|
invoke-interface {p1}, Ljava/lang/CharSequence;->length()I
|
|
|
|
move-result v0
|
|
|
|
const/4 v1, 0x1
|
|
|
|
const/4 v2, 0x0
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
const/4 v0, 0x1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
const/4 v0, 0x0
|
|
|
|
:goto_0
|
|
if-eqz v0, :cond_3
|
|
|
|
if-eqz p2, :cond_2
|
|
|
|
invoke-interface {p2}, Ljava/util/Collection;->isEmpty()Z
|
|
|
|
move-result p2
|
|
|
|
if-eqz p2, :cond_1
|
|
|
|
goto :goto_1
|
|
|
|
:cond_1
|
|
const/4 v1, 0x0
|
|
|
|
:cond_2
|
|
:goto_1
|
|
if-eqz v1, :cond_3
|
|
|
|
sget-object p1, Lcom/discord/widgets/chat/MessageManager$ContentValidationResult$EmptyContent;->INSTANCE:Lcom/discord/widgets/chat/MessageManager$ContentValidationResult$EmptyContent;
|
|
|
|
goto :goto_2
|
|
|
|
:cond_3
|
|
invoke-virtual {p1}, Ljava/lang/String;->length()I
|
|
|
|
move-result p1
|
|
|
|
const/16 p2, 0x7d0
|
|
|
|
if-le p1, p2, :cond_4
|
|
|
|
sget-object p1, Lcom/discord/widgets/chat/MessageManager$ContentValidationResult$MessageTooLong;->INSTANCE:Lcom/discord/widgets/chat/MessageManager$ContentValidationResult$MessageTooLong;
|
|
|
|
goto :goto_2
|
|
|
|
:cond_4
|
|
sget-object p1, Lcom/discord/widgets/chat/MessageManager$ContentValidationResult$Success;->INSTANCE:Lcom/discord/widgets/chat/MessageManager$ContentValidationResult$Success;
|
|
|
|
:goto_2
|
|
return-object p1
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public final editMessage(JJLjava/lang/String;Lkotlin/jvm/functions/Function2;)Z
|
|
.locals 7
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(JJ",
|
|
"Ljava/lang/String;",
|
|
"Lkotlin/jvm/functions/Function2<",
|
|
"-",
|
|
"Ljava/lang/Integer;",
|
|
"-",
|
|
"Ljava/lang/Integer;",
|
|
"Lkotlin/Unit;",
|
|
">;)Z"
|
|
}
|
|
.end annotation
|
|
|
|
const-string v0, "content"
|
|
|
|
invoke-static {p5, v0}, Lk0/n/c/i;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
sget-object v0, Lk0/i/l;->d:Lk0/i/l;
|
|
|
|
invoke-direct {p0, p5, v0}, Lcom/discord/widgets/chat/MessageManager;->validateMessageContent(Ljava/lang/String;Ljava/util/List;)Lcom/discord/widgets/chat/MessageManager$ContentValidationResult;
|
|
|
|
move-result-object v0
|
|
|
|
sget-object v1, Lcom/discord/widgets/chat/MessageManager$ContentValidationResult$MessageTooLong;->INSTANCE:Lcom/discord/widgets/chat/MessageManager$ContentValidationResult$MessageTooLong;
|
|
|
|
invoke-static {v0, v1}, Lk0/n/c/i;->areEqual(Ljava/lang/Object;Ljava/lang/Object;)Z
|
|
|
|
move-result v1
|
|
|
|
const/4 v2, 0x0
|
|
|
|
if-eqz v1, :cond_1
|
|
|
|
if-eqz p6, :cond_0
|
|
|
|
invoke-virtual {p5}, Ljava/lang/String;->length()I
|
|
|
|
move-result p1
|
|
|
|
invoke-static {p1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
|
|
|
|
move-result-object p1
|
|
|
|
const/16 p2, 0x7d0
|
|
|
|
invoke-static {p2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
|
|
|
|
move-result-object p2
|
|
|
|
invoke-interface {p6, p1, p2}, Lkotlin/jvm/functions/Function2;->invoke(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
move-result-object p1
|
|
|
|
check-cast p1, Lkotlin/Unit;
|
|
|
|
:cond_0
|
|
return v2
|
|
|
|
:cond_1
|
|
sget-object p6, Lcom/discord/widgets/chat/MessageManager$ContentValidationResult$EmptyContent;->INSTANCE:Lcom/discord/widgets/chat/MessageManager$ContentValidationResult$EmptyContent;
|
|
|
|
invoke-static {v0, p6}, Lk0/n/c/i;->areEqual(Ljava/lang/Object;Ljava/lang/Object;)Z
|
|
|
|
move-result p6
|
|
|
|
if-eqz p6, :cond_2
|
|
|
|
return v2
|
|
|
|
:cond_2
|
|
sget-object p6, Lcom/discord/widgets/chat/MessageManager$ContentValidationResult$Success;->INSTANCE:Lcom/discord/widgets/chat/MessageManager$ContentValidationResult$Success;
|
|
|
|
invoke-static {v0, p6}, Lk0/n/c/i;->areEqual(Ljava/lang/Object;Ljava/lang/Object;)Z
|
|
|
|
iget-object v1, p0, Lcom/discord/widgets/chat/MessageManager;->storeMessages:Lcom/discord/stores/StoreMessages;
|
|
|
|
move-wide v2, p1
|
|
|
|
move-wide v4, p3
|
|
|
|
move-object v6, p5
|
|
|
|
invoke-virtual/range {v1 .. v6}, Lcom/discord/stores/StoreMessages;->editMessage(JJLjava/lang/String;)V
|
|
|
|
const/4 p1, 0x1
|
|
|
|
return p1
|
|
.end method
|
|
|
|
.method public final sendMessage(Ljava/lang/String;Ljava/util/List;Lcom/discord/widgets/chat/MessageManager$AttachmentsRequest;Ljava/lang/Long;Ljava/util/List;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;)Z
|
|
.locals 22
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Ljava/lang/String;",
|
|
"Ljava/util/List<",
|
|
"+",
|
|
"Lcom/discord/models/domain/ModelUser;",
|
|
">;",
|
|
"Lcom/discord/widgets/chat/MessageManager$AttachmentsRequest;",
|
|
"Ljava/lang/Long;",
|
|
"Ljava/util/List<",
|
|
"Lcom/discord/models/dsti/dto/ModelDsti;",
|
|
">;",
|
|
"Lkotlin/jvm/functions/Function2<",
|
|
"-",
|
|
"Ljava/lang/Integer;",
|
|
"-",
|
|
"Ljava/lang/Integer;",
|
|
"Lkotlin/Unit;",
|
|
">;",
|
|
"Lkotlin/jvm/functions/Function2<",
|
|
"-",
|
|
"Ljava/lang/Integer;",
|
|
"-",
|
|
"Ljava/lang/Boolean;",
|
|
"Lkotlin/Unit;",
|
|
">;",
|
|
"Lkotlin/jvm/functions/Function1<",
|
|
"-",
|
|
"Lcom/discord/widgets/chat/MessageManager$MessageSendResult;",
|
|
"Lkotlin/Unit;",
|
|
">;)Z"
|
|
}
|
|
.end annotation
|
|
|
|
move-object/from16 v9, p0
|
|
|
|
move-object/from16 v5, p1
|
|
|
|
move-object/from16 v0, p3
|
|
|
|
move-object/from16 v1, p4
|
|
|
|
move-object/from16 v8, p5
|
|
|
|
move-object/from16 v2, p6
|
|
|
|
move-object/from16 v3, p7
|
|
|
|
move-object/from16 v10, p8
|
|
|
|
const-string v4, "content"
|
|
|
|
invoke-static {v5, v4}, Lk0/n/c/i;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
const-string v4, "stickers"
|
|
|
|
invoke-static {v8, v4}, Lk0/n/c/i;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
const-string v4, "messageSendResultHandler"
|
|
|
|
invoke-static {v10, v4}, Lk0/n/c/i;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
iget-object v4, v9, Lcom/discord/widgets/chat/MessageManager;->storeUser:Lcom/discord/stores/StoreUser;
|
|
|
|
invoke-virtual {v4}, Lcom/discord/stores/StoreUser;->getMe()Lcom/discord/models/domain/ModelUser$Me;
|
|
|
|
move-result-object v4
|
|
|
|
const/4 v11, 0x0
|
|
|
|
if-nez v4, :cond_0
|
|
|
|
iget-object v0, v9, Lcom/discord/widgets/chat/MessageManager;->logger:Lcom/discord/utilities/logging/Logger;
|
|
|
|
const/4 v1, 0x0
|
|
|
|
const/4 v2, 0x0
|
|
|
|
const/4 v3, 0x6
|
|
|
|
const/4 v4, 0x0
|
|
|
|
const-string v5, "failed to send message because me was null"
|
|
|
|
move-object/from16 p1, v0
|
|
|
|
move-object/from16 p2, v5
|
|
|
|
move-object/from16 p3, v1
|
|
|
|
move-object/from16 p4, v2
|
|
|
|
move/from16 p5, v3
|
|
|
|
move-object/from16 p6, v4
|
|
|
|
invoke-static/range {p1 .. p6}, Lcom/discord/utilities/logging/Logger;->e$default(Lcom/discord/utilities/logging/Logger;Ljava/lang/String;Ljava/lang/Throwable;Ljava/util/Map;ILjava/lang/Object;)V
|
|
|
|
return v11
|
|
|
|
:cond_0
|
|
invoke-direct {v9, v5, v8}, Lcom/discord/widgets/chat/MessageManager;->validateMessageContent(Ljava/lang/String;Ljava/util/List;)Lcom/discord/widgets/chat/MessageManager$ContentValidationResult;
|
|
|
|
move-result-object v6
|
|
|
|
sget-object v7, Lcom/discord/widgets/chat/MessageManager$ContentValidationResult$MessageTooLong;->INSTANCE:Lcom/discord/widgets/chat/MessageManager$ContentValidationResult$MessageTooLong;
|
|
|
|
invoke-static {v6, v7}, Lk0/n/c/i;->areEqual(Ljava/lang/Object;Ljava/lang/Object;)Z
|
|
|
|
move-result v7
|
|
|
|
if-eqz v7, :cond_1
|
|
|
|
if-eqz v2, :cond_1
|
|
|
|
invoke-virtual/range {p1 .. p1}, Ljava/lang/String;->length()I
|
|
|
|
move-result v7
|
|
|
|
invoke-static {v7}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
|
|
|
|
move-result-object v7
|
|
|
|
const/16 v12, 0x7d0
|
|
|
|
invoke-static {v12}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
|
|
|
|
move-result-object v12
|
|
|
|
invoke-interface {v2, v7, v12}, Lkotlin/jvm/functions/Function2;->invoke(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
move-result-object v2
|
|
|
|
check-cast v2, Lkotlin/Unit;
|
|
|
|
:cond_1
|
|
invoke-direct {v9, v0}, Lcom/discord/widgets/chat/MessageManager;->validateAttachments(Lcom/discord/widgets/chat/MessageManager$AttachmentsRequest;)Lcom/discord/widgets/chat/MessageManager$AttachmentValidationResult;
|
|
|
|
move-result-object v2
|
|
|
|
instance-of v7, v2, Lcom/discord/widgets/chat/MessageManager$AttachmentValidationResult$FilesTooLarge;
|
|
|
|
if-eqz v7, :cond_2
|
|
|
|
move-object v7, v2
|
|
|
|
check-cast v7, Lcom/discord/widgets/chat/MessageManager$AttachmentValidationResult$FilesTooLarge;
|
|
|
|
invoke-virtual {v7}, Lcom/discord/widgets/chat/MessageManager$AttachmentValidationResult$FilesTooLarge;->getAttachmentsRequest()Lcom/discord/widgets/chat/MessageManager$AttachmentsRequest;
|
|
|
|
move-result-object v7
|
|
|
|
if-eqz v3, :cond_2
|
|
|
|
invoke-virtual {v7}, Lcom/discord/widgets/chat/MessageManager$AttachmentsRequest;->getMaxFileSizeMB()I
|
|
|
|
move-result v7
|
|
|
|
invoke-static {v7}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
|
|
|
|
move-result-object v7
|
|
|
|
invoke-virtual {v4}, Lcom/discord/models/domain/ModelUser$Me;->isPremium()Z
|
|
|
|
move-result v12
|
|
|
|
invoke-static {v12}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;
|
|
|
|
move-result-object v12
|
|
|
|
invoke-interface {v3, v7, v12}, Lkotlin/jvm/functions/Function2;->invoke(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
move-result-object v3
|
|
|
|
check-cast v3, Lkotlin/Unit;
|
|
|
|
:cond_2
|
|
sget-object v3, Lcom/discord/widgets/chat/MessageManager$ContentValidationResult$Success;->INSTANCE:Lcom/discord/widgets/chat/MessageManager$ContentValidationResult$Success;
|
|
|
|
invoke-static {v6, v3}, Lk0/n/c/i;->areEqual(Ljava/lang/Object;Ljava/lang/Object;)Z
|
|
|
|
move-result v3
|
|
|
|
const/4 v12, 0x1
|
|
|
|
xor-int/2addr v3, v12
|
|
|
|
if-eqz v3, :cond_3
|
|
|
|
sget-object v3, Lcom/discord/widgets/chat/MessageManager$AttachmentValidationResult$Success;->INSTANCE:Lcom/discord/widgets/chat/MessageManager$AttachmentValidationResult$Success;
|
|
|
|
invoke-static {v2, v3}, Lk0/n/c/i;->areEqual(Ljava/lang/Object;Ljava/lang/Object;)Z
|
|
|
|
move-result v2
|
|
|
|
xor-int/2addr v2, v12
|
|
|
|
if-eqz v2, :cond_3
|
|
|
|
return v11
|
|
|
|
:cond_3
|
|
if-eqz v0, :cond_4
|
|
|
|
invoke-virtual/range {p3 .. p3}, Lcom/discord/widgets/chat/MessageManager$AttachmentsRequest;->getAttachments()Ljava/util/List;
|
|
|
|
move-result-object v0
|
|
|
|
move-object v7, v0
|
|
|
|
goto :goto_0
|
|
|
|
:cond_4
|
|
const/4 v7, 0x0
|
|
|
|
:goto_0
|
|
if-eqz v1, :cond_5
|
|
|
|
invoke-virtual/range {p4 .. p4}, Ljava/lang/Long;->longValue()J
|
|
|
|
move-result-wide v2
|
|
|
|
goto :goto_1
|
|
|
|
:cond_5
|
|
iget-object v0, v9, Lcom/discord/widgets/chat/MessageManager;->storeChannelsSelected:Lcom/discord/stores/StoreChannelsSelected;
|
|
|
|
invoke-virtual {v0}, Lcom/discord/stores/StoreChannelsSelected;->getId()J
|
|
|
|
move-result-wide v2
|
|
|
|
:goto_1
|
|
move-wide v14, v2
|
|
|
|
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
|
|
|
|
const/16 v2, 0x19
|
|
|
|
if-lt v0, v2, :cond_7
|
|
|
|
iget-object v0, v9, Lcom/discord/widgets/chat/MessageManager;->context:Landroid/content/Context;
|
|
|
|
invoke-static {v0}, Landroidx/core/content/pm/ShortcutManagerCompat;->getDynamicShortcuts(Landroid/content/Context;)Ljava/util/List;
|
|
|
|
move-result-object v0
|
|
|
|
const-string v2, "ShortcutManagerCompat.getDynamicShortcuts(context)"
|
|
|
|
invoke-static {v0, v2}, Lk0/n/c/i;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
new-instance v2, Ljava/util/ArrayList;
|
|
|
|
const/16 v3, 0xa
|
|
|
|
invoke-static {v0, v3}, Lf/h/a/f/e/n/f;->collectionSizeOrDefault(Ljava/lang/Iterable;I)I
|
|
|
|
move-result v3
|
|
|
|
invoke-direct {v2, v3}, Ljava/util/ArrayList;-><init>(I)V
|
|
|
|
invoke-interface {v0}, Ljava/lang/Iterable;->iterator()Ljava/util/Iterator;
|
|
|
|
move-result-object v0
|
|
|
|
:goto_2
|
|
invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z
|
|
|
|
move-result v3
|
|
|
|
if-eqz v3, :cond_6
|
|
|
|
invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;
|
|
|
|
move-result-object v3
|
|
|
|
check-cast v3, Landroidx/core/content/pm/ShortcutInfoCompat;
|
|
|
|
const-string v6, "it"
|
|
|
|
invoke-static {v3, v6}, Lk0/n/c/i;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
invoke-virtual {v3}, Landroidx/core/content/pm/ShortcutInfoCompat;->getId()Ljava/lang/String;
|
|
|
|
move-result-object v3
|
|
|
|
invoke-interface {v2, v3}, Ljava/util/Collection;->add(Ljava/lang/Object;)Z
|
|
|
|
goto :goto_2
|
|
|
|
:cond_6
|
|
invoke-static {v2}, Lk0/i/f;->toSet(Ljava/lang/Iterable;)Ljava/util/Set;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-static {v14, v15}, Ljava/lang/String;->valueOf(J)Ljava/lang/String;
|
|
|
|
move-result-object v2
|
|
|
|
invoke-interface {v0, v2}, Ljava/util/Set;->contains(Ljava/lang/Object;)Z
|
|
|
|
move-result v0
|
|
|
|
if-eqz v0, :cond_7
|
|
|
|
iget-object v0, v9, Lcom/discord/widgets/chat/MessageManager;->context:Landroid/content/Context;
|
|
|
|
const-class v2, Landroid/content/pm/ShortcutManager;
|
|
|
|
invoke-virtual {v0, v2}, Landroid/content/Context;->getSystemService(Ljava/lang/Class;)Ljava/lang/Object;
|
|
|
|
move-result-object v0
|
|
|
|
check-cast v0, Landroid/content/pm/ShortcutManager;
|
|
|
|
if-eqz v0, :cond_7
|
|
|
|
invoke-static {v14, v15}, Ljava/lang/String;->valueOf(J)Ljava/lang/String;
|
|
|
|
move-result-object v2
|
|
|
|
invoke-virtual {v0, v2}, Landroid/content/pm/ShortcutManager;->reportShortcutUsed(Ljava/lang/String;)V
|
|
|
|
:cond_7
|
|
iget-object v0, v9, Lcom/discord/widgets/chat/MessageManager;->storeSlowMode:Lcom/discord/stores/StoreSlowMode;
|
|
|
|
invoke-virtual {v0, v1}, Lcom/discord/stores/StoreSlowMode;->getCooldownSecs(Ljava/lang/Long;)Lrx/Observable;
|
|
|
|
move-result-object v6
|
|
|
|
new-instance v2, Lcom/discord/widgets/chat/MessageManager$sendMessage$messageResultObservable$1;
|
|
|
|
move-object v0, v2
|
|
|
|
move-object/from16 v1, p0
|
|
|
|
move-object v11, v2
|
|
|
|
move-wide v2, v14
|
|
|
|
move-object/from16 v5, p1
|
|
|
|
move-object v13, v6
|
|
|
|
move-object/from16 v6, p2
|
|
|
|
move-object/from16 v8, p5
|
|
|
|
invoke-direct/range {v0 .. v8}, Lcom/discord/widgets/chat/MessageManager$sendMessage$messageResultObservable$1;-><init>(Lcom/discord/widgets/chat/MessageManager;JLcom/discord/models/domain/ModelUser$Me;Ljava/lang/String;Ljava/util/List;Ljava/util/List;Ljava/util/List;)V
|
|
|
|
invoke-virtual {v13, v11}, Lrx/Observable;->U(Lt0/k/b;)Lrx/Observable;
|
|
|
|
move-result-object v0
|
|
|
|
iget-object v1, v9, Lcom/discord/widgets/chat/MessageManager;->storeGuilds:Lcom/discord/stores/StoreGuilds;
|
|
|
|
invoke-virtual {v1, v14, v15}, Lcom/discord/stores/StoreGuilds;->observeFromChannelId(J)Lrx/Observable;
|
|
|
|
move-result-object v1
|
|
|
|
sget-object v2, Lcom/discord/widgets/chat/MessageManager$sendMessage$1;->INSTANCE:Lcom/discord/widgets/chat/MessageManager$sendMessage$1;
|
|
|
|
invoke-static {v0, v1, v2}, Lrx/Observable;->j(Lrx/Observable;Lrx/Observable;Lrx/functions/Func2;)Lrx/Observable;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {v0, v12}, Lrx/Observable;->V(I)Lrx/Observable;
|
|
|
|
move-result-object v0
|
|
|
|
const-string v1, "Observable.combineLatest\u2026d)\n }\n .take(1)"
|
|
|
|
invoke-static {v0, v1}, Lk0/n/c/i;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
const/4 v1, 0x0
|
|
|
|
const/4 v2, 0x0
|
|
|
|
invoke-static {v0, v2, v12, v1}, Lcom/discord/utilities/rx/ObservableExtensionsKt;->restSubscribeOn$default(Lrx/Observable;ZILjava/lang/Object;)Lrx/Observable;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-static {v0}, Lcom/discord/utilities/rx/ObservableExtensionsKt;->ui(Lrx/Observable;)Lrx/Observable;
|
|
|
|
move-result-object v13
|
|
|
|
const-class v14, Lcom/discord/widgets/chat/MessageManager;
|
|
|
|
const/4 v15, 0x0
|
|
|
|
const/16 v16, 0x0
|
|
|
|
const/16 v17, 0x0
|
|
|
|
const/16 v18, 0x0
|
|
|
|
new-instance v0, Lcom/discord/widgets/chat/MessageManager$sendMessage$2;
|
|
|
|
invoke-direct {v0, v10}, Lcom/discord/widgets/chat/MessageManager$sendMessage$2;-><init>(Lkotlin/jvm/functions/Function1;)V
|
|
|
|
const/16 v20, 0x1e
|
|
|
|
const/16 v21, 0x0
|
|
|
|
move-object/from16 v19, v0
|
|
|
|
invoke-static/range {v13 .. v21}, Lcom/discord/utilities/rx/ObservableExtensionsKt;->appSubscribe$default(Lrx/Observable;Ljava/lang/Class;Landroid/content/Context;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)V
|
|
|
|
return v12
|
|
.end method
|