1266 lines
61 KiB
Java
1266 lines
61 KiB
Java
package com.discord.widgets.chat.input.emoji;
|
|
|
|
import a0.a.a.b;
|
|
import android.content.Context;
|
|
import androidx.annotation.MainThread;
|
|
import androidx.annotation.StringRes;
|
|
import c.d.b.a.a;
|
|
import com.discord.app.AppViewModel;
|
|
import com.discord.models.domain.emoji.Emoji;
|
|
import com.discord.models.domain.emoji.EmojiCategory;
|
|
import com.discord.models.domain.emoji.EmojiSet;
|
|
import com.discord.models.domain.emoji.ModelEmojiCustom;
|
|
import com.discord.models.guild.Guild;
|
|
import com.discord.stores.StoreAccessibility;
|
|
import com.discord.stores.StoreAnalytics;
|
|
import com.discord.stores.StoreChannelsSelected;
|
|
import com.discord.stores.StoreEmoji;
|
|
import com.discord.stores.StoreGuildsSorted;
|
|
import com.discord.stores.StoreStream;
|
|
import com.discord.stores.StoreUserSettings;
|
|
import com.discord.utilities.analytics.SearchType;
|
|
import com.discord.utilities.analytics.Traits;
|
|
import com.discord.utilities.mg_recycler.MGRecyclerDataPayload;
|
|
import com.discord.utilities.rx.ObservableExtensionsKt;
|
|
import com.discord.widgets.chat.input.emoji.EmojiCategoryItem;
|
|
import com.discord.widgets.chat.input.emoji.WidgetEmojiAdapter;
|
|
import d0.f0.q;
|
|
import d0.g;
|
|
import d0.t.n;
|
|
import d0.t.u;
|
|
import d0.z.d.m;
|
|
import d0.z.d.o;
|
|
import j0.l.e.j;
|
|
import java.util.ArrayList;
|
|
import java.util.Collection;
|
|
import java.util.Iterator;
|
|
import java.util.LinkedHashMap;
|
|
import java.util.LinkedHashSet;
|
|
import java.util.List;
|
|
import java.util.Locale;
|
|
import java.util.Map;
|
|
import java.util.Objects;
|
|
import java.util.Set;
|
|
import kotlin.Lazy;
|
|
import kotlin.Pair;
|
|
import kotlin.Unit;
|
|
import kotlin.jvm.functions.Function0;
|
|
import kotlin.jvm.functions.Function1;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
import kotlin.sequences.Sequence;
|
|
import rx.Observable;
|
|
import rx.subjects.BehaviorSubject;
|
|
import rx.subjects.PublishSubject;
|
|
/* compiled from: EmojiPickerViewModel.kt */
|
|
public class EmojiPickerViewModel extends AppViewModel<ViewState> {
|
|
public static final Companion Companion = new Companion(null);
|
|
private final EmojiPickerContextType emojiPickerContextType;
|
|
private final PublishSubject<Event> eventSubject;
|
|
private final Locale locale;
|
|
private boolean logWhenUpsellHeaderIsViewed;
|
|
private final BehaviorSubject<String> searchSubject;
|
|
private final BehaviorSubject<Long> selectedCategoryItemIdSubject;
|
|
private final StoreAnalytics storeAnalytics;
|
|
|
|
/* compiled from: EmojiPickerViewModel.kt */
|
|
/* renamed from: com.discord.widgets.chat.input.emoji.EmojiPickerViewModel$1 reason: invalid class name */
|
|
public static final class AnonymousClass1 extends o implements Function1<StoreState, Unit> {
|
|
public final /* synthetic */ EmojiPickerViewModel this$0;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public AnonymousClass1(EmojiPickerViewModel emojiPickerViewModel) {
|
|
super(1);
|
|
this.this$0 = emojiPickerViewModel;
|
|
}
|
|
|
|
/* Return type fixed from 'java.lang.Object' to match base method */
|
|
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
|
|
@Override // kotlin.jvm.functions.Function1
|
|
public /* bridge */ /* synthetic */ Unit invoke(StoreState storeState) {
|
|
invoke(storeState);
|
|
return Unit.a;
|
|
}
|
|
|
|
public final void invoke(StoreState storeState) {
|
|
m.checkNotNullParameter(storeState, "storeState");
|
|
EmojiPickerViewModel.access$handleStoreState(this.this$0, storeState);
|
|
}
|
|
}
|
|
|
|
/* compiled from: EmojiPickerViewModel.kt */
|
|
public static final class Companion {
|
|
|
|
/* compiled from: EmojiPickerViewModel.kt */
|
|
public static abstract class EmojiItems {
|
|
|
|
/* compiled from: EmojiPickerViewModel.kt */
|
|
public static final class Partitioned extends EmojiItems {
|
|
public static final C0185Companion Companion = new C0185Companion(null);
|
|
private static final Partitioned Empty = new Partitioned(n.emptyList(), n.emptyList());
|
|
private final List<MGRecyclerDataPayload> premiumItems;
|
|
private final List<MGRecyclerDataPayload> regularItems;
|
|
|
|
/* compiled from: EmojiPickerViewModel.kt */
|
|
/* renamed from: com.discord.widgets.chat.input.emoji.EmojiPickerViewModel$Companion$EmojiItems$Partitioned$Companion reason: collision with other inner class name */
|
|
public static final class C0185Companion {
|
|
private C0185Companion() {
|
|
}
|
|
|
|
public /* synthetic */ C0185Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
|
|
public final Partitioned getEmpty() {
|
|
return Partitioned.access$getEmpty$cp();
|
|
}
|
|
}
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r2v0, resolved type: java.util.List<? extends com.discord.utilities.mg_recycler.MGRecyclerDataPayload> */
|
|
/* JADX DEBUG: Multi-variable search result rejected for r3v0, resolved type: java.util.List<? extends com.discord.utilities.mg_recycler.MGRecyclerDataPayload> */
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public Partitioned(List<? extends MGRecyclerDataPayload> list, List<? extends MGRecyclerDataPayload> list2) {
|
|
super(null);
|
|
m.checkNotNullParameter(list, "regularItems");
|
|
m.checkNotNullParameter(list2, "premiumItems");
|
|
this.regularItems = list;
|
|
this.premiumItems = list2;
|
|
}
|
|
|
|
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
|
|
public Partitioned(Pair<? extends List<? extends MGRecyclerDataPayload>, ? extends List<? extends MGRecyclerDataPayload>> pair) {
|
|
this((List) pair.getFirst(), (List) pair.getSecond());
|
|
m.checkNotNullParameter(pair, "p");
|
|
}
|
|
|
|
public static final /* synthetic */ Partitioned access$getEmpty$cp() {
|
|
return Empty;
|
|
}
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r0v0, resolved type: com.discord.widgets.chat.input.emoji.EmojiPickerViewModel$Companion$EmojiItems$Partitioned */
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public static /* synthetic */ Partitioned copy$default(Partitioned partitioned, List list, List list2, int i, Object obj) {
|
|
if ((i & 1) != 0) {
|
|
list = partitioned.regularItems;
|
|
}
|
|
if ((i & 2) != 0) {
|
|
list2 = partitioned.premiumItems;
|
|
}
|
|
return partitioned.copy(list, list2);
|
|
}
|
|
|
|
public final List<MGRecyclerDataPayload> component1() {
|
|
return this.regularItems;
|
|
}
|
|
|
|
public final List<MGRecyclerDataPayload> component2() {
|
|
return this.premiumItems;
|
|
}
|
|
|
|
public final Partitioned copy(List<? extends MGRecyclerDataPayload> list, List<? extends MGRecyclerDataPayload> list2) {
|
|
m.checkNotNullParameter(list, "regularItems");
|
|
m.checkNotNullParameter(list2, "premiumItems");
|
|
return new Partitioned(list, list2);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof Partitioned)) {
|
|
return false;
|
|
}
|
|
Partitioned partitioned = (Partitioned) obj;
|
|
return m.areEqual(this.regularItems, partitioned.regularItems) && m.areEqual(this.premiumItems, partitioned.premiumItems);
|
|
}
|
|
|
|
public final List<MGRecyclerDataPayload> getPremiumItems() {
|
|
return this.premiumItems;
|
|
}
|
|
|
|
public final List<MGRecyclerDataPayload> getRegularItems() {
|
|
return this.regularItems;
|
|
}
|
|
|
|
public int hashCode() {
|
|
List<MGRecyclerDataPayload> list = this.regularItems;
|
|
int i = 0;
|
|
int hashCode = (list != null ? list.hashCode() : 0) * 31;
|
|
List<MGRecyclerDataPayload> list2 = this.premiumItems;
|
|
if (list2 != null) {
|
|
i = list2.hashCode();
|
|
}
|
|
return hashCode + i;
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder K = a.K("Partitioned(regularItems=");
|
|
K.append(this.regularItems);
|
|
K.append(", premiumItems=");
|
|
return a.D(K, this.premiumItems, ")");
|
|
}
|
|
}
|
|
|
|
/* compiled from: EmojiPickerViewModel.kt */
|
|
public static final class Regular extends EmojiItems {
|
|
public static final C0186Companion Companion = new C0186Companion(null);
|
|
private static final Regular Empty = new Regular(n.emptyList());
|
|
private final List<MGRecyclerDataPayload> items;
|
|
|
|
/* compiled from: EmojiPickerViewModel.kt */
|
|
/* renamed from: com.discord.widgets.chat.input.emoji.EmojiPickerViewModel$Companion$EmojiItems$Regular$Companion reason: collision with other inner class name */
|
|
public static final class C0186Companion {
|
|
private C0186Companion() {
|
|
}
|
|
|
|
public /* synthetic */ C0186Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
|
|
public final Regular getEmpty() {
|
|
return Regular.access$getEmpty$cp();
|
|
}
|
|
}
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r2v0, resolved type: java.util.List<? extends com.discord.utilities.mg_recycler.MGRecyclerDataPayload> */
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public Regular(List<? extends MGRecyclerDataPayload> list) {
|
|
super(null);
|
|
m.checkNotNullParameter(list, "items");
|
|
this.items = list;
|
|
}
|
|
|
|
public static final /* synthetic */ Regular access$getEmpty$cp() {
|
|
return Empty;
|
|
}
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r0v0, resolved type: com.discord.widgets.chat.input.emoji.EmojiPickerViewModel$Companion$EmojiItems$Regular */
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public static /* synthetic */ Regular copy$default(Regular regular, List list, int i, Object obj) {
|
|
if ((i & 1) != 0) {
|
|
list = regular.items;
|
|
}
|
|
return regular.copy(list);
|
|
}
|
|
|
|
public final List<MGRecyclerDataPayload> component1() {
|
|
return this.items;
|
|
}
|
|
|
|
public final Regular copy(List<? extends MGRecyclerDataPayload> list) {
|
|
m.checkNotNullParameter(list, "items");
|
|
return new Regular(list);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this != obj) {
|
|
return (obj instanceof Regular) && m.areEqual(this.items, ((Regular) obj).items);
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public final List<MGRecyclerDataPayload> getItems() {
|
|
return this.items;
|
|
}
|
|
|
|
public int hashCode() {
|
|
List<MGRecyclerDataPayload> list = this.items;
|
|
if (list != null) {
|
|
return list.hashCode();
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
public String toString() {
|
|
return a.D(a.K("Regular(items="), this.items, ")");
|
|
}
|
|
}
|
|
|
|
private EmojiItems() {
|
|
}
|
|
|
|
public /* synthetic */ EmojiItems(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
}
|
|
|
|
public final /* synthetic */ class WhenMappings {
|
|
public static final /* synthetic */ int[] $EnumSwitchMapping$0;
|
|
|
|
static {
|
|
EmojiPickerContextType.values();
|
|
int[] iArr = new int[2];
|
|
$EnumSwitchMapping$0 = iArr;
|
|
iArr[EmojiPickerContextType.GLOBAL.ordinal()] = 1;
|
|
}
|
|
}
|
|
|
|
private Companion() {
|
|
}
|
|
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
|
|
public static final /* synthetic */ EmojiItems access$buildEmojiListItems(Companion companion, Collection collection, Function1 function1, String str, boolean z2, boolean z3, boolean z4) {
|
|
return companion.buildEmojiListItems(collection, function1, str, z2, z3, z4);
|
|
}
|
|
|
|
public static final /* synthetic */ EmojiItems access$buildGuildEmojiListItems(Companion companion, Guild guild, EmojiSet emojiSet, String str, boolean z2, boolean z3, boolean z4) {
|
|
return companion.buildGuildEmojiListItems(guild, emojiSet, str, z2, z3, z4);
|
|
}
|
|
|
|
private final EmojiItems buildEmojiListItems(Collection<? extends Emoji> collection, Function1<? super Long, Guild> function1, String str, boolean z2, boolean z3, boolean z4) {
|
|
if (collection == null) {
|
|
collection = n.emptyList();
|
|
}
|
|
Sequence mapNotNull = q.mapNotNull(q.filter(u.asSequence(collection), new EmojiPickerViewModel$Companion$buildEmojiListItems$items$1(z4)), new EmojiPickerViewModel$Companion$buildEmojiListItems$items$2(str, function1, z2));
|
|
if (!z3) {
|
|
return new EmojiItems.Regular(q.toList(mapNotNull));
|
|
}
|
|
ArrayList arrayList = new ArrayList();
|
|
ArrayList arrayList2 = new ArrayList();
|
|
for (Object obj : mapNotNull) {
|
|
if (((WidgetEmojiAdapter.EmojiItem) obj).getEmoji().isUsable()) {
|
|
arrayList.add(obj);
|
|
} else {
|
|
arrayList2.add(obj);
|
|
}
|
|
}
|
|
return new EmojiItems.Partitioned(new Pair(arrayList, arrayList2));
|
|
}
|
|
|
|
/* JADX WARNING: Removed duplicated region for block: B:11:? A[RETURN, SYNTHETIC] */
|
|
/* JADX WARNING: Removed duplicated region for block: B:6:0x002f */
|
|
private final EmojiItems buildGuildEmojiListItems(Guild guild, EmojiSet emojiSet, String str, boolean z2, boolean z3, boolean z4) {
|
|
EmojiItems emojiItems;
|
|
if (guild != null) {
|
|
List<Emoji> list = emojiSet.customEmojis.get(Long.valueOf(guild.getId()));
|
|
if (list != null) {
|
|
emojiItems = EmojiPickerViewModel.Companion.buildEmojiListItems(list, new EmojiPickerViewModel$Companion$buildGuildEmojiListItems$$inlined$let$lambda$1(guild, str, z2, z3, z4), str, z2, z3, z4);
|
|
return emojiItems == null ? emojiItems : z3 ? EmojiItems.Partitioned.Companion.getEmpty() : EmojiItems.Regular.Companion.getEmpty();
|
|
}
|
|
}
|
|
emojiItems = null;
|
|
if (emojiItems == null) {
|
|
}
|
|
}
|
|
|
|
private final Observable<StoreEmoji.EmojiContext> getEmojiContextObservable(EmojiPickerContextType emojiPickerContextType, StoreChannelsSelected storeChannelsSelected) {
|
|
if (emojiPickerContextType.ordinal() != 1) {
|
|
Observable<R> F = storeChannelsSelected.observeSelectedChannel().F(EmojiPickerViewModel$Companion$getEmojiContextObservable$1.INSTANCE);
|
|
m.checkNotNullExpressionValue(F, "storeChannelsSelected.ob… }\n }");
|
|
return F;
|
|
}
|
|
j jVar = new j(StoreEmoji.EmojiContext.Global.INSTANCE);
|
|
m.checkNotNullExpressionValue(jVar, "Observable.just(\n …ontext.Global\n )");
|
|
return jVar;
|
|
}
|
|
|
|
public static /* synthetic */ Observable getEmojiContextObservable$default(Companion companion, EmojiPickerContextType emojiPickerContextType, StoreChannelsSelected storeChannelsSelected, int i, Object obj) {
|
|
if ((i & 2) != 0) {
|
|
storeChannelsSelected = StoreStream.Companion.getChannelsSelected();
|
|
}
|
|
return companion.getEmojiContextObservable(emojiPickerContextType, storeChannelsSelected);
|
|
}
|
|
|
|
public static /* synthetic */ Observable observeStoreState$default(Companion companion, Observable observable, BehaviorSubject behaviorSubject, BehaviorSubject behaviorSubject2, StoreEmoji storeEmoji, StoreGuildsSorted storeGuildsSorted, StoreUserSettings storeUserSettings, StoreAccessibility storeAccessibility, int i, Object obj) {
|
|
return companion.observeStoreState(observable, behaviorSubject, behaviorSubject2, (i & 8) != 0 ? StoreStream.Companion.getEmojis() : storeEmoji, (i & 16) != 0 ? StoreStream.Companion.getGuildsSorted() : storeGuildsSorted, (i & 32) != 0 ? StoreStream.Companion.getUserSettings() : storeUserSettings, (i & 64) != 0 ? StoreStream.Companion.getAccessibility() : storeAccessibility);
|
|
}
|
|
|
|
public final Observable<StoreState> observeStoreState(Observable<StoreEmoji.EmojiContext> observable, BehaviorSubject<String> behaviorSubject, BehaviorSubject<Long> behaviorSubject2, StoreEmoji storeEmoji, StoreGuildsSorted storeGuildsSorted, StoreUserSettings storeUserSettings, StoreAccessibility storeAccessibility) {
|
|
m.checkNotNullParameter(observable, "emojiContextObservable");
|
|
m.checkNotNullParameter(behaviorSubject, "searchSubject");
|
|
m.checkNotNullParameter(behaviorSubject2, "selectedCategoryItemIdSubject");
|
|
m.checkNotNullParameter(storeEmoji, "storeEmoji");
|
|
m.checkNotNullParameter(storeGuildsSorted, "storeGuildsSorted");
|
|
m.checkNotNullParameter(storeUserSettings, "storeUserSettings");
|
|
m.checkNotNullParameter(storeAccessibility, "storeAccessibility");
|
|
Observable<R> Y = observable.Y(new EmojiPickerViewModel$Companion$observeStoreState$1(storeEmoji, storeGuildsSorted, behaviorSubject, storeUserSettings, storeAccessibility, behaviorSubject2));
|
|
m.checkNotNullExpressionValue(Y, "emojiContextObservable.s… )\n }\n }");
|
|
return Y;
|
|
}
|
|
}
|
|
|
|
/* compiled from: EmojiPickerViewModel.kt */
|
|
public static abstract class Event {
|
|
|
|
/* compiled from: EmojiPickerViewModel.kt */
|
|
public static final class ScrollToEmojiListPosition extends Event {
|
|
private final int position;
|
|
|
|
public ScrollToEmojiListPosition(int i) {
|
|
super(null);
|
|
this.position = i;
|
|
}
|
|
|
|
public static /* synthetic */ ScrollToEmojiListPosition copy$default(ScrollToEmojiListPosition scrollToEmojiListPosition, int i, int i2, Object obj) {
|
|
if ((i2 & 1) != 0) {
|
|
i = scrollToEmojiListPosition.position;
|
|
}
|
|
return scrollToEmojiListPosition.copy(i);
|
|
}
|
|
|
|
public final int component1() {
|
|
return this.position;
|
|
}
|
|
|
|
public final ScrollToEmojiListPosition copy(int i) {
|
|
return new ScrollToEmojiListPosition(i);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this != obj) {
|
|
return (obj instanceof ScrollToEmojiListPosition) && this.position == ((ScrollToEmojiListPosition) obj).position;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public final int getPosition() {
|
|
return this.position;
|
|
}
|
|
|
|
public int hashCode() {
|
|
return this.position;
|
|
}
|
|
|
|
public String toString() {
|
|
return a.w(a.K("ScrollToEmojiListPosition(position="), this.position, ")");
|
|
}
|
|
}
|
|
|
|
/* compiled from: EmojiPickerViewModel.kt */
|
|
public static final class ShowPremiumUpsellDialog extends Event {
|
|
private final int body;
|
|
private final int header;
|
|
private final int pageNumber;
|
|
private final String sectionName;
|
|
private final boolean showLearnMore;
|
|
private final boolean showOtherPages;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public ShowPremiumUpsellDialog(int i, @StringRes int i2, @StringRes int i3, String str, boolean z2, boolean z3) {
|
|
super(null);
|
|
m.checkNotNullParameter(str, "sectionName");
|
|
this.pageNumber = i;
|
|
this.header = i2;
|
|
this.body = i3;
|
|
this.sectionName = str;
|
|
this.showOtherPages = z2;
|
|
this.showLearnMore = z3;
|
|
}
|
|
|
|
public static /* synthetic */ ShowPremiumUpsellDialog copy$default(ShowPremiumUpsellDialog showPremiumUpsellDialog, int i, int i2, int i3, String str, boolean z2, boolean z3, int i4, Object obj) {
|
|
if ((i4 & 1) != 0) {
|
|
i = showPremiumUpsellDialog.pageNumber;
|
|
}
|
|
if ((i4 & 2) != 0) {
|
|
i2 = showPremiumUpsellDialog.header;
|
|
}
|
|
if ((i4 & 4) != 0) {
|
|
i3 = showPremiumUpsellDialog.body;
|
|
}
|
|
if ((i4 & 8) != 0) {
|
|
str = showPremiumUpsellDialog.sectionName;
|
|
}
|
|
if ((i4 & 16) != 0) {
|
|
z2 = showPremiumUpsellDialog.showOtherPages;
|
|
}
|
|
if ((i4 & 32) != 0) {
|
|
z3 = showPremiumUpsellDialog.showLearnMore;
|
|
}
|
|
return showPremiumUpsellDialog.copy(i, i2, i3, str, z2, z3);
|
|
}
|
|
|
|
public final int component1() {
|
|
return this.pageNumber;
|
|
}
|
|
|
|
public final int component2() {
|
|
return this.header;
|
|
}
|
|
|
|
public final int component3() {
|
|
return this.body;
|
|
}
|
|
|
|
public final String component4() {
|
|
return this.sectionName;
|
|
}
|
|
|
|
public final boolean component5() {
|
|
return this.showOtherPages;
|
|
}
|
|
|
|
public final boolean component6() {
|
|
return this.showLearnMore;
|
|
}
|
|
|
|
public final ShowPremiumUpsellDialog copy(int i, @StringRes int i2, @StringRes int i3, String str, boolean z2, boolean z3) {
|
|
m.checkNotNullParameter(str, "sectionName");
|
|
return new ShowPremiumUpsellDialog(i, i2, i3, str, z2, z3);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof ShowPremiumUpsellDialog)) {
|
|
return false;
|
|
}
|
|
ShowPremiumUpsellDialog showPremiumUpsellDialog = (ShowPremiumUpsellDialog) obj;
|
|
return this.pageNumber == showPremiumUpsellDialog.pageNumber && this.header == showPremiumUpsellDialog.header && this.body == showPremiumUpsellDialog.body && m.areEqual(this.sectionName, showPremiumUpsellDialog.sectionName) && this.showOtherPages == showPremiumUpsellDialog.showOtherPages && this.showLearnMore == showPremiumUpsellDialog.showLearnMore;
|
|
}
|
|
|
|
public final int getBody() {
|
|
return this.body;
|
|
}
|
|
|
|
public final int getHeader() {
|
|
return this.header;
|
|
}
|
|
|
|
public final int getPageNumber() {
|
|
return this.pageNumber;
|
|
}
|
|
|
|
public final String getSectionName() {
|
|
return this.sectionName;
|
|
}
|
|
|
|
public final boolean getShowLearnMore() {
|
|
return this.showLearnMore;
|
|
}
|
|
|
|
public final boolean getShowOtherPages() {
|
|
return this.showOtherPages;
|
|
}
|
|
|
|
public int hashCode() {
|
|
int i = ((((this.pageNumber * 31) + this.header) * 31) + this.body) * 31;
|
|
String str = this.sectionName;
|
|
int hashCode = (i + (str != null ? str.hashCode() : 0)) * 31;
|
|
boolean z2 = this.showOtherPages;
|
|
int i2 = 1;
|
|
if (z2) {
|
|
z2 = true;
|
|
}
|
|
int i3 = z2 ? 1 : 0;
|
|
int i4 = z2 ? 1 : 0;
|
|
int i5 = z2 ? 1 : 0;
|
|
int i6 = (hashCode + i3) * 31;
|
|
boolean z3 = this.showLearnMore;
|
|
if (!z3) {
|
|
i2 = z3 ? 1 : 0;
|
|
}
|
|
return i6 + i2;
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder K = a.K("ShowPremiumUpsellDialog(pageNumber=");
|
|
K.append(this.pageNumber);
|
|
K.append(", header=");
|
|
K.append(this.header);
|
|
K.append(", body=");
|
|
K.append(this.body);
|
|
K.append(", sectionName=");
|
|
K.append(this.sectionName);
|
|
K.append(", showOtherPages=");
|
|
K.append(this.showOtherPages);
|
|
K.append(", showLearnMore=");
|
|
return a.F(K, this.showLearnMore, ")");
|
|
}
|
|
}
|
|
|
|
private Event() {
|
|
}
|
|
|
|
public /* synthetic */ Event(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
}
|
|
|
|
/* compiled from: EmojiPickerViewModel.kt */
|
|
public static final class Inline extends EmojiPickerViewModel {
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public Inline(EmojiPickerContextType emojiPickerContextType, Locale locale) {
|
|
super(emojiPickerContextType, locale, null, null, null, null, 60, null);
|
|
m.checkNotNullParameter(emojiPickerContextType, "emojiPickerContextType");
|
|
m.checkNotNullParameter(locale, "locale");
|
|
}
|
|
}
|
|
|
|
/* compiled from: EmojiPickerViewModel.kt */
|
|
public static final class Sheet extends EmojiPickerViewModel {
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public Sheet(EmojiPickerContextType emojiPickerContextType, Locale locale) {
|
|
super(emojiPickerContextType, locale, null, null, null, null, 60, null);
|
|
m.checkNotNullParameter(emojiPickerContextType, "emojiPickerContextType");
|
|
m.checkNotNullParameter(locale, "locale");
|
|
}
|
|
}
|
|
|
|
/* compiled from: EmojiPickerViewModel.kt */
|
|
public static abstract class StoreState {
|
|
|
|
/* compiled from: EmojiPickerViewModel.kt */
|
|
public static final class Emoji extends StoreState {
|
|
private final LinkedHashMap<Long, Guild> allGuilds;
|
|
private final boolean allowEmojisToAnimate;
|
|
private final StoreEmoji.EmojiContext emojiContext;
|
|
private final EmojiSet emojiSet;
|
|
private final Set<com.discord.models.domain.emoji.Emoji> favoriteEmoji;
|
|
private final String searchInputStringUpper;
|
|
private final long selectedCategoryItemId;
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r9v0, resolved type: java.util.Set<? extends com.discord.models.domain.emoji.Emoji> */
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public Emoji(EmojiSet emojiSet, StoreEmoji.EmojiContext emojiContext, LinkedHashMap<Long, Guild> linkedHashMap, String str, boolean z2, long j, Set<? extends com.discord.models.domain.emoji.Emoji> set) {
|
|
super(null);
|
|
m.checkNotNullParameter(emojiSet, "emojiSet");
|
|
m.checkNotNullParameter(emojiContext, "emojiContext");
|
|
m.checkNotNullParameter(linkedHashMap, "allGuilds");
|
|
m.checkNotNullParameter(str, "searchInputStringUpper");
|
|
m.checkNotNullParameter(set, "favoriteEmoji");
|
|
this.emojiSet = emojiSet;
|
|
this.emojiContext = emojiContext;
|
|
this.allGuilds = linkedHashMap;
|
|
this.searchInputStringUpper = str;
|
|
this.allowEmojisToAnimate = z2;
|
|
this.selectedCategoryItemId = j;
|
|
this.favoriteEmoji = set;
|
|
}
|
|
|
|
public static /* synthetic */ Emoji copy$default(Emoji emoji, EmojiSet emojiSet, StoreEmoji.EmojiContext emojiContext, LinkedHashMap linkedHashMap, String str, boolean z2, long j, Set set, int i, Object obj) {
|
|
return emoji.copy((i & 1) != 0 ? emoji.emojiSet : emojiSet, (i & 2) != 0 ? emoji.emojiContext : emojiContext, (i & 4) != 0 ? emoji.allGuilds : linkedHashMap, (i & 8) != 0 ? emoji.searchInputStringUpper : str, (i & 16) != 0 ? emoji.allowEmojisToAnimate : z2, (i & 32) != 0 ? emoji.selectedCategoryItemId : j, (i & 64) != 0 ? emoji.favoriteEmoji : set);
|
|
}
|
|
|
|
public final EmojiSet component1() {
|
|
return this.emojiSet;
|
|
}
|
|
|
|
public final StoreEmoji.EmojiContext component2() {
|
|
return this.emojiContext;
|
|
}
|
|
|
|
public final LinkedHashMap<Long, Guild> component3() {
|
|
return this.allGuilds;
|
|
}
|
|
|
|
public final String component4() {
|
|
return this.searchInputStringUpper;
|
|
}
|
|
|
|
public final boolean component5() {
|
|
return this.allowEmojisToAnimate;
|
|
}
|
|
|
|
public final long component6() {
|
|
return this.selectedCategoryItemId;
|
|
}
|
|
|
|
public final Set<com.discord.models.domain.emoji.Emoji> component7() {
|
|
return this.favoriteEmoji;
|
|
}
|
|
|
|
public final Emoji copy(EmojiSet emojiSet, StoreEmoji.EmojiContext emojiContext, LinkedHashMap<Long, Guild> linkedHashMap, String str, boolean z2, long j, Set<? extends com.discord.models.domain.emoji.Emoji> set) {
|
|
m.checkNotNullParameter(emojiSet, "emojiSet");
|
|
m.checkNotNullParameter(emojiContext, "emojiContext");
|
|
m.checkNotNullParameter(linkedHashMap, "allGuilds");
|
|
m.checkNotNullParameter(str, "searchInputStringUpper");
|
|
m.checkNotNullParameter(set, "favoriteEmoji");
|
|
return new Emoji(emojiSet, emojiContext, linkedHashMap, str, z2, j, set);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof Emoji)) {
|
|
return false;
|
|
}
|
|
Emoji emoji = (Emoji) obj;
|
|
return m.areEqual(this.emojiSet, emoji.emojiSet) && m.areEqual(this.emojiContext, emoji.emojiContext) && m.areEqual(this.allGuilds, emoji.allGuilds) && m.areEqual(this.searchInputStringUpper, emoji.searchInputStringUpper) && this.allowEmojisToAnimate == emoji.allowEmojisToAnimate && this.selectedCategoryItemId == emoji.selectedCategoryItemId && m.areEqual(this.favoriteEmoji, emoji.favoriteEmoji);
|
|
}
|
|
|
|
public final LinkedHashMap<Long, Guild> getAllGuilds() {
|
|
return this.allGuilds;
|
|
}
|
|
|
|
public final boolean getAllowEmojisToAnimate() {
|
|
return this.allowEmojisToAnimate;
|
|
}
|
|
|
|
public final StoreEmoji.EmojiContext getEmojiContext() {
|
|
return this.emojiContext;
|
|
}
|
|
|
|
public final EmojiSet getEmojiSet() {
|
|
return this.emojiSet;
|
|
}
|
|
|
|
public final Set<com.discord.models.domain.emoji.Emoji> getFavoriteEmoji() {
|
|
return this.favoriteEmoji;
|
|
}
|
|
|
|
public final String getSearchInputStringUpper() {
|
|
return this.searchInputStringUpper;
|
|
}
|
|
|
|
public final long getSelectedCategoryItemId() {
|
|
return this.selectedCategoryItemId;
|
|
}
|
|
|
|
public int hashCode() {
|
|
EmojiSet emojiSet = this.emojiSet;
|
|
int i = 0;
|
|
int hashCode = (emojiSet != null ? emojiSet.hashCode() : 0) * 31;
|
|
StoreEmoji.EmojiContext emojiContext = this.emojiContext;
|
|
int hashCode2 = (hashCode + (emojiContext != null ? emojiContext.hashCode() : 0)) * 31;
|
|
LinkedHashMap<Long, Guild> linkedHashMap = this.allGuilds;
|
|
int hashCode3 = (hashCode2 + (linkedHashMap != null ? linkedHashMap.hashCode() : 0)) * 31;
|
|
String str = this.searchInputStringUpper;
|
|
int hashCode4 = (hashCode3 + (str != null ? str.hashCode() : 0)) * 31;
|
|
boolean z2 = this.allowEmojisToAnimate;
|
|
if (z2) {
|
|
z2 = true;
|
|
}
|
|
int i2 = z2 ? 1 : 0;
|
|
int i3 = z2 ? 1 : 0;
|
|
int i4 = z2 ? 1 : 0;
|
|
int a = (b.a(this.selectedCategoryItemId) + ((hashCode4 + i2) * 31)) * 31;
|
|
Set<com.discord.models.domain.emoji.Emoji> set = this.favoriteEmoji;
|
|
if (set != null) {
|
|
i = set.hashCode();
|
|
}
|
|
return a + i;
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder K = a.K("Emoji(emojiSet=");
|
|
K.append(this.emojiSet);
|
|
K.append(", emojiContext=");
|
|
K.append(this.emojiContext);
|
|
K.append(", allGuilds=");
|
|
K.append(this.allGuilds);
|
|
K.append(", searchInputStringUpper=");
|
|
K.append(this.searchInputStringUpper);
|
|
K.append(", allowEmojisToAnimate=");
|
|
K.append(this.allowEmojisToAnimate);
|
|
K.append(", selectedCategoryItemId=");
|
|
K.append(this.selectedCategoryItemId);
|
|
K.append(", favoriteEmoji=");
|
|
K.append(this.favoriteEmoji);
|
|
K.append(")");
|
|
return K.toString();
|
|
}
|
|
}
|
|
|
|
/* compiled from: EmojiPickerViewModel.kt */
|
|
public static final class Uninitialized extends StoreState {
|
|
public static final Uninitialized INSTANCE = new Uninitialized();
|
|
|
|
private Uninitialized() {
|
|
super(null);
|
|
}
|
|
}
|
|
|
|
private StoreState() {
|
|
}
|
|
|
|
public /* synthetic */ StoreState(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
}
|
|
|
|
/* compiled from: EmojiPickerViewModel.kt */
|
|
public static abstract class ViewState {
|
|
private final String searchQuery;
|
|
|
|
/* compiled from: EmojiPickerViewModel.kt */
|
|
public static final class EmptySearch extends ViewState {
|
|
private final String searchQuery;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public EmptySearch(String str) {
|
|
super(str, null);
|
|
m.checkNotNullParameter(str, "searchQuery");
|
|
this.searchQuery = str;
|
|
}
|
|
|
|
public static /* synthetic */ EmptySearch copy$default(EmptySearch emptySearch, String str, int i, Object obj) {
|
|
if ((i & 1) != 0) {
|
|
str = emptySearch.getSearchQuery();
|
|
}
|
|
return emptySearch.copy(str);
|
|
}
|
|
|
|
public final String component1() {
|
|
return getSearchQuery();
|
|
}
|
|
|
|
public final EmptySearch copy(String str) {
|
|
m.checkNotNullParameter(str, "searchQuery");
|
|
return new EmptySearch(str);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this != obj) {
|
|
return (obj instanceof EmptySearch) && m.areEqual(getSearchQuery(), ((EmptySearch) obj).getSearchQuery());
|
|
}
|
|
return true;
|
|
}
|
|
|
|
@Override // com.discord.widgets.chat.input.emoji.EmojiPickerViewModel.ViewState
|
|
public String getSearchQuery() {
|
|
return this.searchQuery;
|
|
}
|
|
|
|
public int hashCode() {
|
|
String searchQuery = getSearchQuery();
|
|
if (searchQuery != null) {
|
|
return searchQuery.hashCode();
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder K = a.K("EmptySearch(searchQuery=");
|
|
K.append(getSearchQuery());
|
|
K.append(")");
|
|
return K.toString();
|
|
}
|
|
}
|
|
|
|
/* compiled from: EmojiPickerViewModel.kt */
|
|
public static final class Results extends ViewState {
|
|
private final List<EmojiCategoryItem> categoryItems;
|
|
private final Lazy firstUnicodeEmojiCategoryItem$delegate = g.lazy(new EmojiPickerViewModel$ViewState$Results$firstUnicodeEmojiCategoryItem$2(this));
|
|
private final List<MGRecyclerDataPayload> resultItems;
|
|
private final String searchQuery;
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r3v0, resolved type: java.util.List<? extends com.discord.utilities.mg_recycler.MGRecyclerDataPayload> */
|
|
/* JADX DEBUG: Multi-variable search result rejected for r4v0, resolved type: java.util.List<? extends com.discord.widgets.chat.input.emoji.EmojiCategoryItem> */
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public Results(String str, List<? extends MGRecyclerDataPayload> list, List<? extends EmojiCategoryItem> list2) {
|
|
super(str, null);
|
|
m.checkNotNullParameter(str, "searchQuery");
|
|
m.checkNotNullParameter(list, "resultItems");
|
|
m.checkNotNullParameter(list2, "categoryItems");
|
|
this.searchQuery = str;
|
|
this.resultItems = list;
|
|
this.categoryItems = list2;
|
|
}
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r0v0, resolved type: com.discord.widgets.chat.input.emoji.EmojiPickerViewModel$ViewState$Results */
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public static /* synthetic */ Results copy$default(Results results, String str, List list, List list2, int i, Object obj) {
|
|
if ((i & 1) != 0) {
|
|
str = results.getSearchQuery();
|
|
}
|
|
if ((i & 2) != 0) {
|
|
list = results.resultItems;
|
|
}
|
|
if ((i & 4) != 0) {
|
|
list2 = results.categoryItems;
|
|
}
|
|
return results.copy(str, list, list2);
|
|
}
|
|
|
|
public final String component1() {
|
|
return getSearchQuery();
|
|
}
|
|
|
|
public final List<MGRecyclerDataPayload> component2() {
|
|
return this.resultItems;
|
|
}
|
|
|
|
public final List<EmojiCategoryItem> component3() {
|
|
return this.categoryItems;
|
|
}
|
|
|
|
public final Results copy(String str, List<? extends MGRecyclerDataPayload> list, List<? extends EmojiCategoryItem> list2) {
|
|
m.checkNotNullParameter(str, "searchQuery");
|
|
m.checkNotNullParameter(list, "resultItems");
|
|
m.checkNotNullParameter(list2, "categoryItems");
|
|
return new Results(str, list, list2);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof Results)) {
|
|
return false;
|
|
}
|
|
Results results = (Results) obj;
|
|
return m.areEqual(getSearchQuery(), results.getSearchQuery()) && m.areEqual(this.resultItems, results.resultItems) && m.areEqual(this.categoryItems, results.categoryItems);
|
|
}
|
|
|
|
public final List<EmojiCategoryItem> getCategoryItems() {
|
|
return this.categoryItems;
|
|
}
|
|
|
|
public final EmojiCategoryItem.StandardItem getFirstUnicodeEmojiCategoryItem() {
|
|
return (EmojiCategoryItem.StandardItem) this.firstUnicodeEmojiCategoryItem$delegate.getValue();
|
|
}
|
|
|
|
public final List<MGRecyclerDataPayload> getResultItems() {
|
|
return this.resultItems;
|
|
}
|
|
|
|
@Override // com.discord.widgets.chat.input.emoji.EmojiPickerViewModel.ViewState
|
|
public String getSearchQuery() {
|
|
return this.searchQuery;
|
|
}
|
|
|
|
public final boolean getShowBottomBar() {
|
|
return getSearchQuery().length() == 0;
|
|
}
|
|
|
|
public int hashCode() {
|
|
String searchQuery = getSearchQuery();
|
|
int i = 0;
|
|
int hashCode = (searchQuery != null ? searchQuery.hashCode() : 0) * 31;
|
|
List<MGRecyclerDataPayload> list = this.resultItems;
|
|
int hashCode2 = (hashCode + (list != null ? list.hashCode() : 0)) * 31;
|
|
List<EmojiCategoryItem> list2 = this.categoryItems;
|
|
if (list2 != null) {
|
|
i = list2.hashCode();
|
|
}
|
|
return hashCode2 + i;
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder K = a.K("Results(searchQuery=");
|
|
K.append(getSearchQuery());
|
|
K.append(", resultItems=");
|
|
K.append(this.resultItems);
|
|
K.append(", categoryItems=");
|
|
return a.D(K, this.categoryItems, ")");
|
|
}
|
|
}
|
|
|
|
private ViewState(String str) {
|
|
this.searchQuery = str;
|
|
}
|
|
|
|
public /* synthetic */ ViewState(String str, DefaultConstructorMarker defaultConstructorMarker) {
|
|
this(str);
|
|
}
|
|
|
|
public String getSearchQuery() {
|
|
return this.searchQuery;
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public EmojiPickerViewModel(EmojiPickerContextType emojiPickerContextType, Locale locale, BehaviorSubject<String> behaviorSubject, BehaviorSubject<Long> behaviorSubject2, Observable<StoreState> observable, StoreAnalytics storeAnalytics) {
|
|
super(null);
|
|
m.checkNotNullParameter(emojiPickerContextType, "emojiPickerContextType");
|
|
m.checkNotNullParameter(locale, "locale");
|
|
m.checkNotNullParameter(behaviorSubject, "searchSubject");
|
|
m.checkNotNullParameter(behaviorSubject2, "selectedCategoryItemIdSubject");
|
|
m.checkNotNullParameter(observable, "storeStateObservable");
|
|
m.checkNotNullParameter(storeAnalytics, "storeAnalytics");
|
|
this.emojiPickerContextType = emojiPickerContextType;
|
|
this.locale = locale;
|
|
this.searchSubject = behaviorSubject;
|
|
this.selectedCategoryItemIdSubject = behaviorSubject2;
|
|
this.storeAnalytics = storeAnalytics;
|
|
PublishSubject<Event> k0 = PublishSubject.k0();
|
|
m.checkNotNullExpressionValue(k0, "PublishSubject.create()");
|
|
this.eventSubject = k0;
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(ObservableExtensionsKt.computationLatest(observable), this, null, 2, null), getClass(), (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new AnonymousClass1(this), 62, (Object) null);
|
|
}
|
|
|
|
/* JADX WARNING: Illegal instructions before constructor call */
|
|
public /* synthetic */ EmojiPickerViewModel(EmojiPickerContextType emojiPickerContextType, Locale locale, BehaviorSubject behaviorSubject, BehaviorSubject behaviorSubject2, Observable observable, StoreAnalytics storeAnalytics, int i, DefaultConstructorMarker defaultConstructorMarker) {
|
|
this(emojiPickerContextType, locale, r0, r1, r7, (i & 32) != 0 ? StoreStream.Companion.getAnalytics() : storeAnalytics);
|
|
BehaviorSubject behaviorSubject3;
|
|
BehaviorSubject behaviorSubject4;
|
|
Observable observable2;
|
|
if ((i & 4) != 0) {
|
|
behaviorSubject3 = BehaviorSubject.l0("");
|
|
m.checkNotNullExpressionValue(behaviorSubject3, "BehaviorSubject.create(\"\")");
|
|
} else {
|
|
behaviorSubject3 = behaviorSubject;
|
|
}
|
|
if ((i & 8) != 0) {
|
|
behaviorSubject4 = BehaviorSubject.l0(Long.valueOf(EmojiCategoryItem.Companion.mapEmojiCategoryToItemId(EmojiCategory.FAVORITE)));
|
|
m.checkNotNullExpressionValue(behaviorSubject4, "BehaviorSubject.create(\n…ojiCategory.FAVORITE)\n )");
|
|
} else {
|
|
behaviorSubject4 = behaviorSubject2;
|
|
}
|
|
if ((i & 16) != 0) {
|
|
Companion companion = Companion;
|
|
observable2 = Companion.observeStoreState$default(companion, Companion.getEmojiContextObservable$default(companion, emojiPickerContextType, null, 2, null), behaviorSubject3, behaviorSubject4, null, null, null, null, 120, null);
|
|
} else {
|
|
observable2 = observable;
|
|
}
|
|
}
|
|
|
|
public static final /* synthetic */ void access$handleStoreState(EmojiPickerViewModel emojiPickerViewModel, StoreState storeState) {
|
|
emojiPickerViewModel.handleStoreState(storeState);
|
|
}
|
|
|
|
@MainThread
|
|
private final void handleStoreState(StoreState storeState) {
|
|
LinkedHashMap<Long, Guild> linkedHashMap;
|
|
List list;
|
|
EmojiPickerViewModel emojiPickerViewModel;
|
|
int i;
|
|
LinkedHashMap<Long, Guild> linkedHashMap2;
|
|
EmojiCategory emojiCategory;
|
|
if (storeState instanceof StoreState.Emoji) {
|
|
StoreState.Emoji emoji = (StoreState.Emoji) storeState;
|
|
EmojiSet emojiSet = emoji.getEmojiSet();
|
|
long selectedCategoryItemId = emoji.getSelectedCategoryItemId();
|
|
boolean allowEmojisToAnimate = emoji.getAllowEmojisToAnimate();
|
|
String searchInputStringUpper = emoji.getSearchInputStringUpper();
|
|
Locale locale = this.locale;
|
|
Objects.requireNonNull(searchInputStringUpper, "null cannot be cast to non-null type java.lang.String");
|
|
String lowerCase = searchInputStringUpper.toLowerCase(locale);
|
|
m.checkNotNullExpressionValue(lowerCase, "(this as java.lang.String).toLowerCase(locale)");
|
|
boolean z2 = lowerCase.length() > 0;
|
|
ArrayList arrayList = new ArrayList();
|
|
LinkedHashMap<Long, Guild> allGuilds = emoji.getAllGuilds();
|
|
Collection<Guild> values = emoji.getAllGuilds().values();
|
|
m.checkNotNullExpressionValue(values, "storeState.allGuilds.values");
|
|
List list2 = u.toList(values);
|
|
Collection<MGRecyclerDataPayload> linkedHashSet = z2 ? new LinkedHashSet() : new ArrayList();
|
|
Collection linkedHashSet2 = z2 ? new LinkedHashSet() : new ArrayList();
|
|
boolean z3 = !z2;
|
|
Companion companion = Companion;
|
|
Companion.EmojiItems access$buildEmojiListItems = Companion.access$buildEmojiListItems(companion, emoji.getFavoriteEmoji(), new EmojiPickerViewModel$handleStoreState$favoriteItems$1(allGuilds), lowerCase, allowEmojisToAnimate, z2, z3);
|
|
if (access$buildEmojiListItems instanceof Companion.EmojiItems.Partitioned) {
|
|
Companion.EmojiItems.Partitioned partitioned = (Companion.EmojiItems.Partitioned) access$buildEmojiListItems;
|
|
linkedHashSet.addAll(partitioned.getRegularItems());
|
|
linkedHashSet2.addAll(partitioned.getPremiumItems());
|
|
} else if (access$buildEmojiListItems instanceof Companion.EmojiItems.Regular) {
|
|
Companion.EmojiItems.Regular regular = (Companion.EmojiItems.Regular) access$buildEmojiListItems;
|
|
if (!regular.getItems().isEmpty()) {
|
|
int size = linkedHashSet.size();
|
|
if (!z2) {
|
|
linkedHashSet.add(new WidgetEmojiAdapter.HeaderItem.StandardHeaderItem(EmojiCategory.FAVORITE));
|
|
}
|
|
linkedHashSet.addAll(regular.getItems());
|
|
EmojiCategoryItem.Companion companion2 = EmojiCategoryItem.Companion;
|
|
EmojiCategory emojiCategory2 = EmojiCategory.FAVORITE;
|
|
arrayList.add(new EmojiCategoryItem.StandardItem(emojiCategory2, new Pair(Integer.valueOf(size), Integer.valueOf(linkedHashSet.size())), companion2.mapEmojiCategoryToItemId(emojiCategory2) == selectedCategoryItemId));
|
|
}
|
|
}
|
|
Companion.EmojiItems access$buildEmojiListItems2 = Companion.access$buildEmojiListItems(companion, emojiSet.recentEmojis, new EmojiPickerViewModel$handleStoreState$frequentItems$1(allGuilds), lowerCase, allowEmojisToAnimate, z2, z3);
|
|
if (access$buildEmojiListItems2 instanceof Companion.EmojiItems.Partitioned) {
|
|
Companion.EmojiItems.Partitioned partitioned2 = (Companion.EmojiItems.Partitioned) access$buildEmojiListItems2;
|
|
linkedHashSet.addAll(partitioned2.getRegularItems());
|
|
linkedHashSet2.addAll(partitioned2.getPremiumItems());
|
|
} else if (access$buildEmojiListItems2 instanceof Companion.EmojiItems.Regular) {
|
|
Companion.EmojiItems.Regular regular2 = (Companion.EmojiItems.Regular) access$buildEmojiListItems2;
|
|
if (!regular2.getItems().isEmpty()) {
|
|
int size2 = linkedHashSet.size();
|
|
if (!z2) {
|
|
linkedHashSet.add(new WidgetEmojiAdapter.HeaderItem.StandardHeaderItem(EmojiCategory.RECENT));
|
|
}
|
|
linkedHashSet.addAll(regular2.getItems());
|
|
EmojiCategoryItem.Companion companion3 = EmojiCategoryItem.Companion;
|
|
EmojiCategory emojiCategory3 = EmojiCategory.RECENT;
|
|
arrayList.add(new EmojiCategoryItem.StandardItem(emojiCategory3, new Pair(Integer.valueOf(size2), Integer.valueOf(linkedHashSet.size())), companion3.mapEmojiCategoryToItemId(emojiCategory3) == selectedCategoryItemId));
|
|
}
|
|
}
|
|
StoreEmoji.EmojiContext emojiContext = emoji.getEmojiContext();
|
|
long guildId = emojiContext instanceof StoreEmoji.EmojiContext.Chat ? ((StoreEmoji.EmojiContext.Chat) emojiContext).getGuildId() : 0;
|
|
Guild guild = emoji.getAllGuilds().get(Long.valueOf(guildId));
|
|
List<Emoji> list3 = emojiSet.customEmojis.get(Long.valueOf(guildId));
|
|
if (guild == null || list3 == null || !(!list3.isEmpty())) {
|
|
linkedHashMap = allGuilds;
|
|
list = list2;
|
|
} else {
|
|
linkedHashMap = allGuilds;
|
|
Companion.EmojiItems access$buildGuildEmojiListItems = Companion.access$buildGuildEmojiListItems(companion, guild, emojiSet, lowerCase, allowEmojisToAnimate, z2, z3);
|
|
if (access$buildGuildEmojiListItems instanceof Companion.EmojiItems.Partitioned) {
|
|
Companion.EmojiItems.Partitioned partitioned3 = (Companion.EmojiItems.Partitioned) access$buildGuildEmojiListItems;
|
|
linkedHashSet.addAll(partitioned3.getRegularItems());
|
|
linkedHashSet2.addAll(partitioned3.getPremiumItems());
|
|
} else if (access$buildGuildEmojiListItems instanceof Companion.EmojiItems.Regular) {
|
|
Companion.EmojiItems.Regular regular3 = (Companion.EmojiItems.Regular) access$buildGuildEmojiListItems;
|
|
if (!regular3.getItems().isEmpty()) {
|
|
int size3 = linkedHashSet.size();
|
|
if (!z2) {
|
|
linkedHashSet.add(new WidgetEmojiAdapter.HeaderItem.GuildHeaderItem(guild));
|
|
}
|
|
linkedHashSet.addAll(regular3.getItems());
|
|
arrayList.add(new EmojiCategoryItem.GuildItem(guild, new Pair(Integer.valueOf(size3), Integer.valueOf(linkedHashSet.size())), EmojiCategoryItem.Companion.mapGuildToItemId(guild) == selectedCategoryItemId));
|
|
}
|
|
}
|
|
list = u.minus(list2, guild);
|
|
}
|
|
for (Iterator it = list.iterator(); it.hasNext(); it = it) {
|
|
Guild guild2 = (Guild) it.next();
|
|
Companion.EmojiItems access$buildGuildEmojiListItems2 = Companion.access$buildGuildEmojiListItems(Companion, guild2, emojiSet, lowerCase, allowEmojisToAnimate, z2, z3);
|
|
if (access$buildGuildEmojiListItems2 instanceof Companion.EmojiItems.Partitioned) {
|
|
Companion.EmojiItems.Partitioned partitioned4 = (Companion.EmojiItems.Partitioned) access$buildGuildEmojiListItems2;
|
|
linkedHashSet.addAll(partitioned4.getRegularItems());
|
|
linkedHashSet2.addAll(partitioned4.getPremiumItems());
|
|
} else if (access$buildGuildEmojiListItems2 instanceof Companion.EmojiItems.Regular) {
|
|
Companion.EmojiItems.Regular regular4 = (Companion.EmojiItems.Regular) access$buildGuildEmojiListItems2;
|
|
if (!regular4.getItems().isEmpty()) {
|
|
int size4 = linkedHashSet.size();
|
|
if (!z2) {
|
|
m.checkNotNullExpressionValue(guild2, "guild");
|
|
linkedHashSet.add(new WidgetEmojiAdapter.HeaderItem.GuildHeaderItem(guild2));
|
|
}
|
|
linkedHashSet.addAll(regular4.getItems());
|
|
EmojiCategoryItem.Companion companion4 = EmojiCategoryItem.Companion;
|
|
m.checkNotNullExpressionValue(guild2, "guild");
|
|
arrayList.add(new EmojiCategoryItem.GuildItem(guild2, new Pair(Integer.valueOf(size4), Integer.valueOf(linkedHashSet.size())), companion4.mapGuildToItemId(guild2) == selectedCategoryItemId));
|
|
}
|
|
}
|
|
}
|
|
Map<EmojiCategory, List<Emoji>> map = emojiSet.unicodeEmojis;
|
|
EmojiCategory[] values2 = EmojiCategory.values();
|
|
int i2 = 0;
|
|
for (int i3 = 11; i2 < i3; i3 = 11) {
|
|
EmojiCategory emojiCategory4 = values2[i2];
|
|
if (!map.containsKey(emojiCategory4)) {
|
|
i = i2;
|
|
linkedHashMap2 = linkedHashMap;
|
|
} else {
|
|
int size5 = linkedHashSet.size();
|
|
linkedHashMap2 = linkedHashMap;
|
|
i = i2;
|
|
Companion.EmojiItems access$buildEmojiListItems3 = Companion.access$buildEmojiListItems(Companion, map.get(emojiCategory4), new EmojiPickerViewModel$handleStoreState$unicodeCategoryItems$1(linkedHashMap), lowerCase, allowEmojisToAnimate, false, false);
|
|
if (access$buildEmojiListItems3 instanceof Companion.EmojiItems.Regular) {
|
|
Companion.EmojiItems.Regular regular5 = (Companion.EmojiItems.Regular) access$buildEmojiListItems3;
|
|
if (!regular5.getItems().isEmpty()) {
|
|
if (!z2) {
|
|
emojiCategory = emojiCategory4;
|
|
linkedHashSet.add(new WidgetEmojiAdapter.HeaderItem.StandardHeaderItem(emojiCategory));
|
|
} else {
|
|
emojiCategory = emojiCategory4;
|
|
}
|
|
linkedHashSet.addAll(regular5.getItems());
|
|
arrayList.add(new EmojiCategoryItem.StandardItem(emojiCategory, new Pair(Integer.valueOf(size5), Integer.valueOf(linkedHashSet.size())), EmojiCategoryItem.Companion.mapEmojiCategoryToItemId(emojiCategory) == selectedCategoryItemId));
|
|
}
|
|
}
|
|
}
|
|
i2 = i + 1;
|
|
linkedHashMap = linkedHashMap2;
|
|
}
|
|
if (z2 && (!linkedHashSet2.isEmpty())) {
|
|
linkedHashSet.add(new WidgetEmojiAdapter.HeaderItem.StringHeaderItem(2131888276));
|
|
linkedHashSet.addAll(linkedHashSet2);
|
|
linkedHashSet.add(WidgetEmojiAdapter.UpsellItem.INSTANCE);
|
|
}
|
|
if (z2) {
|
|
emojiPickerViewModel = this;
|
|
emojiPickerViewModel.logWhenUpsellHeaderIsViewed = true;
|
|
int i4 = 0;
|
|
int i5 = 0;
|
|
for (MGRecyclerDataPayload mGRecyclerDataPayload : linkedHashSet) {
|
|
if (mGRecyclerDataPayload instanceof WidgetEmojiAdapter.EmojiItem) {
|
|
i4++;
|
|
if (!((WidgetEmojiAdapter.EmojiItem) mGRecyclerDataPayload).getEmoji().isUsable()) {
|
|
i5++;
|
|
}
|
|
}
|
|
}
|
|
if (i4 > 0) {
|
|
emojiPickerViewModel.storeAnalytics.trackSearchResultViewed(SearchType.EMOJI, i4, Integer.valueOf(i5), emojiPickerViewModel.storeAnalytics.getEmojiPickerUpsellLocation(), true);
|
|
} else {
|
|
StoreAnalytics storeAnalytics = emojiPickerViewModel.storeAnalytics;
|
|
storeAnalytics.trackSearchResultsEmpty(SearchType.EMOJI, storeAnalytics.getEmojiPickerUpsellLocation(), true);
|
|
}
|
|
} else {
|
|
emojiPickerViewModel = this;
|
|
}
|
|
if (!linkedHashSet.isEmpty() || !z2) {
|
|
List list4 = (List) (!(linkedHashSet instanceof List) ? null : linkedHashSet);
|
|
if (list4 == null) {
|
|
list4 = u.toList(linkedHashSet);
|
|
}
|
|
emojiPickerViewModel.updateViewState(new ViewState.Results(emoji.getSearchInputStringUpper(), list4, arrayList));
|
|
return;
|
|
}
|
|
emojiPickerViewModel.updateViewState(new ViewState.EmptySearch(emoji.getSearchInputStringUpper()));
|
|
}
|
|
}
|
|
|
|
public final Observable<Event> observeEvents() {
|
|
return this.eventSubject;
|
|
}
|
|
|
|
public final void onClickUnicodeEmojiCategories() {
|
|
EmojiCategoryItem.StandardItem firstUnicodeEmojiCategoryItem;
|
|
ViewState viewState = getViewState();
|
|
if (!(viewState instanceof ViewState.Results)) {
|
|
viewState = null;
|
|
}
|
|
ViewState.Results results = (ViewState.Results) viewState;
|
|
if (results != null && (firstUnicodeEmojiCategoryItem = results.getFirstUnicodeEmojiCategoryItem()) != null) {
|
|
setSelectedCategoryItemId(firstUnicodeEmojiCategoryItem.getStableId());
|
|
this.eventSubject.j.onNext(new Event.ScrollToEmojiListPosition(firstUnicodeEmojiCategoryItem.getCategoryRange().getFirst().intValue()));
|
|
}
|
|
}
|
|
|
|
public final void onEmojiSelected(Emoji emoji, Function1<? super Emoji, Unit> function1) {
|
|
int i;
|
|
m.checkNotNullParameter(emoji, "emoji");
|
|
m.checkNotNullParameter(function1, "validEmojiSelected");
|
|
ViewState viewState = getViewState();
|
|
List<MGRecyclerDataPayload> list = null;
|
|
if (!(viewState instanceof ViewState.Results)) {
|
|
viewState = null;
|
|
}
|
|
ViewState.Results results = (ViewState.Results) viewState;
|
|
if (results != null) {
|
|
list = results.getResultItems();
|
|
}
|
|
if (list == null) {
|
|
list = n.emptyList();
|
|
}
|
|
boolean z2 = false;
|
|
if (!(list instanceof Collection) || !list.isEmpty()) {
|
|
int i2 = 0;
|
|
for (MGRecyclerDataPayload mGRecyclerDataPayload : list) {
|
|
if ((mGRecyclerDataPayload instanceof WidgetEmojiAdapter.EmojiItem) && (i2 = i2 + 1) < 0) {
|
|
n.throwCountOverflow();
|
|
}
|
|
}
|
|
i = i2;
|
|
} else {
|
|
i = 0;
|
|
}
|
|
StoreAnalytics storeAnalytics = this.storeAnalytics;
|
|
StoreAnalytics.trackSearchResultSelected$default(storeAnalytics, SearchType.EMOJI, i, Traits.Location.copy$default(storeAnalytics.getEmojiPickerUpsellLocation(), null, null, "Search Result", null, null, 27, null), null, 8, null);
|
|
if (!emoji.isUsable()) {
|
|
if ((emoji instanceof ModelEmojiCustom) && ((ModelEmojiCustom) emoji).isAnimated()) {
|
|
z2 = true;
|
|
}
|
|
this.eventSubject.j.onNext(new Event.ShowPremiumUpsellDialog(z2 ? 2 : 1, z2 ? 2131892494 : 2131892502, z2 ? 2131892495 : 2131892503, "Emoji Picker Popout", false, false));
|
|
this.storeAnalytics.emojiPickerUpsellLockedItemClicked(this.emojiPickerContextType, z2);
|
|
} else if (emoji.isAvailable()) {
|
|
function1.invoke(emoji);
|
|
}
|
|
}
|
|
|
|
public final void onUpsellHeaderVisible() {
|
|
this.storeAnalytics.emojiPickerUpsellHeaderViewed(this.emojiPickerContextType);
|
|
this.logWhenUpsellHeaderIsViewed = false;
|
|
}
|
|
|
|
public final void setSearchText(String str) {
|
|
m.checkNotNullParameter(str, "searchText");
|
|
this.searchSubject.onNext(str);
|
|
StoreAnalytics storeAnalytics = this.storeAnalytics;
|
|
storeAnalytics.trackSearchStarted(SearchType.EMOJI, storeAnalytics.getEmojiPickerUpsellLocation(), true);
|
|
}
|
|
|
|
public final void setSelectedCategoryItemId(long j) {
|
|
this.selectedCategoryItemIdSubject.onNext(Long.valueOf(j));
|
|
}
|
|
}
|