87 lines
5.4 KiB
Java
87 lines
5.4 KiB
Java
package com.discord.utilities.voice;
|
|
|
|
import com.airbnb.lottie.parser.AnimatableValueParser;
|
|
import com.discord.api.channel.Channel;
|
|
import com.discord.rtcconnection.RtcConnection;
|
|
import com.discord.rtcconnection.audio.DiscordAudioManager;
|
|
import com.discord.stores.StoreAudioManagerV2;
|
|
import com.discord.stores.StoreMediaSettings;
|
|
import com.discord.utilities.rx.ObservableWithLeadingEdgeThrottle;
|
|
import com.discord.utilities.voice.VoiceEngineServiceController;
|
|
import com.discord.widgets.voice.model.CallModel;
|
|
import d0.z.d.m;
|
|
import j0.k.b;
|
|
import j0.l.e.j;
|
|
import java.util.concurrent.TimeUnit;
|
|
import rx.Observable;
|
|
import rx.functions.Func3;
|
|
/* compiled from: VoiceEngineServiceController.kt */
|
|
public final class VoiceEngineServiceController$notificationDataObservable$1<T, R> implements b<RtcConnection.StateChange, Observable<? extends VoiceEngineServiceController.NotificationData>> {
|
|
public final /* synthetic */ VoiceEngineServiceController this$0;
|
|
|
|
/* compiled from: VoiceEngineServiceController.kt */
|
|
/* renamed from: com.discord.utilities.voice.VoiceEngineServiceController$notificationDataObservable$1$1 reason: invalid class name */
|
|
public static final class AnonymousClass1<T, R> implements b<Long, Observable<? extends VoiceEngineServiceController.NotificationData>> {
|
|
public final /* synthetic */ RtcConnection.State $state;
|
|
public final /* synthetic */ VoiceEngineServiceController$notificationDataObservable$1 this$0;
|
|
|
|
/* compiled from: VoiceEngineServiceController.kt */
|
|
/* renamed from: com.discord.utilities.voice.VoiceEngineServiceController$notificationDataObservable$1$1$1 reason: invalid class name */
|
|
public static final class AnonymousClass1<T1, T2, T3, R> implements Func3<StoreMediaSettings.VoiceConfiguration, StoreAudioManagerV2.State, CallModel, VoiceEngineServiceController.NotificationData> {
|
|
public final /* synthetic */ AnonymousClass1 this$0;
|
|
|
|
public AnonymousClass1(AnonymousClass1 r1) {
|
|
this.this$0 = r1;
|
|
}
|
|
|
|
public final VoiceEngineServiceController.NotificationData call(StoreMediaSettings.VoiceConfiguration voiceConfiguration, StoreAudioManagerV2.State state, CallModel callModel) {
|
|
Channel channel;
|
|
Channel channel2;
|
|
Channel channel3;
|
|
boolean z2 = false;
|
|
boolean z3 = callModel != null && callModel.isVideoCall();
|
|
boolean z4 = !z3 && (state.getActiveAudioDevice() == DiscordAudioManager.DeviceTypes.EARPIECE);
|
|
boolean z5 = callModel == null || !callModel.isSuppressed();
|
|
RtcConnection.State state2 = this.this$0.$state;
|
|
String y0 = (callModel == null || (channel3 = callModel.getChannel()) == null) ? null : AnimatableValueParser.y0(channel3);
|
|
if (y0 == null) {
|
|
y0 = "";
|
|
}
|
|
boolean isSelfMuted = voiceConfiguration.isSelfMuted();
|
|
boolean isSelfDeafened = voiceConfiguration.isSelfDeafened();
|
|
boolean z6 = callModel != null && callModel.isStreaming();
|
|
long h = (callModel == null || (channel2 = callModel.getChannel()) == null) ? -1 : channel2.h();
|
|
Long valueOf = (callModel == null || (channel = callModel.getChannel()) == null) ? null : Long.valueOf(channel.f());
|
|
if (valueOf != null && valueOf.longValue() > 0) {
|
|
z2 = true;
|
|
}
|
|
if (!z2) {
|
|
valueOf = null;
|
|
}
|
|
return new VoiceEngineServiceController.NotificationData(state2, y0, isSelfMuted, isSelfDeafened, z6, z3, h, valueOf, z4, z5);
|
|
}
|
|
}
|
|
|
|
public AnonymousClass1(VoiceEngineServiceController$notificationDataObservable$1 voiceEngineServiceController$notificationDataObservable$1, RtcConnection.State state) {
|
|
this.this$0 = voiceEngineServiceController$notificationDataObservable$1;
|
|
this.$state = state;
|
|
}
|
|
|
|
public final Observable<? extends VoiceEngineServiceController.NotificationData> call(Long l) {
|
|
Observable<StoreMediaSettings.VoiceConfiguration> voiceConfig = VoiceEngineServiceController.access$getMediaSettingsStore$p(this.this$0.this$0).getVoiceConfig();
|
|
Observable<StoreAudioManagerV2.State> observeAudioManagerState = VoiceEngineServiceController.access$getAudioManagerStore$p(this.this$0.this$0).observeAudioManagerState();
|
|
CallModel.Companion companion = CallModel.Companion;
|
|
m.checkNotNullExpressionValue(l, "selectedVoiceChannelId");
|
|
return ObservableWithLeadingEdgeThrottle.combineLatest(voiceConfig, observeAudioManagerState, companion.get(l.longValue()), new AnonymousClass1(this), 300, TimeUnit.MILLISECONDS);
|
|
}
|
|
}
|
|
|
|
public VoiceEngineServiceController$notificationDataObservable$1(VoiceEngineServiceController voiceEngineServiceController) {
|
|
this.this$0 = voiceEngineServiceController;
|
|
}
|
|
|
|
public final Observable<? extends VoiceEngineServiceController.NotificationData> call(RtcConnection.StateChange stateChange) {
|
|
RtcConnection.State state = stateChange.a;
|
|
return m.areEqual(state, RtcConnection.State.h.a) ? new j(VoiceEngineServiceController.access$getNOTIFICATION_DATA_DISCONNECTED$cp()) : VoiceEngineServiceController.access$getVoiceChannelSelectedStore$p(this.this$0).observeSelectedVoiceChannelId().X(new AnonymousClass1(this, state));
|
|
}
|
|
}
|