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

144 lines
5.6 KiB
Java

package com.discord.stores;
import android.content.Context;
import com.discord.api.activity.Activity;
import com.discord.api.activity.ActivityParty;
import com.discord.api.voice.state.VoiceState;
import com.discord.stores.updates.ObservationDeck;
import com.discord.utilities.presence.ActivityUtilsKt;
import com.discord.utilities.rx.ObservableExtensionsKt;
import d0.z.d.m;
import kotlin.Unit;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import rx.Observable;
import rx.subjects.BehaviorSubject;
/* compiled from: StoreStageChannelSelfPresence.kt */
public final class StoreStageChannelSelfPresence extends StoreV2 {
private final Dispatcher dispatcher;
private final ObservationDeck observationDeck;
private final BehaviorSubject<Unit> publishStateTrigger;
private Activity stageChannelActivity;
private final StoreStageChannels stageChannels;
private final StoreUserPresence userPresence;
private final StoreUserSettings userSettings;
private final StoreUser userStore;
private final StoreVoiceChannelSelected voiceChannelSelected;
public StoreStageChannelSelfPresence(ObservationDeck observationDeck, StoreUser storeUser, StoreUserPresence storeUserPresence, StoreStageChannels storeStageChannels, StoreVoiceChannelSelected storeVoiceChannelSelected, StoreUserSettings storeUserSettings, Dispatcher dispatcher) {
m.checkNotNullParameter(observationDeck, "observationDeck");
m.checkNotNullParameter(storeUser, "userStore");
m.checkNotNullParameter(storeUserPresence, "userPresence");
m.checkNotNullParameter(storeStageChannels, "stageChannels");
m.checkNotNullParameter(storeVoiceChannelSelected, "voiceChannelSelected");
m.checkNotNullParameter(storeUserSettings, "userSettings");
m.checkNotNullParameter(dispatcher, "dispatcher");
this.observationDeck = observationDeck;
this.userStore = storeUser;
this.userPresence = storeUserPresence;
this.stageChannels = storeStageChannels;
this.voiceChannelSelected = storeVoiceChannelSelected;
this.userSettings = storeUserSettings;
this.dispatcher = dispatcher;
BehaviorSubject<Unit> k0 = BehaviorSubject.k0();
m.checkNotNullExpressionValue(k0, "BehaviorSubject.create()");
this.publishStateTrigger = k0;
}
@StoreThread
private final void updateActivity() {
ActivityParty i;
ActivityParty i2;
Activity createStageChannelListeningActivity = ActivityUtilsKt.createStageChannelListeningActivity();
String str = null;
String a = (createStageChannelListeningActivity == null || (i2 = createStageChannelListeningActivity.i()) == null) ? null : i2.a();
Activity activity = this.stageChannelActivity;
if (!(!m.areEqual(a, (activity == null || (i = activity.i()) == null) ? null : i.a()))) {
String h = createStageChannelListeningActivity != null ? createStageChannelListeningActivity.h() : null;
Activity activity2 = this.stageChannelActivity;
if (activity2 != null) {
str = activity2.h();
}
if (!(!m.areEqual(h, str))) {
return;
}
}
this.stageChannelActivity = createStageChannelListeningActivity;
this.publishStateTrigger.onNext(Unit.a);
}
public final Dispatcher getDispatcher() {
return this.dispatcher;
}
public final ObservationDeck getObservationDeck() {
return this.observationDeck;
}
public final BehaviorSubject<Unit> getPublishStateTrigger() {
return this.publishStateTrigger;
}
public final Activity getStageChannelActivity() {
return this.stageChannelActivity;
}
public final StoreStageChannels getStageChannels() {
return this.stageChannels;
}
public final StoreUserPresence getUserPresence() {
return this.userPresence;
}
public final StoreUserSettings getUserSettings() {
return this.userSettings;
}
public final StoreUser getUserStore() {
return this.userStore;
}
public final StoreVoiceChannelSelected getVoiceChannelSelected() {
return this.voiceChannelSelected;
}
@StoreThread
public final void handleStageInstanceCreate() {
updateActivity();
}
@StoreThread
public final void handleStageInstanceDelete() {
updateActivity();
}
@StoreThread
public final void handleStageInstanceUpdate() {
updateActivity();
}
@StoreThread
public final void handleVoiceChannelSelected() {
updateActivity();
}
@StoreThread
public final void handleVoiceStateUpdate(VoiceState voiceState) {
m.checkNotNullParameter(voiceState, "voiceState");
if (voiceState.m() == this.userStore.getMe().getId()) {
updateActivity();
}
}
public final void init() {
Observable Y = ObservationDeck.connectRx$default(this.observationDeck, new ObservationDeck.UpdateSource[]{this.stageChannels, this.voiceChannelSelected}, false, null, null, new StoreStageChannelSelfPresence$init$1(this), 14, null).r().Y(new StoreStageChannelSelfPresence$init$2(this));
m.checkNotNullExpressionValue(Y, "observationDeck.connectR…bled -> isEnabled }\n }");
ObservableExtensionsKt.appSubscribe$default(Y, StoreStageChannelSelfPresence.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new StoreStageChannelSelfPresence$init$3(this), 62, (Object) null);
}
public final void setStageChannelActivity(Activity activity) {
this.stageChannelActivity = activity;
}
}