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

1495 lines
68 KiB
Java

package com.discord.stores;
import android.content.Context;
import c.a.d.k;
import c.a.d.l;
import c.a.e.d;
import c.d.b.a.a;
import com.discord.BuildConfig;
import com.discord.api.activity.Activity;
import com.discord.api.channel.Channel;
import com.discord.api.channel.ChannelRecipient;
import com.discord.api.commands.ApplicationCommandAutocompleteResult;
import com.discord.api.commands.GuildApplicationCommands;
import com.discord.api.embeddedactivities.EmbeddedActivityInboundUpdate;
import com.discord.api.emoji.GuildEmojisUpdate;
import com.discord.api.friendsuggestions.FriendSuggestion;
import com.discord.api.friendsuggestions.FriendSuggestionDelete;
import com.discord.api.guild.Guild;
import com.discord.api.guildjoinrequest.GuildJoinRequestCreateOrUpdate;
import com.discord.api.guildjoinrequest.GuildJoinRequestDelete;
import com.discord.api.guildmember.GuildMember;
import com.discord.api.guildmember.GuildMemberRemove;
import com.discord.api.guildmember.GuildMembersChunk;
import com.discord.api.guildscheduledevent.GuildScheduledEvent;
import com.discord.api.guildscheduledevent.GuildScheduledEventUserUpdate;
import com.discord.api.interaction.InteractionStateUpdate;
import com.discord.api.message.Message;
import com.discord.api.message.reaction.MessageReactionUpdate;
import com.discord.api.presence.ClientStatus;
import com.discord.api.presence.Presence;
import com.discord.api.requiredaction.UserRequiredActionUpdate;
import com.discord.api.role.GuildRoleCreate;
import com.discord.api.role.GuildRoleDelete;
import com.discord.api.role.GuildRoleUpdate;
import com.discord.api.stageinstance.StageInstance;
import com.discord.api.sticker.GuildStickersUpdate;
import com.discord.api.thread.ThreadMemberListUpdate;
import com.discord.api.thread.ThreadMemberUpdate;
import com.discord.api.thread.ThreadMembersUpdate;
import com.discord.api.user.TypingUser;
import com.discord.api.user.User;
import com.discord.api.voice.server.VoiceServer;
import com.discord.api.voice.state.VoiceState;
import com.discord.app.App;
import com.discord.app.AppLog;
import com.discord.gateway.GatewayEventHandler;
import com.discord.gateway.GatewaySocket;
import com.discord.gateway.io.OutgoingPayload;
import com.discord.gateway.rest.RestConfig;
import com.discord.models.domain.ModelApplicationStream;
import com.discord.models.domain.ModelBan;
import com.discord.models.domain.ModelCall;
import com.discord.models.domain.ModelChannelUnreadUpdate;
import com.discord.models.domain.ModelGuildIntegration;
import com.discord.models.domain.ModelGuildMemberListUpdate;
import com.discord.models.domain.ModelMessageDelete;
import com.discord.models.domain.ModelNotificationSettings;
import com.discord.models.domain.ModelPayload;
import com.discord.models.domain.ModelReadState;
import com.discord.models.domain.ModelSession;
import com.discord.models.domain.ModelUserNote;
import com.discord.models.domain.ModelUserRelationship;
import com.discord.models.domain.ModelUserSettings;
import com.discord.models.domain.StreamCreateOrUpdate;
import com.discord.models.domain.StreamDelete;
import com.discord.models.domain.StreamServerUpdate;
import com.discord.models.thread.dto.ModelThreadListSync;
import com.discord.rtcconnection.RtcConnection;
import com.discord.stores.StoreClientDataState;
import com.discord.stores.utilities.BatchManager;
import com.discord.stores.utilities.Batched;
import com.discord.utilities.analytics.AnalyticSuperProperties;
import com.discord.utilities.fcm.NotificationData;
import com.discord.utilities.lazy.subscriptions.GuildSubscriptions;
import com.discord.utilities.logging.AppGatewaySocketLogger;
import com.discord.utilities.networking.NetworkMonitor;
import com.discord.utilities.rest.RestAPI;
import com.discord.utilities.rx.ObservableExtensionsKt;
import com.discord.utilities.ssl.SecureSocketsLayerUtils;
import com.discord.utilities.time.Clock;
import d0.t.n;
import d0.t.u;
import d0.z.d.m;
import j0.l.c.c;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicReference;
import javax.net.ssl.SSLSocketFactory;
import kotlin.Unit;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlinx.coroutines.ExecutorCoroutineDispatcher;
import okhttp3.Interceptor;
import rx.Observable;
import rx.Scheduler;
import rx.subjects.BehaviorSubject;
import rx.subjects.PublishSubject;
import rx.subjects.SerializedSubject;
import s.a.w0;
/* compiled from: StoreGatewayConnection.kt */
public final class StoreGatewayConnection implements GatewayEventHandler {
private final SerializedSubject<ApplicationCommandAutocompleteResult, ApplicationCommandAutocompleteResult> applicationCommandAutocompleteResult;
private final BatchManager batches;
private final SerializedSubject<ModelCall, ModelCall> callCreateOrUpdate;
private final SerializedSubject<ModelCall, ModelCall> callDelete;
private final SerializedSubject<Channel, Channel> channelCreateOrUpdate;
private final SerializedSubject<Channel, Channel> channelDeleted;
private final SerializedSubject<ChannelRecipient, ChannelRecipient> channelRecipientAdd;
private final SerializedSubject<ChannelRecipient, ChannelRecipient> channelRecipientRemove;
private final SerializedSubject<ModelChannelUnreadUpdate, ModelChannelUnreadUpdate> channelUnreadUpdate;
private ClientState clientState;
private final Clock clock;
private final SerializedSubject<Boolean, Boolean> connected;
private final SerializedSubject<Boolean, Boolean> connectionReady;
private final ExecutorCoroutineDispatcher coroutineDispatcher;
private final SerializedSubject<EmbeddedActivityInboundUpdate, EmbeddedActivityInboundUpdate> embeddedActivityInboundUpdate;
private final ExecutorService executor;
private final SerializedSubject<FriendSuggestion, FriendSuggestion> friendSuggestionCreate;
private final SerializedSubject<FriendSuggestionDelete, FriendSuggestionDelete> friendSuggestionDelete;
private final AppGatewaySocketLogger gatewaySocketLogger;
private final SerializedSubject<GuildApplicationCommands, GuildApplicationCommands> guildApplicationCommands;
private final SerializedSubject<ModelBan, ModelBan> guildBanAdd;
private final SerializedSubject<ModelBan, ModelBan> guildBanRemove;
private final SerializedSubject<Guild, Guild> guildCreate;
private final SerializedSubject<Guild, Guild> guildDeleted;
private final SerializedSubject<GuildEmojisUpdate, GuildEmojisUpdate> guildEmojisUpdate;
private final SerializedSubject<ModelGuildIntegration.Update, ModelGuildIntegration.Update> guildIntegrationsUpdate;
private final SerializedSubject<GuildJoinRequestCreateOrUpdate, GuildJoinRequestCreateOrUpdate> guildJoinRequestCreateOrUpdate;
private final SerializedSubject<GuildJoinRequestDelete, GuildJoinRequestDelete> guildJoinRequestDelete;
private final SerializedSubject<ModelGuildMemberListUpdate, ModelGuildMemberListUpdate> guildMemberListUpdate;
private final SerializedSubject<GuildMemberRemove, GuildMemberRemove> guildMemberRemove;
private final SerializedSubject<GuildMember, GuildMember> guildMembersAdd;
private final SerializedSubject<GuildMembersChunk, GuildMembersChunk> guildMembersChunk;
private final SerializedSubject<GuildRoleCreate, GuildRoleCreate> guildRoleCreate;
private final SerializedSubject<GuildRoleDelete, GuildRoleDelete> guildRoleDelete;
private final SerializedSubject<GuildRoleUpdate, GuildRoleUpdate> guildRoleUpdate;
private final SerializedSubject<GuildScheduledEvent, GuildScheduledEvent> guildScheduledEventCreate;
private final SerializedSubject<GuildScheduledEvent, GuildScheduledEvent> guildScheduledEventDelete;
private final SerializedSubject<GuildScheduledEvent, GuildScheduledEvent> guildScheduledEventUpdate;
private final SerializedSubject<GuildScheduledEventUserUpdate, GuildScheduledEventUserUpdate> guildScheduledEventUserAdd;
private final SerializedSubject<GuildScheduledEventUserUpdate, GuildScheduledEventUserUpdate> guildScheduledEventUserRemove;
private final SerializedSubject<GuildStickersUpdate, GuildStickersUpdate> guildStickersUpdate;
private final SerializedSubject<Guild, Guild> guildUpdate;
private final SerializedSubject<InteractionStateUpdate, InteractionStateUpdate> interactionCreate;
private final SerializedSubject<InteractionStateUpdate, InteractionStateUpdate> interactionFailure;
private final SerializedSubject<InteractionStateUpdate, InteractionStateUpdate> interactionSuccess;
private final SerializedSubject<ModelReadState, ModelReadState> messageAck;
private final SerializedSubject<Message, Message> messageCreate;
private final SerializedSubject<ModelMessageDelete, ModelMessageDelete> messageDelete;
private final SerializedSubject<MessageReactionUpdate, MessageReactionUpdate> messageReactionAdd;
private final SerializedSubject<MessageReactionUpdate, MessageReactionUpdate> messageReactionRemove;
private final SerializedSubject<MessageReactionUpdate, MessageReactionUpdate> messageReactionRemoveAll;
private final SerializedSubject<MessageReactionUpdate, MessageReactionUpdate> messageReactionRemoveEmoji;
private final SerializedSubject<Message, Message> messageUpdate;
private final SerializedSubject<List<Presence>, List<Presence>> presenceReplace;
private final SerializedSubject<Presence, Presence> presenceUpdate;
private final SerializedSubject<ModelPayload, ModelPayload> ready;
private final SerializedSubject<ModelUserRelationship, ModelUserRelationship> relationshipAdd;
private final SerializedSubject<ModelUserRelationship, ModelUserRelationship> relationshipRemove;
private final Scheduler scheduler;
private final SerializedSubject<List<ModelSession>, List<ModelSession>> sessionsReplace;
private GatewaySocket socket;
private final SerializedSubject<StageInstance, StageInstance> stageInstanceCreate;
private final SerializedSubject<StageInstance, StageInstance> stageInstanceDelete;
private final SerializedSubject<StageInstance, StageInstance> stageInstanceUpdate;
private final StoreStream stream;
private final SerializedSubject<StreamCreateOrUpdate, StreamCreateOrUpdate> streamCreate;
private final SerializedSubject<StreamDelete, StreamDelete> streamDelete;
private final SerializedSubject<StreamServerUpdate, StreamServerUpdate> streamServerUpdate;
private final SerializedSubject<StreamCreateOrUpdate, StreamCreateOrUpdate> streamUpdate;
private final SerializedSubject<Channel, Channel> threadCreateOrUpdate;
private final SerializedSubject<Channel, Channel> threadDelete;
private final SerializedSubject<ModelThreadListSync, ModelThreadListSync> threadListSync;
private final SerializedSubject<ThreadMemberListUpdate, ThreadMemberListUpdate> threadMemberListUpdate;
private final SerializedSubject<ThreadMemberUpdate, ThreadMemberUpdate> threadMemberUpdate;
private final SerializedSubject<ThreadMembersUpdate, ThreadMembersUpdate> threadMembersUpdate;
private final SerializedSubject<TypingUser, TypingUser> typingStart;
private final SerializedSubject<Unit, Unit> userConnectionUpdate;
private final SerializedSubject<ModelNotificationSettings, ModelNotificationSettings> userGuildSettingsUpdate;
private final SerializedSubject<ModelUserNote.Update, ModelUserNote.Update> userNoteUpdate;
private final SerializedSubject<Unit, Unit> userPaymentSourcesUpdate;
private final SerializedSubject<UserRequiredActionUpdate, UserRequiredActionUpdate> userRequiredActionUpdate;
private final SerializedSubject<ModelUserSettings, ModelUserSettings> userSettingsUpdate;
private final SerializedSubject<Unit, Unit> userSubscriptionsUpdate;
private final SerializedSubject<User, User> userUpdate;
private final SerializedSubject<VoiceServer, VoiceServer> voiceServerUpdate;
private final Batched<VoiceState> voiceStateUpdate;
/* compiled from: StoreGatewayConnection.kt */
public static final class ClientState {
public static final Companion Companion = new Companion(null);
private final boolean authed;
private final StoreClientDataState.ClientDataState clientDataState;
private final String tokenIfAvailable;
/* compiled from: StoreGatewayConnection.kt */
public static final class Companion {
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
public static final /* synthetic */ ClientState access$create(Companion companion, boolean z2, String str, long j, boolean z3, StoreClientDataState.ClientDataState clientDataState) {
return companion.create(z2, str, j, z3, clientDataState);
}
private final ClientState create(boolean z2, String str, long j, boolean z3, StoreClientDataState.ClientDataState clientDataState) {
boolean z4 = str != null;
if (z2 && j <= 0 && !z3) {
str = null;
}
return new ClientState(str, z4, clientDataState);
}
public final void initialize(StoreStream storeStream, Scheduler scheduler, Function1<? super ClientState, Unit> function1) {
m.checkNotNullParameter(storeStream, "stream");
m.checkNotNullParameter(scheduler, "scheduler");
m.checkNotNullParameter(function1, "callback");
Observable<Boolean> a = d.d.a();
Observable<String> authedToken$app_productionCanaryRelease = storeStream.getAuthentication$app_productionCanaryRelease().getAuthedToken$app_productionCanaryRelease();
Observable<Long> observeSelectedVoiceChannelId = storeStream.getVoiceChannelSelected$app_productionCanaryRelease().observeSelectedVoiceChannelId();
l lVar = l.f47c;
Observable q = l.b.F(k.j).q();
m.checkNotNullExpressionValue(q, "numGatewayConnectionCons… .distinctUntilChanged()");
Observable g = Observable.g(a, authedToken$app_productionCanaryRelease, observeSelectedVoiceChannelId, q, storeStream.getClientDataState$app_productionCanaryRelease().observeClientState(), new StoreGatewayConnection$sam$rx_functions_Func5$0(new StoreGatewayConnection$ClientState$Companion$initialize$1(this)));
m.checkNotNullExpressionValue(g, "Observable\n .… ::create\n )");
Observable I = ObservableExtensionsKt.computationLatest(g).I(scheduler);
m.checkNotNullExpressionValue(I, "Observable\n .… .observeOn(scheduler)");
ObservableExtensionsKt.appSubscribe$default(I, (Context) null, "clientState", (Function1) null, function1, (Function1) null, (Function0) null, (Function0) null, 117, (Object) null);
}
}
public ClientState(String str, boolean z2, StoreClientDataState.ClientDataState clientDataState) {
m.checkNotNullParameter(clientDataState, "clientDataState");
this.tokenIfAvailable = str;
this.authed = z2;
this.clientDataState = clientDataState;
}
public static /* synthetic */ ClientState copy$default(ClientState clientState, String str, boolean z2, StoreClientDataState.ClientDataState clientDataState, int i, Object obj) {
if ((i & 1) != 0) {
str = clientState.tokenIfAvailable;
}
if ((i & 2) != 0) {
z2 = clientState.authed;
}
if ((i & 4) != 0) {
clientDataState = clientState.clientDataState;
}
return clientState.copy(str, z2, clientDataState);
}
public final String component1() {
return this.tokenIfAvailable;
}
public final boolean component2() {
return this.authed;
}
public final StoreClientDataState.ClientDataState component3() {
return this.clientDataState;
}
public final ClientState copy(String str, boolean z2, StoreClientDataState.ClientDataState clientDataState) {
m.checkNotNullParameter(clientDataState, "clientDataState");
return new ClientState(str, z2, clientDataState);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof ClientState)) {
return false;
}
ClientState clientState = (ClientState) obj;
return m.areEqual(this.tokenIfAvailable, clientState.tokenIfAvailable) && this.authed == clientState.authed && m.areEqual(this.clientDataState, clientState.clientDataState);
}
public final boolean getAuthed() {
return this.authed;
}
public final StoreClientDataState.ClientDataState getClientDataState() {
return this.clientDataState;
}
public final GatewaySocket.IdentifyData getIdentifyData() {
String str = this.tokenIfAvailable;
if (str != null) {
return new GatewaySocket.IdentifyData(str, this.clientDataState.toIdentifyData());
}
return null;
}
public final String getTokenIfAvailable() {
return this.tokenIfAvailable;
}
public int hashCode() {
String str = this.tokenIfAvailable;
int i = 0;
int hashCode = (str != null ? str.hashCode() : 0) * 31;
boolean z2 = this.authed;
if (z2) {
z2 = true;
}
int i2 = z2 ? 1 : 0;
int i3 = z2 ? 1 : 0;
int i4 = z2 ? 1 : 0;
int i5 = (hashCode + i2) * 31;
StoreClientDataState.ClientDataState clientDataState = this.clientDataState;
if (clientDataState != null) {
i = clientDataState.hashCode();
}
return i5 + i;
}
public String toString() {
StringBuilder R = a.R("ClientState(tokenIfAvailable=");
R.append(this.tokenIfAvailable);
R.append(", authed=");
R.append(this.authed);
R.append(", clientDataState=");
R.append(this.clientDataState);
R.append(")");
return R.toString();
}
}
public StoreGatewayConnection(StoreStream storeStream, Clock clock, AppGatewaySocketLogger appGatewaySocketLogger) {
this(storeStream, clock, null, null, appGatewaySocketLogger, 12, null);
}
public StoreGatewayConnection(StoreStream storeStream, Clock clock, ExecutorService executorService, AppGatewaySocketLogger appGatewaySocketLogger) {
this(storeStream, clock, executorService, null, appGatewaySocketLogger, 8, null);
}
public StoreGatewayConnection(StoreStream storeStream, Clock clock, ExecutorService executorService, Scheduler scheduler, AppGatewaySocketLogger appGatewaySocketLogger) {
m.checkNotNullParameter(storeStream, "stream");
m.checkNotNullParameter(clock, "clock");
m.checkNotNullParameter(executorService, "executor");
m.checkNotNullParameter(scheduler, "scheduler");
m.checkNotNullParameter(appGatewaySocketLogger, "gatewaySocketLogger");
this.stream = storeStream;
this.clock = clock;
this.executor = executorService;
this.scheduler = scheduler;
this.gatewaySocketLogger = appGatewaySocketLogger;
w0 w0Var = new w0(executorService);
this.coroutineDispatcher = w0Var;
BatchManager batchManager = new BatchManager(w0Var, null, 2, null);
this.batches = batchManager;
Boolean bool = Boolean.FALSE;
this.connected = new SerializedSubject<>(BehaviorSubject.l0(bool));
this.connectionReady = new SerializedSubject<>(BehaviorSubject.l0(bool));
this.callCreateOrUpdate = new SerializedSubject<>(BehaviorSubject.k0());
this.callDelete = new SerializedSubject<>(BehaviorSubject.k0());
this.channelCreateOrUpdate = new SerializedSubject<>(BehaviorSubject.k0());
this.channelDeleted = new SerializedSubject<>(BehaviorSubject.k0());
this.channelRecipientAdd = new SerializedSubject<>(BehaviorSubject.k0());
this.channelRecipientRemove = new SerializedSubject<>(BehaviorSubject.k0());
this.channelUnreadUpdate = new SerializedSubject<>(BehaviorSubject.k0());
this.embeddedActivityInboundUpdate = new SerializedSubject<>(BehaviorSubject.k0());
this.guildApplicationCommands = new SerializedSubject<>(BehaviorSubject.k0());
this.guildBanAdd = new SerializedSubject<>(PublishSubject.k0());
this.guildBanRemove = new SerializedSubject<>(PublishSubject.k0());
this.guildCreate = new SerializedSubject<>(BehaviorSubject.k0());
this.guildUpdate = new SerializedSubject<>(BehaviorSubject.k0());
this.guildEmojisUpdate = new SerializedSubject<>(BehaviorSubject.k0());
this.guildStickersUpdate = new SerializedSubject<>(BehaviorSubject.k0());
this.guildDeleted = new SerializedSubject<>(BehaviorSubject.k0());
this.guildMembersAdd = new SerializedSubject<>(BehaviorSubject.k0());
this.guildMembersChunk = new SerializedSubject<>(BehaviorSubject.k0());
this.guildMemberRemove = new SerializedSubject<>(BehaviorSubject.k0());
this.guildJoinRequestCreateOrUpdate = new SerializedSubject<>(BehaviorSubject.k0());
this.guildJoinRequestDelete = new SerializedSubject<>(BehaviorSubject.k0());
this.guildRoleCreate = new SerializedSubject<>(BehaviorSubject.k0());
this.guildRoleUpdate = new SerializedSubject<>(BehaviorSubject.k0());
this.guildRoleDelete = new SerializedSubject<>(BehaviorSubject.k0());
this.guildIntegrationsUpdate = new SerializedSubject<>(PublishSubject.k0());
this.messageAck = new SerializedSubject<>(BehaviorSubject.k0());
this.messageCreate = new SerializedSubject<>(BehaviorSubject.k0());
this.messageDelete = new SerializedSubject<>(BehaviorSubject.k0());
this.messageUpdate = new SerializedSubject<>(BehaviorSubject.k0());
this.messageReactionAdd = new SerializedSubject<>(BehaviorSubject.k0());
this.messageReactionRemove = new SerializedSubject<>(BehaviorSubject.k0());
this.messageReactionRemoveEmoji = new SerializedSubject<>(BehaviorSubject.k0());
this.messageReactionRemoveAll = new SerializedSubject<>(BehaviorSubject.k0());
this.presenceUpdate = new SerializedSubject<>(BehaviorSubject.k0());
this.presenceReplace = new SerializedSubject<>(BehaviorSubject.k0());
this.ready = new SerializedSubject<>(BehaviorSubject.k0());
this.relationshipAdd = new SerializedSubject<>(BehaviorSubject.k0());
this.relationshipRemove = new SerializedSubject<>(BehaviorSubject.k0());
this.typingStart = new SerializedSubject<>(BehaviorSubject.k0());
this.userConnectionUpdate = new SerializedSubject<>(BehaviorSubject.k0());
this.userUpdate = new SerializedSubject<>(BehaviorSubject.k0());
this.userSettingsUpdate = new SerializedSubject<>(BehaviorSubject.k0());
this.userGuildSettingsUpdate = new SerializedSubject<>(BehaviorSubject.k0());
this.userNoteUpdate = new SerializedSubject<>(BehaviorSubject.k0());
this.userRequiredActionUpdate = new SerializedSubject<>(BehaviorSubject.k0());
this.sessionsReplace = new SerializedSubject<>(BehaviorSubject.k0());
this.voiceStateUpdate = BatchManager.createBatched$default(batchManager, "VOICE_STATE_UPDATE", 0, 0, 6, null);
this.voiceServerUpdate = new SerializedSubject<>(BehaviorSubject.k0());
this.guildMemberListUpdate = new SerializedSubject<>(BehaviorSubject.k0());
this.userPaymentSourcesUpdate = new SerializedSubject<>(BehaviorSubject.k0());
this.userSubscriptionsUpdate = new SerializedSubject<>(BehaviorSubject.k0());
this.streamCreate = new SerializedSubject<>(BehaviorSubject.k0());
this.streamUpdate = new SerializedSubject<>(BehaviorSubject.k0());
this.streamServerUpdate = new SerializedSubject<>(BehaviorSubject.k0());
this.streamDelete = new SerializedSubject<>(BehaviorSubject.k0());
this.threadCreateOrUpdate = new SerializedSubject<>(BehaviorSubject.k0());
this.threadDelete = new SerializedSubject<>(BehaviorSubject.k0());
this.threadListSync = new SerializedSubject<>(BehaviorSubject.k0());
this.threadMemberUpdate = new SerializedSubject<>(BehaviorSubject.k0());
this.threadMembersUpdate = new SerializedSubject<>(BehaviorSubject.k0());
this.threadMemberListUpdate = new SerializedSubject<>(BehaviorSubject.k0());
this.interactionCreate = new SerializedSubject<>(BehaviorSubject.k0());
this.interactionSuccess = new SerializedSubject<>(BehaviorSubject.k0());
this.interactionFailure = new SerializedSubject<>(BehaviorSubject.k0());
this.applicationCommandAutocompleteResult = new SerializedSubject<>(BehaviorSubject.k0());
this.stageInstanceCreate = new SerializedSubject<>(BehaviorSubject.k0());
this.stageInstanceUpdate = new SerializedSubject<>(BehaviorSubject.k0());
this.stageInstanceDelete = new SerializedSubject<>(BehaviorSubject.k0());
this.friendSuggestionCreate = new SerializedSubject<>(BehaviorSubject.k0());
this.friendSuggestionDelete = new SerializedSubject<>(BehaviorSubject.k0());
this.guildScheduledEventCreate = new SerializedSubject<>(BehaviorSubject.k0());
this.guildScheduledEventUpdate = new SerializedSubject<>(BehaviorSubject.k0());
this.guildScheduledEventDelete = new SerializedSubject<>(BehaviorSubject.k0());
this.guildScheduledEventUserAdd = new SerializedSubject<>(BehaviorSubject.k0());
this.guildScheduledEventUserRemove = new SerializedSubject<>(BehaviorSubject.k0());
}
/* JADX WARNING: Illegal instructions before constructor call */
public StoreGatewayConnection(StoreStream storeStream, Clock clock, ExecutorService executorService, Scheduler scheduler, AppGatewaySocketLogger appGatewaySocketLogger, int i, DefaultConstructorMarker defaultConstructorMarker) {
this(storeStream, clock, executorService, scheduler, appGatewaySocketLogger);
if ((i & 4) != 0) {
executorService = Executors.newFixedThreadPool(1);
m.checkNotNullExpressionValue(executorService, "Executors.newFixedThreadPool(1)");
}
if ((i & 8) != 0) {
AtomicReference<j0.p.a> atomicReference = j0.p.a.a;
scheduler = new c(executorService);
m.checkNotNullExpressionValue(scheduler, "Schedulers.from(executor)");
}
}
public static final /* synthetic */ GatewaySocket.IdentifyData access$getIdentifyData(StoreGatewayConnection storeGatewayConnection) {
return storeGatewayConnection.getIdentifyData();
}
public static final /* synthetic */ StoreStream access$getStream$p(StoreGatewayConnection storeGatewayConnection) {
return storeGatewayConnection.stream;
}
public static final /* synthetic */ void access$handleClientStateUpdate(StoreGatewayConnection storeGatewayConnection, ClientState clientState) {
storeGatewayConnection.handleClientStateUpdate(clientState);
}
private final GatewaySocket buildGatewaySocket(Context context, NetworkMonitor networkMonitor) {
RestAPI.Companion companion = RestAPI.Companion;
List listOf = n.listOf((Object[]) new Interceptor[]{companion.buildAnalyticsInterceptor(), companion.buildLoggingInterceptor()});
App.a aVar = App.Companion;
Objects.requireNonNull(aVar);
SSLSocketFactory createSocketFactory$default = App.access$getIS_LOCAL$cp() ? null : SecureSocketsLayerUtils.createSocketFactory$default(null, 1, null);
Objects.requireNonNull(aVar);
GatewaySocket gatewaySocket = new GatewaySocket(new StoreGatewayConnection$buildGatewaySocket$socket$1(this), StoreGatewayConnection$buildGatewaySocket$socket$2.INSTANCE, this, this.scheduler, AppLog.g, networkMonitor, new RestConfig(BuildConfig.HOST_API, RestAPI.AppHeadersProvider.INSTANCE, listOf), context, App.access$getIS_LOCAL$cp() ? StoreGatewayConnection$buildGatewaySocket$gatewayUrlTransform$1.INSTANCE : null, createSocketFactory$default, AnalyticSuperProperties.INSTANCE.getSuperProperties(), this.gatewaySocketLogger);
this.stream.getConnectionTimeStats$app_productionCanaryRelease().addListener(gatewaySocket);
return gatewaySocket;
}
private final GatewaySocket.IdentifyData getIdentifyData() {
ClientState clientState = this.clientState;
if (clientState != null) {
return clientState.getIdentifyData();
}
return null;
}
private final void handleClientStateUpdate(ClientState clientState) {
this.clientState = clientState;
if (clientState.getTokenIfAvailable() != null) {
GatewaySocket gatewaySocket = this.socket;
if (gatewaySocket != null) {
gatewaySocket.connect();
return;
}
return;
}
GatewaySocket gatewaySocket2 = this.socket;
if (gatewaySocket2 != null) {
gatewaySocket2.close(!clientState.getAuthed());
}
}
private final <T> void onNext(SerializedSubject<T, T> serializedSubject, Object obj) {
serializedSubject.k.onNext(obj);
}
/* JADX DEBUG: Multi-variable search result rejected for r2v0, resolved type: com.discord.stores.StoreGatewayConnection */
/* JADX WARN: Multi-variable type inference failed */
public static /* synthetic */ boolean presenceUpdate$default(StoreGatewayConnection storeGatewayConnection, ClientStatus clientStatus, Long l, List list, Boolean bool, int i, Object obj) {
if ((i & 2) != 0) {
l = Long.valueOf(storeGatewayConnection.clock.currentTimeMillis());
}
if ((i & 4) != 0) {
list = null;
}
if ((i & 8) != 0) {
bool = null;
}
return storeGatewayConnection.presenceUpdate(clientStatus, l, list, bool);
}
public static /* synthetic */ boolean requestApplicationCommands$default(StoreGatewayConnection storeGatewayConnection, long j, String str, boolean z2, String str2, Integer num, int i, List list, int i2, Object obj) {
return storeGatewayConnection.requestApplicationCommands(j, str, z2, (i2 & 8) != 0 ? null : str2, (i2 & 16) != 0 ? null : num, i, (i2 & 64) != 0 ? null : list);
}
public static /* synthetic */ boolean requestGuildMembers$default(StoreGatewayConnection storeGatewayConnection, long j, String str, List list, Integer num, int i, Object obj) {
String str2 = (i & 2) != 0 ? null : str;
List list2 = (i & 4) != 0 ? null : list;
if ((i & 8) != 0) {
num = 100;
}
return storeGatewayConnection.requestGuildMembers(j, str2, list2, num);
}
private final boolean requestIfSessionEstablished(Function1<? super GatewaySocket, Unit> function1) {
GatewaySocket gatewaySocket = this.socket;
if (gatewaySocket == null) {
return false;
}
boolean isSessionEstablished = gatewaySocket.isSessionEstablished();
if (isSessionEstablished) {
function1.invoke(gatewaySocket);
}
return isSessionEstablished;
}
private final void streamPing(String str) {
requestIfSessionEstablished(new StoreGatewayConnection$streamPing$1(str));
}
private final void voiceServerPing() {
requestIfSessionEstablished(StoreGatewayConnection$voiceServerPing$1.INSTANCE);
}
public static /* synthetic */ boolean voiceStateUpdate$default(StoreGatewayConnection storeGatewayConnection, Long l, Long l2, boolean z2, boolean z3, boolean z4, String str, boolean z5, int i, Object obj) {
return storeGatewayConnection.voiceStateUpdate(l, l2, z2, z3, z4, (i & 32) != 0 ? null : str, (i & 64) != 0 ? true : z5);
}
public final boolean callConnect(long j) {
return requestIfSessionEstablished(new StoreGatewayConnection$callConnect$1(j));
}
public final SerializedSubject<ApplicationCommandAutocompleteResult, ApplicationCommandAutocompleteResult> getApplicationCommandAutocompleteResult() {
return this.applicationCommandAutocompleteResult;
}
public final SerializedSubject<ModelCall, ModelCall> getCallCreateOrUpdate() {
return this.callCreateOrUpdate;
}
public final SerializedSubject<ModelCall, ModelCall> getCallDelete() {
return this.callDelete;
}
public final SerializedSubject<Channel, Channel> getChannelCreateOrUpdate() {
return this.channelCreateOrUpdate;
}
public final SerializedSubject<Channel, Channel> getChannelDeleted() {
return this.channelDeleted;
}
public final SerializedSubject<ChannelRecipient, ChannelRecipient> getChannelRecipientAdd() {
return this.channelRecipientAdd;
}
public final SerializedSubject<ChannelRecipient, ChannelRecipient> getChannelRecipientRemove() {
return this.channelRecipientRemove;
}
public final SerializedSubject<ModelChannelUnreadUpdate, ModelChannelUnreadUpdate> getChannelUnreadUpdate() {
return this.channelUnreadUpdate;
}
public final Observable<Boolean> getConnected() {
Observable<Boolean> q = this.connected.q();
m.checkNotNullExpressionValue(q, "connected.distinctUntilChanged()");
return q;
}
public final Observable<Boolean> getConnectionReady() {
Observable<Boolean> q = this.connectionReady.q();
m.checkNotNullExpressionValue(q, "connectionReady.distinctUntilChanged()");
return q;
}
public final ExecutorCoroutineDispatcher getCoroutineDispatcher() {
return this.coroutineDispatcher;
}
public final SerializedSubject<EmbeddedActivityInboundUpdate, EmbeddedActivityInboundUpdate> getEmbeddedActivityInboundUpdate() {
return this.embeddedActivityInboundUpdate;
}
public final SerializedSubject<FriendSuggestion, FriendSuggestion> getFriendSuggestionCreate() {
return this.friendSuggestionCreate;
}
public final SerializedSubject<FriendSuggestionDelete, FriendSuggestionDelete> getFriendSuggestionDelete() {
return this.friendSuggestionDelete;
}
public final SerializedSubject<GuildApplicationCommands, GuildApplicationCommands> getGuildApplicationCommands() {
return this.guildApplicationCommands;
}
public final SerializedSubject<ModelBan, ModelBan> getGuildBanAdd() {
return this.guildBanAdd;
}
public final SerializedSubject<ModelBan, ModelBan> getGuildBanRemove() {
return this.guildBanRemove;
}
public final SerializedSubject<Guild, Guild> getGuildCreate() {
return this.guildCreate;
}
public final SerializedSubject<Guild, Guild> getGuildDeleted() {
return this.guildDeleted;
}
public final SerializedSubject<GuildEmojisUpdate, GuildEmojisUpdate> getGuildEmojisUpdate() {
return this.guildEmojisUpdate;
}
public final SerializedSubject<ModelGuildIntegration.Update, ModelGuildIntegration.Update> getGuildIntegrationsUpdate() {
return this.guildIntegrationsUpdate;
}
public final SerializedSubject<GuildJoinRequestCreateOrUpdate, GuildJoinRequestCreateOrUpdate> getGuildJoinRequestCreateOrUpdate() {
return this.guildJoinRequestCreateOrUpdate;
}
public final SerializedSubject<GuildJoinRequestDelete, GuildJoinRequestDelete> getGuildJoinRequestDelete() {
return this.guildJoinRequestDelete;
}
public final SerializedSubject<ModelGuildMemberListUpdate, ModelGuildMemberListUpdate> getGuildMemberListUpdate() {
return this.guildMemberListUpdate;
}
public final SerializedSubject<GuildMemberRemove, GuildMemberRemove> getGuildMemberRemove() {
return this.guildMemberRemove;
}
public final SerializedSubject<GuildMember, GuildMember> getGuildMembersAdd() {
return this.guildMembersAdd;
}
public final SerializedSubject<GuildMembersChunk, GuildMembersChunk> getGuildMembersChunk() {
return this.guildMembersChunk;
}
public final SerializedSubject<GuildRoleCreate, GuildRoleCreate> getGuildRoleCreate() {
return this.guildRoleCreate;
}
public final SerializedSubject<GuildRoleDelete, GuildRoleDelete> getGuildRoleDelete() {
return this.guildRoleDelete;
}
public final SerializedSubject<GuildRoleUpdate, GuildRoleUpdate> getGuildRoleUpdate() {
return this.guildRoleUpdate;
}
public final SerializedSubject<GuildScheduledEvent, GuildScheduledEvent> getGuildScheduledEventCreate() {
return this.guildScheduledEventCreate;
}
public final SerializedSubject<GuildScheduledEvent, GuildScheduledEvent> getGuildScheduledEventDelete() {
return this.guildScheduledEventDelete;
}
public final SerializedSubject<GuildScheduledEvent, GuildScheduledEvent> getGuildScheduledEventUpdate() {
return this.guildScheduledEventUpdate;
}
public final SerializedSubject<GuildScheduledEventUserUpdate, GuildScheduledEventUserUpdate> getGuildScheduledEventUserAdd() {
return this.guildScheduledEventUserAdd;
}
public final SerializedSubject<GuildScheduledEventUserUpdate, GuildScheduledEventUserUpdate> getGuildScheduledEventUserRemove() {
return this.guildScheduledEventUserRemove;
}
public final SerializedSubject<GuildStickersUpdate, GuildStickersUpdate> getGuildStickersUpdate() {
return this.guildStickersUpdate;
}
public final SerializedSubject<Guild, Guild> getGuildUpdate() {
return this.guildUpdate;
}
public final SerializedSubject<InteractionStateUpdate, InteractionStateUpdate> getInteractionCreate() {
return this.interactionCreate;
}
public final SerializedSubject<InteractionStateUpdate, InteractionStateUpdate> getInteractionFailure() {
return this.interactionFailure;
}
public final SerializedSubject<InteractionStateUpdate, InteractionStateUpdate> getInteractionSuccess() {
return this.interactionSuccess;
}
public final SerializedSubject<ModelReadState, ModelReadState> getMessageAck() {
return this.messageAck;
}
public final SerializedSubject<Message, Message> getMessageCreate() {
return this.messageCreate;
}
public final SerializedSubject<ModelMessageDelete, ModelMessageDelete> getMessageDelete() {
return this.messageDelete;
}
public final SerializedSubject<MessageReactionUpdate, MessageReactionUpdate> getMessageReactionAdd() {
return this.messageReactionAdd;
}
public final SerializedSubject<MessageReactionUpdate, MessageReactionUpdate> getMessageReactionRemove() {
return this.messageReactionRemove;
}
public final SerializedSubject<MessageReactionUpdate, MessageReactionUpdate> getMessageReactionRemoveAll() {
return this.messageReactionRemoveAll;
}
public final SerializedSubject<MessageReactionUpdate, MessageReactionUpdate> getMessageReactionRemoveEmoji() {
return this.messageReactionRemoveEmoji;
}
public final SerializedSubject<Message, Message> getMessageUpdate() {
return this.messageUpdate;
}
public final SerializedSubject<List<Presence>, List<Presence>> getPresenceReplace() {
return this.presenceReplace;
}
public final SerializedSubject<Presence, Presence> getPresenceUpdate() {
return this.presenceUpdate;
}
public final SerializedSubject<ModelPayload, ModelPayload> getReady() {
return this.ready;
}
public final SerializedSubject<ModelUserRelationship, ModelUserRelationship> getRelationshipAdd() {
return this.relationshipAdd;
}
public final SerializedSubject<ModelUserRelationship, ModelUserRelationship> getRelationshipRemove() {
return this.relationshipRemove;
}
public final SerializedSubject<List<ModelSession>, List<ModelSession>> getSessionsReplace() {
return this.sessionsReplace;
}
public final SerializedSubject<StageInstance, StageInstance> getStageInstanceCreate() {
return this.stageInstanceCreate;
}
public final SerializedSubject<StageInstance, StageInstance> getStageInstanceDelete() {
return this.stageInstanceDelete;
}
public final SerializedSubject<StageInstance, StageInstance> getStageInstanceUpdate() {
return this.stageInstanceUpdate;
}
public final SerializedSubject<StreamCreateOrUpdate, StreamCreateOrUpdate> getStreamCreate() {
return this.streamCreate;
}
public final SerializedSubject<StreamDelete, StreamDelete> getStreamDelete() {
return this.streamDelete;
}
public final SerializedSubject<StreamServerUpdate, StreamServerUpdate> getStreamServerUpdate() {
return this.streamServerUpdate;
}
public final SerializedSubject<StreamCreateOrUpdate, StreamCreateOrUpdate> getStreamUpdate() {
return this.streamUpdate;
}
public final SerializedSubject<Channel, Channel> getThreadCreateOrUpdate() {
return this.threadCreateOrUpdate;
}
public final SerializedSubject<Channel, Channel> getThreadDelete() {
return this.threadDelete;
}
public final SerializedSubject<ModelThreadListSync, ModelThreadListSync> getThreadListSync() {
return this.threadListSync;
}
public final SerializedSubject<ThreadMemberListUpdate, ThreadMemberListUpdate> getThreadMemberListUpdate() {
return this.threadMemberListUpdate;
}
public final SerializedSubject<ThreadMemberUpdate, ThreadMemberUpdate> getThreadMemberUpdate() {
return this.threadMemberUpdate;
}
public final SerializedSubject<ThreadMembersUpdate, ThreadMembersUpdate> getThreadMembersUpdate() {
return this.threadMembersUpdate;
}
public final SerializedSubject<TypingUser, TypingUser> getTypingStart() {
return this.typingStart;
}
public final SerializedSubject<Unit, Unit> getUserConnectionUpdate() {
return this.userConnectionUpdate;
}
public final SerializedSubject<ModelNotificationSettings, ModelNotificationSettings> getUserGuildSettingsUpdate() {
return this.userGuildSettingsUpdate;
}
public final SerializedSubject<ModelUserNote.Update, ModelUserNote.Update> getUserNoteUpdate() {
return this.userNoteUpdate;
}
public final SerializedSubject<Unit, Unit> getUserPaymentSourcesUpdate() {
return this.userPaymentSourcesUpdate;
}
public final SerializedSubject<UserRequiredActionUpdate, UserRequiredActionUpdate> getUserRequiredActionUpdate() {
return this.userRequiredActionUpdate;
}
public final SerializedSubject<ModelUserSettings, ModelUserSettings> getUserSettingsUpdate() {
return this.userSettingsUpdate;
}
public final SerializedSubject<Unit, Unit> getUserSubscriptionsUpdate() {
return this.userSubscriptionsUpdate;
}
public final SerializedSubject<User, User> getUserUpdate() {
return this.userUpdate;
}
public final SerializedSubject<VoiceServer, VoiceServer> getVoiceServerUpdate() {
return this.voiceServerUpdate;
}
public final Batched<VoiceState> getVoiceStateUpdate() {
return this.voiceStateUpdate;
}
@Override // com.discord.gateway.GatewayEventHandler
public void handleConnected(boolean z2) {
SerializedSubject<Boolean, Boolean> serializedSubject = this.connected;
serializedSubject.k.onNext(Boolean.valueOf(z2));
}
@Override // com.discord.gateway.GatewayEventHandler
public void handleConnectionReady(boolean z2) {
SerializedSubject<Boolean, Boolean> serializedSubject = this.connectionReady;
serializedSubject.k.onNext(Boolean.valueOf(z2));
}
@Override // com.discord.gateway.GatewayEventHandler
public void handleDisconnect(boolean z2) {
if (z2) {
this.stream.getAuthentication$app_productionCanaryRelease().logout();
}
}
@Override // com.discord.gateway.GatewayEventHandler
public void handleDispatch(String str, Object obj) {
m.checkNotNullParameter(obj, "data");
this.batches.flushBatches(str);
if (str != null) {
switch (str.hashCode()) {
case -2137365335:
if (str.equals("MESSAGE_REACTION_REMOVE_EMOJI")) {
this.messageReactionRemoveEmoji.k.onNext(obj);
return;
}
return;
case -2067017195:
if (!str.equals("GUILD_JOIN_REQUEST_CREATE")) {
return;
}
this.guildJoinRequestCreateOrUpdate.k.onNext(obj);
return;
case -2050181436:
if (str.equals("GUILD_JOIN_REQUEST_DELETE")) {
this.guildJoinRequestDelete.k.onNext(obj);
return;
}
return;
case -2026522382:
if (str.equals("SESSIONS_REPLACE")) {
this.sessionsReplace.k.onNext(obj);
return;
}
return;
case -2002723137:
if (str.equals("GUILD_SCHEDULED_EVENT_CREATE")) {
this.guildScheduledEventCreate.k.onNext(obj);
return;
}
return;
case -1985887378:
if (str.equals("GUILD_SCHEDULED_EVENT_DELETE")) {
this.guildScheduledEventDelete.k.onNext(obj);
return;
}
return;
case -1967037287:
if (str.equals("THREAD_MEMBER_UPDATE")) {
this.threadMemberUpdate.k.onNext(obj);
return;
}
return;
case -1921449515:
if (str.equals("APPLICATION_COMMAND_AUTOCOMPLETE_RESPONSE")) {
this.applicationCommandAutocompleteResult.k.onNext(obj);
return;
}
return;
case -1862771270:
if (str.equals("THREAD_MEMBER_LIST_UPDATE")) {
this.threadMemberListUpdate.k.onNext(obj);
return;
}
return;
case -1825641445:
if (str.equals("GUILD_MEMBERS_CHUNK")) {
this.guildMembersChunk.k.onNext(obj);
return;
}
return;
case -1580624828:
if (str.equals("EMBEDDED_ACTIVITY_UPDATE")) {
this.embeddedActivityInboundUpdate.k.onNext(obj);
return;
}
return;
case -1553569310:
if (!str.equals("GUILD_JOIN_REQUEST_UPDATE")) {
return;
}
this.guildJoinRequestCreateOrUpdate.k.onNext(obj);
return;
case -1553064252:
if (str.equals("MESSAGE_REACTION_REMOVE_ALL")) {
this.messageReactionRemoveAll.k.onNext(obj);
return;
}
return;
case -1489275252:
if (str.equals(NotificationData.TYPE_GUILD_SCHEDULED_EVENT_UPDATE)) {
this.guildScheduledEventUpdate.k.onNext(obj);
return;
}
return;
case -1484942443:
if (str.equals("GUILD_SCHEDULED_EVENT_USER_REMOVE")) {
this.guildScheduledEventUserRemove.k.onNext(obj);
return;
}
return;
case -1467383482:
if (str.equals("USER_REQUIRED_ACTION_UPDATE")) {
this.userRequiredActionUpdate.k.onNext(obj);
return;
}
return;
case -1446088218:
if (str.equals("GUILD_STICKERS_UPDATE")) {
this.guildStickersUpdate.k.onNext(obj);
return;
}
return;
case -1327124998:
if (str.equals(NotificationData.TYPE_RELATIONSHIP_ADD)) {
this.relationshipAdd.k.onNext(obj);
return;
}
return;
case -1263316859:
if (str.equals(NotificationData.TYPE_STAGE_INSTANCE_CREATE)) {
this.stageInstanceCreate.k.onNext(obj);
return;
}
return;
case -1261304891:
if (str.equals("GUILD_BAN_ADD")) {
this.guildBanAdd.k.onNext(obj);
return;
}
return;
case -1248965304:
if (!str.equals("GUILD_MEMBER_ADD")) {
return;
}
this.guildMembersAdd.k.onNext(obj);
return;
case -1246481100:
if (str.equals("STAGE_INSTANCE_DELETE")) {
this.stageInstanceDelete.k.onNext(obj);
return;
}
return;
case -1238538557:
if (str.equals("MESSAGE_REACTION_ADD")) {
this.messageReactionAdd.k.onNext(obj);
return;
}
return;
case -1201943215:
if (str.equals("GUILD_MEMBER_LIST_UPDATE")) {
this.guildMemberListUpdate.k.onNext(obj);
return;
}
return;
case -974414266:
if (str.equals("USER_SUBSCRIPTIONS_UPDATE")) {
this.userSubscriptionsUpdate.k.onNext(obj);
return;
}
return;
case -960563390:
if (str.equals("USER_NOTE_UPDATE")) {
this.userNoteUpdate.k.onNext(obj);
return;
}
return;
case -903406451:
if (str.equals("PRESENCE_UPDATE")) {
this.presenceUpdate.k.onNext(obj);
return;
}
return;
case -850953239:
if (str.equals("INTERACTION_CREATE")) {
this.interactionCreate.k.onNext(obj);
return;
}
return;
case -843352707:
if (str.equals("GUILD_INTEGRATIONS_UPDATE")) {
this.guildIntegrationsUpdate.k.onNext(obj);
return;
}
return;
case -778017807:
if (str.equals("USER_SETTINGS_UPDATE")) {
this.userSettingsUpdate.k.onNext(obj);
return;
}
return;
case -767350043:
if (str.equals("GUILD_APPLICATION_COMMANDS_UPDATE")) {
this.guildApplicationCommands.k.onNext(obj);
return;
}
return;
case -749868974:
if (str.equals("STAGE_INSTANCE_UPDATE")) {
this.stageInstanceUpdate.k.onNext(obj);
return;
}
return;
case -718889877:
if (str.equals("RELATIONSHIP_REMOVE")) {
this.relationshipRemove.k.onNext(obj);
return;
}
return;
case -675064872:
if (!str.equals("CHANNEL_CREATE")) {
return;
}
this.channelCreateOrUpdate.k.onNext(obj);
return;
case -658229113:
if (str.equals("CHANNEL_DELETE")) {
this.channelDeleted.k.onNext(obj);
return;
}
return;
case -548091546:
if (str.equals("CHANNEL_RECIPIENT_REMOVE")) {
this.channelRecipientRemove.k.onNext(obj);
return;
}
return;
case -510741638:
if (str.equals("TYPING_START")) {
this.typingStart.k.onNext(obj);
return;
}
return;
case -300870211:
if (str.equals("USER_PAYMENT_SOURCES_UPDATE")) {
this.userPaymentSourcesUpdate.k.onNext(obj);
return;
}
return;
case -273749272:
if (str.equals("GUILD_CREATE")) {
this.guildCreate.k.onNext(obj);
return;
}
return;
case -256913513:
if (str.equals("GUILD_DELETE")) {
this.guildDeleted.k.onNext(obj);
return;
}
return;
case -233612803:
if (!str.equals("CALL_CREATE")) {
return;
}
this.callCreateOrUpdate.k.onNext(obj);
return;
case -216777044:
if (str.equals("CALL_DELETE")) {
this.callDelete.k.onNext(obj);
return;
}
return;
case -207118083:
if (str.equals("CHANNEL_UNREAD_UPDATE")) {
this.channelUnreadUpdate.k.onNext(obj);
return;
}
return;
case -161616987:
if (!str.equals("CHANNEL_UPDATE")) {
return;
}
this.channelCreateOrUpdate.k.onNext(obj);
return;
case -135720355:
if (str.equals("GUILD_MEMBER_REMOVE")) {
this.guildMemberRemove.k.onNext(obj);
return;
}
return;
case -107601202:
if (!str.equals("MESSAGE_DELETE_BULK")) {
return;
}
this.messageDelete.k.onNext(obj);
return;
case -45642698:
if (str.equals("FRIEND_SUGGESTION_CREATE")) {
this.friendSuggestionCreate.k.onNext(obj);
return;
}
return;
case -39955806:
if (!str.equals("GUILD_MEMBER_UPDATE")) {
return;
}
this.guildMembersAdd.k.onNext(obj);
return;
case -28806939:
if (str.equals("FRIEND_SUGGESTION_DELETE")) {
this.friendSuggestionDelete.k.onNext(obj);
return;
}
return;
case 77848963:
if (str.equals("READY")) {
this.ready.k.onNext(obj);
return;
}
return;
case 85547718:
if (str.equals("STREAM_SERVER_UPDATE")) {
this.streamServerUpdate.k.onNext(obj);
return;
}
return;
case 151900580:
if (str.equals("THREAD_MEMBERS_UPDATE")) {
this.threadMembersUpdate.k.onNext(obj);
return;
}
return;
case 239698613:
if (str.equals("GUILD_UPDATE")) {
this.guildUpdate.k.onNext(obj);
return;
}
return;
case 279835082:
if (!str.equals("CALL_UPDATE")) {
return;
}
this.callCreateOrUpdate.k.onNext(obj);
return;
case 391412669:
if (str.equals("USER_UPDATE")) {
this.userUpdate.k.onNext(obj);
return;
}
return;
case 789496470:
if (str.equals("INTERACTION_SUCCESS")) {
this.interactionSuccess.k.onNext(obj);
return;
}
return;
case 998188116:
if (str.equals(NotificationData.TYPE_MESSAGE_CREATE)) {
this.messageCreate.k.onNext(obj);
return;
}
return;
case 1015023875:
if (!str.equals("MESSAGE_DELETE")) {
return;
}
this.messageDelete.k.onNext(obj);
return;
case 1190664927:
if (str.equals("CHANNEL_RECIPIENT_ADD")) {
this.channelRecipientAdd.k.onNext(obj);
return;
}
return;
case 1249854210:
if (str.equals("MESSAGE_REACTION_REMOVE")) {
this.messageReactionRemove.k.onNext(obj);
return;
}
return;
case 1268388049:
if (!str.equals("THREAD_CREATE")) {
return;
}
this.threadCreateOrUpdate.k.onNext(obj);
return;
case 1276846319:
if (str.equals("GUILD_EMOJIS_UPDATE")) {
this.guildEmojisUpdate.k.onNext(obj);
return;
}
return;
case 1281125393:
if (str.equals("MESSAGE_ACK")) {
this.messageAck.k.onNext(obj);
return;
}
return;
case 1285223808:
if (str.equals("THREAD_DELETE")) {
this.threadDelete.k.onNext(obj);
return;
}
return;
case 1389895301:
if (str.equals("USER_GUILD_SETTINGS_UPDATE")) {
this.userGuildSettingsUpdate.k.onNext(obj);
return;
}
return;
case 1476675193:
if (str.equals("GUILD_ROLE_CREATE")) {
this.guildRoleCreate.k.onNext(obj);
return;
}
return;
case 1478484999:
if (str.equals("USER_CONNECTIONS_UPDATE")) {
SerializedSubject<Unit, Unit> serializedSubject = this.userConnectionUpdate;
serializedSubject.k.onNext(Unit.a);
return;
}
return;
case 1493510952:
if (str.equals("GUILD_ROLE_DELETE")) {
this.guildRoleDelete.k.onNext(obj);
return;
}
return;
case 1511636001:
if (str.equals("MESSAGE_UPDATE")) {
this.messageUpdate.k.onNext(obj);
return;
}
return;
case 1570092061:
if (str.equals("INTERACTION_FAILURE")) {
this.interactionFailure.k.onNext(obj);
return;
}
return;
case 1616207515:
if (str.equals("STREAM_CREATE")) {
this.streamCreate.k.onNext(obj);
return;
}
return;
case 1622830784:
if (str.equals("GUILD_BAN_REMOVE")) {
this.guildBanRemove.k.onNext(obj);
return;
}
return;
case 1633043274:
if (str.equals("STREAM_DELETE")) {
this.streamDelete.k.onNext(obj);
return;
}
return;
case 1689894925:
if (str.equals("PRESENCES_REPLACE")) {
this.presenceReplace.k.onNext(obj);
return;
}
return;
case 1699412580:
if (str.equals("VOICE_STATE_UPDATE")) {
this.voiceStateUpdate.onNext(obj);
return;
}
return;
case 1737758480:
if (str.equals("GUILD_SCHEDULED_EVENT_USER_ADD")) {
this.guildScheduledEventUserAdd.k.onNext(obj);
return;
}
return;
case 1781835934:
if (!str.equals("THREAD_UPDATE")) {
return;
}
this.threadCreateOrUpdate.k.onNext(obj);
return;
case 1882183896:
if (str.equals("VOICE_SERVER_UPDATE")) {
this.voiceServerUpdate.k.onNext(obj);
return;
}
return;
case 1928220071:
if (str.equals("THREAD_LIST_SYNC")) {
this.threadListSync.k.onNext(obj);
return;
}
return;
case 1990123078:
if (str.equals("GUILD_ROLE_UPDATE")) {
this.guildRoleUpdate.k.onNext(obj);
return;
}
return;
case 2129655400:
if (str.equals("STREAM_UPDATE")) {
this.streamUpdate.k.onNext(obj);
return;
}
return;
default:
return;
}
}
}
public final void handlePreLogout() {
voiceStateUpdate$default(this, null, null, false, false, false, null, false, 96, null);
}
public final void handleRtcConnectionStateChanged(RtcConnection.StateChange stateChange) {
m.checkNotNullParameter(stateChange, "stateChange");
RtcConnection.State state = stateChange.a;
if ((state instanceof RtcConnection.State.d) && ((RtcConnection.State.d) state).a) {
RtcConnection.Metadata metadata = stateChange.b;
String str = metadata != null ? metadata.e : null;
if (str instanceof String) {
streamPing(str);
} else {
voiceServerPing();
}
}
}
public final void init(Context context, NetworkMonitor networkMonitor) {
m.checkNotNullParameter(context, "context");
m.checkNotNullParameter(networkMonitor, "networkMonitor");
this.socket = buildGatewaySocket(context, networkMonitor);
ClientState.Companion.initialize(this.stream, this.scheduler, new StoreGatewayConnection$init$1(this));
}
public final boolean presenceUpdate(ClientStatus clientStatus, Long l, List<Activity> list, Boolean bool) {
return requestIfSessionEstablished(new StoreGatewayConnection$presenceUpdate$1(clientStatus, l, list, bool));
}
public final boolean requestApplicationCommands(long j, String str, boolean z2, String str2, Integer num, int i, List<String> list) {
m.checkNotNullParameter(str, "nonce");
return requestIfSessionEstablished(new StoreGatewayConnection$requestApplicationCommands$1(j, str, z2, num, str2, i, list));
}
public final boolean requestGuildMembers(long j) {
return requestGuildMembers$default(this, j, null, null, null, 14, null);
}
public final boolean requestGuildMembers(long j, String str) {
return requestGuildMembers$default(this, j, str, null, null, 12, null);
}
public final boolean requestGuildMembers(long j, String str, List<Long> list) {
return requestGuildMembers$default(this, j, str, list, null, 8, null);
}
public final boolean requestGuildMembers(long j, String str, List<Long> list, Integer num) {
return requestIfSessionEstablished(new StoreGatewayConnection$requestGuildMembers$1(j, str, list, num));
}
public final Unit resetOnError() {
GatewaySocket gatewaySocket = this.socket;
if (gatewaySocket == null) {
return null;
}
gatewaySocket.resetOnError();
return Unit.a;
}
public final void simulateReconnectForTesting() {
GatewaySocket gatewaySocket = this.socket;
if (gatewaySocket != null) {
gatewaySocket.simulateReconnectForTesting();
}
}
@StoreThread
public final void streamCreate(String str, String str2) {
m.checkNotNullParameter(str, "streamKey");
requestIfSessionEstablished(new StoreGatewayConnection$streamCreate$1(this, str, ModelApplicationStream.Companion.decodeStreamKey(str), str2));
}
public final void streamDelete(String str) {
m.checkNotNullParameter(str, "streamKey");
requestIfSessionEstablished(new StoreGatewayConnection$streamDelete$1(str));
}
@StoreThread
public final void streamWatch(String str) {
m.checkNotNullParameter(str, "streamKey");
requestIfSessionEstablished(new StoreGatewayConnection$streamWatch$1(this, str));
}
public final boolean updateGuildSubscriptions(long j, GuildSubscriptions guildSubscriptions) {
m.checkNotNullParameter(guildSubscriptions, "guildSubscriptions");
Map<Long, List<List<Integer>>> serializedRanges = guildSubscriptions.getSerializedRanges();
Boolean typing = guildSubscriptions.getTyping();
Boolean activities = guildSubscriptions.getActivities();
Boolean threads = guildSubscriptions.getThreads();
Set<Long> members = guildSubscriptions.getMembers();
return requestIfSessionEstablished(new StoreGatewayConnection$updateGuildSubscriptions$1(j, new OutgoingPayload.GuildSubscriptions(serializedRanges, typing, activities, members != null ? u.toList(members) : null, threads, guildSubscriptions.getThreadMemberLists())));
}
public final boolean voiceStateUpdate(Long l, Long l2, boolean z2, boolean z3, boolean z4, String str, boolean z5) {
return requestIfSessionEstablished(new StoreGatewayConnection$voiceStateUpdate$1(l, l2, z2, z3, z4, str, z5));
}
}