144 lines
7.5 KiB
Java
144 lines
7.5 KiB
Java
package com.discord.stores;
|
|
|
|
import android.content.Context;
|
|
import com.discord.models.commands.ApplicationCommandLocalSendDataKt;
|
|
import com.discord.restapi.RestAPIParams;
|
|
import com.discord.utilities.error.Error;
|
|
import com.discord.utilities.rx.ObservableExtensionsKt;
|
|
import com.discord.widgets.chat.input.models.ApplicationCommandData;
|
|
import com.discord.widgets.chat.input.models.ApplicationCommandValue;
|
|
import d0.t.n;
|
|
import d0.t.r;
|
|
import d0.z.d.m;
|
|
import d0.z.d.o;
|
|
import java.util.ArrayList;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import kotlin.Unit;
|
|
import kotlin.jvm.functions.Function0;
|
|
import kotlin.jvm.functions.Function1;
|
|
/* compiled from: StoreApplicationCommands.kt */
|
|
public final class StoreApplicationCommands$requestApplicationCommandAutocompleteData$1 extends o implements Function0<Unit> {
|
|
public final /* synthetic */ long $channelId;
|
|
public final /* synthetic */ ApplicationCommandData $data;
|
|
public final /* synthetic */ Long $guildId;
|
|
public final /* synthetic */ StoreApplicationCommands this$0;
|
|
|
|
/* compiled from: StoreApplicationCommands.kt */
|
|
/* renamed from: com.discord.stores.StoreApplicationCommands$requestApplicationCommandAutocompleteData$1$1 reason: invalid class name */
|
|
public static final class AnonymousClass1 extends o implements Function1<Error, Unit> {
|
|
public final /* synthetic */ ApplicationCommandValue $option;
|
|
public final /* synthetic */ StoreApplicationCommands$requestApplicationCommandAutocompleteData$1 this$0;
|
|
|
|
/* compiled from: StoreApplicationCommands.kt */
|
|
/* renamed from: com.discord.stores.StoreApplicationCommands$requestApplicationCommandAutocompleteData$1$1$1 reason: invalid class name */
|
|
public static final class AnonymousClass1 extends o implements Function0<Unit> {
|
|
public final /* synthetic */ AnonymousClass1 this$0;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public AnonymousClass1(AnonymousClass1 r1) {
|
|
super(0);
|
|
this.this$0 = r1;
|
|
}
|
|
|
|
@Override // kotlin.jvm.functions.Function0
|
|
/* renamed from: invoke */
|
|
public final void mo1invoke() {
|
|
AnonymousClass1 r0 = this.this$0;
|
|
r0.this$0.this$0.setAutocompleteFailed(r0.$option.getName(), String.valueOf(this.this$0.$option.getValue()));
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public AnonymousClass1(StoreApplicationCommands$requestApplicationCommandAutocompleteData$1 storeApplicationCommands$requestApplicationCommandAutocompleteData$1, ApplicationCommandValue applicationCommandValue) {
|
|
super(1);
|
|
this.this$0 = storeApplicationCommands$requestApplicationCommandAutocompleteData$1;
|
|
this.$option = applicationCommandValue;
|
|
}
|
|
|
|
/* 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");
|
|
StoreApplicationCommands.access$getDispatcher$p(this.this$0.this$0).schedule(new AnonymousClass1(this));
|
|
}
|
|
}
|
|
|
|
/* compiled from: StoreApplicationCommands.kt */
|
|
/* renamed from: com.discord.stores.StoreApplicationCommands$requestApplicationCommandAutocompleteData$1$2 reason: invalid class name */
|
|
public static final class AnonymousClass2 extends o implements Function1<Void, Unit> {
|
|
public static final AnonymousClass2 INSTANCE = new AnonymousClass2();
|
|
|
|
public AnonymousClass2() {
|
|
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) {
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public StoreApplicationCommands$requestApplicationCommandAutocompleteData$1(StoreApplicationCommands storeApplicationCommands, ApplicationCommandData applicationCommandData, long j, Long l) {
|
|
super(0);
|
|
this.this$0 = storeApplicationCommands;
|
|
this.$data = applicationCommandData;
|
|
this.$channelId = j;
|
|
this.$guildId = l;
|
|
}
|
|
|
|
@Override // kotlin.jvm.functions.Function0
|
|
/* renamed from: invoke */
|
|
public final void mo1invoke() {
|
|
Object obj;
|
|
String access$generateNonce = StoreApplicationCommands.access$generateNonce(this.this$0);
|
|
String version = this.$data.getApplicationCommand().getVersion();
|
|
Long guildId = this.$data.getApplicationCommand().getGuildId();
|
|
com.discord.api.commands.ApplicationCommandData applicationCommandData = new com.discord.api.commands.ApplicationCommandData(version, guildId != null ? String.valueOf(guildId.longValue()) : null, this.$data.getApplicationCommand().getId(), this.$data.getApplicationCommand().getName(), ApplicationCommandLocalSendDataKt.toRestParams(this.$data.getValues()));
|
|
String valueOf = String.valueOf(this.$channelId);
|
|
String valueOf2 = String.valueOf(this.$data.getApplication().getId());
|
|
Long l = this.$guildId;
|
|
RestAPIParams.ApplicationCommand applicationCommand = new RestAPIParams.ApplicationCommand(4, valueOf, valueOf2, l != null ? String.valueOf(l.longValue()) : null, applicationCommandData, access$generateNonce);
|
|
List<ApplicationCommandValue> values = this.$data.getValues();
|
|
ArrayList arrayList = new ArrayList();
|
|
for (ApplicationCommandValue applicationCommandValue : values) {
|
|
List mutableListOf = n.mutableListOf(applicationCommandValue);
|
|
List<ApplicationCommandValue> options = applicationCommandValue.getOptions();
|
|
if (options == null) {
|
|
options = n.emptyList();
|
|
}
|
|
mutableListOf.addAll(options);
|
|
r.addAll(arrayList, mutableListOf);
|
|
}
|
|
Iterator it = arrayList.iterator();
|
|
while (true) {
|
|
if (!it.hasNext()) {
|
|
obj = null;
|
|
break;
|
|
}
|
|
obj = it.next();
|
|
if (m.areEqual(((ApplicationCommandValue) obj).getFocused(), Boolean.TRUE)) {
|
|
break;
|
|
}
|
|
}
|
|
ApplicationCommandValue applicationCommandValue2 = (ApplicationCommandValue) obj;
|
|
if (applicationCommandValue2 != null) {
|
|
StoreApplicationCommands.access$getAutocompleteNonceData$p(this.this$0).put(access$generateNonce, new CommandOptionAutocompleteQuery(String.valueOf(applicationCommandValue2.getValue()), applicationCommandValue2.getName()));
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.restSubscribeOn$default(StoreApplicationCommands.access$getRestApi$p(this.this$0).sendApplicationCommand(applicationCommand), false, 1, null), this.this$0.getClass(), (Context) null, (Function1) null, new AnonymousClass1(this, applicationCommandValue2), (Function0) null, (Function0) null, AnonymousClass2.INSTANCE, 54, (Object) null);
|
|
}
|
|
}
|
|
}
|