apkfuckery/com.discord/smali/com/discord/widgets/chat/input/WidgetChatInputSend$configu...

469 lines
16 KiB
Smali

.class public final Lcom/discord/widgets/chat/input/WidgetChatInputSend$configureSendListeners$1;
.super Lc0/n/c/k;
.source "WidgetChatInputSend.kt"
# interfaces
.implements Lkotlin/jvm/functions/Function1;
# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
value = Lcom/discord/widgets/chat/input/WidgetChatInputSend;->configureSendListeners(Lcom/discord/widgets/chat/input/WidgetChatInputEditText;Lcom/discord/widgets/chat/input/WidgetChatInputAttachments;Landroid/view/View;Landroid/view/View;Lcom/discord/widgets/chat/input/WidgetChatInputModel;Lcom/discord/widgets/chat/input/WidgetChatInputSend$Listener;Lcom/lytefast/flexinput/viewmodel/FlexInputViewModel;)V
.end annotation
.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x19
name = null
.end annotation
.annotation system Ldalvik/annotation/Signature;
value = {
"Lc0/n/c/k;",
"Lkotlin/jvm/functions/Function1<",
"Ljava/util/List<",
"+",
"Lcom/lytefast/flexinput/model/Attachment<",
"*>;>;",
"Ljava/lang/Boolean;",
">;"
}
.end annotation
# instance fields
.field public final synthetic $chatInput:Lcom/discord/widgets/chat/input/WidgetChatInputEditText;
.field public final synthetic $chatInputEdit:Landroid/view/View;
.field public final synthetic $flexInputViewModel:Lcom/lytefast/flexinput/viewmodel/FlexInputViewModel;
.field public final synthetic $messageManager:Lcom/discord/widgets/chat/MessageManager;
.field public final synthetic $model:Lcom/discord/widgets/chat/input/WidgetChatInputModel;
.field public final synthetic $weakListener:Ljava/lang/ref/WeakReference;
# direct methods
.method public constructor <init>(Lcom/discord/widgets/chat/input/WidgetChatInputEditText;Landroid/view/View;Lcom/discord/widgets/chat/input/WidgetChatInputModel;Ljava/lang/ref/WeakReference;Lcom/discord/widgets/chat/MessageManager;Lcom/lytefast/flexinput/viewmodel/FlexInputViewModel;)V
.locals 0
iput-object p1, p0, Lcom/discord/widgets/chat/input/WidgetChatInputSend$configureSendListeners$1;->$chatInput:Lcom/discord/widgets/chat/input/WidgetChatInputEditText;
iput-object p2, p0, Lcom/discord/widgets/chat/input/WidgetChatInputSend$configureSendListeners$1;->$chatInputEdit:Landroid/view/View;
iput-object p3, p0, Lcom/discord/widgets/chat/input/WidgetChatInputSend$configureSendListeners$1;->$model:Lcom/discord/widgets/chat/input/WidgetChatInputModel;
iput-object p4, p0, Lcom/discord/widgets/chat/input/WidgetChatInputSend$configureSendListeners$1;->$weakListener:Ljava/lang/ref/WeakReference;
iput-object p5, p0, Lcom/discord/widgets/chat/input/WidgetChatInputSend$configureSendListeners$1;->$messageManager:Lcom/discord/widgets/chat/MessageManager;
iput-object p6, p0, Lcom/discord/widgets/chat/input/WidgetChatInputSend$configureSendListeners$1;->$flexInputViewModel:Lcom/lytefast/flexinput/viewmodel/FlexInputViewModel;
const/4 p1, 0x1
invoke-direct {p0, p1}, Lc0/n/c/k;-><init>(I)V
return-void
.end method
# virtual methods
.method public bridge synthetic invoke(Ljava/lang/Object;)Ljava/lang/Object;
.locals 0
check-cast p1, Ljava/util/List;
invoke-virtual {p0, p1}, Lcom/discord/widgets/chat/input/WidgetChatInputSend$configureSendListeners$1;->invoke(Ljava/util/List;)Z
move-result p1
invoke-static {p1}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;
move-result-object p1
return-object p1
.end method
.method public final invoke(Ljava/util/List;)Z
.locals 20
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Ljava/util/List<",
"+",
"Lcom/lytefast/flexinput/model/Attachment<",
"*>;>;)Z"
}
.end annotation
move-object/from16 v7, p0
move-object/from16 v4, p1
const-string v0, "attachments"
invoke-static {v4, v0}, Lc0/n/c/j;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
iget-object v0, v7, Lcom/discord/widgets/chat/input/WidgetChatInputSend$configureSendListeners$1;->$chatInput:Lcom/discord/widgets/chat/input/WidgetChatInputEditText;
invoke-virtual {v0}, Lcom/discord/widgets/chat/input/WidgetChatInputEditText;->getMatchedContentWithMetaData()Lcom/discord/models/domain/ModelMessage$Content;
move-result-object v0
invoke-interface/range {p1 .. p1}, Ljava/util/Collection;->isEmpty()Z
move-result v1
const/4 v2, 0x1
const-string v3, "chatInputEdit.context"
if-eqz v1, :cond_1
:cond_0
const/4 v5, 0x0
goto :goto_0
:cond_1
invoke-interface/range {p1 .. p1}, Ljava/lang/Iterable;->iterator()Ljava/util/Iterator;
move-result-object v1
:cond_2
invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z
move-result v5
if-eqz v5, :cond_0
invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v5
check-cast v5, Lcom/lytefast/flexinput/model/Attachment;
iget-object v6, v7, Lcom/discord/widgets/chat/input/WidgetChatInputSend$configureSendListeners$1;->$chatInputEdit:Landroid/view/View;
invoke-virtual {v6}, Landroid/view/View;->getContext()Landroid/content/Context;
move-result-object v6
invoke-static {v6, v3}, Lc0/n/c/j;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V
invoke-virtual {v6}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v6
invoke-static {v5, v6}, Lcom/discord/utilities/attachments/AttachmentUtilsKt;->isImage(Lcom/lytefast/flexinput/model/Attachment;Landroid/content/ContentResolver;)Z
move-result v5
if-eqz v5, :cond_2
const/4 v5, 0x1
:goto_0
invoke-interface/range {p1 .. p1}, Ljava/util/Collection;->isEmpty()Z
move-result v1
if-eqz v1, :cond_4
:cond_3
const/4 v6, 0x0
goto :goto_1
:cond_4
invoke-interface/range {p1 .. p1}, Ljava/lang/Iterable;->iterator()Ljava/util/Iterator;
move-result-object v1
:cond_5
invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z
move-result v6
if-eqz v6, :cond_3
invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v6
check-cast v6, Lcom/lytefast/flexinput/model/Attachment;
iget-object v9, v7, Lcom/discord/widgets/chat/input/WidgetChatInputSend$configureSendListeners$1;->$chatInputEdit:Landroid/view/View;
invoke-virtual {v9}, Landroid/view/View;->getContext()Landroid/content/Context;
move-result-object v9
invoke-static {v9, v3}, Lc0/n/c/j;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V
invoke-virtual {v9}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v9
invoke-static {v6, v9}, Lcom/discord/utilities/attachments/AttachmentUtilsKt;->isVideo(Lcom/lytefast/flexinput/model/Attachment;Landroid/content/ContentResolver;)Z
move-result v6
if-eqz v6, :cond_5
const/4 v6, 0x1
:goto_1
new-instance v1, Ljava/util/ArrayList;
const/16 v2, 0xa
invoke-static {v4, v2}, Lf/h/a/f/e/n/f;->collectionSizeOrDefault(Ljava/lang/Iterable;I)I
move-result v2
invoke-direct {v1, v2}, Ljava/util/ArrayList;-><init>(I)V
invoke-interface/range {p1 .. p1}, Ljava/lang/Iterable;->iterator()Ljava/util/Iterator;
move-result-object v2
:goto_2
invoke-interface {v2}, Ljava/util/Iterator;->hasNext()Z
move-result v9
if-eqz v9, :cond_6
invoke-interface {v2}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v9
check-cast v9, Lcom/lytefast/flexinput/model/Attachment;
invoke-virtual {v9}, Lcom/lytefast/flexinput/model/Attachment;->getUri()Landroid/net/Uri;
move-result-object v9
iget-object v10, v7, Lcom/discord/widgets/chat/input/WidgetChatInputSend$configureSendListeners$1;->$chatInputEdit:Landroid/view/View;
invoke-virtual {v10}, Landroid/view/View;->getContext()Landroid/content/Context;
move-result-object v10
invoke-static {v10, v3}, Lc0/n/c/j;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V
invoke-virtual {v10}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v10
const-string v11, "chatInputEdit.context.contentResolver"
invoke-static {v10, v11}, Lc0/n/c/j;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V
invoke-static {v9, v10}, Lcom/discord/utilities/rest/SendUtilsKt;->computeFileSizeMegabytes(Landroid/net/Uri;Landroid/content/ContentResolver;)F
move-result v9
invoke-static {v9}, Ljava/lang/Float;->valueOf(F)Ljava/lang/Float;
move-result-object v9
invoke-interface {v1, v9}, Ljava/util/Collection;->add(Ljava/lang/Object;)Z
goto :goto_2
:cond_6
invoke-static {v1}, Lc0/i/f;->sumOfFloat(Ljava/lang/Iterable;)F
move-result v2
invoke-static {v1}, Lc0/i/f;->maxOrNull(Ljava/lang/Iterable;)Ljava/lang/Float;
move-result-object v1
if-eqz v1, :cond_7
invoke-virtual {v1}, Ljava/lang/Float;->floatValue()F
move-result v1
move v3, v1
goto :goto_3
:cond_7
const/4 v1, 0x0
const/4 v3, 0x0
:goto_3
new-instance v1, Lcom/discord/widgets/chat/input/WidgetChatInputSend$configureSendListeners$1$messageSendResultHandler$1;
invoke-direct {v1, v7, v4, v5, v6}, Lcom/discord/widgets/chat/input/WidgetChatInputSend$configureSendListeners$1$messageSendResultHandler$1;-><init>(Lcom/discord/widgets/chat/input/WidgetChatInputSend$configureSendListeners$1;Ljava/util/List;ZZ)V
new-instance v15, Lcom/discord/widgets/chat/input/WidgetChatInputSend$configureSendListeners$1$onMessageTooLong$1;
invoke-direct {v15, v7}, Lcom/discord/widgets/chat/input/WidgetChatInputSend$configureSendListeners$1$onMessageTooLong$1;-><init>(Lcom/discord/widgets/chat/input/WidgetChatInputSend$configureSendListeners$1;)V
iget-object v9, v7, Lcom/discord/widgets/chat/input/WidgetChatInputSend$configureSendListeners$1;->$model:Lcom/discord/widgets/chat/input/WidgetChatInputModel;
invoke-virtual {v9}, Lcom/discord/widgets/chat/input/WidgetChatInputModel;->isEditing()Z
move-result v9
const-string v10, "messageData.content"
const-string v11, "messageData"
if-eqz v9, :cond_8
iget-object v9, v7, Lcom/discord/widgets/chat/input/WidgetChatInputSend$configureSendListeners$1;->$model:Lcom/discord/widgets/chat/input/WidgetChatInputModel;
iget-object v9, v9, Lcom/discord/widgets/chat/input/WidgetChatInputModel;->editingMessage:Lcom/discord/stores/StoreChat$EditingMessage;
if-eqz v9, :cond_8
iget-object v1, v7, Lcom/discord/widgets/chat/input/WidgetChatInputSend$configureSendListeners$1;->$messageManager:Lcom/discord/widgets/chat/MessageManager;
invoke-virtual {v9}, Lcom/discord/stores/StoreChat$EditingMessage;->getMessage()Lcom/discord/models/domain/ModelMessage;
move-result-object v2
invoke-virtual {v2}, Lcom/discord/models/domain/ModelMessage;->getId()J
move-result-wide v2
iget-object v4, v7, Lcom/discord/widgets/chat/input/WidgetChatInputSend$configureSendListeners$1;->$model:Lcom/discord/widgets/chat/input/WidgetChatInputModel;
iget-object v4, v4, Lcom/discord/widgets/chat/input/WidgetChatInputModel;->editingMessage:Lcom/discord/stores/StoreChat$EditingMessage;
invoke-virtual {v4}, Lcom/discord/stores/StoreChat$EditingMessage;->getMessage()Lcom/discord/models/domain/ModelMessage;
move-result-object v4
invoke-virtual {v4}, Lcom/discord/models/domain/ModelMessage;->getChannelId()J
move-result-wide v12
invoke-static {v0, v11}, Lc0/n/c/j;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V
invoke-virtual {v0}, Lcom/discord/models/domain/ModelMessage$Content;->getContent()Ljava/lang/String;
move-result-object v14
invoke-static {v14, v10}, Lc0/n/c/j;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V
move-object v9, v1
move-wide v10, v2
invoke-virtual/range {v9 .. v15}, Lcom/discord/widgets/chat/MessageManager;->editMessage(JJLjava/lang/String;Lkotlin/jvm/functions/Function2;)Z
move-result v0
goto :goto_4
:cond_8
iget-object v9, v7, Lcom/discord/widgets/chat/input/WidgetChatInputSend$configureSendListeners$1;->$messageManager:Lcom/discord/widgets/chat/MessageManager;
invoke-static {v0, v11}, Lc0/n/c/j;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V
invoke-virtual {v0}, Lcom/discord/models/domain/ModelMessage$Content;->getContent()Ljava/lang/String;
move-result-object v11
invoke-static {v11, v10}, Lc0/n/c/j;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V
invoke-virtual {v0}, Lcom/discord/models/domain/ModelMessage$Content;->getMentions()Ljava/util/List;
move-result-object v12
new-instance v13, Lcom/discord/widgets/chat/MessageManager$AttachmentsRequest;
iget-object v0, v7, Lcom/discord/widgets/chat/input/WidgetChatInputSend$configureSendListeners$1;->$model:Lcom/discord/widgets/chat/input/WidgetChatInputModel;
iget v0, v0, Lcom/discord/widgets/chat/input/WidgetChatInputModel;->maxFileSizeMB:I
new-instance v10, Ljava/util/ArrayList;
invoke-direct {v10, v4}, Ljava/util/ArrayList;-><init>(Ljava/util/Collection;)V
invoke-direct {v13, v2, v0, v10}, Lcom/discord/widgets/chat/MessageManager$AttachmentsRequest;-><init>(FILjava/util/List;)V
iget-object v0, v7, Lcom/discord/widgets/chat/input/WidgetChatInputSend$configureSendListeners$1;->$model:Lcom/discord/widgets/chat/input/WidgetChatInputModel;
move-object v10, v9
iget-wide v8, v0, Lcom/discord/widgets/chat/input/WidgetChatInputModel;->channelId:J
invoke-static {v8, v9}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;
move-result-object v8
const/4 v14, 0x0
new-instance v9, Lcom/discord/widgets/chat/input/WidgetChatInputSend$configureSendListeners$1$synchronousValidationSucceeded$1;
invoke-direct {v9, v1}, Lcom/discord/widgets/chat/input/WidgetChatInputSend$configureSendListeners$1$synchronousValidationSucceeded$1;-><init>(Lkotlin/jvm/functions/Function2;)V
new-instance v16, Lcom/discord/widgets/chat/input/WidgetChatInputSend$configureSendListeners$1$synchronousValidationSucceeded$2;
move-object/from16 v0, v16
move-object/from16 v1, p0
move-object/from16 v4, p1
invoke-direct/range {v0 .. v6}, Lcom/discord/widgets/chat/input/WidgetChatInputSend$configureSendListeners$1$synchronousValidationSucceeded$2;-><init>(Lcom/discord/widgets/chat/input/WidgetChatInputSend$configureSendListeners$1;FFLjava/util/List;ZZ)V
const/16 v18, 0x10
const/16 v19, 0x0
move-object v0, v9
move-object v9, v10
move-object v10, v11
move-object v11, v12
move-object v12, v13
move-object v13, v8
move-object/from16 v17, v0
invoke-static/range {v9 .. v19}, Lcom/discord/widgets/chat/MessageManager;->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
move-result v0
:goto_4
if-nez v0, :cond_9
const/4 v0, 0x0
return v0
:cond_9
sget-object v1, Lcom/discord/widgets/chat/input/WidgetChatInputSend;->INSTANCE:Lcom/discord/widgets/chat/input/WidgetChatInputSend;
iget-object v2, v7, Lcom/discord/widgets/chat/input/WidgetChatInputSend$configureSendListeners$1;->$chatInput:Lcom/discord/widgets/chat/input/WidgetChatInputEditText;
iget-object v3, v7, Lcom/discord/widgets/chat/input/WidgetChatInputSend$configureSendListeners$1;->$flexInputViewModel:Lcom/lytefast/flexinput/viewmodel/FlexInputViewModel;
const/4 v4, 0x0
const/4 v5, 0x4
const/4 v6, 0x0
invoke-static/range {v1 .. v6}, Lcom/discord/widgets/chat/input/WidgetChatInputSend;->clearInput$default(Lcom/discord/widgets/chat/input/WidgetChatInputSend;Lcom/discord/widgets/chat/input/WidgetChatInputEditText;Lcom/lytefast/flexinput/viewmodel/FlexInputViewModel;Ljava/lang/Boolean;ILjava/lang/Object;)Z
move-result v0
return v0
.end method