644 lines
29 KiB
Java
644 lines
29 KiB
Java
package com.discord.widgets.tabs;
|
|
|
|
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.guild.Guild;
|
|
import com.discord.panels.PanelState;
|
|
import com.discord.stores.StoreGuilds;
|
|
import com.discord.stores.StoreMentions;
|
|
import com.discord.stores.StoreNavigation;
|
|
import com.discord.stores.StoreStream;
|
|
import com.discord.stores.StoreTabsNavigation;
|
|
import com.discord.stores.StoreUser;
|
|
import com.discord.stores.StoreUserRelationships;
|
|
import com.discord.utilities.rx.ObservableExtensionsKt;
|
|
import com.discord.widgets.stage.discovery.StageDiscoveryUsersFeatureFlag;
|
|
import d0.t.k;
|
|
import d0.t.n0;
|
|
import d0.t.u;
|
|
import d0.z.d.m;
|
|
import d0.z.d.o;
|
|
import java.util.Collection;
|
|
import java.util.LinkedHashMap;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
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: TabsHostViewModel.kt */
|
|
public final class TabsHostViewModel extends AppViewModel<ViewState> {
|
|
private static final Set<NavigationTab> AT_LEAST_ONE_GUILD_STAGE_DISCOVERY_EXPERIMENT_TABS;
|
|
private static final Set<NavigationTab> AT_LEAST_ONE_GUILD_TABS;
|
|
public static final Companion Companion = new Companion(null);
|
|
private static final List<NavigationTab> NON_HOME_TAB_DESTINATIONS;
|
|
private static final Set<NavigationTab> NO_GUILD_STAGE_DISCOVERY_EXPERIMENT_TABS;
|
|
private static final Set<NavigationTab> NO_GUILD_TABS;
|
|
private static final List<NavigationTab> TAB_DESTINATIONS;
|
|
private final PublishSubject<Event> eventSubject;
|
|
private final StoreNavigation storeNavigation;
|
|
private StoreState storeState;
|
|
private final StoreTabsNavigation storeTabsNavigation;
|
|
|
|
/* compiled from: TabsHostViewModel.kt */
|
|
/* renamed from: com.discord.widgets.tabs.TabsHostViewModel$1 reason: invalid class name */
|
|
public static final class AnonymousClass1 extends o implements Function1<StoreState, Unit> {
|
|
public final /* synthetic */ TabsHostViewModel this$0;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public AnonymousClass1(TabsHostViewModel tabsHostViewModel) {
|
|
super(1);
|
|
this.this$0 = tabsHostViewModel;
|
|
}
|
|
|
|
/* 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) {
|
|
m.checkNotNullParameter(storeState, "storeState");
|
|
TabsHostViewModel.access$handleStoreState(this.this$0, storeState);
|
|
}
|
|
}
|
|
|
|
/* compiled from: TabsHostViewModel.kt */
|
|
/* renamed from: com.discord.widgets.tabs.TabsHostViewModel$2 reason: invalid class name */
|
|
public static final class AnonymousClass2 extends o implements Function1<Integer, Unit> {
|
|
public final /* synthetic */ TabsHostViewModel this$0;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public AnonymousClass2(TabsHostViewModel tabsHostViewModel) {
|
|
super(1);
|
|
this.this$0 = tabsHostViewModel;
|
|
}
|
|
|
|
/* 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(Integer num) {
|
|
invoke(num.intValue());
|
|
return Unit.a;
|
|
}
|
|
|
|
public final void invoke(int i) {
|
|
TabsHostViewModel.access$handleBottomNavHeight(this.this$0, i);
|
|
}
|
|
}
|
|
|
|
/* compiled from: TabsHostViewModel.kt */
|
|
/* renamed from: com.discord.widgets.tabs.TabsHostViewModel$3 reason: invalid class name */
|
|
public static final class AnonymousClass3 extends o implements Function1<Unit, Unit> {
|
|
public final /* synthetic */ TabsHostViewModel this$0;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public AnonymousClass3(TabsHostViewModel tabsHostViewModel) {
|
|
super(1);
|
|
this.this$0 = tabsHostViewModel;
|
|
}
|
|
|
|
/* 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(Unit unit) {
|
|
invoke(unit);
|
|
return Unit.a;
|
|
}
|
|
|
|
public final void invoke(Unit unit) {
|
|
m.checkNotNullParameter(unit, "it");
|
|
TabsHostViewModel.access$dismissSearchDialog(this.this$0);
|
|
}
|
|
}
|
|
|
|
/* compiled from: TabsHostViewModel.kt */
|
|
public static final class Companion {
|
|
private Companion() {
|
|
}
|
|
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
|
|
public static final /* synthetic */ Observable access$observeStoreState(Companion companion, StoreNavigation storeNavigation, StoreTabsNavigation storeTabsNavigation, StoreUser storeUser, StoreGuilds storeGuilds, StoreMentions storeMentions, StoreUserRelationships storeUserRelationships) {
|
|
return companion.observeStoreState(storeNavigation, storeTabsNavigation, storeUser, storeGuilds, storeMentions, storeUserRelationships);
|
|
}
|
|
|
|
private final Observable<StoreState> observeStoreState(StoreNavigation storeNavigation, StoreTabsNavigation storeTabsNavigation, StoreUser storeUser, StoreGuilds storeGuilds, StoreMentions storeMentions, StoreUserRelationships storeUserRelationships) {
|
|
Observable<StoreState> e = Observable.e(storeNavigation.observeLeftPanelState(), storeTabsNavigation.observeSelectedTab(), storeUser.observeMeId(), storeGuilds.observeGuilds(), storeMentions.observeTotalMentions(), storeUserRelationships.observe(), StageDiscoveryUsersFeatureFlag.Companion.getINSTANCE().observeCanAccessStageDiscovery(), TabsHostViewModel$Companion$observeStoreState$1.INSTANCE);
|
|
m.checkNotNullExpressionValue(e, "Observable.combineLatest…covery,\n )\n }");
|
|
return e;
|
|
}
|
|
|
|
public final Set<NavigationTab> getAT_LEAST_ONE_GUILD_STAGE_DISCOVERY_EXPERIMENT_TABS() {
|
|
return TabsHostViewModel.access$getAT_LEAST_ONE_GUILD_STAGE_DISCOVERY_EXPERIMENT_TABS$cp();
|
|
}
|
|
|
|
public final Set<NavigationTab> getAT_LEAST_ONE_GUILD_TABS() {
|
|
return TabsHostViewModel.access$getAT_LEAST_ONE_GUILD_TABS$cp();
|
|
}
|
|
|
|
public final List<NavigationTab> getNON_HOME_TAB_DESTINATIONS() {
|
|
return TabsHostViewModel.access$getNON_HOME_TAB_DESTINATIONS$cp();
|
|
}
|
|
|
|
public final Set<NavigationTab> getNO_GUILD_STAGE_DISCOVERY_EXPERIMENT_TABS() {
|
|
return TabsHostViewModel.access$getNO_GUILD_STAGE_DISCOVERY_EXPERIMENT_TABS$cp();
|
|
}
|
|
|
|
public final Set<NavigationTab> getNO_GUILD_TABS() {
|
|
return TabsHostViewModel.access$getNO_GUILD_TABS$cp();
|
|
}
|
|
|
|
public final List<NavigationTab> getTAB_DESTINATIONS() {
|
|
return TabsHostViewModel.access$getTAB_DESTINATIONS$cp();
|
|
}
|
|
}
|
|
|
|
/* compiled from: TabsHostViewModel.kt */
|
|
public static abstract class Event {
|
|
|
|
/* compiled from: TabsHostViewModel.kt */
|
|
public static final class DismissSearchDialog extends Event {
|
|
public static final DismissSearchDialog INSTANCE = new DismissSearchDialog();
|
|
|
|
private DismissSearchDialog() {
|
|
super(null);
|
|
}
|
|
}
|
|
|
|
/* compiled from: TabsHostViewModel.kt */
|
|
public static final class TrackFriendsListShown extends Event {
|
|
public static final TrackFriendsListShown INSTANCE = new TrackFriendsListShown();
|
|
|
|
private TrackFriendsListShown() {
|
|
super(null);
|
|
}
|
|
}
|
|
|
|
private Event() {
|
|
}
|
|
|
|
public /* synthetic */ Event(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
}
|
|
|
|
/* compiled from: TabsHostViewModel.kt */
|
|
public static final class StoreState {
|
|
private final boolean canAccessStageDiscovery;
|
|
private final Map<Long, Guild> guildIdToGuildMap;
|
|
private final PanelState leftPanelState;
|
|
private final long myUserId;
|
|
private final int numTotalMentions;
|
|
private final NavigationTab selectedTab;
|
|
private final Map<Long, Integer> userRelationships;
|
|
|
|
public StoreState(PanelState panelState, NavigationTab navigationTab, long j, Map<Long, Guild> map, int i, Map<Long, Integer> map2, boolean z2) {
|
|
m.checkNotNullParameter(panelState, "leftPanelState");
|
|
m.checkNotNullParameter(navigationTab, "selectedTab");
|
|
m.checkNotNullParameter(map, "guildIdToGuildMap");
|
|
m.checkNotNullParameter(map2, "userRelationships");
|
|
this.leftPanelState = panelState;
|
|
this.selectedTab = navigationTab;
|
|
this.myUserId = j;
|
|
this.guildIdToGuildMap = map;
|
|
this.numTotalMentions = i;
|
|
this.userRelationships = map2;
|
|
this.canAccessStageDiscovery = z2;
|
|
}
|
|
|
|
public static /* synthetic */ StoreState copy$default(StoreState storeState, PanelState panelState, NavigationTab navigationTab, long j, Map map, int i, Map map2, boolean z2, int i2, Object obj) {
|
|
return storeState.copy((i2 & 1) != 0 ? storeState.leftPanelState : panelState, (i2 & 2) != 0 ? storeState.selectedTab : navigationTab, (i2 & 4) != 0 ? storeState.myUserId : j, (i2 & 8) != 0 ? storeState.guildIdToGuildMap : map, (i2 & 16) != 0 ? storeState.numTotalMentions : i, (i2 & 32) != 0 ? storeState.userRelationships : map2, (i2 & 64) != 0 ? storeState.canAccessStageDiscovery : z2);
|
|
}
|
|
|
|
public final PanelState component1() {
|
|
return this.leftPanelState;
|
|
}
|
|
|
|
public final NavigationTab component2() {
|
|
return this.selectedTab;
|
|
}
|
|
|
|
public final long component3() {
|
|
return this.myUserId;
|
|
}
|
|
|
|
public final Map<Long, Guild> component4() {
|
|
return this.guildIdToGuildMap;
|
|
}
|
|
|
|
public final int component5() {
|
|
return this.numTotalMentions;
|
|
}
|
|
|
|
public final Map<Long, Integer> component6() {
|
|
return this.userRelationships;
|
|
}
|
|
|
|
public final boolean component7() {
|
|
return this.canAccessStageDiscovery;
|
|
}
|
|
|
|
public final StoreState copy(PanelState panelState, NavigationTab navigationTab, long j, Map<Long, Guild> map, int i, Map<Long, Integer> map2, boolean z2) {
|
|
m.checkNotNullParameter(panelState, "leftPanelState");
|
|
m.checkNotNullParameter(navigationTab, "selectedTab");
|
|
m.checkNotNullParameter(map, "guildIdToGuildMap");
|
|
m.checkNotNullParameter(map2, "userRelationships");
|
|
return new StoreState(panelState, navigationTab, j, map, i, map2, 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.selectedTab, storeState.selectedTab) && this.myUserId == storeState.myUserId && m.areEqual(this.guildIdToGuildMap, storeState.guildIdToGuildMap) && this.numTotalMentions == storeState.numTotalMentions && m.areEqual(this.userRelationships, storeState.userRelationships) && this.canAccessStageDiscovery == storeState.canAccessStageDiscovery;
|
|
}
|
|
|
|
public final boolean getCanAccessStageDiscovery() {
|
|
return this.canAccessStageDiscovery;
|
|
}
|
|
|
|
public final Map<Long, Guild> getGuildIdToGuildMap() {
|
|
return this.guildIdToGuildMap;
|
|
}
|
|
|
|
public final PanelState getLeftPanelState() {
|
|
return this.leftPanelState;
|
|
}
|
|
|
|
public final long getMyUserId() {
|
|
return this.myUserId;
|
|
}
|
|
|
|
public final int getNumTotalMentions() {
|
|
return this.numTotalMentions;
|
|
}
|
|
|
|
public final NavigationTab getSelectedTab() {
|
|
return this.selectedTab;
|
|
}
|
|
|
|
public final Map<Long, Integer> getUserRelationships() {
|
|
return this.userRelationships;
|
|
}
|
|
|
|
public int hashCode() {
|
|
PanelState panelState = this.leftPanelState;
|
|
int i = 0;
|
|
int hashCode = (panelState != null ? panelState.hashCode() : 0) * 31;
|
|
NavigationTab navigationTab = this.selectedTab;
|
|
int a = (b.a(this.myUserId) + ((hashCode + (navigationTab != null ? navigationTab.hashCode() : 0)) * 31)) * 31;
|
|
Map<Long, Guild> map = this.guildIdToGuildMap;
|
|
int hashCode2 = (((a + (map != null ? map.hashCode() : 0)) * 31) + this.numTotalMentions) * 31;
|
|
Map<Long, Integer> map2 = this.userRelationships;
|
|
if (map2 != null) {
|
|
i = map2.hashCode();
|
|
}
|
|
int i2 = (hashCode2 + i) * 31;
|
|
boolean z2 = this.canAccessStageDiscovery;
|
|
if (z2) {
|
|
z2 = true;
|
|
}
|
|
int i3 = z2 ? 1 : 0;
|
|
int i4 = z2 ? 1 : 0;
|
|
int i5 = z2 ? 1 : 0;
|
|
return i2 + i3;
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder L = a.L("StoreState(leftPanelState=");
|
|
L.append(this.leftPanelState);
|
|
L.append(", selectedTab=");
|
|
L.append(this.selectedTab);
|
|
L.append(", myUserId=");
|
|
L.append(this.myUserId);
|
|
L.append(", guildIdToGuildMap=");
|
|
L.append(this.guildIdToGuildMap);
|
|
L.append(", numTotalMentions=");
|
|
L.append(this.numTotalMentions);
|
|
L.append(", userRelationships=");
|
|
L.append(this.userRelationships);
|
|
L.append(", canAccessStageDiscovery=");
|
|
return a.G(L, this.canAccessStageDiscovery, ")");
|
|
}
|
|
}
|
|
|
|
/* compiled from: TabsHostViewModel.kt */
|
|
public static final class ViewState {
|
|
private final int bottomNavHeight;
|
|
private final long myUserId;
|
|
private final int numFriendsNotifications;
|
|
private final int numHomeNotifications;
|
|
private final NavigationTab selectedTab;
|
|
private final boolean showBottomNav;
|
|
private final Set<NavigationTab> visibleTabs;
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r7v0, resolved type: java.util.Set<? extends com.discord.widgets.tabs.NavigationTab> */
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public ViewState(NavigationTab navigationTab, boolean z2, int i, long j, Set<? extends NavigationTab> set, int i2, int i3) {
|
|
m.checkNotNullParameter(navigationTab, "selectedTab");
|
|
m.checkNotNullParameter(set, "visibleTabs");
|
|
this.selectedTab = navigationTab;
|
|
this.showBottomNav = z2;
|
|
this.bottomNavHeight = i;
|
|
this.myUserId = j;
|
|
this.visibleTabs = set;
|
|
this.numHomeNotifications = i2;
|
|
this.numFriendsNotifications = i3;
|
|
}
|
|
|
|
public static /* synthetic */ ViewState copy$default(ViewState viewState, NavigationTab navigationTab, boolean z2, int i, long j, Set set, int i2, int i3, int i4, Object obj) {
|
|
return viewState.copy((i4 & 1) != 0 ? viewState.selectedTab : navigationTab, (i4 & 2) != 0 ? viewState.showBottomNav : z2, (i4 & 4) != 0 ? viewState.bottomNavHeight : i, (i4 & 8) != 0 ? viewState.myUserId : j, (i4 & 16) != 0 ? viewState.visibleTabs : set, (i4 & 32) != 0 ? viewState.numHomeNotifications : i2, (i4 & 64) != 0 ? viewState.numFriendsNotifications : i3);
|
|
}
|
|
|
|
public final NavigationTab component1() {
|
|
return this.selectedTab;
|
|
}
|
|
|
|
public final boolean component2() {
|
|
return this.showBottomNav;
|
|
}
|
|
|
|
public final int component3() {
|
|
return this.bottomNavHeight;
|
|
}
|
|
|
|
public final long component4() {
|
|
return this.myUserId;
|
|
}
|
|
|
|
public final Set<NavigationTab> component5() {
|
|
return this.visibleTabs;
|
|
}
|
|
|
|
public final int component6() {
|
|
return this.numHomeNotifications;
|
|
}
|
|
|
|
public final int component7() {
|
|
return this.numFriendsNotifications;
|
|
}
|
|
|
|
public final ViewState copy(NavigationTab navigationTab, boolean z2, int i, long j, Set<? extends NavigationTab> set, int i2, int i3) {
|
|
m.checkNotNullParameter(navigationTab, "selectedTab");
|
|
m.checkNotNullParameter(set, "visibleTabs");
|
|
return new ViewState(navigationTab, z2, i, j, set, i2, i3);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof ViewState)) {
|
|
return false;
|
|
}
|
|
ViewState viewState = (ViewState) obj;
|
|
return m.areEqual(this.selectedTab, viewState.selectedTab) && this.showBottomNav == viewState.showBottomNav && this.bottomNavHeight == viewState.bottomNavHeight && this.myUserId == viewState.myUserId && m.areEqual(this.visibleTabs, viewState.visibleTabs) && this.numHomeNotifications == viewState.numHomeNotifications && this.numFriendsNotifications == viewState.numFriendsNotifications;
|
|
}
|
|
|
|
public final int getBottomNavHeight() {
|
|
return this.bottomNavHeight;
|
|
}
|
|
|
|
public final long getMyUserId() {
|
|
return this.myUserId;
|
|
}
|
|
|
|
public final int getNumFriendsNotifications() {
|
|
return this.numFriendsNotifications;
|
|
}
|
|
|
|
public final int getNumHomeNotifications() {
|
|
return this.numHomeNotifications;
|
|
}
|
|
|
|
public final NavigationTab getSelectedTab() {
|
|
return this.selectedTab;
|
|
}
|
|
|
|
public final boolean getShowBottomNav() {
|
|
return this.showBottomNav;
|
|
}
|
|
|
|
public final Set<NavigationTab> getVisibleTabs() {
|
|
return this.visibleTabs;
|
|
}
|
|
|
|
public int hashCode() {
|
|
NavigationTab navigationTab = this.selectedTab;
|
|
int i = 0;
|
|
int hashCode = (navigationTab != null ? navigationTab.hashCode() : 0) * 31;
|
|
boolean z2 = this.showBottomNav;
|
|
if (z2) {
|
|
z2 = true;
|
|
}
|
|
int i2 = z2 ? 1 : 0;
|
|
int i3 = z2 ? 1 : 0;
|
|
int i4 = z2 ? 1 : 0;
|
|
int a = (b.a(this.myUserId) + ((((hashCode + i2) * 31) + this.bottomNavHeight) * 31)) * 31;
|
|
Set<NavigationTab> set = this.visibleTabs;
|
|
if (set != null) {
|
|
i = set.hashCode();
|
|
}
|
|
return ((((a + i) * 31) + this.numHomeNotifications) * 31) + this.numFriendsNotifications;
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder L = a.L("ViewState(selectedTab=");
|
|
L.append(this.selectedTab);
|
|
L.append(", showBottomNav=");
|
|
L.append(this.showBottomNav);
|
|
L.append(", bottomNavHeight=");
|
|
L.append(this.bottomNavHeight);
|
|
L.append(", myUserId=");
|
|
L.append(this.myUserId);
|
|
L.append(", visibleTabs=");
|
|
L.append(this.visibleTabs);
|
|
L.append(", numHomeNotifications=");
|
|
L.append(this.numHomeNotifications);
|
|
L.append(", numFriendsNotifications=");
|
|
return a.y(L, this.numFriendsNotifications, ")");
|
|
}
|
|
}
|
|
|
|
public final /* synthetic */ class WhenMappings {
|
|
public static final /* synthetic */ int[] $EnumSwitchMapping$0;
|
|
|
|
static {
|
|
NavigationTab.values();
|
|
int[] iArr = new int[6];
|
|
$EnumSwitchMapping$0 = iArr;
|
|
iArr[NavigationTab.HOME.ordinal()] = 1;
|
|
iArr[NavigationTab.FRIENDS.ordinal()] = 2;
|
|
}
|
|
}
|
|
|
|
static {
|
|
List<NavigationTab> list = k.toList(NavigationTab.values());
|
|
TAB_DESTINATIONS = list;
|
|
NavigationTab navigationTab = NavigationTab.HOME;
|
|
NON_HOME_TAB_DESTINATIONS = u.minus(list, navigationTab);
|
|
NavigationTab navigationTab2 = NavigationTab.FRIENDS;
|
|
NavigationTab navigationTab3 = NavigationTab.SETTINGS;
|
|
NO_GUILD_TABS = n0.setOf((Object[]) new NavigationTab[]{navigationTab, navigationTab2, navigationTab3});
|
|
NavigationTab navigationTab4 = NavigationTab.SEARCH;
|
|
AT_LEAST_ONE_GUILD_TABS = n0.setOf((Object[]) new NavigationTab[]{navigationTab, navigationTab2, navigationTab4, NavigationTab.MENTIONS, navigationTab3});
|
|
NavigationTab navigationTab5 = NavigationTab.DISCOVERY;
|
|
NO_GUILD_STAGE_DISCOVERY_EXPERIMENT_TABS = n0.setOf((Object[]) new NavigationTab[]{navigationTab, navigationTab2, navigationTab5, navigationTab3});
|
|
AT_LEAST_ONE_GUILD_STAGE_DISCOVERY_EXPERIMENT_TABS = n0.setOf((Object[]) new NavigationTab[]{navigationTab, navigationTab2, navigationTab4, navigationTab5, navigationTab3});
|
|
}
|
|
|
|
public TabsHostViewModel() {
|
|
this(null, null, null, null, 15, null);
|
|
}
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public TabsHostViewModel(BottomNavViewObserver bottomNavViewObserver, StoreTabsNavigation storeTabsNavigation, StoreNavigation storeNavigation, Observable<StoreState> observable) {
|
|
super(new ViewState(NavigationTab.HOME, false, 0, 0, NO_GUILD_TABS, 0, 0));
|
|
m.checkNotNullParameter(bottomNavViewObserver, "bottomNavViewObserver");
|
|
m.checkNotNullParameter(storeTabsNavigation, "storeTabsNavigation");
|
|
m.checkNotNullParameter(storeNavigation, "storeNavigation");
|
|
m.checkNotNullParameter(observable, "storeStateObservable");
|
|
this.storeTabsNavigation = storeTabsNavigation;
|
|
this.storeNavigation = storeNavigation;
|
|
this.eventSubject = PublishSubject.k0();
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(ObservableExtensionsKt.computationLatest(observable), this, null, 2, null), TabsHostViewModel.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new AnonymousClass1(this), 62, (Object) null);
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(bottomNavViewObserver.observeHeight(), this, null, 2, null), TabsHostViewModel.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new AnonymousClass2(this), 62, (Object) null);
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(storeTabsNavigation.observeDismissTabsDialogEvent(), this, null, 2, null), TabsHostViewModel.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new AnonymousClass3(this), 62, (Object) null);
|
|
}
|
|
|
|
/* JADX WARNING: Illegal instructions before constructor call */
|
|
public /* synthetic */ TabsHostViewModel(BottomNavViewObserver bottomNavViewObserver, StoreTabsNavigation storeTabsNavigation, StoreNavigation storeNavigation, Observable observable, int i, DefaultConstructorMarker defaultConstructorMarker) {
|
|
this(bottomNavViewObserver, storeTabsNavigation, storeNavigation, observable);
|
|
bottomNavViewObserver = (i & 1) != 0 ? BottomNavViewObserver.Companion.getINSTANCE() : bottomNavViewObserver;
|
|
storeTabsNavigation = (i & 2) != 0 ? StoreStream.Companion.getTabsNavigation() : storeTabsNavigation;
|
|
storeNavigation = (i & 4) != 0 ? StoreStream.Companion.getNavigation() : storeNavigation;
|
|
if ((i & 8) != 0) {
|
|
Companion companion = Companion;
|
|
StoreStream.Companion companion2 = StoreStream.Companion;
|
|
observable = Companion.access$observeStoreState(companion, storeNavigation, storeTabsNavigation, companion2.getUsers(), companion2.getGuilds(), companion2.getMentions(), companion2.getUserRelationships());
|
|
}
|
|
}
|
|
|
|
public static final /* synthetic */ void access$dismissSearchDialog(TabsHostViewModel tabsHostViewModel) {
|
|
tabsHostViewModel.dismissSearchDialog();
|
|
}
|
|
|
|
public static final /* synthetic */ Set access$getAT_LEAST_ONE_GUILD_STAGE_DISCOVERY_EXPERIMENT_TABS$cp() {
|
|
return AT_LEAST_ONE_GUILD_STAGE_DISCOVERY_EXPERIMENT_TABS;
|
|
}
|
|
|
|
public static final /* synthetic */ Set access$getAT_LEAST_ONE_GUILD_TABS$cp() {
|
|
return AT_LEAST_ONE_GUILD_TABS;
|
|
}
|
|
|
|
public static final /* synthetic */ List access$getNON_HOME_TAB_DESTINATIONS$cp() {
|
|
return NON_HOME_TAB_DESTINATIONS;
|
|
}
|
|
|
|
public static final /* synthetic */ Set access$getNO_GUILD_STAGE_DISCOVERY_EXPERIMENT_TABS$cp() {
|
|
return NO_GUILD_STAGE_DISCOVERY_EXPERIMENT_TABS;
|
|
}
|
|
|
|
public static final /* synthetic */ Set access$getNO_GUILD_TABS$cp() {
|
|
return NO_GUILD_TABS;
|
|
}
|
|
|
|
public static final /* synthetic */ List access$getTAB_DESTINATIONS$cp() {
|
|
return TAB_DESTINATIONS;
|
|
}
|
|
|
|
public static final /* synthetic */ void access$handleBottomNavHeight(TabsHostViewModel tabsHostViewModel, int i) {
|
|
tabsHostViewModel.handleBottomNavHeight(i);
|
|
}
|
|
|
|
public static final /* synthetic */ void access$handleStoreState(TabsHostViewModel tabsHostViewModel, StoreState storeState) {
|
|
tabsHostViewModel.handleStoreState(storeState);
|
|
}
|
|
|
|
private final void dismissSearchDialog() {
|
|
PublishSubject<Event> publishSubject = this.eventSubject;
|
|
publishSubject.j.onNext(Event.DismissSearchDialog.INSTANCE);
|
|
}
|
|
|
|
private final void emitTrackFriendsListShown() {
|
|
PublishSubject<Event> publishSubject = this.eventSubject;
|
|
publishSubject.j.onNext(Event.TrackFriendsListShown.INSTANCE);
|
|
}
|
|
|
|
@MainThread
|
|
private final void handleBottomNavHeight(int i) {
|
|
updateViewState(ViewState.copy$default(requireViewState(), null, false, i, 0, null, 0, 0, 123, null));
|
|
}
|
|
|
|
@MainThread
|
|
private final void handleStoreState(StoreState storeState) {
|
|
this.storeState = storeState;
|
|
NavigationTab selectedTab = storeState.getSelectedTab();
|
|
boolean z2 = NON_HOME_TAB_DESTINATIONS.contains(selectedTab) || (selectedTab == NavigationTab.HOME && (m.areEqual(storeState.getLeftPanelState(), PanelState.c.a) || m.areEqual(storeState.getLeftPanelState(), PanelState.d.a)));
|
|
Collection<Guild> values = storeState.getGuildIdToGuildMap().values();
|
|
Set<NavigationTab> set = (!(values.isEmpty() ^ true) || !storeState.getCanAccessStageDiscovery()) ? values.isEmpty() ^ true ? AT_LEAST_ONE_GUILD_TABS : storeState.getCanAccessStageDiscovery() ? NO_GUILD_STAGE_DISCOVERY_EXPERIMENT_TABS : NO_GUILD_TABS : AT_LEAST_ONE_GUILD_STAGE_DISCOVERY_EXPERIMENT_TABS;
|
|
Map<Long, Integer> userRelationships = storeState.getUserRelationships();
|
|
LinkedHashMap linkedHashMap = new LinkedHashMap();
|
|
for (Map.Entry<Long, Integer> entry : userRelationships.entrySet()) {
|
|
if (entry.getValue().intValue() == 3) {
|
|
linkedHashMap.put(entry.getKey(), entry.getValue());
|
|
}
|
|
}
|
|
updateViewState(ViewState.copy$default(requireViewState(), selectedTab, z2, 0, storeState.getMyUserId(), set, storeState.getNumTotalMentions(), linkedHashMap.size(), 4, null));
|
|
}
|
|
|
|
@MainThread
|
|
public final boolean handleBackPress() {
|
|
NavigationTab navigationTab;
|
|
NavigationTab selectedTab = requireViewState().getSelectedTab();
|
|
if (!TAB_DESTINATIONS.contains(selectedTab) || selectedTab == (navigationTab = NavigationTab.HOME)) {
|
|
return false;
|
|
}
|
|
selectTab(navigationTab);
|
|
return true;
|
|
}
|
|
|
|
public final Observable<Event> observeEvents() {
|
|
PublishSubject<Event> publishSubject = this.eventSubject;
|
|
m.checkNotNullExpressionValue(publishSubject, "eventSubject");
|
|
return publishSubject;
|
|
}
|
|
|
|
@MainThread
|
|
public final void selectTab(NavigationTab navigationTab) {
|
|
StoreNavigation.PanelAction panelAction;
|
|
m.checkNotNullParameter(navigationTab, "tab");
|
|
NavigationTab selectedTab = requireViewState().getSelectedTab();
|
|
StoreTabsNavigation.selectTab$default(this.storeTabsNavigation, navigationTab, false, 2, null);
|
|
int ordinal = navigationTab.ordinal();
|
|
if (ordinal == 0) {
|
|
if (selectedTab == NavigationTab.HOME) {
|
|
StoreState storeState = this.storeState;
|
|
if (m.areEqual(storeState != null ? storeState.getLeftPanelState() : null, PanelState.c.a)) {
|
|
panelAction = StoreNavigation.PanelAction.CLOSE;
|
|
StoreNavigation.setNavigationPanelAction$default(this.storeNavigation, panelAction, null, 2, null);
|
|
}
|
|
}
|
|
panelAction = StoreNavigation.PanelAction.OPEN;
|
|
StoreNavigation.setNavigationPanelAction$default(this.storeNavigation, panelAction, null, 2, null);
|
|
} else if (ordinal == 1) {
|
|
emitTrackFriendsListShown();
|
|
}
|
|
}
|
|
}
|