discord-jadx/app/src/main/java/com/discord/utilities/StoreUIEventHandler.java

120 lines
5.9 KiB
Java

package com.discord.utilities;
import android.content.Context;
import androidx.annotation.MainThread;
import c.a.d.o;
import com.airbnb.lottie.parser.AnimatableValueParser;
import com.discord.api.channel.Channel;
import com.discord.rtcconnection.KrispOveruseDetector;
import com.discord.stores.StoreChannels;
import com.discord.stores.StoreMediaEngine;
import com.discord.stores.StoreStageChannels;
import com.discord.stores.StoreUserGuildSettings;
import com.discord.stores.StoreVoiceChannelSelected;
import com.discord.utilities.rx.ObservableExtensionsKt;
import com.discord.widgets.stage.StageRoles;
import d0.z.d.m;
import kotlin.NoWhenBranchMatchedException;
import kotlin.Unit;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
/* compiled from: StoreUIEventHandler.kt */
public final class StoreUIEventHandler {
private final StoreChannels channelsStore;
private final Context context;
private final StoreMediaEngine mediaEngineStore;
private final StoreStageChannels stageChannelsStore;
private final StoreUserGuildSettings storeUserGuildSettings;
private final StoreVoiceChannelSelected voiceChannelSelectedStore;
public final /* synthetic */ class WhenMappings {
public static final /* synthetic */ int[] $EnumSwitchMapping$0;
public static final /* synthetic */ int[] $EnumSwitchMapping$1;
static {
KrispOveruseDetector.Status.values();
int[] iArr = new int[3];
$EnumSwitchMapping$0 = iArr;
iArr[KrispOveruseDetector.Status.CPU_OVERUSE.ordinal()] = 1;
iArr[KrispOveruseDetector.Status.VAD_CPU_OVERUSE.ordinal()] = 2;
iArr[KrispOveruseDetector.Status.FAILED.ordinal()] = 3;
StoreUserGuildSettings.SettingsUpdateType.values();
int[] iArr2 = new int[3];
$EnumSwitchMapping$1 = iArr2;
iArr2[StoreUserGuildSettings.SettingsUpdateType.GUILD.ordinal()] = 1;
iArr2[StoreUserGuildSettings.SettingsUpdateType.CHANNEL.ordinal()] = 2;
iArr2[StoreUserGuildSettings.SettingsUpdateType.CATEGORY.ordinal()] = 3;
}
}
public StoreUIEventHandler(Context context, StoreMediaEngine storeMediaEngine, StoreChannels storeChannels, StoreVoiceChannelSelected storeVoiceChannelSelected, StoreStageChannels storeStageChannels, StoreUserGuildSettings storeUserGuildSettings) {
m.checkNotNullParameter(context, "context");
m.checkNotNullParameter(storeMediaEngine, "mediaEngineStore");
m.checkNotNullParameter(storeChannels, "channelsStore");
m.checkNotNullParameter(storeVoiceChannelSelected, "voiceChannelSelectedStore");
m.checkNotNullParameter(storeStageChannels, "stageChannelsStore");
m.checkNotNullParameter(storeUserGuildSettings, "storeUserGuildSettings");
this.context = context;
this.mediaEngineStore = storeMediaEngine;
this.channelsStore = storeChannels;
this.voiceChannelSelectedStore = storeVoiceChannelSelected;
this.stageChannelsStore = storeStageChannels;
this.storeUserGuildSettings = storeUserGuildSettings;
subscribeToStoreEvents();
}
public static final /* synthetic */ void access$handleKrispStatusEvent(StoreUIEventHandler storeUIEventHandler, KrispOveruseDetector.Status status) {
storeUIEventHandler.handleKrispStatusEvent(status);
}
public static final /* synthetic */ void access$handleUserGuildSettingsEvent(StoreUIEventHandler storeUIEventHandler, StoreUserGuildSettings.Event event) {
storeUIEventHandler.handleUserGuildSettingsEvent(event);
}
@MainThread
private final void handleKrispStatusEvent(KrispOveruseDetector.Status status) {
int i;
Channel channel;
StageRoles r0;
if (status != KrispOveruseDetector.Status.FAILED || (channel = this.channelsStore.getChannel(this.voiceChannelSelectedStore.getSelectedVoiceChannelId())) == null || !AnimatableValueParser.w1(channel) || (r0 = this.stageChannelsStore.m10getMyRolesvisDeB4(channel.h())) == null || !StageRoles.m23isAudienceimpl(r0.m28unboximpl())) {
int ordinal = status.ordinal();
if (ordinal == 0) {
i = 2131891374;
} else if (ordinal == 1) {
i = 2131891375;
} else if (ordinal == 2) {
i = 2131891368;
} else {
throw new NoWhenBranchMatchedException();
}
o.g(this.context, i, 0, null, 12);
}
}
@MainThread
private final void handleUserGuildSettingsEvent(StoreUserGuildSettings.Event event) {
int i;
if (event instanceof StoreUserGuildSettings.Event.SettingsUpdated) {
int ordinal = ((StoreUserGuildSettings.Event.SettingsUpdated) event).getType().ordinal();
if (ordinal == 0) {
i = 2131893364;
} else if (ordinal == 1) {
i = 2131887330;
} else if (ordinal == 2) {
i = 2131887211;
} else {
throw new NoWhenBranchMatchedException();
}
o.g(this.context, i, 0, null, 12);
KotlinExtensionsKt.getExhaustive(Unit.a);
return;
}
throw new NoWhenBranchMatchedException();
}
private final void subscribeToStoreEvents() {
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui(this.mediaEngineStore.onKrispStatusEvent()), StoreUIEventHandler.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new StoreUIEventHandler$subscribeToStoreEvents$1(this), 62, (Object) null);
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui(this.storeUserGuildSettings.observeEvents()), StoreUIEventHandler.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new StoreUIEventHandler$subscribeToStoreEvents$2(this), 62, (Object) null);
}
}