358 lines
19 KiB
Java
358 lines
19 KiB
Java
package com.discord.utilities.voice;
|
|
|
|
import android.content.Context;
|
|
import androidx.annotation.MainThread;
|
|
import c.d.b.a.a;
|
|
import com.airbnb.lottie.parser.AnimatableValueParser;
|
|
import com.discord.api.channel.Channel;
|
|
import com.discord.app.AppComponent;
|
|
import com.discord.models.domain.ModelApplicationStream;
|
|
import com.discord.models.user.MeUser;
|
|
import com.discord.rtcconnection.RtcConnection;
|
|
import com.discord.stores.StoreApplicationStreaming;
|
|
import com.discord.stores.StoreChannels;
|
|
import com.discord.stores.StoreRtcConnection;
|
|
import com.discord.stores.StoreStream;
|
|
import com.discord.stores.StoreUser;
|
|
import com.discord.stores.StoreVoiceParticipants;
|
|
import com.discord.utilities.media.AppSound;
|
|
import com.discord.utilities.media.AppSoundManager;
|
|
import com.discord.utilities.rx.ObservableExtensionsKt;
|
|
import d0.t.n;
|
|
import d0.t.o;
|
|
import d0.z.d.m;
|
|
import java.util.ArrayList;
|
|
import java.util.Collection;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import kotlin.jvm.functions.Function0;
|
|
import kotlin.jvm.functions.Function1;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
import rx.Observable;
|
|
import rx.Subscription;
|
|
/* compiled from: CallSoundManager.kt */
|
|
public final class CallSoundManager {
|
|
public static final Companion Companion = new Companion(null);
|
|
private static final int JOIN_LEAVE_USER_LIMIT = 25;
|
|
private String activeStreamKey;
|
|
private Long activeStreamUserId;
|
|
private int activeStreamViewerCount;
|
|
private final AppComponent appComponent;
|
|
private final AppSoundManager appSoundManager;
|
|
private int numConnectedParticipants;
|
|
private final IStoreStateGenerator storeStateGenerator;
|
|
private Subscription storeStateSubscription;
|
|
private List<Long> streamingUserIds;
|
|
private Long voiceChannelId;
|
|
|
|
/* compiled from: CallSoundManager.kt */
|
|
public static final class Companion {
|
|
private Companion() {
|
|
}
|
|
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
}
|
|
|
|
/* compiled from: CallSoundManager.kt */
|
|
public interface IStoreStateGenerator {
|
|
Observable<StoreState> observeStoreState(long j);
|
|
}
|
|
|
|
/* compiled from: CallSoundManager.kt */
|
|
public static final class StoreState {
|
|
private final StoreApplicationStreaming.ActiveApplicationStream activeApplicationStream;
|
|
|
|
/* renamed from: me reason: collision with root package name */
|
|
private final MeUser f2165me;
|
|
private final RtcConnection.State rtcConnectionState;
|
|
private final Channel selectedVoiceChannel;
|
|
private final Map<String, List<Long>> streamSpectators;
|
|
private final Map<Long, ModelApplicationStream> streamsByUser;
|
|
private final Map<Long, StoreVoiceParticipants.VoiceUser> voiceParticipants;
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r4v0, resolved type: java.util.Map<java.lang.Long, ? extends com.discord.models.domain.ModelApplicationStream> */
|
|
/* JADX DEBUG: Multi-variable search result rejected for r5v0, resolved type: java.util.Map<java.lang.String, ? extends java.util.List<java.lang.Long>> */
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public StoreState(Map<Long, StoreVoiceParticipants.VoiceUser> map, RtcConnection.State state, Map<Long, ? extends ModelApplicationStream> map2, Map<String, ? extends List<Long>> map3, StoreApplicationStreaming.ActiveApplicationStream activeApplicationStream, MeUser meUser, Channel channel) {
|
|
m.checkNotNullParameter(map, "voiceParticipants");
|
|
m.checkNotNullParameter(state, "rtcConnectionState");
|
|
m.checkNotNullParameter(map2, "streamsByUser");
|
|
m.checkNotNullParameter(map3, "streamSpectators");
|
|
m.checkNotNullParameter(meUser, "me");
|
|
this.voiceParticipants = map;
|
|
this.rtcConnectionState = state;
|
|
this.streamsByUser = map2;
|
|
this.streamSpectators = map3;
|
|
this.activeApplicationStream = activeApplicationStream;
|
|
this.f2165me = meUser;
|
|
this.selectedVoiceChannel = channel;
|
|
}
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r5v0, resolved type: com.discord.utilities.voice.CallSoundManager$StoreState */
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public static /* synthetic */ StoreState copy$default(StoreState storeState, Map map, RtcConnection.State state, Map map2, Map map3, StoreApplicationStreaming.ActiveApplicationStream activeApplicationStream, MeUser meUser, Channel channel, int i, Object obj) {
|
|
if ((i & 1) != 0) {
|
|
map = storeState.voiceParticipants;
|
|
}
|
|
if ((i & 2) != 0) {
|
|
state = storeState.rtcConnectionState;
|
|
}
|
|
if ((i & 4) != 0) {
|
|
map2 = storeState.streamsByUser;
|
|
}
|
|
if ((i & 8) != 0) {
|
|
map3 = storeState.streamSpectators;
|
|
}
|
|
if ((i & 16) != 0) {
|
|
activeApplicationStream = storeState.activeApplicationStream;
|
|
}
|
|
if ((i & 32) != 0) {
|
|
meUser = storeState.f2165me;
|
|
}
|
|
if ((i & 64) != 0) {
|
|
channel = storeState.selectedVoiceChannel;
|
|
}
|
|
return storeState.copy(map, state, map2, map3, activeApplicationStream, meUser, channel);
|
|
}
|
|
|
|
public final Map<Long, StoreVoiceParticipants.VoiceUser> component1() {
|
|
return this.voiceParticipants;
|
|
}
|
|
|
|
public final RtcConnection.State component2() {
|
|
return this.rtcConnectionState;
|
|
}
|
|
|
|
public final Map<Long, ModelApplicationStream> component3() {
|
|
return this.streamsByUser;
|
|
}
|
|
|
|
public final Map<String, List<Long>> component4() {
|
|
return this.streamSpectators;
|
|
}
|
|
|
|
public final StoreApplicationStreaming.ActiveApplicationStream component5() {
|
|
return this.activeApplicationStream;
|
|
}
|
|
|
|
public final MeUser component6() {
|
|
return this.f2165me;
|
|
}
|
|
|
|
public final Channel component7() {
|
|
return this.selectedVoiceChannel;
|
|
}
|
|
|
|
public final StoreState copy(Map<Long, StoreVoiceParticipants.VoiceUser> map, RtcConnection.State state, Map<Long, ? extends ModelApplicationStream> map2, Map<String, ? extends List<Long>> map3, StoreApplicationStreaming.ActiveApplicationStream activeApplicationStream, MeUser meUser, Channel channel) {
|
|
m.checkNotNullParameter(map, "voiceParticipants");
|
|
m.checkNotNullParameter(state, "rtcConnectionState");
|
|
m.checkNotNullParameter(map2, "streamsByUser");
|
|
m.checkNotNullParameter(map3, "streamSpectators");
|
|
m.checkNotNullParameter(meUser, "me");
|
|
return new StoreState(map, state, map2, map3, activeApplicationStream, meUser, channel);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof StoreState)) {
|
|
return false;
|
|
}
|
|
StoreState storeState = (StoreState) obj;
|
|
return m.areEqual(this.voiceParticipants, storeState.voiceParticipants) && m.areEqual(this.rtcConnectionState, storeState.rtcConnectionState) && m.areEqual(this.streamsByUser, storeState.streamsByUser) && m.areEqual(this.streamSpectators, storeState.streamSpectators) && m.areEqual(this.activeApplicationStream, storeState.activeApplicationStream) && m.areEqual(this.f2165me, storeState.f2165me) && m.areEqual(this.selectedVoiceChannel, storeState.selectedVoiceChannel);
|
|
}
|
|
|
|
public final StoreApplicationStreaming.ActiveApplicationStream getActiveApplicationStream() {
|
|
return this.activeApplicationStream;
|
|
}
|
|
|
|
public final MeUser getMe() {
|
|
return this.f2165me;
|
|
}
|
|
|
|
public final RtcConnection.State getRtcConnectionState() {
|
|
return this.rtcConnectionState;
|
|
}
|
|
|
|
public final Channel getSelectedVoiceChannel() {
|
|
return this.selectedVoiceChannel;
|
|
}
|
|
|
|
public final Map<String, List<Long>> getStreamSpectators() {
|
|
return this.streamSpectators;
|
|
}
|
|
|
|
public final Map<Long, ModelApplicationStream> getStreamsByUser() {
|
|
return this.streamsByUser;
|
|
}
|
|
|
|
public final Map<Long, StoreVoiceParticipants.VoiceUser> getVoiceParticipants() {
|
|
return this.voiceParticipants;
|
|
}
|
|
|
|
public int hashCode() {
|
|
Map<Long, StoreVoiceParticipants.VoiceUser> map = this.voiceParticipants;
|
|
int i = 0;
|
|
int hashCode = (map != null ? map.hashCode() : 0) * 31;
|
|
RtcConnection.State state = this.rtcConnectionState;
|
|
int hashCode2 = (hashCode + (state != null ? state.hashCode() : 0)) * 31;
|
|
Map<Long, ModelApplicationStream> map2 = this.streamsByUser;
|
|
int hashCode3 = (hashCode2 + (map2 != null ? map2.hashCode() : 0)) * 31;
|
|
Map<String, List<Long>> map3 = this.streamSpectators;
|
|
int hashCode4 = (hashCode3 + (map3 != null ? map3.hashCode() : 0)) * 31;
|
|
StoreApplicationStreaming.ActiveApplicationStream activeApplicationStream = this.activeApplicationStream;
|
|
int hashCode5 = (hashCode4 + (activeApplicationStream != null ? activeApplicationStream.hashCode() : 0)) * 31;
|
|
MeUser meUser = this.f2165me;
|
|
int hashCode6 = (hashCode5 + (meUser != null ? meUser.hashCode() : 0)) * 31;
|
|
Channel channel = this.selectedVoiceChannel;
|
|
if (channel != null) {
|
|
i = channel.hashCode();
|
|
}
|
|
return hashCode6 + i;
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder L = a.L("StoreState(voiceParticipants=");
|
|
L.append(this.voiceParticipants);
|
|
L.append(", rtcConnectionState=");
|
|
L.append(this.rtcConnectionState);
|
|
L.append(", streamsByUser=");
|
|
L.append(this.streamsByUser);
|
|
L.append(", streamSpectators=");
|
|
L.append(this.streamSpectators);
|
|
L.append(", activeApplicationStream=");
|
|
L.append(this.activeApplicationStream);
|
|
L.append(", me=");
|
|
L.append(this.f2165me);
|
|
L.append(", selectedVoiceChannel=");
|
|
L.append(this.selectedVoiceChannel);
|
|
L.append(")");
|
|
return L.toString();
|
|
}
|
|
}
|
|
|
|
/* compiled from: CallSoundManager.kt */
|
|
public static final class StoreStateGenerator implements IStoreStateGenerator {
|
|
private final StoreApplicationStreaming storeApplicationStreaming;
|
|
private final StoreChannels storeChannels;
|
|
private final StoreRtcConnection storeRtcConnection;
|
|
private final StoreUser storeUser;
|
|
private final StoreVoiceParticipants storeVoiceParticipants;
|
|
|
|
public StoreStateGenerator() {
|
|
this(null, null, null, null, null, 31, null);
|
|
}
|
|
|
|
public StoreStateGenerator(StoreVoiceParticipants storeVoiceParticipants, StoreRtcConnection storeRtcConnection, StoreApplicationStreaming storeApplicationStreaming, StoreUser storeUser, StoreChannels storeChannels) {
|
|
m.checkNotNullParameter(storeVoiceParticipants, "storeVoiceParticipants");
|
|
m.checkNotNullParameter(storeRtcConnection, "storeRtcConnection");
|
|
m.checkNotNullParameter(storeApplicationStreaming, "storeApplicationStreaming");
|
|
m.checkNotNullParameter(storeUser, "storeUser");
|
|
m.checkNotNullParameter(storeChannels, "storeChannels");
|
|
this.storeVoiceParticipants = storeVoiceParticipants;
|
|
this.storeRtcConnection = storeRtcConnection;
|
|
this.storeApplicationStreaming = storeApplicationStreaming;
|
|
this.storeUser = storeUser;
|
|
this.storeChannels = storeChannels;
|
|
}
|
|
|
|
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
|
|
public /* synthetic */ StoreStateGenerator(StoreVoiceParticipants storeVoiceParticipants, StoreRtcConnection storeRtcConnection, StoreApplicationStreaming storeApplicationStreaming, StoreUser storeUser, StoreChannels storeChannels, int i, DefaultConstructorMarker defaultConstructorMarker) {
|
|
this((i & 1) != 0 ? StoreStream.Companion.getVoiceParticipants() : storeVoiceParticipants, (i & 2) != 0 ? StoreStream.Companion.getRtcConnection() : storeRtcConnection, (i & 4) != 0 ? StoreStream.Companion.getApplicationStreaming() : storeApplicationStreaming, (i & 8) != 0 ? StoreStream.Companion.getUsers() : storeUser, (i & 16) != 0 ? StoreStream.Companion.getChannels() : storeChannels);
|
|
}
|
|
|
|
@Override // com.discord.utilities.voice.CallSoundManager.IStoreStateGenerator
|
|
public Observable<StoreState> observeStoreState(long j) {
|
|
Observable<StoreState> e = Observable.e(this.storeVoiceParticipants.get(j), this.storeRtcConnection.getConnectionState(), this.storeApplicationStreaming.observeStreamsByUser(), this.storeApplicationStreaming.observeStreamSpectators(), this.storeApplicationStreaming.observeActiveStream(), StoreUser.observeMe$default(this.storeUser, false, 1, null), this.storeChannels.observeChannel(j), CallSoundManager$StoreStateGenerator$observeStoreState$1.INSTANCE);
|
|
m.checkNotNullExpressionValue(e, "Observable.combineLatest…Channel\n )\n }");
|
|
return e;
|
|
}
|
|
}
|
|
|
|
public CallSoundManager(AppComponent appComponent, AppSoundManager appSoundManager, IStoreStateGenerator iStoreStateGenerator) {
|
|
m.checkNotNullParameter(appComponent, "appComponent");
|
|
m.checkNotNullParameter(appSoundManager, "appSoundManager");
|
|
m.checkNotNullParameter(iStoreStateGenerator, "storeStateGenerator");
|
|
this.appComponent = appComponent;
|
|
this.appSoundManager = appSoundManager;
|
|
this.storeStateGenerator = iStoreStateGenerator;
|
|
this.streamingUserIds = n.emptyList();
|
|
}
|
|
|
|
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
|
|
public /* synthetic */ CallSoundManager(AppComponent appComponent, AppSoundManager appSoundManager, IStoreStateGenerator iStoreStateGenerator, int i, DefaultConstructorMarker defaultConstructorMarker) {
|
|
this(appComponent, (i & 2) != 0 ? AppSoundManager.Provider.INSTANCE.get() : appSoundManager, (i & 4) != 0 ? new StoreStateGenerator(null, null, null, null, null, 31, null) : iStoreStateGenerator);
|
|
}
|
|
|
|
public static final /* synthetic */ AppSoundManager access$getAppSoundManager$p(CallSoundManager callSoundManager) {
|
|
return callSoundManager.appSoundManager;
|
|
}
|
|
|
|
public static final /* synthetic */ Subscription access$getStoreStateSubscription$p(CallSoundManager callSoundManager) {
|
|
return callSoundManager.storeStateSubscription;
|
|
}
|
|
|
|
public static final /* synthetic */ void access$handleStoreState(CallSoundManager callSoundManager, long j, StoreState storeState) {
|
|
callSoundManager.handleStoreState(j, storeState);
|
|
}
|
|
|
|
public static final /* synthetic */ void access$setStoreStateSubscription$p(CallSoundManager callSoundManager, Subscription subscription) {
|
|
callSoundManager.storeStateSubscription = subscription;
|
|
}
|
|
|
|
/* JADX ERROR: IF instruction can be used only in fallback mode
|
|
jadx.core.utils.exceptions.CodegenException: IF instruction can be used only in fallback mode
|
|
at jadx.core.codegen.InsnGen.fallbackOnlyInsn(InsnGen.java:631)
|
|
at jadx.core.codegen.InsnGen.makeInsnBody(InsnGen.java:513)
|
|
at jadx.core.codegen.InsnGen.makeInsn(InsnGen.java:275)
|
|
at jadx.core.codegen.InsnGen.makeInsn(InsnGen.java:245)
|
|
at jadx.core.codegen.RegionGen.makeSimpleBlock(RegionGen.java:104)
|
|
at jadx.core.dex.nodes.IBlock.generate(IBlock.java:15)
|
|
at jadx.core.codegen.RegionGen.makeRegion(RegionGen.java:64)
|
|
at jadx.core.dex.regions.Region.generate(Region.java:35)
|
|
at jadx.core.codegen.RegionGen.makeRegion(RegionGen.java:64)
|
|
at jadx.core.codegen.RegionGen.makeRegionIndent(RegionGen.java:93)
|
|
at jadx.core.codegen.RegionGen.makeLoop(RegionGen.java:188)
|
|
at jadx.core.dex.regions.loops.LoopRegion.generate(LoopRegion.java:173)
|
|
at jadx.core.codegen.RegionGen.makeRegion(RegionGen.java:64)
|
|
at jadx.core.dex.regions.Region.generate(Region.java:35)
|
|
at jadx.core.codegen.RegionGen.makeRegion(RegionGen.java:64)
|
|
at jadx.core.codegen.MethodGen.addRegionInsns(MethodGen.java:261)
|
|
at jadx.core.codegen.MethodGen.addInstructions(MethodGen.java:254)
|
|
at jadx.core.codegen.ClassGen.addMethodCode(ClassGen.java:345)
|
|
at jadx.core.codegen.ClassGen.addMethod(ClassGen.java:298)
|
|
at jadx.core.codegen.ClassGen.lambda$addInnerClsAndMethods$3(ClassGen.java:267)
|
|
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
|
|
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
|
|
at java.base/java.util.stream.SortedOps$RefSortingSink.end(SortedOps.java:395)
|
|
at java.base/java.util.stream.Sink$ChainedReference.end(Sink.java:258)
|
|
*/
|
|
/* JADX WARNING: Removed duplicated region for block: B:100:0x0208 */
|
|
/* JADX WARNING: Removed duplicated region for block: B:112:0x0231 */
|
|
/* JADX WARNING: Removed duplicated region for block: B:113:0x023d */
|
|
/* JADX WARNING: Removed duplicated region for block: B:140:0x0129 A[EDGE_INSN: B:140:0x0129->B:54:0x0129 ?: BREAK , SYNTHETIC] */
|
|
/* JADX WARNING: Removed duplicated region for block: B:58:0x0135 */
|
|
/* JADX WARNING: Removed duplicated region for block: B:83:0x0186 */
|
|
/* JADX WARNING: Removed duplicated region for block: B:94:0x01de */
|
|
@androidx.annotation.MainThread
|
|
private final void handleStoreState(long j, com.discord.utilities.voice.CallSoundManager.StoreState storeState) {
|
|
/*
|
|
// Method dump skipped, instructions count: 639
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: com.discord.utilities.voice.CallSoundManager.handleStoreState(long, com.discord.utilities.voice.CallSoundManager$StoreState):void");
|
|
}
|
|
|
|
public final void subscribeToStoreState(long j) {
|
|
Subscription subscription = this.storeStateSubscription;
|
|
if (subscription != null) {
|
|
subscription.unsubscribe();
|
|
}
|
|
Observable<StoreState> r = this.storeStateGenerator.observeStoreState(j).r();
|
|
m.checkNotNullExpressionValue(r, "storeStateGenerator\n … .distinctUntilChanged()");
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(ObservableExtensionsKt.computationLatest(r), this.appComponent, null, 2, null), CallSoundManager.class, (Context) null, new CallSoundManager$subscribeToStoreState$1(this), (Function1) null, new CallSoundManager$subscribeToStoreState$2(this), (Function0) null, new CallSoundManager$subscribeToStoreState$3(this, j), 42, (Object) null);
|
|
}
|
|
}
|