discord-jadx/app/src/main/java/com/discord/widgets/chat/list/actions/WidgetChatListActions.java

718 lines
39 KiB
Java

package com.discord.widgets.chat.list.actions;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import androidx.annotation.MainThread;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.recyclerview.widget.RecyclerView;
import c.d.b.a.a;
import com.airbnb.lottie.parser.AnimatableValueParser;
import com.discord.api.channel.Channel;
import com.discord.api.thread.ThreadMetadata;
import com.discord.api.user.User;
import com.discord.app.AppBottomSheet;
import com.discord.databinding.WidgetChatListActionsBinding;
import com.discord.models.domain.emoji.Emoji;
import com.discord.models.domain.emoji.EmojiSet;
import com.discord.models.guild.Guild;
import com.discord.models.member.GuildMember;
import com.discord.models.message.Message;
import com.discord.models.user.MeUser;
import com.discord.stores.StoreStream;
import com.discord.utilities.dimen.DimenUtils;
import com.discord.utilities.mg_recycler.MGRecyclerAdapter;
import com.discord.utilities.permissions.ManageMessageContext;
import com.discord.utilities.permissions.PermissionUtils;
import com.discord.utilities.rest.RestAPI;
import com.discord.utilities.rx.ObservableExtensionsKt;
import com.discord.utilities.threads.ThreadUtils;
import com.discord.utilities.view.recycler.PaddedItemDecorator;
import com.discord.utilities.viewbinding.FragmentViewBindingDelegate;
import com.discord.utilities.viewbinding.FragmentViewBindingDelegateKt;
import com.discord.widgets.notice.WidgetNoticeDialog;
import d0.o;
import d0.t.g0;
import d0.z.d.m;
import j0.l.e.j;
import java.util.List;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.reflect.KProperty;
import rx.Observable;
/* compiled from: WidgetChatListActions.kt */
public final class WidgetChatListActions extends AppBottomSheet {
public static final /* synthetic */ KProperty[] $$delegatedProperties = {a.W(WidgetChatListActions.class, "binding", "getBinding()Lcom/discord/databinding/WidgetChatListActionsBinding;", 0)};
public static final Companion Companion = new Companion(null);
private static final String INTENT_EXTRA_MESSAGE_CHANNEL_ID = "INTENT_EXTRA_MESSAGE_CHANNEL_ID";
private static final String INTENT_EXTRA_MESSAGE_CONTENT = "INTENT_EXTRA_MESSAGE_CONTENT";
private static final String INTENT_EXTRA_MESSAGE_ID = "INTENT_EXTRA_MESSAGE_ID";
private static final String INTENT_EXTRA_TYPE = "INTENT_EXTRA_TYPE";
private static final int TYPE_CHAT = 0;
private static final int TYPE_PINS = 1;
private WidgetChatListActionsEmojisAdapter adapter;
private final FragmentViewBindingDelegate binding$delegate = FragmentViewBindingDelegateKt.viewBinding$default(this, WidgetChatListActions$binding$2.INSTANCE, null, 2, null);
private long channelId;
private PaddedItemDecorator itemDecorator;
private long messageId;
/* compiled from: WidgetChatListActions.kt */
public static final class Companion {
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
public final void showForChat(FragmentManager fragmentManager, long j, long j2, CharSequence charSequence) {
m.checkNotNullParameter(fragmentManager, "fragmentManager");
m.checkNotNullParameter(charSequence, "messageContent");
WidgetChatListActions widgetChatListActions = new WidgetChatListActions();
Bundle bundle = new Bundle();
bundle.putLong("INTENT_EXTRA_MESSAGE_CHANNEL_ID", j);
bundle.putLong("INTENT_EXTRA_MESSAGE_ID", j2);
bundle.putCharSequence("INTENT_EXTRA_MESSAGE_CONTENT", charSequence);
bundle.putInt("INTENT_EXTRA_TYPE", 0);
widgetChatListActions.setArguments(bundle);
widgetChatListActions.show(fragmentManager, WidgetChatListActions.class.getName());
}
public final void showForPin(FragmentManager fragmentManager, long j, long j2, CharSequence charSequence) {
m.checkNotNullParameter(fragmentManager, "fragmentManager");
m.checkNotNullParameter(charSequence, "messageContent");
Bundle bundle = new Bundle();
bundle.putLong("INTENT_EXTRA_MESSAGE_CHANNEL_ID", j);
bundle.putLong("INTENT_EXTRA_MESSAGE_ID", j2);
bundle.putCharSequence("INTENT_EXTRA_MESSAGE_CONTENT", charSequence);
bundle.putInt("INTENT_EXTRA_TYPE", 1);
WidgetChatListActions widgetChatListActions = new WidgetChatListActions();
widgetChatListActions.setArguments(bundle);
widgetChatListActions.show(fragmentManager, WidgetChatListActions.class.getName());
}
}
/* compiled from: WidgetChatListActions.kt */
public static final class Model {
public static final Companion Companion = new Companion(null);
private final Channel channel;
private final Guild guild;
private final boolean isDeveloper;
private final ManageMessageContext manageMessageContext;
/* renamed from: me reason: collision with root package name */
private final MeUser f2138me;
private final Message message;
private final String messageAuthorName;
private final CharSequence messageContent;
private final Long permissions;
private final List<Emoji> recentEmojis;
private final int type;
/* compiled from: WidgetChatListActions.kt */
public static final class Companion {
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
public static final /* synthetic */ Model access$create(Companion companion, Message message, Guild guild, Long l, MeUser meUser, GuildMember guildMember, Channel channel, CharSequence charSequence, int i, EmojiSet emojiSet) {
return companion.create(message, guild, l, meUser, guildMember, channel, charSequence, i, emojiSet);
}
private final Model create(Message message, Guild guild, Long l, MeUser meUser, GuildMember guildMember, Channel channel, CharSequence charSequence, int i, EmojiSet emojiSet) {
String nick;
ThreadMetadata y2;
String str = null;
if (message == null) {
return null;
}
ManageMessageContext from = ManageMessageContext.Companion.from(message, l, meUser, guild != null ? Integer.valueOf(guild.getMfaLevel()) : null, channel != null && AnimatableValueParser.s1(channel), channel != null && AnimatableValueParser.x1(channel), (channel == null || (y2 = channel.y()) == null || !y2.b()) ? false : true);
if (guildMember == null || (nick = guildMember.getNick()) == null) {
User author = message.getAuthor();
if (author != null) {
str = author.r();
}
} else {
str = nick;
}
if (str == null) {
str = "";
}
boolean isDeveloperMode = StoreStream.Companion.getUserSettings().getIsDeveloperMode();
List<Emoji> list = emojiSet.recentEmojis;
m.checkNotNullExpressionValue(list, "emojis.recentEmojis");
return new Model(message, guild, str, charSequence, from, i, isDeveloperMode, list, channel, l, meUser);
}
public final Observable<Model> get(long j, long j2, CharSequence charSequence, int i) {
Observable<Model> Y = Observable.j(i != 0 ? i != 1 ? new j<>(null) : StoreStream.Companion.getPinnedMessages().observePinnedMessage(j, j2) : StoreStream.Companion.getMessages().observeMessagesForChannel(j, j2), StoreStream.Companion.getChannels().observeChannel(j), WidgetChatListActions$Model$Companion$get$1.INSTANCE).Y(new WidgetChatListActions$Model$Companion$get$2(j, charSequence, i));
m.checkNotNullExpressionValue(Y, "Observable\n .… }\n }");
return Y;
}
}
/* JADX DEBUG: Multi-variable search result rejected for r9v0, resolved type: java.util.List<? extends com.discord.models.domain.emoji.Emoji> */
/* JADX WARN: Multi-variable type inference failed */
public Model(Message message, Guild guild, String str, CharSequence charSequence, ManageMessageContext manageMessageContext, int i, boolean z2, List<? extends Emoji> list, Channel channel, Long l, MeUser meUser) {
m.checkNotNullParameter(message, "message");
m.checkNotNullParameter(str, "messageAuthorName");
m.checkNotNullParameter(manageMessageContext, "manageMessageContext");
m.checkNotNullParameter(list, "recentEmojis");
m.checkNotNullParameter(meUser, "me");
this.message = message;
this.guild = guild;
this.messageAuthorName = str;
this.messageContent = charSequence;
this.manageMessageContext = manageMessageContext;
this.type = i;
this.isDeveloper = z2;
this.recentEmojis = list;
this.channel = channel;
this.permissions = l;
this.f2138me = meUser;
}
public static /* synthetic */ Model copy$default(Model model, Message message, Guild guild, String str, CharSequence charSequence, ManageMessageContext manageMessageContext, int i, boolean z2, List list, Channel channel, Long l, MeUser meUser, int i2, Object obj) {
return model.copy((i2 & 1) != 0 ? model.message : message, (i2 & 2) != 0 ? model.guild : guild, (i2 & 4) != 0 ? model.messageAuthorName : str, (i2 & 8) != 0 ? model.messageContent : charSequence, (i2 & 16) != 0 ? model.manageMessageContext : manageMessageContext, (i2 & 32) != 0 ? model.type : i, (i2 & 64) != 0 ? model.isDeveloper : z2, (i2 & 128) != 0 ? model.recentEmojis : list, (i2 & 256) != 0 ? model.channel : channel, (i2 & 512) != 0 ? model.permissions : l, (i2 & 1024) != 0 ? model.f2138me : meUser);
}
public final Message component1() {
return this.message;
}
public final Long component10() {
return this.permissions;
}
public final MeUser component11() {
return this.f2138me;
}
public final Guild component2() {
return this.guild;
}
public final String component3() {
return this.messageAuthorName;
}
public final CharSequence component4() {
return this.messageContent;
}
public final ManageMessageContext component5() {
return this.manageMessageContext;
}
public final int component6() {
return this.type;
}
public final boolean component7() {
return this.isDeveloper;
}
public final List<Emoji> component8() {
return this.recentEmojis;
}
public final Channel component9() {
return this.channel;
}
public final Model copy(Message message, Guild guild, String str, CharSequence charSequence, ManageMessageContext manageMessageContext, int i, boolean z2, List<? extends Emoji> list, Channel channel, Long l, MeUser meUser) {
m.checkNotNullParameter(message, "message");
m.checkNotNullParameter(str, "messageAuthorName");
m.checkNotNullParameter(manageMessageContext, "manageMessageContext");
m.checkNotNullParameter(list, "recentEmojis");
m.checkNotNullParameter(meUser, "me");
return new Model(message, guild, str, charSequence, manageMessageContext, i, z2, list, channel, l, meUser);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof Model)) {
return false;
}
Model model = (Model) obj;
return m.areEqual(this.message, model.message) && m.areEqual(this.guild, model.guild) && m.areEqual(this.messageAuthorName, model.messageAuthorName) && m.areEqual(this.messageContent, model.messageContent) && m.areEqual(this.manageMessageContext, model.manageMessageContext) && this.type == model.type && this.isDeveloper == model.isDeveloper && m.areEqual(this.recentEmojis, model.recentEmojis) && m.areEqual(this.channel, model.channel) && m.areEqual(this.permissions, model.permissions) && m.areEqual(this.f2138me, model.f2138me);
}
public final Channel getChannel() {
return this.channel;
}
public final Guild getGuild() {
return this.guild;
}
public final ManageMessageContext getManageMessageContext() {
return this.manageMessageContext;
}
public final MeUser getMe() {
return this.f2138me;
}
public final Message getMessage() {
return this.message;
}
public final String getMessageAuthorName() {
return this.messageAuthorName;
}
public final CharSequence getMessageContent() {
return this.messageContent;
}
public final Long getPermissions() {
return this.permissions;
}
public final List<Emoji> getRecentEmojis() {
return this.recentEmojis;
}
public final int getType() {
return this.type;
}
public int hashCode() {
Message message = this.message;
int i = 0;
int hashCode = (message != null ? message.hashCode() : 0) * 31;
Guild guild = this.guild;
int hashCode2 = (hashCode + (guild != null ? guild.hashCode() : 0)) * 31;
String str = this.messageAuthorName;
int hashCode3 = (hashCode2 + (str != null ? str.hashCode() : 0)) * 31;
CharSequence charSequence = this.messageContent;
int hashCode4 = (hashCode3 + (charSequence != null ? charSequence.hashCode() : 0)) * 31;
ManageMessageContext manageMessageContext = this.manageMessageContext;
int hashCode5 = (((hashCode4 + (manageMessageContext != null ? manageMessageContext.hashCode() : 0)) * 31) + this.type) * 31;
boolean z2 = this.isDeveloper;
if (z2) {
z2 = true;
}
int i2 = z2 ? 1 : 0;
int i3 = z2 ? 1 : 0;
int i4 = z2 ? 1 : 0;
int i5 = (hashCode5 + i2) * 31;
List<Emoji> list = this.recentEmojis;
int hashCode6 = (i5 + (list != null ? list.hashCode() : 0)) * 31;
Channel channel = this.channel;
int hashCode7 = (hashCode6 + (channel != null ? channel.hashCode() : 0)) * 31;
Long l = this.permissions;
int hashCode8 = (hashCode7 + (l != null ? l.hashCode() : 0)) * 31;
MeUser meUser = this.f2138me;
if (meUser != null) {
i = meUser.hashCode();
}
return hashCode8 + i;
}
public final boolean isDeveloper() {
return this.isDeveloper;
}
public String toString() {
StringBuilder L = a.L("Model(message=");
L.append(this.message);
L.append(", guild=");
L.append(this.guild);
L.append(", messageAuthorName=");
L.append(this.messageAuthorName);
L.append(", messageContent=");
L.append(this.messageContent);
L.append(", manageMessageContext=");
L.append(this.manageMessageContext);
L.append(", type=");
L.append(this.type);
L.append(", isDeveloper=");
L.append(this.isDeveloper);
L.append(", recentEmojis=");
L.append(this.recentEmojis);
L.append(", channel=");
L.append(this.channel);
L.append(", permissions=");
L.append(this.permissions);
L.append(", me=");
L.append(this.f2138me);
L.append(")");
return L.toString();
}
}
public WidgetChatListActions() {
super(false, 1, null);
}
public static final /* synthetic */ void access$addReaction(WidgetChatListActions widgetChatListActions, Emoji emoji) {
widgetChatListActions.addReaction(emoji);
}
public static final /* synthetic */ void access$configureUI(WidgetChatListActions widgetChatListActions, Model model) {
widgetChatListActions.configureUI(model);
}
public static final /* synthetic */ void access$confirmPublishMessage(WidgetChatListActions widgetChatListActions, Message message) {
widgetChatListActions.confirmPublishMessage(message);
}
public static final /* synthetic */ void access$deleteMessage(WidgetChatListActions widgetChatListActions, Message message) {
widgetChatListActions.deleteMessage(message);
}
public static final /* synthetic */ void access$editMessage(WidgetChatListActions widgetChatListActions, Message message) {
widgetChatListActions.editMessage(message);
}
public static final /* synthetic */ long access$getChannelId$p(WidgetChatListActions widgetChatListActions) {
return widgetChatListActions.channelId;
}
public static final /* synthetic */ long access$getMessageId$p(WidgetChatListActions widgetChatListActions) {
return widgetChatListActions.messageId;
}
public static final /* synthetic */ void access$removeAllReactions(WidgetChatListActions widgetChatListActions, Model model) {
widgetChatListActions.removeAllReactions(model);
}
public static final /* synthetic */ void access$replyMessage(WidgetChatListActions widgetChatListActions, Message message, Channel channel) {
widgetChatListActions.replyMessage(message, channel);
}
public static final /* synthetic */ void access$setChannelId$p(WidgetChatListActions widgetChatListActions, long j) {
widgetChatListActions.channelId = j;
}
public static final /* synthetic */ void access$setMessageId$p(WidgetChatListActions widgetChatListActions, long j) {
widgetChatListActions.messageId = j;
}
public static final /* synthetic */ void access$toggleMessagePin(WidgetChatListActions widgetChatListActions, Message message) {
widgetChatListActions.toggleMessagePin(message);
}
private final void addReaction(Emoji emoji) {
RestAPI api = RestAPI.Companion.getApi();
long j = this.channelId;
long j2 = this.messageId;
String reactionKey = emoji.getReactionKey();
m.checkNotNullExpressionValue(reactionKey, "emoji.reactionKey");
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(ObservableExtensionsKt.restSubscribeOn$default(api.addReaction(j, j2, reactionKey), false, 1, null), this, null, 2, null), getContext(), "REST: addReaction", (Function1) null, new WidgetChatListActions$addReaction$1(this, emoji), (Function1) null, (Function0) null, (Function0) null, 116, (Object) null);
}
private final void configureAddReactionEmojisList(List<? extends Emoji> list, boolean z2, boolean z3) {
if (list.isEmpty() || z2 || !z3) {
RecyclerView recyclerView = getBinding().b;
m.checkNotNullExpressionValue(recyclerView, "binding.dialogChatActionsAddReactionEmojisList");
recyclerView.setVisibility(8);
return;
}
RecyclerView recyclerView2 = getBinding().b;
m.checkNotNullExpressionValue(recyclerView2, "binding.dialogChatActionsAddReactionEmojisList");
recyclerView2.setVisibility(0);
RecyclerView recyclerView3 = getBinding().b;
m.checkNotNullExpressionValue(recyclerView3, "binding.dialogChatActionsAddReactionEmojisList");
int width = recyclerView3.getWidth();
RecyclerView recyclerView4 = getBinding().b;
m.checkNotNullExpressionValue(recyclerView4, "binding.dialogChatActionsAddReactionEmojisList");
int paddingStart = recyclerView4.getPaddingStart();
RecyclerView recyclerView5 = getBinding().b;
m.checkNotNullExpressionValue(recyclerView5, "binding.dialogChatActionsAddReactionEmojisList");
int paddingEnd = recyclerView5.getPaddingEnd() + paddingStart;
int dimensionPixelSize = getResources().getDimensionPixelSize(2131165315);
int dpToPixels = DimenUtils.dpToPixels(8);
int i = width - paddingEnd;
int min = Math.min(list.size() + 1, (i + dpToPixels) / (dimensionPixelSize + dpToPixels));
int i2 = min - 1;
int max = Math.max(i - ((i2 * dpToPixels) + (dimensionPixelSize * min)), 0);
PaddedItemDecorator paddedItemDecorator = this.itemDecorator;
if (paddedItemDecorator != null) {
getBinding().b.removeItemDecoration(paddedItemDecorator);
}
PaddedItemDecorator paddedItemDecorator2 = new PaddedItemDecorator(0, (max / i2) + dpToPixels, 0, true);
getBinding().b.addItemDecoration(paddedItemDecorator2);
this.itemDecorator = paddedItemDecorator2;
WidgetChatListActionsEmojisAdapter widgetChatListActionsEmojisAdapter = this.adapter;
if (widgetChatListActionsEmojisAdapter == null) {
m.throwUninitializedPropertyAccessException("adapter");
}
widgetChatListActionsEmojisAdapter.setData(list, min);
}
/* JADX WARNING: Removed duplicated region for block: B:102:0x029c */
/* JADX WARNING: Removed duplicated region for block: B:103:0x029e */
/* JADX WARNING: Removed duplicated region for block: B:106:0x02b9 */
/* JADX WARNING: Removed duplicated region for block: B:107:0x02bd */
/* JADX WARNING: Removed duplicated region for block: B:110:0x02e6 */
/* JADX WARNING: Removed duplicated region for block: B:111:0x02e8 */
/* JADX WARNING: Removed duplicated region for block: B:131:0x0356 */
/* JADX WARNING: Removed duplicated region for block: B:132:0x0358 */
/* JADX WARNING: Removed duplicated region for block: B:135:0x038f */
/* JADX WARNING: Removed duplicated region for block: B:81:0x0205 */
/* JADX WARNING: Removed duplicated region for block: B:82:0x0207 */
/* JADX WARNING: Removed duplicated region for block: B:90:0x0245 */
/* JADX WARNING: Removed duplicated region for block: B:91:0x0247 */
/* JADX WARNING: Removed duplicated region for block: B:98:0x0272 */
/* JADX WARNING: Removed duplicated region for block: B:99:0x0274 */
private final void configureUI(Model model) {
Channel channel;
Integer type;
if (model == null) {
dismiss();
return;
}
Guild guild = model.getGuild();
long id2 = guild != null ? guild.getId() : 0;
boolean isLocal = model.getMessage().isLocal();
boolean isCrossposted = model.getMessage().isCrossposted();
boolean z2 = true;
int i = 0;
boolean z3 = model.getManageMessageContext().getCanEdit() || model.getManageMessageContext().getCanManageMessages();
configureAddReactionEmojisList(model.getRecentEmojis(), isLocal, model.getManageMessageContext().getCanAddReactions());
int type2 = model.getType();
if (type2 == 0) {
TextView textView = getBinding().f;
m.checkNotNullExpressionValue(textView, "binding.dialogChatActionsEdit");
textView.setVisibility(model.getManageMessageContext().getCanEdit() ? 0 : 8);
getBinding().f.setOnClickListener(new WidgetChatListActions$configureUI$1(this, model));
} else if (type2 == 1) {
TextView textView2 = getBinding().f;
m.checkNotNullExpressionValue(textView2, "binding.dialogChatActionsEdit");
textView2.setVisibility(8);
}
TextView textView3 = getBinding().k;
m.checkNotNullExpressionValue(textView3, "binding.dialogChatActionsPublish");
textView3.setVisibility(z3 && (channel = model.getChannel()) != null && channel.A() == 5 && (type = model.getMessage().getType()) != null && type.intValue() == 0 && !isCrossposted ? 0 : 8);
getBinding().k.setOnClickListener(new WidgetChatListActions$configureUI$2(this, model));
TextView textView4 = getBinding().g;
m.checkNotNullExpressionValue(textView4, "binding.dialogChatActionsManageReactions");
textView4.setVisibility(model.getMessage().getReactionsMap().isEmpty() ^ true ? 0 : 8);
getBinding().g.setOnClickListener(new WidgetChatListActions$configureUI$3(this));
TextView textView5 = getBinding().l;
m.checkNotNullExpressionValue(textView5, "binding.dialogChatActionsRemoveAllReactions");
textView5.setVisibility((model.getMessage().getReactionsMap().isEmpty() ^ true) && model.getManageMessageContext().getCanManageMessages() ? 0 : 8);
getBinding().l.setOnClickListener(new WidgetChatListActions$configureUI$4(this, model));
TextView textView6 = getBinding().o;
m.checkNotNullExpressionValue(textView6, "binding.dialogChatActionsResend");
textView6.setVisibility(model.getMessage().canResend() ? 0 : 8);
getBinding().o.setOnClickListener(new WidgetChatListActions$configureUI$5(this, model));
TextView textView7 = getBinding().h;
m.checkNotNullExpressionValue(textView7, "binding.dialogChatActionsMarkUnread");
textView7.setVisibility(!model.getMessage().isFailed() && model.getManageMessageContext().getCanMarkUnread() ? 0 : 8);
getBinding().h.setOnClickListener(new WidgetChatListActions$configureUI$6(this, model));
if (model.getMessageContent() != null) {
if ((model.getMessageContent().length() > 0) && !model.getMessage().isLocalApplicationCommand()) {
TextView textView8 = getBinding().f1723c;
m.checkNotNullExpressionValue(textView8, "binding.dialogChatActionsCopy");
textView8.setVisibility(0);
getBinding().f1723c.setOnClickListener(new WidgetChatListActions$configureUI$7(this, model));
TextView textView9 = getBinding().d;
m.checkNotNullExpressionValue(textView9, "binding.dialogChatActionsCopyId");
textView9.setVisibility(!(!model.isDeveloper() && !isLocal) ? 0 : 8);
getBinding().d.setOnClickListener(new WidgetChatListActions$configureUI$8(this, model));
TextView textView10 = getBinding().n;
m.checkNotNullExpressionValue(textView10, "binding.dialogChatActionsReport");
User author = model.getMessage().getAuthor();
textView10.setVisibility(!(author != null || (author.i() > model.getMe().getId() ? 1 : (author.i() == model.getMe().getId() ? 0 : -1)) != 0) ? 0 : 8);
getBinding().n.setOnClickListener(new WidgetChatListActions$configureUI$9(this, model));
TextView textView11 = getBinding().p;
m.checkNotNullExpressionValue(textView11, "binding.dialogChatActionsShare");
textView11.setVisibility(!(!model.isDeveloper() && !isLocal) ? 0 : 8);
getBinding().p.setOnClickListener(new WidgetChatListActions$configureUI$10(this, model, id2));
TextView textView12 = getBinding().i;
m.checkNotNullExpressionValue(textView12, "binding.dialogChatActionsPin");
textView12.setVisibility(!model.getManageMessageContext().getCanTogglePinned() ? 0 : 8);
getBinding().i.setText(!m.areEqual(model.getMessage().getPinned(), Boolean.TRUE) ? 2131894171 : 2131891955);
getBinding().i.setOnClickListener(new WidgetChatListActions$configureUI$11(this, model));
TextView textView13 = getBinding().e;
m.checkNotNullExpressionValue(textView13, "binding.dialogChatActionsDelete");
textView13.setVisibility(!model.getManageMessageContext().getCanDelete() ? 0 : 8);
getBinding().e.setOnClickListener(new WidgetChatListActions$configureUI$12(this, model));
getBinding().j.setOnClickListener(new WidgetChatListActions$configureUI$13(this, model));
boolean z4 = model.getChannel() == null && AnimatableValueParser.s1(model.getChannel()) && !AnimatableValueParser.x1(model.getChannel());
if (isLocal || model.getType() != 0 || !model.getMessage().isUserMessage() || (!z4 && !PermissionUtils.can(67584, model.getPermissions()))) {
z2 = false;
}
TextView textView14 = getBinding().m;
m.checkNotNullExpressionValue(textView14, "binding.dialogChatActionsReply");
textView14.setVisibility(!z2 ? 0 : 8);
getBinding().m.setOnClickListener(new WidgetChatListActions$configureUI$14(this, model));
TextView textView15 = getBinding().q;
m.checkNotNullExpressionValue(textView15, "binding.dialogChatActionsStartThread");
if (!ThreadUtils.INSTANCE.canCreatePublicThread(model.getPermissions(), model.getChannel(), model.getMessage(), model.getGuild())) {
i = 8;
}
textView15.setVisibility(i);
getBinding().q.setOnClickListener(new WidgetChatListActions$configureUI$15(this, id2, model));
}
}
TextView textView16 = getBinding().f1723c;
m.checkNotNullExpressionValue(textView16, "binding.dialogChatActionsCopy");
textView16.setVisibility(8);
TextView textView9 = getBinding().d;
m.checkNotNullExpressionValue(textView9, "binding.dialogChatActionsCopyId");
textView9.setVisibility(!(!model.isDeveloper() && !isLocal) ? 0 : 8);
getBinding().d.setOnClickListener(new WidgetChatListActions$configureUI$8(this, model));
TextView textView10 = getBinding().n;
m.checkNotNullExpressionValue(textView10, "binding.dialogChatActionsReport");
User author = model.getMessage().getAuthor();
textView10.setVisibility(!(author != null || (author.i() > model.getMe().getId() ? 1 : (author.i() == model.getMe().getId() ? 0 : -1)) != 0) ? 0 : 8);
getBinding().n.setOnClickListener(new WidgetChatListActions$configureUI$9(this, model));
TextView textView11 = getBinding().p;
m.checkNotNullExpressionValue(textView11, "binding.dialogChatActionsShare");
textView11.setVisibility(!(!model.isDeveloper() && !isLocal) ? 0 : 8);
getBinding().p.setOnClickListener(new WidgetChatListActions$configureUI$10(this, model, id2));
TextView textView12 = getBinding().i;
m.checkNotNullExpressionValue(textView12, "binding.dialogChatActionsPin");
textView12.setVisibility(!model.getManageMessageContext().getCanTogglePinned() ? 0 : 8);
getBinding().i.setText(!m.areEqual(model.getMessage().getPinned(), Boolean.TRUE) ? 2131894171 : 2131891955);
getBinding().i.setOnClickListener(new WidgetChatListActions$configureUI$11(this, model));
TextView textView13 = getBinding().e;
m.checkNotNullExpressionValue(textView13, "binding.dialogChatActionsDelete");
textView13.setVisibility(!model.getManageMessageContext().getCanDelete() ? 0 : 8);
getBinding().e.setOnClickListener(new WidgetChatListActions$configureUI$12(this, model));
getBinding().j.setOnClickListener(new WidgetChatListActions$configureUI$13(this, model));
if (model.getChannel() == null) {
}
z2 = false;
TextView textView14 = getBinding().m;
m.checkNotNullExpressionValue(textView14, "binding.dialogChatActionsReply");
textView14.setVisibility(!z2 ? 0 : 8);
getBinding().m.setOnClickListener(new WidgetChatListActions$configureUI$14(this, model));
TextView textView15 = getBinding().q;
m.checkNotNullExpressionValue(textView15, "binding.dialogChatActionsStartThread");
if (!ThreadUtils.INSTANCE.canCreatePublicThread(model.getPermissions(), model.getChannel(), model.getMessage(), model.getGuild())) {
}
textView15.setVisibility(i);
getBinding().q.setOnClickListener(new WidgetChatListActions$configureUI$15(this, id2, model));
}
@MainThread
private final void confirmPublishMessage(Message message) {
MessageActionDialogs messageActionDialogs = MessageActionDialogs.INSTANCE;
FragmentManager parentFragmentManager = getParentFragmentManager();
m.checkNotNullExpressionValue(parentFragmentManager, "parentFragmentManager");
messageActionDialogs.showPublishMessageConfirmation(parentFragmentManager, message, new WidgetChatListActions$confirmPublishMessage$1(this));
}
@MainThread
private final void deleteMessage(Message message) {
MessageActionDialogs messageActionDialogs = MessageActionDialogs.INSTANCE;
FragmentManager parentFragmentManager = getParentFragmentManager();
m.checkNotNullExpressionValue(parentFragmentManager, "parentFragmentManager");
Context requireContext = requireContext();
m.checkNotNullExpressionValue(requireContext, "requireContext()");
messageActionDialogs.showDeleteMessageConfirmation(parentFragmentManager, requireContext, message, new WidgetChatListActions$deleteMessage$1(this));
}
private final void editMessage(Message message) {
Observable<R> Y = StoreStream.Companion.getChannels().observeGuildAndPrivateChannels().Y(new WidgetChatListActions$editMessage$1(message));
m.checkNotNullExpressionValue(Y, "StoreStream\n .get… }\n }");
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.takeSingleUntilTimeout$default(ObservableExtensionsKt.computationBuffered(Y), 0, false, 3, null), (Context) null, "editMessage", (Function1) null, new WidgetChatListActions$editMessage$2(message), (Function1) null, (Function0) null, (Function0) null, 117, (Object) null);
}
private final WidgetChatListActionsBinding getBinding() {
return (WidgetChatListActionsBinding) this.binding$delegate.getValue((Fragment) this, $$delegatedProperties[0]);
}
@MainThread
private final void removeAllReactions(Model model) {
WidgetNoticeDialog.Companion companion = WidgetNoticeDialog.Companion;
FragmentManager parentFragmentManager = getParentFragmentManager();
m.checkNotNullExpressionValue(parentFragmentManager, "parentFragmentManager");
String string = getString(2131892642);
String string2 = getString(2131892641);
m.checkNotNullExpressionValue(string2, "getString(R.string.remov…l_reactions_confirm_body)");
WidgetNoticeDialog.Companion.show$default(companion, parentFragmentManager, string, string2, getString(2131894759), getString(2131891493), g0.mapOf(o.to(2131364075, new WidgetChatListActions$removeAllReactions$1(this, model))), null, null, null, null, null, null, 0, null, 16320, null);
}
private final void replyMessage(Message message, Channel channel) {
StoreStream.Companion companion = StoreStream.Companion;
long id2 = companion.getUsers().getMe().getId();
boolean s1 = AnimatableValueParser.s1(channel);
boolean isWebhook = message.isWebhook();
User author = message.getAuthor();
boolean z2 = true;
boolean z3 = author != null && author.i() == id2;
boolean z4 = !isWebhook && !z3;
if (s1 || isWebhook || z3) {
z2 = false;
}
companion.getPendingReplies().onCreatePendingReply(channel, message, z4, z2);
}
public static final void showForChat(FragmentManager fragmentManager, long j, long j2, CharSequence charSequence) {
Companion.showForChat(fragmentManager, j, j2, charSequence);
}
public static final void showForPin(FragmentManager fragmentManager, long j, long j2, CharSequence charSequence) {
Companion.showForPin(fragmentManager, j, j2, charSequence);
}
@MainThread
private final void toggleMessagePin(Message message) {
MessageActionDialogs messageActionDialogs = MessageActionDialogs.INSTANCE;
FragmentManager parentFragmentManager = getParentFragmentManager();
m.checkNotNullExpressionValue(parentFragmentManager, "parentFragmentManager");
Context requireContext = requireContext();
m.checkNotNullExpressionValue(requireContext, "requireContext()");
messageActionDialogs.showPinMessageConfirmation(parentFragmentManager, requireContext, message, this, new WidgetChatListActions$toggleMessagePin$1(this));
}
@Override // com.discord.app.AppBottomSheet
public int getContentViewResId() {
return 2131558925;
}
@Override // com.discord.app.AppBottomSheet, androidx.fragment.app.Fragment
public void onResume() {
super.onResume();
AppBottomSheet.hideKeyboard$default(this, null, 1, null);
Observable r = ObservableExtensionsKt.computationLatest(Model.Companion.get(this.channelId, this.messageId, getArgumentsOrDefault().getCharSequence("INTENT_EXTRA_MESSAGE_CONTENT"), getArgumentsOrDefault().getInt("INTENT_EXTRA_TYPE"))).r();
m.checkNotNullExpressionValue(r, "Model.get(channelId, mes… .distinctUntilChanged()");
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(r, this, null, 2, null), WidgetChatListActions.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetChatListActions$onResume$1(this), 62, (Object) null);
}
@Override // com.discord.app.AppBottomSheet, androidx.fragment.app.Fragment
public void onViewCreated(View view, Bundle bundle) {
m.checkNotNullParameter(view, "view");
super.onViewCreated(view, bundle);
this.channelId = getArgumentsOrDefault().getLong("INTENT_EXTRA_MESSAGE_CHANNEL_ID");
this.messageId = getArgumentsOrDefault().getLong("INTENT_EXTRA_MESSAGE_ID");
MGRecyclerAdapter.Companion companion = MGRecyclerAdapter.Companion;
RecyclerView recyclerView = getBinding().b;
m.checkNotNullExpressionValue(recyclerView, "binding.dialogChatActionsAddReactionEmojisList");
WidgetChatListActionsEmojisAdapter widgetChatListActionsEmojisAdapter = (WidgetChatListActionsEmojisAdapter) companion.configure(new WidgetChatListActionsEmojisAdapter(recyclerView));
this.adapter = widgetChatListActionsEmojisAdapter;
if (widgetChatListActionsEmojisAdapter == null) {
m.throwUninitializedPropertyAccessException("adapter");
}
widgetChatListActionsEmojisAdapter.setOnClickEmoji(new WidgetChatListActions$onViewCreated$1(this));
WidgetChatListActionsEmojisAdapter widgetChatListActionsEmojisAdapter2 = this.adapter;
if (widgetChatListActionsEmojisAdapter2 == null) {
m.throwUninitializedPropertyAccessException("adapter");
}
widgetChatListActionsEmojisAdapter2.setOnClickMoreEmojis(new WidgetChatListActions$onViewCreated$2(this));
RecyclerView recyclerView2 = getBinding().b;
m.checkNotNullExpressionValue(recyclerView2, "binding.dialogChatActionsAddReactionEmojisList");
WidgetChatListActionsEmojisAdapter widgetChatListActionsEmojisAdapter3 = this.adapter;
if (widgetChatListActionsEmojisAdapter3 == null) {
m.throwUninitializedPropertyAccessException("adapter");
}
recyclerView2.setAdapter(widgetChatListActionsEmojisAdapter3);
getBinding().b.setHasFixedSize(true);
}
}