596 lines
32 KiB
Java
596 lines
32 KiB
Java
package com.discord.widgets.home;
|
|
|
|
import android.content.Context;
|
|
import android.graphics.Bitmap;
|
|
import android.graphics.Canvas;
|
|
import android.graphics.Rect;
|
|
import android.os.Bundle;
|
|
import android.text.TextUtils;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.widget.FrameLayout;
|
|
import android.widget.ImageView;
|
|
import android.widget.TextView;
|
|
import androidx.appcompat.widget.Toolbar;
|
|
import androidx.core.view.ViewCompat;
|
|
import androidx.core.view.ViewGroupKt;
|
|
import androidx.fragment.app.Fragment;
|
|
import androidx.fragment.app.FragmentManager;
|
|
import androidx.fragment.app.FragmentViewModelLazyKt;
|
|
import c.a.d.h0;
|
|
import c.a.d.j0;
|
|
import c.a.i.v4;
|
|
import c.a.i.w4;
|
|
import c.a.i.x4;
|
|
import c.a.i.z4;
|
|
import c.a.p.b;
|
|
import c.d.b.a.a;
|
|
import com.discord.app.AppActivity;
|
|
import com.discord.app.AppFragment;
|
|
import com.discord.databinding.WidgetHomeBinding;
|
|
import com.discord.panels.OverlappingPanelsLayout;
|
|
import com.discord.stores.StoreChannelsSelected;
|
|
import com.discord.stores.StoreConnectionOpen;
|
|
import com.discord.stores.StoreNavigation;
|
|
import com.discord.stores.StoreNotices;
|
|
import com.discord.stores.StoreNux;
|
|
import com.discord.stores.StoreStream;
|
|
import com.discord.stores.StoreTabsNavigation;
|
|
import com.discord.stores.StoreUser;
|
|
import com.discord.utilities.channel.ChannelSelector;
|
|
import com.discord.utilities.color.ColorCompat;
|
|
import com.discord.utilities.dimen.DimenUtils;
|
|
import com.discord.utilities.locale.LocaleManager;
|
|
import com.discord.utilities.rx.ObservableExtensionsKt;
|
|
import com.discord.utilities.rx.ObservableExtensionsKt$filterNull$1;
|
|
import com.discord.utilities.rx.ObservableExtensionsKt$filterNull$2;
|
|
import com.discord.utilities.surveys.SurveyUtils;
|
|
import com.discord.utilities.time.ClockFactory;
|
|
import com.discord.utilities.view.extensions.ViewExtensions;
|
|
import com.discord.utilities.view.rounded.RoundedRelativeLayout;
|
|
import com.discord.utilities.viewbinding.FragmentViewBindingDelegate;
|
|
import com.discord.utilities.viewbinding.FragmentViewBindingDelegateKt;
|
|
import com.discord.widgets.accessibility.AccessibilityDetectionNavigator;
|
|
import com.discord.widgets.channels.WidgetChannelOnboarding;
|
|
import com.discord.widgets.chat.input.SmoothKeyboardReactionHelper;
|
|
import com.discord.widgets.chat.list.WidgetChatList;
|
|
import com.discord.widgets.guilds.join.WidgetGuildWelcomeSheet;
|
|
import com.discord.widgets.home.WidgetHomeViewModel;
|
|
import com.discord.widgets.hubs.WidgetDiscordHubEmailFlow;
|
|
import com.discord.widgets.notice.WidgetNoticeNuxSamsungLink;
|
|
import com.discord.widgets.status.WidgetGlobalStatusIndicatorState;
|
|
import com.discord.widgets.tabs.NavigationTab;
|
|
import com.discord.widgets.tabs.OnTabSelectedListener;
|
|
import com.discord.widgets.tabs.WidgetTabsHost;
|
|
import com.google.android.material.appbar.AppBarLayout;
|
|
import d0.t.m0;
|
|
import d0.t.u;
|
|
import d0.z.d.a0;
|
|
import d0.z.d.m;
|
|
import java.io.Serializable;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import java.util.Objects;
|
|
import java.util.Set;
|
|
import kotlin.Lazy;
|
|
import kotlin.Unit;
|
|
import kotlin.jvm.functions.Function0;
|
|
import kotlin.jvm.functions.Function1;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
import kotlin.reflect.KProperty;
|
|
import rx.Observable;
|
|
/* compiled from: WidgetHome.kt */
|
|
public final class WidgetHome extends AppFragment implements OnTabSelectedListener, b.a {
|
|
public static final /* synthetic */ KProperty[] $$delegatedProperties = {a.W(WidgetHome.class, "binding", "getBinding()Lcom/discord/databinding/WidgetHomeBinding;", 0)};
|
|
public static final Companion Companion = new Companion(null);
|
|
private static final long DELAY_DRAWER_OPEN_FINISH = 2000;
|
|
private static final long DELAY_DRAWER_OPEN_START = 1000;
|
|
private final FragmentViewBindingDelegate binding$delegate = FragmentViewBindingDelegateKt.viewBinding$default(this, WidgetHome$binding$2.INSTANCE, null, 2, null);
|
|
private final Set<Integer> fixedPositionViewIds;
|
|
private final WidgetGlobalStatusIndicatorState globalStatusIndicatorStateObserver;
|
|
private final LeftPanelManager leftPanelManager;
|
|
private final LocaleManager localeManager;
|
|
private Function1<? super View, Unit> onGuildListAddHintCreate;
|
|
private WidgetHomePanelLoading panelLoading;
|
|
private WidgetHomePanelNsfw panelNsfw;
|
|
private final StoreTabsNavigation storeTabsNavigation;
|
|
private final Lazy viewModel$delegate;
|
|
|
|
/* compiled from: WidgetHome.kt */
|
|
public static final class Companion {
|
|
private Companion() {
|
|
}
|
|
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
}
|
|
|
|
public final /* synthetic */ class WhenMappings {
|
|
public static final /* synthetic */ int[] $EnumSwitchMapping$0;
|
|
|
|
static {
|
|
OverlappingPanelsLayout.Panel.values();
|
|
int[] iArr = new int[3];
|
|
$EnumSwitchMapping$0 = iArr;
|
|
iArr[OverlappingPanelsLayout.Panel.END.ordinal()] = 1;
|
|
iArr[OverlappingPanelsLayout.Panel.CENTER.ordinal()] = 2;
|
|
iArr[OverlappingPanelsLayout.Panel.START.ordinal()] = 3;
|
|
}
|
|
}
|
|
|
|
public WidgetHome() {
|
|
super(2131559082);
|
|
WidgetHome$viewModel$2 widgetHome$viewModel$2 = WidgetHome$viewModel$2.INSTANCE;
|
|
h0 h0Var = new h0(this);
|
|
this.viewModel$delegate = FragmentViewModelLazyKt.createViewModelLazy(this, a0.getOrCreateKotlinClass(WidgetHomeViewModel.class), new WidgetHome$appViewModels$$inlined$viewModels$1(h0Var), new j0(widgetHome$viewModel$2));
|
|
this.fixedPositionViewIds = m0.setOf(2131365459);
|
|
this.leftPanelManager = new LeftPanelManager(null, null, 3, null);
|
|
this.localeManager = new LocaleManager();
|
|
this.onGuildListAddHintCreate = WidgetHome$onGuildListAddHintCreate$1.INSTANCE;
|
|
this.storeTabsNavigation = StoreStream.Companion.getTabsNavigation();
|
|
this.globalStatusIndicatorStateObserver = WidgetGlobalStatusIndicatorState.Provider.get();
|
|
}
|
|
|
|
public static final /* synthetic */ void access$configureFirstOpen(WidgetHome widgetHome) {
|
|
widgetHome.configureFirstOpen();
|
|
}
|
|
|
|
public static final /* synthetic */ void access$configureUI(WidgetHome widgetHome, WidgetHomeModel widgetHomeModel) {
|
|
widgetHome.configureUI(widgetHomeModel);
|
|
}
|
|
|
|
public static final /* synthetic */ WidgetHomeBinding access$getBinding$p(WidgetHome widgetHome) {
|
|
return widgetHome.getBinding();
|
|
}
|
|
|
|
public static final /* synthetic */ LocaleManager access$getLocaleManager$p(WidgetHome widgetHome) {
|
|
return widgetHome.localeManager;
|
|
}
|
|
|
|
public static final /* synthetic */ WidgetHomePanelNsfw access$getPanelNsfw$p(WidgetHome widgetHome) {
|
|
return widgetHome.panelNsfw;
|
|
}
|
|
|
|
public static final /* synthetic */ WidgetHomeViewModel access$getViewModel$p(WidgetHome widgetHome) {
|
|
return widgetHome.getViewModel();
|
|
}
|
|
|
|
public static final /* synthetic */ boolean access$handleBackPressed(WidgetHome widgetHome) {
|
|
return widgetHome.handleBackPressed();
|
|
}
|
|
|
|
public static final /* synthetic */ void access$handleCenterPanelBack(WidgetHome widgetHome) {
|
|
widgetHome.handleCenterPanelBack();
|
|
}
|
|
|
|
public static final /* synthetic */ void access$handleEvent(WidgetHome widgetHome, WidgetHomeViewModel.Event event) {
|
|
widgetHome.handleEvent(event);
|
|
}
|
|
|
|
public static final /* synthetic */ void access$handleGlobalStatusIndicatorState(WidgetHome widgetHome, WidgetGlobalStatusIndicatorState.State state) {
|
|
widgetHome.handleGlobalStatusIndicatorState(state);
|
|
}
|
|
|
|
public static final /* synthetic */ void access$handleViewState(WidgetHome widgetHome, WidgetHomeViewModel.ViewState viewState) {
|
|
widgetHome.handleViewState(viewState);
|
|
}
|
|
|
|
public static final /* synthetic */ void access$maybeShowHubEmailUpsell(WidgetHome widgetHome) {
|
|
widgetHome.maybeShowHubEmailUpsell();
|
|
}
|
|
|
|
public static final /* synthetic */ void access$setPanelNsfw$p(WidgetHome widgetHome, WidgetHomePanelNsfw widgetHomePanelNsfw) {
|
|
widgetHome.panelNsfw = widgetHomePanelNsfw;
|
|
}
|
|
|
|
public static final /* synthetic */ void access$showSurvey(WidgetHome widgetHome, SurveyUtils.Survey survey) {
|
|
widgetHome.showSurvey(survey);
|
|
}
|
|
|
|
public static final /* synthetic */ void access$showUrgentMessageDialog(WidgetHome widgetHome) {
|
|
widgetHome.showUrgentMessageDialog();
|
|
}
|
|
|
|
private final void animatePeek(WidgetHomeViewModel.Event event) {
|
|
View view;
|
|
long j;
|
|
float f;
|
|
float f2;
|
|
View view2;
|
|
Fragment findFragmentById = getChildFragmentManager().findFragmentById(2131365715);
|
|
if (!(findFragmentById instanceof WidgetChatList)) {
|
|
findFragmentById = null;
|
|
}
|
|
WidgetChatList widgetChatList = (WidgetChatList) findFragmentById;
|
|
if (widgetChatList != null) {
|
|
v4 v4Var = getBinding().d;
|
|
m.checkNotNullExpressionValue(v4Var, "binding.panelCenter");
|
|
RoundedRelativeLayout roundedRelativeLayout = v4Var.a;
|
|
m.checkNotNullExpressionValue(roundedRelativeLayout, "binding.panelCenter.root");
|
|
Bitmap createBitmap = Bitmap.createBitmap(roundedRelativeLayout.getMeasuredWidth(), roundedRelativeLayout.getMeasuredHeight(), Bitmap.Config.ARGB_8888);
|
|
roundedRelativeLayout.draw(new Canvas(createBitmap));
|
|
getBinding().g.setImageBitmap(createBitmap);
|
|
if (event instanceof WidgetHomeViewModel.Event.AnimatePeekIn) {
|
|
View view3 = getBinding().g;
|
|
m.checkNotNullExpressionValue(view3, "binding.peekTransitionBitmap");
|
|
f = (float) roundedRelativeLayout.getRight();
|
|
view2 = view3;
|
|
view = roundedRelativeLayout;
|
|
j = 250;
|
|
f2 = 0.0f;
|
|
} else {
|
|
view = getBinding().g;
|
|
m.checkNotNullExpressionValue(view, "binding.peekTransitionBitmap");
|
|
view2 = roundedRelativeLayout;
|
|
j = 200;
|
|
f2 = (float) roundedRelativeLayout.getRight();
|
|
f = 0.0f;
|
|
}
|
|
view.setTranslationX(f);
|
|
view.animate().setDuration(j).translationX(f2).withEndAction(new WidgetHome$animatePeek$1(this, widgetChatList)).start();
|
|
view2.setTranslationX(f - ((float) roundedRelativeLayout.getMeasuredWidth()));
|
|
view2.animate().setDuration(j).translationX(f2 - ((float) roundedRelativeLayout.getMeasuredWidth())).start();
|
|
widgetChatList.disableItemAnimations();
|
|
ImageView imageView = getBinding().g;
|
|
m.checkNotNullExpressionValue(imageView, "binding.peekTransitionBitmap");
|
|
imageView.setVisibility(0);
|
|
}
|
|
}
|
|
|
|
private final void configureFirstOpen() {
|
|
StoreStream.Companion companion = StoreStream.Companion;
|
|
Observable y2 = Observable.j(StoreConnectionOpen.observeConnectionOpen$default(companion.getConnectionOpen(), false, 1, null), companion.getChannels().observeGuildAndPrivateChannels(), WidgetHome$configureFirstOpen$1.INSTANCE).y();
|
|
m.checkNotNullExpressionValue(y2, "Observable\n .comb… }\n .first()");
|
|
ObservableExtensionsKt.appSubscribe$default(y2, WidgetHome.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetHome$configureFirstOpen$2(this), 62, (Object) null);
|
|
}
|
|
|
|
private final void configureLeftPanel() {
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(ObservableExtensionsKt.computationLatest(this.leftPanelManager.observeLockState()), this, null, 2, null), WidgetHome.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetHome$configureLeftPanel$1(this), 62, (Object) null);
|
|
}
|
|
|
|
private final void configureNavigationDrawerAction(StoreNavigation storeNavigation) {
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(storeNavigation.getNavigationPanelAction(), this, null, 2, null), StoreNavigation.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetHome$configureNavigationDrawerAction$1(this, storeNavigation), 62, (Object) null);
|
|
}
|
|
|
|
private final void configureOverlappingPanels() {
|
|
getBinding().f1833c.registerStartPanelStateListeners(new WidgetHome$configureOverlappingPanels$1(this));
|
|
getBinding().f1833c.registerEndPanelStateListeners(new WidgetHome$configureOverlappingPanels$2(this));
|
|
}
|
|
|
|
private final void configureUI(WidgetHomeModel widgetHomeModel) {
|
|
getViewModel().setWidgetHomeModel$app_productionBetaRelease(widgetHomeModel);
|
|
if (isOnHomeTab()) {
|
|
WidgetHomeHeaderManager.INSTANCE.configure(this, widgetHomeModel);
|
|
}
|
|
WidgetHomePanelNsfw widgetHomePanelNsfw = this.panelNsfw;
|
|
if (widgetHomePanelNsfw != null) {
|
|
widgetHomePanelNsfw.configureUI(widgetHomeModel);
|
|
}
|
|
}
|
|
|
|
private final WidgetHomeBinding getBinding() {
|
|
return (WidgetHomeBinding) this.binding$delegate.getValue((Fragment) this, $$delegatedProperties[0]);
|
|
}
|
|
|
|
private final WidgetHomeViewModel getViewModel() {
|
|
return (WidgetHomeViewModel) this.viewModel$delegate.getValue();
|
|
}
|
|
|
|
private final boolean handleBackPressed() {
|
|
int ordinal = getBinding().f1833c.getSelectedPanel().ordinal();
|
|
if (ordinal == 0) {
|
|
requireActivity().moveTaskToBack(true);
|
|
} else if (ordinal == 1) {
|
|
handleCenterPanelBack();
|
|
} else if (ordinal == 2) {
|
|
getBinding().f1833c.closePanels();
|
|
}
|
|
return true;
|
|
}
|
|
|
|
private final void handleCenterPanelBack() {
|
|
WidgetHomeModel widgetHomeModel$app_productionBetaRelease = getViewModel().getWidgetHomeModel$app_productionBetaRelease();
|
|
StoreChannelsSelected.ResolvedSelectedChannel selectedChannel = widgetHomeModel$app_productionBetaRelease != null ? widgetHomeModel$app_productionBetaRelease.getSelectedChannel() : null;
|
|
if (selectedChannel instanceof StoreChannelsSelected.ResolvedSelectedChannel.ThreadDraft) {
|
|
ChannelSelector.Companion.getInstance().dismissCreateThread();
|
|
return;
|
|
}
|
|
if (selectedChannel instanceof StoreChannelsSelected.ResolvedSelectedChannel.Channel) {
|
|
StoreChannelsSelected.ResolvedSelectedChannel.Channel channel = (StoreChannelsSelected.ResolvedSelectedChannel.Channel) selectedChannel;
|
|
if (channel.getPeekParent() != null) {
|
|
ChannelSelector.selectChannel$default(ChannelSelector.Companion.getInstance(), channel.getChannel().f(), channel.getPeekParent().longValue(), null, null, 12, null);
|
|
return;
|
|
}
|
|
}
|
|
getBinding().f1833c.openStartPanel();
|
|
}
|
|
|
|
private final void handleEvent(WidgetHomeViewModel.Event event) {
|
|
if (m.areEqual(event, WidgetHomeViewModel.Event.OpenLeftPanel.INSTANCE)) {
|
|
getBinding().f1833c.openStartPanel();
|
|
} else if (m.areEqual(event, WidgetHomeViewModel.Event.ClosePanels.INSTANCE)) {
|
|
getBinding().f1833c.closePanels();
|
|
} else if (m.areEqual(event, WidgetHomeViewModel.Event.UnlockLeftPanel.INSTANCE)) {
|
|
getBinding().f1833c.setStartPanelLockState(OverlappingPanelsLayout.LockState.UNLOCKED);
|
|
} else if (m.areEqual(event, WidgetHomeViewModel.Event.ShowChannelOnboardingSheet.INSTANCE)) {
|
|
showChannelOnboardingSheet();
|
|
} else if (m.areEqual(event, WidgetHomeViewModel.Event.AnimatePeekIn.INSTANCE) || m.areEqual(event, WidgetHomeViewModel.Event.AnimatePeekOut.INSTANCE)) {
|
|
animatePeek(event);
|
|
} else if (event instanceof WidgetHomeViewModel.Event.ShowGuildWelcomeSheet) {
|
|
showWelcomeSheet(((WidgetHomeViewModel.Event.ShowGuildWelcomeSheet) event).getGuildId());
|
|
}
|
|
}
|
|
|
|
private final void handleGlobalStatusIndicatorState(WidgetGlobalStatusIndicatorState.State state) {
|
|
if (state.isCustomBackground()) {
|
|
unroundPanelCorners();
|
|
} else {
|
|
roundPanelCorners();
|
|
}
|
|
}
|
|
|
|
private final void handleHomeConfig(HomeConfig homeConfig) {
|
|
if (homeConfig != null && homeConfig.getGuildWelcomeSheetId() != null) {
|
|
showWelcomeSheet(homeConfig.getGuildWelcomeSheetId().longValue());
|
|
}
|
|
}
|
|
|
|
private final void handleViewState(WidgetHomeViewModel.ViewState viewState) {
|
|
getBinding().f1833c.handleStartPanelState(viewState.getLeftPanelState());
|
|
getBinding().f1833c.handleEndPanelState(viewState.getRightPanelState());
|
|
}
|
|
|
|
private final boolean isOnHomeTab() {
|
|
return this.storeTabsNavigation.getSelectedTab() == NavigationTab.HOME;
|
|
}
|
|
|
|
private final void maybeShowHubEmailUpsell() {
|
|
StoreNotices notices = StoreStream.Companion.getNotices();
|
|
String name = WidgetDiscordHubEmailFlow.class.getName();
|
|
m.checkNotNullExpressionValue(name, "WidgetDiscordHubEmailFlow::class.java.name");
|
|
notices.requestToShow(new StoreNotices.Notice(name, null, 0, 0, true, d0.t.m.listOf(a0.getOrCreateKotlinClass(WidgetHome.class)), 0, true, Long.MAX_VALUE, WidgetHome$maybeShowHubEmailUpsell$1.INSTANCE, 6, null));
|
|
}
|
|
|
|
private final void roundPanelCorners() {
|
|
float dpToPixels = (float) DimenUtils.dpToPixels(8);
|
|
v4 v4Var = getBinding().d;
|
|
m.checkNotNullExpressionValue(v4Var, "binding.panelCenter");
|
|
v4Var.a.updateTopLeftRadius(dpToPixels);
|
|
v4 v4Var2 = getBinding().d;
|
|
m.checkNotNullExpressionValue(v4Var2, "binding.panelCenter");
|
|
v4Var2.a.updateTopRightRadius(dpToPixels);
|
|
getBinding().f.b.updateTopLeftRadius(dpToPixels);
|
|
getBinding().f.b.updateTopRightRadius(dpToPixels);
|
|
}
|
|
|
|
private final void setPanelWindowInsetsListeners() {
|
|
FrameLayout frameLayout = getBinding().h;
|
|
m.checkNotNullExpressionValue(frameLayout, "binding.widgetHomeContainer");
|
|
ViewExtensions.setForwardingWindowInsetsListener(frameLayout);
|
|
HomePanelsLayout homePanelsLayout = getBinding().f1833c;
|
|
m.checkNotNullExpressionValue(homePanelsLayout, "binding.overlappingPanels");
|
|
ViewExtensions.setForwardingWindowInsetsListener(homePanelsLayout);
|
|
x4 x4Var = getBinding().e;
|
|
m.checkNotNullExpressionValue(x4Var, "binding.panelLeft");
|
|
ViewCompat.setOnApplyWindowInsetsListener(x4Var.a, new WidgetHome$setPanelWindowInsetsListeners$1(this));
|
|
v4 v4Var = getBinding().d;
|
|
m.checkNotNullExpressionValue(v4Var, "binding.panelCenter");
|
|
ViewCompat.setOnApplyWindowInsetsListener(v4Var.a, new WidgetHome$setPanelWindowInsetsListeners$2(this));
|
|
z4 z4Var = getBinding().f;
|
|
m.checkNotNullExpressionValue(z4Var, "binding.panelRight");
|
|
ViewCompat.setOnApplyWindowInsetsListener(z4Var.a, new WidgetHome$setPanelWindowInsetsListeners$3(this));
|
|
}
|
|
|
|
private final void setUpToolbar() {
|
|
setActionBarDisplayHomeAsUpEnabled(true, 2131231755, 2131894141, Integer.valueOf(ColorCompat.getThemedColor(requireContext(), 2130968946)));
|
|
Toolbar toolbar = getToolbar();
|
|
if (toolbar != null) {
|
|
toolbar.setNavigationOnClickListener(new WidgetHome$setUpToolbar$1(this));
|
|
}
|
|
}
|
|
|
|
private final void setupSmoothKeyboardReaction() {
|
|
v4 v4Var = getBinding().d;
|
|
m.checkNotNullExpressionValue(v4Var, "binding.panelCenter");
|
|
RoundedRelativeLayout roundedRelativeLayout = v4Var.a;
|
|
m.checkNotNullExpressionValue(roundedRelativeLayout, "binding.panelCenter.root");
|
|
Iterator<View> it = ViewGroupKt.iterator(roundedRelativeLayout);
|
|
while (it.hasNext()) {
|
|
View next = it.next();
|
|
if (!(next instanceof AppBarLayout) && !this.fixedPositionViewIds.contains(Integer.valueOf(next.getId()))) {
|
|
SmoothKeyboardReactionHelper.INSTANCE.install(next);
|
|
}
|
|
}
|
|
}
|
|
|
|
private final void showChannelOnboardingSheet() {
|
|
WidgetChannelOnboarding.Companion companion = WidgetChannelOnboarding.Companion;
|
|
FragmentManager parentFragmentManager = getParentFragmentManager();
|
|
m.checkNotNullExpressionValue(parentFragmentManager, "parentFragmentManager");
|
|
companion.show(parentFragmentManager);
|
|
}
|
|
|
|
private final void showSurvey(SurveyUtils.Survey survey) {
|
|
StoreStream.Companion.getNotices().requestToShow(new StoreNotices.Notice(survey.getNoticeKey(), null, 0, 5, true, null, 0, false, 0, new WidgetHome$showSurvey$1(survey), 486, null));
|
|
}
|
|
|
|
private final void showUrgentMessageDialog() {
|
|
StoreStream.Companion.getNotices().requestToShow(new StoreNotices.Notice("URGENT_MESSAGE_DIALOG", null, 0, 0, false, null, 0, false, 0, WidgetHome$showUrgentMessageDialog$1.INSTANCE, 166, null));
|
|
}
|
|
|
|
private final void showWelcomeSheet(long j) {
|
|
WidgetGuildWelcomeSheet.Companion companion = WidgetGuildWelcomeSheet.Companion;
|
|
FragmentManager parentFragmentManager = getParentFragmentManager();
|
|
m.checkNotNullExpressionValue(parentFragmentManager, "parentFragmentManager");
|
|
companion.show(parentFragmentManager, j);
|
|
}
|
|
|
|
private final void unroundPanelCorners() {
|
|
v4 v4Var = getBinding().d;
|
|
m.checkNotNullExpressionValue(v4Var, "binding.panelCenter");
|
|
v4Var.a.updateTopLeftRadius(0.0f);
|
|
v4 v4Var2 = getBinding().d;
|
|
m.checkNotNullExpressionValue(v4Var2, "binding.panelCenter");
|
|
v4Var2.a.updateTopRightRadius(0.0f);
|
|
getBinding().f.b.updateTopLeftRadius(0.0f);
|
|
getBinding().f.b.updateTopRightRadius(0.0f);
|
|
}
|
|
|
|
public final PanelLayout getPanelLayout() {
|
|
HomePanelsLayout homePanelsLayout = getBinding().f1833c;
|
|
m.checkNotNullExpressionValue(homePanelsLayout, "binding.overlappingPanels");
|
|
return homePanelsLayout;
|
|
}
|
|
|
|
public final Toolbar getToolbar() {
|
|
AppActivity appActivity = getAppActivity();
|
|
if (appActivity != null) {
|
|
return appActivity.t;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public final TextView getUnreadCountView() {
|
|
w4 w4Var = getBinding().d.f172c;
|
|
m.checkNotNullExpressionValue(w4Var, "binding.panelCenter.unread");
|
|
TextView textView = w4Var.a;
|
|
m.checkNotNullExpressionValue(textView, "binding.panelCenter.unread.root");
|
|
return textView;
|
|
}
|
|
|
|
public final void lockCloseRightPanel(boolean z2) {
|
|
getBinding().f1833c.setEndPanelLockState(z2 ? OverlappingPanelsLayout.LockState.CLOSE : OverlappingPanelsLayout.LockState.UNLOCKED);
|
|
}
|
|
|
|
@Override // androidx.fragment.app.Fragment
|
|
public void onCreate(Bundle bundle) {
|
|
super.onCreate(bundle);
|
|
c.a.p.a aVar = c.a.p.a.b;
|
|
WidgetHome$onCreate$1 widgetHome$onCreate$1 = new WidgetHome$onCreate$1(this);
|
|
m.checkParameterIsNotNull(widgetHome$onCreate$1, "provider");
|
|
c.a.p.a.a = widgetHome$onCreate$1;
|
|
}
|
|
|
|
@Override // c.a.p.b.a
|
|
public void onGestureRegionsUpdate(List<Rect> list) {
|
|
m.checkNotNullParameter(list, "gestureRegions");
|
|
getBinding().f1833c.setChildGestureRegions(list);
|
|
}
|
|
|
|
@Override // com.discord.app.AppFragment, androidx.fragment.app.Fragment
|
|
public void onPause() {
|
|
super.onPause();
|
|
b a = b.C0032b.a();
|
|
m.checkParameterIsNotNull(this, "gestureRegionsListener");
|
|
a.j.remove(this);
|
|
}
|
|
|
|
@Override // com.discord.app.AppFragment, androidx.fragment.app.Fragment
|
|
public void onResume() {
|
|
super.onResume();
|
|
b a = b.C0032b.a();
|
|
m.checkParameterIsNotNull(this, "gestureRegionsListener");
|
|
onGestureRegionsUpdate(u.toList(a.i.values()));
|
|
a.j.add(this);
|
|
}
|
|
|
|
@Override // com.discord.widgets.tabs.OnTabSelectedListener
|
|
public void onTabSelected() {
|
|
WidgetHomeModel widgetHomeModel$app_productionBetaRelease = getViewModel().getWidgetHomeModel$app_productionBetaRelease();
|
|
if (widgetHomeModel$app_productionBetaRelease != null) {
|
|
WidgetHomeHeaderManager.INSTANCE.configure(this, widgetHomeModel$app_productionBetaRelease);
|
|
}
|
|
if (getBinding().f1833c.getSelectedPanel() == OverlappingPanelsLayout.Panel.CENTER) {
|
|
setActionBarTitleAccessibilityViewFocused();
|
|
}
|
|
}
|
|
|
|
@Override // com.discord.app.AppFragment
|
|
public void onViewBound(View view) {
|
|
m.checkNotNullParameter(view, "view");
|
|
super.onViewBound(view);
|
|
boolean z2 = TextUtils.getLayoutDirectionFromLocale(new LocaleManager().getPrimaryLocale(requireContext())) == 0;
|
|
RoundedRelativeLayout roundedRelativeLayout = getBinding().f.b;
|
|
m.checkNotNullExpressionValue(roundedRelativeLayout, "binding.panelRight.mainPanelRightRoundedContainer");
|
|
ViewGroup.LayoutParams layoutParams = roundedRelativeLayout.getLayoutParams();
|
|
Objects.requireNonNull(layoutParams, "null cannot be cast to non-null type android.view.ViewGroup.MarginLayoutParams");
|
|
ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) layoutParams;
|
|
int dpToPixels = DimenUtils.dpToPixels(8);
|
|
int i = z2 ? marginLayoutParams.leftMargin : dpToPixels;
|
|
if (!z2) {
|
|
dpToPixels = marginLayoutParams.rightMargin;
|
|
}
|
|
marginLayoutParams.setMargins(i, marginLayoutParams.topMargin, dpToPixels, marginLayoutParams.bottomMargin);
|
|
RoundedRelativeLayout roundedRelativeLayout2 = getBinding().f.b;
|
|
m.checkNotNullExpressionValue(roundedRelativeLayout2, "binding.panelRight.mainPanelRightRoundedContainer");
|
|
roundedRelativeLayout2.setLayoutParams(marginLayoutParams);
|
|
setUpToolbar();
|
|
Fragment parentFragment = getParentFragment();
|
|
if (!(parentFragment instanceof WidgetTabsHost)) {
|
|
parentFragment = null;
|
|
}
|
|
WidgetTabsHost widgetTabsHost = (WidgetTabsHost) parentFragment;
|
|
if (widgetTabsHost != null) {
|
|
widgetTabsHost.registerTabSelectionListener(NavigationTab.HOME, this);
|
|
}
|
|
WidgetHomeBinding binding = getBinding();
|
|
m.checkNotNullExpressionValue(binding, "binding");
|
|
FragmentManager childFragmentManager = getChildFragmentManager();
|
|
m.checkNotNullExpressionValue(childFragmentManager, "childFragmentManager");
|
|
this.panelNsfw = new WidgetHomePanelNsfw(binding, this, childFragmentManager);
|
|
WidgetHomeBinding binding2 = getBinding();
|
|
m.checkNotNullExpressionValue(binding2, "binding");
|
|
this.panelLoading = new WidgetHomePanelLoading(binding2);
|
|
Function1<? super View, Unit> function1 = this.onGuildListAddHintCreate;
|
|
TextView textView = getBinding().e.b;
|
|
m.checkNotNullExpressionValue(textView, "binding.panelLeft.guildListAddHint");
|
|
function1.invoke(textView);
|
|
AppFragment.setOnBackPressed$default(this, new WidgetHome$onViewBound$1(this), 0, 2, null);
|
|
WidgetNoticeNuxSamsungLink.Companion.enqueue(requireContext(), ClockFactory.get());
|
|
setPanelWindowInsetsListeners();
|
|
setupSmoothKeyboardReaction();
|
|
}
|
|
|
|
@Override // com.discord.app.AppFragment
|
|
public void onViewBoundOrOnResume() {
|
|
super.onViewBoundOrOnResume();
|
|
Serializable serializableExtra = getMostRecentIntent().getSerializableExtra("com.discord.intent.extra.EXTRA_HOME_CONFIG");
|
|
if (!(serializableExtra instanceof HomeConfig)) {
|
|
serializableExtra = null;
|
|
}
|
|
handleHomeConfig((HomeConfig) serializableExtra);
|
|
WidgetHomePanelLoading widgetHomePanelLoading = this.panelLoading;
|
|
if (widgetHomePanelLoading != null) {
|
|
widgetHomePanelLoading.configure(this);
|
|
}
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.bindToComponentLifecycle(getViewModel().observeViewState(), this), WidgetHome.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetHome$onViewBoundOrOnResume$1(this), 62, (Object) null);
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.bindToComponentLifecycle(getViewModel().observeEvents(), this), WidgetHome.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetHome$onViewBoundOrOnResume$2(this), 62, (Object) null);
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(WidgetHomeModel.Companion.get(), this, null, 2, null), WidgetHome.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetHome$onViewBoundOrOnResume$3(this), 62, (Object) null);
|
|
AccessibilityDetectionNavigator.INSTANCE.enqueueNoticeWhenEnabled(this);
|
|
StoreStream.Companion companion = StoreStream.Companion;
|
|
configureNavigationDrawerAction(companion.getNavigation());
|
|
configureOverlappingPanels();
|
|
Observable F = ObservableExtensionsKt.ui$default(ObservableExtensionsKt.takeSingleUntilTimeout$default(SurveyUtils.INSTANCE.getSurveyToShow(), 0, false, 3, null), this, null, 2, null).x(ObservableExtensionsKt$filterNull$1.INSTANCE).F(ObservableExtensionsKt$filterNull$2.INSTANCE);
|
|
m.checkNotNullExpressionValue(F, "filter { it != null }.map { it!! }");
|
|
Observable x2 = F.x(WidgetHome$onViewBoundOrOnResume$4.INSTANCE);
|
|
m.checkNotNullExpressionValue(x2, "SurveyUtils\n .get…SurveyUtils.Survey.None }");
|
|
ObservableExtensionsKt.appSubscribe$default(x2, WidgetHome.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetHome$onViewBoundOrOnResume$5(this), 62, (Object) null);
|
|
Observable<StoreNux.NuxState> x3 = companion.getNux().getNuxState().x(WidgetHome$onViewBoundOrOnResume$6.INSTANCE);
|
|
m.checkNotNullExpressionValue(x3, "StoreStream\n .get… .filter { it.firstOpen }");
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(ObservableExtensionsKt.takeSingleUntilTimeout$default(x3, 0, false, 1, null), this, null, 2, null), WidgetHome.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetHome$onViewBoundOrOnResume$7(this), 62, (Object) null);
|
|
Observable<StoreNux.NuxState> x4 = companion.getNux().getNuxState().x(WidgetHome$onViewBoundOrOnResume$8.INSTANCE);
|
|
m.checkNotNullExpressionValue(x4, "StoreStream\n .get…mailConnectionEnabled() }");
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(ObservableExtensionsKt.takeSingleUntilTimeout$default(x4, 0, false, 1, null), this, null, 2, null), WidgetHome.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetHome$onViewBoundOrOnResume$9(this), 62, (Object) null);
|
|
Observable x5 = StoreUser.observeMe$default(companion.getUsers(), false, 1, null).x(WidgetHome$onViewBoundOrOnResume$10.INSTANCE);
|
|
m.checkNotNullExpressionValue(x5, "StoreStream\n .get…hasUnreadUrgentMessages }");
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(x5, this, null, 2, null), WidgetHome.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetHome$onViewBoundOrOnResume$11(this), 62, (Object) null);
|
|
configureLeftPanel();
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.bindToComponentLifecycle(this.globalStatusIndicatorStateObserver.observeState(), this), WidgetHome.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetHome$onViewBoundOrOnResume$12(this), 62, (Object) null);
|
|
}
|
|
|
|
public final void setOnGuildListAddHintCreate(Function1<? super View, Unit> function1) {
|
|
m.checkNotNullParameter(function1, "onGuildListAddHintCreate");
|
|
this.onGuildListAddHintCreate = function1;
|
|
}
|
|
}
|