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

70 lines
3.7 KiB
Java

package com.discord.widgets.chat.input;
import com.discord.R;
import com.discord.widgets.chat.input.ChatInputViewModel;
import com.lytefast.flexinput.FlexInputListener;
import com.lytefast.flexinput.model.Attachment;
import d0.z.d.m;
import d0.z.d.o;
import java.util.List;
import kotlin.Unit;
import kotlin.jvm.functions.Function1;
/* compiled from: WidgetChatInput.kt */
public final class WidgetChatInput$configureSendListeners$6 implements FlexInputListener {
public final /* synthetic */ WidgetChatInput$configureSendListeners$4 $sendMessageError$4;
public final /* synthetic */ WidgetChatInput$configureSendListeners$3 $trySend$3;
public final /* synthetic */ ChatInputViewModel.ViewState.Loaded $viewState;
public final /* synthetic */ WidgetChatInput this$0;
/* compiled from: WidgetChatInput.kt */
/* renamed from: com.discord.widgets.chat.input.WidgetChatInput$configureSendListeners$6$1 reason: invalid class name */
public static final class AnonymousClass1 extends o implements Function1<Boolean, Unit> {
public final /* synthetic */ Function1 $onSendResult;
public final /* synthetic */ WidgetChatInput$configureSendListeners$6 this$0;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public AnonymousClass1(WidgetChatInput$configureSendListeners$6 widgetChatInput$configureSendListeners$6, Function1 function1) {
super(1);
this.this$0 = widgetChatInput$configureSendListeners$6;
this.$onSendResult = function1;
}
/* 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] */
@Override // kotlin.jvm.functions.Function1
public /* bridge */ /* synthetic */ Unit invoke(Boolean bool) {
invoke(bool.booleanValue());
return Unit.a;
}
public final void invoke(boolean z2) {
if (z2) {
WidgetChatInput.clearInput$default(this.this$0.this$0, null, false, 3, null);
}
this.$onSendResult.invoke(Boolean.valueOf(z2));
}
}
public WidgetChatInput$configureSendListeners$6(WidgetChatInput widgetChatInput, ChatInputViewModel.ViewState.Loaded loaded, WidgetChatInput$configureSendListeners$4 widgetChatInput$configureSendListeners$4, WidgetChatInput$configureSendListeners$3 widgetChatInput$configureSendListeners$3) {
this.this$0 = widgetChatInput;
this.$viewState = loaded;
this.$sendMessageError$4 = widgetChatInput$configureSendListeners$4;
this.$trySend$3 = widgetChatInput$configureSendListeners$3;
}
@Override // com.lytefast.flexinput.FlexInputListener
public final void onSend(String str, List<? extends Attachment<?>> list, Function1<? super Boolean, Unit> function1) {
m.checkNotNullParameter(list, "list");
m.checkNotNullParameter(function1, "onSendResult");
if (this.$viewState.isOnCooldown() && !this.$viewState.isEditing() && this.$viewState.getSelectedThreadDraft() == null) {
function1.invoke(Boolean.valueOf(this.$sendMessageError$4.invoke(R.string.channel_slowmode_desc_short)));
} else if (this.$viewState.isEditing() && (!list.isEmpty())) {
function1.invoke(Boolean.valueOf(this.$sendMessageError$4.invoke(R.string.editing_with_attachment_error)));
} else if (this.$viewState.getAbleToSendMessage()) {
this.$trySend$3.invoke(list, (Function1<? super Boolean, Unit>) new AnonymousClass1(this, function1));
} else {
function1.invoke(Boolean.valueOf(this.$sendMessageError$4.invoke(R.string.no_send_messages_permission_placeholder)));
}
}
}