package com.discord.widgets.chat.input; import android.content.Context; import com.discord.models.guild.Guild; import com.discord.models.user.MeUser; import com.discord.utilities.messagesend.MessageResult; import com.discord.utilities.premium.PremiumUtils; import com.discord.utilities.rest.SendUtils; import com.discord.utilities.user.UserUtils; import com.discord.widgets.chat.input.ChatInputViewModel; import d0.z.d.m; import d0.z.d.o; import java.util.ArrayList; import kotlin.Unit; import kotlin.jvm.functions.Function0; import kotlin.jvm.functions.Function2; import rx.subjects.PublishSubject; /* compiled from: ChatInputViewModel.kt */ public final class ChatInputViewModel$sendMessage$messageSendResultHandler$1 extends o implements Function2 { public final /* synthetic */ ArrayList $attachments; public final /* synthetic */ Context $context; public final /* synthetic */ boolean $hasGif; public final /* synthetic */ boolean $hasImage; public final /* synthetic */ boolean $hasVideo; public final /* synthetic */ boolean $isThreadDraft; public final /* synthetic */ ChatInputViewModel.ViewState.Loaded $loadedViewState; public final /* synthetic */ Function0 $messageResendCompressedHandler; public final /* synthetic */ ChatInputViewModel this$0; /* compiled from: ChatInputViewModel.kt */ /* renamed from: com.discord.widgets.chat.input.ChatInputViewModel$sendMessage$messageSendResultHandler$1$1 reason: invalid class name */ public static final class AnonymousClass1 extends o implements Function0 { public final /* synthetic */ Guild $guild; public final /* synthetic */ ChatInputViewModel$sendMessage$messageSendResultHandler$1 this$0; /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public AnonymousClass1(ChatInputViewModel$sendMessage$messageSendResultHandler$1 chatInputViewModel$sendMessage$messageSendResultHandler$1, Guild guild) { super(0); this.this$0 = chatInputViewModel$sendMessage$messageSendResultHandler$1; this.$guild = guild; } @Override // kotlin.jvm.functions.Function0 /* renamed from: invoke */ public final void mo1invoke() { PremiumUtils premiumUtils = PremiumUtils.INSTANCE; Guild guild = this.$guild; int max = Math.max(premiumUtils.getGuildMaxFileSizeMB(guild != null ? guild.getPremiumTier() : 0), premiumUtils.getMaxFileSizeMB(this.this$0.$loadedViewState.getMe())); PublishSubject access$getEventSubject$p = ChatInputViewModel.access$getEventSubject$p(this.this$0.this$0); MeUser me2 = this.this$0.$loadedViewState.getMe(); boolean isPremium = me2 != null ? UserUtils.INSTANCE.isPremium(me2) : false; ChatInputViewModel$sendMessage$messageSendResultHandler$1 chatInputViewModel$sendMessage$messageSendResultHandler$1 = this.this$0; access$getEventSubject$p.j.onNext(new ChatInputViewModel.Event.FilesTooLarge(max, Float.MAX_VALUE, Float.MAX_VALUE, isPremium, chatInputViewModel$sendMessage$messageSendResultHandler$1.$attachments, chatInputViewModel$sendMessage$messageSendResultHandler$1.$hasImage, chatInputViewModel$sendMessage$messageSendResultHandler$1.$hasVideo, chatInputViewModel$sendMessage$messageSendResultHandler$1.$hasGif, chatInputViewModel$sendMessage$messageSendResultHandler$1.$messageResendCompressedHandler)); } } /* compiled from: ChatInputViewModel.kt */ /* renamed from: com.discord.widgets.chat.input.ChatInputViewModel$sendMessage$messageSendResultHandler$1$2 reason: invalid class name */ public static final class AnonymousClass2 extends o implements Function0 { public final /* synthetic */ ChatInputViewModel$sendMessage$messageSendResultHandler$1 this$0; /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public AnonymousClass2(ChatInputViewModel$sendMessage$messageSendResultHandler$1 chatInputViewModel$sendMessage$messageSendResultHandler$1) { super(0); this.this$0 = chatInputViewModel$sendMessage$messageSendResultHandler$1; } @Override // kotlin.jvm.functions.Function0 /* renamed from: invoke */ public final void mo1invoke() { PublishSubject access$getEventSubject$p = ChatInputViewModel.access$getEventSubject$p(this.this$0.this$0); access$getEventSubject$p.j.onNext(ChatInputViewModel.Event.FailedDeliveryToRecipient.INSTANCE); } } /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public ChatInputViewModel$sendMessage$messageSendResultHandler$1(ChatInputViewModel chatInputViewModel, Context context, ChatInputViewModel.ViewState.Loaded loaded, ArrayList arrayList, boolean z2, boolean z3, boolean z4, Function0 function0, boolean z5) { super(2); this.this$0 = chatInputViewModel; this.$context = context; this.$loadedViewState = loaded; this.$attachments = arrayList; this.$hasImage = z2; this.$hasVideo = z3; this.$hasGif = z4; this.$messageResendCompressedHandler = function0; this.$isThreadDraft = z5; } /* 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] */ @Override // kotlin.jvm.functions.Function2 public /* bridge */ /* synthetic */ Unit invoke(MessageResult messageResult, Guild guild) { invoke(messageResult, guild); return Unit.a; } public final void invoke(MessageResult messageResult, Guild guild) { m.checkNotNullParameter(messageResult, "messageResult"); if (messageResult instanceof MessageResult.UnknownFailure) { SendUtils.INSTANCE.handleSendError(((MessageResult.UnknownFailure) messageResult).getError(), this.$context, new AnonymousClass1(this, guild), new AnonymousClass2(this)); } else if (this.$isThreadDraft) { ChatInputViewModel.access$getStoreThreadDraft$p(this.this$0).clearDraftState(); } } }