discord-jadx/app/src/main/java/com/discord/widgets/chat/input/WidgetChatInput$configureSe...

73 lines
4.0 KiB
Java

package com.discord.widgets.chat.input;
import android.content.Context;
import c.d.b.a.a;
import com.discord.models.commands.ApplicationCommand;
import com.discord.widgets.chat.MessageContent;
import com.discord.widgets.chat.MessageManager;
import com.discord.widgets.chat.input.models.ApplicationCommandData;
import com.discord.widgets.chat.input.models.ApplicationCommandValue;
import com.lytefast.flexinput.model.Attachment;
import d0.t.g0;
import d0.z.d.m;
import d0.z.d.o;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import kotlin.Unit;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.functions.Function3;
/* compiled from: WidgetChatInput.kt */
public final class WidgetChatInput$configureSendListeners$2 extends o implements Function3<List<? extends Attachment<?>>, ApplicationCommandData, Function1<? super Boolean, ? extends Unit>, Unit> {
public final /* synthetic */ WidgetChatInputEditText $chatInput;
public final /* synthetic */ Context $context;
public final /* synthetic */ MessageManager $messageManager;
public final /* synthetic */ WidgetChatInput this$0;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public WidgetChatInput$configureSendListeners$2(WidgetChatInput widgetChatInput, WidgetChatInputEditText widgetChatInputEditText, Context context, MessageManager messageManager) {
super(3);
this.this$0 = widgetChatInput;
this.$chatInput = widgetChatInputEditText;
this.$context = context;
this.$messageManager = messageManager;
}
/* Return type fixed from 'java.lang.Object' to match base method */
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object, java.lang.Object, java.lang.Object] */
@Override // kotlin.jvm.functions.Function3
public /* bridge */ /* synthetic */ Unit invoke(List<? extends Attachment<?>> list, ApplicationCommandData applicationCommandData, Function1<? super Boolean, ? extends Unit> function1) {
invoke(list, applicationCommandData, (Function1<? super Boolean, Unit>) function1);
return Unit.a;
}
public final void invoke(List<? extends Attachment<?>> list, ApplicationCommandData applicationCommandData, Function1<? super Boolean, Unit> function1) {
MessageContent messageContent;
ApplicationCommand applicationCommand;
String str;
m.checkNotNullParameter(list, "attachmentsRaw");
m.checkNotNullParameter(function1, "onValidationResult");
MessageContent matchedContentWithMetaData = this.$chatInput.getMatchedContentWithMetaData();
if (applicationCommandData == null || (applicationCommand = applicationCommandData.getApplicationCommand()) == null || !applicationCommand.getBuiltIn()) {
messageContent = matchedContentWithMetaData;
} else {
ApplicationCommand applicationCommand2 = applicationCommandData.getApplicationCommand();
List<ApplicationCommandValue> values = applicationCommandData.getValues();
LinkedHashMap linkedHashMap = new LinkedHashMap(a.I(values, 10, 16));
for (Object obj : values) {
linkedHashMap.put(((ApplicationCommandValue) obj).getName(), obj);
}
LinkedHashMap linkedHashMap2 = new LinkedHashMap(g0.mapCapacity(linkedHashMap.size()));
for (Map.Entry entry : linkedHashMap.entrySet()) {
linkedHashMap2.put(entry.getKey(), ((ApplicationCommandValue) entry.getValue()).getValue());
}
Function1<Map<String, ? extends Object>, String> execute = applicationCommand2.getExecute();
if (execute == null || (str = execute.invoke(linkedHashMap2)) == null) {
str = "";
}
messageContent = new MessageContent(str, matchedContentWithMetaData.getMentionedUsers());
}
ChatInputViewModel.sendMessage$default(WidgetChatInput.access$getViewModel$p(this.this$0), this.$context, this.$messageManager, messageContent, list, false, function1, 16, null);
}
}