960 lines
48 KiB
Java
960 lines
48 KiB
Java
package com.discord.stores;
|
|
|
|
import android.content.Context;
|
|
import c.d.b.a.a;
|
|
import com.discord.api.commands.ApplicationCommandAutocompleteResult;
|
|
import com.discord.api.commands.GuildApplicationCommands;
|
|
import com.discord.api.permission.Permission;
|
|
import com.discord.models.commands.Application;
|
|
import com.discord.models.commands.ApplicationCommand;
|
|
import com.discord.models.domain.NonceGenerator;
|
|
import com.discord.models.user.User;
|
|
import com.discord.stores.CommandAutocompleteState;
|
|
import com.discord.stores.DiscoverCommands;
|
|
import com.discord.stores.LoadState;
|
|
import com.discord.stores.updates.ObservationDeck;
|
|
import com.discord.stores.updates.ObservationDeckProvider;
|
|
import com.discord.utilities.permissions.PermissionUtils;
|
|
import com.discord.utilities.rest.RestAPI;
|
|
import com.discord.utilities.rx.ObservableExtensionsKt;
|
|
import com.discord.widgets.chat.input.models.ApplicationCommandData;
|
|
import d0.d0.f;
|
|
import d0.g0.t;
|
|
import d0.g0.w;
|
|
import d0.t.g0;
|
|
import d0.t.h0;
|
|
import d0.t.n;
|
|
import d0.t.o;
|
|
import d0.t.s;
|
|
import d0.t.u;
|
|
import d0.z.d.m;
|
|
import j0.l.e.j;
|
|
import java.util.ArrayList;
|
|
import java.util.Collection;
|
|
import java.util.HashMap;
|
|
import java.util.Iterator;
|
|
import java.util.LinkedHashMap;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Objects;
|
|
import kotlin.jvm.functions.Function0;
|
|
import kotlin.jvm.functions.Function1;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
import kotlin.jvm.internal.Ref$IntRef;
|
|
import rx.Observable;
|
|
/* compiled from: StoreApplicationCommands.kt */
|
|
public final class StoreApplicationCommands extends StoreV2 {
|
|
private static final ObservationDeck.UpdateSource AutocompleteResultsUpdate = new StoreApplicationCommands$Companion$AutocompleteResultsUpdate$1();
|
|
public static final int COMMANDS_LIMIT_PER_REQUEST = 20;
|
|
public static final Companion Companion = new Companion(null);
|
|
private static final ObservationDeck.UpdateSource DiscoverCommandsUpdate = new StoreApplicationCommands$Companion$DiscoverCommandsUpdate$1();
|
|
private static final ObservationDeck.UpdateSource FrecencyCommandsUpdate = new StoreApplicationCommands$Companion$FrecencyCommandsUpdate$1();
|
|
private static final ObservationDeck.UpdateSource GuildApplicationsUpdate = new StoreApplicationCommands$Companion$GuildApplicationsUpdate$1();
|
|
private static final ObservationDeck.UpdateSource QueryCommandsUpdate = new StoreApplicationCommands$Companion$QueryCommandsUpdate$1();
|
|
public static final long TYPE_APPLICATION_COMMAND = 2;
|
|
public static final long TYPE_APPLICATION_COMMAND_AUTOCOMPLETE = 4;
|
|
private Map<Long, Integer> applicationCommandIndexes;
|
|
private String applicationNonce;
|
|
private List<Application> applications;
|
|
private Map<Long, Application> applicationsMapSnapshot;
|
|
private List<Application> applicationsSnapshot;
|
|
private Map<String, CommandOptionAutocompleteQuery> autocompleteNonceData;
|
|
private Map<String, Map<String, CommandAutocompleteState>> autocompleteOptionResults;
|
|
private Map<String, ? extends Map<String, ? extends CommandAutocompleteState>> autocompleteOptionResultsSnapshot;
|
|
private final BuiltInCommandsProvider builtInCommandsProvider;
|
|
private boolean connectionReady;
|
|
private int currentEndOffset;
|
|
private int currentStartOffset;
|
|
private Long discoverApplicationId;
|
|
private DiscoverCommands discoverCommands;
|
|
private String discoverCommandsNonce;
|
|
private DiscoverCommands discoverCommandsSnapshot;
|
|
private Long discoverGuildId;
|
|
private final Dispatcher dispatcher;
|
|
private Map<Long, List<ApplicationCommand>> frecencyCommands;
|
|
private Map<Long, ? extends List<? extends ApplicationCommand>> frecencyCommandsSnapshot;
|
|
private Map<String, FrecencyRequest> frecencyRequests;
|
|
private boolean isLoadingDiscoveryCommands;
|
|
private Long jumpedApplicationId;
|
|
private int jumpedSequenceId;
|
|
private boolean loadDirectionDown;
|
|
private boolean loadDirectionUp;
|
|
private final NonceGenerator nonceGenerator;
|
|
private int numRemoteCommands;
|
|
private final ObservationDeck observationDeck;
|
|
private Long pendingGatewayGuildId;
|
|
private String query;
|
|
private final List<ApplicationCommand> queryCommands;
|
|
private List<? extends ApplicationCommand> queryCommandsSnapshot;
|
|
private Long queryGuildId;
|
|
private String queryNonce;
|
|
private final RestAPI restApi;
|
|
private final StoreApplicationCommandFrecency storeApplicationCommandFrecency;
|
|
private final StoreExperiments storeExperiments;
|
|
private final StoreGatewayConnection storeGatewayConnection;
|
|
private final StoreGuilds storeGuilds;
|
|
private final StorePermissions storePermissions;
|
|
private final StoreUser storeUsers;
|
|
|
|
/* compiled from: StoreApplicationCommands.kt */
|
|
public static final class Companion {
|
|
private Companion() {
|
|
}
|
|
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
|
|
public final ObservationDeck.UpdateSource getAutocompleteResultsUpdate() {
|
|
return StoreApplicationCommands.access$getAutocompleteResultsUpdate$cp();
|
|
}
|
|
|
|
public final ObservationDeck.UpdateSource getDiscoverCommandsUpdate() {
|
|
return StoreApplicationCommands.access$getDiscoverCommandsUpdate$cp();
|
|
}
|
|
|
|
public final ObservationDeck.UpdateSource getFrecencyCommandsUpdate() {
|
|
return StoreApplicationCommands.access$getFrecencyCommandsUpdate$cp();
|
|
}
|
|
|
|
public final ObservationDeck.UpdateSource getGuildApplicationsUpdate() {
|
|
return StoreApplicationCommands.access$getGuildApplicationsUpdate$cp();
|
|
}
|
|
|
|
public final ObservationDeck.UpdateSource getQueryCommandsUpdate() {
|
|
return StoreApplicationCommands.access$getQueryCommandsUpdate$cp();
|
|
}
|
|
}
|
|
|
|
/* compiled from: StoreApplicationCommands.kt */
|
|
public static final class FrecencyRequest {
|
|
private final List<String> applicationCommandIds;
|
|
private final Long guildId;
|
|
|
|
public FrecencyRequest(Long l, List<String> list) {
|
|
m.checkNotNullParameter(list, "applicationCommandIds");
|
|
this.guildId = l;
|
|
this.applicationCommandIds = list;
|
|
}
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r0v0, resolved type: com.discord.stores.StoreApplicationCommands$FrecencyRequest */
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public static /* synthetic */ FrecencyRequest copy$default(FrecencyRequest frecencyRequest, Long l, List list, int i, Object obj) {
|
|
if ((i & 1) != 0) {
|
|
l = frecencyRequest.guildId;
|
|
}
|
|
if ((i & 2) != 0) {
|
|
list = frecencyRequest.applicationCommandIds;
|
|
}
|
|
return frecencyRequest.copy(l, list);
|
|
}
|
|
|
|
public final Long component1() {
|
|
return this.guildId;
|
|
}
|
|
|
|
public final List<String> component2() {
|
|
return this.applicationCommandIds;
|
|
}
|
|
|
|
public final FrecencyRequest copy(Long l, List<String> list) {
|
|
m.checkNotNullParameter(list, "applicationCommandIds");
|
|
return new FrecencyRequest(l, list);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof FrecencyRequest)) {
|
|
return false;
|
|
}
|
|
FrecencyRequest frecencyRequest = (FrecencyRequest) obj;
|
|
return m.areEqual(this.guildId, frecencyRequest.guildId) && m.areEqual(this.applicationCommandIds, frecencyRequest.applicationCommandIds);
|
|
}
|
|
|
|
public final List<String> getApplicationCommandIds() {
|
|
return this.applicationCommandIds;
|
|
}
|
|
|
|
public final Long getGuildId() {
|
|
return this.guildId;
|
|
}
|
|
|
|
public int hashCode() {
|
|
Long l = this.guildId;
|
|
int i = 0;
|
|
int hashCode = (l != null ? l.hashCode() : 0) * 31;
|
|
List<String> list = this.applicationCommandIds;
|
|
if (list != null) {
|
|
i = list.hashCode();
|
|
}
|
|
return hashCode + i;
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder P = a.P("FrecencyRequest(guildId=");
|
|
P.append(this.guildId);
|
|
P.append(", applicationCommandIds=");
|
|
return a.J(P, this.applicationCommandIds, ")");
|
|
}
|
|
}
|
|
|
|
public StoreApplicationCommands(StoreGatewayConnection storeGatewayConnection, StorePermissions storePermissions, StoreApplicationCommandFrecency storeApplicationCommandFrecency, StoreGuilds storeGuilds, StoreUser storeUser, StoreExperiments storeExperiments, Dispatcher dispatcher, RestAPI restAPI, ObservationDeck observationDeck, BuiltInCommandsProvider builtInCommandsProvider, NonceGenerator nonceGenerator) {
|
|
m.checkNotNullParameter(storeGatewayConnection, "storeGatewayConnection");
|
|
m.checkNotNullParameter(storePermissions, "storePermissions");
|
|
m.checkNotNullParameter(storeApplicationCommandFrecency, "storeApplicationCommandFrecency");
|
|
m.checkNotNullParameter(storeGuilds, "storeGuilds");
|
|
m.checkNotNullParameter(storeUser, "storeUsers");
|
|
m.checkNotNullParameter(storeExperiments, "storeExperiments");
|
|
m.checkNotNullParameter(dispatcher, "dispatcher");
|
|
m.checkNotNullParameter(restAPI, "restApi");
|
|
m.checkNotNullParameter(observationDeck, "observationDeck");
|
|
m.checkNotNullParameter(builtInCommandsProvider, "builtInCommandsProvider");
|
|
m.checkNotNullParameter(nonceGenerator, "nonceGenerator");
|
|
this.storeGatewayConnection = storeGatewayConnection;
|
|
this.storePermissions = storePermissions;
|
|
this.storeApplicationCommandFrecency = storeApplicationCommandFrecency;
|
|
this.storeGuilds = storeGuilds;
|
|
this.storeUsers = storeUser;
|
|
this.storeExperiments = storeExperiments;
|
|
this.dispatcher = dispatcher;
|
|
this.restApi = restAPI;
|
|
this.observationDeck = observationDeck;
|
|
this.builtInCommandsProvider = builtInCommandsProvider;
|
|
this.nonceGenerator = nonceGenerator;
|
|
DiscoverCommands.Companion companion = DiscoverCommands.Companion;
|
|
this.discoverCommands = companion.getDefaultModelDiscoveryCommands();
|
|
this.discoverCommandsSnapshot = companion.getDefaultModelDiscoveryCommands();
|
|
this.applicationCommandIndexes = new LinkedHashMap();
|
|
this.applications = n.emptyList();
|
|
this.applicationsSnapshot = n.emptyList();
|
|
this.applicationsMapSnapshot = h0.emptyMap();
|
|
this.queryCommands = new ArrayList();
|
|
this.queryCommandsSnapshot = n.emptyList();
|
|
this.autocompleteNonceData = new LinkedHashMap();
|
|
this.autocompleteOptionResults = new LinkedHashMap();
|
|
this.autocompleteOptionResultsSnapshot = h0.emptyMap();
|
|
this.frecencyRequests = new LinkedHashMap();
|
|
this.frecencyCommands = new LinkedHashMap();
|
|
this.frecencyCommandsSnapshot = h0.emptyMap();
|
|
}
|
|
|
|
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
|
|
public /* synthetic */ StoreApplicationCommands(StoreGatewayConnection storeGatewayConnection, StorePermissions storePermissions, StoreApplicationCommandFrecency storeApplicationCommandFrecency, StoreGuilds storeGuilds, StoreUser storeUser, StoreExperiments storeExperiments, Dispatcher dispatcher, RestAPI restAPI, ObservationDeck observationDeck, BuiltInCommandsProvider builtInCommandsProvider, NonceGenerator nonceGenerator, int i, DefaultConstructorMarker defaultConstructorMarker) {
|
|
this(storeGatewayConnection, storePermissions, storeApplicationCommandFrecency, storeGuilds, storeUser, storeExperiments, dispatcher, (i & 128) != 0 ? RestAPI.Companion.getApi() : restAPI, (i & 256) != 0 ? ObservationDeckProvider.get() : observationDeck, (i & 512) != 0 ? new BuiltInCommands() : builtInCommandsProvider, (i & 1024) != 0 ? new NonceGenerator() : nonceGenerator);
|
|
}
|
|
|
|
public static final /* synthetic */ String access$generateNonce(StoreApplicationCommands storeApplicationCommands) {
|
|
return storeApplicationCommands.generateNonce();
|
|
}
|
|
|
|
public static final /* synthetic */ Map access$getApplicationCommandIndexes$p(StoreApplicationCommands storeApplicationCommands) {
|
|
return storeApplicationCommands.applicationCommandIndexes;
|
|
}
|
|
|
|
public static final /* synthetic */ void access$getApplicationCommandsViaRest(StoreApplicationCommands storeApplicationCommands, long j) {
|
|
storeApplicationCommands.getApplicationCommandsViaRest(j);
|
|
}
|
|
|
|
public static final /* synthetic */ String access$getApplicationNonce$p(StoreApplicationCommands storeApplicationCommands) {
|
|
return storeApplicationCommands.applicationNonce;
|
|
}
|
|
|
|
public static final /* synthetic */ List access$getApplications$p(StoreApplicationCommands storeApplicationCommands) {
|
|
return storeApplicationCommands.applications;
|
|
}
|
|
|
|
public static final /* synthetic */ Map access$getAutocompleteNonceData$p(StoreApplicationCommands storeApplicationCommands) {
|
|
return storeApplicationCommands.autocompleteNonceData;
|
|
}
|
|
|
|
public static final /* synthetic */ ObservationDeck.UpdateSource access$getAutocompleteResultsUpdate$cp() {
|
|
return AutocompleteResultsUpdate;
|
|
}
|
|
|
|
public static final /* synthetic */ BuiltInCommandsProvider access$getBuiltInCommandsProvider$p(StoreApplicationCommands storeApplicationCommands) {
|
|
return storeApplicationCommands.builtInCommandsProvider;
|
|
}
|
|
|
|
public static final /* synthetic */ Long access$getDiscoverApplicationId$p(StoreApplicationCommands storeApplicationCommands) {
|
|
return storeApplicationCommands.discoverApplicationId;
|
|
}
|
|
|
|
public static final /* synthetic */ DiscoverCommands access$getDiscoverCommands$p(StoreApplicationCommands storeApplicationCommands) {
|
|
return storeApplicationCommands.discoverCommands;
|
|
}
|
|
|
|
public static final /* synthetic */ String access$getDiscoverCommandsNonce$p(StoreApplicationCommands storeApplicationCommands) {
|
|
return storeApplicationCommands.discoverCommandsNonce;
|
|
}
|
|
|
|
public static final /* synthetic */ ObservationDeck.UpdateSource access$getDiscoverCommandsUpdate$cp() {
|
|
return DiscoverCommandsUpdate;
|
|
}
|
|
|
|
public static final /* synthetic */ Long access$getDiscoverGuildId$p(StoreApplicationCommands storeApplicationCommands) {
|
|
return storeApplicationCommands.discoverGuildId;
|
|
}
|
|
|
|
public static final /* synthetic */ Dispatcher access$getDispatcher$p(StoreApplicationCommands storeApplicationCommands) {
|
|
return storeApplicationCommands.dispatcher;
|
|
}
|
|
|
|
public static final /* synthetic */ Map access$getFrecencyCommands$p(StoreApplicationCommands storeApplicationCommands) {
|
|
return storeApplicationCommands.frecencyCommands;
|
|
}
|
|
|
|
public static final /* synthetic */ ObservationDeck.UpdateSource access$getFrecencyCommandsUpdate$cp() {
|
|
return FrecencyCommandsUpdate;
|
|
}
|
|
|
|
public static final /* synthetic */ ObservationDeck.UpdateSource access$getGuildApplicationsUpdate$cp() {
|
|
return GuildApplicationsUpdate;
|
|
}
|
|
|
|
public static final /* synthetic */ boolean access$getLoadDirectionDown$p(StoreApplicationCommands storeApplicationCommands) {
|
|
return storeApplicationCommands.loadDirectionDown;
|
|
}
|
|
|
|
public static final /* synthetic */ boolean access$getLoadDirectionUp$p(StoreApplicationCommands storeApplicationCommands) {
|
|
return storeApplicationCommands.loadDirectionUp;
|
|
}
|
|
|
|
public static final /* synthetic */ Long access$getPendingGatewayGuildId$p(StoreApplicationCommands storeApplicationCommands) {
|
|
return storeApplicationCommands.pendingGatewayGuildId;
|
|
}
|
|
|
|
public static final /* synthetic */ String access$getQuery$p(StoreApplicationCommands storeApplicationCommands) {
|
|
return storeApplicationCommands.query;
|
|
}
|
|
|
|
public static final /* synthetic */ List access$getQueryCommands$p(StoreApplicationCommands storeApplicationCommands) {
|
|
return storeApplicationCommands.queryCommands;
|
|
}
|
|
|
|
public static final /* synthetic */ ObservationDeck.UpdateSource access$getQueryCommandsUpdate$cp() {
|
|
return QueryCommandsUpdate;
|
|
}
|
|
|
|
public static final /* synthetic */ Long access$getQueryGuildId$p(StoreApplicationCommands storeApplicationCommands) {
|
|
return storeApplicationCommands.queryGuildId;
|
|
}
|
|
|
|
public static final /* synthetic */ String access$getQueryNonce$p(StoreApplicationCommands storeApplicationCommands) {
|
|
return storeApplicationCommands.queryNonce;
|
|
}
|
|
|
|
public static final /* synthetic */ RestAPI access$getRestApi$p(StoreApplicationCommands storeApplicationCommands) {
|
|
return storeApplicationCommands.restApi;
|
|
}
|
|
|
|
public static final /* synthetic */ StoreApplicationCommandFrecency access$getStoreApplicationCommandFrecency$p(StoreApplicationCommands storeApplicationCommands) {
|
|
return storeApplicationCommands.storeApplicationCommandFrecency;
|
|
}
|
|
|
|
public static final /* synthetic */ StoreExperiments access$getStoreExperiments$p(StoreApplicationCommands storeApplicationCommands) {
|
|
return storeApplicationCommands.storeExperiments;
|
|
}
|
|
|
|
public static final /* synthetic */ StoreGatewayConnection access$getStoreGatewayConnection$p(StoreApplicationCommands storeApplicationCommands) {
|
|
return storeApplicationCommands.storeGatewayConnection;
|
|
}
|
|
|
|
public static final /* synthetic */ StorePermissions access$getStorePermissions$p(StoreApplicationCommands storeApplicationCommands) {
|
|
return storeApplicationCommands.storePermissions;
|
|
}
|
|
|
|
public static final /* synthetic */ void access$handleDiscoverCommandsUpdate(StoreApplicationCommands storeApplicationCommands, List list) {
|
|
storeApplicationCommands.handleDiscoverCommandsUpdate(list);
|
|
}
|
|
|
|
public static final /* synthetic */ void access$handleGuildApplicationsUpdate(StoreApplicationCommands storeApplicationCommands, List list) {
|
|
storeApplicationCommands.handleGuildApplicationsUpdate(list);
|
|
}
|
|
|
|
public static final /* synthetic */ void access$handleQueryCommandsUpdate(StoreApplicationCommands storeApplicationCommands, List list) {
|
|
storeApplicationCommands.handleQueryCommandsUpdate(list);
|
|
}
|
|
|
|
public static final /* synthetic */ boolean access$isLoadingDiscoveryCommands$p(StoreApplicationCommands storeApplicationCommands) {
|
|
return storeApplicationCommands.isLoadingDiscoveryCommands;
|
|
}
|
|
|
|
public static final /* synthetic */ void access$setApplicationCommandIndexes$p(StoreApplicationCommands storeApplicationCommands, Map map) {
|
|
storeApplicationCommands.applicationCommandIndexes = map;
|
|
}
|
|
|
|
public static final /* synthetic */ void access$setApplicationNonce$p(StoreApplicationCommands storeApplicationCommands, String str) {
|
|
storeApplicationCommands.applicationNonce = str;
|
|
}
|
|
|
|
public static final /* synthetic */ void access$setApplications$p(StoreApplicationCommands storeApplicationCommands, List list) {
|
|
storeApplicationCommands.applications = list;
|
|
}
|
|
|
|
public static final /* synthetic */ void access$setAutocompleteNonceData$p(StoreApplicationCommands storeApplicationCommands, Map map) {
|
|
storeApplicationCommands.autocompleteNonceData = map;
|
|
}
|
|
|
|
public static final /* synthetic */ void access$setDiscoverApplicationId$p(StoreApplicationCommands storeApplicationCommands, Long l) {
|
|
storeApplicationCommands.discoverApplicationId = l;
|
|
}
|
|
|
|
public static final /* synthetic */ void access$setDiscoverCommands$p(StoreApplicationCommands storeApplicationCommands, DiscoverCommands discoverCommands) {
|
|
storeApplicationCommands.discoverCommands = discoverCommands;
|
|
}
|
|
|
|
public static final /* synthetic */ void access$setDiscoverCommandsNonce$p(StoreApplicationCommands storeApplicationCommands, String str) {
|
|
storeApplicationCommands.discoverCommandsNonce = str;
|
|
}
|
|
|
|
public static final /* synthetic */ void access$setDiscoverGuildId$p(StoreApplicationCommands storeApplicationCommands, Long l) {
|
|
storeApplicationCommands.discoverGuildId = l;
|
|
}
|
|
|
|
public static final /* synthetic */ void access$setFrecencyCommands$p(StoreApplicationCommands storeApplicationCommands, Map map) {
|
|
storeApplicationCommands.frecencyCommands = map;
|
|
}
|
|
|
|
public static final /* synthetic */ void access$setLoadDirectionDown$p(StoreApplicationCommands storeApplicationCommands, boolean z2) {
|
|
storeApplicationCommands.loadDirectionDown = z2;
|
|
}
|
|
|
|
public static final /* synthetic */ void access$setLoadDirectionUp$p(StoreApplicationCommands storeApplicationCommands, boolean z2) {
|
|
storeApplicationCommands.loadDirectionUp = z2;
|
|
}
|
|
|
|
public static final /* synthetic */ void access$setLoadingDiscoveryCommands$p(StoreApplicationCommands storeApplicationCommands, boolean z2) {
|
|
storeApplicationCommands.isLoadingDiscoveryCommands = z2;
|
|
}
|
|
|
|
public static final /* synthetic */ void access$setPendingGatewayGuildId$p(StoreApplicationCommands storeApplicationCommands, Long l) {
|
|
storeApplicationCommands.pendingGatewayGuildId = l;
|
|
}
|
|
|
|
public static final /* synthetic */ void access$setQuery$p(StoreApplicationCommands storeApplicationCommands, String str) {
|
|
storeApplicationCommands.query = str;
|
|
}
|
|
|
|
public static final /* synthetic */ void access$setQueryGuildId$p(StoreApplicationCommands storeApplicationCommands, Long l) {
|
|
storeApplicationCommands.queryGuildId = l;
|
|
}
|
|
|
|
public static final /* synthetic */ void access$setQueryNonce$p(StoreApplicationCommands storeApplicationCommands, String str) {
|
|
storeApplicationCommands.queryNonce = str;
|
|
}
|
|
|
|
public static final /* synthetic */ boolean access$shouldReturnApplicationCommands(StoreApplicationCommands storeApplicationCommands, Long l) {
|
|
return storeApplicationCommands.shouldReturnApplicationCommands(l);
|
|
}
|
|
|
|
@StoreThread
|
|
private final String generateNonce() {
|
|
return String.valueOf(this.nonceGenerator.nonce());
|
|
}
|
|
|
|
private final void getApplicationCommandsViaRest(long j) {
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.restSubscribeOn$default(this.restApi.getApplicationCommands(j), false, 1, null), StoreApplicationCommands.class, (Context) null, (Function1) null, new StoreApplicationCommands$getApplicationCommandsViaRest$2(this), (Function0) null, (Function0) null, new StoreApplicationCommands$getApplicationCommandsViaRest$1(this, j), 54, (Object) null);
|
|
}
|
|
|
|
@StoreThread
|
|
private final void handleDiscoverCommandsUpdate(List<? extends ApplicationCommand> list) {
|
|
this.isLoadingDiscoveryCommands = false;
|
|
List<ApplicationCommand> mutableList = u.toMutableList((Collection) this.discoverCommands.getCommands());
|
|
int size = mutableList.size();
|
|
Long l = this.jumpedApplicationId;
|
|
if (l != null) {
|
|
mutableList = u.toMutableList((Collection) list);
|
|
Integer num = this.applicationCommandIndexes.get(l);
|
|
this.currentStartOffset = num != null ? num.intValue() : 0;
|
|
} else if (this.loadDirectionUp) {
|
|
ArrayList arrayList = new ArrayList();
|
|
for (Object obj : list) {
|
|
ApplicationCommand applicationCommand = (ApplicationCommand) obj;
|
|
ArrayList arrayList2 = new ArrayList(o.collectionSizeOrDefault(mutableList, 10));
|
|
for (ApplicationCommand applicationCommand2 : mutableList) {
|
|
arrayList2.add(applicationCommand2.getId());
|
|
}
|
|
if (!arrayList2.contains(applicationCommand.getId())) {
|
|
arrayList.add(obj);
|
|
}
|
|
}
|
|
for (ApplicationCommand applicationCommand3 : s.asReversed(arrayList)) {
|
|
mutableList.add(0, applicationCommand3);
|
|
}
|
|
this.currentStartOffset -= mutableList.size() - size;
|
|
} else if (this.loadDirectionDown) {
|
|
ArrayList arrayList3 = new ArrayList();
|
|
for (Object obj2 : list) {
|
|
ApplicationCommand applicationCommand4 = (ApplicationCommand) obj2;
|
|
ArrayList arrayList4 = new ArrayList(o.collectionSizeOrDefault(mutableList, 10));
|
|
for (ApplicationCommand applicationCommand5 : mutableList) {
|
|
arrayList4.add(applicationCommand5.getId());
|
|
}
|
|
if (!arrayList4.contains(applicationCommand4.getId())) {
|
|
arrayList3.add(obj2);
|
|
}
|
|
}
|
|
mutableList = u.toMutableList((Collection) u.plus((Collection) mutableList, (Iterable) arrayList3));
|
|
} else {
|
|
mutableList = u.toMutableList((Collection) list);
|
|
this.currentStartOffset = 0;
|
|
}
|
|
if ((mutableList.size() + this.currentStartOffset) - 1 == this.numRemoteCommands - 1) {
|
|
mutableList.addAll(this.builtInCommandsProvider.getBuiltInCommands());
|
|
}
|
|
this.currentEndOffset = (mutableList.size() + this.currentStartOffset) - 1;
|
|
this.discoverCommands = new DiscoverCommands(mutableList, this.currentStartOffset, this.currentEndOffset, this.currentStartOffset > 0 && (mutableList.isEmpty() ^ true), this.currentEndOffset < this.numRemoteCommands - 1, this.jumpedSequenceId, this.jumpedApplicationId, this.loadDirectionUp ? LoadState.JustLoadedUp.INSTANCE : this.loadDirectionDown ? LoadState.JustLoadedDown.INSTANCE : LoadState.JustLoadedAll.INSTANCE);
|
|
markChanged(DiscoverCommandsUpdate);
|
|
}
|
|
|
|
private final void handleFrecencyCommandsUpdate(String str, List<? extends ApplicationCommand> list) {
|
|
int intValue;
|
|
boolean z2;
|
|
FrecencyRequest frecencyRequest = this.frecencyRequests.get(str);
|
|
if (frecencyRequest != null) {
|
|
List<ApplicationCommand> flattenSubCommands = StoreApplicationCommandsKt.flattenSubCommands(list);
|
|
Map<Long, List<ApplicationCommand>> map = this.frecencyCommands;
|
|
Long guildId = frecencyRequest.getGuildId();
|
|
Long valueOf = Long.valueOf(guildId != null ? guildId.longValue() : 0);
|
|
List<String> applicationCommandIds = frecencyRequest.getApplicationCommandIds();
|
|
ArrayList arrayList = new ArrayList(o.collectionSizeOrDefault(applicationCommandIds, 10));
|
|
for (String str2 : applicationCommandIds) {
|
|
Integer intOrNull = d0.g0.s.toIntOrNull(str2);
|
|
Object obj = null;
|
|
if (intOrNull == null || (intValue = intOrNull.intValue()) >= 0) {
|
|
Iterator<T> it = flattenSubCommands.iterator();
|
|
while (true) {
|
|
if (!it.hasNext()) {
|
|
break;
|
|
}
|
|
Object next = it.next();
|
|
if (m.areEqual(((ApplicationCommand) next).getId(), str2)) {
|
|
obj = next;
|
|
break;
|
|
}
|
|
}
|
|
} else {
|
|
Iterator<T> it2 = this.builtInCommandsProvider.getBuiltInCommands().iterator();
|
|
while (true) {
|
|
if (!it2.hasNext()) {
|
|
break;
|
|
}
|
|
Object next2 = it2.next();
|
|
Integer intOrNull2 = d0.g0.s.toIntOrNull(((ApplicationCommand) next2).getId());
|
|
if (intOrNull2 != null && intOrNull2.intValue() == intValue) {
|
|
z2 = true;
|
|
continue;
|
|
} else {
|
|
z2 = false;
|
|
continue;
|
|
}
|
|
if (z2) {
|
|
obj = next2;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
arrayList.add((ApplicationCommand) obj);
|
|
}
|
|
map.put(valueOf, u.filterNotNull(arrayList));
|
|
markChanged(FrecencyCommandsUpdate);
|
|
}
|
|
}
|
|
|
|
@StoreThread
|
|
private final void handleGuildApplicationsUpdate(List<Application> list) {
|
|
this.applications = list;
|
|
this.numRemoteCommands = 0;
|
|
int i = 0;
|
|
for (Application application : list) {
|
|
this.applicationCommandIndexes.put(Long.valueOf(application.getId()), Integer.valueOf(i));
|
|
i += application.getCommandCount();
|
|
if (!application.getBuiltIn()) {
|
|
this.numRemoteCommands = application.getCommandCount() + this.numRemoteCommands;
|
|
}
|
|
}
|
|
markChanged(GuildApplicationsUpdate);
|
|
}
|
|
|
|
@StoreThread
|
|
private final void handleQueryCommandsUpdate(List<? extends ApplicationCommand> list) {
|
|
this.queryCommands.clear();
|
|
this.queryCommands.addAll(list);
|
|
String str = this.query;
|
|
if (str != null) {
|
|
List<ApplicationCommand> list2 = this.queryCommands;
|
|
List<ApplicationCommand> builtInCommands = this.builtInCommandsProvider.getBuiltInCommands();
|
|
ArrayList arrayList = new ArrayList();
|
|
for (Object obj : builtInCommands) {
|
|
if (t.startsWith(((ApplicationCommand) obj).getName(), str, true)) {
|
|
arrayList.add(obj);
|
|
}
|
|
}
|
|
list2.addAll(arrayList);
|
|
}
|
|
markChanged(QueryCommandsUpdate);
|
|
}
|
|
|
|
private final void requestApplicationCommands(Long l, int i, Long l2, int i2) {
|
|
this.dispatcher.schedule(new StoreApplicationCommands$requestApplicationCommands$1(this, l, i, i2, l2));
|
|
}
|
|
|
|
public static /* synthetic */ void requestApplicationCommands$default(StoreApplicationCommands storeApplicationCommands, Long l, int i, Long l2, int i2, int i3, Object obj) {
|
|
if ((i3 & 2) != 0) {
|
|
i = 0;
|
|
}
|
|
if ((i3 & 4) != 0) {
|
|
l2 = null;
|
|
}
|
|
if ((i3 & 8) != 0) {
|
|
i2 = 20;
|
|
}
|
|
storeApplicationCommands.requestApplicationCommands(l, i, l2, i2);
|
|
}
|
|
|
|
public static /* synthetic */ void requestInitialApplicationCommands$default(StoreApplicationCommands storeApplicationCommands, Long l, Long l2, boolean z2, int i, Object obj) {
|
|
if ((i & 4) != 0) {
|
|
z2 = false;
|
|
}
|
|
storeApplicationCommands.requestInitialApplicationCommands(l, l2, z2);
|
|
}
|
|
|
|
@StoreThread
|
|
private final void setAutocompleteState(String str, String str2, CommandAutocompleteState commandAutocompleteState) {
|
|
Map<String, CommandAutocompleteState> map = this.autocompleteOptionResults.get(str);
|
|
if (map == null) {
|
|
map = h0.emptyMap();
|
|
}
|
|
if (!(map.get(str2) instanceof CommandAutocompleteState.Choices)) {
|
|
LinkedHashMap linkedHashMap = new LinkedHashMap();
|
|
Map<String, CommandAutocompleteState> map2 = this.autocompleteOptionResults.get(str);
|
|
if (map2 == null) {
|
|
map2 = h0.emptyMap();
|
|
}
|
|
linkedHashMap.putAll(map2);
|
|
linkedHashMap.put(str2, commandAutocompleteState);
|
|
this.autocompleteOptionResults.put(str, linkedHashMap);
|
|
markChanged(AutocompleteResultsUpdate);
|
|
}
|
|
}
|
|
|
|
private final boolean shouldReturnApplicationCommands(Long l) {
|
|
Long l2 = this.discoverGuildId;
|
|
return l2 == null || (l2 != null && l2.longValue() == 0) || PermissionUtils.can(Permission.USE_APPLICATION_COMMANDS, l);
|
|
}
|
|
|
|
public final void clearAutocompleteResults() {
|
|
this.autocompleteOptionResults.clear();
|
|
markChanged(AutocompleteResultsUpdate);
|
|
}
|
|
|
|
public final void clearQueryCommands() {
|
|
this.dispatcher.schedule(new StoreApplicationCommands$clearQueryCommands$1(this));
|
|
}
|
|
|
|
public final Map<Long, Application> getApplicationMap() {
|
|
return this.applicationsMapSnapshot;
|
|
}
|
|
|
|
public final List<Application> getApplications() {
|
|
return this.applicationsSnapshot;
|
|
}
|
|
|
|
/* JADX DEBUG: Type inference failed for r0v0. Raw type applied. Possible types: java.util.Map<java.lang.String, ? extends java.util.Map<java.lang.String, ? extends com.discord.stores.CommandAutocompleteState>>, java.util.Map<java.lang.String, java.util.Map<java.lang.String, com.discord.stores.CommandAutocompleteState>> */
|
|
public final Map<String, Map<String, CommandAutocompleteState>> getAutocompleteOptionResults() {
|
|
return this.autocompleteOptionResultsSnapshot;
|
|
}
|
|
|
|
public final DiscoverCommands getDiscoverCommands() {
|
|
return this.discoverCommandsSnapshot;
|
|
}
|
|
|
|
public final List<ApplicationCommand> getFrecencyCommands(long j) {
|
|
List<ApplicationCommand> list = (List) this.frecencyCommandsSnapshot.get(Long.valueOf(j));
|
|
return list != null ? list : n.emptyList();
|
|
}
|
|
|
|
/* JADX DEBUG: Type inference failed for r0v0. Raw type applied. Possible types: java.util.List<? extends com.discord.models.commands.ApplicationCommand>, java.util.List<com.discord.models.commands.ApplicationCommand> */
|
|
public final List<ApplicationCommand> getQueryCommands() {
|
|
return this.queryCommandsSnapshot;
|
|
}
|
|
|
|
@StoreThread
|
|
public final void handleApplicationCommandAutocompleteResult(ApplicationCommandAutocompleteResult applicationCommandAutocompleteResult) {
|
|
m.checkNotNullParameter(applicationCommandAutocompleteResult, "autocompleteResult");
|
|
CommandOptionAutocompleteQuery commandOptionAutocompleteQuery = this.autocompleteNonceData.get(applicationCommandAutocompleteResult.b());
|
|
if (commandOptionAutocompleteQuery != null) {
|
|
LinkedHashMap linkedHashMap = new LinkedHashMap();
|
|
Map<String, CommandAutocompleteState> map = this.autocompleteOptionResults.get(commandOptionAutocompleteQuery.getCommandOptionName());
|
|
if (map == null) {
|
|
map = h0.emptyMap();
|
|
}
|
|
linkedHashMap.putAll(map);
|
|
linkedHashMap.put(commandOptionAutocompleteQuery.getQueryString(), new CommandAutocompleteState.Choices(applicationCommandAutocompleteResult.a()));
|
|
this.autocompleteOptionResults.put(commandOptionAutocompleteQuery.getCommandOptionName(), linkedHashMap);
|
|
markChanged(AutocompleteResultsUpdate);
|
|
}
|
|
}
|
|
|
|
@StoreThread
|
|
public final void handleApplicationCommandsUpdate(GuildApplicationCommands guildApplicationCommands) {
|
|
m.checkNotNullParameter(guildApplicationCommands, "commandsGateway");
|
|
if (this.frecencyRequests.containsKey(guildApplicationCommands.c())) {
|
|
String c2 = guildApplicationCommands.c();
|
|
List<com.discord.api.commands.ApplicationCommand> a = guildApplicationCommands.a();
|
|
ArrayList arrayList = new ArrayList(o.collectionSizeOrDefault(a, 10));
|
|
for (com.discord.api.commands.ApplicationCommand applicationCommand : a) {
|
|
arrayList.add(StoreApplicationCommandsKt.toSlashCommand(applicationCommand));
|
|
}
|
|
handleFrecencyCommandsUpdate(c2, arrayList);
|
|
return;
|
|
}
|
|
String c3 = guildApplicationCommands.c();
|
|
if (m.areEqual(c3, this.applicationNonce)) {
|
|
List listOf = d0.t.m.listOf(this.builtInCommandsProvider.getFrecencyApplication());
|
|
List<com.discord.api.commands.Application> b = guildApplicationCommands.b();
|
|
ArrayList arrayList2 = new ArrayList(o.collectionSizeOrDefault(b, 10));
|
|
for (com.discord.api.commands.Application application : b) {
|
|
arrayList2.add(StoreApplicationCommandsKt.toDomainApplication(application));
|
|
}
|
|
handleGuildApplicationsUpdate(u.plus((Collection<? extends Application>) u.plus((Collection) listOf, (Iterable) u.sortedWith(arrayList2, new StoreApplicationCommands$handleApplicationCommandsUpdate$$inlined$sortedBy$1())), this.builtInCommandsProvider.getBuiltInApplication()));
|
|
} else if (m.areEqual(c3, this.queryNonce)) {
|
|
List<com.discord.api.commands.ApplicationCommand> a2 = guildApplicationCommands.a();
|
|
ArrayList arrayList3 = new ArrayList(o.collectionSizeOrDefault(a2, 10));
|
|
for (com.discord.api.commands.ApplicationCommand applicationCommand2 : a2) {
|
|
arrayList3.add(StoreApplicationCommandsKt.toSlashCommand(applicationCommand2));
|
|
}
|
|
handleQueryCommandsUpdate(arrayList3);
|
|
} else if (m.areEqual(c3, this.discoverCommandsNonce)) {
|
|
List<com.discord.api.commands.ApplicationCommand> a3 = guildApplicationCommands.a();
|
|
ArrayList arrayList4 = new ArrayList(o.collectionSizeOrDefault(a3, 10));
|
|
for (com.discord.api.commands.ApplicationCommand applicationCommand3 : a3) {
|
|
arrayList4.add(StoreApplicationCommandsKt.toSlashCommand(applicationCommand3));
|
|
}
|
|
handleDiscoverCommandsUpdate(arrayList4);
|
|
}
|
|
}
|
|
|
|
public final void handleConnectionReady(boolean z2) {
|
|
Long l;
|
|
this.connectionReady = z2;
|
|
if (z2 && (l = this.pendingGatewayGuildId) != null) {
|
|
long longValue = l.longValue();
|
|
requestApplications(Long.valueOf(longValue));
|
|
requestFrecencyCommands(longValue);
|
|
this.pendingGatewayGuildId = null;
|
|
}
|
|
}
|
|
|
|
public final void handleDmUserApplication(User user) {
|
|
m.checkNotNullParameter(user, "botUser");
|
|
if (user.isBot()) {
|
|
this.dispatcher.schedule(new StoreApplicationCommands$handleDmUserApplication$1(this, user));
|
|
}
|
|
}
|
|
|
|
public final boolean hasFetchedApplicationCommands(long j) {
|
|
Integer num = this.applicationCommandIndexes.get(Long.valueOf(j));
|
|
if (num == null) {
|
|
return false;
|
|
}
|
|
int intValue = num.intValue();
|
|
return this.currentStartOffset <= intValue && this.currentEndOffset >= intValue;
|
|
}
|
|
|
|
public final Observable<Map<String, Map<String, CommandAutocompleteState>>> observeAutocompleteResults() {
|
|
Observable connectRx$default = ObservationDeck.connectRx$default(this.observationDeck, new ObservationDeck.UpdateSource[]{AutocompleteResultsUpdate}, false, null, null, new StoreApplicationCommands$observeAutocompleteResults$1(this), 14, null);
|
|
Map emptyMap = h0.emptyMap();
|
|
Objects.requireNonNull(connectRx$default);
|
|
Observable<Map<String, Map<String, CommandAutocompleteState>>> m = Observable.m(new j(emptyMap), connectRx$default);
|
|
m.checkNotNullExpressionValue(m, "observationDeck.connectR… }.startWith(emptyMap())");
|
|
return m;
|
|
}
|
|
|
|
public final Observable<DiscoverCommands> observeDiscoverCommands(long j) {
|
|
Observable<DiscoverCommands> j2 = Observable.j(ObservationDeck.connectRx$default(this.observationDeck, new ObservationDeck.UpdateSource[]{DiscoverCommandsUpdate}, false, null, null, new StoreApplicationCommands$observeDiscoverCommands$1(this), 14, null).r(), this.storePermissions.observePermissionsForChannel(j), new StoreApplicationCommands$observeDiscoverCommands$2(this));
|
|
m.checkNotNullExpressionValue(j2, "Observable\n .comb… )\n }\n }");
|
|
return j2;
|
|
}
|
|
|
|
public final Observable<List<ApplicationCommand>> observeFrecencyCommands(long j) {
|
|
return ObservationDeck.connectRx$default(this.observationDeck, new ObservationDeck.UpdateSource[]{FrecencyCommandsUpdate, this.storeExperiments}, false, null, null, new StoreApplicationCommands$observeFrecencyCommands$1(this, j), 14, null);
|
|
}
|
|
|
|
public final Observable<List<Application>> observeGuildApplications(long j) {
|
|
return ObservationDeck.connectRx$default(this.observationDeck, new ObservationDeck.UpdateSource[]{GuildApplicationsUpdate, this.storePermissions}, false, null, null, new StoreApplicationCommands$observeGuildApplications$1(this, j), 14, null);
|
|
}
|
|
|
|
public final Observable<List<ApplicationCommand>> observeQueryCommands(long j) {
|
|
Observable<List<ApplicationCommand>> r = ObservationDeck.connectRx$default(this.observationDeck, new ObservationDeck.UpdateSource[]{QueryCommandsUpdate, this.storePermissions}, false, null, null, new StoreApplicationCommands$observeQueryCommands$1(this, j), 14, null).r();
|
|
m.checkNotNullExpressionValue(r, "observationDeck.connectR… }.distinctUntilChanged()");
|
|
return r;
|
|
}
|
|
|
|
public final void requestApplicationCommandAutocompleteData(Long l, long j, ApplicationCommandData applicationCommandData) {
|
|
m.checkNotNullParameter(applicationCommandData, "data");
|
|
this.dispatcher.schedule(new StoreApplicationCommands$requestApplicationCommandAutocompleteData$1(this, applicationCommandData, j, l));
|
|
}
|
|
|
|
public final void requestApplicationCommandsQuery(Long l, String str) {
|
|
m.checkNotNullParameter(str, "query");
|
|
this.dispatcher.schedule(new StoreApplicationCommands$requestApplicationCommandsQuery$1(this, l, str));
|
|
}
|
|
|
|
public final void requestApplications(Long l) {
|
|
if (!this.connectionReady) {
|
|
this.pendingGatewayGuildId = l;
|
|
} else {
|
|
this.dispatcher.schedule(new StoreApplicationCommands$requestApplications$1(this, l));
|
|
}
|
|
}
|
|
|
|
public final void requestDiscoverCommands(long j) {
|
|
Long l = this.discoverGuildId;
|
|
if (l != null) {
|
|
l.longValue();
|
|
requestInitialApplicationCommands$default(this, l, Long.valueOf(j), false, 4, null);
|
|
}
|
|
}
|
|
|
|
public final void requestFrecencyCommands(long j) {
|
|
List<String> topCommandIds = this.storeApplicationCommandFrecency.getTopCommandIds(Long.valueOf(j));
|
|
if (!topCommandIds.isEmpty()) {
|
|
String generateNonce = generateNonce();
|
|
FrecencyRequest frecencyRequest = new FrecencyRequest(Long.valueOf(j), topCommandIds);
|
|
if (!this.frecencyRequests.containsValue(frecencyRequest)) {
|
|
this.frecencyRequests.put(generateNonce, frecencyRequest);
|
|
ArrayList arrayList = new ArrayList(o.collectionSizeOrDefault(topCommandIds, 10));
|
|
for (String str : topCommandIds) {
|
|
if (w.contains$default((CharSequence) str, (CharSequence) " ", false, 2, (Object) null)) {
|
|
str = (String) w.split$default((CharSequence) str, new String[]{" "}, false, 0, 6, (Object) null).get(0);
|
|
}
|
|
arrayList.add(str);
|
|
}
|
|
ArrayList arrayList2 = new ArrayList();
|
|
for (Object obj : arrayList) {
|
|
Long longOrNull = d0.g0.s.toLongOrNull((String) obj);
|
|
if ((longOrNull != null ? longOrNull.longValue() : 0) > 0) {
|
|
arrayList2.add(obj);
|
|
}
|
|
}
|
|
if (!(true ^ arrayList2.isEmpty())) {
|
|
handleFrecencyCommandsUpdate(generateNonce, n.emptyList());
|
|
} else if (!StoreGatewayConnection.requestApplicationCommands$default(this.storeGatewayConnection, j, generateNonce, false, null, null, 20, u.distinct(arrayList2), 24, null)) {
|
|
this.frecencyRequests.remove(generateNonce);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public final void requestInitialApplicationCommands(Long l, Long l2, boolean z2) {
|
|
Ref$IntRef ref$IntRef = new Ref$IntRef();
|
|
int i = 0;
|
|
ref$IntRef.element = 0;
|
|
this.loadDirectionUp = false;
|
|
this.loadDirectionDown = false;
|
|
if (!z2) {
|
|
this.jumpedApplicationId = l2;
|
|
}
|
|
if (this.jumpedApplicationId != null) {
|
|
this.jumpedSequenceId++;
|
|
}
|
|
if (l2 != null) {
|
|
long longValue = l2.longValue();
|
|
this.discoverCommands = DiscoverCommands.copy$default(this.discoverCommands, n.emptyList(), 0, 0, false, false, 0, null, null, 254, null);
|
|
if (this.applicationCommandIndexes.containsKey(Long.valueOf(longValue))) {
|
|
Integer num = this.applicationCommandIndexes.get(Long.valueOf(longValue));
|
|
if (num != null) {
|
|
i = num.intValue();
|
|
}
|
|
ref$IntRef.element = i;
|
|
this.currentStartOffset = i;
|
|
this.currentEndOffset = i;
|
|
}
|
|
if (longValue == this.builtInCommandsProvider.getBuiltInApplication().getId()) {
|
|
this.dispatcher.schedule(new StoreApplicationCommands$requestInitialApplicationCommands$$inlined$let$lambda$1(this, ref$IntRef));
|
|
return;
|
|
}
|
|
}
|
|
requestApplicationCommands$default(this, l, ref$IntRef.element, l2, 0, 8, null);
|
|
}
|
|
|
|
public final void requestLoadMoreDown() {
|
|
Long l = this.discoverGuildId;
|
|
if (l != null) {
|
|
requestApplicationCommands$default(this, Long.valueOf(l.longValue()), this.currentEndOffset + 1, null, 20, 4, null);
|
|
this.loadDirectionUp = false;
|
|
this.loadDirectionDown = true;
|
|
this.jumpedApplicationId = null;
|
|
this.discoverCommands = DiscoverCommands.copy$default(this.discoverCommands, null, 0, 0, false, false, 0, null, LoadState.LoadingDown.INSTANCE, 127, null);
|
|
}
|
|
}
|
|
|
|
public final void requestLoadMoreUp() {
|
|
int i;
|
|
int i2;
|
|
Long l = this.discoverGuildId;
|
|
if (l != null) {
|
|
long longValue = l.longValue();
|
|
int i3 = this.currentStartOffset;
|
|
int i4 = i3 - 20;
|
|
if (i4 < 0) {
|
|
i = i3;
|
|
i2 = 0;
|
|
} else {
|
|
i2 = i4;
|
|
i = 20;
|
|
}
|
|
requestApplicationCommands$default(this, Long.valueOf(longValue), i2, null, i, 4, null);
|
|
this.loadDirectionUp = true;
|
|
this.loadDirectionDown = false;
|
|
this.jumpedApplicationId = null;
|
|
this.discoverCommands = DiscoverCommands.copy$default(this.discoverCommands, null, 0, 0, false, false, 0, null, LoadState.LoadingUp.INSTANCE, 127, null);
|
|
}
|
|
}
|
|
|
|
@StoreThread
|
|
public final void setAutocompleteFailed(String str, String str2) {
|
|
m.checkNotNullParameter(str, "commandOptionName");
|
|
m.checkNotNullParameter(str2, "queryString");
|
|
setAutocompleteState(str, str2, CommandAutocompleteState.Failed.INSTANCE);
|
|
}
|
|
|
|
@StoreThread
|
|
public final void setAutocompleteLoading(String str, String str2) {
|
|
m.checkNotNullParameter(str, "commandOptionName");
|
|
m.checkNotNullParameter(str2, "queryString");
|
|
setAutocompleteState(str, str2, CommandAutocompleteState.Loading.INSTANCE);
|
|
}
|
|
|
|
@Override // com.discord.stores.StoreV2
|
|
public void snapshotData() {
|
|
if (getUpdateSources().contains(DiscoverCommandsUpdate)) {
|
|
DiscoverCommands discoverCommands = this.discoverCommands;
|
|
this.discoverCommandsSnapshot = DiscoverCommands.copy$default(discoverCommands, StoreApplicationCommandsKt.flattenSubCommands(discoverCommands.getCommands()), 0, 0, false, false, 0, null, null, 254, null);
|
|
}
|
|
if (getUpdateSources().contains(QueryCommandsUpdate)) {
|
|
this.queryCommandsSnapshot = new ArrayList(StoreApplicationCommandsKt.flattenSubCommands(this.queryCommands));
|
|
}
|
|
if (getUpdateSources().contains(GuildApplicationsUpdate)) {
|
|
ArrayList arrayList = new ArrayList(this.applications);
|
|
this.applicationsSnapshot = arrayList;
|
|
LinkedHashMap linkedHashMap = new LinkedHashMap(f.coerceAtLeast(g0.mapCapacity(o.collectionSizeOrDefault(arrayList, 10)), 16));
|
|
for (Object obj : arrayList) {
|
|
linkedHashMap.put(Long.valueOf(((Application) obj).getId()), obj);
|
|
}
|
|
this.applicationsMapSnapshot = linkedHashMap;
|
|
}
|
|
if (getUpdateSources().contains(AutocompleteResultsUpdate)) {
|
|
this.autocompleteOptionResultsSnapshot = new HashMap(this.autocompleteOptionResults);
|
|
}
|
|
if (getUpdateSources().contains(FrecencyCommandsUpdate)) {
|
|
LinkedHashMap linkedHashMap2 = new LinkedHashMap();
|
|
linkedHashMap2.putAll(this.frecencyCommands);
|
|
this.frecencyCommandsSnapshot = linkedHashMap2;
|
|
}
|
|
}
|
|
}
|