discord-jadx/app/src/main/java/com/discord/widgets/chat/pins/WidgetChannelPinnedMessages...

367 lines
17 KiB
Java

package com.discord.widgets.chat.pins;
import a0.a.a.b;
import android.content.Context;
import android.content.Intent;
import android.view.View;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.recyclerview.widget.RecyclerView;
import c.a.d.l;
import c.d.b.a.a;
import com.airbnb.lottie.parser.AnimatableValueParser;
import com.discord.api.channel.Channel;
import com.discord.app.AppFragment;
import com.discord.databinding.WidgetChannelPinnedMessagesBinding;
import com.discord.models.guild.Guild;
import com.discord.stores.StoreStream;
import com.discord.stores.StoreUserSettings;
import com.discord.utilities.embed.InviteEmbedModel;
import com.discord.utilities.mg_recycler.MGRecyclerAdapter;
import com.discord.utilities.rx.ObservableExtensionsKt;
import com.discord.utilities.viewbinding.FragmentViewBindingDelegate;
import com.discord.utilities.viewbinding.FragmentViewBindingDelegateKt;
import com.discord.widgets.chat.list.adapter.WidgetChatListAdapter;
import com.discord.widgets.chat.list.entries.ChatListEntry;
import d0.z.d.m;
import j0.l.e.j;
import java.util.List;
import java.util.Map;
import java.util.Set;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.reflect.KProperty;
import rx.Observable;
/* compiled from: WidgetChannelPinnedMessages.kt */
public final class WidgetChannelPinnedMessages extends AppFragment {
public static final /* synthetic */ KProperty[] $$delegatedProperties = {a.V(WidgetChannelPinnedMessages.class, "binding", "getBinding()Lcom/discord/databinding/WidgetChannelPinnedMessagesBinding;", 0)};
public static final Companion Companion = new Companion(null);
private static final String INTENT_EXTRA_CHANNEL_ID = "INTENT_EXTRA_CHANNEL_ID";
private WidgetChatListAdapter adapter;
private final FragmentViewBindingDelegate binding$delegate = FragmentViewBindingDelegateKt.viewBinding$default(this, WidgetChannelPinnedMessages$binding$2.INSTANCE, null, 2, null);
/* compiled from: WidgetChannelPinnedMessages.kt */
public static final class Companion {
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
public final void show(Context context, long j) {
m.checkNotNullParameter(context, "context");
Intent intent = new Intent();
intent.putExtra("INTENT_EXTRA_CHANNEL_ID", j);
l.d(context, WidgetChannelPinnedMessages.class, intent);
}
}
/* compiled from: WidgetChannelPinnedMessages.kt */
public static final class Model implements WidgetChatListAdapter.Data {
public static final Companion Companion = new Companion(null);
private final Channel channel;
private final long channelId;
private final Map<Long, String> channelNames;
private final Guild guild;
private final long guildId;
private final boolean isSpoilerClickAllowed;
private final List<ChatListEntry> list;
private final Set<Long> myRoleIds;
private final long newMessagesMarkerMessageId;
private final long oldestMessageId;
private final long userId;
/* compiled from: WidgetChannelPinnedMessages.kt */
public static final class Companion {
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
public final Observable<Model> get(Context context, long j) {
m.checkNotNullParameter(context, "context");
StoreStream.Companion companion = StoreStream.Companion;
Channel findChannelByIdInternal$app_productionBetaRelease = companion.getChannels().findChannelByIdInternal$app_productionBetaRelease(j);
if (findChannelByIdInternal$app_productionBetaRelease != null) {
Observable<Model> c2 = Observable.c(companion.getUsers().observeMeId(), companion.getPinnedMessages().observeForChannel(j), companion.getGuilds().observeRoles(findChannelByIdInternal$app_productionBetaRelease.f()), companion.getGuilds().observeComputed(findChannelByIdInternal$app_productionBetaRelease.f()), companion.getChannels().observeNames(), StoreUserSettings.observeIsAnimatedEmojisEnabled$default(companion.getUserSettings(), false, 1, null), StoreUserSettings.observeIsAutoPlayGifsEnabled$default(companion.getUserSettings(), false, 1, null), companion.getGuilds().observeGuild(findChannelByIdInternal$app_productionBetaRelease.f()), InviteEmbedModel.Companion.observe$default(InviteEmbedModel.Companion, null, null, null, null, 15, null), new WidgetChannelPinnedMessages$Model$Companion$get$1(context, findChannelByIdInternal$app_productionBetaRelease));
m.checkNotNullExpressionValue(c2, "Observable\n .… myRoleIds)\n }");
return c2;
}
j jVar = new j(null);
m.checkNotNullExpressionValue(jVar, "Observable.just(null)");
return jVar;
}
}
/* JADX DEBUG: Multi-variable search result rejected for r13v0, resolved type: java.util.List<? extends com.discord.widgets.chat.list.entries.ChatListEntry> */
/* JADX WARN: Multi-variable type inference failed */
public Model(Channel channel, Guild guild, long j, Map<Long, String> map, List<? extends ChatListEntry> list, Set<Long> set, long j2, long j3, long j4, long j5, boolean z2) {
m.checkNotNullParameter(channel, "channel");
m.checkNotNullParameter(map, "channelNames");
m.checkNotNullParameter(list, "list");
m.checkNotNullParameter(set, "myRoleIds");
this.channel = channel;
this.guild = guild;
this.userId = j;
this.channelNames = map;
this.list = list;
this.myRoleIds = set;
this.channelId = j2;
this.guildId = j3;
this.oldestMessageId = j4;
this.newMessagesMarkerMessageId = j5;
this.isSpoilerClickAllowed = z2;
}
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
public /* synthetic */ Model(Channel channel, Guild guild, long j, Map map, List list, Set set, long j2, long j3, long j4, long j5, boolean z2, int i, DefaultConstructorMarker defaultConstructorMarker) {
this(channel, guild, j, map, list, set, (i & 64) != 0 ? channel.h() : j2, (i & 128) != 0 ? channel.f() : j3, (i & 256) != 0 ? 0 : j4, (i & 512) != 0 ? 0 : j5, (i & 1024) != 0 ? false : z2);
}
public static /* synthetic */ Model copy$default(Model model, Channel channel, Guild guild, long j, Map map, List list, Set set, long j2, long j3, long j4, long j5, boolean z2, int i, Object obj) {
return model.copy((i & 1) != 0 ? model.channel : channel, (i & 2) != 0 ? model.getGuild() : guild, (i & 4) != 0 ? model.getUserId() : j, (i & 8) != 0 ? model.getChannelNames() : map, (i & 16) != 0 ? model.getList() : list, (i & 32) != 0 ? model.getMyRoleIds() : set, (i & 64) != 0 ? model.getChannelId() : j2, (i & 128) != 0 ? model.getGuildId() : j3, (i & 256) != 0 ? model.getOldestMessageId() : j4, (i & 512) != 0 ? model.getNewMessagesMarkerMessageId() : j5, (i & 1024) != 0 ? model.isSpoilerClickAllowed() : z2);
}
public final Channel component1() {
return this.channel;
}
public final long component10() {
return getNewMessagesMarkerMessageId();
}
public final boolean component11() {
return isSpoilerClickAllowed();
}
public final Guild component2() {
return getGuild();
}
public final long component3() {
return getUserId();
}
public final Map<Long, String> component4() {
return getChannelNames();
}
public final List<ChatListEntry> component5() {
return getList();
}
public final Set<Long> component6() {
return getMyRoleIds();
}
public final long component7() {
return getChannelId();
}
public final long component8() {
return getGuildId();
}
public final long component9() {
return getOldestMessageId();
}
public final Model copy(Channel channel, Guild guild, long j, Map<Long, String> map, List<? extends ChatListEntry> list, Set<Long> set, long j2, long j3, long j4, long j5, boolean z2) {
m.checkNotNullParameter(channel, "channel");
m.checkNotNullParameter(map, "channelNames");
m.checkNotNullParameter(list, "list");
m.checkNotNullParameter(set, "myRoleIds");
return new Model(channel, guild, j, map, list, set, j2, j3, j4, j5, z2);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof Model)) {
return false;
}
Model model = (Model) obj;
return m.areEqual(this.channel, model.channel) && m.areEqual(getGuild(), model.getGuild()) && getUserId() == model.getUserId() && m.areEqual(getChannelNames(), model.getChannelNames()) && m.areEqual(getList(), model.getList()) && m.areEqual(getMyRoleIds(), model.getMyRoleIds()) && getChannelId() == model.getChannelId() && getGuildId() == model.getGuildId() && getOldestMessageId() == model.getOldestMessageId() && getNewMessagesMarkerMessageId() == model.getNewMessagesMarkerMessageId() && isSpoilerClickAllowed() == model.isSpoilerClickAllowed();
}
public final Channel getChannel() {
return this.channel;
}
@Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.Data
public long getChannelId() {
return this.channelId;
}
@Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.Data
public Map<Long, String> getChannelNames() {
return this.channelNames;
}
@Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.Data
public Guild getGuild() {
return this.guild;
}
@Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.Data
public long getGuildId() {
return this.guildId;
}
@Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.Data
public List<ChatListEntry> getList() {
return this.list;
}
@Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.Data
public Set<Long> getMyRoleIds() {
return this.myRoleIds;
}
@Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.Data
public long getNewMessagesMarkerMessageId() {
return this.newMessagesMarkerMessageId;
}
@Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.Data
public long getOldestMessageId() {
return this.oldestMessageId;
}
@Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.Data
public long getUserId() {
return this.userId;
}
public int hashCode() {
Channel channel = this.channel;
int i = 0;
int hashCode = (channel != null ? channel.hashCode() : 0) * 31;
Guild guild = getGuild();
int a = (b.a(getUserId()) + ((hashCode + (guild != null ? guild.hashCode() : 0)) * 31)) * 31;
Map<Long, String> channelNames = getChannelNames();
int hashCode2 = (a + (channelNames != null ? channelNames.hashCode() : 0)) * 31;
List<ChatListEntry> list = getList();
int hashCode3 = (hashCode2 + (list != null ? list.hashCode() : 0)) * 31;
Set<Long> myRoleIds = getMyRoleIds();
if (myRoleIds != null) {
i = myRoleIds.hashCode();
}
int a2 = (b.a(getNewMessagesMarkerMessageId()) + ((b.a(getOldestMessageId()) + ((b.a(getGuildId()) + ((b.a(getChannelId()) + ((hashCode3 + i) * 31)) * 31)) * 31)) * 31)) * 31;
boolean isSpoilerClickAllowed = isSpoilerClickAllowed();
if (isSpoilerClickAllowed) {
isSpoilerClickAllowed = true;
}
int i2 = isSpoilerClickAllowed ? 1 : 0;
int i3 = isSpoilerClickAllowed ? 1 : 0;
int i4 = isSpoilerClickAllowed ? 1 : 0;
return a2 + i2;
}
@Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.Data
public boolean isSpoilerClickAllowed() {
return this.isSpoilerClickAllowed;
}
public String toString() {
StringBuilder K = a.K("Model(channel=");
K.append(this.channel);
K.append(", guild=");
K.append(getGuild());
K.append(", userId=");
K.append(getUserId());
K.append(", channelNames=");
K.append(getChannelNames());
K.append(", list=");
K.append(getList());
K.append(", myRoleIds=");
K.append(getMyRoleIds());
K.append(", channelId=");
K.append(getChannelId());
K.append(", guildId=");
K.append(getGuildId());
K.append(", oldestMessageId=");
K.append(getOldestMessageId());
K.append(", newMessagesMarkerMessageId=");
K.append(getNewMessagesMarkerMessageId());
K.append(", isSpoilerClickAllowed=");
K.append(isSpoilerClickAllowed());
K.append(")");
return K.toString();
}
}
public WidgetChannelPinnedMessages() {
super(2131558883);
}
public static final /* synthetic */ void access$configureUI(WidgetChannelPinnedMessages widgetChannelPinnedMessages, Model model) {
widgetChannelPinnedMessages.configureUI(model);
}
private final void configureUI(Model model) {
if (model == null) {
requireActivity().finish();
return;
}
setActionBarSubtitle(AnimatableValueParser.A0(model.getChannel(), requireContext(), false, 2));
WidgetChatListAdapter widgetChatListAdapter = this.adapter;
if (widgetChatListAdapter != null) {
widgetChatListAdapter.setData(model);
}
}
private final WidgetChannelPinnedMessagesBinding getBinding() {
return (WidgetChannelPinnedMessagesBinding) this.binding$delegate.getValue((Fragment) this, $$delegatedProperties[0]);
}
@Override // androidx.fragment.app.Fragment
public void onDestroy() {
super.onDestroy();
WidgetChatListAdapter widgetChatListAdapter = this.adapter;
if (widgetChatListAdapter != null) {
widgetChatListAdapter.dispose();
}
}
@Override // com.discord.app.AppFragment, androidx.fragment.app.Fragment
public void onPause() {
super.onPause();
WidgetChatListAdapter widgetChatListAdapter = this.adapter;
if (widgetChatListAdapter != null) {
widgetChatListAdapter.disposeHandlers();
}
}
@Override // com.discord.app.AppFragment
public void onViewBound(View view) {
m.checkNotNullParameter(view, "view");
super.onViewBound(view);
AppFragment.setActionBarDisplayHomeAsUpEnabled$default(this, false, 1, null);
setActionBarTitle(2131892052);
MGRecyclerAdapter.Companion companion = MGRecyclerAdapter.Companion;
RecyclerView recyclerView = getBinding().b;
m.checkNotNullExpressionValue(recyclerView, "binding.channelPinnedMessagesRecycler");
FragmentManager parentFragmentManager = getParentFragmentManager();
m.checkNotNullExpressionValue(parentFragmentManager, "parentFragmentManager");
this.adapter = (WidgetChatListAdapter) companion.configure(new WidgetChatListAdapter(recyclerView, this, parentFragmentManager, new WidgetChannelPinnedMessages$onViewBound$1(this), null, null, 48, null));
}
@Override // com.discord.app.AppFragment
public void onViewBoundOrOnResume() {
super.onViewBoundOrOnResume();
Observable<Model> r = Model.Companion.get(requireContext(), getMostRecentIntent().getLongExtra("INTENT_EXTRA_CHANNEL_ID", 0)).r();
m.checkNotNullExpressionValue(r, "Model\n .get(requi… .distinctUntilChanged()");
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(ObservableExtensionsKt.computationLatest(r), this, null, 2, null), WidgetChannelPinnedMessages.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetChannelPinnedMessages$onViewBoundOrOnResume$1(this), 62, (Object) null);
WidgetChatListAdapter widgetChatListAdapter = this.adapter;
if (widgetChatListAdapter != null) {
widgetChatListAdapter.setHandlers();
}
}
}