forked from Juby210/discord-jadx
863 lines
49 KiB
Java
863 lines
49 KiB
Java
package com.discord.widgets.user.usersheet;
|
|
|
|
import android.content.Context;
|
|
import android.os.Bundle;
|
|
import android.view.LayoutInflater;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.widget.Button;
|
|
import android.widget.FrameLayout;
|
|
import android.widget.ImageView;
|
|
import android.widget.LinearLayout;
|
|
import android.widget.TextView;
|
|
import androidx.cardview.widget.CardView;
|
|
import androidx.core.view.ViewCompat;
|
|
import androidx.core.widget.NestedScrollView;
|
|
import androidx.fragment.app.Fragment;
|
|
import androidx.fragment.app.FragmentManager;
|
|
import androidx.fragment.app.FragmentViewModelLazyKt;
|
|
import c.a.d.f0;
|
|
import c.a.d.h0;
|
|
import c.c.a.a0.d;
|
|
import c.d.b.a.a;
|
|
import com.discord.R;
|
|
import com.discord.api.activity.Activity;
|
|
import com.discord.api.channel.Channel;
|
|
import com.discord.api.role.GuildRole;
|
|
import com.discord.app.AppBottomSheet;
|
|
import com.discord.databinding.WidgetUserSheetBinding;
|
|
import com.discord.models.domain.ModelUserRelationship;
|
|
import com.discord.models.presence.Presence;
|
|
import com.discord.models.user.User;
|
|
import com.discord.simpleast.core.node.Node;
|
|
import com.discord.stores.StoreNotices;
|
|
import com.discord.stores.StoreStream;
|
|
import com.discord.stores.StoreUserNotes;
|
|
import com.discord.utilities.accessibility.AccessibilityUtils;
|
|
import com.discord.utilities.analytics.AnalyticsTracker;
|
|
import com.discord.utilities.color.ColorCompat;
|
|
import com.discord.utilities.guilds.GuildUtilsKt;
|
|
import com.discord.utilities.icon.IconUtils;
|
|
import com.discord.utilities.images.MGImages;
|
|
import com.discord.utilities.presence.ActivityUtilsKt;
|
|
import com.discord.utilities.presence.PresenceUtils;
|
|
import com.discord.utilities.rest.RestAPIAbortMessages;
|
|
import com.discord.utilities.rx.ObservableExtensionsKt;
|
|
import com.discord.utilities.streams.StreamContext;
|
|
import com.discord.utilities.textprocessing.AstRenderer;
|
|
import com.discord.utilities.textprocessing.MessageRenderContext;
|
|
import com.discord.utilities.view.extensions.ViewExtensions;
|
|
import com.discord.utilities.view.text.LinkifiedTextView;
|
|
import com.discord.utilities.viewbinding.FragmentViewBindingDelegate;
|
|
import com.discord.utilities.viewbinding.FragmentViewBindingDelegateKt;
|
|
import com.discord.widgets.channels.WidgetChannelSelector;
|
|
import com.discord.widgets.roles.RolesListView;
|
|
import com.discord.widgets.servers.WidgetServerSettingsEditMember;
|
|
import com.discord.widgets.stage.usersheet.UserProfileStageActionsView;
|
|
import com.discord.widgets.user.Badge;
|
|
import com.discord.widgets.user.WidgetBanUser;
|
|
import com.discord.widgets.user.WidgetKickUser;
|
|
import com.discord.widgets.user.calls.PrivateCallLauncher;
|
|
import com.discord.widgets.user.presence.ViewHolderStreamRichPresence;
|
|
import com.discord.widgets.user.presence.ViewHolderUserRichPresence;
|
|
import com.discord.widgets.user.profile.UserProfileAdminView;
|
|
import com.discord.widgets.user.profile.UserProfileConnectionsView;
|
|
import com.discord.widgets.user.profile.UserProfileHeaderView;
|
|
import com.discord.widgets.user.profile.UserProfileHeaderViewModel;
|
|
import com.discord.widgets.user.usersheet.UserProfileVoiceSettingsView;
|
|
import com.discord.widgets.user.usersheet.WidgetUserSheetViewModel;
|
|
import com.discord.widgets.voice.fullscreen.WidgetCallFullscreen;
|
|
import com.facebook.drawee.view.SimpleDraweeView;
|
|
import com.google.android.flexbox.FlexboxLayout;
|
|
import com.google.android.material.button.MaterialButton;
|
|
import com.google.android.material.textfield.TextInputLayout;
|
|
import d0.t.n;
|
|
import d0.z.d.a0;
|
|
import d0.z.d.m;
|
|
import java.util.List;
|
|
import kotlin.Lazy;
|
|
import kotlin.NoWhenBranchMatchedException;
|
|
import kotlin.jvm.functions.Function0;
|
|
import kotlin.jvm.functions.Function1;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
import kotlin.reflect.KProperty;
|
|
import rx.subscriptions.CompositeSubscription;
|
|
/* compiled from: WidgetUserSheet.kt */
|
|
public final class WidgetUserSheet extends AppBottomSheet {
|
|
public static final /* synthetic */ KProperty[] $$delegatedProperties = {a.b0(WidgetUserSheet.class, "binding", "getBinding()Lcom/discord/databinding/WidgetUserSheetBinding;", 0)};
|
|
private static final String ARG_CHANNEL_ID = "ARG_CHANNEL_ID";
|
|
private static final String ARG_FRIEND_TOKEN = "ARG_FRIEND_TOKEN";
|
|
private static final String ARG_GUILD_ID = "ARG_GUILD_ID";
|
|
private static final String ARG_IS_VOICE_CONTEXT = "ARG_IS_VOICE_CONTEXT";
|
|
private static final String ARG_STREAM_PREVIEW_CLICK_BEHAVIOR = "ARG_STREAM_PREVIEW_CLICK_BEHAVIOR";
|
|
private static final String ARG_USER_ID = "ARG_USER_ID";
|
|
public static final Companion Companion = new Companion(null);
|
|
private static final String REQUEST_KEY_MOVE_USER = "REQUEST_KEY_MOVE_USER";
|
|
private ViewHolderUserRichPresence activityViewHolder;
|
|
private final FragmentViewBindingDelegate binding$delegate = FragmentViewBindingDelegateKt.viewBinding$default(this, WidgetUserSheet$binding$2.INSTANCE, null, 2, null);
|
|
private PrivateCallLauncher privateCallLauncher;
|
|
private final Lazy viewModel$delegate;
|
|
private final Lazy viewModelUserProfileHeader$delegate;
|
|
|
|
/* compiled from: WidgetUserSheet.kt */
|
|
public static final class Companion {
|
|
private Companion() {
|
|
}
|
|
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
|
|
public static /* synthetic */ void enqueueNotice$default(Companion companion, long j, String str, int i, Object obj) {
|
|
if ((i & 2) != 0) {
|
|
str = null;
|
|
}
|
|
companion.enqueueNotice(j, str);
|
|
}
|
|
|
|
private final String getNoticeName(long j) {
|
|
String str = "User Sheet Notice for user ID: " + j;
|
|
m.checkNotNullExpressionValue(str, "StringBuilder(\"User Shee…)\n .toString()");
|
|
return str;
|
|
}
|
|
|
|
public static /* synthetic */ void show$default(Companion companion, long j, Long l, FragmentManager fragmentManager, Long l2, Boolean bool, StreamPreviewClickBehavior streamPreviewClickBehavior, String str, int i, Object obj) {
|
|
companion.show(j, (i & 2) != 0 ? null : l, fragmentManager, (i & 8) != 0 ? null : l2, (i & 16) != 0 ? null : bool, (i & 32) != 0 ? StreamPreviewClickBehavior.TARGET_AND_LAUNCH_SPECTATE : streamPreviewClickBehavior, (i & 64) != 0 ? null : str);
|
|
}
|
|
|
|
public final void enqueueNotice(long j, String str) {
|
|
StoreNotices notices = StoreStream.Companion.getNotices();
|
|
String noticeName = getNoticeName(j);
|
|
notices.requestToShow(new StoreNotices.Notice(noticeName, null, 0, 0, false, null, 0, false, 0, new WidgetUserSheet$Companion$enqueueNotice$showUserSheetNotice$1(j, str, notices, noticeName), 182, null));
|
|
}
|
|
|
|
public final void show(long j, FragmentManager fragmentManager) {
|
|
show$default(this, j, null, fragmentManager, null, null, null, null, 122, null);
|
|
}
|
|
|
|
public final void show(long j, Long l, FragmentManager fragmentManager) {
|
|
show$default(this, j, l, fragmentManager, null, null, null, null, 120, null);
|
|
}
|
|
|
|
public final void show(long j, Long l, FragmentManager fragmentManager, Long l2) {
|
|
show$default(this, j, l, fragmentManager, l2, null, null, null, 112, null);
|
|
}
|
|
|
|
public final void show(long j, Long l, FragmentManager fragmentManager, Long l2, Boolean bool) {
|
|
show$default(this, j, l, fragmentManager, l2, bool, null, null, 96, null);
|
|
}
|
|
|
|
public final void show(long j, Long l, FragmentManager fragmentManager, Long l2, Boolean bool, StreamPreviewClickBehavior streamPreviewClickBehavior) {
|
|
show$default(this, j, l, fragmentManager, l2, bool, streamPreviewClickBehavior, null, 64, null);
|
|
}
|
|
|
|
public final void show(long j, Long l, FragmentManager fragmentManager, Long l2, Boolean bool, StreamPreviewClickBehavior streamPreviewClickBehavior, String str) {
|
|
m.checkNotNullParameter(fragmentManager, "fragmentManager");
|
|
m.checkNotNullParameter(streamPreviewClickBehavior, "streamPreviewClickBehavior");
|
|
WidgetUserSheet widgetUserSheet = new WidgetUserSheet();
|
|
Bundle I = a.I(WidgetUserSheet.ARG_USER_ID, j);
|
|
if (l != null) {
|
|
I.putLong(WidgetUserSheet.ARG_CHANNEL_ID, l.longValue());
|
|
}
|
|
if (str != null) {
|
|
I.putString(WidgetUserSheet.ARG_FRIEND_TOKEN, str);
|
|
}
|
|
if (l2 != null) {
|
|
I.putLong(WidgetUserSheet.ARG_GUILD_ID, l2.longValue());
|
|
}
|
|
I.putBoolean(WidgetUserSheet.ARG_IS_VOICE_CONTEXT, bool != null ? bool.booleanValue() : false);
|
|
I.putSerializable(WidgetUserSheet.ARG_STREAM_PREVIEW_CLICK_BEHAVIOR, streamPreviewClickBehavior);
|
|
widgetUserSheet.setArguments(I);
|
|
widgetUserSheet.show(fragmentManager, WidgetUserSheet.class.getName());
|
|
}
|
|
}
|
|
|
|
/* compiled from: WidgetUserSheet.kt */
|
|
public enum StreamPreviewClickBehavior {
|
|
TARGET_AND_LAUNCH_SPECTATE,
|
|
TARGET_AND_DISMISS
|
|
}
|
|
|
|
public WidgetUserSheet() {
|
|
super(false, 1, null);
|
|
WidgetUserSheet$viewModelUserProfileHeader$2 widgetUserSheet$viewModelUserProfileHeader$2 = new WidgetUserSheet$viewModelUserProfileHeader$2(this);
|
|
f0 f0Var = new f0(this);
|
|
this.viewModelUserProfileHeader$delegate = FragmentViewModelLazyKt.createViewModelLazy(this, a0.getOrCreateKotlinClass(UserProfileHeaderViewModel.class), new WidgetUserSheet$appViewModels$$inlined$viewModels$1(f0Var), new h0(widgetUserSheet$viewModelUserProfileHeader$2));
|
|
WidgetUserSheet$viewModel$2 widgetUserSheet$viewModel$2 = new WidgetUserSheet$viewModel$2(this);
|
|
f0 f0Var2 = new f0(this);
|
|
this.viewModel$delegate = FragmentViewModelLazyKt.createViewModelLazy(this, a0.getOrCreateKotlinClass(WidgetUserSheetViewModel.class), new WidgetUserSheet$appViewModels$$inlined$viewModels$2(f0Var2), new h0(widgetUserSheet$viewModel$2));
|
|
}
|
|
|
|
private final void acceptFriendRequest(String str) {
|
|
getViewModel().addRelationship(null, str, R.string.accept_request_button_after);
|
|
}
|
|
|
|
public static final /* synthetic */ void access$acceptFriendRequest(WidgetUserSheet widgetUserSheet, String str) {
|
|
widgetUserSheet.acceptFriendRequest(str);
|
|
}
|
|
|
|
public static final /* synthetic */ void access$addFriend(WidgetUserSheet widgetUserSheet, String str) {
|
|
widgetUserSheet.addFriend(str);
|
|
}
|
|
|
|
public static final /* synthetic */ void access$configureUI(WidgetUserSheet widgetUserSheet, WidgetUserSheetViewModel.ViewState viewState) {
|
|
widgetUserSheet.configureUI(viewState);
|
|
}
|
|
|
|
public static final /* synthetic */ Bundle access$getArgumentsOrDefault$p(WidgetUserSheet widgetUserSheet) {
|
|
return widgetUserSheet.getArgumentsOrDefault();
|
|
}
|
|
|
|
public static final /* synthetic */ WidgetUserSheetBinding access$getBinding$p(WidgetUserSheet widgetUserSheet) {
|
|
return widgetUserSheet.getBinding();
|
|
}
|
|
|
|
public static final /* synthetic */ WidgetUserSheetViewModel access$getViewModel$p(WidgetUserSheet widgetUserSheet) {
|
|
return widgetUserSheet.getViewModel();
|
|
}
|
|
|
|
public static final /* synthetic */ UserProfileHeaderViewModel access$getViewModelUserProfileHeader$p(WidgetUserSheet widgetUserSheet) {
|
|
return widgetUserSheet.getViewModelUserProfileHeader();
|
|
}
|
|
|
|
public static final /* synthetic */ void access$handleEvent(WidgetUserSheet widgetUserSheet, WidgetUserSheetViewModel.Event event) {
|
|
widgetUserSheet.handleEvent(event);
|
|
}
|
|
|
|
public static final /* synthetic */ void access$ignoreFriendRequest(WidgetUserSheet widgetUserSheet) {
|
|
widgetUserSheet.ignoreFriendRequest();
|
|
}
|
|
|
|
public static final /* synthetic */ void access$onStreamPreviewClicked(WidgetUserSheet widgetUserSheet, StreamContext streamContext) {
|
|
widgetUserSheet.onStreamPreviewClicked(streamContext);
|
|
}
|
|
|
|
private final void addFriend(String str) {
|
|
getViewModel().addRelationship(null, str, R.string.friend_request_sent);
|
|
}
|
|
|
|
private final void configureAboutMe(WidgetUserSheetViewModel.ViewState.Loaded loaded) {
|
|
String str;
|
|
List<Node<MessageRenderContext>> bioAst = loaded.getBioAst();
|
|
getBinding().f.setOnClickListener(new WidgetUserSheet$configureAboutMe$1(this, loaded));
|
|
TextView textView = getBinding().e;
|
|
m.checkNotNullExpressionValue(textView, "binding.aboutMeHeader");
|
|
boolean z2 = true;
|
|
int i = 0;
|
|
textView.setVisibility(bioAst != null ? 0 : 8);
|
|
SimpleDraweeView simpleDraweeView = getBinding().f2118c;
|
|
m.checkNotNullExpressionValue(simpleDraweeView, "binding.aboutMeGuildIcon");
|
|
simpleDraweeView.setVisibility(loaded.getHasGuildMemberBio() ? 0 : 8);
|
|
String guildIconURL = loaded.getGuildIconURL();
|
|
if (guildIconURL == null || guildIconURL.length() == 0) {
|
|
SimpleDraweeView simpleDraweeView2 = getBinding().f2118c;
|
|
m.checkNotNullExpressionValue(simpleDraweeView2, "binding.aboutMeGuildIcon");
|
|
IconUtils.setIcon$default(simpleDraweeView2, IconUtils.DEFAULT_ICON_BLURPLE, 0, (Function1) null, (MGImages.ChangeDetector) null, 28, (Object) null);
|
|
TextView textView2 = getBinding().d;
|
|
m.checkNotNullExpressionValue(textView2, "binding.aboutMeGuildIconName");
|
|
textView2.setVisibility(0);
|
|
TextView textView3 = getBinding().d;
|
|
m.checkNotNullExpressionValue(textView3, "binding.aboutMeGuildIconName");
|
|
String guildName = loaded.getGuildName();
|
|
if (guildName == null || (str = GuildUtilsKt.computeShortName(guildName)) == null) {
|
|
str = "";
|
|
}
|
|
textView3.setText(str);
|
|
} else {
|
|
SimpleDraweeView simpleDraweeView3 = getBinding().f2118c;
|
|
m.checkNotNullExpressionValue(simpleDraweeView3, "binding.aboutMeGuildIcon");
|
|
IconUtils.setIcon$default(simpleDraweeView3, loaded.getGuildIconURL(), 0, (Function1) null, (MGImages.ChangeDetector) null, 28, (Object) null);
|
|
TextView textView4 = getBinding().d;
|
|
m.checkNotNullExpressionValue(textView4, "binding.aboutMeGuildIconName");
|
|
textView4.setVisibility(8);
|
|
}
|
|
CardView cardView = getBinding().b;
|
|
m.checkNotNullExpressionValue(cardView, "binding.aboutMeCard");
|
|
if (bioAst == null) {
|
|
z2 = false;
|
|
}
|
|
if (!z2) {
|
|
i = 8;
|
|
}
|
|
cardView.setVisibility(i);
|
|
if (bioAst != null) {
|
|
LinkifiedTextView linkifiedTextView = getBinding().g;
|
|
m.checkNotNullExpressionValue(linkifiedTextView, "binding.aboutMeText");
|
|
Context context = linkifiedTextView.getContext();
|
|
m.checkNotNullExpressionValue(context, "binding.aboutMeText.context");
|
|
getBinding().g.setDraweeSpanStringBuilder(AstRenderer.render(loaded.getBioAst(), new MessageRenderContext(context, 0, false, null, null, null, 0, null, null, 0, 0, new WidgetUserSheet$configureAboutMe$renderContext$1(getViewModel()), null, null, 14328, null)));
|
|
}
|
|
}
|
|
|
|
private final void configureConnectionsSection(WidgetUserSheetViewModel.ViewState.Loaded loaded) {
|
|
UserProfileConnectionsView.ViewState connectionsViewState = loaded.getConnectionsViewState();
|
|
TextView textView = getBinding().m;
|
|
m.checkNotNullExpressionValue(textView, "binding.userSheetConnectionsHeader");
|
|
int i = 0;
|
|
textView.setVisibility(connectionsViewState.getShowConnectionsSection() ? 0 : 8);
|
|
UserProfileConnectionsView userProfileConnectionsView = getBinding().n;
|
|
m.checkNotNullExpressionValue(userProfileConnectionsView, "binding.userSheetConnectionsView");
|
|
if (!connectionsViewState.getShowConnectionsSection()) {
|
|
i = 8;
|
|
}
|
|
userProfileConnectionsView.setVisibility(i);
|
|
WidgetUserSheet$configureConnectionsSection$onConnectedAccountClick$1 widgetUserSheet$configureConnectionsSection$onConnectedAccountClick$1 = new WidgetUserSheet$configureConnectionsSection$onConnectedAccountClick$1(this);
|
|
User user = loaded.getUser();
|
|
getBinding().n.updateViewState(connectionsViewState, widgetUserSheet$configureConnectionsSection$onConnectedAccountClick$1, new WidgetUserSheet$configureConnectionsSection$onMutualGuildsItemClick$1(this, user), new WidgetUserSheet$configureConnectionsSection$onMutualFriendsItemClick$1(this, user));
|
|
}
|
|
|
|
private final void configureDeveloperSection(WidgetUserSheetViewModel.ViewState.Loaded loaded) {
|
|
TextView textView = getBinding().o;
|
|
int i = 8;
|
|
textView.setVisibility(StoreStream.Companion.getUserSettings().getIsDeveloperMode() ? 0 : 8);
|
|
textView.setOnClickListener(new WidgetUserSheet$configureDeveloperSection$$inlined$apply$lambda$1(textView, this, loaded));
|
|
TextView textView2 = getBinding().o;
|
|
m.checkNotNullExpressionValue(textView2, "binding.userSheetCopyId");
|
|
boolean z2 = textView2.getVisibility() == 0;
|
|
TextView textView3 = getBinding().p;
|
|
m.checkNotNullExpressionValue(textView3, "binding.userSheetDeveloperHeader");
|
|
if (z2) {
|
|
i = 0;
|
|
}
|
|
textView3.setVisibility(i);
|
|
}
|
|
|
|
private final void configureGuildSection(WidgetUserSheetViewModel.ViewState.Loaded loaded) {
|
|
List<GuildRole> roleItems = loaded.getRoleItems();
|
|
UserProfileAdminView.ViewState adminViewState = loaded.getAdminViewState();
|
|
boolean shouldShowRoles = loaded.shouldShowRoles();
|
|
boolean z2 = true;
|
|
int i = 0;
|
|
boolean z3 = adminViewState != null && adminViewState.isAdminSectionEnabled();
|
|
LinearLayout linearLayout = getBinding().t;
|
|
m.checkNotNullExpressionValue(linearLayout, "binding.userSheetGuildContainer");
|
|
if (!shouldShowRoles && !z3) {
|
|
z2 = false;
|
|
}
|
|
linearLayout.setVisibility(z2 ? 0 : 8);
|
|
RolesListView rolesListView = getBinding().N;
|
|
m.checkNotNullExpressionValue(rolesListView, "binding.userSheetRolesList");
|
|
rolesListView.setVisibility(shouldShowRoles ? 0 : 8);
|
|
Long guildId = loaded.getGuildId();
|
|
if (shouldShowRoles && guildId != null) {
|
|
RolesListView rolesListView2 = getBinding().N;
|
|
RolesListView rolesListView3 = getBinding().N;
|
|
m.checkNotNullExpressionValue(rolesListView3, "binding.userSheetRolesList");
|
|
rolesListView2.updateView(roleItems, ColorCompat.getThemedColor(rolesListView3.getContext(), (int) R.attr.primary_300), guildId.longValue());
|
|
}
|
|
String guildSectionHeaderText = loaded.getGuildSectionHeaderText();
|
|
if (guildSectionHeaderText != null) {
|
|
TextView textView = getBinding().u;
|
|
m.checkNotNullExpressionValue(textView, "binding.userSheetGuildHeader");
|
|
textView.setText(guildSectionHeaderText);
|
|
}
|
|
CardView cardView = getBinding().j;
|
|
m.checkNotNullExpressionValue(cardView, "binding.userSheetAdminCard");
|
|
cardView.setVisibility(z3 ? 0 : 8);
|
|
UserProfileAdminView userProfileAdminView = getBinding().k;
|
|
m.checkNotNullExpressionValue(userProfileAdminView, "binding.userSheetAdminView");
|
|
if (!z3) {
|
|
i = 8;
|
|
}
|
|
userProfileAdminView.setVisibility(i);
|
|
if (adminViewState != null) {
|
|
getBinding().k.updateView(adminViewState);
|
|
}
|
|
}
|
|
|
|
private final void configureIncomingFriendRequest(WidgetUserSheetViewModel.ViewState.Loaded loaded) {
|
|
int i = 0;
|
|
boolean z2 = ModelUserRelationship.getType(Integer.valueOf(loaded.getUserRelationshipType())) == 3;
|
|
TextView textView = getBinding().v;
|
|
m.checkNotNullExpressionValue(textView, "binding.userSheetIncomingFriendRequestHeader");
|
|
textView.setVisibility(z2 ? 0 : 8);
|
|
LinearLayout linearLayout = getBinding().f2119s;
|
|
m.checkNotNullExpressionValue(linearLayout, "binding.userSheetFriendRequestIncomingContainer");
|
|
if (!z2) {
|
|
i = 8;
|
|
}
|
|
linearLayout.setVisibility(i);
|
|
getBinding().q.setOnClickListener(new WidgetUserSheet$configureIncomingFriendRequest$1(this, loaded));
|
|
getBinding().r.setOnClickListener(new WidgetUserSheet$configureIncomingFriendRequest$2(this));
|
|
}
|
|
|
|
private final void configureNote(WidgetUserSheetViewModel.ViewState.Loaded loaded) {
|
|
getBinding().A.setRawInputType(1);
|
|
StoreUserNotes.UserNoteState userNoteFetchState = loaded.getUserNoteFetchState();
|
|
if (userNoteFetchState instanceof StoreUserNotes.UserNoteState.Empty) {
|
|
TextInputLayout textInputLayout = getBinding().B;
|
|
m.checkNotNullExpressionValue(textInputLayout, "binding.userSheetNoteTextFieldWrap");
|
|
textInputLayout.setHint(getString(R.string.note_placeholder_mobile));
|
|
TextInputLayout textInputLayout2 = getBinding().B;
|
|
m.checkNotNullExpressionValue(textInputLayout2, "binding.userSheetNoteTextFieldWrap");
|
|
textInputLayout2.setEnabled(true);
|
|
} else if (userNoteFetchState instanceof StoreUserNotes.UserNoteState.Loading) {
|
|
TextInputLayout textInputLayout3 = getBinding().B;
|
|
m.checkNotNullExpressionValue(textInputLayout3, "binding.userSheetNoteTextFieldWrap");
|
|
textInputLayout3.setHint(getString(R.string.loading_note));
|
|
TextInputLayout textInputLayout4 = getBinding().B;
|
|
m.checkNotNullExpressionValue(textInputLayout4, "binding.userSheetNoteTextFieldWrap");
|
|
textInputLayout4.setEnabled(false);
|
|
} else if (userNoteFetchState instanceof StoreUserNotes.UserNoteState.Loaded) {
|
|
TextInputLayout textInputLayout5 = getBinding().B;
|
|
m.checkNotNullExpressionValue(textInputLayout5, "binding.userSheetNoteTextFieldWrap");
|
|
textInputLayout5.setHint(getString(R.string.note_placeholder_mobile));
|
|
TextInputLayout textInputLayout6 = getBinding().B;
|
|
m.checkNotNullExpressionValue(textInputLayout6, "binding.userSheetNoteTextFieldWrap");
|
|
textInputLayout6.setEnabled(true);
|
|
}
|
|
if (loaded.getUserNote() != null) {
|
|
TextInputLayout textInputLayout7 = getBinding().B;
|
|
m.checkNotNullExpressionValue(textInputLayout7, "binding.userSheetNoteTextFieldWrap");
|
|
ViewExtensions.setTextIfDifferent(textInputLayout7, loaded.getUserNote());
|
|
}
|
|
}
|
|
|
|
/* JADX WARNING: Removed duplicated region for block: B:15:0x004e */
|
|
/* JADX WARNING: Removed duplicated region for block: B:16:0x0050 */
|
|
/* JADX WARNING: Removed duplicated region for block: B:24:0x008b */
|
|
/* JADX WARNING: Removed duplicated region for block: B:25:0x008d */
|
|
/* JADX WARNING: Removed duplicated region for block: B:28:0x009f */
|
|
/* JADX WARNING: Removed duplicated region for block: B:29:0x00a1 */
|
|
/* JADX WARNING: Removed duplicated region for block: B:32:0x00a8 A[RETURN] */
|
|
/* JADX WARNING: Removed duplicated region for block: B:33:0x00a9 */
|
|
private final void configureProfileActionButtons(WidgetUserSheetViewModel.ViewState.Loaded loaded) {
|
|
boolean z2;
|
|
boolean z3;
|
|
boolean isMe = loaded.isMe();
|
|
Long currentGuildId = loaded.getCurrentGuildId();
|
|
FlexboxLayout flexboxLayout = getBinding().G;
|
|
m.checkNotNullExpressionValue(flexboxLayout, "binding.userSheetProfileEditContainer");
|
|
int i = 8;
|
|
flexboxLayout.setVisibility(isMe ? 0 : 8);
|
|
getBinding().F.setOnClickListener(new WidgetUserSheet$configureProfileActionButtons$1(this));
|
|
MaterialButton materialButton = getBinding().I;
|
|
m.checkNotNullExpressionValue(materialButton, "binding.userSheetProfileIdentityButton");
|
|
boolean z4 = true;
|
|
if (isMe) {
|
|
if ((currentGuildId != null ? currentGuildId.longValue() : 0) > 0) {
|
|
z2 = true;
|
|
materialButton.setVisibility(!z2 ? 0 : 8);
|
|
getBinding().I.setOnClickListener(new WidgetUserSheet$configureProfileActionButtons$2(currentGuildId));
|
|
boolean isBot = loaded.getUser().isBot();
|
|
boolean isSystemUser = loaded.getUser().isSystemUser();
|
|
int userRelationshipType = loaded.getUserRelationshipType();
|
|
z3 = isMe && !isSystemUser;
|
|
View view = getBinding().E;
|
|
m.checkNotNullExpressionValue(view, "binding.userSheetProfileActionsDivider");
|
|
view.setVisibility(!z3 ? 0 : 8);
|
|
LinearLayout linearLayout = getBinding().D;
|
|
m.checkNotNullExpressionValue(linearLayout, "binding.userSheetProfileActionsContainer");
|
|
linearLayout.setVisibility(!z3 ? 0 : 8);
|
|
if (!z3) {
|
|
Button button = getBinding().f2120x;
|
|
m.checkNotNullExpressionValue(button, "binding.userSheetMessageActionButton");
|
|
Channel channel = loaded.getChannel();
|
|
button.setVisibility(channel == null || channel.A() != 1 ? 0 : 8);
|
|
getBinding().f2120x.setOnClickListener(new WidgetUserSheet$configureProfileActionButtons$3(this, loaded));
|
|
getBinding().l.setOnClickListener(new WidgetUserSheet$configureProfileActionButtons$4(this));
|
|
getBinding().O.setOnClickListener(new WidgetUserSheet$configureProfileActionButtons$5(this));
|
|
if (userRelationshipType == 0) {
|
|
Button button2 = getBinding().i;
|
|
m.checkNotNullExpressionValue(button2, "binding.userSheetAddFriendActionButton");
|
|
button2.setVisibility(0);
|
|
Button button3 = getBinding().C;
|
|
m.checkNotNullExpressionValue(button3, "binding.userSheetPendingFriendRequestActionButton");
|
|
button3.setVisibility(8);
|
|
} else if (userRelationshipType == 3 || userRelationshipType == 4) {
|
|
Button button4 = getBinding().i;
|
|
m.checkNotNullExpressionValue(button4, "binding.userSheetAddFriendActionButton");
|
|
button4.setVisibility(8);
|
|
Button button5 = getBinding().C;
|
|
m.checkNotNullExpressionValue(button5, "binding.userSheetPendingFriendRequestActionButton");
|
|
button5.setVisibility(0);
|
|
} else {
|
|
Button button6 = getBinding().i;
|
|
m.checkNotNullExpressionValue(button6, "binding.userSheetAddFriendActionButton");
|
|
button6.setVisibility(8);
|
|
Button button7 = getBinding().C;
|
|
m.checkNotNullExpressionValue(button7, "binding.userSheetPendingFriendRequestActionButton");
|
|
button7.setVisibility(8);
|
|
}
|
|
if (isMe || isBot || userRelationshipType != 0) {
|
|
z4 = false;
|
|
}
|
|
Button button8 = getBinding().i;
|
|
m.checkNotNullExpressionValue(button8, "binding.userSheetAddFriendActionButton");
|
|
if (z4) {
|
|
i = 0;
|
|
}
|
|
button8.setVisibility(i);
|
|
getBinding().i.setOnClickListener(new WidgetUserSheet$configureProfileActionButtons$6(this, loaded));
|
|
getBinding().C.setOnClickListener(new WidgetUserSheet$configureProfileActionButtons$7(this, userRelationshipType, loaded));
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
}
|
|
z2 = false;
|
|
materialButton.setVisibility(!z2 ? 0 : 8);
|
|
getBinding().I.setOnClickListener(new WidgetUserSheet$configureProfileActionButtons$2(currentGuildId));
|
|
boolean isBot = loaded.getUser().isBot();
|
|
boolean isSystemUser = loaded.getUser().isSystemUser();
|
|
int userRelationshipType = loaded.getUserRelationshipType();
|
|
if (isMe) {
|
|
}
|
|
View view = getBinding().E;
|
|
m.checkNotNullExpressionValue(view, "binding.userSheetProfileActionsDivider");
|
|
view.setVisibility(!z3 ? 0 : 8);
|
|
LinearLayout linearLayout = getBinding().D;
|
|
m.checkNotNullExpressionValue(linearLayout, "binding.userSheetProfileActionsContainer");
|
|
linearLayout.setVisibility(!z3 ? 0 : 8);
|
|
if (!z3) {
|
|
}
|
|
}
|
|
|
|
private final void configureStageActionsSection(WidgetUserSheetViewModel.ViewState.Loaded loaded) {
|
|
getBinding().K.updateView(loaded.getStageViewState());
|
|
CardView cardView = getBinding().J;
|
|
m.checkNotNullExpressionValue(cardView, "binding.userSheetProfileStageActionsCard");
|
|
UserProfileStageActionsView userProfileStageActionsView = getBinding().K;
|
|
m.checkNotNullExpressionValue(userProfileStageActionsView, "binding.userSheetProfileStageActionsView");
|
|
int i = 0;
|
|
if (!(userProfileStageActionsView.getVisibility() == 0)) {
|
|
i = 8;
|
|
}
|
|
cardView.setVisibility(i);
|
|
}
|
|
|
|
private final void configureUI(WidgetUserSheetViewModel.ViewState viewState) {
|
|
int i = 0;
|
|
if (viewState instanceof WidgetUserSheetViewModel.ViewState.Uninitialized) {
|
|
FrameLayout frameLayout = getBinding().w;
|
|
m.checkNotNullExpressionValue(frameLayout, "binding.userSheetLoadingContainer");
|
|
frameLayout.setVisibility(0);
|
|
} else if (viewState instanceof WidgetUserSheetViewModel.ViewState.Loaded) {
|
|
FrameLayout frameLayout2 = getBinding().w;
|
|
m.checkNotNullExpressionValue(frameLayout2, "binding.userSheetLoadingContainer");
|
|
frameLayout2.setVisibility(8);
|
|
WidgetUserSheetViewModel.ViewState.Loaded loaded = (WidgetUserSheetViewModel.ViewState.Loaded) viewState;
|
|
Presence presence = loaded.getPresence();
|
|
ViewHolderStreamRichPresence viewHolderStreamRichPresence = null;
|
|
Activity primaryActivity = presence != null ? PresenceUtils.INSTANCE.getPrimaryActivity(presence) : null;
|
|
boolean isMe = loaded.isMe();
|
|
boolean isSystemUser = loaded.getUser().isSystemUser();
|
|
boolean z2 = true;
|
|
if (!getViewModel().getOpenPopoutLogged() && loaded.getProfileLoaded()) {
|
|
AnalyticsTracker.INSTANCE.openUserSheet(loaded.getHasPremiumCustomization(), primaryActivity != null ? primaryActivity.h() : null, primaryActivity != null ? ActivityUtilsKt.getGamePlatform(primaryActivity) : null, loaded.getGuildMember());
|
|
getViewModel().setOpenPopoutLogged(true);
|
|
}
|
|
getBinding().H.setOnBannerPress(new WidgetUserSheet$configureUI$1(this));
|
|
ImageView imageView = getBinding().f2121y;
|
|
m.checkNotNullExpressionValue(imageView, "binding.userSheetMoreButton");
|
|
if (isMe || isSystemUser) {
|
|
z2 = false;
|
|
}
|
|
if (!z2) {
|
|
i = 8;
|
|
}
|
|
imageView.setVisibility(i);
|
|
if (loaded.getConnectionsViewState().getShowConnectionsSection()) {
|
|
setPeekHeightBottomView(getBinding().m);
|
|
}
|
|
ViewHolderUserRichPresence.Companion companion = ViewHolderUserRichPresence.Companion;
|
|
FrameLayout frameLayout3 = getBinding().h;
|
|
m.checkNotNullExpressionValue(frameLayout3, "binding.richPresenceContainer");
|
|
ViewHolderUserRichPresence richPresence = companion.setRichPresence(frameLayout3, primaryActivity, loaded.getStreamContext(), this.activityViewHolder);
|
|
FragmentManager parentFragmentManager = getParentFragmentManager();
|
|
m.checkNotNullExpressionValue(parentFragmentManager, "parentFragmentManager");
|
|
StreamContext streamContext = loaded.getStreamContext();
|
|
boolean isMe2 = loaded.isMe();
|
|
User user = loaded.getUser();
|
|
Context applicationContext = requireAppActivity().getApplicationContext();
|
|
m.checkNotNullExpressionValue(applicationContext, "requireAppActivity().applicationContext");
|
|
richPresence.configureUi(parentFragmentManager, streamContext, isMe2, user, applicationContext, loaded.getRichPresence(), loaded.getUserInSameVoiceChannel());
|
|
richPresence.configureUiTimestamp(primaryActivity, this);
|
|
this.activityViewHolder = richPresence;
|
|
if (richPresence instanceof ViewHolderStreamRichPresence) {
|
|
viewHolderStreamRichPresence = richPresence;
|
|
}
|
|
ViewHolderStreamRichPresence viewHolderStreamRichPresence2 = viewHolderStreamRichPresence;
|
|
if (!(loaded.getStreamContext() == null || viewHolderStreamRichPresence2 == null)) {
|
|
viewHolderStreamRichPresence2.setOnStreamPreviewClicked(new WidgetUserSheet$configureUI$3(this, viewState));
|
|
}
|
|
ViewHolderUserRichPresence viewHolderUserRichPresence = this.activityViewHolder;
|
|
if (viewHolderUserRichPresence != null) {
|
|
viewHolderUserRichPresence.setOnActivityCustomButtonClicked(new WidgetUserSheet$configureUI$4(getViewModel()));
|
|
}
|
|
configureProfileActionButtons(loaded);
|
|
configureStageActionsSection(loaded);
|
|
configureAboutMe(loaded);
|
|
configureIncomingFriendRequest(loaded);
|
|
configureVoiceSection(loaded);
|
|
configureGuildSection(loaded);
|
|
configureConnectionsSection(loaded);
|
|
configureNote(loaded);
|
|
configureDeveloperSection(loaded);
|
|
} else {
|
|
throw new NoWhenBranchMatchedException();
|
|
}
|
|
}
|
|
|
|
private final void configureVoiceSection(WidgetUserSheetViewModel.ViewState.Loaded loaded) {
|
|
UserProfileVoiceSettingsView.ViewState voiceSettingsViewState = loaded.getVoiceSettingsViewState();
|
|
boolean showVoiceSettings = loaded.getShowVoiceSettings();
|
|
TextView textView = getBinding().L;
|
|
m.checkNotNullExpressionValue(textView, "binding.userSheetProfileVoiceSettingsHeader");
|
|
int i = 0;
|
|
textView.setVisibility(showVoiceSettings ? 0 : 8);
|
|
CardView cardView = getBinding().P;
|
|
m.checkNotNullExpressionValue(cardView, "binding.voiceSettingsViewCard");
|
|
if (!showVoiceSettings) {
|
|
i = 8;
|
|
}
|
|
cardView.setVisibility(i);
|
|
getBinding().M.updateView(voiceSettingsViewState);
|
|
}
|
|
|
|
private final WidgetUserSheetBinding getBinding() {
|
|
return (WidgetUserSheetBinding) this.binding$delegate.getValue((Fragment) this, $$delegatedProperties[0]);
|
|
}
|
|
|
|
private final WidgetUserSheetViewModel getViewModel() {
|
|
return (WidgetUserSheetViewModel) this.viewModel$delegate.getValue();
|
|
}
|
|
|
|
private final UserProfileHeaderViewModel getViewModelUserProfileHeader() {
|
|
return (UserProfileHeaderViewModel) this.viewModelUserProfileHeader$delegate.getValue();
|
|
}
|
|
|
|
private final void handleBanUser(WidgetUserSheetViewModel.Event.LaunchBanUser launchBanUser) {
|
|
WidgetBanUser.Companion.launch(launchBanUser.getUsername(), launchBanUser.getGuildId(), launchBanUser.getUserId(), getParentFragmentManager());
|
|
}
|
|
|
|
private final void handleDismissSheet() {
|
|
dismiss();
|
|
}
|
|
|
|
private final void handleEvent(WidgetUserSheetViewModel.Event event) {
|
|
if (event instanceof WidgetUserSheetViewModel.Event.ShowToast) {
|
|
handleShowToast((WidgetUserSheetViewModel.Event.ShowToast) event);
|
|
} else if (event instanceof WidgetUserSheetViewModel.Event.ShowFriendRequestErrorToast) {
|
|
handleShowFriendRequestErrorToast((WidgetUserSheetViewModel.Event.ShowFriendRequestErrorToast) event);
|
|
} else if (event instanceof WidgetUserSheetViewModel.Event.LaunchVoiceCall) {
|
|
handleLaunchVoiceCall((WidgetUserSheetViewModel.Event.LaunchVoiceCall) event);
|
|
} else if (event instanceof WidgetUserSheetViewModel.Event.LaunchVideoCall) {
|
|
handleLaunchVideoCall((WidgetUserSheetViewModel.Event.LaunchVideoCall) event);
|
|
} else if (event instanceof WidgetUserSheetViewModel.Event.LaunchSpectate) {
|
|
handleLaunchSpectate((WidgetUserSheetViewModel.Event.LaunchSpectate) event);
|
|
} else if (event instanceof WidgetUserSheetViewModel.Event.LaunchEditMember) {
|
|
handleLaunchEditMember((WidgetUserSheetViewModel.Event.LaunchEditMember) event);
|
|
} else if (event instanceof WidgetUserSheetViewModel.Event.LaunchKickUser) {
|
|
handleKickUser((WidgetUserSheetViewModel.Event.LaunchKickUser) event);
|
|
} else if (event instanceof WidgetUserSheetViewModel.Event.LaunchBanUser) {
|
|
handleBanUser((WidgetUserSheetViewModel.Event.LaunchBanUser) event);
|
|
} else if (event instanceof WidgetUserSheetViewModel.Event.LaunchMoveUser) {
|
|
handleMoveUser((WidgetUserSheetViewModel.Event.LaunchMoveUser) event);
|
|
} else if (event instanceof WidgetUserSheetViewModel.Event.RequestPermissionsForSpectateStream) {
|
|
handleRequestPermissionsForSpectateStream((WidgetUserSheetViewModel.Event.RequestPermissionsForSpectateStream) event);
|
|
} else if (event instanceof WidgetUserSheetViewModel.Event.UserNotFound) {
|
|
c.a.d.m.i(this, R.string.user_profile_failure_to_open_message, 0, 4);
|
|
handleDismissSheet();
|
|
} else if (event instanceof WidgetUserSheetViewModel.Event.DismissSheet) {
|
|
handleDismissSheet();
|
|
} else {
|
|
throw new NoWhenBranchMatchedException();
|
|
}
|
|
}
|
|
|
|
private final void handleKickUser(WidgetUserSheetViewModel.Event.LaunchKickUser launchKickUser) {
|
|
WidgetKickUser.Companion companion = WidgetKickUser.Companion;
|
|
String username = launchKickUser.getUsername();
|
|
long guildId = launchKickUser.getGuildId();
|
|
long userId = launchKickUser.getUserId();
|
|
FragmentManager parentFragmentManager = getParentFragmentManager();
|
|
m.checkNotNullExpressionValue(parentFragmentManager, "parentFragmentManager");
|
|
companion.launch(username, guildId, userId, parentFragmentManager);
|
|
}
|
|
|
|
private final void handleLaunchEditMember(WidgetUserSheetViewModel.Event.LaunchEditMember launchEditMember) {
|
|
WidgetServerSettingsEditMember.Companion companion = WidgetServerSettingsEditMember.Companion;
|
|
long guildId = launchEditMember.getGuildId();
|
|
long userId = launchEditMember.getUserId();
|
|
WidgetUserSheetBinding binding = getBinding();
|
|
m.checkNotNullExpressionValue(binding, "binding");
|
|
NestedScrollView nestedScrollView = binding.a;
|
|
m.checkNotNullExpressionValue(nestedScrollView, "binding.root");
|
|
Context context = nestedScrollView.getContext();
|
|
m.checkNotNullExpressionValue(context, "binding.root.context");
|
|
companion.launch(guildId, userId, context);
|
|
}
|
|
|
|
private final void handleLaunchSpectate(WidgetUserSheetViewModel.Event.LaunchSpectate launchSpectate) {
|
|
WidgetCallFullscreen.Companion companion = WidgetCallFullscreen.Companion;
|
|
Context requireContext = requireContext();
|
|
m.checkNotNullExpressionValue(requireContext, "requireContext()");
|
|
WidgetCallFullscreen.Companion.launch$default(companion, requireContext, launchSpectate.getStream().getChannelId(), false, launchSpectate.getStream().getEncodedStreamKey(), null, 20, null);
|
|
dismiss();
|
|
}
|
|
|
|
private final void handleLaunchVideoCall(WidgetUserSheetViewModel.Event.LaunchVideoCall launchVideoCall) {
|
|
PrivateCallLauncher privateCallLauncher = this.privateCallLauncher;
|
|
if (privateCallLauncher == null) {
|
|
m.throwUninitializedPropertyAccessException("privateCallLauncher");
|
|
}
|
|
privateCallLauncher.launchVideoCall(launchVideoCall.getChannelId());
|
|
}
|
|
|
|
private final void handleLaunchVoiceCall(WidgetUserSheetViewModel.Event.LaunchVoiceCall launchVoiceCall) {
|
|
PrivateCallLauncher privateCallLauncher = this.privateCallLauncher;
|
|
if (privateCallLauncher == null) {
|
|
m.throwUninitializedPropertyAccessException("privateCallLauncher");
|
|
}
|
|
privateCallLauncher.launchVoiceCall(launchVoiceCall.getChannelId());
|
|
}
|
|
|
|
private final void handleMoveUser(WidgetUserSheetViewModel.Event.LaunchMoveUser launchMoveUser) {
|
|
WidgetChannelSelector.Companion.launchForVocal$default(WidgetChannelSelector.Companion, this, launchMoveUser.getGuildId(), REQUEST_KEY_MOVE_USER, false, 0, 24, null);
|
|
}
|
|
|
|
private final void handleRequestPermissionsForSpectateStream(WidgetUserSheetViewModel.Event.RequestPermissionsForSpectateStream requestPermissionsForSpectateStream) {
|
|
d.Q1(this, null, new WidgetUserSheet$handleRequestPermissionsForSpectateStream$1(this, requestPermissionsForSpectateStream), 1, null);
|
|
}
|
|
|
|
private final void handleShowFriendRequestErrorToast(WidgetUserSheetViewModel.Event.ShowFriendRequestErrorToast showFriendRequestErrorToast) {
|
|
c.a.d.m.j(this, RestAPIAbortMessages.ResponseResolver.INSTANCE.getRelationshipResponse(getContext(), showFriendRequestErrorToast.getAbortCode(), showFriendRequestErrorToast.getUsername()), 0, 4);
|
|
}
|
|
|
|
private final void handleShowToast(WidgetUserSheetViewModel.Event.ShowToast showToast) {
|
|
c.a.d.m.i(this, showToast.getStringRes(), 0, 4);
|
|
}
|
|
|
|
private final void ignoreFriendRequest() {
|
|
getViewModel().removeRelationship(R.string.friend_request_ignored);
|
|
}
|
|
|
|
private final void onStreamPreviewClicked(StreamContext streamContext) {
|
|
getViewModel().onStreamPreviewClicked(streamContext);
|
|
}
|
|
|
|
public static final void show(long j, FragmentManager fragmentManager) {
|
|
Companion.show$default(Companion, j, null, fragmentManager, null, null, null, null, 122, null);
|
|
}
|
|
|
|
public static final void show(long j, Long l, FragmentManager fragmentManager) {
|
|
Companion.show$default(Companion, j, l, fragmentManager, null, null, null, null, 120, null);
|
|
}
|
|
|
|
public static final void show(long j, Long l, FragmentManager fragmentManager, Long l2) {
|
|
Companion.show$default(Companion, j, l, fragmentManager, l2, null, null, null, 112, null);
|
|
}
|
|
|
|
public static final void show(long j, Long l, FragmentManager fragmentManager, Long l2, Boolean bool) {
|
|
Companion.show$default(Companion, j, l, fragmentManager, l2, bool, null, null, 96, null);
|
|
}
|
|
|
|
public static final void show(long j, Long l, FragmentManager fragmentManager, Long l2, Boolean bool, StreamPreviewClickBehavior streamPreviewClickBehavior) {
|
|
Companion.show$default(Companion, j, l, fragmentManager, l2, bool, streamPreviewClickBehavior, null, 64, null);
|
|
}
|
|
|
|
public static final void show(long j, Long l, FragmentManager fragmentManager, Long l2, Boolean bool, StreamPreviewClickBehavior streamPreviewClickBehavior, String str) {
|
|
Companion.show(j, l, fragmentManager, l2, bool, streamPreviewClickBehavior, str);
|
|
}
|
|
|
|
@Override // com.discord.app.AppBottomSheet
|
|
public void bindSubscriptions(CompositeSubscription compositeSubscription) {
|
|
m.checkNotNullParameter(compositeSubscription, "compositeSubscription");
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.bindToComponentLifecycle$default(getViewModel().observeViewState(), this, null, 2, null), WidgetUserSheet.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetUserSheet$bindSubscriptions$1(this), 62, (Object) null);
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.bindToComponentLifecycle$default(getViewModel().observeEvents(), this, null, 2, null), WidgetUserSheet.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetUserSheet$bindSubscriptions$2(this), 62, (Object) null);
|
|
UserProfileHeaderView.Companion companion = UserProfileHeaderView.Companion;
|
|
UserProfileHeaderView userProfileHeaderView = getBinding().H;
|
|
m.checkNotNullExpressionValue(userProfileHeaderView, "binding.userSheetProfileHeaderView");
|
|
companion.bind(userProfileHeaderView, this, getViewModelUserProfileHeader().observeViewState());
|
|
}
|
|
|
|
@Override // com.discord.app.AppBottomSheet
|
|
public int getContentViewResId() {
|
|
return R.layout.widget_user_sheet;
|
|
}
|
|
|
|
@Override // com.discord.app.AppBottomSheet, androidx.fragment.app.Fragment
|
|
public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
|
|
m.checkNotNullParameter(layoutInflater, "inflater");
|
|
Context requireContext = requireContext();
|
|
m.checkNotNullExpressionValue(requireContext, "requireContext()");
|
|
FragmentManager parentFragmentManager = getParentFragmentManager();
|
|
m.checkNotNullExpressionValue(parentFragmentManager, "parentFragmentManager");
|
|
this.privateCallLauncher = new PrivateCallLauncher(this, this, requireContext, parentFragmentManager);
|
|
return super.onCreateView(layoutInflater, viewGroup, bundle);
|
|
}
|
|
|
|
@Override // com.discord.app.AppBottomSheet, androidx.fragment.app.Fragment
|
|
public void onPause() {
|
|
ViewHolderUserRichPresence viewHolderUserRichPresence = this.activityViewHolder;
|
|
if (viewHolderUserRichPresence != null) {
|
|
viewHolderUserRichPresence.disposeSubscriptions();
|
|
}
|
|
long j = getArgumentsOrDefault().getLong(ARG_USER_ID);
|
|
long j2 = getArgumentsOrDefault().getLong(ARG_GUILD_ID);
|
|
if (j > 0 && j2 > 0) {
|
|
StoreStream.Companion.getGuildSubscriptions().unsubscribeUser(j2, j);
|
|
}
|
|
hideKeyboard(getBinding().B);
|
|
WidgetUserSheetViewModel viewModel = getViewModel();
|
|
Context context = getContext();
|
|
TextInputLayout textInputLayout = getBinding().B;
|
|
m.checkNotNullExpressionValue(textInputLayout, "binding.userSheetNoteTextFieldWrap");
|
|
viewModel.saveUserNote(context, ViewExtensions.getTextOrEmpty(textInputLayout));
|
|
super.onPause();
|
|
}
|
|
|
|
@Override // com.discord.app.AppBottomSheet, androidx.fragment.app.Fragment
|
|
public void onResume() {
|
|
super.onResume();
|
|
AppBottomSheet.hideKeyboard$default(this, null, 1, null);
|
|
long j = getArgumentsOrDefault().getLong(ARG_USER_ID);
|
|
long j2 = getArgumentsOrDefault().getLong(ARG_GUILD_ID);
|
|
if (j > 0 && j2 > 0) {
|
|
StoreStream.Companion.getGuildSubscriptions().subscribeUser(j2, j);
|
|
}
|
|
}
|
|
|
|
@Override // com.discord.app.AppBottomSheet, androidx.fragment.app.Fragment
|
|
public void onViewCreated(View view, Bundle bundle) {
|
|
m.checkNotNullParameter(view, "view");
|
|
super.onViewCreated(view, bundle);
|
|
long j = getArgumentsOrDefault().getLong(ARG_USER_ID);
|
|
boolean z2 = j == StoreStream.Companion.getUsers().getMe().getId();
|
|
getBinding().f2121y.setOnClickListener(new WidgetUserSheet$onViewCreated$1(this, j));
|
|
UserProfileHeaderView userProfileHeaderView = getBinding().H;
|
|
Badge.Companion companion = Badge.Companion;
|
|
FragmentManager parentFragmentManager = getParentFragmentManager();
|
|
m.checkNotNullExpressionValue(parentFragmentManager, "parentFragmentManager");
|
|
Context requireContext = requireContext();
|
|
m.checkNotNullExpressionValue(requireContext, "requireContext()");
|
|
userProfileHeaderView.setOnBadgeClick(companion.onBadgeClick(parentFragmentManager, requireContext));
|
|
getBinding().K.setOnInviteToSpeak(new WidgetUserSheet$onViewCreated$2(this, z2));
|
|
getBinding().K.setOnMoveToAudience(new WidgetUserSheet$onViewCreated$3(this));
|
|
getBinding().M.setOnMuteChecked(new WidgetUserSheet$onViewCreated$4(this));
|
|
getBinding().M.setOnDeafenChecked(new WidgetUserSheet$onViewCreated$5(this));
|
|
getBinding().M.setOnVolumeChange(new WidgetUserSheet$onViewCreated$6(this));
|
|
getBinding().k.setOnEditMember(new WidgetUserSheet$onViewCreated$7(this));
|
|
getBinding().k.setOnKick(new WidgetUserSheet$onViewCreated$8(this));
|
|
getBinding().k.setOnBan(new WidgetUserSheet$onViewCreated$9(this));
|
|
getBinding().k.setOnServerMute(new WidgetUserSheet$onViewCreated$10(this));
|
|
getBinding().k.setOnServerDeafen(new WidgetUserSheet$onViewCreated$11(this));
|
|
getBinding().k.setOnServerMove(new WidgetUserSheet$onViewCreated$12(this));
|
|
getBinding().k.setOnDisconnect(new WidgetUserSheet$onViewCreated$13(this));
|
|
TextInputLayout textInputLayout = getBinding().B;
|
|
m.checkNotNullExpressionValue(textInputLayout, "binding.userSheetNoteTextFieldWrap");
|
|
ViewExtensions.setOnEditTextFocusChangeListener(textInputLayout, new WidgetUserSheet$onViewCreated$14(this));
|
|
TextInputLayout textInputLayout2 = getBinding().B;
|
|
m.checkNotNullExpressionValue(textInputLayout2, "binding.userSheetNoteTextFieldWrap");
|
|
ViewExtensions.setOnImeActionDone$default(textInputLayout2, false, new WidgetUserSheet$onViewCreated$15(this, view), 1, null);
|
|
ViewCompat.setAccessibilityDelegate(getBinding().f2121y, new WidgetUserSheet$onViewCreated$16(this));
|
|
for (TextView textView : n.listOf((Object[]) new TextView[]{getBinding().m, getBinding().u, getBinding().f2122z, getBinding().p, getBinding().v, getBinding().L})) {
|
|
AccessibilityUtils accessibilityUtils = AccessibilityUtils.INSTANCE;
|
|
m.checkNotNullExpressionValue(textView, "header");
|
|
accessibilityUtils.setViewIsHeading(textView);
|
|
}
|
|
WidgetChannelSelector.Companion.registerForResult$default(WidgetChannelSelector.Companion, this, REQUEST_KEY_MOVE_USER, false, new WidgetUserSheet$onViewCreated$17(this), 4, null);
|
|
}
|
|
}
|