discord-jadx/app/src/main/java/com/discord/stores/StoreApplicationInteraction...

183 lines
9.5 KiB
Java

package com.discord.stores;
import android.content.Context;
import com.discord.restapi.RestAPIParams;
import com.discord.stores.StoreApplicationInteractions;
import com.discord.utilities.error.Error;
import com.discord.utilities.rx.ObservableExtensionsKt;
import d0.z.d.m;
import d0.z.d.o;
import java.util.Collection;
import java.util.Iterator;
import kotlin.Unit;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
/* compiled from: StoreApplicationInteractions.kt */
public final class StoreApplicationInteractions$sendComponentInteraction$1 extends o implements Function0<Unit> {
public final /* synthetic */ long $applicationId;
public final /* synthetic */ long $channelId;
public final /* synthetic */ int $componentIndex;
public final /* synthetic */ RestAPIParams.ComponentInteractionData $data;
public final /* synthetic */ Long $guildId;
public final /* synthetic */ Long $messageFlags;
public final /* synthetic */ long $messageId;
public final /* synthetic */ String $nonce;
public final /* synthetic */ StoreApplicationInteractions this$0;
/* compiled from: StoreApplicationInteractions.kt */
/* renamed from: com.discord.stores.StoreApplicationInteractions$sendComponentInteraction$1$3 reason: invalid class name */
public static final class AnonymousClass3 extends o implements Function1<Void, Unit> {
public static final AnonymousClass3 INSTANCE = new AnonymousClass3();
public AnonymousClass3() {
super(1);
}
/* 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(Void r1) {
invoke(r1);
return Unit.a;
}
public final void invoke(Void r1) {
}
}
/* compiled from: StoreApplicationInteractions.kt */
/* renamed from: com.discord.stores.StoreApplicationInteractions$sendComponentInteraction$1$4 reason: invalid class name */
public static final class AnonymousClass4 extends o implements Function1<Error, Unit> {
public final /* synthetic */ StoreApplicationInteractions$sendComponentInteraction$1 this$0;
/* compiled from: StoreApplicationInteractions.kt */
/* renamed from: com.discord.stores.StoreApplicationInteractions$sendComponentInteraction$1$4$1 reason: invalid class name */
public static final class AnonymousClass1 extends o implements Function0<Unit> {
public final /* synthetic */ Error $it;
public final /* synthetic */ AnonymousClass4 this$0;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public AnonymousClass1(AnonymousClass4 r1, Error error) {
super(0);
this.this$0 = r1;
this.$it = error;
}
@Override // kotlin.jvm.functions.Function0
/* renamed from: invoke */
public final void mo1invoke() {
StoreLocalActionComponentState access$getStoreLocalActionComponentState$p = StoreApplicationInteractions.access$getStoreLocalActionComponentState$p(this.this$0.this$0.this$0);
StoreApplicationInteractions$sendComponentInteraction$1 storeApplicationInteractions$sendComponentInteraction$1 = this.this$0.this$0;
access$getStoreLocalActionComponentState$p.clearState(storeApplicationInteractions$sendComponentInteraction$1.$messageId, Integer.valueOf(storeApplicationInteractions$sendComponentInteraction$1.$componentIndex));
StoreApplicationInteractions$sendComponentInteraction$1 storeApplicationInteractions$sendComponentInteraction$12 = this.this$0.this$0;
StoreApplicationInteractions storeApplicationInteractions = storeApplicationInteractions$sendComponentInteraction$12.this$0;
long j = storeApplicationInteractions$sendComponentInteraction$12.$messageId;
int i = storeApplicationInteractions$sendComponentInteraction$12.$componentIndex;
Error.Response response = this.$it.getResponse();
m.checkNotNullExpressionValue(response, "it.response");
StoreApplicationInteractions.access$addInteractionStateToComponent(storeApplicationInteractions, j, i, new StoreApplicationInteractions.InteractionSendState.Failed(response.getMessage()));
}
}
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public AnonymousClass4(StoreApplicationInteractions$sendComponentInteraction$1 storeApplicationInteractions$sendComponentInteraction$1) {
super(1);
this.this$0 = storeApplicationInteractions$sendComponentInteraction$1;
}
/* 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(Error error) {
invoke(error);
return Unit.a;
}
public final void invoke(Error error) {
m.checkNotNullParameter(error, "it");
StoreApplicationInteractions.access$getDispatcher$p(this.this$0.this$0).schedule(new AnonymousClass1(this, error));
}
}
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public StoreApplicationInteractions$sendComponentInteraction$1(StoreApplicationInteractions storeApplicationInteractions, long j, int i, String str, long j2, Long l, long j3, Long l2, RestAPIParams.ComponentInteractionData componentInteractionData) {
super(0);
this.this$0 = storeApplicationInteractions;
this.$messageId = j;
this.$componentIndex = i;
this.$nonce = str;
this.$applicationId = j2;
this.$guildId = l;
this.$channelId = j3;
this.$messageFlags = l2;
this.$data = componentInteractionData;
}
/* JADX WARNING: Removed duplicated region for block: B:15:0x003b */
/* JADX WARNING: Removed duplicated region for block: B:33:0x008d */
@Override // kotlin.jvm.functions.Function0
/* renamed from: invoke */
public final void mo1invoke() {
boolean z2;
boolean z3;
boolean z4;
boolean z5;
Collection<StoreApplicationInteractions.ComponentLocation> values = this.this$0.getComponentInteractions().values();
if (!(values instanceof Collection) || !values.isEmpty()) {
Iterator<T> it = values.iterator();
while (true) {
if (!it.hasNext()) {
break;
}
if (((StoreApplicationInteractions.ComponentLocation) it.next()).getMessageId() == this.$messageId) {
z5 = true;
continue;
} else {
z5 = false;
continue;
}
if (z5) {
z2 = true;
break;
}
}
if (!z2) {
Collection<StoreApplicationInteractions.ComponentLocation> values2 = this.this$0.getComponentInteractions().values();
if (!(values2 instanceof Collection) || !values2.isEmpty()) {
Iterator<T> it2 = values2.iterator();
while (true) {
if (!it2.hasNext()) {
break;
}
StoreApplicationInteractions.ComponentLocation componentLocation = (StoreApplicationInteractions.ComponentLocation) it2.next();
if (componentLocation.getMessageId() != this.$messageId || componentLocation.getComponentIndex() == this.$componentIndex) {
z4 = false;
continue;
} else {
z4 = true;
continue;
}
if (!z4) {
z3 = false;
break;
}
}
}
z3 = true;
if (z3) {
StoreApplicationInteractions.access$getStoreLocalActionComponentState$p(this.this$0).clearState(this.$messageId, Integer.valueOf(this.$componentIndex));
return;
}
return;
}
this.this$0.getComponentInteractions().put(this.$nonce, new StoreApplicationInteractions.ComponentLocation(this.$messageId, this.$componentIndex));
StoreApplicationInteractions.access$addInteractionStateToComponent(this.this$0, this.$messageId, this.$componentIndex, StoreApplicationInteractions.InteractionSendState.Loading.INSTANCE);
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.restSubscribeOn$default(StoreApplicationInteractions.access$getRestAPI$p(this.this$0).sendComponentInteraction(new RestAPIParams.ComponentInteraction(3, this.$channelId, this.$applicationId, this.$guildId, this.$messageId, this.$messageFlags, this.$data, this.$nonce)), false, 1, null), this.this$0.getClass(), (Context) null, (Function1) null, new AnonymousClass4(this), (Function0) null, (Function0) null, AnonymousClass3.INSTANCE, 54, (Object) null);
return;
}
z2 = false;
if (!z2) {
}
}
}