859 lines
52 KiB
Java
859 lines
52 KiB
Java
package com.discord.utilities.auditlogs;
|
|
|
|
import android.content.Context;
|
|
import android.content.res.Resources;
|
|
import android.text.format.DateUtils;
|
|
import android.view.View;
|
|
import androidx.annotation.DrawableRes;
|
|
import androidx.annotation.StringRes;
|
|
import c.a.k.b;
|
|
import c.d.b.a.a;
|
|
import com.discord.R;
|
|
import com.discord.api.sticker.Sticker;
|
|
import com.discord.app.AppLog;
|
|
import com.discord.models.domain.ModelAuditLogEntry;
|
|
import com.discord.stores.StoreStream;
|
|
import com.discord.utilities.SnowflakeUtils;
|
|
import com.discord.utilities.drawable.DrawableCompat;
|
|
import com.discord.utilities.logging.Logger;
|
|
import com.discord.utilities.resources.StringResourceUtilsKt;
|
|
import com.discord.utilities.time.Clock;
|
|
import com.discord.utilities.time.ClockFactory;
|
|
import d0.g;
|
|
import d0.z.d.m;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.NoSuchElementException;
|
|
import java.util.Objects;
|
|
import java.util.concurrent.TimeUnit;
|
|
import kotlin.Lazy;
|
|
/* compiled from: AuditLogUtils.kt */
|
|
public final class AuditLogUtils {
|
|
private static final Lazy ALL_ACTION_TYPES$delegate = g.lazy(AuditLogUtils$ALL_ACTION_TYPES$2.INSTANCE);
|
|
public static final AuditLogUtils INSTANCE = new AuditLogUtils();
|
|
|
|
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;
|
|
ModelAuditLogEntry.TargetType targetType = ModelAuditLogEntry.TargetType.CHANNEL;
|
|
iArr[targetType.ordinal()] = 3;
|
|
iArr[ModelAuditLogEntry.TargetType.CHANNEL_OVERWRITE.ordinal()] = 4;
|
|
iArr[ModelAuditLogEntry.TargetType.USER.ordinal()] = 5;
|
|
ModelAuditLogEntry.TargetType targetType2 = ModelAuditLogEntry.TargetType.ROLE;
|
|
iArr[targetType2.ordinal()] = 6;
|
|
ModelAuditLogEntry.TargetType targetType3 = ModelAuditLogEntry.TargetType.INVITE;
|
|
iArr[targetType3.ordinal()] = 7;
|
|
ModelAuditLogEntry.TargetType targetType4 = ModelAuditLogEntry.TargetType.WEBHOOK;
|
|
iArr[targetType4.ordinal()] = 8;
|
|
iArr[ModelAuditLogEntry.TargetType.EMOJI.ordinal()] = 9;
|
|
ModelAuditLogEntry.TargetType targetType5 = ModelAuditLogEntry.TargetType.INTEGRATION;
|
|
iArr[targetType5.ordinal()] = 10;
|
|
iArr[ModelAuditLogEntry.TargetType.STAGE_INSTANCE.ordinal()] = 11;
|
|
iArr[ModelAuditLogEntry.TargetType.GUILD_SCHEDULED_EVENT.ordinal()] = 12;
|
|
iArr[ModelAuditLogEntry.TargetType.STICKER.ordinal()] = 13;
|
|
iArr[ModelAuditLogEntry.TargetType.THREAD.ordinal()] = 14;
|
|
ModelAuditLogEntry.ActionType.values();
|
|
int[] iArr2 = new int[4];
|
|
$EnumSwitchMapping$1 = iArr2;
|
|
iArr2[ModelAuditLogEntry.ActionType.CREATE.ordinal()] = 1;
|
|
iArr2[ModelAuditLogEntry.ActionType.UPDATE.ordinal()] = 2;
|
|
iArr2[ModelAuditLogEntry.ActionType.DELETE.ordinal()] = 3;
|
|
ModelAuditLogEntry.TargetType.values();
|
|
int[] iArr3 = new int[15];
|
|
$EnumSwitchMapping$2 = iArr3;
|
|
iArr3[targetType.ordinal()] = 1;
|
|
iArr3[targetType2.ordinal()] = 2;
|
|
iArr3[targetType3.ordinal()] = 3;
|
|
iArr3[targetType4.ordinal()] = 4;
|
|
iArr3[targetType5.ordinal()] = 5;
|
|
}
|
|
}
|
|
|
|
private AuditLogUtils() {
|
|
}
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r0v5, resolved type: java.lang.Object */
|
|
/* JADX DEBUG: Multi-variable search result rejected for r0v11, resolved type: java.lang.Object */
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
@StringRes
|
|
private final int getEntryTitle(ModelAuditLogEntry modelAuditLogEntry) {
|
|
int actionTypeId = modelAuditLogEntry.getActionTypeId();
|
|
ModelAuditLogEntry.Change change = null;
|
|
switch (actionTypeId) {
|
|
case 1:
|
|
return R.string.guild_settings_audit_log_guild_update;
|
|
case 20:
|
|
return R.string.guild_settings_audit_log_member_kick;
|
|
case 21:
|
|
return R.string.guild_settings_audit_log_member_prune;
|
|
case 22:
|
|
return R.string.guild_settings_audit_log_member_ban_add;
|
|
case 23:
|
|
return R.string.guild_settings_audit_log_member_ban_remove;
|
|
case 24:
|
|
return R.string.guild_settings_audit_log_member_update;
|
|
case 25:
|
|
return R.string.guild_settings_audit_log_member_role_update;
|
|
case 26:
|
|
return R.string.guild_settings_audit_log_member_move;
|
|
case 27:
|
|
return R.string.guild_settings_audit_log_member_disconnect;
|
|
case 28:
|
|
return R.string.guild_settings_audit_log_bot_add;
|
|
case 110:
|
|
List<ModelAuditLogEntry.Change> changes = modelAuditLogEntry.getChanges();
|
|
if (changes != null) {
|
|
Iterator<T> it = changes.iterator();
|
|
while (true) {
|
|
if (it.hasNext()) {
|
|
Object next = it.next();
|
|
ModelAuditLogEntry.Change change2 = (ModelAuditLogEntry.Change) next;
|
|
m.checkNotNullExpressionValue(change2, "it");
|
|
if (m.areEqual(change2.getKey(), "type")) {
|
|
change = next;
|
|
}
|
|
}
|
|
}
|
|
change = change;
|
|
}
|
|
if (change == null) {
|
|
return 0;
|
|
}
|
|
Object newValue = change.getNewValue();
|
|
Objects.requireNonNull(newValue, "null cannot be cast to non-null type kotlin.Long");
|
|
int longValue = (int) ((Long) newValue).longValue();
|
|
return longValue != 10 ? longValue != 12 ? R.string.guild_settings_audit_log_thread_create : R.string.guild_settings_audit_log_private_thread_create : R.string.guild_settings_audit_log_announcement_thread_create;
|
|
case 111:
|
|
return R.string.guild_settings_audit_log_thread_update;
|
|
case 112:
|
|
return R.string.guild_settings_audit_log_thread_delete;
|
|
default:
|
|
switch (actionTypeId) {
|
|
case 10:
|
|
List<ModelAuditLogEntry.Change> changes2 = modelAuditLogEntry.getChanges();
|
|
if (changes2 != null) {
|
|
Iterator<T> it2 = changes2.iterator();
|
|
while (true) {
|
|
if (it2.hasNext()) {
|
|
Object next2 = it2.next();
|
|
ModelAuditLogEntry.Change change3 = (ModelAuditLogEntry.Change) next2;
|
|
m.checkNotNullExpressionValue(change3, "it");
|
|
if (m.areEqual(change3.getKey(), "type")) {
|
|
change = next2;
|
|
}
|
|
}
|
|
}
|
|
change = change;
|
|
}
|
|
if (change == null) {
|
|
return 0;
|
|
}
|
|
Object newValue2 = change.getNewValue();
|
|
Objects.requireNonNull(newValue2, "null cannot be cast to non-null type kotlin.Long");
|
|
int longValue2 = (int) ((Long) newValue2).longValue();
|
|
return longValue2 != 2 ? longValue2 != 4 ? longValue2 != 13 ? R.string.guild_settings_audit_log_channel_text_create : R.string.guild_settings_audit_log_channel_stage_create : R.string.guild_settings_audit_log_channel_category_create : R.string.guild_settings_audit_log_channel_voice_create;
|
|
case 11:
|
|
return R.string.guild_settings_audit_log_channel_update;
|
|
case 12:
|
|
return R.string.guild_settings_audit_log_channel_delete;
|
|
case 13:
|
|
return R.string.guild_settings_audit_log_channel_overwrite_create;
|
|
case 14:
|
|
return R.string.guild_settings_audit_log_channel_overwrite_update;
|
|
case 15:
|
|
return R.string.guild_settings_audit_log_channel_overwrite_delete;
|
|
default:
|
|
switch (actionTypeId) {
|
|
case 30:
|
|
return R.string.guild_settings_audit_log_role_create;
|
|
case 31:
|
|
return R.string.guild_settings_audit_log_role_update;
|
|
case 32:
|
|
return R.string.guild_settings_audit_log_role_delete;
|
|
default:
|
|
switch (actionTypeId) {
|
|
case 40:
|
|
return R.string.guild_settings_audit_log_invite_create;
|
|
case 41:
|
|
return R.string.guild_settings_audit_log_invite_update;
|
|
case 42:
|
|
return R.string.guild_settings_audit_log_invite_delete;
|
|
default:
|
|
switch (actionTypeId) {
|
|
case 50:
|
|
return R.string.guild_settings_audit_log_webhook_create;
|
|
case 51:
|
|
return R.string.guild_settings_audit_log_webhook_update;
|
|
case 52:
|
|
return R.string.guild_settings_audit_log_webhook_delete;
|
|
default:
|
|
switch (actionTypeId) {
|
|
case 60:
|
|
return R.string.guild_settings_audit_log_emoji_create;
|
|
case 61:
|
|
return R.string.guild_settings_audit_log_emoji_update;
|
|
case 62:
|
|
return R.string.guild_settings_audit_log_emoji_delete;
|
|
default:
|
|
switch (actionTypeId) {
|
|
case 72:
|
|
return R.string.guild_settings_audit_log_message_delete;
|
|
case 73:
|
|
return R.string.guild_settings_audit_log_message_bulk_delete;
|
|
case 74:
|
|
return R.string.guild_settings_audit_log_message_pin;
|
|
case 75:
|
|
return R.string.guild_settings_audit_log_message_unpin;
|
|
default:
|
|
switch (actionTypeId) {
|
|
case 80:
|
|
return R.string.guild_settings_audit_log_integration_create;
|
|
case 81:
|
|
return R.string.guild_settings_audit_log_integration_update;
|
|
case 82:
|
|
return R.string.guild_settings_audit_log_integration_delete;
|
|
case 83:
|
|
return R.string.guild_settings_audit_log_stage_instance_create;
|
|
case 84:
|
|
return R.string.guild_settings_audit_log_stage_instance_update;
|
|
case 85:
|
|
return modelAuditLogEntry.getUserId() == 0 ? R.string.guild_settings_audit_log_stage_instance_delete_no_user : R.string.guild_settings_audit_log_stage_instance_delete;
|
|
default:
|
|
switch (actionTypeId) {
|
|
case 90:
|
|
return R.string.guild_settings_audit_log_sticker_create;
|
|
case 91:
|
|
return R.string.guild_settings_audit_log_sticker_update;
|
|
case 92:
|
|
return R.string.guild_settings_audit_log_sticker_delete;
|
|
default:
|
|
switch (actionTypeId) {
|
|
case 100:
|
|
return R.string.guild_settings_audit_log_scheduled_event_create;
|
|
case 101:
|
|
return R.string.guild_settings_audit_log_scheduled_event_update;
|
|
case 102:
|
|
return R.string.guild_settings_audit_log_scheduled_event_delete;
|
|
default:
|
|
AppLog appLog = AppLog.g;
|
|
StringBuilder L = a.L("Unknown audit log action type: ");
|
|
L.append(modelAuditLogEntry.getActionTypeId());
|
|
Logger.e$default(appLog, L.toString(), null, null, 6, null);
|
|
return R.string.guild_settings_audit_log_unknown_action;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public static /* synthetic */ CharSequence getHeaderString$default(AuditLogUtils auditLogUtils, ModelAuditLogEntry modelAuditLogEntry, CharSequence charSequence, Context context, Map map, String str, int i, Object obj) {
|
|
if ((i & 16) != 0) {
|
|
str = "";
|
|
}
|
|
return auditLogUtils.getHeaderString(modelAuditLogEntry, charSequence, context, map, str);
|
|
}
|
|
|
|
private final String getTargetText(ModelAuditLogEntry modelAuditLogEntry, Map<ModelAuditLogEntry.TargetType, ? extends Map<Long, CharSequence>> map, String str) {
|
|
Object obj;
|
|
ModelAuditLogEntry.TargetType targetType = modelAuditLogEntry.getTargetType();
|
|
if (targetType == ModelAuditLogEntry.TargetType.CHANNEL_OVERWRITE) {
|
|
targetType = ModelAuditLogEntry.TargetType.CHANNEL;
|
|
}
|
|
Map map2 = (Map) map.get(targetType);
|
|
if (map2 == null || (obj = (CharSequence) map2.get(Long.valueOf(modelAuditLogEntry.getTargetId()))) == null) {
|
|
if (targetType != null) {
|
|
int ordinal = targetType.ordinal();
|
|
if (ordinal == 3) {
|
|
StringBuilder L = a.L(str);
|
|
L.append(getTargetValue(modelAuditLogEntry, ModelAuditLogEntry.CHANGE_KEY_NAME));
|
|
obj = L.toString();
|
|
} else if (ordinal == 10) {
|
|
obj = getTargetValue(modelAuditLogEntry, "type");
|
|
} else if (ordinal == 6) {
|
|
ModelAuditLogEntry.Options options = modelAuditLogEntry.getOptions();
|
|
if (options == null || (obj = options.getRoleName()) == null) {
|
|
obj = getTargetValue(modelAuditLogEntry, ModelAuditLogEntry.CHANGE_KEY_NAME);
|
|
}
|
|
} else if (ordinal == 7) {
|
|
obj = getTargetValue(modelAuditLogEntry, ModelAuditLogEntry.CHANGE_KEY_CODE);
|
|
} else if (ordinal == 8) {
|
|
obj = getTargetValue(modelAuditLogEntry, ModelAuditLogEntry.CHANGE_KEY_NAME);
|
|
}
|
|
}
|
|
obj = null;
|
|
}
|
|
if (obj == null) {
|
|
obj = Long.valueOf(modelAuditLogEntry.getTargetId());
|
|
}
|
|
return obj.toString();
|
|
}
|
|
|
|
public static /* synthetic */ String getTargetText$default(AuditLogUtils auditLogUtils, ModelAuditLogEntry modelAuditLogEntry, Map map, String str, int i, Object obj) {
|
|
if ((i & 4) != 0) {
|
|
str = "";
|
|
}
|
|
return auditLogUtils.getTargetText(modelAuditLogEntry, map, str);
|
|
}
|
|
|
|
private final Object getTargetValue(ModelAuditLogEntry modelAuditLogEntry, String str) {
|
|
Object obj;
|
|
List<ModelAuditLogEntry.Change> changes = modelAuditLogEntry.getChanges();
|
|
if (changes == null) {
|
|
return null;
|
|
}
|
|
Iterator<T> it = changes.iterator();
|
|
while (true) {
|
|
if (!it.hasNext()) {
|
|
obj = null;
|
|
break;
|
|
}
|
|
obj = it.next();
|
|
ModelAuditLogEntry.Change change = (ModelAuditLogEntry.Change) obj;
|
|
m.checkNotNullExpressionValue(change, "it");
|
|
if (m.areEqual(change.getKey(), str)) {
|
|
break;
|
|
}
|
|
}
|
|
ModelAuditLogEntry.Change change2 = (ModelAuditLogEntry.Change) obj;
|
|
if (change2 != null) {
|
|
return change2.getValue();
|
|
}
|
|
return null;
|
|
}
|
|
|
|
private final CharSequence getTimestampText(long j, Context context) {
|
|
Clock clock = ClockFactory.get();
|
|
CharSequence relativeTimeSpanString = DateUtils.getRelativeTimeSpanString(j, clock.currentTimeMillis(), 86400000, 131092);
|
|
if (TimeUnit.MILLISECONDS.toDays(clock.currentTimeMillis() - j) < ((long) 7)) {
|
|
return b.h(context, R.string.guild_settings_audit_log_time_at_android, new Object[]{relativeTimeSpanString, DateUtils.formatDateTime(context, j, 1)}, null, 4);
|
|
}
|
|
m.checkNotNullExpressionValue(relativeTimeSpanString, "timeString");
|
|
return relativeTimeSpanString;
|
|
}
|
|
|
|
public final List<Integer> getALL_ACTION_TYPES() {
|
|
return (List) ALL_ACTION_TYPES$delegate.getValue();
|
|
}
|
|
|
|
@StringRes
|
|
public final int getActionName(int i) {
|
|
if (i == 0) {
|
|
return R.string.guild_settings_filter_all_actions;
|
|
}
|
|
if (i == 1) {
|
|
return R.string.guild_settings_action_filter_guild_update;
|
|
}
|
|
switch (i) {
|
|
case 10:
|
|
return R.string.guild_settings_action_filter_channel_create;
|
|
case 11:
|
|
return R.string.guild_settings_action_filter_channel_update;
|
|
case 12:
|
|
return R.string.guild_settings_action_filter_channel_delete;
|
|
case 13:
|
|
return R.string.guild_settings_action_filter_channel_overwrite_create;
|
|
case 14:
|
|
return R.string.guild_settings_action_filter_channel_overwrite_update;
|
|
case 15:
|
|
return R.string.guild_settings_action_filter_channel_overwrite_delete;
|
|
default:
|
|
switch (i) {
|
|
case 20:
|
|
return R.string.guild_settings_action_filter_member_kick;
|
|
case 21:
|
|
return R.string.guild_settings_action_filter_member_prune;
|
|
case 22:
|
|
return R.string.guild_settings_action_filter_member_ban_add;
|
|
case 23:
|
|
return R.string.guild_settings_action_filter_member_ban_remove;
|
|
case 24:
|
|
return R.string.guild_settings_action_filter_member_update;
|
|
case 25:
|
|
return R.string.guild_settings_action_filter_member_role_update;
|
|
case 26:
|
|
return R.string.guild_settings_action_filter_member_move;
|
|
case 27:
|
|
return R.string.guild_settings_action_filter_member_disconnect;
|
|
case 28:
|
|
return R.string.guild_settings_action_filter_bot_add;
|
|
case 100:
|
|
return R.string.guild_settings_action_filter_guild_scheduled_event_create;
|
|
case 101:
|
|
return R.string.guild_settings_action_filter_guild_scheduled_event_update;
|
|
case 102:
|
|
return R.string.guild_settings_action_filter_guild_scheduled_event_delete;
|
|
case 110:
|
|
return R.string.guild_settings_action_filter_thread_create;
|
|
case 111:
|
|
return R.string.guild_settings_action_filter_thread_update;
|
|
case 112:
|
|
return R.string.guild_settings_action_filter_thread_delete;
|
|
default:
|
|
switch (i) {
|
|
case 30:
|
|
return R.string.guild_settings_action_filter_role_create;
|
|
case 31:
|
|
return R.string.guild_settings_action_filter_role_update;
|
|
case 32:
|
|
return R.string.guild_settings_action_filter_role_delete;
|
|
default:
|
|
switch (i) {
|
|
case 40:
|
|
return R.string.guild_settings_action_filter_invite_create;
|
|
case 41:
|
|
return R.string.guild_settings_action_filter_invite_update;
|
|
case 42:
|
|
return R.string.guild_settings_action_filter_invite_delete;
|
|
default:
|
|
switch (i) {
|
|
case 50:
|
|
return R.string.guild_settings_action_filter_webhook_create;
|
|
case 51:
|
|
return R.string.guild_settings_action_filter_webhook_update;
|
|
case 52:
|
|
return R.string.guild_settings_action_filter_webhook_delete;
|
|
default:
|
|
switch (i) {
|
|
case 60:
|
|
return R.string.guild_settings_action_filter_emoji_create;
|
|
case 61:
|
|
return R.string.guild_settings_action_filter_emoji_update;
|
|
case 62:
|
|
return R.string.guild_settings_action_filter_emoji_delete;
|
|
default:
|
|
switch (i) {
|
|
case 72:
|
|
return R.string.guild_settings_action_filter_message_delete;
|
|
case 73:
|
|
return R.string.guild_settings_action_filter_message_bulk_delete;
|
|
case 74:
|
|
return R.string.guild_settings_action_filter_message_pin;
|
|
case 75:
|
|
return R.string.guild_settings_action_filter_message_unpin;
|
|
default:
|
|
switch (i) {
|
|
case 80:
|
|
return R.string.guild_settings_action_filter_integration_create;
|
|
case 81:
|
|
return R.string.guild_settings_action_filter_integration_update;
|
|
case 82:
|
|
return R.string.guild_settings_action_filter_integration_delete;
|
|
case 83:
|
|
return R.string.guild_settings_action_filter_stage_instance_create;
|
|
case 84:
|
|
return R.string.guild_settings_action_filter_stage_instance_update;
|
|
case 85:
|
|
return R.string.guild_settings_action_filter_stage_instance_delete;
|
|
default:
|
|
switch (i) {
|
|
case 90:
|
|
return R.string.guild_settings_action_filter_sticker_create;
|
|
case 91:
|
|
return R.string.guild_settings_action_filter_sticker_update;
|
|
case 92:
|
|
return R.string.guild_settings_action_filter_sticker_delete;
|
|
default:
|
|
return 0;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
@DrawableRes
|
|
public final int getActionTypeImage(int i) {
|
|
ModelAuditLogEntry.ActionType actionType = ModelAuditLogEntry.getActionType(i);
|
|
if (actionType != null) {
|
|
int ordinal = actionType.ordinal();
|
|
if (ordinal == 1) {
|
|
return R.drawable.ic_audit_audit_create_24dp;
|
|
}
|
|
if (ordinal == 2) {
|
|
return R.drawable.ic_audit_audit_update_24dp;
|
|
}
|
|
if (ordinal == 3) {
|
|
return R.drawable.ic_audit_audit_delete_24dp;
|
|
}
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
/* JADX DEBUG: Can't convert new array creation: APUT found in different block: 0x00bc: APUT (r5v17 java.lang.Object[]), (1 ??[boolean, int, float, short, byte, char]), (r2v18 java.lang.String) */
|
|
/* JADX DEBUG: Can't convert new array creation: APUT found in different block: 0x0158: APUT (r13v7 java.lang.Object[]), (2 ??[int, float, short, byte, char]), (r1v70 java.lang.Object) */
|
|
/* JADX DEBUG: Can't convert new array creation: APUT found in different block: 0x018f: APUT
|
|
(r7v13 java.lang.Object[])
|
|
(1 ??[boolean, int, float, short, byte, char])
|
|
(wrap: java.lang.CharSequence : 0x018b: INVOKE (r2v13 java.lang.CharSequence) =
|
|
(r20v0 android.content.Context)
|
|
(wrap: ?? : ?: SGET com.discord.R.plurals.guild_settings_audit_log_message_bulk_delete_count int)
|
|
(r13v4 int)
|
|
(r14v5 java.lang.Object[])
|
|
type: STATIC call: com.discord.utilities.resources.StringResourceUtilsKt.getI18nPluralString(android.content.Context, int, int, java.lang.Object[]):java.lang.CharSequence)
|
|
*/
|
|
/* JADX DEBUG: Can't convert new array creation: APUT found in different block: 0x0189: APUT
|
|
(r14v5 java.lang.Object[])
|
|
(0 ??[int, short, byte, char])
|
|
(wrap: java.lang.Integer : 0x0185: INVOKE (r15v3 java.lang.Integer) = (r15v2 int) type: STATIC call: java.lang.Integer.valueOf(int):java.lang.Integer)
|
|
*/
|
|
/* JADX DEBUG: Can't convert new array creation: APUT found in different block: 0x01dd: APUT
|
|
(r13v2 java.lang.Object[])
|
|
(1 ??[boolean, int, float, short, byte, char])
|
|
(wrap: java.lang.CharSequence : 0x01d9: INVOKE (r2v11 java.lang.CharSequence) =
|
|
(r20v0 android.content.Context)
|
|
(wrap: ?? : ?: SGET com.discord.R.plurals.guild_settings_audit_log_message_delete_count int)
|
|
(r14v2 int)
|
|
(r9v5 java.lang.Object[])
|
|
type: STATIC call: com.discord.utilities.resources.StringResourceUtilsKt.getI18nPluralString(android.content.Context, int, int, java.lang.Object[]):java.lang.CharSequence)
|
|
*/
|
|
/* JADX DEBUG: Can't convert new array creation: APUT found in different block: 0x01d7: APUT
|
|
(r9v5 java.lang.Object[])
|
|
(0 ??[int, short, byte, char])
|
|
(wrap: java.lang.Integer : 0x01d3: INVOKE (r16v2 java.lang.Integer) = (r16v1 int) type: STATIC call: java.lang.Integer.valueOf(int):java.lang.Integer)
|
|
*/
|
|
/* JADX DEBUG: Can't convert new array creation: APUT found in different block: 0x024a: APUT
|
|
(r5v9 java.lang.Object[])
|
|
(1 ??[boolean, int, float, short, byte, char])
|
|
(wrap: java.lang.String : 0x0246: INVOKE (r1v45 java.lang.String) = (r1v44 java.lang.Object) type: STATIC call: java.lang.String.valueOf(java.lang.Object):java.lang.String)
|
|
*/
|
|
/* JADX DEBUG: Can't convert new array creation: APUT found in different block: 0x0282: APUT
|
|
(r5v8 java.lang.Object[])
|
|
(1 ??[boolean, int, float, short, byte, char])
|
|
(wrap: java.lang.CharSequence : 0x027e: INVOKE (r1v38 java.lang.CharSequence) =
|
|
(r20v0 android.content.Context)
|
|
(wrap: ?? : ?: SGET com.discord.R.plurals.guild_settings_audit_log_member_disconnect_count int)
|
|
(r6v12 int)
|
|
(r7v10 java.lang.Object[])
|
|
type: STATIC call: com.discord.utilities.resources.StringResourceUtilsKt.getI18nPluralString(android.content.Context, int, int, java.lang.Object[]):java.lang.CharSequence)
|
|
*/
|
|
/* JADX DEBUG: Can't convert new array creation: APUT found in different block: 0x027c: APUT
|
|
(r7v10 java.lang.Object[])
|
|
(0 ??[int, short, byte, char])
|
|
(wrap: java.lang.Integer : 0x0278: INVOKE (r1v37 java.lang.Integer) = (r1v36 int) type: STATIC call: java.lang.Integer.valueOf(int):java.lang.Integer)
|
|
*/
|
|
/* JADX DEBUG: Can't convert new array creation: APUT found in different block: 0x02ca: APUT
|
|
(r7v8 java.lang.Object[])
|
|
(1 ??[boolean, int, float, short, byte, char])
|
|
(wrap: java.lang.CharSequence : 0x02c6: INVOKE (r1v21 java.lang.CharSequence) =
|
|
(r20v0 android.content.Context)
|
|
(wrap: ?? : ?: SGET com.discord.R.plurals.guild_settings_audit_log_member_move_count int)
|
|
(r9v2 int)
|
|
(r13v1 java.lang.Object[])
|
|
type: STATIC call: com.discord.utilities.resources.StringResourceUtilsKt.getI18nPluralString(android.content.Context, int, int, java.lang.Object[]):java.lang.CharSequence)
|
|
*/
|
|
/* JADX DEBUG: Can't convert new array creation: APUT found in different block: 0x02c4: APUT
|
|
(r13v1 java.lang.Object[])
|
|
(0 ??[int, short, byte, char])
|
|
(wrap: java.lang.Integer : 0x02c0: INVOKE (r1v20 java.lang.Integer) = (r1v19 int) type: STATIC call: java.lang.Integer.valueOf(int):java.lang.Integer)
|
|
*/
|
|
/* JADX DEBUG: Can't convert new array creation: APUT found in different block: 0x0333: APUT
|
|
(r5v2 java.lang.Object[])
|
|
(1 ??[boolean, int, float, short, byte, char])
|
|
(wrap: java.lang.String : 0x032f: INVOKE (r1v11 java.lang.String) = (r1v10 java.lang.Object) type: STATIC call: java.lang.String.valueOf(java.lang.Object):java.lang.String)
|
|
*/
|
|
/* JADX DEBUG: Can't convert new array creation: APUT found in different block: 0x0373: APUT
|
|
(r5v1 java.lang.Object[])
|
|
(1 ??[boolean, int, float, short, byte, char])
|
|
(wrap: java.lang.CharSequence : 0x036f: INVOKE (r1v4 java.lang.CharSequence) =
|
|
(r2v1 android.content.res.Resources)
|
|
(r20v0 android.content.Context)
|
|
(wrap: ?? : ?: SGET com.discord.R.plurals.guild_settings_audit_log_member_prune_count int)
|
|
(r7v2 int)
|
|
(r8v1 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: 0x036d: APUT
|
|
(r8v1 java.lang.Object[])
|
|
(0 ??[int, short, byte, char])
|
|
(wrap: java.lang.Integer : 0x0369: INVOKE (r1v3 java.lang.Integer) = (r1v2 int) type: STATIC call: java.lang.Integer.valueOf(int):java.lang.Integer)
|
|
*/
|
|
public final CharSequence getHeaderString(ModelAuditLogEntry modelAuditLogEntry, CharSequence charSequence, Context context, Map<ModelAuditLogEntry.TargetType, ? extends Map<Long, CharSequence>> map, String str) {
|
|
Object obj;
|
|
Object obj2;
|
|
Object obj3;
|
|
Object obj4;
|
|
Object obj5;
|
|
Object obj6;
|
|
String str2;
|
|
Object obj7;
|
|
Object obj8;
|
|
m.checkNotNullParameter(modelAuditLogEntry, "auditLogEntry");
|
|
m.checkNotNullParameter(charSequence, "username");
|
|
m.checkNotNullParameter(context, "context");
|
|
m.checkNotNullParameter(map, "targets");
|
|
m.checkNotNullParameter(str, "prefix");
|
|
int actionTypeId = modelAuditLogEntry.getActionTypeId();
|
|
if (actionTypeId == 21) {
|
|
int entryTitle = getEntryTitle(modelAuditLogEntry);
|
|
Object[] objArr = new Object[2];
|
|
objArr[0] = charSequence;
|
|
Resources resources = context.getResources();
|
|
m.checkNotNullExpressionValue(resources, "context.resources");
|
|
ModelAuditLogEntry.Options options = modelAuditLogEntry.getOptions();
|
|
int membersRemoved = options != null ? options.getMembersRemoved() : 0;
|
|
Object[] objArr2 = new Object[1];
|
|
ModelAuditLogEntry.Options options2 = modelAuditLogEntry.getOptions();
|
|
objArr2[0] = Integer.valueOf(options2 != null ? options2.getMembersRemoved() : 0);
|
|
objArr[1] = StringResourceUtilsKt.getQuantityString(resources, context, (int) R.plurals.guild_settings_audit_log_member_prune_count, membersRemoved, objArr2);
|
|
return b.h(context, entryTitle, objArr, null, 4);
|
|
} else if (actionTypeId == 42) {
|
|
int entryTitle2 = getEntryTitle(modelAuditLogEntry);
|
|
Object[] objArr3 = new Object[2];
|
|
objArr3[0] = charSequence;
|
|
List<ModelAuditLogEntry.Change> changes = modelAuditLogEntry.getChanges();
|
|
if (changes != null) {
|
|
for (ModelAuditLogEntry.Change change : changes) {
|
|
m.checkNotNullExpressionValue(change, "it");
|
|
if (m.areEqual(change.getKey(), ModelAuditLogEntry.CHANGE_KEY_CODE)) {
|
|
if (change != null) {
|
|
obj = change.getOldValue();
|
|
objArr3[1] = String.valueOf(obj);
|
|
return b.h(context, entryTitle2, objArr3, null, 4);
|
|
}
|
|
}
|
|
}
|
|
throw new NoSuchElementException("Collection contains no element matching the predicate.");
|
|
}
|
|
obj = null;
|
|
objArr3[1] = String.valueOf(obj);
|
|
return b.h(context, entryTitle2, objArr3, null, 4);
|
|
} else if (actionTypeId == 26) {
|
|
ModelAuditLogEntry.Options options3 = modelAuditLogEntry.getOptions();
|
|
Long valueOf = options3 != null ? Long.valueOf(options3.getChannelId()) : null;
|
|
int entryTitle3 = getEntryTitle(modelAuditLogEntry);
|
|
Object[] objArr4 = new Object[3];
|
|
objArr4[0] = charSequence;
|
|
ModelAuditLogEntry.Options options4 = modelAuditLogEntry.getOptions();
|
|
int count = options4 != null ? options4.getCount() : 0;
|
|
Object[] objArr5 = new Object[1];
|
|
ModelAuditLogEntry.Options options5 = modelAuditLogEntry.getOptions();
|
|
objArr5[0] = Integer.valueOf(options5 != null ? options5.getCount() : 0);
|
|
objArr4[1] = StringResourceUtilsKt.getI18nPluralString(context, R.plurals.guild_settings_audit_log_member_move_count, count, objArr5);
|
|
Map map2 = (Map) map.get(ModelAuditLogEntry.TargetType.CHANNEL);
|
|
if (map2 == null || (obj2 = (CharSequence) map2.get(valueOf)) == null) {
|
|
obj2 = valueOf != null ? String.valueOf(valueOf.longValue()) : null;
|
|
}
|
|
objArr4[2] = obj2;
|
|
return b.h(context, entryTitle3, objArr4, null, 4);
|
|
} else if (actionTypeId != 27) {
|
|
switch (actionTypeId) {
|
|
case 60:
|
|
case 61:
|
|
case 62:
|
|
int entryTitle4 = getEntryTitle(modelAuditLogEntry);
|
|
Object[] objArr6 = new Object[2];
|
|
objArr6[0] = charSequence;
|
|
List<ModelAuditLogEntry.Change> changes2 = modelAuditLogEntry.getChanges();
|
|
if (changes2 != null) {
|
|
for (ModelAuditLogEntry.Change change2 : changes2) {
|
|
m.checkNotNullExpressionValue(change2, "it");
|
|
if (m.areEqual(change2.getKey(), ModelAuditLogEntry.CHANGE_KEY_NAME)) {
|
|
if (change2 != null) {
|
|
obj3 = change2.getValue();
|
|
objArr6[1] = String.valueOf(obj3);
|
|
return b.h(context, entryTitle4, objArr6, null, 4);
|
|
}
|
|
}
|
|
}
|
|
throw new NoSuchElementException("Collection contains no element matching the predicate.");
|
|
}
|
|
obj3 = null;
|
|
objArr6[1] = String.valueOf(obj3);
|
|
return b.h(context, entryTitle4, objArr6, null, 4);
|
|
default:
|
|
switch (actionTypeId) {
|
|
case 72:
|
|
ModelAuditLogEntry.Options options6 = modelAuditLogEntry.getOptions();
|
|
Long valueOf2 = options6 != null ? Long.valueOf(options6.getChannelId()) : null;
|
|
int entryTitle5 = getEntryTitle(modelAuditLogEntry);
|
|
Object[] objArr7 = new Object[4];
|
|
objArr7[0] = charSequence;
|
|
ModelAuditLogEntry.Options options7 = modelAuditLogEntry.getOptions();
|
|
int count2 = options7 != null ? options7.getCount() : 0;
|
|
Object[] objArr8 = new Object[1];
|
|
ModelAuditLogEntry.Options options8 = modelAuditLogEntry.getOptions();
|
|
objArr8[0] = Integer.valueOf(options8 != null ? options8.getCount() : 0);
|
|
objArr7[1] = StringResourceUtilsKt.getI18nPluralString(context, R.plurals.guild_settings_audit_log_message_delete_count, count2, objArr8);
|
|
objArr7[2] = getTargetText(modelAuditLogEntry, map, str);
|
|
Map map3 = (Map) map.get(ModelAuditLogEntry.TargetType.CHANNEL);
|
|
if (map3 == null || (obj4 = (CharSequence) map3.get(valueOf2)) == null) {
|
|
obj4 = valueOf2 != null ? String.valueOf(valueOf2.longValue()) : null;
|
|
}
|
|
objArr7[3] = obj4;
|
|
return b.h(context, entryTitle5, objArr7, null, 4);
|
|
case 73:
|
|
int entryTitle6 = getEntryTitle(modelAuditLogEntry);
|
|
Object[] objArr9 = new Object[3];
|
|
objArr9[0] = charSequence;
|
|
ModelAuditLogEntry.Options options9 = modelAuditLogEntry.getOptions();
|
|
int count3 = options9 != null ? options9.getCount() : 0;
|
|
Object[] objArr10 = new Object[1];
|
|
ModelAuditLogEntry.Options options10 = modelAuditLogEntry.getOptions();
|
|
objArr10[0] = Integer.valueOf(options10 != null ? options10.getCount() : 0);
|
|
objArr9[1] = StringResourceUtilsKt.getI18nPluralString(context, R.plurals.guild_settings_audit_log_message_bulk_delete_count, count3, objArr10);
|
|
objArr9[2] = getTargetText(modelAuditLogEntry, map, str);
|
|
return b.h(context, entryTitle6, objArr9, null, 4);
|
|
case 74:
|
|
case 75:
|
|
ModelAuditLogEntry.Options options11 = modelAuditLogEntry.getOptions();
|
|
Long valueOf3 = options11 != null ? Long.valueOf(options11.getChannelId()) : null;
|
|
int entryTitle7 = getEntryTitle(modelAuditLogEntry);
|
|
Object[] objArr11 = new Object[3];
|
|
objArr11[0] = charSequence;
|
|
objArr11[1] = getTargetText(modelAuditLogEntry, map, str);
|
|
Map map4 = (Map) map.get(ModelAuditLogEntry.TargetType.CHANNEL);
|
|
if (map4 == null || (obj5 = (CharSequence) map4.get(valueOf3)) == null) {
|
|
obj5 = valueOf3 != null ? String.valueOf(valueOf3.longValue()) : null;
|
|
}
|
|
objArr11[2] = obj5;
|
|
return b.h(context, entryTitle7, objArr11, null, 4);
|
|
default:
|
|
switch (actionTypeId) {
|
|
case 83:
|
|
case 84:
|
|
case 85:
|
|
ModelAuditLogEntry.Options options12 = modelAuditLogEntry.getOptions();
|
|
Long valueOf4 = options12 != null ? Long.valueOf(options12.getChannelId()) : null;
|
|
Map map5 = (Map) map.get(ModelAuditLogEntry.TargetType.CHANNEL);
|
|
if (map5 == null || (obj6 = (CharSequence) map5.get(valueOf4)) == null) {
|
|
obj6 = valueOf4 != null ? String.valueOf(valueOf4.longValue()) : null;
|
|
}
|
|
return modelAuditLogEntry.getUserId() == 0 ? b.h(context, getEntryTitle(modelAuditLogEntry), new Object[]{obj6}, null, 4) : b.h(context, getEntryTitle(modelAuditLogEntry), new Object[]{charSequence, obj6}, null, 4);
|
|
default:
|
|
switch (actionTypeId) {
|
|
case 90:
|
|
case 91:
|
|
case 92:
|
|
int entryTitle8 = getEntryTitle(modelAuditLogEntry);
|
|
Object[] objArr12 = new Object[2];
|
|
objArr12[0] = charSequence;
|
|
Sticker guildSticker = StoreStream.Companion.getGuildStickers().getGuildSticker(modelAuditLogEntry.getTargetId());
|
|
if (guildSticker == null || (str2 = guildSticker.h()) == null) {
|
|
List<ModelAuditLogEntry.Change> changes3 = modelAuditLogEntry.getChanges();
|
|
if (changes3 != null) {
|
|
Iterator<T> it = changes3.iterator();
|
|
while (true) {
|
|
if (it.hasNext()) {
|
|
obj8 = it.next();
|
|
ModelAuditLogEntry.Change change3 = (ModelAuditLogEntry.Change) obj8;
|
|
m.checkNotNullExpressionValue(change3, "it");
|
|
if (m.areEqual(change3.getKey(), ModelAuditLogEntry.CHANGE_KEY_NAME)) {
|
|
}
|
|
} else {
|
|
obj8 = null;
|
|
}
|
|
}
|
|
ModelAuditLogEntry.Change change4 = (ModelAuditLogEntry.Change) obj8;
|
|
if (change4 != null) {
|
|
obj7 = change4.getValue();
|
|
str2 = String.valueOf(obj7);
|
|
}
|
|
}
|
|
obj7 = null;
|
|
str2 = String.valueOf(obj7);
|
|
}
|
|
objArr12[1] = str2;
|
|
return b.h(context, entryTitle8, objArr12, null, 4);
|
|
default:
|
|
return b.h(context, getEntryTitle(modelAuditLogEntry), new Object[]{charSequence, getTargetText(modelAuditLogEntry, map, str)}, null, 4);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
int entryTitle9 = getEntryTitle(modelAuditLogEntry);
|
|
Object[] objArr13 = new Object[2];
|
|
objArr13[0] = charSequence;
|
|
ModelAuditLogEntry.Options options13 = modelAuditLogEntry.getOptions();
|
|
int count4 = options13 != null ? options13.getCount() : 0;
|
|
Object[] objArr14 = new Object[1];
|
|
ModelAuditLogEntry.Options options14 = modelAuditLogEntry.getOptions();
|
|
objArr14[0] = Integer.valueOf(options14 != null ? options14.getCount() : 0);
|
|
objArr13[1] = StringResourceUtilsKt.getI18nPluralString(context, R.plurals.guild_settings_audit_log_member_disconnect_count, count4, objArr14);
|
|
return b.h(context, entryTitle9, objArr13, null, 4);
|
|
}
|
|
}
|
|
|
|
@DrawableRes
|
|
public final int getTargetTypeImage(View view, int i) {
|
|
m.checkNotNullParameter(view, "view");
|
|
ModelAuditLogEntry.TargetType targetType = ModelAuditLogEntry.getTargetType(i);
|
|
m.checkNotNullExpressionValue(targetType, "ModelAuditLogEntry.getTargetType(actionTypeId)");
|
|
if (i == 72) {
|
|
return DrawableCompat.getThemedDrawableRes(view, (int) R.attr.ic_audit_message, 0);
|
|
}
|
|
int ordinal = targetType.ordinal();
|
|
if (ordinal == 0) {
|
|
return DrawableCompat.getThemedDrawableRes(view, (int) R.attr.ic_audit_all, 0);
|
|
}
|
|
switch (ordinal) {
|
|
case 2:
|
|
return DrawableCompat.getThemedDrawableRes(view, (int) R.attr.ic_audit_server, 0);
|
|
case 3:
|
|
case 4:
|
|
return DrawableCompat.getThemedDrawableRes(view, (int) R.attr.ic_audit_channel, 0);
|
|
case 5:
|
|
return DrawableCompat.getThemedDrawableRes(view, (int) R.attr.ic_audit_member, 0);
|
|
case 6:
|
|
return DrawableCompat.getThemedDrawableRes(view, (int) R.attr.ic_audit_role, 0);
|
|
case 7:
|
|
return DrawableCompat.getThemedDrawableRes(view, (int) R.attr.ic_audit_invite, 0);
|
|
case 8:
|
|
return DrawableCompat.getThemedDrawableRes(view, (int) R.attr.ic_audit_webhook, 0);
|
|
case 9:
|
|
return DrawableCompat.getThemedDrawableRes(view, (int) R.attr.ic_audit_emoji, 0);
|
|
case 10:
|
|
return DrawableCompat.getThemedDrawableRes(view, (int) R.attr.ic_audit_integration, 0);
|
|
case 11:
|
|
return DrawableCompat.getThemedDrawableRes(view, (int) R.attr.ic_audit_stage_instance, 0);
|
|
case 12:
|
|
return DrawableCompat.getThemedDrawableRes(view, (int) R.attr.ic_audit_calendar, 0);
|
|
case 13:
|
|
return DrawableCompat.getThemedDrawableRes(view, (int) R.attr.ic_audit_sticker, 0);
|
|
case 14:
|
|
return DrawableCompat.getThemedDrawableRes(view, (int) R.attr.ic_audit_thread, 0);
|
|
default:
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
public final long getTimestampStart(ModelAuditLogEntry modelAuditLogEntry) {
|
|
m.checkNotNullParameter(modelAuditLogEntry, "$this$getTimestampStart");
|
|
return (modelAuditLogEntry.getId() >>> 22) + SnowflakeUtils.DISCORD_EPOCH;
|
|
}
|
|
|
|
public final CharSequence getTimestampString(ModelAuditLogEntry modelAuditLogEntry, Context context) {
|
|
m.checkNotNullParameter(modelAuditLogEntry, "auditLogEntry");
|
|
m.checkNotNullParameter(context, "context");
|
|
if (modelAuditLogEntry.getTimestampEnd() == null) {
|
|
return getTimestampText(getTimestampStart(modelAuditLogEntry), context);
|
|
}
|
|
CharSequence timestampText = getTimestampText(getTimestampStart(modelAuditLogEntry), context);
|
|
Long timestampEnd = modelAuditLogEntry.getTimestampEnd();
|
|
if (timestampEnd == null) {
|
|
timestampEnd = 0L;
|
|
}
|
|
m.checkNotNullExpressionValue(timestampEnd, "auditLogEntry.timestampEnd ?: 0L");
|
|
CharSequence timestampText2 = getTimestampText(timestampEnd.longValue(), context);
|
|
return timestampText + " - " + timestampText2;
|
|
}
|
|
}
|