695 lines
28 KiB
Java
695 lines
28 KiB
Java
package com.discord.widgets.home;
|
|
|
|
import a0.a.a.b;
|
|
import android.content.Context;
|
|
import androidx.annotation.MainThread;
|
|
import c.d.b.a.a;
|
|
import com.discord.app.AppViewModel;
|
|
import com.discord.models.user.MeUser;
|
|
import com.discord.panels.PanelState;
|
|
import com.discord.stores.StoreChannelsSelected;
|
|
import com.discord.stores.StoreGuildSelected;
|
|
import com.discord.stores.StoreGuildWelcomeScreens;
|
|
import com.discord.stores.StoreLurking;
|
|
import com.discord.stores.StoreNavigation;
|
|
import com.discord.stores.StoreStream;
|
|
import com.discord.stores.StoreUser;
|
|
import com.discord.utilities.rx.ObservableExtensionsKt;
|
|
import com.discord.utilities.time.Clock;
|
|
import com.discord.utilities.time.ClockFactory;
|
|
import com.discord.utilities.user.UserUtils;
|
|
import com.discord.widgets.channels.ChannelOnboardingManager;
|
|
import d0.z.d.m;
|
|
import d0.z.d.o;
|
|
import kotlin.Unit;
|
|
import kotlin.jvm.functions.Function0;
|
|
import kotlin.jvm.functions.Function1;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
import rx.Observable;
|
|
import rx.subjects.PublishSubject;
|
|
/* compiled from: WidgetHomeViewModel.kt */
|
|
public final class WidgetHomeViewModel extends AppViewModel<ViewState> {
|
|
public static final Companion Companion = new Companion(null);
|
|
private final ChannelOnboardingManager channelOnboardingManager;
|
|
private final Clock clock;
|
|
private final PublishSubject<Event> eventSubject;
|
|
private PanelState previousLeftPanelState;
|
|
private final StoreGuildWelcomeScreens storeGuildWelcomeScreens;
|
|
private final StoreNavigation storeNavigation;
|
|
private boolean wasThreadPeek;
|
|
private WidgetHomeModel widgetHomeModel;
|
|
|
|
/* compiled from: WidgetHomeViewModel.kt */
|
|
/* renamed from: com.discord.widgets.home.WidgetHomeViewModel$1 reason: invalid class name */
|
|
public static final class AnonymousClass1 extends o implements Function1<StoreState, Unit> {
|
|
public final /* synthetic */ WidgetHomeViewModel this$0;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public AnonymousClass1(WidgetHomeViewModel widgetHomeViewModel) {
|
|
super(1);
|
|
this.this$0 = widgetHomeViewModel;
|
|
}
|
|
|
|
/* Return type fixed from 'java.lang.Object' to match base method */
|
|
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
|
|
@Override // kotlin.jvm.functions.Function1
|
|
public /* bridge */ /* synthetic */ Unit invoke(StoreState storeState) {
|
|
invoke(storeState);
|
|
return Unit.a;
|
|
}
|
|
|
|
public final void invoke(StoreState storeState) {
|
|
WidgetHomeViewModel widgetHomeViewModel = this.this$0;
|
|
m.checkNotNullExpressionValue(storeState, "storeState");
|
|
WidgetHomeViewModel.access$handleStoreState(widgetHomeViewModel, storeState);
|
|
}
|
|
}
|
|
|
|
/* compiled from: WidgetHomeViewModel.kt */
|
|
/* renamed from: com.discord.widgets.home.WidgetHomeViewModel$2 reason: invalid class name */
|
|
public static final class AnonymousClass2 extends o implements Function1<StoreNavigation.PanelAction, Unit> {
|
|
public final /* synthetic */ WidgetHomeViewModel this$0;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public AnonymousClass2(WidgetHomeViewModel widgetHomeViewModel) {
|
|
super(1);
|
|
this.this$0 = widgetHomeViewModel;
|
|
}
|
|
|
|
/* Return type fixed from 'java.lang.Object' to match base method */
|
|
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
|
|
@Override // kotlin.jvm.functions.Function1
|
|
public /* bridge */ /* synthetic */ Unit invoke(StoreNavigation.PanelAction panelAction) {
|
|
invoke(panelAction);
|
|
return Unit.a;
|
|
}
|
|
|
|
public final void invoke(StoreNavigation.PanelAction panelAction) {
|
|
m.checkNotNullParameter(panelAction, "panelAction");
|
|
WidgetHomeViewModel.access$handleNavDrawerAction(this.this$0, panelAction);
|
|
}
|
|
}
|
|
|
|
/* compiled from: WidgetHomeViewModel.kt */
|
|
public static final class Companion {
|
|
private Companion() {
|
|
}
|
|
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
|
|
public static final /* synthetic */ Observable access$observeStoreState(Companion companion, StoreGuildSelected storeGuildSelected, StoreNavigation storeNavigation, StoreLurking storeLurking, StoreUser storeUser, StoreGuildWelcomeScreens storeGuildWelcomeScreens, StoreChannelsSelected storeChannelsSelected) {
|
|
return companion.observeStoreState(storeGuildSelected, storeNavigation, storeLurking, storeUser, storeGuildWelcomeScreens, storeChannelsSelected);
|
|
}
|
|
|
|
private final Observable<StoreState> observeStoreState(StoreGuildSelected storeGuildSelected, StoreNavigation storeNavigation, StoreLurking storeLurking, StoreUser storeUser, StoreGuildWelcomeScreens storeGuildWelcomeScreens, StoreChannelsSelected storeChannelsSelected) {
|
|
Observable<StoreState> g = Observable.g(storeNavigation.observeLeftPanelState(), storeNavigation.observeRightPanelState(), storeGuildSelected.observeSelectedGuildId().Y(new WidgetHomeViewModel$Companion$observeStoreState$guildInfoObservable$1(storeLurking, storeGuildWelcomeScreens)), StoreUser.observeMe$default(storeUser, false, 1, null), storeChannelsSelected.observeResolvedSelectedChannel(), WidgetHomeViewModel$Companion$observeStoreState$1.INSTANCE);
|
|
m.checkNotNullExpressionValue(g, "Observable.combineLatest…adPeek,\n )\n }");
|
|
return g;
|
|
}
|
|
}
|
|
|
|
/* compiled from: WidgetHomeViewModel.kt */
|
|
public static abstract class Event {
|
|
|
|
/* compiled from: WidgetHomeViewModel.kt */
|
|
public static final class AnimatePeekIn extends Event {
|
|
public static final AnimatePeekIn INSTANCE = new AnimatePeekIn();
|
|
|
|
private AnimatePeekIn() {
|
|
super(null);
|
|
}
|
|
}
|
|
|
|
/* compiled from: WidgetHomeViewModel.kt */
|
|
public static final class AnimatePeekOut extends Event {
|
|
public static final AnimatePeekOut INSTANCE = new AnimatePeekOut();
|
|
|
|
private AnimatePeekOut() {
|
|
super(null);
|
|
}
|
|
}
|
|
|
|
/* compiled from: WidgetHomeViewModel.kt */
|
|
public static final class ClosePanels extends Event {
|
|
public static final ClosePanels INSTANCE = new ClosePanels();
|
|
|
|
private ClosePanels() {
|
|
super(null);
|
|
}
|
|
}
|
|
|
|
/* compiled from: WidgetHomeViewModel.kt */
|
|
public static final class OpenLeftPanel extends Event {
|
|
public static final OpenLeftPanel INSTANCE = new OpenLeftPanel();
|
|
|
|
private OpenLeftPanel() {
|
|
super(null);
|
|
}
|
|
}
|
|
|
|
/* compiled from: WidgetHomeViewModel.kt */
|
|
public static final class ShowChannelOnboardingSheet extends Event {
|
|
public static final ShowChannelOnboardingSheet INSTANCE = new ShowChannelOnboardingSheet();
|
|
|
|
private ShowChannelOnboardingSheet() {
|
|
super(null);
|
|
}
|
|
}
|
|
|
|
/* compiled from: WidgetHomeViewModel.kt */
|
|
public static final class ShowGuildWelcomeSheet extends Event {
|
|
private final long guildId;
|
|
|
|
public ShowGuildWelcomeSheet(long j) {
|
|
super(null);
|
|
this.guildId = j;
|
|
}
|
|
|
|
public static /* synthetic */ ShowGuildWelcomeSheet copy$default(ShowGuildWelcomeSheet showGuildWelcomeSheet, long j, int i, Object obj) {
|
|
if ((i & 1) != 0) {
|
|
j = showGuildWelcomeSheet.guildId;
|
|
}
|
|
return showGuildWelcomeSheet.copy(j);
|
|
}
|
|
|
|
public final long component1() {
|
|
return this.guildId;
|
|
}
|
|
|
|
public final ShowGuildWelcomeSheet copy(long j) {
|
|
return new ShowGuildWelcomeSheet(j);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this != obj) {
|
|
return (obj instanceof ShowGuildWelcomeSheet) && this.guildId == ((ShowGuildWelcomeSheet) obj).guildId;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public final long getGuildId() {
|
|
return this.guildId;
|
|
}
|
|
|
|
public int hashCode() {
|
|
return b.a(this.guildId);
|
|
}
|
|
|
|
public String toString() {
|
|
return a.z(a.L("ShowGuildWelcomeSheet(guildId="), this.guildId, ")");
|
|
}
|
|
}
|
|
|
|
/* compiled from: WidgetHomeViewModel.kt */
|
|
public static final class UnlockLeftPanel extends Event {
|
|
public static final UnlockLeftPanel INSTANCE = new UnlockLeftPanel();
|
|
|
|
private UnlockLeftPanel() {
|
|
super(null);
|
|
}
|
|
}
|
|
|
|
private Event() {
|
|
}
|
|
|
|
public /* synthetic */ Event(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
}
|
|
|
|
/* compiled from: WidgetHomeViewModel.kt */
|
|
public static final class GuildInfo {
|
|
private final long guildId;
|
|
private final boolean isLurking;
|
|
private final StoreGuildWelcomeScreens.State welcomeScreenState;
|
|
|
|
public GuildInfo(long j, boolean z2, StoreGuildWelcomeScreens.State state) {
|
|
this.guildId = j;
|
|
this.isLurking = z2;
|
|
this.welcomeScreenState = state;
|
|
}
|
|
|
|
public static /* synthetic */ GuildInfo copy$default(GuildInfo guildInfo, long j, boolean z2, StoreGuildWelcomeScreens.State state, int i, Object obj) {
|
|
if ((i & 1) != 0) {
|
|
j = guildInfo.guildId;
|
|
}
|
|
if ((i & 2) != 0) {
|
|
z2 = guildInfo.isLurking;
|
|
}
|
|
if ((i & 4) != 0) {
|
|
state = guildInfo.welcomeScreenState;
|
|
}
|
|
return guildInfo.copy(j, z2, state);
|
|
}
|
|
|
|
public final long component1() {
|
|
return this.guildId;
|
|
}
|
|
|
|
public final boolean component2() {
|
|
return this.isLurking;
|
|
}
|
|
|
|
public final StoreGuildWelcomeScreens.State component3() {
|
|
return this.welcomeScreenState;
|
|
}
|
|
|
|
public final GuildInfo copy(long j, boolean z2, StoreGuildWelcomeScreens.State state) {
|
|
return new GuildInfo(j, z2, state);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof GuildInfo)) {
|
|
return false;
|
|
}
|
|
GuildInfo guildInfo = (GuildInfo) obj;
|
|
return this.guildId == guildInfo.guildId && this.isLurking == guildInfo.isLurking && m.areEqual(this.welcomeScreenState, guildInfo.welcomeScreenState);
|
|
}
|
|
|
|
public final long getGuildId() {
|
|
return this.guildId;
|
|
}
|
|
|
|
public final StoreGuildWelcomeScreens.State getWelcomeScreenState() {
|
|
return this.welcomeScreenState;
|
|
}
|
|
|
|
public int hashCode() {
|
|
int a = b.a(this.guildId) * 31;
|
|
boolean z2 = this.isLurking;
|
|
if (z2) {
|
|
z2 = true;
|
|
}
|
|
int i = z2 ? 1 : 0;
|
|
int i2 = z2 ? 1 : 0;
|
|
int i3 = z2 ? 1 : 0;
|
|
int i4 = (a + i) * 31;
|
|
StoreGuildWelcomeScreens.State state = this.welcomeScreenState;
|
|
return i4 + (state != null ? state.hashCode() : 0);
|
|
}
|
|
|
|
public final boolean isLurking() {
|
|
return this.isLurking;
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder L = a.L("GuildInfo(guildId=");
|
|
L.append(this.guildId);
|
|
L.append(", isLurking=");
|
|
L.append(this.isLurking);
|
|
L.append(", welcomeScreenState=");
|
|
L.append(this.welcomeScreenState);
|
|
L.append(")");
|
|
return L.toString();
|
|
}
|
|
}
|
|
|
|
/* compiled from: WidgetHomeViewModel.kt */
|
|
public static final class StoreState {
|
|
private final GuildInfo guildInfo;
|
|
private final boolean isThreadPeek;
|
|
private final PanelState leftPanelState;
|
|
|
|
/* renamed from: me reason: collision with root package name */
|
|
private final MeUser f2156me;
|
|
private final PanelState rightPanelState;
|
|
|
|
public StoreState(PanelState panelState, PanelState panelState2, GuildInfo guildInfo, MeUser meUser, boolean z2) {
|
|
m.checkNotNullParameter(panelState, "leftPanelState");
|
|
m.checkNotNullParameter(panelState2, "rightPanelState");
|
|
m.checkNotNullParameter(guildInfo, "guildInfo");
|
|
m.checkNotNullParameter(meUser, "me");
|
|
this.leftPanelState = panelState;
|
|
this.rightPanelState = panelState2;
|
|
this.guildInfo = guildInfo;
|
|
this.f2156me = meUser;
|
|
this.isThreadPeek = z2;
|
|
}
|
|
|
|
public static /* synthetic */ StoreState copy$default(StoreState storeState, PanelState panelState, PanelState panelState2, GuildInfo guildInfo, MeUser meUser, boolean z2, int i, Object obj) {
|
|
if ((i & 1) != 0) {
|
|
panelState = storeState.leftPanelState;
|
|
}
|
|
if ((i & 2) != 0) {
|
|
panelState2 = storeState.rightPanelState;
|
|
}
|
|
if ((i & 4) != 0) {
|
|
guildInfo = storeState.guildInfo;
|
|
}
|
|
if ((i & 8) != 0) {
|
|
meUser = storeState.f2156me;
|
|
}
|
|
if ((i & 16) != 0) {
|
|
z2 = storeState.isThreadPeek;
|
|
}
|
|
return storeState.copy(panelState, panelState2, guildInfo, meUser, z2);
|
|
}
|
|
|
|
public final PanelState component1() {
|
|
return this.leftPanelState;
|
|
}
|
|
|
|
public final PanelState component2() {
|
|
return this.rightPanelState;
|
|
}
|
|
|
|
public final GuildInfo component3() {
|
|
return this.guildInfo;
|
|
}
|
|
|
|
public final MeUser component4() {
|
|
return this.f2156me;
|
|
}
|
|
|
|
public final boolean component5() {
|
|
return this.isThreadPeek;
|
|
}
|
|
|
|
public final StoreState copy(PanelState panelState, PanelState panelState2, GuildInfo guildInfo, MeUser meUser, boolean z2) {
|
|
m.checkNotNullParameter(panelState, "leftPanelState");
|
|
m.checkNotNullParameter(panelState2, "rightPanelState");
|
|
m.checkNotNullParameter(guildInfo, "guildInfo");
|
|
m.checkNotNullParameter(meUser, "me");
|
|
return new StoreState(panelState, panelState2, guildInfo, meUser, z2);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof StoreState)) {
|
|
return false;
|
|
}
|
|
StoreState storeState = (StoreState) obj;
|
|
return m.areEqual(this.leftPanelState, storeState.leftPanelState) && m.areEqual(this.rightPanelState, storeState.rightPanelState) && m.areEqual(this.guildInfo, storeState.guildInfo) && m.areEqual(this.f2156me, storeState.f2156me) && this.isThreadPeek == storeState.isThreadPeek;
|
|
}
|
|
|
|
public final GuildInfo getGuildInfo() {
|
|
return this.guildInfo;
|
|
}
|
|
|
|
public final PanelState getLeftPanelState() {
|
|
return this.leftPanelState;
|
|
}
|
|
|
|
public final MeUser getMe() {
|
|
return this.f2156me;
|
|
}
|
|
|
|
public final PanelState getRightPanelState() {
|
|
return this.rightPanelState;
|
|
}
|
|
|
|
public int hashCode() {
|
|
PanelState panelState = this.leftPanelState;
|
|
int i = 0;
|
|
int hashCode = (panelState != null ? panelState.hashCode() : 0) * 31;
|
|
PanelState panelState2 = this.rightPanelState;
|
|
int hashCode2 = (hashCode + (panelState2 != null ? panelState2.hashCode() : 0)) * 31;
|
|
GuildInfo guildInfo = this.guildInfo;
|
|
int hashCode3 = (hashCode2 + (guildInfo != null ? guildInfo.hashCode() : 0)) * 31;
|
|
MeUser meUser = this.f2156me;
|
|
if (meUser != null) {
|
|
i = meUser.hashCode();
|
|
}
|
|
int i2 = (hashCode3 + i) * 31;
|
|
boolean z2 = this.isThreadPeek;
|
|
if (z2) {
|
|
z2 = true;
|
|
}
|
|
int i3 = z2 ? 1 : 0;
|
|
int i4 = z2 ? 1 : 0;
|
|
int i5 = z2 ? 1 : 0;
|
|
return i2 + i3;
|
|
}
|
|
|
|
public final boolean isThreadPeek() {
|
|
return this.isThreadPeek;
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder L = a.L("StoreState(leftPanelState=");
|
|
L.append(this.leftPanelState);
|
|
L.append(", rightPanelState=");
|
|
L.append(this.rightPanelState);
|
|
L.append(", guildInfo=");
|
|
L.append(this.guildInfo);
|
|
L.append(", me=");
|
|
L.append(this.f2156me);
|
|
L.append(", isThreadPeek=");
|
|
return a.G(L, this.isThreadPeek, ")");
|
|
}
|
|
}
|
|
|
|
/* compiled from: WidgetHomeViewModel.kt */
|
|
public static final class ViewState {
|
|
private final PanelState leftPanelState;
|
|
private final PanelState rightPanelState;
|
|
|
|
public ViewState(PanelState panelState, PanelState panelState2) {
|
|
m.checkNotNullParameter(panelState, "leftPanelState");
|
|
m.checkNotNullParameter(panelState2, "rightPanelState");
|
|
this.leftPanelState = panelState;
|
|
this.rightPanelState = panelState2;
|
|
}
|
|
|
|
public static /* synthetic */ ViewState copy$default(ViewState viewState, PanelState panelState, PanelState panelState2, int i, Object obj) {
|
|
if ((i & 1) != 0) {
|
|
panelState = viewState.leftPanelState;
|
|
}
|
|
if ((i & 2) != 0) {
|
|
panelState2 = viewState.rightPanelState;
|
|
}
|
|
return viewState.copy(panelState, panelState2);
|
|
}
|
|
|
|
public final PanelState component1() {
|
|
return this.leftPanelState;
|
|
}
|
|
|
|
public final PanelState component2() {
|
|
return this.rightPanelState;
|
|
}
|
|
|
|
public final ViewState copy(PanelState panelState, PanelState panelState2) {
|
|
m.checkNotNullParameter(panelState, "leftPanelState");
|
|
m.checkNotNullParameter(panelState2, "rightPanelState");
|
|
return new ViewState(panelState, panelState2);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof ViewState)) {
|
|
return false;
|
|
}
|
|
ViewState viewState = (ViewState) obj;
|
|
return m.areEqual(this.leftPanelState, viewState.leftPanelState) && m.areEqual(this.rightPanelState, viewState.rightPanelState);
|
|
}
|
|
|
|
public final PanelState getLeftPanelState() {
|
|
return this.leftPanelState;
|
|
}
|
|
|
|
public final PanelState getRightPanelState() {
|
|
return this.rightPanelState;
|
|
}
|
|
|
|
public int hashCode() {
|
|
PanelState panelState = this.leftPanelState;
|
|
int i = 0;
|
|
int hashCode = (panelState != null ? panelState.hashCode() : 0) * 31;
|
|
PanelState panelState2 = this.rightPanelState;
|
|
if (panelState2 != null) {
|
|
i = panelState2.hashCode();
|
|
}
|
|
return hashCode + i;
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder L = a.L("ViewState(leftPanelState=");
|
|
L.append(this.leftPanelState);
|
|
L.append(", rightPanelState=");
|
|
L.append(this.rightPanelState);
|
|
L.append(")");
|
|
return L.toString();
|
|
}
|
|
}
|
|
|
|
public final /* synthetic */ class WhenMappings {
|
|
public static final /* synthetic */ int[] $EnumSwitchMapping$0;
|
|
|
|
static {
|
|
StoreNavigation.PanelAction.values();
|
|
int[] iArr = new int[4];
|
|
$EnumSwitchMapping$0 = iArr;
|
|
iArr[StoreNavigation.PanelAction.OPEN.ordinal()] = 1;
|
|
iArr[StoreNavigation.PanelAction.CLOSE.ordinal()] = 2;
|
|
iArr[StoreNavigation.PanelAction.UNLOCK_LEFT.ordinal()] = 3;
|
|
iArr[StoreNavigation.PanelAction.NOOP.ordinal()] = 4;
|
|
}
|
|
}
|
|
|
|
public WidgetHomeViewModel() {
|
|
this(null, null, null, null, null, null, 63, null);
|
|
}
|
|
|
|
/* JADX WARNING: Illegal instructions before constructor call */
|
|
public WidgetHomeViewModel(StoreNavigation storeNavigation, StoreGuildWelcomeScreens storeGuildWelcomeScreens, Observable<StoreState> observable, Observable<StoreNavigation.PanelAction> observable2, ChannelOnboardingManager channelOnboardingManager, Clock clock) {
|
|
super(new ViewState(r8, r8));
|
|
m.checkNotNullParameter(storeNavigation, "storeNavigation");
|
|
m.checkNotNullParameter(storeGuildWelcomeScreens, "storeGuildWelcomeScreens");
|
|
m.checkNotNullParameter(observable, "storeStateObservable");
|
|
m.checkNotNullParameter(observable2, "navPanelActionObservable");
|
|
m.checkNotNullParameter(channelOnboardingManager, "channelOnboardingManager");
|
|
m.checkNotNullParameter(clock, "clock");
|
|
PanelState.a aVar = PanelState.a.a;
|
|
this.storeNavigation = storeNavigation;
|
|
this.storeGuildWelcomeScreens = storeGuildWelcomeScreens;
|
|
this.channelOnboardingManager = channelOnboardingManager;
|
|
this.clock = clock;
|
|
this.eventSubject = PublishSubject.k0();
|
|
Observable<StoreState> r = observable.r();
|
|
m.checkNotNullExpressionValue(r, "storeStateObservable\n … .distinctUntilChanged()");
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(ObservableExtensionsKt.computationLatest(r), this, null, 2, null), WidgetHomeViewModel.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new AnonymousClass1(this), 62, (Object) null);
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(observable2, this, null, 2, null), WidgetHomeViewModel.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new AnonymousClass2(this), 62, (Object) null);
|
|
}
|
|
|
|
/* JADX WARNING: Illegal instructions before constructor call */
|
|
public /* synthetic */ WidgetHomeViewModel(StoreNavigation storeNavigation, StoreGuildWelcomeScreens storeGuildWelcomeScreens, Observable observable, Observable observable2, ChannelOnboardingManager channelOnboardingManager, Clock clock, int i, DefaultConstructorMarker defaultConstructorMarker) {
|
|
this(storeNavigation, storeGuildWelcomeScreens, observable, (i & 8) != 0 ? storeNavigation.getNavigationPanelAction() : observable2, (i & 16) != 0 ? new ChannelOnboardingManager() : channelOnboardingManager, (i & 32) != 0 ? ClockFactory.get() : clock);
|
|
storeNavigation = (i & 1) != 0 ? StoreStream.Companion.getNavigation() : storeNavigation;
|
|
storeGuildWelcomeScreens = (i & 2) != 0 ? StoreStream.Companion.getGuildWelcomeScreens() : storeGuildWelcomeScreens;
|
|
if ((i & 4) != 0) {
|
|
Companion companion = Companion;
|
|
StoreStream.Companion companion2 = StoreStream.Companion;
|
|
observable = Companion.access$observeStoreState(companion, companion2.getGuildSelected(), storeNavigation, companion2.getLurking(), companion2.getUsers(), storeGuildWelcomeScreens, companion2.getChannelsSelected());
|
|
}
|
|
}
|
|
|
|
public static final /* synthetic */ void access$handleNavDrawerAction(WidgetHomeViewModel widgetHomeViewModel, StoreNavigation.PanelAction panelAction) {
|
|
widgetHomeViewModel.handleNavDrawerAction(panelAction);
|
|
}
|
|
|
|
public static final /* synthetic */ void access$handleStoreState(WidgetHomeViewModel widgetHomeViewModel, StoreState storeState) {
|
|
widgetHomeViewModel.handleStoreState(storeState);
|
|
}
|
|
|
|
@MainThread
|
|
private final void emitAnimatePeekIn() {
|
|
PublishSubject<Event> publishSubject = this.eventSubject;
|
|
publishSubject.j.onNext(Event.AnimatePeekIn.INSTANCE);
|
|
}
|
|
|
|
@MainThread
|
|
private final void emitAnimatePeekOut() {
|
|
PublishSubject<Event> publishSubject = this.eventSubject;
|
|
publishSubject.j.onNext(Event.AnimatePeekOut.INSTANCE);
|
|
}
|
|
|
|
@MainThread
|
|
private final void emitClosePanelsEvent() {
|
|
PublishSubject<Event> publishSubject = this.eventSubject;
|
|
publishSubject.j.onNext(Event.ClosePanels.INSTANCE);
|
|
}
|
|
|
|
@MainThread
|
|
private final void emitShowChannelOnboardingSheet() {
|
|
PublishSubject<Event> publishSubject = this.eventSubject;
|
|
publishSubject.j.onNext(Event.ShowChannelOnboardingSheet.INSTANCE);
|
|
}
|
|
|
|
@MainThread
|
|
private final void emitShowWelcomeSheet(long j) {
|
|
PublishSubject<Event> publishSubject = this.eventSubject;
|
|
publishSubject.j.onNext(new Event.ShowGuildWelcomeSheet(j));
|
|
}
|
|
|
|
@MainThread
|
|
private final void emitUnlockLeftPanelEvent() {
|
|
PublishSubject<Event> publishSubject = this.eventSubject;
|
|
publishSubject.j.onNext(Event.UnlockLeftPanel.INSTANCE);
|
|
}
|
|
|
|
@MainThread
|
|
private final void handleNavDrawerAction(StoreNavigation.PanelAction panelAction) {
|
|
int ordinal = panelAction.ordinal();
|
|
if (ordinal == 1) {
|
|
emitOpenLeftPanelEvent();
|
|
} else if (ordinal == 2) {
|
|
emitClosePanelsEvent();
|
|
} else if (ordinal == 3) {
|
|
emitUnlockLeftPanelEvent();
|
|
}
|
|
}
|
|
|
|
@MainThread
|
|
private final void handleStoreState(StoreState storeState) {
|
|
PanelState leftPanelState = storeState.getLeftPanelState();
|
|
PanelState rightPanelState = storeState.getRightPanelState();
|
|
long guildId = storeState.getGuildInfo().getGuildId();
|
|
boolean isLurking = storeState.getGuildInfo().isLurking();
|
|
StoreGuildWelcomeScreens.State welcomeScreenState = storeState.getGuildInfo().getWelcomeScreenState();
|
|
boolean isNewUser = UserUtils.INSTANCE.isNewUser(storeState.getMe(), this.clock);
|
|
updateViewState(new ViewState(leftPanelState, rightPanelState));
|
|
if (isLurking && !this.storeGuildWelcomeScreens.hasWelcomeScreenBeenSeen(guildId)) {
|
|
if (welcomeScreenState instanceof StoreGuildWelcomeScreens.State.Loaded) {
|
|
emitShowWelcomeSheet(guildId);
|
|
} else if (welcomeScreenState == null) {
|
|
this.storeGuildWelcomeScreens.fetchIfNonexisting(guildId);
|
|
}
|
|
}
|
|
if (shouldShowChannelOnboardingSheet(this.previousLeftPanelState, leftPanelState, guildId, isNewUser)) {
|
|
emitShowChannelOnboardingSheet();
|
|
}
|
|
this.previousLeftPanelState = leftPanelState;
|
|
if (storeState.isThreadPeek() && !this.wasThreadPeek) {
|
|
emitAnimatePeekIn();
|
|
}
|
|
if (!storeState.isThreadPeek() && this.wasThreadPeek) {
|
|
emitAnimatePeekOut();
|
|
}
|
|
this.wasThreadPeek = storeState.isThreadPeek();
|
|
}
|
|
|
|
private final boolean shouldShowChannelOnboardingSheet(PanelState panelState, PanelState panelState2, long j, boolean z2) {
|
|
return ((panelState instanceof PanelState.d) && (panelState2 instanceof PanelState.c)) && ((j > 0 ? 1 : (j == 0 ? 0 : -1)) != 0) && z2 && !this.channelOnboardingManager.hasUserSeenChannelOnboarding();
|
|
}
|
|
|
|
@MainThread
|
|
public final void emitOpenLeftPanelEvent() {
|
|
PublishSubject<Event> publishSubject = this.eventSubject;
|
|
publishSubject.j.onNext(Event.OpenLeftPanel.INSTANCE);
|
|
}
|
|
|
|
public final WidgetHomeModel getWidgetHomeModel$app_productionBetaRelease() {
|
|
return this.widgetHomeModel;
|
|
}
|
|
|
|
public final Observable<Event> observeEvents() {
|
|
PublishSubject<Event> publishSubject = this.eventSubject;
|
|
m.checkNotNullExpressionValue(publishSubject, "eventSubject");
|
|
return publishSubject;
|
|
}
|
|
|
|
public final void onEndPanelStateChange(PanelState panelState) {
|
|
m.checkNotNullParameter(panelState, "panelState");
|
|
this.storeNavigation.setRightPanelState(panelState);
|
|
}
|
|
|
|
public final void onStartPanelStateChange(PanelState panelState) {
|
|
m.checkNotNullParameter(panelState, "panelState");
|
|
this.storeNavigation.setLeftPanelState(panelState);
|
|
}
|
|
|
|
public final void setWidgetHomeModel$app_productionBetaRelease(WidgetHomeModel widgetHomeModel) {
|
|
this.widgetHomeModel = widgetHomeModel;
|
|
}
|
|
}
|