discord-jadx/app/src/main/java/com/discord/widgets/channels/settings/WidgetTextChannelSettings$M...

57 lines
3.2 KiB
Java

package com.discord.widgets.channels.settings;
import com.airbnb.lottie.parser.AnimatableValueParser;
import com.discord.api.channel.Channel;
import com.discord.api.guild.GuildFeature;
import com.discord.models.guild.Guild;
import com.discord.models.user.MeUser;
import com.discord.stores.StoreStream;
import com.discord.stores.StoreUser;
import com.discord.utilities.permissions.PermissionUtils;
import com.discord.widgets.channels.settings.WidgetTextChannelSettings;
import j0.k.b;
import j0.l.e.j;
import rx.Observable;
import rx.functions.Func3;
/* compiled from: WidgetTextChannelSettings.kt */
public final class WidgetTextChannelSettings$Model$Companion$get$1<T, R> implements b<Channel, Observable<? extends WidgetTextChannelSettings.Model>> {
public final /* synthetic */ long $channelId;
/* compiled from: WidgetTextChannelSettings.kt */
/* renamed from: com.discord.widgets.channels.settings.WidgetTextChannelSettings$Model$Companion$get$1$1 reason: invalid class name */
public static final class AnonymousClass1<T1, T2, T3, R> implements Func3<Guild, MeUser, Long, WidgetTextChannelSettings.Model> {
public final /* synthetic */ Channel $channel;
public final /* synthetic */ WidgetTextChannelSettings$Model$Companion$get$1 this$0;
public AnonymousClass1(WidgetTextChannelSettings$Model$Companion$get$1 widgetTextChannelSettings$Model$Companion$get$1, Channel channel) {
this.this$0 = widgetTextChannelSettings$Model$Companion$get$1;
this.$channel = channel;
}
public final WidgetTextChannelSettings.Model call(Guild guild, MeUser meUser, Long l) {
Long publicUpdatesChannelId;
Long rulesChannelId;
if (guild == null) {
return null;
}
boolean canAndIsElevated = PermissionUtils.canAndIsElevated(16, l, meUser.getMfaEnabled(), guild.getMfaLevel());
boolean canAndIsElevated2 = PermissionUtils.canAndIsElevated(268435456, l, meUser.getMfaEnabled(), guild.getMfaLevel());
boolean z2 = !this.$channel.o() || StoreStream.Companion.getGuildsNsfw().isGuildNsfwGateAgreed(this.$channel.f());
boolean contains = guild.getFeatures().contains(GuildFeature.COMMUNITY);
return new WidgetTextChannelSettings.Model(guild, this.$channel, canAndIsElevated, canAndIsElevated2, z2, contains && (rulesChannelId = guild.getRulesChannelId()) != null && rulesChannelId.longValue() == this.this$0.$channelId, contains && (publicUpdatesChannelId = guild.getPublicUpdatesChannelId()) != null && publicUpdatesChannelId.longValue() == this.this$0.$channelId, contains);
}
}
public WidgetTextChannelSettings$Model$Companion$get$1(long j) {
this.$channelId = j;
}
public final Observable<? extends WidgetTextChannelSettings.Model> call(Channel channel) {
if (channel == null || AnimatableValueParser.A1(channel)) {
return new j(null);
}
StoreStream.Companion companion = StoreStream.Companion;
return Observable.i(companion.getGuilds().observeGuild(channel.f()), StoreUser.observeMe$default(companion.getUsers(), false, 1, null), companion.getPermissions().observePermissionsForChannel(this.$channelId), new AnonymousClass1(this, channel));
}
}