546 lines
25 KiB
Java
546 lines
25 KiB
Java
package com.discord.widgets.channels.permissions;
|
|
|
|
import android.content.Context;
|
|
import androidx.annotation.MainThread;
|
|
import c.d.b.a.a;
|
|
import com.discord.api.channel.Channel;
|
|
import com.discord.api.permission.PermissionOverwrite;
|
|
import com.discord.api.role.GuildRole;
|
|
import com.discord.app.AppViewModel;
|
|
import com.discord.models.guild.Guild;
|
|
import com.discord.models.member.GuildMember;
|
|
import com.discord.models.user.User;
|
|
import com.discord.stores.StoreChannels;
|
|
import com.discord.stores.StoreGatewayConnection;
|
|
import com.discord.stores.StoreGuilds;
|
|
import com.discord.stores.StoreStream;
|
|
import com.discord.stores.StoreUser;
|
|
import com.discord.utilities.permissions.PermissionUtils;
|
|
import com.discord.utilities.rx.ObservableExtensionsKt;
|
|
import com.discord.utilities.rx.ObservableExtensionsKt$filterNull$1;
|
|
import com.discord.utilities.rx.ObservableExtensionsKt$filterNull$2;
|
|
import com.discord.widgets.channels.permissions.AddMemberAdapter;
|
|
import com.discord.widgets.channels.permissions.PermissionOwner;
|
|
import d0.g0.w;
|
|
import d0.t.u;
|
|
import d0.z.d.m;
|
|
import d0.z.d.o;
|
|
import java.util.ArrayList;
|
|
import java.util.Collection;
|
|
import java.util.HashMap;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Objects;
|
|
import java.util.Set;
|
|
import kotlin.NoWhenBranchMatchedException;
|
|
import kotlin.Pair;
|
|
import kotlin.Unit;
|
|
import kotlin.jvm.functions.Function0;
|
|
import kotlin.jvm.functions.Function1;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
import rx.Observable;
|
|
/* compiled from: WidgetChannelSettingsAddMemberFragmentViewModel.kt */
|
|
public final class WidgetChannelSettingsAddMemberFragmentViewModel extends AppViewModel<ViewState> {
|
|
public static final Companion Companion = new Companion(null);
|
|
private final long channelId;
|
|
private final StoreChannels channelsStore;
|
|
private final StoreGatewayConnection gatewaySocket;
|
|
private final StoreGuilds guildsStore;
|
|
private String query;
|
|
private final HashMap<Long, PermissionOverwrite.Type> selected;
|
|
private final boolean showRolesWithGuildPermission;
|
|
private StoreState storeState;
|
|
private final StoreUser userStore;
|
|
|
|
/* compiled from: WidgetChannelSettingsAddMemberFragmentViewModel.kt */
|
|
/* renamed from: com.discord.widgets.channels.permissions.WidgetChannelSettingsAddMemberFragmentViewModel$1 reason: invalid class name */
|
|
public static final class AnonymousClass1 extends o implements Function1<StoreState, Unit> {
|
|
public final /* synthetic */ WidgetChannelSettingsAddMemberFragmentViewModel this$0;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public AnonymousClass1(WidgetChannelSettingsAddMemberFragmentViewModel widgetChannelSettingsAddMemberFragmentViewModel) {
|
|
super(1);
|
|
this.this$0 = widgetChannelSettingsAddMemberFragmentViewModel;
|
|
}
|
|
|
|
/* 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");
|
|
WidgetChannelSettingsAddMemberFragmentViewModel.access$handleStoreState(this.this$0, storeState);
|
|
}
|
|
}
|
|
|
|
/* compiled from: WidgetChannelSettingsAddMemberFragmentViewModel.kt */
|
|
public static final class Companion {
|
|
private Companion() {
|
|
}
|
|
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
|
|
public static final /* synthetic */ Observable access$observeStoreState(Companion companion, long j, StoreChannels storeChannels, StoreGuilds storeGuilds, StoreUser storeUser) {
|
|
return companion.observeStoreState(j, storeChannels, storeGuilds, storeUser);
|
|
}
|
|
|
|
private final Observable<StoreState> observeStoreState(long j, StoreChannels storeChannels, StoreGuilds storeGuilds, StoreUser storeUser) {
|
|
Observable<R> F = storeChannels.observeChannel(j).x(ObservableExtensionsKt$filterNull$1.INSTANCE).F(ObservableExtensionsKt$filterNull$2.INSTANCE);
|
|
m.checkNotNullExpressionValue(F, "filter { it != null }.map { it!! }");
|
|
Observable<StoreState> Y = F.r().Y(new WidgetChannelSettingsAddMemberFragmentViewModel$Companion$observeStoreState$1(storeGuilds, storeUser));
|
|
m.checkNotNullExpressionValue(Y, "channelsStore.observeCha… }\n }");
|
|
return Y;
|
|
}
|
|
}
|
|
|
|
/* compiled from: WidgetChannelSettingsAddMemberFragmentViewModel.kt */
|
|
public static final class StoreState {
|
|
private final Channel channel;
|
|
private final Map<Long, PermissionOverwrite> channelPermissionOverwritesMap;
|
|
private final Guild guild;
|
|
private final Map<Long, GuildMember> members;
|
|
private final Map<Long, GuildRole> roles;
|
|
private final Map<Long, User> users;
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r7v0, resolved type: java.util.Map<java.lang.Long, ? extends com.discord.models.user.User> */
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public StoreState(Guild guild, Channel channel, Map<Long, PermissionOverwrite> map, Map<Long, GuildRole> map2, Map<Long, GuildMember> map3, Map<Long, ? extends User> map4) {
|
|
m.checkNotNullParameter(channel, "channel");
|
|
m.checkNotNullParameter(map, "channelPermissionOverwritesMap");
|
|
m.checkNotNullParameter(map2, "roles");
|
|
m.checkNotNullParameter(map3, "members");
|
|
m.checkNotNullParameter(map4, "users");
|
|
this.guild = guild;
|
|
this.channel = channel;
|
|
this.channelPermissionOverwritesMap = map;
|
|
this.roles = map2;
|
|
this.members = map3;
|
|
this.users = map4;
|
|
}
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r4v0, resolved type: com.discord.widgets.channels.permissions.WidgetChannelSettingsAddMemberFragmentViewModel$StoreState */
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public static /* synthetic */ StoreState copy$default(StoreState storeState, Guild guild, Channel channel, Map map, Map map2, Map map3, Map map4, int i, Object obj) {
|
|
if ((i & 1) != 0) {
|
|
guild = storeState.guild;
|
|
}
|
|
if ((i & 2) != 0) {
|
|
channel = storeState.channel;
|
|
}
|
|
if ((i & 4) != 0) {
|
|
map = storeState.channelPermissionOverwritesMap;
|
|
}
|
|
if ((i & 8) != 0) {
|
|
map2 = storeState.roles;
|
|
}
|
|
if ((i & 16) != 0) {
|
|
map3 = storeState.members;
|
|
}
|
|
if ((i & 32) != 0) {
|
|
map4 = storeState.users;
|
|
}
|
|
return storeState.copy(guild, channel, map, map2, map3, map4);
|
|
}
|
|
|
|
public final Guild component1() {
|
|
return this.guild;
|
|
}
|
|
|
|
public final Channel component2() {
|
|
return this.channel;
|
|
}
|
|
|
|
public final Map<Long, PermissionOverwrite> component3() {
|
|
return this.channelPermissionOverwritesMap;
|
|
}
|
|
|
|
public final Map<Long, GuildRole> component4() {
|
|
return this.roles;
|
|
}
|
|
|
|
public final Map<Long, GuildMember> component5() {
|
|
return this.members;
|
|
}
|
|
|
|
public final Map<Long, User> component6() {
|
|
return this.users;
|
|
}
|
|
|
|
public final StoreState copy(Guild guild, Channel channel, Map<Long, PermissionOverwrite> map, Map<Long, GuildRole> map2, Map<Long, GuildMember> map3, Map<Long, ? extends User> map4) {
|
|
m.checkNotNullParameter(channel, "channel");
|
|
m.checkNotNullParameter(map, "channelPermissionOverwritesMap");
|
|
m.checkNotNullParameter(map2, "roles");
|
|
m.checkNotNullParameter(map3, "members");
|
|
m.checkNotNullParameter(map4, "users");
|
|
return new StoreState(guild, channel, map, map2, map3, map4);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof StoreState)) {
|
|
return false;
|
|
}
|
|
StoreState storeState = (StoreState) obj;
|
|
return m.areEqual(this.guild, storeState.guild) && m.areEqual(this.channel, storeState.channel) && m.areEqual(this.channelPermissionOverwritesMap, storeState.channelPermissionOverwritesMap) && m.areEqual(this.roles, storeState.roles) && m.areEqual(this.members, storeState.members) && m.areEqual(this.users, storeState.users);
|
|
}
|
|
|
|
public final Channel getChannel() {
|
|
return this.channel;
|
|
}
|
|
|
|
public final Map<Long, PermissionOverwrite> getChannelPermissionOverwritesMap() {
|
|
return this.channelPermissionOverwritesMap;
|
|
}
|
|
|
|
public final Guild getGuild() {
|
|
return this.guild;
|
|
}
|
|
|
|
public final Map<Long, GuildMember> getMembers() {
|
|
return this.members;
|
|
}
|
|
|
|
public final Map<Long, GuildRole> getRoles() {
|
|
return this.roles;
|
|
}
|
|
|
|
public final Map<Long, User> getUsers() {
|
|
return this.users;
|
|
}
|
|
|
|
public int hashCode() {
|
|
Guild guild = this.guild;
|
|
int i = 0;
|
|
int hashCode = (guild != null ? guild.hashCode() : 0) * 31;
|
|
Channel channel = this.channel;
|
|
int hashCode2 = (hashCode + (channel != null ? channel.hashCode() : 0)) * 31;
|
|
Map<Long, PermissionOverwrite> map = this.channelPermissionOverwritesMap;
|
|
int hashCode3 = (hashCode2 + (map != null ? map.hashCode() : 0)) * 31;
|
|
Map<Long, GuildRole> map2 = this.roles;
|
|
int hashCode4 = (hashCode3 + (map2 != null ? map2.hashCode() : 0)) * 31;
|
|
Map<Long, GuildMember> map3 = this.members;
|
|
int hashCode5 = (hashCode4 + (map3 != null ? map3.hashCode() : 0)) * 31;
|
|
Map<Long, User> map4 = this.users;
|
|
if (map4 != null) {
|
|
i = map4.hashCode();
|
|
}
|
|
return hashCode5 + i;
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder K = a.K("StoreState(guild=");
|
|
K.append(this.guild);
|
|
K.append(", channel=");
|
|
K.append(this.channel);
|
|
K.append(", channelPermissionOverwritesMap=");
|
|
K.append(this.channelPermissionOverwritesMap);
|
|
K.append(", roles=");
|
|
K.append(this.roles);
|
|
K.append(", members=");
|
|
K.append(this.members);
|
|
K.append(", users=");
|
|
return a.E(K, this.users, ")");
|
|
}
|
|
}
|
|
|
|
/* compiled from: WidgetChannelSettingsAddMemberFragmentViewModel.kt */
|
|
public static final class ViewState {
|
|
private final Channel channel;
|
|
private final Guild guild;
|
|
private final List<AddMemberAdapter.Item> items;
|
|
private final String query;
|
|
private final Map<Long, PermissionOverwrite.Type> selected;
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r5v0, resolved type: java.util.List<? extends com.discord.widgets.channels.permissions.AddMemberAdapter$Item> */
|
|
/* JADX DEBUG: Multi-variable search result rejected for r6v0, resolved type: java.util.Map<java.lang.Long, ? extends com.discord.api.permission.PermissionOverwrite$Type> */
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public ViewState(Guild guild, Channel channel, String str, List<? extends AddMemberAdapter.Item> list, Map<Long, ? extends PermissionOverwrite.Type> map) {
|
|
m.checkNotNullParameter(channel, "channel");
|
|
m.checkNotNullParameter(str, "query");
|
|
m.checkNotNullParameter(list, "items");
|
|
m.checkNotNullParameter(map, "selected");
|
|
this.guild = guild;
|
|
this.channel = channel;
|
|
this.query = str;
|
|
this.items = list;
|
|
this.selected = map;
|
|
}
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r3v0, resolved type: com.discord.widgets.channels.permissions.WidgetChannelSettingsAddMemberFragmentViewModel$ViewState */
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public static /* synthetic */ ViewState copy$default(ViewState viewState, Guild guild, Channel channel, String str, List list, Map map, int i, Object obj) {
|
|
if ((i & 1) != 0) {
|
|
guild = viewState.guild;
|
|
}
|
|
if ((i & 2) != 0) {
|
|
channel = viewState.channel;
|
|
}
|
|
if ((i & 4) != 0) {
|
|
str = viewState.query;
|
|
}
|
|
if ((i & 8) != 0) {
|
|
list = viewState.items;
|
|
}
|
|
if ((i & 16) != 0) {
|
|
map = viewState.selected;
|
|
}
|
|
return viewState.copy(guild, channel, str, list, map);
|
|
}
|
|
|
|
public final Guild component1() {
|
|
return this.guild;
|
|
}
|
|
|
|
public final Channel component2() {
|
|
return this.channel;
|
|
}
|
|
|
|
public final String component3() {
|
|
return this.query;
|
|
}
|
|
|
|
public final List<AddMemberAdapter.Item> component4() {
|
|
return this.items;
|
|
}
|
|
|
|
public final Map<Long, PermissionOverwrite.Type> component5() {
|
|
return this.selected;
|
|
}
|
|
|
|
public final ViewState copy(Guild guild, Channel channel, String str, List<? extends AddMemberAdapter.Item> list, Map<Long, ? extends PermissionOverwrite.Type> map) {
|
|
m.checkNotNullParameter(channel, "channel");
|
|
m.checkNotNullParameter(str, "query");
|
|
m.checkNotNullParameter(list, "items");
|
|
m.checkNotNullParameter(map, "selected");
|
|
return new ViewState(guild, channel, str, list, map);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof ViewState)) {
|
|
return false;
|
|
}
|
|
ViewState viewState = (ViewState) obj;
|
|
return m.areEqual(this.guild, viewState.guild) && m.areEqual(this.channel, viewState.channel) && m.areEqual(this.query, viewState.query) && m.areEqual(this.items, viewState.items) && m.areEqual(this.selected, viewState.selected);
|
|
}
|
|
|
|
public final Channel getChannel() {
|
|
return this.channel;
|
|
}
|
|
|
|
public final Guild getGuild() {
|
|
return this.guild;
|
|
}
|
|
|
|
public final List<AddMemberAdapter.Item> getItems() {
|
|
return this.items;
|
|
}
|
|
|
|
public final String getQuery() {
|
|
return this.query;
|
|
}
|
|
|
|
public final Map<Long, PermissionOverwrite.Type> getSelected() {
|
|
return this.selected;
|
|
}
|
|
|
|
public int hashCode() {
|
|
Guild guild = this.guild;
|
|
int i = 0;
|
|
int hashCode = (guild != null ? guild.hashCode() : 0) * 31;
|
|
Channel channel = this.channel;
|
|
int hashCode2 = (hashCode + (channel != null ? channel.hashCode() : 0)) * 31;
|
|
String str = this.query;
|
|
int hashCode3 = (hashCode2 + (str != null ? str.hashCode() : 0)) * 31;
|
|
List<AddMemberAdapter.Item> list = this.items;
|
|
int hashCode4 = (hashCode3 + (list != null ? list.hashCode() : 0)) * 31;
|
|
Map<Long, PermissionOverwrite.Type> map = this.selected;
|
|
if (map != null) {
|
|
i = map.hashCode();
|
|
}
|
|
return hashCode4 + i;
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder K = a.K("ViewState(guild=");
|
|
K.append(this.guild);
|
|
K.append(", channel=");
|
|
K.append(this.channel);
|
|
K.append(", query=");
|
|
K.append(this.query);
|
|
K.append(", items=");
|
|
K.append(this.items);
|
|
K.append(", selected=");
|
|
return a.E(K, this.selected, ")");
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public WidgetChannelSettingsAddMemberFragmentViewModel(long j, boolean z2, StoreChannels storeChannels, StoreGuilds storeGuilds, StoreUser storeUser, StoreGatewayConnection storeGatewayConnection, Observable<StoreState> observable) {
|
|
super(null, 1, null);
|
|
m.checkNotNullParameter(storeChannels, "channelsStore");
|
|
m.checkNotNullParameter(storeGuilds, "guildsStore");
|
|
m.checkNotNullParameter(storeUser, "userStore");
|
|
m.checkNotNullParameter(storeGatewayConnection, "gatewaySocket");
|
|
m.checkNotNullParameter(observable, "storeStateObservable");
|
|
this.channelId = j;
|
|
this.showRolesWithGuildPermission = z2;
|
|
this.channelsStore = storeChannels;
|
|
this.guildsStore = storeGuilds;
|
|
this.userStore = storeUser;
|
|
this.gatewaySocket = storeGatewayConnection;
|
|
this.query = "";
|
|
this.selected = new HashMap<>();
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(observable, this, null, 2, null), WidgetChannelSettingsAddMemberFragmentViewModel.class, (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 */ WidgetChannelSettingsAddMemberFragmentViewModel(long j, boolean z2, StoreChannels storeChannels, StoreGuilds storeGuilds, StoreUser storeUser, StoreGatewayConnection storeGatewayConnection, Observable observable, int i, DefaultConstructorMarker defaultConstructorMarker) {
|
|
this(j, z2, r5, r6, r7, (i & 32) != 0 ? StoreStream.Companion.getGatewaySocket() : storeGatewayConnection, (i & 64) != 0 ? Companion.access$observeStoreState(Companion, j, r5, r6, r7) : observable);
|
|
StoreChannels channels = (i & 4) != 0 ? StoreStream.Companion.getChannels() : storeChannels;
|
|
StoreGuilds guilds = (i & 8) != 0 ? StoreStream.Companion.getGuilds() : storeGuilds;
|
|
StoreUser users = (i & 16) != 0 ? StoreStream.Companion.getUsers() : storeUser;
|
|
}
|
|
|
|
public static final /* synthetic */ void access$handleStoreState(WidgetChannelSettingsAddMemberFragmentViewModel widgetChannelSettingsAddMemberFragmentViewModel, StoreState storeState) {
|
|
widgetChannelSettingsAddMemberFragmentViewModel.handleStoreState(storeState);
|
|
}
|
|
|
|
private final ViewState generateViewState(StoreState storeState) {
|
|
return new ViewState(storeState.getGuild(), storeState.getChannel(), this.query, makeAdapterItems(storeState), this.selected);
|
|
}
|
|
|
|
@MainThread
|
|
private final void handleStoreState(StoreState storeState) {
|
|
this.storeState = storeState;
|
|
updateViewState(generateViewState(storeState));
|
|
}
|
|
|
|
private final boolean isPermissionOverrideAlreadyPresent(PermissionOverwrite permissionOverwrite, long j) {
|
|
return permissionOverwrite != null && (permissionOverwrite.c() & j) == j;
|
|
}
|
|
|
|
/* JADX WARNING: Removed duplicated region for block: B:78:0x0093 A[SYNTHETIC] */
|
|
/* JADX WARNING: Removed duplicated region for block: B:81:0x002a A[SYNTHETIC] */
|
|
private final List<AddMemberAdapter.Item> makeAdapterItems(StoreState storeState) {
|
|
AddMemberAdapter.Item.PermissionOwnerItem.Companion.AddStatus addStatus;
|
|
boolean z2;
|
|
Guild guild = storeState.getGuild();
|
|
Map<Long, PermissionOverwrite> channelPermissionOverwritesMap = storeState.getChannelPermissionOverwritesMap();
|
|
String str = this.query;
|
|
Objects.requireNonNull(str, "null cannot be cast to non-null type kotlin.CharSequence");
|
|
String obj = w.trim(str).toString();
|
|
Collection<GuildRole> values = storeState.getRoles().values();
|
|
ArrayList<GuildRole> arrayList = new ArrayList();
|
|
for (Object obj2 : values) {
|
|
GuildRole guildRole = (GuildRole) obj2;
|
|
if ((guildRole.g() & 8) == 0) {
|
|
long id2 = guildRole.getId();
|
|
if ((guild == null || id2 != guild.getId()) && ((this.showRolesWithGuildPermission || !PermissionUtils.INSTANCE.canRole(20971536, guildRole, channelPermissionOverwritesMap.get(Long.valueOf(guildRole.getId())))) && !isPermissionOverrideAlreadyPresent(channelPermissionOverwritesMap.get(Long.valueOf(guildRole.getId())), 20971536) && w.contains((CharSequence) guildRole.f(), (CharSequence) obj, true))) {
|
|
z2 = true;
|
|
if (!z2) {
|
|
arrayList.add(obj2);
|
|
}
|
|
}
|
|
}
|
|
z2 = false;
|
|
if (!z2) {
|
|
}
|
|
}
|
|
ArrayList arrayList2 = new ArrayList(d0.t.o.collectionSizeOrDefault(arrayList, 10));
|
|
for (GuildRole guildRole2 : arrayList) {
|
|
boolean canRole = PermissionUtils.INSTANCE.canRole(20971536, guildRole2, channelPermissionOverwritesMap.get(Long.valueOf(guildRole2.getId())));
|
|
PermissionOwner.Role role = new PermissionOwner.Role(guildRole2);
|
|
boolean z3 = canRole || this.selected.containsKey(Long.valueOf(guildRole2.getId()));
|
|
if (canRole) {
|
|
addStatus = new AddMemberAdapter.Item.PermissionOwnerItem.Companion.AddStatus.CannotAdd(AddMemberAdapter.Item.PermissionOwnerItem.Companion.AddStatus.CannotAdd.Reason.HAS_GUILD_PERMISSIONS);
|
|
} else if (!canRole) {
|
|
addStatus = AddMemberAdapter.Item.PermissionOwnerItem.Companion.AddStatus.CanAdd.INSTANCE;
|
|
} else {
|
|
throw new NoWhenBranchMatchedException();
|
|
}
|
|
arrayList2.add(new AddMemberAdapter.Item.PermissionOwnerItem(role, z3, addStatus));
|
|
}
|
|
Set<Map.Entry<Long, GuildMember>> entrySet = storeState.getMembers().entrySet();
|
|
ArrayList arrayList3 = new ArrayList();
|
|
Iterator<T> it = entrySet.iterator();
|
|
while (it.hasNext()) {
|
|
Map.Entry entry = (Map.Entry) it.next();
|
|
User user = storeState.getUsers().get(entry.getKey());
|
|
Pair pair = user == null ? null : new Pair((GuildMember) entry.getValue(), user);
|
|
if (pair != null) {
|
|
arrayList3.add(pair);
|
|
}
|
|
}
|
|
ArrayList<Pair> arrayList4 = new ArrayList();
|
|
for (Object obj3 : arrayList3) {
|
|
Pair pair2 = (Pair) obj3;
|
|
GuildMember guildMember = (GuildMember) pair2.component1();
|
|
User user2 = (User) pair2.component2();
|
|
if (!(guild != null ? guild.isOwner(user2.getId()) : false) && !isPermissionOverrideAlreadyPresent((PermissionOverwrite) a.c(user2, channelPermissionOverwritesMap), 20971536) && (w.contains(user2.getUsername(), obj, true) || (guildMember.getNick() != null && w.contains(guildMember.getNick(), obj, true)))) {
|
|
arrayList4.add(obj3);
|
|
}
|
|
}
|
|
ArrayList arrayList5 = new ArrayList(d0.t.o.collectionSizeOrDefault(arrayList4, 10));
|
|
for (Pair pair3 : arrayList4) {
|
|
User user3 = (User) pair3.component2();
|
|
arrayList5.add(new AddMemberAdapter.Item.PermissionOwnerItem(new PermissionOwner.Member(user3, ((GuildMember) pair3.component1()).getNick(), guild != null && guild.isOwner(user3.getId())), this.selected.containsKey(Long.valueOf(user3.getId())), AddMemberAdapter.Item.PermissionOwnerItem.Companion.AddStatus.CanAdd.INSTANCE));
|
|
}
|
|
return u.plus((Collection) u.plus((Collection) u.plus((Collection) d0.t.m.listOf(new AddMemberAdapter.Item.CategoryItem(AddMemberAdapter.Item.CategoryItem.Companion.CategoryType.ROLE)), (Iterable) arrayList2), (Iterable) d0.t.m.listOf(new AddMemberAdapter.Item.CategoryItem(AddMemberAdapter.Item.CategoryItem.Companion.CategoryType.MEMBER))), (Iterable) arrayList5);
|
|
}
|
|
|
|
private final void requestMembers(String str) {
|
|
Guild guild;
|
|
StoreState storeState = this.storeState;
|
|
if (storeState != null && (guild = storeState.getGuild()) != null) {
|
|
long id2 = guild.getId();
|
|
StoreGatewayConnection storeGatewayConnection = this.gatewaySocket;
|
|
Objects.requireNonNull(str, "null cannot be cast to non-null type kotlin.CharSequence");
|
|
storeGatewayConnection.requestGuildMembers(id2, w.trim(str).toString(), null, 20);
|
|
}
|
|
}
|
|
|
|
public final String getQuery() {
|
|
return this.query;
|
|
}
|
|
|
|
public final void setQuery(String str) {
|
|
m.checkNotNullParameter(str, "<set-?>");
|
|
this.query = str;
|
|
}
|
|
|
|
public final void toggleItem(long j, PermissionOverwrite.Type type) {
|
|
m.checkNotNullParameter(type, "type");
|
|
if (this.selected.containsKey(Long.valueOf(j))) {
|
|
this.selected.remove(Long.valueOf(j));
|
|
} else {
|
|
this.selected.put(Long.valueOf(j), type);
|
|
}
|
|
StoreState storeState = this.storeState;
|
|
if (storeState != null) {
|
|
updateViewState(generateViewState(storeState));
|
|
}
|
|
}
|
|
|
|
public final void updateQuery(String str) {
|
|
m.checkNotNullParameter(str, "query");
|
|
this.query = str;
|
|
StoreState storeState = this.storeState;
|
|
if (storeState != null) {
|
|
updateViewState(generateViewState(storeState));
|
|
}
|
|
requestMembers(str);
|
|
}
|
|
}
|