747 lines
41 KiB
Java
747 lines
41 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.l.b;
|
|
import c.d.b.a.a;
|
|
import com.discord.app.AppLog;
|
|
import com.discord.models.domain.ModelAuditLogEntry;
|
|
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[13];
|
|
$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;
|
|
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[13];
|
|
$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 r1v2, resolved type: java.lang.Object */
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
@StringRes
|
|
private final int getEntryTitle(ModelAuditLogEntry modelAuditLogEntry) {
|
|
int actionTypeId = modelAuditLogEntry.getActionTypeId();
|
|
if (actionTypeId == 1) {
|
|
return 2131889471;
|
|
}
|
|
switch (actionTypeId) {
|
|
case 10:
|
|
List<ModelAuditLogEntry.Change> changes = modelAuditLogEntry.getChanges();
|
|
ModelAuditLogEntry.Change change = null;
|
|
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();
|
|
if (longValue == 2) {
|
|
return 2131889440;
|
|
}
|
|
if (longValue != 4) {
|
|
return longValue != 13 ? 2131889429 : 2131889428;
|
|
}
|
|
return 2131889407;
|
|
case 11:
|
|
return 2131889435;
|
|
case 12:
|
|
return 2131889410;
|
|
case 13:
|
|
return 2131889415;
|
|
case 14:
|
|
return 2131889417;
|
|
case 15:
|
|
return 2131889416;
|
|
default:
|
|
switch (actionTypeId) {
|
|
case 20:
|
|
return 2131889510;
|
|
case 21:
|
|
return 2131889517;
|
|
case 22:
|
|
return 2131889505;
|
|
case 23:
|
|
return 2131889506;
|
|
case 24:
|
|
return 2131889522;
|
|
case 25:
|
|
return 2131889519;
|
|
case 26:
|
|
return 2131889511;
|
|
case 27:
|
|
return 2131889509;
|
|
case 28:
|
|
return 2131889404;
|
|
default:
|
|
switch (actionTypeId) {
|
|
case 30:
|
|
return 2131889530;
|
|
case 31:
|
|
return 2131889540;
|
|
case 32:
|
|
return 2131889531;
|
|
default:
|
|
switch (actionTypeId) {
|
|
case 40:
|
|
return 2131889495;
|
|
case 41:
|
|
return 2131889503;
|
|
case 42:
|
|
return 2131889496;
|
|
default:
|
|
switch (actionTypeId) {
|
|
case 50:
|
|
return 2131889564;
|
|
case 51:
|
|
return 2131889568;
|
|
case 52:
|
|
return 2131889565;
|
|
default:
|
|
switch (actionTypeId) {
|
|
case 60:
|
|
return 2131889442;
|
|
case 61:
|
|
return 2131889446;
|
|
case 62:
|
|
return 2131889443;
|
|
default:
|
|
switch (actionTypeId) {
|
|
case 72:
|
|
return 2131889524;
|
|
case 73:
|
|
return 2131889523;
|
|
case 74:
|
|
return 2131889525;
|
|
case 75:
|
|
return 2131889526;
|
|
default:
|
|
switch (actionTypeId) {
|
|
case 80:
|
|
return 2131889485;
|
|
case 81:
|
|
return 2131889492;
|
|
case 82:
|
|
return 2131889486;
|
|
case 83:
|
|
return 2131889553;
|
|
case 84:
|
|
return 2131889558;
|
|
case 85:
|
|
return modelAuditLogEntry.getUserId() == 0 ? 2131889555 : 2131889554;
|
|
default:
|
|
switch (actionTypeId) {
|
|
case 100:
|
|
return 2131889541;
|
|
case 101:
|
|
return 2131889552;
|
|
case 102:
|
|
return 2131889542;
|
|
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 2131889560;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
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, "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, "name");
|
|
}
|
|
} else if (ordinal == 7) {
|
|
obj = getTargetValue(modelAuditLogEntry, "code");
|
|
} else if (ordinal == 8) {
|
|
obj = getTargetValue(modelAuditLogEntry, "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.g(context, 2131889559, 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 2131889691;
|
|
}
|
|
if (i == 1) {
|
|
return 2131889376;
|
|
}
|
|
switch (i) {
|
|
case 10:
|
|
return 2131889364;
|
|
case 11:
|
|
return 2131889369;
|
|
case 12:
|
|
return 2131889365;
|
|
case 13:
|
|
return 2131889366;
|
|
case 14:
|
|
return 2131889368;
|
|
case 15:
|
|
return 2131889367;
|
|
default:
|
|
switch (i) {
|
|
case 20:
|
|
return 2131889386;
|
|
case 21:
|
|
return 2131889388;
|
|
case 22:
|
|
return 2131889383;
|
|
case 23:
|
|
return 2131889384;
|
|
case 24:
|
|
return 2131889390;
|
|
case 25:
|
|
return 2131889389;
|
|
case 26:
|
|
return 2131889387;
|
|
case 27:
|
|
return 2131889385;
|
|
case 28:
|
|
return 2131889363;
|
|
default:
|
|
switch (i) {
|
|
case 30:
|
|
return 2131889395;
|
|
case 31:
|
|
return 2131889397;
|
|
case 32:
|
|
return 2131889396;
|
|
default:
|
|
switch (i) {
|
|
case 40:
|
|
return 2131889380;
|
|
case 41:
|
|
return 2131889382;
|
|
case 42:
|
|
return 2131889381;
|
|
default:
|
|
switch (i) {
|
|
case 50:
|
|
return 2131889401;
|
|
case 51:
|
|
return 2131889403;
|
|
case 52:
|
|
return 2131889402;
|
|
default:
|
|
switch (i) {
|
|
case 60:
|
|
return 2131889370;
|
|
case 61:
|
|
return 2131889372;
|
|
case 62:
|
|
return 2131889371;
|
|
default:
|
|
switch (i) {
|
|
case 72:
|
|
return 2131889392;
|
|
case 73:
|
|
return 2131889391;
|
|
case 74:
|
|
return 2131889393;
|
|
case 75:
|
|
return 2131889394;
|
|
default:
|
|
switch (i) {
|
|
case 80:
|
|
return 2131889377;
|
|
case 81:
|
|
return 2131889379;
|
|
case 82:
|
|
return 2131889378;
|
|
case 83:
|
|
return 2131889398;
|
|
case 84:
|
|
return 2131889400;
|
|
case 85:
|
|
return 2131889399;
|
|
default:
|
|
switch (i) {
|
|
case 100:
|
|
return 2131889373;
|
|
case 101:
|
|
return 2131889375;
|
|
case 102:
|
|
return 2131889374;
|
|
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 2131231412;
|
|
}
|
|
if (ordinal == 2) {
|
|
return 2131231414;
|
|
}
|
|
if (ordinal == 3) {
|
|
return 2131231413;
|
|
}
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
/* JADX DEBUG: Can't convert new array creation: APUT found in different block: 0x00f7: 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: 0x012e: APUT
|
|
(r7v13 java.lang.Object[])
|
|
(1 ??[boolean, int, float, short, byte, char])
|
|
(wrap: java.lang.CharSequence : 0x012a: INVOKE (r2v13 java.lang.CharSequence) = (r20v0 android.content.Context), (2131755151 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: 0x0128: APUT
|
|
(r14v5 java.lang.Object[])
|
|
(0 ??[int, short, byte, char])
|
|
(wrap: java.lang.Integer : 0x0124: 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: 0x017c: APUT
|
|
(r13v2 java.lang.Object[])
|
|
(1 ??[boolean, int, float, short, byte, char])
|
|
(wrap: java.lang.CharSequence : 0x0178: INVOKE (r2v11 java.lang.CharSequence) = (r20v0 android.content.Context), (2131755152 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: 0x0176: APUT
|
|
(r9v5 java.lang.Object[])
|
|
(0 ??[int, short, byte, char])
|
|
(wrap: java.lang.Integer : 0x0172: 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: 0x01ec: APUT
|
|
(r5v9 java.lang.Object[])
|
|
(1 ??[boolean, int, float, short, byte, char])
|
|
(wrap: java.lang.String : 0x01e8: 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: 0x0224: APUT
|
|
(r5v8 java.lang.Object[])
|
|
(1 ??[boolean, int, float, short, byte, char])
|
|
(wrap: java.lang.CharSequence : 0x0220: INVOKE (r1v38 java.lang.CharSequence) = (r20v0 android.content.Context), (2131755145 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: 0x021e: APUT
|
|
(r7v10 java.lang.Object[])
|
|
(0 ??[int, short, byte, char])
|
|
(wrap: java.lang.Integer : 0x021a: 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: 0x026c: APUT
|
|
(r7v8 java.lang.Object[])
|
|
(1 ??[boolean, int, float, short, byte, char])
|
|
(wrap: java.lang.CharSequence : 0x0268: INVOKE (r1v21 java.lang.CharSequence) = (r20v0 android.content.Context), (2131755146 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: 0x0266: APUT
|
|
(r13v1 java.lang.Object[])
|
|
(0 ??[int, short, byte, char])
|
|
(wrap: java.lang.Integer : 0x0262: 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: 0x02d5: APUT
|
|
(r5v2 java.lang.Object[])
|
|
(1 ??[boolean, int, float, short, byte, char])
|
|
(wrap: java.lang.String : 0x02d1: 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: 0x0315: APUT
|
|
(r5v1 java.lang.Object[])
|
|
(1 ??[boolean, int, float, short, byte, char])
|
|
(wrap: java.lang.CharSequence : 0x0311: INVOKE (r1v4 java.lang.CharSequence) =
|
|
(r2v1 android.content.res.Resources)
|
|
(r20v0 android.content.Context)
|
|
(2131755147 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: 0x030f: APUT
|
|
(r8v1 java.lang.Object[])
|
|
(0 ??[int, short, byte, char])
|
|
(wrap: java.lang.Integer : 0x030b: 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;
|
|
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, 2131755147, membersRemoved, objArr2);
|
|
return b.g(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(), "code")) {
|
|
if (change != null) {
|
|
obj = change.getOldValue();
|
|
objArr3[1] = String.valueOf(obj);
|
|
return b.g(context, entryTitle2, objArr3, null, 4);
|
|
}
|
|
}
|
|
}
|
|
throw new NoSuchElementException("Collection contains no element matching the predicate.");
|
|
}
|
|
obj = null;
|
|
objArr3[1] = String.valueOf(obj);
|
|
return b.g(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, 2131755146, 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.g(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(), "name")) {
|
|
if (change2 != null) {
|
|
obj3 = change2.getValue();
|
|
objArr6[1] = String.valueOf(obj3);
|
|
return b.g(context, entryTitle4, objArr6, null, 4);
|
|
}
|
|
}
|
|
}
|
|
throw new NoSuchElementException("Collection contains no element matching the predicate.");
|
|
}
|
|
obj3 = null;
|
|
objArr6[1] = String.valueOf(obj3);
|
|
return b.g(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, 2131755152, 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.g(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, 2131755151, count3, objArr10);
|
|
objArr9[2] = getTargetText(modelAuditLogEntry, map, str);
|
|
return b.g(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.g(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.g(context, getEntryTitle(modelAuditLogEntry), new Object[]{obj6}, null, 4) : b.g(context, getEntryTitle(modelAuditLogEntry), new Object[]{charSequence, obj6}, null, 4);
|
|
default:
|
|
return b.g(context, getEntryTitle(modelAuditLogEntry), new Object[]{charSequence, getTargetText(modelAuditLogEntry, map, str)}, null, 4);
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
int entryTitle8 = getEntryTitle(modelAuditLogEntry);
|
|
Object[] objArr12 = new Object[2];
|
|
objArr12[0] = charSequence;
|
|
ModelAuditLogEntry.Options options13 = modelAuditLogEntry.getOptions();
|
|
int count4 = options13 != null ? options13.getCount() : 0;
|
|
Object[] objArr13 = new Object[1];
|
|
ModelAuditLogEntry.Options options14 = modelAuditLogEntry.getOptions();
|
|
objArr13[0] = Integer.valueOf(options14 != null ? options14.getCount() : 0);
|
|
objArr12[1] = StringResourceUtilsKt.getI18nPluralString(context, 2131755145, count4, objArr13);
|
|
return b.g(context, entryTitle8, objArr12, 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, 2130969381, 0);
|
|
}
|
|
int ordinal = targetType.ordinal();
|
|
if (ordinal == 0) {
|
|
return DrawableCompat.getThemedDrawableRes(view, 2130969373, 0);
|
|
}
|
|
switch (ordinal) {
|
|
case 2:
|
|
return DrawableCompat.getThemedDrawableRes(view, 2130969383, 0);
|
|
case 3:
|
|
case 4:
|
|
return DrawableCompat.getThemedDrawableRes(view, 2130969375, 0);
|
|
case 5:
|
|
return DrawableCompat.getThemedDrawableRes(view, 2130969380, 0);
|
|
case 6:
|
|
return DrawableCompat.getThemedDrawableRes(view, 2130969382, 0);
|
|
case 7:
|
|
return DrawableCompat.getThemedDrawableRes(view, 2130969378, 0);
|
|
case 8:
|
|
return DrawableCompat.getThemedDrawableRes(view, 2130969385, 0);
|
|
case 9:
|
|
return DrawableCompat.getThemedDrawableRes(view, 2130969376, 0);
|
|
case 10:
|
|
return DrawableCompat.getThemedDrawableRes(view, 2130969377, 0);
|
|
case 11:
|
|
return DrawableCompat.getThemedDrawableRes(view, 2130969384, 0);
|
|
case 12:
|
|
return DrawableCompat.getThemedDrawableRes(view, 2130969374, 0);
|
|
default:
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
public final long getTimestampStart(ModelAuditLogEntry modelAuditLogEntry) {
|
|
m.checkNotNullParameter(modelAuditLogEntry, "$this$getTimestampStart");
|
|
return (modelAuditLogEntry.getId() >>> 22) + 1420070400000L;
|
|
}
|
|
|
|
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;
|
|
}
|
|
}
|