package com.discord.widgets.user; import a0.a.a.b; import android.content.Context; import android.net.Uri; import android.view.View; import androidx.annotation.MainThread; import androidx.core.os.BundleKt; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentViewModelLazyKt; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import c.a.d.h0; import c.a.d.j0; import c.d.b.a.a; import com.discord.api.activity.Activity; import com.discord.api.application.Application; import com.discord.api.channel.Channel; import com.discord.api.message.activity.MessageActivityType; import com.discord.api.message.reaction.MessageReaction; import com.discord.api.sticker.BaseSticker; import com.discord.api.sticker.Sticker; import com.discord.app.AppBottomSheet; import com.discord.app.AppFragment; import com.discord.databinding.WidgetUserMentionsBinding; import com.discord.databinding.WidgetUserMentionsFilterBinding; import com.discord.models.guild.Guild; import com.discord.models.message.Message; import com.discord.restapi.RestAPIParams; import com.discord.stores.SelectedChannelAnalyticsLocation; import com.discord.stores.StoreChat; import com.discord.stores.StoreNavigation; import com.discord.stores.StoreStream; import com.discord.stores.StoreTabsNavigation; import com.discord.utilities.channel.ChannelSelector; import com.discord.utilities.fragment.FragmentExtensionsKt; import com.discord.utilities.mg_recycler.MGRecyclerAdapter; import com.discord.utilities.rest.RestAPI; import com.discord.utilities.rx.LeadingEdgeThrottle; import com.discord.utilities.rx.ObservableExtensionsKt; import com.discord.utilities.viewbinding.FragmentViewBindingDelegate; import com.discord.utilities.viewbinding.FragmentViewBindingDelegateKt; import com.discord.utilities.views.ViewCoroutineScopeKt; import com.discord.views.CheckedSetting; import com.discord.widgets.chat.list.ThreadSpineItemDecoration; import com.discord.widgets.chat.list.adapter.WidgetChatListAdapter; import com.discord.widgets.chat.list.adapter.WidgetChatListAdapterItemCallMessage; import com.discord.widgets.chat.list.entries.ChatListEntry; import com.discord.widgets.tabs.NavigationTab; import com.discord.widgets.tabs.OnTabSelectedListener; import com.discord.widgets.tabs.WidgetTabsHost; import com.discord.widgets.user.search.WidgetGlobalSearchDismissModel; import d0.g0.t; import d0.o; import d0.t.n; import d0.t.u; import d0.z.d.a0; import d0.z.d.m; import j0.l.a.r; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.TimeUnit; import kotlin.Lazy; import kotlin.Unit; import kotlin.jvm.functions.Function0; import kotlin.jvm.functions.Function1; import kotlin.jvm.internal.DefaultConstructorMarker; import kotlin.reflect.KProperty; import kotlinx.coroutines.CoroutineScope; import kotlinx.coroutines.Job; import rx.Observable; import rx.Subscription; import rx.subjects.BehaviorSubject; /* compiled from: WidgetUserMentions.kt */ public final class WidgetUserMentions extends AppFragment implements OnTabSelectedListener { public static final /* synthetic */ KProperty[] $$delegatedProperties = {a.V(WidgetUserMentions.class, "binding", "getBinding()Lcom/discord/databinding/WidgetUserMentionsBinding;", 0)}; public static final Companion Companion = new Companion(null); private static final String EXTRA_IS_EMBEDDED = "EXTRA_HIDE_TITLE"; private final FragmentViewBindingDelegate binding$delegate = FragmentViewBindingDelegateKt.viewBinding$default(this, WidgetUserMentions$binding$2.INSTANCE, null, 2, null); private final Lazy dismissViewModel$delegate = FragmentViewModelLazyKt.createViewModelLazy(this, a0.getOrCreateKotlinClass(WidgetGlobalSearchDismissModel.class), new WidgetUserMentions$$special$$inlined$activityViewModels$1(this), new WidgetUserMentions$$special$$inlined$activityViewModels$2(this)); private final Lazy isEmbedded$delegate = FragmentExtensionsKt.booleanExtra$default(this, "EXTRA_HIDE_TITLE", false, 2, null); private WidgetChatListAdapter mentionsAdapter; private final Model.MessageLoader mentionsLoader = new Model.MessageLoader(1000); private final StoreTabsNavigation storeTabsNavigation = StoreStream.Companion.getTabsNavigation(); private final Lazy viewModel$delegate; /* compiled from: WidgetUserMentions.kt */ public static final class Companion { private Companion() { } public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) { this(); } public static /* synthetic */ WidgetUserMentions create$default(Companion companion, boolean z2, int i, Object obj) { if ((i & 1) != 0) { z2 = false; } return companion.create(z2); } public final WidgetUserMentions create(boolean z2) { WidgetUserMentions widgetUserMentions = new WidgetUserMentions(); widgetUserMentions.setArguments(BundleKt.bundleOf(o.to("EXTRA_HIDE_TITLE", Boolean.valueOf(z2)))); return widgetUserMentions; } } /* compiled from: WidgetUserMentions.kt */ public static final class Model implements WidgetChatListAdapter.Data { public static final Companion Companion = new Companion(null); private final boolean animateEmojis; private final long channelId; private final Map channelNames; private final Guild guild; private final long guildId; private final String guildName; private final boolean isSpoilerClickAllowed; private final List list; private final Set myRoleIds; private final long newMessagesMarkerMessageId; private final long oldestMessageId; private final NavigationTab selectedTab; private final long userId; /* compiled from: WidgetUserMentions.kt */ public static final class Companion { private Companion() { } public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) { this(); } /* JADX DEBUG: Multi-variable search result rejected for r5v3, resolved type: rx.Observable$a */ /* JADX WARN: Multi-variable type inference failed */ public final Observable get(MessageLoader messageLoader, NavigationTab navigationTab) { m.checkNotNullParameter(messageLoader, "messageLoader"); m.checkNotNullParameter(navigationTab, "selectedTab"); Observable Y = messageLoader.getMentionsLoadingStateSubject().Y(new WidgetUserMentions$Model$Companion$get$1(navigationTab)); Observable r = Observable.h0(new r(Y.i, new LeadingEdgeThrottle(300, TimeUnit.MILLISECONDS, j0.p.a.a()))).r(); m.checkNotNullExpressionValue(r, "messageLoader\n … .distinctUntilChanged()"); return r; } } /* compiled from: WidgetUserMentions.kt */ public static final class MessageLoader { private Filters filters = new Filters(0, false, false, false, 15, null); private StoreChat.InteractionState interactionState; private boolean isFocused; private Long loadBeforeMessageId; private Subscription loadSubscription; private final int mentionLimit = 25; private final ArrayList mentions = new ArrayList<>(); private LoadingState mentionsLoadingState = new LoadingState(false, false, null, 7, null); private final BehaviorSubject mentionsLoadingStateSubject; private Function0 retryAction; private final long retryDelayMs; private Subscription retrySubscription; /* compiled from: WidgetUserMentions.kt */ public static final class Filters { private final boolean allGuilds; private final long guildId; private final boolean includeEveryone; private final boolean includeRoles; public Filters() { this(0, false, false, false, 15, null); } public Filters(long j, boolean z2, boolean z3, boolean z4) { this.guildId = j; this.allGuilds = z2; this.includeEveryone = z3; this.includeRoles = z4; } /* JADX INFO: this call moved to the top of the method (can break code semantics) */ public /* synthetic */ Filters(long j, boolean z2, boolean z3, boolean z4, int i, DefaultConstructorMarker defaultConstructorMarker) { this((i & 1) != 0 ? 0 : j, (i & 2) != 0 ? true : z2, (i & 4) != 0 ? true : z3, (i & 8) != 0 ? true : z4); } public static /* synthetic */ Filters copy$default(Filters filters, long j, boolean z2, boolean z3, boolean z4, int i, Object obj) { if ((i & 1) != 0) { j = filters.guildId; } if ((i & 2) != 0) { z2 = filters.allGuilds; } if ((i & 4) != 0) { z3 = filters.includeEveryone; } if ((i & 8) != 0) { z4 = filters.includeRoles; } return filters.copy(j, z2, z3, z4); } public final long component1() { return this.guildId; } public final boolean component2() { return this.allGuilds; } public final boolean component3() { return this.includeEveryone; } public final boolean component4() { return this.includeRoles; } public final Filters copy(long j, boolean z2, boolean z3, boolean z4) { return new Filters(j, z2, z3, z4); } public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof Filters)) { return false; } Filters filters = (Filters) obj; return this.guildId == filters.guildId && this.allGuilds == filters.allGuilds && this.includeEveryone == filters.includeEveryone && this.includeRoles == filters.includeRoles; } public final boolean getAllGuilds() { return this.allGuilds; } public final long getGuildId() { return this.guildId; } public final boolean getIncludeEveryone() { return this.includeEveryone; } public final boolean getIncludeRoles() { return this.includeRoles; } public int hashCode() { int a = b.a(this.guildId) * 31; boolean z2 = this.allGuilds; int i = 1; if (z2) { z2 = true; } int i2 = z2 ? 1 : 0; int i3 = z2 ? 1 : 0; int i4 = z2 ? 1 : 0; int i5 = (a + i2) * 31; boolean z3 = this.includeEveryone; if (z3) { z3 = true; } int i6 = z3 ? 1 : 0; int i7 = z3 ? 1 : 0; int i8 = z3 ? 1 : 0; int i9 = (i5 + i6) * 31; boolean z4 = this.includeRoles; if (!z4) { i = z4 ? 1 : 0; } return i9 + i; } public String toString() { StringBuilder K = a.K("Filters(guildId="); K.append(this.guildId); K.append(", allGuilds="); K.append(this.allGuilds); K.append(", includeEveryone="); K.append(this.includeEveryone); K.append(", includeRoles="); return a.F(K, this.includeRoles, ")"); } } /* compiled from: WidgetUserMentions.kt */ public static final class LoadingState { private final boolean isAllLoaded; private final boolean isLoading; private final List mentions; public LoadingState() { this(false, false, null, 7, null); } public LoadingState(boolean z2, boolean z3, List list) { m.checkNotNullParameter(list, "mentions"); this.isLoading = z2; this.isAllLoaded = z3; this.mentions = list; } /* JADX INFO: this call moved to the top of the method (can break code semantics) */ public /* synthetic */ LoadingState(boolean z2, boolean z3, List list, int i, DefaultConstructorMarker defaultConstructorMarker) { this((i & 1) != 0 ? false : z2, (i & 2) != 0 ? false : z3, (i & 4) != 0 ? n.emptyList() : list); } /* JADX DEBUG: Multi-variable search result rejected for r0v0, resolved type: com.discord.widgets.user.WidgetUserMentions$Model$MessageLoader$LoadingState */ /* JADX WARN: Multi-variable type inference failed */ public static /* synthetic */ LoadingState copy$default(LoadingState loadingState, boolean z2, boolean z3, List list, int i, Object obj) { if ((i & 1) != 0) { z2 = loadingState.isLoading; } if ((i & 2) != 0) { z3 = loadingState.isAllLoaded; } if ((i & 4) != 0) { list = loadingState.mentions; } return loadingState.copy(z2, z3, list); } public final boolean component1() { return this.isLoading; } public final boolean component2() { return this.isAllLoaded; } public final List component3() { return this.mentions; } public final LoadingState copy(boolean z2, boolean z3, List list) { m.checkNotNullParameter(list, "mentions"); return new LoadingState(z2, z3, list); } public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof LoadingState)) { return false; } LoadingState loadingState = (LoadingState) obj; return this.isLoading == loadingState.isLoading && this.isAllLoaded == loadingState.isAllLoaded && m.areEqual(this.mentions, loadingState.mentions); } public final List getMentions() { return this.mentions; } public int hashCode() { boolean z2 = this.isLoading; int i = 1; if (z2) { z2 = true; } int i2 = z2 ? 1 : 0; int i3 = z2 ? 1 : 0; int i4 = z2 ? 1 : 0; int i5 = i2 * 31; boolean z3 = this.isAllLoaded; if (!z3) { i = z3 ? 1 : 0; } int i6 = (i5 + i) * 31; List list = this.mentions; return i6 + (list != null ? list.hashCode() : 0); } public final boolean isAllLoaded() { return this.isAllLoaded; } public final boolean isLoading() { return this.isLoading; } public String toString() { StringBuilder K = a.K("LoadingState(isLoading="); K.append(this.isLoading); K.append(", isAllLoaded="); K.append(this.isAllLoaded); K.append(", mentions="); return a.D(K, this.mentions, ")"); } } public MessageLoader(long j) { this.retryDelayMs = j; BehaviorSubject l0 = BehaviorSubject.l0(this.mentionsLoadingState); m.checkNotNullExpressionValue(l0, "BehaviorSubject.create(mentionsLoadingState)"); this.mentionsLoadingStateSubject = l0; } public static final /* synthetic */ Subscription access$getLoadSubscription$p(MessageLoader messageLoader) { return messageLoader.loadSubscription; } public static final /* synthetic */ Subscription access$getRetrySubscription$p(MessageLoader messageLoader) { return messageLoader.retrySubscription; } public static final /* synthetic */ void access$handleLoadError(MessageLoader messageLoader) { messageLoader.handleLoadError(); } public static final /* synthetic */ void access$handleLoaded(MessageLoader messageLoader, List list) { messageLoader.handleLoaded(list); } public static final /* synthetic */ void access$setLoadSubscription$p(MessageLoader messageLoader, Subscription subscription) { messageLoader.loadSubscription = subscription; } public static final /* synthetic */ void access$setRetrySubscription$p(MessageLoader messageLoader, Subscription subscription) { messageLoader.retrySubscription = subscription; } @MainThread private final void handleLoadError() { retry(new WidgetUserMentions$Model$MessageLoader$handleLoadError$1(this)); } @MainThread private final void handleLoaded(List list) { boolean z2 = list.isEmpty() || list.size() < this.mentionLimit; Message message = (Message) u.lastOrNull((List) list); this.loadBeforeMessageId = message != null ? Long.valueOf(message.getId()) : null; this.mentions.addAll(list); setMentionsLoadingState(LoadingState.copy$default(this.mentionsLoadingState, false, false, new ArrayList(this.mentions), 3, null)); retry(new WidgetUserMentions$Model$MessageLoader$handleLoaded$1(this, z2)); } private final void retry(Function0 function0) { Subscription subscription = this.retrySubscription; if (subscription != null) { subscription.unsubscribe(); } this.retryAction = function0; Observable d02 = Observable.d0(this.retryDelayMs, TimeUnit.MILLISECONDS); m.checkNotNullExpressionValue(d02, "Observable.timer(retryDe…s, TimeUnit.MILLISECONDS)"); ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui(d02), MessageLoader.class, (Context) null, new WidgetUserMentions$Model$MessageLoader$retry$1(this), (Function1) null, (Function0) null, (Function0) null, new WidgetUserMentions$Model$MessageLoader$retry$2(function0), 58, (Object) null); } private final void setMentionsLoadingState(LoadingState loadingState) { if (!m.areEqual(this.mentionsLoadingState, loadingState)) { this.mentionsLoadingState = loadingState; this.mentionsLoadingStateSubject.onNext(loadingState); } } /* JADX DEBUG: Multi-variable search result rejected for r0v0, resolved type: com.discord.widgets.user.WidgetUserMentions$Model$MessageLoader */ /* JADX WARN: Multi-variable type inference failed */ public static /* synthetic */ void tryLoad$default(MessageLoader messageLoader, Function1 function1, int i, Object obj) { if ((i & 1) != 0) { function1 = WidgetUserMentions$Model$MessageLoader$tryLoad$1.INSTANCE; } messageLoader.tryLoad(function1); } public final Filters getFilters() { return this.filters; } public final BehaviorSubject getMentionsLoadingStateSubject() { return this.mentionsLoadingStateSubject; } @MainThread public final void setFilters(Filters filters) { m.checkNotNullParameter(filters, "value"); if (!m.areEqual(this.filters, filters)) { this.filters = filters; Subscription subscription = this.loadSubscription; if (subscription != null) { subscription.unsubscribe(); } this.loadBeforeMessageId = null; this.mentions.clear(); tryLoad(WidgetUserMentions$Model$MessageLoader$filters$1.INSTANCE); } } @MainThread public final void setInteractionState(StoreChat.InteractionState interactionState) { m.checkNotNullParameter(interactionState, "interactionState"); this.interactionState = interactionState; tryLoad$default(this, null, 1, null); } @MainThread public final void setIsFocused(boolean z2) { this.isFocused = z2; tryLoad$default(this, null, 1, null); } @MainThread public final void tryLoad(Function1 function1) { StoreChat.InteractionState interactionState; m.checkNotNullParameter(function1, "loadingStateUpdater"); setMentionsLoadingState(function1.invoke(this.mentionsLoadingState)); if (!this.mentionsLoadingState.isLoading() && !this.mentionsLoadingState.isAllLoaded() && (interactionState = this.interactionState) != null && interactionState.isAtTopIgnoringTouch() && this.isFocused) { setMentionsLoadingState(LoadingState.copy$default(this.mentionsLoadingState, true, false, null, 6, null)); Observable F = ObservableExtensionsKt.ui(ObservableExtensionsKt.restSubscribeOn$default(RestAPI.Companion.getApi().getMentions(this.mentionLimit, this.filters.getIncludeRoles(), this.filters.getIncludeEveryone(), Long.valueOf(this.filters.getAllGuilds() ? 0 : this.filters.getGuildId()), this.loadBeforeMessageId), false, 1, null)).F(WidgetUserMentions$Model$MessageLoader$tryLoad$2.INSTANCE); m.checkNotNullExpressionValue(F, "RestAPI\n .api…messages.map(::Message) }"); ObservableExtensionsKt.appSubscribe$default(F, MessageLoader.class, (Context) null, new WidgetUserMentions$Model$MessageLoader$tryLoad$5(this), new WidgetUserMentions$Model$MessageLoader$tryLoad$3(this), (Function0) null, (Function0) null, new WidgetUserMentions$Model$MessageLoader$tryLoad$4(this), 50, (Object) null); } } } public Model(long j, long j2, Guild guild, long j3, Map map, long j4, List list, Set set, long j5, boolean z2, boolean z3, String str, NavigationTab navigationTab) { m.checkNotNullParameter(map, "channelNames"); m.checkNotNullParameter(list, "list"); m.checkNotNullParameter(set, "myRoleIds"); m.checkNotNullParameter(navigationTab, "selectedTab"); this.userId = j; this.channelId = j2; this.guild = guild; this.guildId = j3; this.channelNames = map; this.oldestMessageId = j4; this.list = list; this.myRoleIds = set; this.newMessagesMarkerMessageId = j5; this.isSpoilerClickAllowed = z2; this.animateEmojis = z3; this.guildName = str; this.selectedTab = navigationTab; } /* JADX INFO: this call moved to the top of the method (can break code semantics) */ public /* synthetic */ Model(long j, long j2, Guild guild, long j3, Map map, long j4, List list, Set set, long j5, boolean z2, boolean z3, String str, NavigationTab navigationTab, int i, DefaultConstructorMarker defaultConstructorMarker) { this(j, j2, guild, j3, map, j4, list, set, j5, (i & 512) != 0 ? false : z2, z3, str, navigationTab); } public static /* synthetic */ Model copy$default(Model model, long j, long j2, Guild guild, long j3, Map map, long j4, List list, Set set, long j5, boolean z2, boolean z3, String str, NavigationTab navigationTab, int i, Object obj) { return model.copy((i & 1) != 0 ? model.getUserId() : j, (i & 2) != 0 ? model.getChannelId() : j2, (i & 4) != 0 ? model.getGuild() : guild, (i & 8) != 0 ? model.getGuildId() : j3, (i & 16) != 0 ? model.getChannelNames() : map, (i & 32) != 0 ? model.getOldestMessageId() : j4, (i & 64) != 0 ? model.getList() : list, (i & 128) != 0 ? model.getMyRoleIds() : set, (i & 256) != 0 ? model.getNewMessagesMarkerMessageId() : j5, (i & 512) != 0 ? model.isSpoilerClickAllowed() : z2, (i & 1024) != 0 ? model.animateEmojis : z3, (i & 2048) != 0 ? model.guildName : str, (i & 4096) != 0 ? model.selectedTab : navigationTab); } public final long component1() { return getUserId(); } public final boolean component10() { return isSpoilerClickAllowed(); } public final boolean component11() { return this.animateEmojis; } public final String component12() { return this.guildName; } public final NavigationTab component13() { return this.selectedTab; } public final long component2() { return getChannelId(); } public final Guild component3() { return getGuild(); } public final long component4() { return getGuildId(); } public final Map component5() { return getChannelNames(); } public final long component6() { return getOldestMessageId(); } public final List component7() { return getList(); } public final Set component8() { return getMyRoleIds(); } public final long component9() { return getNewMessagesMarkerMessageId(); } public final Model copy(long j, long j2, Guild guild, long j3, Map map, long j4, List list, Set set, long j5, boolean z2, boolean z3, String str, NavigationTab navigationTab) { m.checkNotNullParameter(map, "channelNames"); m.checkNotNullParameter(list, "list"); m.checkNotNullParameter(set, "myRoleIds"); m.checkNotNullParameter(navigationTab, "selectedTab"); return new Model(j, j2, guild, j3, map, j4, list, set, j5, z2, z3, str, navigationTab); } public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof Model)) { return false; } Model model = (Model) obj; return getUserId() == model.getUserId() && getChannelId() == model.getChannelId() && m.areEqual(getGuild(), model.getGuild()) && getGuildId() == model.getGuildId() && m.areEqual(getChannelNames(), model.getChannelNames()) && getOldestMessageId() == model.getOldestMessageId() && m.areEqual(getList(), model.getList()) && m.areEqual(getMyRoleIds(), model.getMyRoleIds()) && getNewMessagesMarkerMessageId() == model.getNewMessagesMarkerMessageId() && isSpoilerClickAllowed() == model.isSpoilerClickAllowed() && this.animateEmojis == model.animateEmojis && m.areEqual(this.guildName, model.guildName) && m.areEqual(this.selectedTab, model.selectedTab); } public final boolean getAnimateEmojis() { return this.animateEmojis; } @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 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; } public final String getGuildName() { return this.guildName; } @Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.Data public List getList() { return this.list; } @Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.Data public Set 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; } public final NavigationTab getSelectedTab() { return this.selectedTab; } @Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.Data public long getUserId() { return this.userId; } public int hashCode() { int a = (b.a(getChannelId()) + (b.a(getUserId()) * 31)) * 31; Guild guild = getGuild(); int i = 0; int a2 = (b.a(getGuildId()) + ((a + (guild != null ? guild.hashCode() : 0)) * 31)) * 31; Map channelNames = getChannelNames(); int a3 = (b.a(getOldestMessageId()) + ((a2 + (channelNames != null ? channelNames.hashCode() : 0)) * 31)) * 31; List list = getList(); int hashCode = (a3 + (list != null ? list.hashCode() : 0)) * 31; Set myRoleIds = getMyRoleIds(); int a4 = (b.a(getNewMessagesMarkerMessageId()) + ((hashCode + (myRoleIds != null ? myRoleIds.hashCode() : 0)) * 31)) * 31; boolean isSpoilerClickAllowed = isSpoilerClickAllowed(); int i2 = 1; if (isSpoilerClickAllowed) { isSpoilerClickAllowed = true; } int i3 = isSpoilerClickAllowed ? 1 : 0; int i4 = isSpoilerClickAllowed ? 1 : 0; int i5 = isSpoilerClickAllowed ? 1 : 0; int i6 = (a4 + i3) * 31; boolean z2 = this.animateEmojis; if (!z2) { i2 = z2 ? 1 : 0; } int i7 = (i6 + i2) * 31; String str = this.guildName; int hashCode2 = (i7 + (str != null ? str.hashCode() : 0)) * 31; NavigationTab navigationTab = this.selectedTab; if (navigationTab != null) { i = navigationTab.hashCode(); } return hashCode2 + i; } @Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.Data public boolean isSpoilerClickAllowed() { return this.isSpoilerClickAllowed; } public String toString() { StringBuilder K = a.K("Model(userId="); K.append(getUserId()); K.append(", channelId="); K.append(getChannelId()); K.append(", guild="); K.append(getGuild()); K.append(", guildId="); K.append(getGuildId()); K.append(", channelNames="); K.append(getChannelNames()); K.append(", oldestMessageId="); K.append(getOldestMessageId()); K.append(", list="); K.append(getList()); K.append(", myRoleIds="); K.append(getMyRoleIds()); K.append(", newMessagesMarkerMessageId="); K.append(getNewMessagesMarkerMessageId()); K.append(", isSpoilerClickAllowed="); K.append(isSpoilerClickAllowed()); K.append(", animateEmojis="); K.append(this.animateEmojis); K.append(", guildName="); K.append(this.guildName); K.append(", selectedTab="); K.append(this.selectedTab); K.append(")"); return K.toString(); } } /* compiled from: WidgetUserMentions.kt */ public static final class UserMentionsAdapterEventHandler implements WidgetChatListAdapter.EventHandler { private final ChannelSelector channelSelector; private final Function1 interactionStateUpdated; private final boolean isEmbedded; /* JADX DEBUG: Multi-variable search result rejected for r4v0, resolved type: kotlin.jvm.functions.Function1 */ /* JADX WARN: Multi-variable type inference failed */ public UserMentionsAdapterEventHandler(boolean z2, ChannelSelector channelSelector, Function1 function1) { m.checkNotNullParameter(channelSelector, "channelSelector"); m.checkNotNullParameter(function1, "interactionStateUpdated"); this.isEmbedded = z2; this.channelSelector = channelSelector; this.interactionStateUpdated = function1; } private final void jumpToMessage(Message message) { StoreStream.Companion companion = StoreStream.Companion; companion.getMessagesLoader().jumpToMessage(message.getChannelId(), message.getId()); companion.getTabsNavigation().selectHomeTab(StoreNavigation.PanelAction.CLOSE, this.isEmbedded); } @Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.EventHandler public void onBotUiComponentClicked(long j, Long l, long j2, long j3, Long l2, int i, RestAPIParams.ComponentInteractionData componentInteractionData) { m.checkNotNullParameter(componentInteractionData, "componentSendData"); WidgetChatListAdapter.EventHandler.DefaultImpls.onBotUiComponentClicked(this, j, l, j2, j3, l2, i, componentInteractionData); } @Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.EventHandler public void onCallMessageClicked(long j, WidgetChatListAdapterItemCallMessage.CallStatus callStatus) { m.checkNotNullParameter(callStatus, "callStatus"); } @Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.EventHandler public void onCommandClicked(long j, Long l, long j2, long j3, long j4, long j5, String str) { WidgetChatListAdapter.EventHandler.DefaultImpls.onCommandClicked(this, j, l, j2, j3, j4, j5, str); } @Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.EventHandler public void onDismissClicked(Message message) { m.checkNotNullParameter(message, "message"); WidgetChatListAdapter.EventHandler.DefaultImpls.onDismissClicked(this, message); } @Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.EventHandler public void onInteractionStateUpdated(StoreChat.InteractionState interactionState) { m.checkNotNullParameter(interactionState, "interactionState"); this.interactionStateUpdated.invoke(interactionState); } @Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.EventHandler public void onListClicked() { } @Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.EventHandler public void onMessageAuthorAvatarClicked(Message message, long j) { m.checkNotNullParameter(message, "message"); jumpToMessage(message); } @Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.EventHandler public void onMessageAuthorLongClicked(Message message, Long l) { m.checkNotNullParameter(message, "message"); jumpToMessage(message); } @Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.EventHandler public void onMessageAuthorNameClicked(Message message, long j) { m.checkNotNullParameter(message, "message"); jumpToMessage(message); } @Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.EventHandler public void onMessageBlockedGroupClicked(Message message) { m.checkNotNullParameter(message, "message"); jumpToMessage(message); } @Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.EventHandler public void onMessageClicked(Message message, boolean z2) { m.checkNotNullParameter(message, "message"); jumpToMessage(message); } @Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.EventHandler public void onMessageLongClicked(Message message, CharSequence charSequence, boolean z2) { m.checkNotNullParameter(message, "message"); m.checkNotNullParameter(charSequence, "formattedMessage"); jumpToMessage(message); } @Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.EventHandler public void onOldestMessageId(long j, long j2) { } @Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.EventHandler public void onOpenPinsClicked(Message message) { m.checkNotNullParameter(message, "message"); } @Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.EventHandler public void onQuickAddReactionClicked(long j, long j2, long j3, long j4) { } @Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.EventHandler public boolean onQuickDownloadClicked(Uri uri, String str) { m.checkNotNullParameter(uri, "uri"); m.checkNotNullParameter(str, "fileName"); return false; } @Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.EventHandler public void onReactionClicked(long j, long j2, long j3, long j4, MessageReaction messageReaction, boolean z2) { m.checkNotNullParameter(messageReaction, "reaction"); } @Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.EventHandler public void onReactionLongClicked(long j, long j2, long j3, MessageReaction messageReaction) { m.checkNotNullParameter(messageReaction, "reaction"); } @Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.EventHandler public void onSendGreetMessageClicked(long j, int i, Sticker sticker) { m.checkNotNullParameter(sticker, "sticker"); WidgetChatListAdapter.EventHandler.DefaultImpls.onSendGreetMessageClicked(this, j, i, sticker); } @Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.EventHandler public void onStickerClicked(Message message, BaseSticker baseSticker) { m.checkNotNullParameter(message, "message"); m.checkNotNullParameter(baseSticker, "sticker"); StoreStream.Companion.getMessagesLoader().jumpToMessage(message.getChannelId(), message.getId()); } @Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.EventHandler public void onThreadClicked(Channel channel) { m.checkNotNullParameter(channel, "channel"); ChannelSelector.selectChannel$default(this.channelSelector, channel, null, SelectedChannelAnalyticsLocation.EMBED, 2, null); StoreStream.Companion.getTabsNavigation().selectHomeTab(StoreNavigation.PanelAction.CLOSE, this.isEmbedded); } @Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.EventHandler public void onThreadLongClicked(Channel channel) { m.checkNotNullParameter(channel, "channel"); WidgetChatListAdapter.EventHandler.DefaultImpls.onThreadLongClicked(this, channel); } @Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.EventHandler public void onUrlLongClicked(String str) { m.checkNotNullParameter(str, "url"); WidgetChatListAdapter.EventHandler.DefaultImpls.onUrlLongClicked(this, str); } @Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.EventHandler public void onUserActivityAction(long j, long j2, long j3, MessageActivityType messageActivityType, Activity activity, Application application) { m.checkNotNullParameter(messageActivityType, "actionType"); m.checkNotNullParameter(activity, "activity"); m.checkNotNullParameter(application, "application"); } @Override // com.discord.widgets.chat.list.adapter.WidgetChatListAdapter.EventHandler public void onUserMentionClicked(long j, long j2, long j3) { WidgetChatListAdapter.EventHandler.DefaultImpls.onUserMentionClicked(this, j, j2, j3); } } /* compiled from: WidgetUserMentions.kt */ public static final class WidgetUserMentionFilter extends AppBottomSheet { public static final /* synthetic */ KProperty[] $$delegatedProperties = {a.V(WidgetUserMentionFilter.class, "binding", "getBinding()Lcom/discord/databinding/WidgetUserMentionsFilterBinding;", 0)}; public static final Companion Companion = new Companion(null); private final FragmentViewBindingDelegate binding$delegate = FragmentViewBindingDelegateKt.viewBinding$default(this, WidgetUserMentions$WidgetUserMentionFilter$binding$2.INSTANCE, null, 2, null); private Model.MessageLoader.Filters filters; private String guildName; private Function1 onFiltersUpdated; /* compiled from: WidgetUserMentions.kt */ public static final class Companion { private Companion() { } public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) { this(); } public final WidgetUserMentionFilter show(FragmentManager fragmentManager, String str, Model.MessageLoader.Filters filters, Function1 function1) { m.checkNotNullParameter(fragmentManager, "fragmentManager"); m.checkNotNullParameter(filters, "filters"); m.checkNotNullParameter(function1, "onFiltersUpdated"); WidgetUserMentionFilter widgetUserMentionFilter = new WidgetUserMentionFilter(); WidgetUserMentionFilter.access$setOnFiltersUpdated$p(widgetUserMentionFilter, function1); WidgetUserMentionFilter.access$setFilters$p(widgetUserMentionFilter, filters); WidgetUserMentionFilter.access$setGuildName$p(widgetUserMentionFilter, str); widgetUserMentionFilter.show(fragmentManager, WidgetUserMentionFilter.class.getName()); return widgetUserMentionFilter; } } public WidgetUserMentionFilter() { super(false, 1, null); } public static final /* synthetic */ Job access$delayedDismiss(WidgetUserMentionFilter widgetUserMentionFilter) { return widgetUserMentionFilter.delayedDismiss(); } public static final /* synthetic */ WidgetUserMentionsFilterBinding access$getBinding$p(WidgetUserMentionFilter widgetUserMentionFilter) { return widgetUserMentionFilter.getBinding(); } public static final /* synthetic */ Model.MessageLoader.Filters access$getFilters$p(WidgetUserMentionFilter widgetUserMentionFilter) { Model.MessageLoader.Filters filters = widgetUserMentionFilter.filters; if (filters == null) { m.throwUninitializedPropertyAccessException("filters"); } return filters; } public static final /* synthetic */ String access$getGuildName$p(WidgetUserMentionFilter widgetUserMentionFilter) { return widgetUserMentionFilter.guildName; } public static final /* synthetic */ Function1 access$getOnFiltersUpdated$p(WidgetUserMentionFilter widgetUserMentionFilter) { Function1 function1 = widgetUserMentionFilter.onFiltersUpdated; if (function1 == null) { m.throwUninitializedPropertyAccessException("onFiltersUpdated"); } return function1; } public static final /* synthetic */ void access$setFilters$p(WidgetUserMentionFilter widgetUserMentionFilter, Model.MessageLoader.Filters filters) { widgetUserMentionFilter.filters = filters; } public static final /* synthetic */ void access$setGuildName$p(WidgetUserMentionFilter widgetUserMentionFilter, String str) { widgetUserMentionFilter.guildName = str; } public static final /* synthetic */ void access$setOnFiltersUpdated$p(WidgetUserMentionFilter widgetUserMentionFilter, Function1 function1) { widgetUserMentionFilter.onFiltersUpdated = function1; } public static final /* synthetic */ void access$updateFilters(WidgetUserMentionFilter widgetUserMentionFilter, Model.MessageLoader.Filters filters) { widgetUserMentionFilter.updateFilters(filters); } private final Job delayedDismiss() { CoroutineScope coroutineScope; View view = getView(); if (view == null || (coroutineScope = ViewCoroutineScopeKt.getCoroutineScope(view)) == null) { return null; } return c.q.a.k.a.G(coroutineScope, null, null, new WidgetUserMentions$WidgetUserMentionFilter$delayedDismiss$1(this, null), 3, null); } private final WidgetUserMentionsFilterBinding getBinding() { return (WidgetUserMentionsFilterBinding) this.binding$delegate.getValue((Fragment) this, $$delegatedProperties[0]); } private final void updateFilters(Model.MessageLoader.Filters filters) { this.filters = filters; Function1 function1 = this.onFiltersUpdated; if (function1 == null) { m.throwUninitializedPropertyAccessException("onFiltersUpdated"); } function1.invoke(filters); } @Override // com.discord.app.AppBottomSheet public int getContentViewResId() { return 2131559294; } @Override // com.discord.app.AppBottomSheet, androidx.fragment.app.Fragment public void onPause() { dismissAllowingStateLoss(); super.onPause(); } @Override // com.discord.app.AppBottomSheet, androidx.fragment.app.Fragment public void onResume() { super.onResume(); CheckedSetting checkedSetting = getBinding().d; m.checkNotNullExpressionValue(checkedSetting, "binding.userMentionsFilterThisServer"); Model.MessageLoader.Filters filters = this.filters; if (filters == null) { m.throwUninitializedPropertyAccessException("filters"); } checkedSetting.setChecked(!filters.getAllGuilds()); String str = this.guildName; if (!(str == null || t.isBlank(str))) { CheckedSetting checkedSetting2 = getBinding().d; m.checkNotNullExpressionValue(checkedSetting2, "binding.userMentionsFilterThisServer"); checkedSetting2.setVisibility(0); CheckedSetting checkedSetting3 = getBinding().d; Context context = getContext(); CharSequence charSequence = null; if (context != null) { charSequence = c.a.k.b.g(context, 2131894067, new Object[]{this.guildName}, null, 4); } checkedSetting3.setText(charSequence); getBinding().d.setOnCheckedListener(new WidgetUserMentions$WidgetUserMentionFilter$onResume$1(this)); } else { CheckedSetting checkedSetting4 = getBinding().d; m.checkNotNullExpressionValue(checkedSetting4, "binding.userMentionsFilterThisServer"); checkedSetting4.setVisibility(8); } CheckedSetting checkedSetting5 = getBinding().b; m.checkNotNullExpressionValue(checkedSetting5, "binding.userMentionsFilterIncludeEveryone"); Model.MessageLoader.Filters filters2 = this.filters; if (filters2 == null) { m.throwUninitializedPropertyAccessException("filters"); } checkedSetting5.setChecked(filters2.getIncludeEveryone()); getBinding().b.setOnCheckedListener(new WidgetUserMentions$WidgetUserMentionFilter$onResume$2(this)); CheckedSetting checkedSetting6 = getBinding().f2007c; m.checkNotNullExpressionValue(checkedSetting6, "binding.userMentionsFilterIncludeRoles"); Model.MessageLoader.Filters filters3 = this.filters; if (filters3 == null) { m.throwUninitializedPropertyAccessException("filters"); } checkedSetting6.setChecked(filters3.getIncludeRoles()); getBinding().f2007c.setOnCheckedListener(new WidgetUserMentions$WidgetUserMentionFilter$onResume$3(this)); } } public WidgetUserMentions() { super(2131559293); WidgetUserMentions$viewModel$2 widgetUserMentions$viewModel$2 = WidgetUserMentions$viewModel$2.INSTANCE; h0 h0Var = new h0(this); this.viewModel$delegate = FragmentViewModelLazyKt.createViewModelLazy(this, a0.getOrCreateKotlinClass(WidgetUserMentionsViewModel.class), new WidgetUserMentions$appViewModels$$inlined$viewModels$1(h0Var), new j0(widgetUserMentions$viewModel$2)); } public static final /* synthetic */ void access$configureUI(WidgetUserMentions widgetUserMentions, Model model) { widgetUserMentions.configureUI(model); } public static final /* synthetic */ WidgetGlobalSearchDismissModel access$getDismissViewModel$p(WidgetUserMentions widgetUserMentions) { return widgetUserMentions.getDismissViewModel(); } public static final /* synthetic */ Model.MessageLoader access$getMentionsLoader$p(WidgetUserMentions widgetUserMentions) { return widgetUserMentions.mentionsLoader; } private final void addThreadSpineItemDecoration(WidgetChatListAdapter widgetChatListAdapter) { getBinding().f2006c.addItemDecoration(new ThreadSpineItemDecoration(requireContext(), widgetChatListAdapter)); } private final void configureToolbar(String str) { AppFragment.bindToolbar$default(this, null, 1, null); String string = this.mentionsLoader.getFilters().getAllGuilds() ? getString(2131886340) : str; if (isEmbedded()) { setActionBarTitle(string); } else { setActionBarSubtitle(string); } AppFragment.setActionBarOptionsMenu$default(this, 2131623967, new WidgetUserMentions$configureToolbar$1(this, str), null, 4, null); } private final void configureUI(Model model) { boolean z2 = true; boolean allGuilds = model.getGuildId() > 0 ? this.mentionsLoader.getFilters().getAllGuilds() : true; WidgetChatListAdapter widgetChatListAdapter = this.mentionsAdapter; if (widgetChatListAdapter != null) { widgetChatListAdapter.setData(model); } Model.MessageLoader messageLoader = this.mentionsLoader; messageLoader.setFilters(Model.MessageLoader.Filters.copy$default(messageLoader.getFilters(), model.getGuildId(), allGuilds, false, false, 12, null)); Model.MessageLoader messageLoader2 = this.mentionsLoader; if (model.getSelectedTab() != NavigationTab.MENTIONS) { z2 = false; } messageLoader2.setIsFocused(z2); if (isEmbedded() || isOnMentionsTab()) { configureToolbar(model.getGuildName()); } getViewModel().setModel$app_productionBetaRelease(model); } private final WidgetChatListAdapter createAdapter(Function1 function1) { RecyclerView recyclerView = getBinding().f2006c; m.checkNotNullExpressionValue(recyclerView, "binding.userMentionsList"); FragmentManager parentFragmentManager = getParentFragmentManager(); m.checkNotNullExpressionValue(parentFragmentManager, "parentFragmentManager"); WidgetChatListAdapter widgetChatListAdapter = new WidgetChatListAdapter(recyclerView, this, parentFragmentManager, new UserMentionsAdapterEventHandler(isEmbedded(), ChannelSelector.Companion.getInstance(), function1), null, null, 48, null); addThreadSpineItemDecoration(widgetChatListAdapter); return widgetChatListAdapter; } private final WidgetUserMentionsBinding getBinding() { return (WidgetUserMentionsBinding) this.binding$delegate.getValue((Fragment) this, $$delegatedProperties[0]); } private final WidgetGlobalSearchDismissModel getDismissViewModel() { return (WidgetGlobalSearchDismissModel) this.dismissViewModel$delegate.getValue(); } private final WidgetUserMentionsViewModel getViewModel() { return (WidgetUserMentionsViewModel) this.viewModel$delegate.getValue(); } private final boolean isEmbedded() { return ((Boolean) this.isEmbedded$delegate.getValue()).booleanValue(); } private final boolean isOnMentionsTab() { return this.storeTabsNavigation.getSelectedTab() == NavigationTab.MENTIONS; } private final Observable observeModel() { if (isEmbedded()) { return Model.Companion.get(this.mentionsLoader, NavigationTab.MENTIONS); } Observable Y = StoreStream.Companion.getTabsNavigation().observeSelectedTab().Y(new WidgetUserMentions$observeModel$1(this)); m.checkNotNullExpressionValue(Y, "StoreStream.getTabsNavig… }\n }"); return Y; } @Override // androidx.fragment.app.Fragment public void onDestroy() { super.onDestroy(); WidgetChatListAdapter widgetChatListAdapter = this.mentionsAdapter; if (widgetChatListAdapter != null) { widgetChatListAdapter.dispose(); } } @Override // com.discord.app.AppFragment, androidx.fragment.app.Fragment public void onPause() { super.onPause(); WidgetChatListAdapter widgetChatListAdapter = this.mentionsAdapter; if (widgetChatListAdapter != null) { widgetChatListAdapter.disposeHandlers(); } } @Override // com.discord.widgets.tabs.OnTabSelectedListener public void onTabSelected() { Model model$app_productionBetaRelease = getViewModel().getModel$app_productionBetaRelease(); if (model$app_productionBetaRelease != null) { configureToolbar(model$app_productionBetaRelease.getGuildName()); } setActionBarTitleAccessibilityViewFocused(); } @Override // com.discord.app.AppFragment public void onViewBound(View view) { LinearLayoutManager layoutManager; m.checkNotNullParameter(view, "view"); super.onViewBound(view); WidgetTabsHost widgetTabsHost = null; if (isEmbedded()) { onTabSelected(); AppFragment.setActionBarDisplayHomeAsUpEnabled$default(this, false, 1, null); getBinding().b.setNavigationOnClickListener(new WidgetUserMentions$onViewBound$1(this)); } else { setActionBarTitle(2131892701); } WidgetChatListAdapter widgetChatListAdapter = (WidgetChatListAdapter) MGRecyclerAdapter.Companion.configure(createAdapter(new WidgetUserMentions$onViewBound$2(this.mentionsLoader))); this.mentionsAdapter = widgetChatListAdapter; if (!(widgetChatListAdapter == null || (layoutManager = widgetChatListAdapter.getLayoutManager()) == null)) { layoutManager.setSmoothScrollbarEnabled(true); } WidgetChatListAdapter widgetChatListAdapter2 = this.mentionsAdapter; if (widgetChatListAdapter2 != null) { widgetChatListAdapter2.setMentionMeMessageLevelHighlighting(false); } Fragment parentFragment = getParentFragment(); if (parentFragment instanceof WidgetTabsHost) { widgetTabsHost = parentFragment; } WidgetTabsHost widgetTabsHost2 = widgetTabsHost; if (widgetTabsHost2 != null) { widgetTabsHost2.registerTabSelectionListener(NavigationTab.MENTIONS, this); } } @Override // com.discord.app.AppFragment public void onViewBoundOrOnResume() { super.onViewBoundOrOnResume(); ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(ObservableExtensionsKt.computationLatest(observeModel()), this, null, 2, null), WidgetUserMentions.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetUserMentions$onViewBoundOrOnResume$1(this), 62, (Object) null); WidgetChatListAdapter widgetChatListAdapter = this.mentionsAdapter; if (widgetChatListAdapter != null) { widgetChatListAdapter.setHandlers(); } Model.MessageLoader.tryLoad$default(this.mentionsLoader, null, 1, null); } }