802 lines
34 KiB
Java
802 lines
34 KiB
Java
package com.discord.widgets.home;
|
|
|
|
import a0.a.a.b;
|
|
import android.content.Context;
|
|
import android.content.SharedPreferences;
|
|
import androidx.annotation.MainThread;
|
|
import androidx.core.app.FrameMetricsAggregator;
|
|
import c.a.j.a;
|
|
import c.d.b.a.a;
|
|
import com.discord.api.utcdatetime.UtcDateTime;
|
|
import com.discord.app.AppLog;
|
|
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.tooltips.TooltipManager;
|
|
import com.discord.utilities.cache.SharedPreferencesProvider;
|
|
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 com.discord.widgets.channels.ThreadOnboardingManager;
|
|
import com.discord.widgets.settings.profile.ProfileMarketingTooltip;
|
|
import com.discord.widgets.settings.profile.WidgetSettingsUserProfile;
|
|
import d0.z.d.m;
|
|
import d0.z.d.o;
|
|
import java.lang.ref.WeakReference;
|
|
import java.util.Set;
|
|
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 SharedPreferences sharedPreferences;
|
|
private final StoreGuildWelcomeScreens storeGuildWelcomeScreens;
|
|
private final StoreNavigation storeNavigation;
|
|
private final ThreadOnboardingManager threadOnboardingManager;
|
|
private final TooltipManager tooltipManager;
|
|
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().X(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.y(a.L("ShowGuildWelcomeSheet(guildId="), this.guildId, ")");
|
|
}
|
|
}
|
|
|
|
/* compiled from: WidgetHomeViewModel.kt */
|
|
public static final class ShowProfileMarketingSheet extends Event {
|
|
public static final ShowProfileMarketingSheet INSTANCE = new ShowProfileMarketingSheet();
|
|
|
|
private ShowProfileMarketingSheet() {
|
|
super(null);
|
|
}
|
|
}
|
|
|
|
/* compiled from: WidgetHomeViewModel.kt */
|
|
public static final class ShowThreadOnboardingSheet extends Event {
|
|
public static final ShowThreadOnboardingSheet INSTANCE = new ShowThreadOnboardingSheet();
|
|
|
|
private ShowThreadOnboardingSheet() {
|
|
super(null);
|
|
}
|
|
}
|
|
|
|
/* 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 f2193me;
|
|
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.f2193me = 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.f2193me;
|
|
}
|
|
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.f2193me;
|
|
}
|
|
|
|
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.f2193me, storeState.f2193me) && this.isThreadPeek == storeState.isThreadPeek;
|
|
}
|
|
|
|
public final GuildInfo getGuildInfo() {
|
|
return this.guildInfo;
|
|
}
|
|
|
|
public final PanelState getLeftPanelState() {
|
|
return this.leftPanelState;
|
|
}
|
|
|
|
public final MeUser getMe() {
|
|
return this.f2193me;
|
|
}
|
|
|
|
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.f2193me;
|
|
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.f2193me);
|
|
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, null, null, null, FrameMetricsAggregator.EVERY_DURATION, null);
|
|
}
|
|
|
|
/* JADX WARNING: Illegal instructions before constructor call */
|
|
public WidgetHomeViewModel(StoreNavigation storeNavigation, StoreGuildWelcomeScreens storeGuildWelcomeScreens, Observable<StoreState> observable, Observable<StoreNavigation.PanelAction> observable2, ChannelOnboardingManager channelOnboardingManager, ThreadOnboardingManager threadOnboardingManager, SharedPreferences sharedPreferences, Clock clock, TooltipManager tooltipManager) {
|
|
super(new ViewState(r11, r11));
|
|
m.checkNotNullParameter(storeNavigation, "storeNavigation");
|
|
m.checkNotNullParameter(storeGuildWelcomeScreens, "storeGuildWelcomeScreens");
|
|
m.checkNotNullParameter(observable, "storeStateObservable");
|
|
m.checkNotNullParameter(observable2, "navPanelActionObservable");
|
|
m.checkNotNullParameter(channelOnboardingManager, "channelOnboardingManager");
|
|
m.checkNotNullParameter(threadOnboardingManager, "threadOnboardingManager");
|
|
m.checkNotNullParameter(sharedPreferences, "sharedPreferences");
|
|
m.checkNotNullParameter(clock, "clock");
|
|
m.checkNotNullParameter(tooltipManager, "tooltipManager");
|
|
PanelState.a aVar = PanelState.a.a;
|
|
this.storeNavigation = storeNavigation;
|
|
this.storeGuildWelcomeScreens = storeGuildWelcomeScreens;
|
|
this.channelOnboardingManager = channelOnboardingManager;
|
|
this.threadOnboardingManager = threadOnboardingManager;
|
|
this.sharedPreferences = sharedPreferences;
|
|
this.clock = clock;
|
|
this.tooltipManager = tooltipManager;
|
|
this.eventSubject = PublishSubject.j0();
|
|
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 WidgetHomeViewModel(StoreNavigation storeNavigation, StoreGuildWelcomeScreens storeGuildWelcomeScreens, Observable observable, Observable observable2, ChannelOnboardingManager channelOnboardingManager, ThreadOnboardingManager threadOnboardingManager, SharedPreferences sharedPreferences, Clock clock, TooltipManager tooltipManager, int i, DefaultConstructorMarker defaultConstructorMarker) {
|
|
this(r1, r9, r2, r3, r4, r5, r6, r7, r10);
|
|
Observable observable3;
|
|
TooltipManager tooltipManager2;
|
|
StoreNavigation navigation = (i & 1) != 0 ? StoreStream.Companion.getNavigation() : storeNavigation;
|
|
StoreGuildWelcomeScreens guildWelcomeScreens = (i & 2) != 0 ? StoreStream.Companion.getGuildWelcomeScreens() : storeGuildWelcomeScreens;
|
|
if ((i & 4) != 0) {
|
|
Companion companion = Companion;
|
|
StoreStream.Companion companion2 = StoreStream.Companion;
|
|
observable3 = Companion.access$observeStoreState(companion, companion2.getGuildSelected(), navigation, companion2.getLurking(), companion2.getUsers(), guildWelcomeScreens, companion2.getChannelsSelected());
|
|
} else {
|
|
observable3 = observable;
|
|
}
|
|
Observable navigationPanelAction = (i & 8) != 0 ? navigation.getNavigationPanelAction() : observable2;
|
|
ChannelOnboardingManager channelOnboardingManager2 = (i & 16) != 0 ? new ChannelOnboardingManager() : channelOnboardingManager;
|
|
ThreadOnboardingManager threadOnboardingManager2 = (i & 32) != 0 ? new ThreadOnboardingManager() : threadOnboardingManager;
|
|
SharedPreferences sharedPreferences2 = (i & 64) != 0 ? SharedPreferencesProvider.INSTANCE.get() : sharedPreferences;
|
|
Clock clock2 = (i & 128) != 0 ? ClockFactory.get() : clock;
|
|
if ((i & 256) != 0) {
|
|
AppLog appLog = AppLog.g;
|
|
m.checkNotNullParameter(appLog, "logger");
|
|
WeakReference<c.a.j.a> weakReference = a.b.a;
|
|
tooltipManager2 = null;
|
|
c.a.j.a aVar = weakReference != null ? weakReference.get() : null;
|
|
if (aVar == null) {
|
|
aVar = new c.a.j.a(appLog);
|
|
a.b.a = new WeakReference<>(aVar);
|
|
}
|
|
TooltipManager.a aVar2 = TooltipManager.a.d;
|
|
m.checkNotNullParameter(aVar, "floatingViewManager");
|
|
WeakReference<TooltipManager> weakReference2 = TooltipManager.a.a;
|
|
tooltipManager2 = weakReference2 != null ? weakReference2.get() : tooltipManager2;
|
|
if (tooltipManager2 == null) {
|
|
TooltipManager tooltipManager3 = new TooltipManager((c.a.v.a) TooltipManager.a.b.getValue(), (Set) TooltipManager.a.f2158c.getValue(), 0, aVar, 4);
|
|
TooltipManager.a.a = new WeakReference<>(tooltipManager3);
|
|
tooltipManager2 = tooltipManager3;
|
|
}
|
|
} else {
|
|
tooltipManager2 = tooltipManager;
|
|
}
|
|
}
|
|
|
|
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 emitShowProfileMarketingSheet() {
|
|
PublishSubject<Event> publishSubject = this.eventSubject;
|
|
publishSubject.j.onNext(Event.ShowProfileMarketingSheet.INSTANCE);
|
|
}
|
|
|
|
@MainThread
|
|
private final void emitShowThreadOnboardingSheet() {
|
|
PublishSubject<Event> publishSubject = this.eventSubject;
|
|
publishSubject.j.onNext(Event.ShowThreadOnboardingSheet.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();
|
|
} else if (this.threadOnboardingManager.shouldShowThreadOnboarding(storeState.getMe().getId(), Long.valueOf(guildId))) {
|
|
emitShowThreadOnboardingSheet();
|
|
} else if (shouldShowProfileMarketingSheet(this.previousLeftPanelState, leftPanelState, storeState.getMe())) {
|
|
emitShowProfileMarketingSheet();
|
|
}
|
|
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();
|
|
}
|
|
|
|
private final boolean shouldShowProfileMarketingSheet(PanelState panelState, PanelState panelState2, MeUser meUser) {
|
|
boolean z2;
|
|
UserUtils userUtils = UserUtils.INSTANCE;
|
|
Clock clock = this.clock;
|
|
boolean since = userUtils.since(meUser, clock, new UtcDateTime(clock.currentTimeMillis() - 1209600000));
|
|
String banner = meUser.getBanner();
|
|
if (banner == null || banner.length() == 0) {
|
|
String bio = meUser.getBio();
|
|
if (bio == null || bio.length() == 0) {
|
|
String bannerColor = meUser.getBannerColor();
|
|
if (bannerColor == null || bannerColor.length() == 0) {
|
|
z2 = true;
|
|
return !(!(panelState instanceof PanelState.d) && (panelState2 instanceof PanelState.c)) && this.tooltipManager.b(ProfileMarketingTooltip.INSTANCE, false) && since && !this.sharedPreferences.getBoolean(WidgetSettingsUserProfile.USER_PROFILE_SETTINGS_VIEWED_CACHE_KEY, false) && z2;
|
|
}
|
|
}
|
|
}
|
|
z2 = false;
|
|
if (!(!(panelState instanceof PanelState.d) && (panelState2 instanceof PanelState.c))) {
|
|
}
|
|
}
|
|
|
|
@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;
|
|
}
|
|
}
|