discord-jadx/app/src/main/java/com/discord/utilities/auditlogs/AuditLogChangeUtils.java

1776 lines
96 KiB
Java

package com.discord.utilities.auditlogs;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Color;
import android.graphics.Typeface;
import android.text.SpannableStringBuilder;
import android.text.style.ForegroundColorSpan;
import androidx.annotation.StringRes;
import b.a.k.b;
import b.d.b.a.a;
import com.discord.R;
import com.discord.api.guild.GuildExplicitContentFilter;
import com.discord.api.guild.GuildVerificationLevel;
import com.discord.api.guildscheduledevent.GuildScheduledEventEntityType;
import com.discord.api.guildscheduledevent.GuildScheduledEventStatus;
import com.discord.api.permission.Permission;
import com.discord.api.stageinstance.StageInstancePrivacyLevel;
import com.discord.app.AppLog;
import com.discord.models.domain.ModelAuditLogEntry;
import com.discord.models.user.User;
import com.discord.rtcconnection.MediaSinkWantsManager;
import com.discord.stores.StoreStream;
import com.discord.utilities.color.ColorCompat;
import com.discord.utilities.font.FontUtils;
import com.discord.utilities.logging.Logger;
import com.discord.utilities.resources.DurationUtilsKt;
import com.discord.utilities.resources.StringResourceUtilsKt;
import com.discord.utilities.spans.TypefaceSpanCompat;
import com.discord.utilities.time.TimeUtils;
import d0.f0.q;
import d0.g0.t;
import d0.g0.w;
import d0.t.n;
import d0.t.u;
import d0.z.d.m;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.MissingFormatArgumentException;
import java.util.Objects;
import java.util.Set;
import kotlin.NoWhenBranchMatchedException;
import kotlin.Pair;
/* compiled from: AuditLogChangeUtils.kt */
public final class AuditLogChangeUtils {
private static final List<String> CHANGE_KEYS_REFERENCING_CHANNEL = n.listOf((Object[]) new String[]{ModelAuditLogEntry.CHANGE_KEY_CHANNEL_ID, ModelAuditLogEntry.CHANGE_KEY_AFK_CHANNEL_ID, ModelAuditLogEntry.CHANGE_KEY_SYSTEM_CHANNEL_ID, ModelAuditLogEntry.CHANGE_KEY_RULES_CHANNEL_ID, ModelAuditLogEntry.CHANGE_KEY_UPDATES_CHANNEL_ID});
public static final AuditLogChangeUtils INSTANCE = new AuditLogChangeUtils();
private static final List<Integer> RENDERABLE_DELETE_ACTION_TYPES = n.listOf((Object[]) new Integer[]{22, 20, 21});
public final /* synthetic */ class WhenMappings {
public static final /* synthetic */ int[] $EnumSwitchMapping$0;
public static final /* synthetic */ int[] $EnumSwitchMapping$1;
public static final /* synthetic */ int[] $EnumSwitchMapping$2;
static {
ModelAuditLogEntry.TargetType.values();
int[] iArr = new int[15];
$EnumSwitchMapping$0 = iArr;
iArr[ModelAuditLogEntry.TargetType.ALL.ordinal()] = 1;
iArr[ModelAuditLogEntry.TargetType.GUILD.ordinal()] = 2;
iArr[ModelAuditLogEntry.TargetType.CHANNEL.ordinal()] = 3;
iArr[ModelAuditLogEntry.TargetType.CHANNEL_OVERWRITE.ordinal()] = 4;
iArr[ModelAuditLogEntry.TargetType.USER.ordinal()] = 5;
iArr[ModelAuditLogEntry.TargetType.ROLE.ordinal()] = 6;
iArr[ModelAuditLogEntry.TargetType.INVITE.ordinal()] = 7;
iArr[ModelAuditLogEntry.TargetType.WEBHOOK.ordinal()] = 8;
iArr[ModelAuditLogEntry.TargetType.EMOJI.ordinal()] = 9;
iArr[ModelAuditLogEntry.TargetType.STICKER.ordinal()] = 10;
iArr[ModelAuditLogEntry.TargetType.INTEGRATION.ordinal()] = 11;
iArr[ModelAuditLogEntry.TargetType.STAGE_INSTANCE.ordinal()] = 12;
iArr[ModelAuditLogEntry.TargetType.GUILD_SCHEDULED_EVENT.ordinal()] = 13;
iArr[ModelAuditLogEntry.TargetType.THREAD.ordinal()] = 14;
MediaSinkWantsManager.VideoQualityMode.values();
int[] iArr2 = new int[2];
$EnumSwitchMapping$1 = iArr2;
iArr2[MediaSinkWantsManager.VideoQualityMode.AUTO.ordinal()] = 1;
iArr2[MediaSinkWantsManager.VideoQualityMode.FULL.ordinal()] = 2;
ModelAuditLogEntry.ActionType.values();
int[] iArr3 = new int[4];
$EnumSwitchMapping$2 = iArr3;
iArr3[ModelAuditLogEntry.ActionType.CREATE.ordinal()] = 1;
iArr3[ModelAuditLogEntry.ActionType.UPDATE.ordinal()] = 2;
iArr3[ModelAuditLogEntry.ActionType.DELETE.ordinal()] = 3;
}
}
private AuditLogChangeUtils() {
}
public static final /* synthetic */ int access$getStringForPermission(AuditLogChangeUtils auditLogChangeUtils, long j, ModelAuditLogEntry modelAuditLogEntry) {
return auditLogChangeUtils.getStringForPermission(j, modelAuditLogEntry);
}
private final Pair<HashSet<Long>, HashSet<Long>> calculatePermissionChange(ModelAuditLogEntry.Change change) {
Object oldValue = change.getOldValue();
String str = null;
if (!(oldValue instanceof String)) {
oldValue = null;
}
String str2 = (String) oldValue;
long j = 0;
long parseLong = str2 != null ? Long.parseLong(str2) : 0;
Object newValue = change.getNewValue();
if (newValue instanceof String) {
str = newValue;
}
String str3 = str;
if (str3 != null) {
j = Long.parseLong(str3);
}
long j2 = (~parseLong) & j;
long j3 = parseLong & (~j);
HashSet hashSet = new HashSet();
HashSet hashSet2 = new HashSet();
for (int i = 0; i <= 63; i++) {
long j4 = 1 << i;
if ((j2 & j4) == j4) {
hashSet.add(Long.valueOf(j4));
}
if ((j3 & j4) == j4) {
hashSet2.add(Long.valueOf(j4));
}
}
return new Pair<>(hashSet, hashSet2);
}
/* JADX DEBUG: TODO: convert one arg to string using `String.valueOf()`, args: [('0' char), (r3v0 int)] */
private final String getChangeNumberString(int i) {
if (i < 0 || 9 < i) {
return String.valueOf(i);
}
StringBuilder sb = new StringBuilder();
sb.append('0');
sb.append(i);
return sb.toString();
}
/* JADX DEBUG: Can't convert new array creation: APUT found in different block: 0x00bd: APUT (r15v34 java.lang.Object[]), (0 ??[int, short, byte, char]), (r1v76 java.lang.String) */
/* JADX DEBUG: Can't convert new array creation: APUT found in different block: 0x00ae: APUT
(r2v26 java.lang.Object[])
(0 ??[int, short, byte, char])
(wrap: java.lang.Integer : 0x00aa: INVOKE (r3v17 java.lang.Integer) =
(wrap: int : 0x00a9: ARITH (r3v16 int) = (16777215 int) & (wrap: int : 0x00a8: CAST (r4v5 int) = (int) (wrap: long : 0x00a4: INVOKE (r8v10 long) = (wrap: java.lang.Long : 0x00a2: CHECK_CAST (r8v9 java.lang.Long) = (java.lang.Long) (r8v8 java.lang.Object)) type: VIRTUAL call: java.lang.Long.longValue():long)))
type: STATIC call: java.lang.Integer.valueOf(int):java.lang.Integer)
*/
/* JADX DEBUG: Can't convert new array creation: APUT found in different block: 0x00e8: APUT
(r15v33 java.lang.Object[])
(0 ??[int, short, byte, char])
(wrap: java.lang.CharSequence : 0x00e4: INVOKE (r1v73 java.lang.CharSequence) =
(r11v0 android.content.Context)
(wrap: int : 0x00e3: CAST (r2v25 int) = (int) (wrap: long : 0x00df: INVOKE (r1v72 long) = (wrap: java.lang.Long : 0x00dd: CHECK_CAST (r1v71 java.lang.Long) = (java.lang.Long) (r1v70 java.lang.Object)) type: VIRTUAL call: java.lang.Long.longValue():long))
type: STATIC call: com.discord.utilities.resources.DurationUtilsKt.formatInviteExpireAfterString(android.content.Context, int):java.lang.CharSequence)
*/
/* JADX DEBUG: Can't convert new array creation: APUT found in different block: 0x01d8: APUT (r1v49 java.lang.Object[]), (0 ??[int, short, byte, char]), (r15v26 java.lang.CharSequence) */
/* JADX DEBUG: Can't convert new array creation: APUT found in different block: 0x01ff: APUT
(r15v23 java.lang.Object[])
(0 ??[int, short, byte, char])
(wrap: java.lang.Long : 0x01fb: INVOKE (r1v45 java.lang.Long) =
(wrap: long : 0x01fa: ARITH (r1v44 long) = (wrap: long : 0x01f3: INVOKE (r1v43 long) = (wrap: java.lang.Long : 0x01f1: CHECK_CAST (r1v42 java.lang.Long) = (java.lang.Long) (r1v41 java.lang.Object)) type: VIRTUAL call: java.lang.Long.longValue():long) / (wrap: long : 0x01f9: CAST (r3v14 long) = (long) (1000 int)))
type: STATIC call: java.lang.Long.valueOf(long):java.lang.Long)
*/
/* JADX DEBUG: Can't convert new array creation: APUT found in different block: 0x0241: APUT (r15v22 java.lang.Object[]), (0 ??[int, short, byte, char]), (r1v37 java.lang.String) */
/* JADX DEBUG: Can't convert new array creation: APUT found in different block: 0x0287: APUT
(r15v21 java.lang.Object[])
(0 ??[int, short, byte, char])
(wrap: java.lang.CharSequence : 0x0283: INVOKE (r1v30 java.lang.CharSequence) =
(r2v8 android.content.res.Resources)
(r11v0 android.content.Context)
(wrap: ?? : ?: SGET com.discord.R.plurals.guild_settings_audit_log_channel_rate_limit_per_user_change_newValue int)
(r3v12 int)
(r6v3 java.lang.Object[])
type: STATIC call: com.discord.utilities.resources.StringResourceUtilsKt.getQuantityString(android.content.res.Resources, android.content.Context, int, int, java.lang.Object[]):java.lang.CharSequence)
*/
/* JADX DEBUG: Can't convert new array creation: APUT found in different block: 0x0281: APUT
(r6v3 java.lang.Object[])
(0 ??[int, short, byte, char])
(wrap: java.lang.Integer : 0x027d: INVOKE (r4v4 java.lang.Integer) =
(wrap: int : 0x027c: CAST (r4v3 int) = (int) (wrap: long : 0x0278: INVOKE (r8v5 long) = (wrap: java.lang.Long : 0x0276: CHECK_CAST (r8v4 java.lang.Long) = (java.lang.Long) (r8v3 java.lang.Object)) type: VIRTUAL call: java.lang.Long.longValue():long))
type: STATIC call: java.lang.Integer.valueOf(int):java.lang.Integer)
*/
/* JADX DEBUG: Can't convert new array creation: APUT found in different block: 0x02ba: APUT
(r15v20 java.lang.Object[])
(0 ??[int, short, byte, char])
(wrap: java.lang.Long : 0x02b6: INVOKE (r1v27 java.lang.Long) =
(wrap: long : 0x02b5: ARITH (r1v26 long) = (wrap: long : 0x02ae: INVOKE (r1v25 long) = (wrap: java.lang.Long : 0x02ac: CHECK_CAST (r1v24 java.lang.Long) = (java.lang.Long) (r1v23 java.lang.Object)) type: VIRTUAL call: java.lang.Long.longValue():long) / (wrap: long : 0x02b4: CAST (r3v9 long) = (long) (60 int)))
type: STATIC call: java.lang.Long.valueOf(long):java.lang.Long)
*/
/* JADX DEBUG: Can't convert new array creation: APUT found in different block: 0x02fd: APUT
(r15v19 java.lang.Object[])
(0 ??[int, short, byte, char])
(wrap: java.lang.CharSequence : 0x02f9: INVOKE (r1v21 java.lang.CharSequence) =
(r2v7 android.content.res.Resources)
(r11v0 android.content.Context)
(wrap: ?? : ?: SGET com.discord.R.plurals.guild_settings_audit_log_member_prune_delete_days_newValue int)
(r3v7 int)
(r6v2 java.lang.Object[])
type: STATIC call: com.discord.utilities.resources.StringResourceUtilsKt.getQuantityString(android.content.res.Resources, android.content.Context, int, int, java.lang.Object[]):java.lang.CharSequence)
*/
/* JADX DEBUG: Can't convert new array creation: APUT found in different block: 0x02f7: APUT
(r6v2 java.lang.Object[])
(0 ??[int, short, byte, char])
(wrap: java.lang.Integer : 0x02f5: CHECK_CAST (r8v1 java.lang.Integer) = (java.lang.Integer) (r8v0 java.lang.Object))
*/
/* JADX DEBUG: Can't convert new array creation: APUT found in different block: 0x0337: APUT
(r15v18 java.lang.Object[])
(0 ??[int, short, byte, char])
(wrap: java.lang.CharSequence : 0x0333: INVOKE (r1v18 java.lang.CharSequence) =
(r10v0 'this' com.discord.utilities.auditlogs.AuditLogChangeUtils A[IMMUTABLE_TYPE, THIS])
(wrap: com.discord.rtcconnection.MediaSinkWantsManager$VideoQualityMode : 0x032f: INVOKE (r1v17 com.discord.rtcconnection.MediaSinkWantsManager$VideoQualityMode) =
(r1v16 com.discord.rtcconnection.MediaSinkWantsManager$VideoQualityMode$a)
(wrap: java.lang.Integer : 0x032b: INVOKE (r2v6 java.lang.Integer) =
(wrap: int : 0x032a: CAST (r3v4 int) = (int) (wrap: long : 0x0326: INVOKE (r2v5 long) = (wrap: java.lang.Long : 0x0324: CHECK_CAST (r2v4 java.lang.Long) = (java.lang.Long) (r2v3 java.lang.Object)) type: VIRTUAL call: java.lang.Long.longValue():long))
type: STATIC call: java.lang.Integer.valueOf(int):java.lang.Integer)
type: VIRTUAL call: com.discord.rtcconnection.MediaSinkWantsManager.VideoQualityMode.a.a(java.lang.Integer):com.discord.rtcconnection.MediaSinkWantsManager$VideoQualityMode)
(r11v0 android.content.Context)
type: DIRECT call: com.discord.utilities.auditlogs.AuditLogChangeUtils.getStringForVideoQualityMode(com.discord.rtcconnection.MediaSinkWantsManager$VideoQualityMode, android.content.Context):java.lang.CharSequence)
*/
/* JADX DEBUG: Can't convert new array creation: APUT found in different block: 0x035b: APUT
(r15v17 java.lang.Object[])
(0 ??[int, short, byte, char])
(wrap: java.lang.String : 0x0357: INVOKE (r1v14 java.lang.String) =
(r11v0 android.content.Context)
(wrap: java.lang.String : 0x0355: CHECK_CAST (r1v13 java.lang.String) = (java.lang.String) (r1v12 java.lang.Object))
type: STATIC call: com.discord.utilities.time.TimeUtils.getReadableTimeString(android.content.Context, java.lang.String):java.lang.String)
*/
/* JADX WARNING: Removed duplicated region for block: B:19:0x004c */
/* JADX WARNING: Removed duplicated region for block: B:28:0x0073 A[ADDED_TO_REGION] */
private final CharSequence getChangeTextWithParams(Context context, ModelAuditLogEntry modelAuditLogEntry, ModelAuditLogEntry.Change change, @StringRes int i, Map<ModelAuditLogEntry.TargetType, ? extends Map<Long, ? extends CharSequence>> map) {
CharSequence charSequence;
CharSequence charSequence2;
try {
if (hasNewValue(change, "type") && modelAuditLogEntry.getTargetType() == ModelAuditLogEntry.TargetType.CHANNEL) {
if (change.getOldValue() != null) {
Object oldValue = change.getOldValue();
if (oldValue != null) {
int channelTypeStringResIdFromValue = getChannelTypeStringResIdFromValue(Integer.valueOf((int) ((Long) oldValue).longValue()));
if (channelTypeStringResIdFromValue != 0) {
charSequence = b.h(context, channelTypeStringResIdFromValue, new Object[0], null, 4);
if (change.getNewValue() != null) {
Object newValue = change.getNewValue();
if (newValue != null) {
int channelTypeStringResIdFromValue2 = getChannelTypeStringResIdFromValue(Integer.valueOf((int) ((Long) newValue).longValue()));
if (channelTypeStringResIdFromValue2 != 0) {
charSequence2 = b.h(context, channelTypeStringResIdFromValue2, new Object[0], null, 4);
return (charSequence == null || charSequence2 == null) ? b.h(context, i, new Object[]{charSequence, charSequence2}, null, 4) : b.h(context, i, new Object[]{charSequence2}, null, 4);
}
} else {
throw new NullPointerException("null cannot be cast to non-null type kotlin.Long");
}
}
charSequence2 = null;
if (charSequence == null) {
}
}
} else {
throw new NullPointerException("null cannot be cast to non-null type kotlin.Long");
}
}
charSequence = null;
if (change.getNewValue() != null) {
}
charSequence2 = null;
if (charSequence == null) {
}
} else if (hasNewValue(change, ModelAuditLogEntry.CHANGE_KEY_COLOR)) {
Object[] objArr = new Object[1];
Object[] objArr2 = new Object[1];
Object newValue2 = change.getNewValue();
if (newValue2 != null) {
objArr2[0] = Integer.valueOf(16777215 & ((int) ((Long) newValue2).longValue()));
String format = String.format("#%06X", Arrays.copyOf(objArr2, 1));
m.checkNotNullExpressionValue(format, "java.lang.String.format(format, *args)");
objArr[0] = format;
return b.h(context, i, objArr, null, 4);
}
throw new NullPointerException("null cannot be cast to non-null type kotlin.Long");
} else if (hasNewValue(change, ModelAuditLogEntry.CHANGE_KEY_MAX_AGE)) {
Object[] objArr3 = new Object[1];
Object newValue3 = change.getNewValue();
if (newValue3 != null) {
objArr3[0] = DurationUtilsKt.formatInviteExpireAfterString(context, (int) ((Long) newValue3).longValue());
return b.h(context, i, objArr3, null, 4);
}
throw new NullPointerException("null cannot be cast to non-null type kotlin.Long");
} else if (change.getNewValue() != null && modelAuditLogEntry.getTargetType() == ModelAuditLogEntry.TargetType.CHANNEL_OVERWRITE && (m.areEqual(change.getKey(), ModelAuditLogEntry.CHANGE_KEY_PERMISSIONS_GRANTED) || m.areEqual(change.getKey(), ModelAuditLogEntry.CHANGE_KEY_PERMISSIONS_DENIED) || m.areEqual(change.getKey(), ModelAuditLogEntry.CHANGE_KEY_PERMISSIONS_RESET))) {
return renderPermissions(change, modelAuditLogEntry, context, map);
} else {
if (change.getNewValue() != null && (m.areEqual(change.getKey(), ModelAuditLogEntry.CHANGE_KEY_PERMISSIONS_GRANTED) || m.areEqual(change.getKey(), ModelAuditLogEntry.CHANGE_KEY_PERMISSIONS_DENIED))) {
return b.h(context, i, new Object[]{getPluralString(context, change).toString() + "\n" + renderPermissionList(change, modelAuditLogEntry, context)}, null, 4);
} else if (change.getNewValue() != null && (m.areEqual(change.getKey(), ModelAuditLogEntry.CHANGE_KEY_ROLES_REMOVE) || m.areEqual(change.getKey(), ModelAuditLogEntry.CHANGE_KEY_ROLES_ADD))) {
return b.h(context, i, new Object[]{renderRoles(context, change)}, null, 4);
} else {
if (change.getNewValue() != null && CHANGE_KEYS_REFERENCING_CHANNEL.contains(change.getKey())) {
Object[] objArr4 = new Object[1];
Map map2 = (Map) map.get(ModelAuditLogEntry.TargetType.CHANNEL);
objArr4[0] = map2 != null ? (CharSequence) map2.get(Long.valueOf(Long.parseLong(change.getValue().toString()))) : null;
return b.h(context, i, objArr4, null, 4);
} else if (hasNewValue(change, ModelAuditLogEntry.CHANGE_KEY_BITRATE)) {
Object[] objArr5 = new Object[1];
Object newValue4 = change.getNewValue();
if (newValue4 != null) {
objArr5[0] = Long.valueOf(((Long) newValue4).longValue() / ((long) 1000));
return b.h(context, i, objArr5, null, 4);
}
throw new NullPointerException("null cannot be cast to non-null type kotlin.Long");
} else if (hasNewValue(change, ModelAuditLogEntry.CHANGE_KEY_OWNER_ID)) {
Object[] objArr6 = new Object[1];
User user = StoreStream.Companion.getUsers().getUsers().get(Long.valueOf(Long.parseLong(change.getNewValue().toString())));
objArr6[0] = user != null ? user.getUsername() : null;
return b.h(context, i, objArr6, null, 4);
} else if (hasNewValue(change, ModelAuditLogEntry.CHANGE_KEY_RATE_LIMIT_PER_USER)) {
Object[] objArr7 = new Object[1];
Resources resources = context.getResources();
m.checkNotNullExpressionValue(resources, "context.resources");
Object newValue5 = change.getNewValue();
if (newValue5 != null) {
int longValue = (int) ((Long) newValue5).longValue();
Object[] objArr8 = new Object[1];
Object newValue6 = change.getNewValue();
if (newValue6 != null) {
objArr8[0] = Integer.valueOf((int) ((Long) newValue6).longValue());
objArr7[0] = StringResourceUtilsKt.getQuantityString(resources, context, (int) R.plurals.guild_settings_audit_log_channel_rate_limit_per_user_change_newValue, longValue, objArr8);
return b.h(context, i, objArr7, null, 4);
}
throw new NullPointerException("null cannot be cast to non-null type kotlin.Long");
}
throw new NullPointerException("null cannot be cast to non-null type kotlin.Long");
} else if (hasNewValue(change, ModelAuditLogEntry.CHANGE_KEY_AFK_TIMEOUT)) {
Object[] objArr9 = new Object[1];
Object newValue7 = change.getNewValue();
if (newValue7 != null) {
objArr9[0] = Long.valueOf(((Long) newValue7).longValue() / ((long) 60));
return b.h(context, i, objArr9, null, 4);
}
throw new NullPointerException("null cannot be cast to non-null type kotlin.Long");
} else if (hasNewValue(change, ModelAuditLogEntry.CHANGE_KEY_PRUNE_DELETE_DAYS)) {
Object[] objArr10 = new Object[1];
Resources resources2 = context.getResources();
m.checkNotNullExpressionValue(resources2, "context.resources");
Object newValue8 = change.getNewValue();
if (newValue8 != null) {
int intValue = ((Integer) newValue8).intValue();
Object[] objArr11 = new Object[1];
Object newValue9 = change.getNewValue();
if (newValue9 != null) {
objArr11[0] = (Integer) newValue9;
objArr10[0] = StringResourceUtilsKt.getQuantityString(resources2, context, (int) R.plurals.guild_settings_audit_log_member_prune_delete_days_newValue, intValue, objArr11);
return b.h(context, i, objArr10, null, 4);
}
throw new NullPointerException("null cannot be cast to non-null type kotlin.Int");
}
throw new NullPointerException("null cannot be cast to non-null type kotlin.Int");
} else if (hasNewValue(change, ModelAuditLogEntry.CHANGE_KEY_VIDEO_QUALITY_MODE)) {
Object[] objArr12 = new Object[1];
MediaSinkWantsManager.VideoQualityMode.a aVar = MediaSinkWantsManager.VideoQualityMode.Companion;
Object newValue10 = change.getNewValue();
if (newValue10 != null) {
objArr12[0] = getStringForVideoQualityMode(aVar.a(Integer.valueOf((int) ((Long) newValue10).longValue())), context);
return b.h(context, i, objArr12, null, 4);
}
throw new NullPointerException("null cannot be cast to non-null type kotlin.Long");
} else if (!hasNewValue(change, ModelAuditLogEntry.CHANGE_KEY_GUILD_COMMUNICATION_DISABLED)) {
return b.b(context, i, new Object[0], new AuditLogChangeUtils$getChangeTextWithParams$1(change));
} else {
Object[] objArr13 = new Object[1];
Object newValue11 = change.getNewValue();
if (newValue11 != null) {
objArr13[0] = TimeUtils.getReadableTimeString(context, (String) newValue11);
return b.h(context, i, objArr13, null, 4);
}
throw new NullPointerException("null cannot be cast to non-null type kotlin.String");
}
}
}
} catch (MissingFormatArgumentException unused) {
StringBuilder R = a.R("Failed to get string for action id: ");
R.append(modelAuditLogEntry.getActionTypeId() + " and change: " + change.getKey());
String sb = R.toString();
m.checkNotNullExpressionValue(sb, "StringBuilder()\n …}\")\n .toString()");
Logger.e$default(AppLog.g, "Audit Logs", sb, null, null, 12, null);
return "";
} catch (ClassCastException e) {
StringBuilder sb2 = new StringBuilder();
sb2.append(e.getLocalizedMessage() + " for change: ");
sb2.append(change.getKey() + ' ' + change.getNewValue() + ' ' + change.getOldValue());
String sb3 = sb2.toString();
m.checkNotNullExpressionValue(sb3, "StringBuilder()\n …}\")\n .toString()");
Logger.w$default(AppLog.g, sb3, null, 2, null);
return "";
}
}
@StringRes
private final int getChannelChangeString(ModelAuditLogEntry.Change change) {
String key = change.getKey();
if (key != null) {
switch (key.hashCode()) {
case -1920783726:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_REGION_OVERRIDE)) {
return getNullableNewOrOldValueString$default(this, change, Integer.valueOf((int) R.string.guild_settings_audit_log_channel_rtc_region_override_change), Integer.valueOf((int) R.string.guild_settings_audit_log_channel_rtc_region_override_create), Integer.valueOf((int) R.string.guild_settings_audit_log_channel_rtc_region_override_delete), null, 8, null);
}
break;
case -1451708889:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_VIDEO_QUALITY_MODE)) {
return getNullableOldValueString(change, R.string.guild_settings_audit_log_channel_video_quality_mode_create, R.string.guild_settings_audit_log_channel_video_quality_mode_change);
}
break;
case -934964668:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_REASON)) {
return R.string.guild_settings_audit_log_common_reason;
}
break;
case -102270099:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_BITRATE)) {
return getNullableOldValueString(change, R.string.guild_settings_audit_log_channel_bitrate_create, R.string.guild_settings_audit_log_channel_bitrate_change);
}
break;
case 3079692:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_PERMISSIONS_DENIED)) {
return R.string.guild_settings_audit_log_channel_permission_overrides_denied;
}
break;
case 3373707:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_NAME)) {
return getNullableOldValueString(change, R.string.guild_settings_audit_log_channel_name_create, R.string.guild_settings_audit_log_channel_name_change);
}
break;
case 3390806:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_NSFW)) {
Object value = change.getValue();
Objects.requireNonNull(value, "null cannot be cast to non-null type kotlin.Boolean");
boolean booleanValue = ((Boolean) value).booleanValue();
if (!booleanValue) {
return R.string.guild_settings_audit_log_channel_nsfw_disabled;
}
if (booleanValue) {
return R.string.guild_settings_audit_log_channel_nsfw_enabled;
}
throw new NoWhenBranchMatchedException();
}
break;
case 3575610:
if (key.equals("type")) {
return getNullableOldValueString(change, R.string.guild_settings_audit_log_channel_type_create, R.string.guild_settings_audit_log_channel_type_change);
}
break;
case 92906313:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_PERMISSIONS_GRANTED)) {
return R.string.guild_settings_audit_log_channel_permission_overrides_granted;
}
break;
case 108404047:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_PERMISSIONS_RESET)) {
return R.string.guild_settings_audit_log_channel_permission_overrides_reset;
}
break;
case 110546223:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_TOPIC)) {
return getNullableNewOrOldValueString$default(this, change, Integer.valueOf((int) R.string.guild_settings_audit_log_channel_topic_change), Integer.valueOf((int) R.string.guild_settings_audit_log_channel_topic_create), Integer.valueOf((int) R.string.guild_settings_audit_log_channel_topic_clear), null, 8, null);
}
break;
case 747804969:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_POSITION)) {
return getNullableOldValueString(change, R.string.guild_settings_audit_log_channel_position_create, R.string.guild_settings_audit_log_channel_position_change);
}
break;
case 987155184:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_RATE_LIMIT_PER_USER)) {
return getNullableOldValueString(change, R.string.guild_settings_audit_log_channel_rate_limit_per_user_create, R.string.guild_settings_audit_log_channel_rate_limit_per_user_change);
}
break;
case 1702269315:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_DEFAULT_AUTO_ARCHIVE_DURATION)) {
return getNullableOldValueString(change, R.string.guild_settings_audit_log_channel_default_auto_archive_duration_create, R.string.guild_settings_audit_log_channel_default_auto_archive_duration_change);
}
break;
}
}
return 0;
}
@StringRes
private final int getChannelTypeStringResIdFromValue(Integer num) {
if (num != null && num.intValue() == 1) {
return R.string.dm;
}
if (num != null && num.intValue() == 3) {
return R.string.group_dm;
}
if (num != null && num.intValue() == 0) {
return R.string.text_channel;
}
if (num != null && num.intValue() == 2) {
return R.string.voice_channel;
}
if (num != null && num.intValue() == 5) {
return R.string.news_channel;
}
if (num != null && num.intValue() == 6) {
return R.string.store_channel;
}
if (num != null && num.intValue() == 13) {
return R.string.stage_channel;
}
if ((num != null && num.intValue() == 10) || ((num != null && num.intValue() == 11) || (num != null && num.intValue() == 12))) {
return R.string.thread;
}
if (num != null && num.intValue() == 4) {
return R.string.category;
}
return 0;
}
@StringRes
private final int getEmojiChangeString(ModelAuditLogEntry.Change change) {
String key = change.getKey();
if (key != null) {
int hashCode = key.hashCode();
if (hashCode != -934964668) {
if (hashCode == 3373707 && key.equals(ModelAuditLogEntry.CHANGE_KEY_NAME)) {
return getNullableOldValueString(change, R.string.guild_settings_audit_log_emoji_name_create, R.string.guild_settings_audit_log_emoji_name_change);
}
} else if (key.equals(ModelAuditLogEntry.CHANGE_KEY_REASON)) {
return R.string.guild_settings_audit_log_common_reason;
}
}
return 0;
}
@StringRes
private final int getGuildChangeString(ModelAuditLogEntry.Change change) {
String key = change.getKey();
if (key == null) {
return 0;
}
switch (key.hashCode()) {
case -1907190207:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_BANNER_HASH)) {
return R.string.guild_settings_audit_log_guild_banner_hash_change;
}
return 0;
case -1724546052:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_DESCRIPTION)) {
return getNullableNewValueString(change, R.string.guild_settings_audit_log_guild_description_clear, R.string.guild_settings_audit_log_guild_description_change);
}
return 0;
case -1705139351:
if (!key.equals(ModelAuditLogEntry.CHANGE_KEY_EXPLICIT_CONTENT_FILTER)) {
return 0;
}
Object value = change.getValue();
Objects.requireNonNull(value, "null cannot be cast to non-null type kotlin.Long");
int longValue = (int) ((Long) value).longValue();
if (longValue == GuildExplicitContentFilter.NONE.getApiValue()) {
return R.string.guild_settings_audit_log_guild_explicit_content_filter_disable;
}
if (longValue == GuildExplicitContentFilter.SOME.getApiValue()) {
return R.string.guild_settings_audit_log_guild_explicit_content_filter_members_without_roles;
}
if (longValue == GuildExplicitContentFilter.ALL.getApiValue()) {
return R.string.guild_settings_audit_log_guild_explicit_content_filter_all_members;
}
return 0;
case -1572429104:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_AFK_CHANNEL_ID)) {
return getNullableNewValueString(change, R.string.guild_settings_audit_log_guild_afk_channel_id_clear, R.string.guild_settings_audit_log_guild_afk_channel_id_change);
}
return 0;
case -1390796524:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_ICON_HASH)) {
return R.string.guild_settings_audit_log_guild_icon_hash_change;
}
return 0;
case -1100074521:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_SYSTEM_CHANNEL_ID)) {
return getNullableNewValueString(change, R.string.guild_settings_audit_log_guild_system_channel_id_disable, R.string.guild_settings_audit_log_guild_system_channel_id_change);
}
return 0;
case -934964668:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_REASON)) {
return R.string.guild_settings_audit_log_common_reason;
}
return 0;
case -934795532:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_REGION)) {
return R.string.guild_settings_audit_log_guild_region_change;
}
return 0;
case -645093141:
if (!key.equals(ModelAuditLogEntry.CHANGE_KEY_PREMIUM_PROGRESS_BAR_ENABLED)) {
return 0;
}
Object value2 = change.getValue();
Objects.requireNonNull(value2, "null cannot be cast to non-null type kotlin.Boolean");
boolean booleanValue = ((Boolean) value2).booleanValue();
if (booleanValue) {
return R.string.guild_settings_audit_log_guild_premium_progress_bar_enabled_enabled;
}
if (!booleanValue) {
return R.string.guild_settings_audit_log_guild_premium_progress_bar_enabled_disabled;
}
throw new NoWhenBranchMatchedException();
case -506227616:
if (!key.equals(ModelAuditLogEntry.CHANGE_KEY_VERIFICATION_LEVEL)) {
return 0;
}
Object value3 = change.getValue();
Objects.requireNonNull(value3, "null cannot be cast to non-null type kotlin.Long");
int longValue2 = (int) ((Long) value3).longValue();
if (longValue2 == GuildVerificationLevel.NONE.getApiValue()) {
return R.string.guild_settings_audit_log_guild_verification_level_change_none;
}
if (longValue2 == GuildVerificationLevel.LOW.getApiValue()) {
return R.string.guild_settings_audit_log_guild_verification_level_change_low;
}
if (longValue2 == GuildVerificationLevel.MEDIUM.getApiValue()) {
return R.string.guild_settings_audit_log_guild_verification_level_change_medium;
}
if (longValue2 == GuildVerificationLevel.HIGH.getApiValue()) {
return R.string.guild_settings_audit_log_guild_verification_level_change_high;
}
if (longValue2 == GuildVerificationLevel.HIGHEST.getApiValue()) {
return R.string.guild_settings_audit_log_guild_verification_level_change_very_high;
}
return 0;
case -154917112:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_AFK_TIMEOUT)) {
return R.string.guild_settings_audit_log_guild_afk_timeout_change;
}
return 0;
case 3373707:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_NAME)) {
return R.string.guild_settings_audit_log_guild_name_change;
}
return 0;
case 226923479:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_DISCOVERY_SPLASH_HASH)) {
return R.string.guild_settings_audit_log_guild_discovery_splash_hash_change;
}
return 0;
case 643741670:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_SPLASH_HASH)) {
return R.string.guild_settings_audit_log_guild_splash_hash_change;
}
return 0;
case 706006559:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_RULES_CHANNEL_ID)) {
return getNullableNewValueString(change, R.string.guild_settings_audit_log_guild_rules_channel_id_clear, R.string.guild_settings_audit_log_guild_rules_channel_id_change);
}
return 0;
case 945133165:
if (!key.equals(ModelAuditLogEntry.CHANGE_KEY_MFA_LEVEL)) {
return 0;
}
Object value4 = change.getValue();
Objects.requireNonNull(value4, "null cannot be cast to non-null type kotlin.Long");
int longValue3 = (int) ((Long) value4).longValue();
if (longValue3 == 0) {
return R.string.guild_settings_audit_log_guild_mfa_level_disabled;
}
if (longValue3 != 1) {
return 0;
}
return R.string.guild_settings_audit_log_guild_mfa_level_enabled;
case 950953474:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_UPDATES_CHANNEL_ID)) {
return getNullableNewValueString(change, R.string.guild_settings_audit_log_guild_updates_channel_id_clear, R.string.guild_settings_audit_log_guild_updates_channel_id_change);
}
return 0;
case 1207357234:
if (!key.equals(ModelAuditLogEntry.CHANGE_KEY_DEFAULT_MESSAGE_NOTIFICATIONS)) {
return 0;
}
Object value5 = change.getValue();
Objects.requireNonNull(value5, "null cannot be cast to non-null type kotlin.Long");
int longValue4 = (int) ((Long) value5).longValue();
if (longValue4 == 0) {
return R.string.guild_settings_audit_log_guild_default_message_notifications_change_all_messages;
}
if (longValue4 != 1) {
return 0;
}
return R.string.guild_settings_audit_log_guild_default_message_notifications_change_only_mentions;
case 1580684753:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_VANITY_URL_CODE)) {
return getNullableNewValueString(change, R.string.guild_settings_audit_log_guild_vanity_url_code_delete, R.string.guild_settings_audit_log_guild_vanity_url_code_change);
}
return 0;
case 1639242418:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_WIDGET_CHANNEL_ID)) {
return getNullableNewValueString(change, R.string.guild_settings_audit_log_guild_widget_channel_id_delete, R.string.guild_settings_audit_log_guild_widget_channel_id_change);
}
return 0;
case 1663147559:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_OWNER_ID)) {
return R.string.guild_settings_audit_log_guild_owner_id_change;
}
return 0;
case 1792613336:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_PREFERRED_LOCALE)) {
return R.string.guild_settings_audit_log_guild_preferred_locale_change;
}
return 0;
case 2010777670:
if (!key.equals(ModelAuditLogEntry.CHANGE_KEY_WIDGET_ENABLED)) {
return 0;
}
Object value6 = change.getValue();
Objects.requireNonNull(value6, "null cannot be cast to non-null type kotlin.Boolean");
boolean booleanValue2 = ((Boolean) value6).booleanValue();
if (booleanValue2) {
return R.string.guild_settings_audit_log_guild_widget_enabled;
}
if (!booleanValue2) {
return R.string.guild_settings_audit_log_guild_widget_disabled;
}
throw new NoWhenBranchMatchedException();
default:
return 0;
}
}
@StringRes
private final int getGuildScheduledEventChangeString(ModelAuditLogEntry.Change change) {
String key = change.getKey();
if (key == null) {
return 0;
}
switch (key.hashCode()) {
case -1930808873:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_CHANNEL_ID)) {
return getNullableNewValueString(change, R.string.guild_settings_audit_log_scheduled_event_channel_clear, R.string.guild_settings_audit_log_scheduled_event_channel);
}
return 0;
case -1724546052:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_DESCRIPTION)) {
return R.string.guild_settings_audit_log_scheduled_event_description_create;
}
return 0;
case -892481550:
if (!key.equals("status")) {
return 0;
}
Object value = change.getValue();
Objects.requireNonNull(value, "null cannot be cast to non-null type kotlin.Long");
int longValue = (int) ((Long) value).longValue();
if (longValue == GuildScheduledEventStatus.SCHEDULED.getApiValue()) {
return R.string.guild_settings_audit_log_scheduled_event_status_scheduled;
}
if (longValue == GuildScheduledEventStatus.ACTIVE.getApiValue()) {
return R.string.guild_settings_audit_log_scheduled_event_status_active;
}
if (longValue == GuildScheduledEventStatus.COMPLETED.getApiValue()) {
return R.string.guild_settings_audit_log_scheduled_event_status_completed;
}
if (longValue == GuildScheduledEventStatus.CANCELED.getApiValue()) {
return R.string.guild_settings_audit_log_scheduled_event_status_canceled;
}
return 0;
case 3373707:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_NAME)) {
return R.string.guild_settings_audit_log_scheduled_event_name_create;
}
return 0;
case 1281710614:
if (!key.equals(ModelAuditLogEntry.CHANGE_KEY_ENTITY_TYPE)) {
return 0;
}
Object value2 = change.getValue();
Objects.requireNonNull(value2, "null cannot be cast to non-null type kotlin.Long");
int longValue2 = (int) ((Long) value2).longValue();
if (longValue2 == GuildScheduledEventEntityType.NONE.getApiValue()) {
return R.string.guild_settings_audit_log_scheduled_event_entity_type_none;
}
if (longValue2 == GuildScheduledEventEntityType.STAGE_INSTANCE.getApiValue()) {
return R.string.guild_settings_audit_log_scheduled_event_entity_type_stage_instance;
}
if (longValue2 == GuildScheduledEventEntityType.VOICE.getApiValue()) {
return R.string.guild_settings_audit_log_scheduled_event_entity_type_voice;
}
if (longValue2 == GuildScheduledEventEntityType.EXTERNAL.getApiValue()) {
return R.string.guild_settings_audit_log_scheduled_event_entity_type_external;
}
return 0;
case 1901043637:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_LOCATION)) {
return getNullableNewValueString(change, R.string.guild_settings_audit_log_scheduled_event_location_clear, R.string.guild_settings_audit_log_scheduled_event_location);
}
return 0;
case 1965579277:
if (!key.equals(ModelAuditLogEntry.CHANGE_KEY_PRIVACY_LEVEL)) {
return 0;
}
Object value3 = change.getValue();
Objects.requireNonNull(value3, "null cannot be cast to non-null type kotlin.Long");
int longValue3 = (int) ((Long) value3).longValue();
if (longValue3 == StageInstancePrivacyLevel.GUILD_ONLY.getApiValue()) {
return R.string.guild_settings_audit_log_stage_instance_privacy_level_guild_only;
}
if (longValue3 == StageInstancePrivacyLevel.PUBLIC.getApiValue()) {
return R.string.guild_settings_audit_log_stage_instance_privacy_level_public;
}
return 0;
default:
return 0;
}
}
@StringRes
private final int getIntegrationChangeString(ModelAuditLogEntry.Change change) {
String key = change.getKey();
if (key == null) {
return 0;
}
int hashCode = key.hashCode();
if (hashCode != -1743820047) {
if (hashCode != -486786702) {
if (hashCode == 1767574344 && key.equals(ModelAuditLogEntry.CHANGE_KEY_EXPIRE_GRACE_PERIOD)) {
return R.string.guild_settings_audit_log_integration_expire_grace_period;
}
return 0;
} else if (!key.equals(ModelAuditLogEntry.CHANGE_KEY_EXPIRE_BEHAVIOR)) {
return 0;
} else {
Object value = change.getValue();
Objects.requireNonNull(value, "null cannot be cast to non-null type kotlin.Long");
int longValue = (int) ((Long) value).longValue();
if (longValue == 0) {
return R.string.guild_settings_audit_log_integration_expire_behavior_remove_synced_role;
}
if (longValue != 1) {
return 0;
}
return R.string.guild_settings_audit_log_integration_expire_behavior_kick_from_server;
}
} else if (!key.equals(ModelAuditLogEntry.CHANGE_KEY_ENABLE_EMOTICONS)) {
return 0;
} else {
Object value2 = change.getValue();
Objects.requireNonNull(value2, "null cannot be cast to non-null type kotlin.Boolean");
boolean booleanValue = ((Boolean) value2).booleanValue();
if (booleanValue) {
return R.string.guild_settings_audit_log_integration_enable_emoticons_on;
}
if (!booleanValue) {
return R.string.guild_settings_audit_log_integration_enable_emoticons_off;
}
throw new NoWhenBranchMatchedException();
}
}
@StringRes
private final int getInviteChangeString(ModelAuditLogEntry.Change change) {
String key = change.getKey();
if (key != null) {
switch (key.hashCode()) {
case -1930808873:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_CHANNEL_ID)) {
return R.string.guild_settings_audit_log_invite_channel_create;
}
break;
case -934964668:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_REASON)) {
return R.string.guild_settings_audit_log_common_reason;
}
break;
case 3059181:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_CODE)) {
return R.string.guild_settings_audit_log_invite_code_create;
}
break;
case 408141255:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_MAX_USES)) {
Object value = change.getValue();
Objects.requireNonNull(value, "null cannot be cast to non-null type kotlin.Long");
return ((int) ((Long) value).longValue()) != 0 ? R.string.guild_settings_audit_log_invite_max_uses_create : R.string.guild_settings_audit_log_invite_max_uses_create_infinite;
}
break;
case 844430244:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_MAX_AGE)) {
Object value2 = change.getValue();
Objects.requireNonNull(value2, "null cannot be cast to non-null type kotlin.Long");
return ((int) ((Long) value2).longValue()) != 0 ? R.string.guild_settings_audit_log_invite_max_age_create : R.string.guild_settings_audit_log_invite_max_age_create_infinite;
}
break;
case 1984986705:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_TEMPORARY)) {
Object value3 = change.getValue();
Objects.requireNonNull(value3, "null cannot be cast to non-null type kotlin.Boolean");
boolean booleanValue = ((Boolean) value3).booleanValue();
if (booleanValue) {
return R.string.guild_settings_audit_log_invite_temporary_on;
}
if (!booleanValue) {
return R.string.guild_settings_audit_log_invite_temporary_off;
}
throw new NoWhenBranchMatchedException();
}
break;
}
}
return 0;
}
private final int getNullableNewOrOldValueString(ModelAuditLogEntry.Change change, @StringRes Integer num, @StringRes Integer num2, @StringRes Integer num3, @StringRes Integer num4) {
if (change.getNewValue() == null || change.getOldValue() == null) {
num = change.getNewValue() != null ? num2 : change.getOldValue() != null ? num3 : num4;
}
if (num != null) {
return num.intValue();
}
return 0;
}
public static /* synthetic */ int getNullableNewOrOldValueString$default(AuditLogChangeUtils auditLogChangeUtils, ModelAuditLogEntry.Change change, Integer num, Integer num2, Integer num3, Integer num4, int i, Object obj) {
return auditLogChangeUtils.getNullableNewOrOldValueString(change, (i & 1) != 0 ? null : num, (i & 2) != 0 ? null : num2, (i & 4) != 0 ? null : num3, (i & 8) != 0 ? null : num4);
}
private final int getNullableNewValueString(ModelAuditLogEntry.Change change, @StringRes int i, @StringRes int i2) {
return change.getNewValue() == null ? i : i2;
}
private final int getNullableOldValueString(ModelAuditLogEntry.Change change, @StringRes int i, @StringRes int i2) {
return change.getOldValue() == null ? i : i2;
}
/* JADX WARNING: Removed duplicated region for block: B:25:0x0069 */
private final String getOverridesPluralString(Context context, ModelAuditLogEntry.Change change, ModelAuditLogEntry modelAuditLogEntry, Map<ModelAuditLogEntry.TargetType, ? extends Map<Long, ? extends CharSequence>> map) {
Object obj;
String key;
Object value = change.getValue();
Objects.requireNonNull(value, "null cannot be cast to non-null type kotlin.collections.Collection<*>");
Collection collection = (Collection) value;
ModelAuditLogEntry.Options options = modelAuditLogEntry.getOptions();
Integer valueOf = options != null ? Integer.valueOf(options.getType()) : null;
Object obj2 = "";
if (valueOf != null && valueOf.intValue() == 1) {
Map map2 = (Map) map.get(ModelAuditLogEntry.TargetType.USER);
if (map2 != null) {
ModelAuditLogEntry.Options options2 = modelAuditLogEntry.getOptions();
obj = (CharSequence) map2.get(options2 != null ? Long.valueOf(options2.getId()) : null);
key = change.getKey();
if (key != null) {
int hashCode = key.hashCode();
if (hashCode != 3079692) {
if (hashCode != 92906313) {
if (hashCode == 108404047 && key.equals(ModelAuditLogEntry.CHANGE_KEY_PERMISSIONS_RESET)) {
Resources resources = context.getResources();
m.checkNotNullExpressionValue(resources, "context.resources");
obj2 = b.h(context, R.string.guild_settings_audit_log_channel_permission_overrides_reset, new Object[]{StringResourceUtilsKt.getQuantityString(resources, context, (int) R.plurals.guild_settings_audit_log_channel_permission_overrides_reset_count, collection.size(), Integer.valueOf(collection.size())), obj}, null, 4);
}
} else if (key.equals(ModelAuditLogEntry.CHANGE_KEY_PERMISSIONS_GRANTED)) {
Resources resources2 = context.getResources();
m.checkNotNullExpressionValue(resources2, "context.resources");
obj2 = b.h(context, R.string.guild_settings_audit_log_channel_permission_overrides_granted, new Object[]{StringResourceUtilsKt.getQuantityString(resources2, context, (int) R.plurals.guild_settings_audit_log_channel_permission_overrides_granted_count, collection.size(), Integer.valueOf(collection.size())), obj}, null, 4);
}
} else if (key.equals(ModelAuditLogEntry.CHANGE_KEY_PERMISSIONS_DENIED)) {
Resources resources3 = context.getResources();
m.checkNotNullExpressionValue(resources3, "context.resources");
obj2 = b.h(context, R.string.guild_settings_audit_log_channel_permission_overrides_denied, new Object[]{StringResourceUtilsKt.getQuantityString(resources3, context, (int) R.plurals.guild_settings_audit_log_channel_permission_overrides_denied_count, collection.size(), Integer.valueOf(collection.size())), obj}, null, 4);
}
}
return obj2.toString();
}
} else if (valueOf != null && valueOf.intValue() == 0) {
ModelAuditLogEntry.Options options3 = modelAuditLogEntry.getOptions();
if (options3 != null) {
obj = options3.getRoleName();
key = change.getKey();
if (key != null) {
}
return obj2.toString();
}
} else {
obj = obj2;
key = change.getKey();
if (key != null) {
}
return obj2.toString();
}
obj = null;
key = change.getKey();
if (key != null) {
}
return obj2.toString();
}
private final CharSequence getPluralString(Context context, ModelAuditLogEntry.Change change) {
Object value = change.getValue();
Objects.requireNonNull(value, "null cannot be cast to non-null type kotlin.collections.Collection<*>");
Collection collection = (Collection) value;
String key = change.getKey();
if (key != null) {
switch (key.hashCode()) {
case 1168893:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_ROLES_ADD)) {
Resources resources = context.getResources();
m.checkNotNullExpressionValue(resources, "context.resources");
return StringResourceUtilsKt.getQuantityString(resources, context, (int) R.plurals.guild_settings_audit_log_member_roles_add_count, collection.size(), Integer.valueOf(collection.size()));
}
break;
case 3079692:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_PERMISSIONS_DENIED)) {
Resources resources2 = context.getResources();
m.checkNotNullExpressionValue(resources2, "context.resources");
return StringResourceUtilsKt.getQuantityString(resources2, context, (int) R.plurals.guild_settings_audit_log_channel_permission_overrides_denied_count, collection.size(), Integer.valueOf(collection.size()));
}
break;
case 92906313:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_PERMISSIONS_GRANTED)) {
Resources resources3 = context.getResources();
m.checkNotNullExpressionValue(resources3, "context.resources");
return StringResourceUtilsKt.getQuantityString(resources3, context, (int) R.plurals.guild_settings_audit_log_channel_permission_overrides_granted_count, collection.size(), Integer.valueOf(collection.size()));
}
break;
case 950750632:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_ROLES_REMOVE)) {
Resources resources4 = context.getResources();
m.checkNotNullExpressionValue(resources4, "context.resources");
return StringResourceUtilsKt.getQuantityString(resources4, context, (int) R.plurals.guild_settings_audit_log_member_roles_remove_count, collection.size(), Integer.valueOf(collection.size()));
}
break;
}
}
return "";
}
@StringRes
private final int getRoleChangeString(ModelAuditLogEntry.Change change) {
String key = change.getKey();
if (key != null) {
switch (key.hashCode()) {
case -1390796524:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_ICON_HASH)) {
return R.string.guild_settings_audit_log_role_icon_hash_change;
}
break;
case -934964668:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_REASON)) {
return R.string.guild_settings_audit_log_common_reason;
}
break;
case 3079692:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_PERMISSIONS_DENIED)) {
return R.string.guild_settings_audit_log_role_permissions_denied;
}
break;
case 3373707:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_NAME)) {
return getNullableOldValueString(change, R.string.guild_settings_audit_log_role_name_create, R.string.guild_settings_audit_log_role_name_change);
}
break;
case 64859716:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_MENTIONABLE)) {
Object value = change.getValue();
Objects.requireNonNull(value, "null cannot be cast to non-null type kotlin.Boolean");
boolean booleanValue = ((Boolean) value).booleanValue();
if (booleanValue) {
return R.string.guild_settings_audit_log_role_mentionable_on;
}
if (!booleanValue) {
return R.string.guild_settings_audit_log_role_mentionable_off;
}
throw new NoWhenBranchMatchedException();
}
break;
case 92906313:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_PERMISSIONS_GRANTED)) {
return R.string.guild_settings_audit_log_role_permissions_granted;
}
break;
case 94842723:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_COLOR)) {
Object value2 = change.getValue();
Objects.requireNonNull(value2, "null cannot be cast to non-null type kotlin.Long");
return ((Long) value2).longValue() == 0 ? R.string.guild_settings_audit_log_role_color_none : R.string.guild_settings_audit_log_role_color;
}
break;
case 99457571:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_HOIST)) {
Object value3 = change.getValue();
Objects.requireNonNull(value3, "null cannot be cast to non-null type kotlin.Boolean");
boolean booleanValue2 = ((Boolean) value3).booleanValue();
if (booleanValue2) {
return R.string.guild_settings_audit_log_role_hoist_on;
}
if (!booleanValue2) {
return R.string.guild_settings_audit_log_role_hoist_off;
}
throw new NoWhenBranchMatchedException();
}
break;
case 1052836964:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_UNICODE_EMOJI)) {
return R.string.guild_settings_audit_log_role_unicode_emoji_change;
}
break;
}
}
return 0;
}
@StringRes
private final int getStageInstanceChangeString(ModelAuditLogEntry.Change change) {
String key = change.getKey();
if (key == null) {
return 0;
}
int hashCode = key.hashCode();
if (hashCode != 110546223) {
if (hashCode != 1965579277 || !key.equals(ModelAuditLogEntry.CHANGE_KEY_PRIVACY_LEVEL)) {
return 0;
}
Object value = change.getValue();
Objects.requireNonNull(value, "null cannot be cast to non-null type kotlin.Long");
int longValue = (int) ((Long) value).longValue();
if (longValue == StageInstancePrivacyLevel.GUILD_ONLY.getApiValue()) {
return R.string.guild_settings_audit_log_stage_instance_privacy_level_guild_only;
}
if (longValue == StageInstancePrivacyLevel.PUBLIC.getApiValue()) {
return R.string.guild_settings_audit_log_stage_instance_privacy_level_public;
}
return 0;
} else if (key.equals(ModelAuditLogEntry.CHANGE_KEY_TOPIC)) {
return getNullableOldValueString(change, R.string.guild_settings_audit_log_channel_topic_create, R.string.guild_settings_audit_log_channel_topic_change);
} else {
return 0;
}
}
@StringRes
private final int getStickerChangeString(ModelAuditLogEntry.Change change) {
String key = change.getKey();
if (key != null) {
int hashCode = key.hashCode();
if (hashCode != -1724546052) {
if (hashCode != 3373707) {
if (hashCode == 3552281 && key.equals(ModelAuditLogEntry.CHANGE_KEY_TAGS)) {
return getNullableOldValueString(change, R.string.guild_settings_audit_log_tags_create, R.string.guild_settings_audit_log_tags_change);
}
} else if (key.equals(ModelAuditLogEntry.CHANGE_KEY_NAME)) {
return getNullableOldValueString(change, R.string.guild_settings_audit_log_name_create, R.string.guild_settings_audit_log_name_change);
}
} else if (key.equals(ModelAuditLogEntry.CHANGE_KEY_DESCRIPTION)) {
return getNullableOldValueString(change, R.string.guild_settings_audit_log_description_create, R.string.guild_settings_audit_log_description_change);
}
}
return 0;
}
@StringRes
private final int getStringForPermission(long j, ModelAuditLogEntry modelAuditLogEntry) {
if (j == 1) {
return R.string.create_instant_invite;
}
if (j == 2) {
return R.string.kick_members;
}
if (j == 4) {
return R.string.ban_members;
}
if (j == 8) {
return R.string.administrator;
}
if (j == 16) {
return (modelAuditLogEntry.getTargetType() == ModelAuditLogEntry.TargetType.CHANNEL || modelAuditLogEntry.getTargetType() == ModelAuditLogEntry.TargetType.CHANNEL_OVERWRITE) ? R.string.manage_channel : R.string.manage_channels;
}
if (j == 32) {
return R.string.manage_server;
}
if (j == Permission.VIEW_GUILD_ANALYTICS) {
return R.string.view_guild_analytics;
}
if (j == Permission.CHANGE_NICKNAME) {
return R.string.change_nickname;
}
if (j == Permission.MANAGE_NICKNAMES) {
return R.string.manage_nicknames;
}
if (j == Permission.MANAGE_ROLES) {
return R.string.manage_roles;
}
if (j == Permission.MANAGE_WEBHOOKS) {
return R.string.manage_webhooks;
}
if (j == Permission.MANAGE_EMOJIS_AND_STICKERS) {
return R.string.manage_emojis_and_stickers;
}
if (j == Permission.MANAGE_EVENTS) {
return R.string.manage_events;
}
if (j == 128) {
return R.string.view_audit_log;
}
if (j == Permission.VIEW_CHANNEL) {
return R.string.read_messages;
}
if (j == Permission.SEND_MESSAGES) {
return R.string.send_messages;
}
if (j == Permission.SEND_TTS_MESSAGES) {
return R.string.send_tts_messages;
}
if (j == Permission.MANAGE_MESSAGES) {
return R.string.manage_messages;
}
if (j == Permission.EMBED_LINKS) {
return R.string.embed_links;
}
if (j == Permission.ATTACH_FILES) {
return R.string.attach_files;
}
if (j == Permission.READ_MESSAGE_HISTORY) {
return R.string.read_message_history;
}
if (j == Permission.MENTION_EVERYONE) {
return R.string.mention_everyone_android;
}
if (j == Permission.USE_EXTERNAL_EMOJIS) {
return R.string.use_external_emojis;
}
if (j == Permission.USE_EXTERNAL_STICKERS) {
return R.string.role_permissions_use_external_stickers;
}
if (j == 64) {
return R.string.add_reactions;
}
if (j == Permission.CONNECT) {
return R.string.connect;
}
if (j == Permission.SPEAK) {
return R.string.speak;
}
if (j == Permission.MUTE_MEMBERS) {
return R.string.mute_members;
}
if (j == Permission.DEAFEN_MEMBERS) {
return R.string.deafen_members;
}
if (j == Permission.MOVE_MEMBERS) {
return R.string.move_members;
}
if (j == Permission.USE_VAD) {
return R.string.use_vad;
}
if (j == 256) {
return R.string.priority_speaker;
}
if (j == 512) {
return R.string.video;
}
if (j == Permission.USE_APPLICATION_COMMANDS) {
return R.string.use_application_commands;
}
if (j == Permission.REQUEST_TO_SPEAK) {
return R.string.request_to_speak;
}
if (j == Permission.SEND_MESSAGES_IN_THREADS) {
return R.string.send_messages_in_threads;
}
if (j == Permission.CREATE_PUBLIC_THREADS) {
return R.string.create_public_threads;
}
if (j == Permission.CREATE_PRIVATE_THREADS) {
return R.string.create_private_threads;
}
if (j == Permission.MANAGE_THREADS) {
return R.string.manage_threads;
}
if (j == Permission.MODERATE_MEMBERS) {
return R.string.moderate_member;
}
return 0;
}
private final CharSequence getStringForVideoQualityMode(MediaSinkWantsManager.VideoQualityMode videoQualityMode, Context context) {
int ordinal = videoQualityMode.ordinal();
if (ordinal == 0) {
return b.h(context, R.string.video_quality_mode_auto, new Object[0], null, 4);
}
if (ordinal == 1) {
return b.h(context, R.string.video_quality_mode_full, new Object[0], null, 4);
}
throw new NoWhenBranchMatchedException();
}
private final int getTextColor(Context context, ModelAuditLogEntry modelAuditLogEntry) {
ModelAuditLogEntry.ActionType actionType = modelAuditLogEntry.getActionType();
if (actionType != null) {
int ordinal = actionType.ordinal();
if (ordinal == 1) {
return ColorCompat.getColor(context, (int) R.color.status_green_500);
}
if (ordinal == 2) {
return ColorCompat.getColor(context, (int) R.color.status_yellow_400);
}
if (ordinal == 3) {
return ColorCompat.getColor(context, (int) R.color.status_red_400);
}
}
return ColorCompat.getColor(context, (int) R.color.primary_300);
}
@StringRes
private final int getThreadChangeString(ModelAuditLogEntry.Change change) {
String key = change.getKey();
if (key != null) {
switch (key.hashCode()) {
case -1716307998:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_ARCHIVED)) {
Object value = change.getValue();
Objects.requireNonNull(value, "null cannot be cast to non-null type kotlin.Boolean");
boolean booleanValue = ((Boolean) value).booleanValue();
if (booleanValue) {
return R.string.guild_settings_audit_log_thread_archived;
}
if (!booleanValue) {
return R.string.guild_settings_audit_log_thread_unarchived;
}
throw new NoWhenBranchMatchedException();
}
break;
case -1097452790:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_LOCKED)) {
Object value2 = change.getValue();
Objects.requireNonNull(value2, "null cannot be cast to non-null type kotlin.Boolean");
boolean booleanValue2 = ((Boolean) value2).booleanValue();
if (booleanValue2) {
return R.string.guild_settings_audit_log_thread_locked;
}
if (!booleanValue2) {
return R.string.guild_settings_audit_log_thread_unlocked;
}
throw new NoWhenBranchMatchedException();
}
break;
case 3373707:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_NAME)) {
return getNullableOldValueString(change, R.string.guild_settings_audit_log_thread_name_create, R.string.guild_settings_audit_log_thread_name_change);
}
break;
case 987155184:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_RATE_LIMIT_PER_USER)) {
return getNullableOldValueString(change, R.string.guild_settings_audit_log_channel_rate_limit_per_user_create, R.string.guild_settings_audit_log_channel_rate_limit_per_user_change);
}
break;
case 1901007105:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_AUTO_ARCHIVE_DURATION)) {
return getNullableOldValueString(change, R.string.guild_settings_audit_log_thread_auto_archive_duration_create, R.string.guild_settings_audit_log_thread_auto_archive_duration_change);
}
break;
}
}
return 0;
}
@StringRes
private final int getUserChangeString(ModelAuditLogEntry.Change change) {
String key = change.getKey();
if (key != null) {
switch (key.hashCode()) {
case -1919744682:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_PRUNE_DELETE_DAYS)) {
return R.string.guild_settings_audit_log_member_prune_delete_days;
}
break;
case -934964668:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_REASON)) {
return R.string.guild_settings_audit_log_common_reason;
}
break;
case 1168893:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_ROLES_ADD)) {
return R.string.guild_settings_audit_log_member_roles_add;
}
break;
case 3079270:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_DEAF)) {
Object value = change.getValue();
Objects.requireNonNull(value, "null cannot be cast to non-null type kotlin.Boolean");
boolean booleanValue = ((Boolean) value).booleanValue();
if (booleanValue) {
return R.string.guild_settings_audit_log_member_deaf_on;
}
if (!booleanValue) {
return R.string.guild_settings_audit_log_member_deaf_off;
}
throw new NoWhenBranchMatchedException();
}
break;
case 3363353:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_MUTE)) {
Object value2 = change.getValue();
Objects.requireNonNull(value2, "null cannot be cast to non-null type kotlin.Boolean");
boolean booleanValue2 = ((Boolean) value2).booleanValue();
if (booleanValue2) {
return R.string.guild_settings_audit_log_member_mute_on;
}
if (!booleanValue2) {
return R.string.guild_settings_audit_log_member_mute_off;
}
throw new NoWhenBranchMatchedException();
}
break;
case 3381091:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_NICK)) {
return getNullableNewOrOldValueString$default(this, change, Integer.valueOf((int) R.string.guild_settings_audit_log_member_nick_change), Integer.valueOf((int) R.string.guild_settings_audit_log_member_nick_create), Integer.valueOf((int) R.string.guild_settings_audit_log_member_nick_delete), null, 8, null);
}
break;
case 950750632:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_ROLES_REMOVE)) {
return R.string.guild_settings_audit_log_member_roles_remove;
}
break;
case 1217496932:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_GUILD_COMMUNICATION_DISABLED)) {
return getNullableNewValueString(change, R.string.guild_settings_audit_log_communication_disabled_until_removed, R.string.guild_settings_audit_log_communication_disabled_until);
}
break;
}
}
return 0;
}
@StringRes
private final int getWebhookChangeString(ModelAuditLogEntry.Change change) {
String key = change.getKey();
if (key != null) {
switch (key.hashCode()) {
case -1930808873:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_CHANNEL_ID)) {
return getNullableOldValueString(change, R.string.guild_settings_audit_log_webhook_channel_create, R.string.guild_settings_audit_log_webhook_channel_change);
}
break;
case -934964668:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_REASON)) {
return R.string.guild_settings_audit_log_common_reason;
}
break;
case 3373707:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_NAME)) {
return getNullableOldValueString(change, R.string.guild_settings_audit_log_webhook_name_create, R.string.guild_settings_audit_log_webhook_name_change);
}
break;
case 396929076:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_AVATAR_HASH)) {
return R.string.guild_settings_audit_log_webhook_avatar;
}
break;
}
}
return 0;
}
private final boolean hasNewValue(ModelAuditLogEntry.Change change, String str) {
return change.getNewValue() != null && m.areEqual(change.getKey(), str);
}
private final String renderPermissionList(ModelAuditLogEntry.Change change, ModelAuditLogEntry modelAuditLogEntry, Context context) {
Object value = change.getValue();
if (!(value instanceof Set)) {
value = null;
}
Set set = (Set) value;
return set != null ? q.joinToString$default(q.filterNot(q.map(q.filter(q.mapNotNull(q.sorted(u.asSequence(set)), new AuditLogChangeUtils$renderPermissionList$1(modelAuditLogEntry)), AuditLogChangeUtils$renderPermissionList$2.INSTANCE), new AuditLogChangeUtils$renderPermissionList$3(context)), AuditLogChangeUtils$renderPermissionList$4.INSTANCE), null, null, null, 0, null, null, 63, null) : "";
}
private final String renderPermissions(ModelAuditLogEntry.Change change, ModelAuditLogEntry modelAuditLogEntry, Context context, Map<ModelAuditLogEntry.TargetType, ? extends Map<Long, ? extends CharSequence>> map) {
return getOverridesPluralString(context, change, modelAuditLogEntry, map) + "\n" + renderPermissionList(change, modelAuditLogEntry, context);
}
private final String renderRoles(Context context, ModelAuditLogEntry.Change change) {
String str = getPluralString(context, change).toString() + "\n";
Object newValue = change.getNewValue();
Objects.requireNonNull(newValue, "null cannot be cast to non-null type kotlin.collections.List<com.discord.models.domain.ModelAuditLogEntry.ChangeNameId>");
boolean z2 = false;
for (ModelAuditLogEntry.ChangeNameId changeNameId : (List) newValue) {
if (z2) {
str = a.v(str, ", ");
} else {
z2 = true;
}
StringBuilder R = a.R(str);
R.append(changeNameId.getName());
str = R.toString();
}
return str;
}
private final boolean shouldNotRenderChange(ModelAuditLogEntry modelAuditLogEntry, ModelAuditLogEntry.Change change) {
String key;
if (modelAuditLogEntry.getActionType() != ModelAuditLogEntry.ActionType.DELETE || RENDERABLE_DELETE_ACTION_TYPES.contains(Integer.valueOf(modelAuditLogEntry.getActionTypeId()))) {
if (modelAuditLogEntry.getTargetType() == ModelAuditLogEntry.TargetType.CHANNEL) {
String key2 = change.getKey();
if (key2 == null) {
return false;
}
int hashCode = key2.hashCode();
if (hashCode != 3355) {
if (hashCode != 852040376 || !key2.equals(ModelAuditLogEntry.CHANGE_KEY_PERMISSION_OVERWRITES)) {
return false;
}
} else if (!key2.equals(ModelAuditLogEntry.CHANGE_KEY_ID)) {
return false;
}
} else if (modelAuditLogEntry.getTargetType() == ModelAuditLogEntry.TargetType.CHANNEL_OVERWRITE) {
String key3 = change.getKey();
if (key3 == null) {
return false;
}
int hashCode2 = key3.hashCode();
if (hashCode2 != 3355) {
if (hashCode2 != 3575610) {
if (hashCode2 != 852040376 || !key3.equals(ModelAuditLogEntry.CHANGE_KEY_PERMISSION_OVERWRITES)) {
return false;
}
} else if (!key3.equals("type")) {
return false;
}
} else if (!key3.equals(ModelAuditLogEntry.CHANGE_KEY_ID)) {
return false;
}
} else if (modelAuditLogEntry.getTargetType() == ModelAuditLogEntry.TargetType.INVITE) {
String key4 = change.getKey();
if (key4 == null) {
return false;
}
int hashCode3 = key4.hashCode();
if (hashCode3 != 3599308) {
if (hashCode3 != 1198966417 || !key4.equals(ModelAuditLogEntry.CHANGE_KEY_INVITER_ID)) {
return false;
}
} else if (!key4.equals(ModelAuditLogEntry.CHANGE_KEY_USES)) {
return false;
}
} else if (modelAuditLogEntry.getTargetType() == ModelAuditLogEntry.TargetType.WEBHOOK) {
String key5 = change.getKey();
if (key5 == null) {
return false;
}
int hashCode4 = key5.hashCode();
if (hashCode4 != -1287148950) {
if (hashCode4 != 3575610 || !key5.equals("type")) {
return false;
}
} else if (!key5.equals(ModelAuditLogEntry.CHANGE_KEY_APPLICATION_ID)) {
return false;
}
} else if (modelAuditLogEntry.getTargetType() == ModelAuditLogEntry.TargetType.INTEGRATION) {
String key6 = change.getKey();
if (key6 == null || key6.hashCode() != 3575610 || !key6.equals("type")) {
return false;
}
} else if (modelAuditLogEntry.getTargetType() != ModelAuditLogEntry.TargetType.STICKER || (key = change.getKey()) == null) {
return false;
} else {
switch (key.hashCode()) {
case -1724546052:
if (key.equals(ModelAuditLogEntry.CHANGE_KEY_DESCRIPTION)) {
return t.isBlank(change.getValue().toString());
}
return false;
case -1306538777:
if (!key.equals(ModelAuditLogEntry.CHANGE_KEY_GUILD_ID)) {
return false;
}
break;
case -733902135:
if (!key.equals(ModelAuditLogEntry.CHANGE_KEY_AVAILABLE)) {
return false;
}
break;
case 3355:
if (!key.equals(ModelAuditLogEntry.CHANGE_KEY_ID)) {
return false;
}
break;
case 3575610:
if (!key.equals("type")) {
return false;
}
break;
case 93121264:
if (!key.equals(ModelAuditLogEntry.CHANGE_KEY_ASSET)) {
return false;
}
break;
case 1458614914:
if (!key.equals(ModelAuditLogEntry.CHANGE_KEY_FORMAT_TYPE)) {
return false;
}
break;
default:
return false;
}
}
}
return true;
}
/* JADX WARNING: Removed duplicated region for block: B:47:0x017c A[SYNTHETIC] */
/* JADX WARNING: Removed duplicated region for block: B:48:0x00a0 A[SYNTHETIC] */
public final CharSequence getChangeSummary(Context context, ModelAuditLogEntry modelAuditLogEntry, Map<ModelAuditLogEntry.TargetType, ? extends Map<Long, ? extends CharSequence>> map) {
int i;
int ordinal;
int i2;
m.checkNotNullParameter(context, "context");
m.checkNotNullParameter(modelAuditLogEntry, "auditLogEntry");
m.checkNotNullParameter(map, "targets");
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder();
Typeface create = Typeface.create(FontUtils.INSTANCE.getThemedFont(context, R.attr.font_monospace), 0);
List<ModelAuditLogEntry.Change> changes = modelAuditLogEntry.getChanges();
if (changes != null) {
int i3 = 0;
for (ModelAuditLogEntry.Change change : changes) {
AuditLogChangeUtils auditLogChangeUtils = INSTANCE;
m.checkNotNullExpressionValue(change, "change");
if (!auditLogChangeUtils.shouldNotRenderChange(modelAuditLogEntry, change)) {
ModelAuditLogEntry.TargetType targetType = modelAuditLogEntry.getTargetType();
if (!(targetType == null || (ordinal = targetType.ordinal()) == 0)) {
switch (ordinal) {
case 2:
i2 = auditLogChangeUtils.getGuildChangeString(change);
i = i2;
break;
case 3:
case 4:
i2 = auditLogChangeUtils.getChannelChangeString(change);
i = i2;
break;
case 5:
i2 = auditLogChangeUtils.getUserChangeString(change);
i = i2;
break;
case 6:
i2 = auditLogChangeUtils.getRoleChangeString(change);
i = i2;
break;
case 7:
i2 = auditLogChangeUtils.getInviteChangeString(change);
i = i2;
break;
case 8:
i2 = auditLogChangeUtils.getWebhookChangeString(change);
i = i2;
break;
case 9:
i2 = auditLogChangeUtils.getEmojiChangeString(change);
i = i2;
break;
case 10:
i2 = auditLogChangeUtils.getIntegrationChangeString(change);
i = i2;
break;
case 11:
i2 = auditLogChangeUtils.getStageInstanceChangeString(change);
i = i2;
break;
case 12:
i2 = auditLogChangeUtils.getGuildScheduledEventChangeString(change);
i = i2;
break;
case 13:
i2 = auditLogChangeUtils.getStickerChangeString(change);
i = i2;
break;
case 14:
i2 = auditLogChangeUtils.getThreadChangeString(change);
i = i2;
break;
}
if (i == 0) {
int i4 = i3 + 1;
if (i4 != 1) {
spannableStringBuilder.append((CharSequence) "\n");
}
int max = Math.max(spannableStringBuilder.length() - 1, 0);
spannableStringBuilder.append((CharSequence) (auditLogChangeUtils.getChangeNumberString(i4) + ""));
int length = spannableStringBuilder.length() - 1;
spannableStringBuilder.setSpan(new ForegroundColorSpan(auditLogChangeUtils.getTextColor(context, modelAuditLogEntry)), max, length, 33);
m.checkNotNullExpressionValue(create, "numberTypeface");
spannableStringBuilder.setSpan(new TypefaceSpanCompat(create), max, length, 33);
Long l = null;
spannableStringBuilder.append(b.l(auditLogChangeUtils.getChangeTextWithParams(context, modelAuditLogEntry, change, i, map), new Object[0], null, 2));
if (m.areEqual(change.getKey(), ModelAuditLogEntry.CHANGE_KEY_COLOR) && change.getValue() != null) {
Object value = change.getValue();
if (value instanceof Long) {
l = value;
}
Long l2 = l;
if (l2 == null || l2.longValue() != 0) {
spannableStringBuilder.append((CharSequence) "");
Object value2 = change.getValue();
Objects.requireNonNull(value2, "null cannot be cast to non-null type kotlin.Long");
String format = String.format("#%06X", Arrays.copyOf(new Object[]{Integer.valueOf(16777215 & ((int) ((Long) value2).longValue()))}, 1));
m.checkNotNullExpressionValue(format, "java.lang.String.format(format, *args)");
spannableStringBuilder.setSpan(new ForegroundColorSpan(Color.parseColor(format)), w.getLastIndex(spannableStringBuilder), w.getLastIndex(spannableStringBuilder) + 1, 33);
}
}
i3 = i4;
} else {
AppLog appLog = AppLog.g;
StringBuilder R = a.R("No change text for actiontype: ");
R.append(modelAuditLogEntry.getActionTypeId());
R.append(" key:");
R.append(change.getKey());
Logger.w$default(appLog, "Audit Logs", R.toString(), null, 4, null);
}
}
i = 0;
if (i == 0) {
}
}
}
}
return spannableStringBuilder;
}
public final boolean hasChangesToRender(ModelAuditLogEntry modelAuditLogEntry) {
boolean z2;
m.checkNotNullParameter(modelAuditLogEntry, "log");
List<ModelAuditLogEntry.Change> changes = modelAuditLogEntry.getChanges();
if (changes == null) {
return false;
}
if (!changes.isEmpty()) {
Iterator<T> it = changes.iterator();
while (true) {
if (!it.hasNext()) {
break;
}
ModelAuditLogEntry.Change change = (ModelAuditLogEntry.Change) it.next();
AuditLogChangeUtils auditLogChangeUtils = INSTANCE;
m.checkNotNullExpressionValue(change, "it");
if (!auditLogChangeUtils.shouldNotRenderChange(modelAuditLogEntry, change)) {
z2 = true;
break;
}
}
}
z2 = false;
return z2;
}
public final List<ModelAuditLogEntry.Change> transformPermissionChange(ModelAuditLogEntry.Change change) {
m.checkNotNullParameter(change, "change");
Pair<HashSet<Long>, HashSet<Long>> calculatePermissionChange = calculatePermissionChange(change);
ArrayList arrayList = new ArrayList();
if (!calculatePermissionChange.getFirst().isEmpty()) {
arrayList.add(new ModelAuditLogEntry.Change(ModelAuditLogEntry.CHANGE_KEY_PERMISSIONS_GRANTED, null, calculatePermissionChange.getFirst()));
}
if (!calculatePermissionChange.getSecond().isEmpty()) {
arrayList.add(new ModelAuditLogEntry.Change(ModelAuditLogEntry.CHANGE_KEY_PERMISSIONS_DENIED, null, calculatePermissionChange.getSecond()));
}
return arrayList;
}
public final List<ModelAuditLogEntry.Change> transformPermissionOverride(ModelAuditLogEntry.Change change) {
m.checkNotNullParameter(change, "change");
Pair<HashSet<Long>, HashSet<Long>> calculatePermissionChange = calculatePermissionChange(change);
ArrayList arrayList = new ArrayList();
if (!calculatePermissionChange.getFirst().isEmpty()) {
arrayList.add(new ModelAuditLogEntry.Change(change.getKey(), null, calculatePermissionChange.getFirst()));
}
if (!calculatePermissionChange.getSecond().isEmpty()) {
arrayList.add(new ModelAuditLogEntry.Change(ModelAuditLogEntry.CHANGE_KEY_PERMISSIONS_RESET, null, calculatePermissionChange.getSecond()));
}
return arrayList;
}
}