872 lines
40 KiB
Java
872 lines
40 KiB
Java
package com.discord.widgets.channels;
|
|
|
|
import android.annotation.SuppressLint;
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.content.res.Resources;
|
|
import android.net.Uri;
|
|
import android.view.View;
|
|
import android.widget.RelativeLayout;
|
|
import androidx.fragment.app.Fragment;
|
|
import androidx.recyclerview.widget.RecyclerView;
|
|
import c.a.d.l;
|
|
import c.a.l.b;
|
|
import c.d.b.a.a;
|
|
import com.airbnb.lottie.parser.AnimatableValueParser;
|
|
import com.discord.api.channel.Channel;
|
|
import com.discord.app.AppActivity;
|
|
import com.discord.app.AppFragment;
|
|
import com.discord.app.AppViewFlipper;
|
|
import com.discord.chips_view.ChipsView;
|
|
import com.discord.databinding.WidgetGroupInviteFriendsBinding;
|
|
import com.discord.models.domain.ModelApplicationStream;
|
|
import com.discord.models.presence.Presence;
|
|
import com.discord.models.user.User;
|
|
import com.discord.stores.StoreStream;
|
|
import com.discord.utilities.analytics.AnalyticsTracker;
|
|
import com.discord.utilities.icon.IconUtils;
|
|
import com.discord.utilities.mg_recycler.MGRecyclerAdapter;
|
|
import com.discord.utilities.mg_recycler.MGRecyclerDataPayload;
|
|
import com.discord.utilities.resources.StringResourceUtilsKt;
|
|
import com.discord.utilities.rx.ObservableExtensionsKt;
|
|
import com.discord.utilities.viewbinding.FragmentViewBindingDelegate;
|
|
import com.discord.utilities.viewbinding.FragmentViewBindingDelegateKt;
|
|
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
|
import com.google.gson.internal.LinkedTreeMap;
|
|
import d0.t.n;
|
|
import d0.t.o;
|
|
import d0.t.u;
|
|
import d0.z.d.m;
|
|
import java.util.ArrayList;
|
|
import java.util.Collection;
|
|
import java.util.HashSet;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Objects;
|
|
import java.util.Set;
|
|
import kotlin.jvm.functions.Function0;
|
|
import kotlin.jvm.functions.Function1;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
import kotlin.reflect.KProperty;
|
|
import rx.Observable;
|
|
import rx.functions.Func2;
|
|
import rx.subjects.BehaviorSubject;
|
|
/* compiled from: WidgetGroupInviteFriends.kt */
|
|
public final class WidgetGroupInviteFriends extends AppFragment {
|
|
public static final /* synthetic */ KProperty[] $$delegatedProperties = {a.W(WidgetGroupInviteFriends.class, "binding", "getBinding()Lcom/discord/databinding/WidgetGroupInviteFriendsBinding;", 0)};
|
|
public static final Companion Companion = new Companion(null);
|
|
private static final String INTENT_EXTRA_CHANNEL_ID = "INTENT_EXTRA_CHANNEL_ID";
|
|
private static final int MAX_GROUP_MEMBERS = 10;
|
|
private static final int MAX_GROUP_MEMBERS_STAFF = 25;
|
|
private static final long NO_CHANNEL_ID = -1;
|
|
private static final int VIEW_INDEX_FRIENDS_LIST = 0;
|
|
private static final int VIEW_INDEX_GROUP_FULL = 2;
|
|
private static final int VIEW_INDEX_NO_FRIENDS = 1;
|
|
private WidgetGroupInviteFriendsAdapter adapter;
|
|
private final LinkedTreeMap<Long, User> addedUsers = new LinkedTreeMap<>();
|
|
private final BehaviorSubject<Collection<User>> addedUsersPublisher = BehaviorSubject.l0(new ArrayList());
|
|
private final FragmentViewBindingDelegate binding$delegate = FragmentViewBindingDelegateKt.viewBinding$default(this, WidgetGroupInviteFriends$binding$2.INSTANCE, null, 2, null);
|
|
private final BehaviorSubject<String> filterPublisher = BehaviorSubject.l0("");
|
|
|
|
/* compiled from: WidgetGroupInviteFriends.kt */
|
|
public static final class Companion {
|
|
private Companion() {
|
|
}
|
|
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
|
|
public final void launch(Context context, long j, String str) {
|
|
m.checkNotNullParameter(context, "context");
|
|
m.checkNotNullParameter(str, "source");
|
|
AnalyticsTracker.openModal$default("DM Group Add", str, null, 4, null);
|
|
Intent intent = new Intent();
|
|
intent.putExtra("INTENT_EXTRA_CHANNEL_ID", j);
|
|
l.d(context, WidgetGroupInviteFriends.class, intent);
|
|
}
|
|
|
|
public final void launch(Context context, String str) {
|
|
m.checkNotNullParameter(context, "context");
|
|
m.checkNotNullParameter(str, "source");
|
|
AnalyticsTracker.openModal$default("DM Group Create", str, null, 4, null);
|
|
l.e(context, WidgetGroupInviteFriends.class, null, 4);
|
|
}
|
|
}
|
|
|
|
/* compiled from: WidgetGroupInviteFriends.kt */
|
|
public static final class Model {
|
|
public static final Companion Companion = new Companion(null);
|
|
public static final int MODE_ADD = 1;
|
|
public static final int MODE_CREATE = 0;
|
|
private final Channel channel;
|
|
private final String filterText;
|
|
private final int maxGroupMemberCount;
|
|
private final int mode;
|
|
private final List<FriendItem> potentialAdditions;
|
|
private final Collection<User> selectedUsers;
|
|
|
|
/* compiled from: WidgetGroupInviteFriends.kt */
|
|
public static final class Companion {
|
|
|
|
/* compiled from: WidgetGroupInviteFriends.kt */
|
|
public static final class AddedUsersInput {
|
|
private final Collection<User> addedUsers;
|
|
private final String filter;
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r2v0, resolved type: java.util.Collection<? extends com.discord.models.user.User> */
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public AddedUsersInput(Collection<? extends User> collection, String str) {
|
|
m.checkNotNullParameter(collection, "addedUsers");
|
|
m.checkNotNullParameter(str, "filter");
|
|
this.addedUsers = collection;
|
|
this.filter = str;
|
|
}
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r0v0, resolved type: com.discord.widgets.channels.WidgetGroupInviteFriends$Model$Companion$AddedUsersInput */
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public static /* synthetic */ AddedUsersInput copy$default(AddedUsersInput addedUsersInput, Collection collection, String str, int i, Object obj) {
|
|
if ((i & 1) != 0) {
|
|
collection = addedUsersInput.addedUsers;
|
|
}
|
|
if ((i & 2) != 0) {
|
|
str = addedUsersInput.filter;
|
|
}
|
|
return addedUsersInput.copy(collection, str);
|
|
}
|
|
|
|
public final Collection<User> component1() {
|
|
return this.addedUsers;
|
|
}
|
|
|
|
public final String component2() {
|
|
return this.filter;
|
|
}
|
|
|
|
public final AddedUsersInput copy(Collection<? extends User> collection, String str) {
|
|
m.checkNotNullParameter(collection, "addedUsers");
|
|
m.checkNotNullParameter(str, "filter");
|
|
return new AddedUsersInput(collection, str);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof AddedUsersInput)) {
|
|
return false;
|
|
}
|
|
AddedUsersInput addedUsersInput = (AddedUsersInput) obj;
|
|
return m.areEqual(this.addedUsers, addedUsersInput.addedUsers) && m.areEqual(this.filter, addedUsersInput.filter);
|
|
}
|
|
|
|
public final Collection<User> getAddedUsers() {
|
|
return this.addedUsers;
|
|
}
|
|
|
|
public final String getFilter() {
|
|
return this.filter;
|
|
}
|
|
|
|
public int hashCode() {
|
|
Collection<User> collection = this.addedUsers;
|
|
int i = 0;
|
|
int hashCode = (collection != null ? collection.hashCode() : 0) * 31;
|
|
String str = this.filter;
|
|
if (str != null) {
|
|
i = str.hashCode();
|
|
}
|
|
return hashCode + i;
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder L = a.L("AddedUsersInput(addedUsers=");
|
|
L.append(this.addedUsers);
|
|
L.append(", filter=");
|
|
return a.D(L, this.filter, ")");
|
|
}
|
|
}
|
|
|
|
private Companion() {
|
|
}
|
|
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
|
|
public static final /* synthetic */ Observable access$getFilteredFriends(Companion companion, Collection collection, String str) {
|
|
return companion.getFilteredFriends(collection, str);
|
|
}
|
|
|
|
@SuppressLint({"DefaultLocale"})
|
|
private final Observable<ModelAppUserRelationship> getFilteredFriends(Collection<? extends User> collection, String str) {
|
|
if (collection == null) {
|
|
collection = n.emptyList();
|
|
}
|
|
Observable<ModelAppUserRelationship> Y = Observable.A(collection).F(WidgetGroupInviteFriends$Model$Companion$getFilteredFriends$1.INSTANCE).f0().z(new WidgetGroupInviteFriends$Model$Companion$getFilteredFriends$2(str)).Y(WidgetGroupInviteFriends$Model$Companion$getFilteredFriends$3.INSTANCE);
|
|
m.checkNotNullExpressionValue(Y, "Observable\n .… }\n }");
|
|
return Y;
|
|
}
|
|
|
|
private final Observable<Model> getForAdd(long j, Observable<Collection<User>> observable, Observable<String> observable2) {
|
|
Observable<R> Y = StoreStream.Companion.getChannels().observeChannel(j).Y(new WidgetGroupInviteFriends$Model$Companion$getForAdd$1(observable, observable2));
|
|
m.checkNotNullExpressionValue(Y, "StoreStream\n … }\n }");
|
|
return Y;
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
/* JADX WARNING: Unknown variable types count: 1 */
|
|
private final Observable<Model> getForCreate(Observable<Collection<User>> observable, Observable<String> observable2) {
|
|
WidgetGroupInviteFriends$Model$Companion$getForCreate$1 widgetGroupInviteFriends$Model$Companion$getForCreate$1 = WidgetGroupInviteFriends$Model$Companion$getForCreate$1.INSTANCE;
|
|
if (widgetGroupInviteFriends$Model$Companion$getForCreate$1 != null) {
|
|
widgetGroupInviteFriends$Model$Companion$getForCreate$1 = new WidgetGroupInviteFriends$sam$rx_functions_Func2$0(widgetGroupInviteFriends$Model$Companion$getForCreate$1);
|
|
}
|
|
Observable<Model> Y = Observable.j(observable, observable2, (Func2) widgetGroupInviteFriends$Model$Companion$getForCreate$1).Y(WidgetGroupInviteFriends$Model$Companion$getForCreate$2.INSTANCE);
|
|
m.checkNotNullExpressionValue(Y, "Observable\n .… }\n }");
|
|
return Y;
|
|
}
|
|
|
|
public static /* synthetic */ void getMODE_CREATE$annotations() {
|
|
}
|
|
|
|
public final Observable<Model> get(long j, Observable<Collection<User>> observable, Observable<String> observable2) {
|
|
m.checkNotNullParameter(observable, "addedUsersPublisher");
|
|
m.checkNotNullParameter(observable2, "filterPublisher");
|
|
return j == -1 ? getForCreate(observable, observable2) : getForAdd(j, observable, observable2);
|
|
}
|
|
|
|
public final Observable<? extends Collection<User>> getFriendChanges(Observable<Collection<User>> observable) {
|
|
m.checkNotNullParameter(observable, "addedUsers");
|
|
Observable<? extends Collection<User>> r = StoreStream.Companion.getUserRelationships().observeForType(1).Y(new WidgetGroupInviteFriends$Model$Companion$getFriendChanges$1(observable)).r();
|
|
m.checkNotNullExpressionValue(r, "StoreStream\n … .distinctUntilChanged()");
|
|
return r;
|
|
}
|
|
}
|
|
|
|
/* compiled from: WidgetGroupInviteFriends.kt */
|
|
public static final class FriendItem implements MGRecyclerDataPayload {
|
|
public static final Companion Companion = new Companion(null);
|
|
public static final int TYPE_FRIEND = 0;
|
|
private final boolean isApplicationStreaming;
|
|
private final boolean isSelected;
|
|
private final String key;
|
|
private final Presence presence;
|
|
private final int type;
|
|
private final User user;
|
|
|
|
/* compiled from: WidgetGroupInviteFriends.kt */
|
|
public static final class Companion {
|
|
private Companion() {
|
|
}
|
|
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
|
|
public final List<FriendItem> createData(ModelAppUserRelationship modelAppUserRelationship, Collection<? extends User> collection) {
|
|
m.checkNotNullParameter(modelAppUserRelationship, "friends");
|
|
m.checkNotNullParameter(collection, "alreadyAddedUsers");
|
|
ArrayList arrayList = new ArrayList(o.collectionSizeOrDefault(collection, 10));
|
|
for (User user : collection) {
|
|
arrayList.add(Long.valueOf(user.getId()));
|
|
}
|
|
Set set = u.toSet(arrayList);
|
|
Set<Long> keySet = modelAppUserRelationship.getUsers().keySet();
|
|
ArrayList arrayList2 = new ArrayList(o.collectionSizeOrDefault(keySet, 10));
|
|
for (Number number : keySet) {
|
|
long longValue = number.longValue();
|
|
arrayList2.add(new FriendItem(modelAppUserRelationship.getUsers().get(Long.valueOf(longValue)), modelAppUserRelationship.getPresences().get(Long.valueOf(longValue)), set.contains(Long.valueOf(longValue)), modelAppUserRelationship.getStreams().containsKey(Long.valueOf(longValue))));
|
|
}
|
|
return arrayList2;
|
|
}
|
|
}
|
|
|
|
public FriendItem() {
|
|
this(null, null, false, false, 15, null);
|
|
}
|
|
|
|
public FriendItem(User user, Presence presence, boolean z2, boolean z3) {
|
|
this.user = user;
|
|
this.presence = presence;
|
|
this.isSelected = z2;
|
|
this.isApplicationStreaming = z3;
|
|
this.key = String.valueOf(user != null ? Long.valueOf(user.getId()) : null);
|
|
}
|
|
|
|
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
|
|
public /* synthetic */ FriendItem(User user, Presence presence, boolean z2, boolean z3, int i, DefaultConstructorMarker defaultConstructorMarker) {
|
|
this((i & 1) != 0 ? null : user, (i & 2) != 0 ? null : presence, (i & 4) != 0 ? false : z2, (i & 8) != 0 ? false : z3);
|
|
}
|
|
|
|
public static /* synthetic */ FriendItem copy$default(FriendItem friendItem, User user, Presence presence, boolean z2, boolean z3, int i, Object obj) {
|
|
if ((i & 1) != 0) {
|
|
user = friendItem.user;
|
|
}
|
|
if ((i & 2) != 0) {
|
|
presence = friendItem.presence;
|
|
}
|
|
if ((i & 4) != 0) {
|
|
z2 = friendItem.isSelected;
|
|
}
|
|
if ((i & 8) != 0) {
|
|
z3 = friendItem.isApplicationStreaming;
|
|
}
|
|
return friendItem.copy(user, presence, z2, z3);
|
|
}
|
|
|
|
public final User component1() {
|
|
return this.user;
|
|
}
|
|
|
|
public final Presence component2() {
|
|
return this.presence;
|
|
}
|
|
|
|
public final boolean component3() {
|
|
return this.isSelected;
|
|
}
|
|
|
|
public final boolean component4() {
|
|
return this.isApplicationStreaming;
|
|
}
|
|
|
|
public final FriendItem copy(User user, Presence presence, boolean z2, boolean z3) {
|
|
return new FriendItem(user, presence, z2, z3);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof FriendItem)) {
|
|
return false;
|
|
}
|
|
FriendItem friendItem = (FriendItem) obj;
|
|
return m.areEqual(this.user, friendItem.user) && m.areEqual(this.presence, friendItem.presence) && this.isSelected == friendItem.isSelected && this.isApplicationStreaming == friendItem.isApplicationStreaming;
|
|
}
|
|
|
|
@Override // com.discord.utilities.mg_recycler.MGRecyclerDataPayload, com.discord.utilities.recycler.DiffKeyProvider
|
|
public String getKey() {
|
|
return this.key;
|
|
}
|
|
|
|
public final Presence getPresence() {
|
|
return this.presence;
|
|
}
|
|
|
|
@Override // com.discord.utilities.mg_recycler.MGRecyclerDataPayload
|
|
public int getType() {
|
|
return this.type;
|
|
}
|
|
|
|
public final User getUser() {
|
|
return this.user;
|
|
}
|
|
|
|
public int hashCode() {
|
|
User user = this.user;
|
|
int i = 0;
|
|
int hashCode = (user != null ? user.hashCode() : 0) * 31;
|
|
Presence presence = this.presence;
|
|
if (presence != null) {
|
|
i = presence.hashCode();
|
|
}
|
|
int i2 = (hashCode + i) * 31;
|
|
boolean z2 = this.isSelected;
|
|
int i3 = 1;
|
|
if (z2) {
|
|
z2 = true;
|
|
}
|
|
int i4 = z2 ? 1 : 0;
|
|
int i5 = z2 ? 1 : 0;
|
|
int i6 = z2 ? 1 : 0;
|
|
int i7 = (i2 + i4) * 31;
|
|
boolean z3 = this.isApplicationStreaming;
|
|
if (!z3) {
|
|
i3 = z3 ? 1 : 0;
|
|
}
|
|
return i7 + i3;
|
|
}
|
|
|
|
public final boolean isApplicationStreaming() {
|
|
return this.isApplicationStreaming;
|
|
}
|
|
|
|
public final boolean isSelected() {
|
|
return this.isSelected;
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder L = a.L("FriendItem(user=");
|
|
L.append(this.user);
|
|
L.append(", presence=");
|
|
L.append(this.presence);
|
|
L.append(", isSelected=");
|
|
L.append(this.isSelected);
|
|
L.append(", isApplicationStreaming=");
|
|
return a.G(L, this.isApplicationStreaming, ")");
|
|
}
|
|
}
|
|
|
|
/* compiled from: WidgetGroupInviteFriends.kt */
|
|
public static final class ModelAppUserRelationship {
|
|
private final Map<Long, Presence> presences;
|
|
private final Map<Long, Integer> relationships;
|
|
private final Map<Long, ModelApplicationStream> streams;
|
|
private final Map<Long, User> users;
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r4v0, resolved type: java.util.Map<java.lang.Long, ? extends com.discord.models.user.User> */
|
|
/* JADX DEBUG: Multi-variable search result rejected for r5v0, resolved type: java.util.Map<java.lang.Long, ? extends com.discord.models.domain.ModelApplicationStream> */
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public ModelAppUserRelationship(Map<Long, Integer> map, Map<Long, Presence> map2, Map<Long, ? extends User> map3, Map<Long, ? extends ModelApplicationStream> map4) {
|
|
m.checkNotNullParameter(map, "relationships");
|
|
m.checkNotNullParameter(map2, "presences");
|
|
m.checkNotNullParameter(map3, "users");
|
|
m.checkNotNullParameter(map4, "streams");
|
|
this.relationships = map;
|
|
this.presences = map2;
|
|
this.users = map3;
|
|
this.streams = map4;
|
|
}
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r0v0, resolved type: com.discord.widgets.channels.WidgetGroupInviteFriends$Model$ModelAppUserRelationship */
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public static /* synthetic */ ModelAppUserRelationship copy$default(ModelAppUserRelationship modelAppUserRelationship, Map map, Map map2, Map map3, Map map4, int i, Object obj) {
|
|
if ((i & 1) != 0) {
|
|
map = modelAppUserRelationship.relationships;
|
|
}
|
|
if ((i & 2) != 0) {
|
|
map2 = modelAppUserRelationship.presences;
|
|
}
|
|
if ((i & 4) != 0) {
|
|
map3 = modelAppUserRelationship.users;
|
|
}
|
|
if ((i & 8) != 0) {
|
|
map4 = modelAppUserRelationship.streams;
|
|
}
|
|
return modelAppUserRelationship.copy(map, map2, map3, map4);
|
|
}
|
|
|
|
public final Map<Long, Integer> component1() {
|
|
return this.relationships;
|
|
}
|
|
|
|
public final Map<Long, Presence> component2() {
|
|
return this.presences;
|
|
}
|
|
|
|
public final Map<Long, User> component3() {
|
|
return this.users;
|
|
}
|
|
|
|
public final Map<Long, ModelApplicationStream> component4() {
|
|
return this.streams;
|
|
}
|
|
|
|
public final ModelAppUserRelationship copy(Map<Long, Integer> map, Map<Long, Presence> map2, Map<Long, ? extends User> map3, Map<Long, ? extends ModelApplicationStream> map4) {
|
|
m.checkNotNullParameter(map, "relationships");
|
|
m.checkNotNullParameter(map2, "presences");
|
|
m.checkNotNullParameter(map3, "users");
|
|
m.checkNotNullParameter(map4, "streams");
|
|
return new ModelAppUserRelationship(map, map2, map3, map4);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof ModelAppUserRelationship)) {
|
|
return false;
|
|
}
|
|
ModelAppUserRelationship modelAppUserRelationship = (ModelAppUserRelationship) obj;
|
|
return m.areEqual(this.relationships, modelAppUserRelationship.relationships) && m.areEqual(this.presences, modelAppUserRelationship.presences) && m.areEqual(this.users, modelAppUserRelationship.users) && m.areEqual(this.streams, modelAppUserRelationship.streams);
|
|
}
|
|
|
|
public final Map<Long, Presence> getPresences() {
|
|
return this.presences;
|
|
}
|
|
|
|
public final Map<Long, Integer> getRelationships() {
|
|
return this.relationships;
|
|
}
|
|
|
|
public final Map<Long, ModelApplicationStream> getStreams() {
|
|
return this.streams;
|
|
}
|
|
|
|
public final Map<Long, User> getUsers() {
|
|
return this.users;
|
|
}
|
|
|
|
public int hashCode() {
|
|
Map<Long, Integer> map = this.relationships;
|
|
int i = 0;
|
|
int hashCode = (map != null ? map.hashCode() : 0) * 31;
|
|
Map<Long, Presence> map2 = this.presences;
|
|
int hashCode2 = (hashCode + (map2 != null ? map2.hashCode() : 0)) * 31;
|
|
Map<Long, User> map3 = this.users;
|
|
int hashCode3 = (hashCode2 + (map3 != null ? map3.hashCode() : 0)) * 31;
|
|
Map<Long, ModelApplicationStream> map4 = this.streams;
|
|
if (map4 != null) {
|
|
i = map4.hashCode();
|
|
}
|
|
return hashCode3 + i;
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder L = a.L("ModelAppUserRelationship(relationships=");
|
|
L.append(this.relationships);
|
|
L.append(", presences=");
|
|
L.append(this.presences);
|
|
L.append(", users=");
|
|
L.append(this.users);
|
|
L.append(", streams=");
|
|
return a.F(L, this.streams, ")");
|
|
}
|
|
}
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r4v0, resolved type: java.util.Collection<? extends com.discord.models.user.User> */
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public Model(Channel channel, String str, Collection<? extends User> collection, List<FriendItem> list, int i, int i2) {
|
|
m.checkNotNullParameter(collection, "selectedUsers");
|
|
m.checkNotNullParameter(list, "potentialAdditions");
|
|
this.channel = channel;
|
|
this.filterText = str;
|
|
this.selectedUsers = collection;
|
|
this.potentialAdditions = list;
|
|
this.mode = i;
|
|
this.maxGroupMemberCount = i2;
|
|
}
|
|
|
|
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
|
|
public /* synthetic */ Model(Channel channel, String str, Collection collection, List list, int i, int i2, int i3, DefaultConstructorMarker defaultConstructorMarker) {
|
|
this((i3 & 1) != 0 ? null : channel, (i3 & 2) != 0 ? null : str, collection, list, (i3 & 16) != 0 ? 0 : i, i2);
|
|
}
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r4v0, resolved type: com.discord.widgets.channels.WidgetGroupInviteFriends$Model */
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public static /* synthetic */ Model copy$default(Model model, Channel channel, String str, Collection collection, List list, int i, int i2, int i3, Object obj) {
|
|
if ((i3 & 1) != 0) {
|
|
channel = model.channel;
|
|
}
|
|
if ((i3 & 2) != 0) {
|
|
str = model.filterText;
|
|
}
|
|
if ((i3 & 4) != 0) {
|
|
collection = model.selectedUsers;
|
|
}
|
|
if ((i3 & 8) != 0) {
|
|
list = model.potentialAdditions;
|
|
}
|
|
if ((i3 & 16) != 0) {
|
|
i = model.mode;
|
|
}
|
|
if ((i3 & 32) != 0) {
|
|
i2 = model.maxGroupMemberCount;
|
|
}
|
|
return model.copy(channel, str, collection, list, i, i2);
|
|
}
|
|
|
|
public final Channel component1() {
|
|
return this.channel;
|
|
}
|
|
|
|
public final String component2() {
|
|
return this.filterText;
|
|
}
|
|
|
|
public final Collection<User> component3() {
|
|
return this.selectedUsers;
|
|
}
|
|
|
|
public final List<FriendItem> component4() {
|
|
return this.potentialAdditions;
|
|
}
|
|
|
|
public final int component5() {
|
|
return this.mode;
|
|
}
|
|
|
|
public final int component6() {
|
|
return this.maxGroupMemberCount;
|
|
}
|
|
|
|
public final Model copy(Channel channel, String str, Collection<? extends User> collection, List<FriendItem> list, int i, int i2) {
|
|
m.checkNotNullParameter(collection, "selectedUsers");
|
|
m.checkNotNullParameter(list, "potentialAdditions");
|
|
return new Model(channel, str, collection, list, i, i2);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof Model)) {
|
|
return false;
|
|
}
|
|
Model model = (Model) obj;
|
|
return m.areEqual(this.channel, model.channel) && m.areEqual(this.filterText, model.filterText) && m.areEqual(this.selectedUsers, model.selectedUsers) && m.areEqual(this.potentialAdditions, model.potentialAdditions) && this.mode == model.mode && this.maxGroupMemberCount == model.maxGroupMemberCount;
|
|
}
|
|
|
|
public final Channel getChannel() {
|
|
return this.channel;
|
|
}
|
|
|
|
public final String getFilterText() {
|
|
return this.filterText;
|
|
}
|
|
|
|
public final int getMaxGroupMemberCount() {
|
|
return this.maxGroupMemberCount;
|
|
}
|
|
|
|
public final int getMode() {
|
|
return this.mode;
|
|
}
|
|
|
|
public final List<FriendItem> getPotentialAdditions() {
|
|
return this.potentialAdditions;
|
|
}
|
|
|
|
public final Collection<User> getSelectedUsers() {
|
|
return this.selectedUsers;
|
|
}
|
|
|
|
public final int getTotalNumRecipients() {
|
|
int size = this.selectedUsers.size() + 1;
|
|
Channel channel = this.channel;
|
|
if (channel == null) {
|
|
return size;
|
|
}
|
|
List<com.discord.api.user.User> w = channel.w();
|
|
return size + (w != null ? w.size() : 0);
|
|
}
|
|
|
|
public int hashCode() {
|
|
Channel channel = this.channel;
|
|
int i = 0;
|
|
int hashCode = (channel != null ? channel.hashCode() : 0) * 31;
|
|
String str = this.filterText;
|
|
int hashCode2 = (hashCode + (str != null ? str.hashCode() : 0)) * 31;
|
|
Collection<User> collection = this.selectedUsers;
|
|
int hashCode3 = (hashCode2 + (collection != null ? collection.hashCode() : 0)) * 31;
|
|
List<FriendItem> list = this.potentialAdditions;
|
|
if (list != null) {
|
|
i = list.hashCode();
|
|
}
|
|
return ((((hashCode3 + i) * 31) + this.mode) * 31) + this.maxGroupMemberCount;
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder L = a.L("Model(channel=");
|
|
L.append(this.channel);
|
|
L.append(", filterText=");
|
|
L.append(this.filterText);
|
|
L.append(", selectedUsers=");
|
|
L.append(this.selectedUsers);
|
|
L.append(", potentialAdditions=");
|
|
L.append(this.potentialAdditions);
|
|
L.append(", mode=");
|
|
L.append(this.mode);
|
|
L.append(", maxGroupMemberCount=");
|
|
return a.z(L, this.maxGroupMemberCount, ")");
|
|
}
|
|
}
|
|
|
|
/* compiled from: WidgetGroupInviteFriends.kt */
|
|
public static final class UserDataContract implements ChipsView.a {
|
|
private final String displayString;
|
|
private final User modelUser;
|
|
|
|
public UserDataContract(User user) {
|
|
this.modelUser = user;
|
|
this.displayString = user != null ? user.getUsername() : null;
|
|
}
|
|
|
|
@Override // com.discord.chips_view.ChipsView.a
|
|
public String getDisplayString() {
|
|
return this.displayString;
|
|
}
|
|
|
|
public final User getModelUser() {
|
|
return this.modelUser;
|
|
}
|
|
}
|
|
|
|
public WidgetGroupInviteFriends() {
|
|
super(2131559029);
|
|
}
|
|
|
|
public static final /* synthetic */ void access$configureUI(WidgetGroupInviteFriends widgetGroupInviteFriends, Model model) {
|
|
widgetGroupInviteFriends.configureUI(model);
|
|
}
|
|
|
|
public static final /* synthetic */ BehaviorSubject access$getFilterPublisher$p(WidgetGroupInviteFriends widgetGroupInviteFriends) {
|
|
return widgetGroupInviteFriends.filterPublisher;
|
|
}
|
|
|
|
public static final /* synthetic */ void access$selectUser(WidgetGroupInviteFriends widgetGroupInviteFriends, User user) {
|
|
widgetGroupInviteFriends.selectUser(user);
|
|
}
|
|
|
|
public static final /* synthetic */ void access$unselectUser(WidgetGroupInviteFriends widgetGroupInviteFriends, User user) {
|
|
widgetGroupInviteFriends.unselectUser(user);
|
|
}
|
|
|
|
private final void configureUI(Model model) {
|
|
int i;
|
|
List<com.discord.api.user.User> w;
|
|
if (model == null || (model.getMode() == 1 && model.getChannel() == null)) {
|
|
AppActivity appActivity = getAppActivity();
|
|
if (appActivity != null) {
|
|
appActivity.finish();
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
HashSet hashSet = new HashSet();
|
|
Iterator<User> it = model.getSelectedUsers().iterator();
|
|
while (true) {
|
|
i = 0;
|
|
if (!it.hasNext()) {
|
|
break;
|
|
}
|
|
User next = it.next();
|
|
getBinding().b.b(next.getUsername(), Uri.parse(IconUtils.getForUser$default(next, false, null, 6, null)), Long.valueOf(next.getId()), new UserDataContract(next));
|
|
hashSet.add(Long.valueOf(next.getId()));
|
|
}
|
|
String filterText = model.getFilterText();
|
|
if (filterText != null) {
|
|
if (filterText.length() > 0) {
|
|
if (getBinding().b.getText().length() == 0) {
|
|
getBinding().b.setText(model.getFilterText());
|
|
}
|
|
}
|
|
}
|
|
getBinding().b.e(hashSet);
|
|
List<Model.FriendItem> potentialAdditions = model.getPotentialAdditions();
|
|
Channel channel = model.getChannel();
|
|
if (!(channel == null || (w = channel.w()) == null)) {
|
|
i = w.size();
|
|
}
|
|
AppViewFlipper appViewFlipper = getBinding().f;
|
|
m.checkNotNullExpressionValue(appViewFlipper, "binding.groupInviteFriendsViewFlipper");
|
|
appViewFlipper.setDisplayedChild(getChildToDisplay(model.getMaxGroupMemberCount(), 1 + i, potentialAdditions));
|
|
WidgetGroupInviteFriendsAdapter widgetGroupInviteFriendsAdapter = this.adapter;
|
|
if (widgetGroupInviteFriendsAdapter != null) {
|
|
widgetGroupInviteFriendsAdapter.setData(potentialAdditions, new WidgetGroupInviteFriends$configureUI$1(this, model));
|
|
}
|
|
setupFAB(model);
|
|
setupToolbar(model);
|
|
}
|
|
|
|
private final WidgetGroupInviteFriendsBinding getBinding() {
|
|
return (WidgetGroupInviteFriendsBinding) this.binding$delegate.getValue((Fragment) this, $$delegatedProperties[0]);
|
|
}
|
|
|
|
private final int getChildToDisplay(int i, int i2, List<Model.FriendItem> list) {
|
|
if (i2 >= i) {
|
|
return 2;
|
|
}
|
|
return list == null || list.isEmpty() ? 1 : 0;
|
|
}
|
|
|
|
private final void selectUser(User user) {
|
|
getBinding().b.b(user.getUsername(), Uri.parse(IconUtils.getForUser$default(user, false, null, 6, null)), Long.valueOf(user.getId()), new UserDataContract(user));
|
|
this.addedUsers.put(Long.valueOf(user.getId()), user);
|
|
this.addedUsersPublisher.onNext(new ArrayList(this.addedUsers.values()));
|
|
}
|
|
|
|
@SuppressLint({"RestrictedApi"})
|
|
private final void setupFAB(Model model) {
|
|
if (!model.getSelectedUsers().isEmpty()) {
|
|
FloatingActionButton floatingActionButton = getBinding().e;
|
|
m.checkNotNullExpressionValue(floatingActionButton, "binding.groupInviteFriendsSaveFab");
|
|
floatingActionButton.setVisibility(0);
|
|
if (model.getTotalNumRecipients() > model.getMaxGroupMemberCount()) {
|
|
getBinding().e.setOnClickListener(new WidgetGroupInviteFriends$setupFAB$1(this));
|
|
} else {
|
|
getBinding().e.setOnClickListener(new WidgetGroupInviteFriends$setupFAB$2(this, model));
|
|
}
|
|
} else {
|
|
FloatingActionButton floatingActionButton2 = getBinding().e;
|
|
m.checkNotNullExpressionValue(floatingActionButton2, "binding.groupInviteFriendsSaveFab");
|
|
floatingActionButton2.setVisibility(8);
|
|
}
|
|
}
|
|
|
|
private final void setupToolbar(Model model) {
|
|
CharSequence charSequence;
|
|
if (model.getChannel() != null) {
|
|
setActionBarTitle(b.j(this, 2131889160, new Object[]{AnimatableValueParser.A0(model.getChannel(), requireContext(), false, 2)}, null, 4));
|
|
} else {
|
|
setActionBarTitle(getString(2131890613));
|
|
}
|
|
if (model.getChannel() != null) {
|
|
List<com.discord.api.user.User> w = model.getChannel().w();
|
|
if ((w != null ? w.size() : 1) >= model.getMaxGroupMemberCount()) {
|
|
charSequence = getString(2131889147);
|
|
m.checkNotNullExpressionValue(charSequence, "getString(R.string.group_dm_invite_full_main)");
|
|
RelativeLayout relativeLayout = getBinding().f1791c;
|
|
m.checkNotNullExpressionValue(relativeLayout, "binding.groupInviteFriendsRecipientsContainer");
|
|
relativeLayout.setVisibility(8);
|
|
setActionBarSubtitle(charSequence);
|
|
}
|
|
}
|
|
int maxGroupMemberCount = model.getMaxGroupMemberCount() - model.getTotalNumRecipients();
|
|
if (maxGroupMemberCount > 0) {
|
|
Resources resources = getResources();
|
|
m.checkNotNullExpressionValue(resources, "resources");
|
|
charSequence = StringResourceUtilsKt.getQuantityString(resources, requireContext(), 2131755130, maxGroupMemberCount, Integer.valueOf(maxGroupMemberCount));
|
|
} else if (maxGroupMemberCount == 0) {
|
|
charSequence = getString(2131889159);
|
|
m.checkNotNullExpressionValue(charSequence, "getString(R.string.group…_invite_will_fill_mobile)");
|
|
} else {
|
|
int i = maxGroupMemberCount * -1;
|
|
Resources resources2 = getResources();
|
|
m.checkNotNullExpressionValue(resources2, "resources");
|
|
charSequence = StringResourceUtilsKt.getQuantityString(resources2, requireContext(), 2131755131, i, Integer.valueOf(i));
|
|
}
|
|
RelativeLayout relativeLayout2 = getBinding().f1791c;
|
|
m.checkNotNullExpressionValue(relativeLayout2, "binding.groupInviteFriendsRecipientsContainer");
|
|
relativeLayout2.setVisibility(0);
|
|
setActionBarSubtitle(charSequence);
|
|
}
|
|
|
|
private final void unselectUser(User user) {
|
|
this.addedUsers.remove(Long.valueOf(user.getId()));
|
|
this.addedUsersPublisher.onNext(new ArrayList(this.addedUsers.values()));
|
|
}
|
|
|
|
@Override // com.discord.app.AppFragment
|
|
public void onViewBound(View view) {
|
|
m.checkNotNullParameter(view, "view");
|
|
super.onViewBound(view);
|
|
MGRecyclerAdapter.Companion companion = MGRecyclerAdapter.Companion;
|
|
RecyclerView recyclerView = getBinding().d;
|
|
m.checkNotNullExpressionValue(recyclerView, "binding.groupInviteFriendsRecycler");
|
|
this.adapter = (WidgetGroupInviteFriendsAdapter) companion.configure(new WidgetGroupInviteFriendsAdapter(recyclerView));
|
|
}
|
|
|
|
@Override // com.discord.app.AppFragment
|
|
public void onViewBoundOrOnResume() {
|
|
super.onViewBoundOrOnResume();
|
|
AppFragment.setActionBarDisplayHomeAsUpEnabled$default(this, false, 1, null);
|
|
ChipsView chipsView = getBinding().b;
|
|
Objects.requireNonNull(chipsView, "null cannot be cast to non-null type com.discord.chips_view.ChipsView<kotlin.Long, com.discord.widgets.channels.WidgetGroupInviteFriends.UserDataContract>");
|
|
chipsView.setChipDeletedListener(new WidgetGroupInviteFriends$onViewBoundOrOnResume$1(this));
|
|
getBinding().b.setTextChangedListener(new WidgetGroupInviteFriends$onViewBoundOrOnResume$2(this));
|
|
Model.Companion companion = Model.Companion;
|
|
BehaviorSubject<Collection<User>> behaviorSubject = this.addedUsersPublisher;
|
|
m.checkNotNullExpressionValue(behaviorSubject, "addedUsersPublisher");
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui(companion.getFriendChanges(behaviorSubject), this, this.adapter), WidgetGroupInviteFriends.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetGroupInviteFriends$onViewBoundOrOnResume$3(this.addedUsersPublisher), 62, (Object) null);
|
|
long longExtra = getMostRecentIntent().getLongExtra("INTENT_EXTRA_CHANNEL_ID", -1);
|
|
BehaviorSubject<Collection<User>> behaviorSubject2 = this.addedUsersPublisher;
|
|
m.checkNotNullExpressionValue(behaviorSubject2, "addedUsersPublisher");
|
|
BehaviorSubject<String> behaviorSubject3 = this.filterPublisher;
|
|
m.checkNotNullExpressionValue(behaviorSubject3, "filterPublisher");
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui(companion.get(longExtra, behaviorSubject2, behaviorSubject3), this, this.adapter), WidgetGroupInviteFriends.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetGroupInviteFriends$onViewBoundOrOnResume$4(this), 62, (Object) null);
|
|
}
|
|
}
|