26 lines
1.4 KiB
Java
26 lines
1.4 KiB
Java
package com.discord.utilities.channel;
|
|
|
|
import com.discord.api.channel.Channel;
|
|
import com.discord.models.domain.ModelNotificationSettings;
|
|
import com.discord.models.guild.Guild;
|
|
import d0.z.d.m;
|
|
/* compiled from: ChannelNotificationSettingsUtils.kt */
|
|
public final class ChannelNotificationSettingsUtils {
|
|
public static final ChannelNotificationSettingsUtils INSTANCE = new ChannelNotificationSettingsUtils();
|
|
|
|
private ChannelNotificationSettingsUtils() {
|
|
}
|
|
|
|
public final int computeNotificationSetting(Guild guild, Channel channel, ModelNotificationSettings modelNotificationSettings) {
|
|
m.checkNotNullParameter(guild, "guild");
|
|
m.checkNotNullParameter(channel, "channel");
|
|
m.checkNotNullParameter(modelNotificationSettings, "guildSettings");
|
|
ModelNotificationSettings.ChannelOverride channelOverride = modelNotificationSettings.getChannelOverride(channel.h());
|
|
int messageNotifications = channelOverride != null ? channelOverride.getMessageNotifications() : ModelNotificationSettings.FREQUENCY_UNSET;
|
|
if (messageNotifications != ModelNotificationSettings.FREQUENCY_UNSET) {
|
|
return messageNotifications;
|
|
}
|
|
int messageNotifications2 = modelNotificationSettings.getMessageNotifications();
|
|
return messageNotifications2 == ModelNotificationSettings.FREQUENCY_UNSET ? guild.getDefaultMessageNotifications() : messageNotifications2;
|
|
}
|
|
}
|