2021-06-27 20:44:35 +00:00
|
|
|
package com.discord.stores;
|
|
|
|
|
|
|
|
import a0.a.a.b;
|
|
|
|
import android.content.Context;
|
|
|
|
import c.d.b.a.a;
|
|
|
|
import com.discord.api.guildscheduledevent.GuildScheduledEvent;
|
|
|
|
import com.discord.models.domain.ModelAuditLog;
|
|
|
|
import com.discord.models.domain.ModelAuditLogEntry;
|
|
|
|
import com.discord.models.domain.ModelGuildIntegration;
|
|
|
|
import com.discord.models.domain.ModelWebhook;
|
|
|
|
import com.discord.models.user.User;
|
|
|
|
import com.discord.stores.updates.ObservationDeck;
|
|
|
|
import com.discord.utilities.auditlogs.AuditLogChangeUtils;
|
|
|
|
import com.discord.utilities.auditlogs.AuditLogUtils;
|
|
|
|
import com.discord.utilities.rest.RestAPI;
|
|
|
|
import com.discord.utilities.rx.ObservableExtensionsKt;
|
|
|
|
import com.discord.utilities.rx.ObservableExtensionsKt$filterNull$1;
|
|
|
|
import com.discord.utilities.rx.ObservableExtensionsKt$filterNull$2;
|
|
|
|
import d0.o;
|
|
|
|
import d0.t.g0;
|
|
|
|
import d0.t.h0;
|
|
|
|
import d0.t.n;
|
|
|
|
import d0.t.s;
|
|
|
|
import d0.t.u;
|
|
|
|
import d0.z.d.m;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.Collection;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.Iterator;
|
|
|
|
import java.util.LinkedHashMap;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
import kotlin.jvm.functions.Function0;
|
|
|
|
import kotlin.jvm.functions.Function1;
|
|
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
|
|
import rx.Observable;
|
|
|
|
/* compiled from: StoreAuditLog.kt */
|
|
|
|
public final class StoreAuditLog extends StoreV2 {
|
|
|
|
public static final Companion Companion = new Companion(null);
|
|
|
|
private static final long NO_GUILD = -1;
|
|
|
|
private Long cutoffTimestamp;
|
|
|
|
private final Dispatcher dispatcher;
|
|
|
|
private final ObservationDeck observationDeck;
|
|
|
|
private final RestAPI restAPI;
|
|
|
|
private AuditLogState state;
|
|
|
|
private AuditLogState stateSnapshot;
|
|
|
|
|
|
|
|
/* compiled from: StoreAuditLog.kt */
|
|
|
|
public static final class AuditLogFilter {
|
|
|
|
public static final Companion Companion = new Companion(null);
|
|
|
|
private final int actionFilter;
|
|
|
|
private final long userFilter;
|
|
|
|
|
|
|
|
/* compiled from: StoreAuditLog.kt */
|
|
|
|
public static final class Companion {
|
|
|
|
private Companion() {
|
|
|
|
}
|
|
|
|
|
|
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
|
|
this();
|
|
|
|
}
|
|
|
|
|
|
|
|
public final AuditLogFilter emptyFilter() {
|
|
|
|
return new AuditLogFilter(0, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public AuditLogFilter(long j, int i) {
|
|
|
|
this.userFilter = j;
|
|
|
|
this.actionFilter = i;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static /* synthetic */ AuditLogFilter copy$default(AuditLogFilter auditLogFilter, long j, int i, int i2, Object obj) {
|
|
|
|
if ((i2 & 1) != 0) {
|
|
|
|
j = auditLogFilter.userFilter;
|
|
|
|
}
|
|
|
|
if ((i2 & 2) != 0) {
|
|
|
|
i = auditLogFilter.actionFilter;
|
|
|
|
}
|
|
|
|
return auditLogFilter.copy(j, i);
|
|
|
|
}
|
|
|
|
|
|
|
|
public final long component1() {
|
|
|
|
return this.userFilter;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final int component2() {
|
|
|
|
return this.actionFilter;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final AuditLogFilter copy(long j, int i) {
|
|
|
|
return new AuditLogFilter(j, i);
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean equals(Object obj) {
|
|
|
|
if (this == obj) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (!(obj instanceof AuditLogFilter)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
AuditLogFilter auditLogFilter = (AuditLogFilter) obj;
|
|
|
|
return this.userFilter == auditLogFilter.userFilter && this.actionFilter == auditLogFilter.actionFilter;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final int getActionFilter() {
|
|
|
|
return this.actionFilter;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final long getUserFilter() {
|
|
|
|
return this.userFilter;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int hashCode() {
|
|
|
|
return (b.a(this.userFilter) * 31) + this.actionFilter;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String toString() {
|
|
|
|
StringBuilder L = a.L("AuditLogFilter(userFilter=");
|
|
|
|
L.append(this.userFilter);
|
|
|
|
L.append(", actionFilter=");
|
|
|
|
return a.z(L, this.actionFilter, ")");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: StoreAuditLog.kt */
|
|
|
|
public static final class AuditLogState {
|
|
|
|
private final Map<ModelAuditLogEntry.TargetType, Map<Long, CharSequence>> deletedTargets;
|
|
|
|
private final List<ModelAuditLogEntry> entries;
|
|
|
|
private final AuditLogFilter filter;
|
|
|
|
private final long guildId;
|
|
|
|
private final List<GuildScheduledEvent> guildScheduledEvents;
|
|
|
|
private final List<ModelGuildIntegration> integrations;
|
|
|
|
private final boolean isLoading;
|
|
|
|
private final Long selectedItemId;
|
|
|
|
private final Map<Long, User> users;
|
|
|
|
private final List<ModelWebhook> webhooks;
|
|
|
|
|
|
|
|
public AuditLogState() {
|
|
|
|
this(0, null, null, null, null, null, null, null, null, false, 1023, null);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r4v0, resolved type: java.util.Map<java.lang.Long, ? extends com.discord.models.user.User> */
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r5v0, resolved type: java.util.List<? extends com.discord.models.domain.ModelAuditLogEntry> */
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r6v0, resolved type: java.util.List<? extends com.discord.models.domain.ModelWebhook> */
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r7v0, resolved type: java.util.List<? extends com.discord.models.domain.ModelGuildIntegration> */
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r11v0, resolved type: java.util.Map<com.discord.models.domain.ModelAuditLogEntry$TargetType, ? extends java.util.Map<java.lang.Long, java.lang.CharSequence>> */
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
|
|
public AuditLogState(long j, Map<Long, ? extends User> map, List<? extends ModelAuditLogEntry> list, List<? extends ModelWebhook> list2, List<? extends ModelGuildIntegration> list3, List<GuildScheduledEvent> list4, Long l, AuditLogFilter auditLogFilter, Map<ModelAuditLogEntry.TargetType, ? extends Map<Long, CharSequence>> map2, boolean z2) {
|
|
|
|
m.checkNotNullParameter(map, "users");
|
|
|
|
m.checkNotNullParameter(list2, "webhooks");
|
|
|
|
m.checkNotNullParameter(list3, "integrations");
|
|
|
|
m.checkNotNullParameter(list4, "guildScheduledEvents");
|
|
|
|
m.checkNotNullParameter(auditLogFilter, "filter");
|
|
|
|
m.checkNotNullParameter(map2, "deletedTargets");
|
|
|
|
this.guildId = j;
|
|
|
|
this.users = map;
|
|
|
|
this.entries = list;
|
|
|
|
this.webhooks = list2;
|
|
|
|
this.integrations = list3;
|
|
|
|
this.guildScheduledEvents = list4;
|
|
|
|
this.selectedItemId = l;
|
|
|
|
this.filter = auditLogFilter;
|
|
|
|
this.deletedTargets = map2;
|
|
|
|
this.isLoading = z2;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
|
|
|
|
public /* synthetic */ AuditLogState(long j, Map map, List list, List list2, List list3, List list4, Long l, AuditLogFilter auditLogFilter, Map map2, boolean z2, int i, DefaultConstructorMarker defaultConstructorMarker) {
|
|
|
|
this((i & 1) != 0 ? -1 : j, (i & 2) != 0 ? h0.emptyMap() : map, (i & 4) != 0 ? null : list, (i & 8) != 0 ? n.emptyList() : list2, (i & 16) != 0 ? n.emptyList() : list3, (i & 32) != 0 ? n.emptyList() : list4, (i & 64) == 0 ? l : null, (i & 128) != 0 ? AuditLogFilter.Companion.emptyFilter() : auditLogFilter, (i & 256) != 0 ? h0.emptyMap() : map2, (i & 512) != 0 ? false : z2);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static /* synthetic */ AuditLogState copy$default(AuditLogState auditLogState, long j, Map map, List list, List list2, List list3, List list4, Long l, AuditLogFilter auditLogFilter, Map map2, boolean z2, int i, Object obj) {
|
|
|
|
return auditLogState.copy((i & 1) != 0 ? auditLogState.guildId : j, (i & 2) != 0 ? auditLogState.users : map, (i & 4) != 0 ? auditLogState.entries : list, (i & 8) != 0 ? auditLogState.webhooks : list2, (i & 16) != 0 ? auditLogState.integrations : list3, (i & 32) != 0 ? auditLogState.guildScheduledEvents : list4, (i & 64) != 0 ? auditLogState.selectedItemId : l, (i & 128) != 0 ? auditLogState.filter : auditLogFilter, (i & 256) != 0 ? auditLogState.deletedTargets : map2, (i & 512) != 0 ? auditLogState.isLoading : z2);
|
|
|
|
}
|
|
|
|
|
|
|
|
public final long component1() {
|
|
|
|
return this.guildId;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final boolean component10() {
|
|
|
|
return this.isLoading;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final Map<Long, User> component2() {
|
|
|
|
return this.users;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final List<ModelAuditLogEntry> component3() {
|
|
|
|
return this.entries;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final List<ModelWebhook> component4() {
|
|
|
|
return this.webhooks;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final List<ModelGuildIntegration> component5() {
|
|
|
|
return this.integrations;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final List<GuildScheduledEvent> component6() {
|
|
|
|
return this.guildScheduledEvents;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final Long component7() {
|
|
|
|
return this.selectedItemId;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final AuditLogFilter component8() {
|
|
|
|
return this.filter;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final Map<ModelAuditLogEntry.TargetType, Map<Long, CharSequence>> component9() {
|
|
|
|
return this.deletedTargets;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final AuditLogState copy(long j, Map<Long, ? extends User> map, List<? extends ModelAuditLogEntry> list, List<? extends ModelWebhook> list2, List<? extends ModelGuildIntegration> list3, List<GuildScheduledEvent> list4, Long l, AuditLogFilter auditLogFilter, Map<ModelAuditLogEntry.TargetType, ? extends Map<Long, CharSequence>> map2, boolean z2) {
|
|
|
|
m.checkNotNullParameter(map, "users");
|
|
|
|
m.checkNotNullParameter(list2, "webhooks");
|
|
|
|
m.checkNotNullParameter(list3, "integrations");
|
|
|
|
m.checkNotNullParameter(list4, "guildScheduledEvents");
|
|
|
|
m.checkNotNullParameter(auditLogFilter, "filter");
|
|
|
|
m.checkNotNullParameter(map2, "deletedTargets");
|
|
|
|
return new AuditLogState(j, map, list, list2, list3, list4, l, auditLogFilter, map2, z2);
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean equals(Object obj) {
|
|
|
|
if (this == obj) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (!(obj instanceof AuditLogState)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
AuditLogState auditLogState = (AuditLogState) obj;
|
|
|
|
return this.guildId == auditLogState.guildId && m.areEqual(this.users, auditLogState.users) && m.areEqual(this.entries, auditLogState.entries) && m.areEqual(this.webhooks, auditLogState.webhooks) && m.areEqual(this.integrations, auditLogState.integrations) && m.areEqual(this.guildScheduledEvents, auditLogState.guildScheduledEvents) && m.areEqual(this.selectedItemId, auditLogState.selectedItemId) && m.areEqual(this.filter, auditLogState.filter) && m.areEqual(this.deletedTargets, auditLogState.deletedTargets) && this.isLoading == auditLogState.isLoading;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final Map<ModelAuditLogEntry.TargetType, Map<Long, CharSequence>> getDeletedTargets() {
|
|
|
|
return this.deletedTargets;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final List<ModelAuditLogEntry> getEntries() {
|
|
|
|
return this.entries;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final AuditLogFilter getFilter() {
|
|
|
|
return this.filter;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final long getGuildId() {
|
|
|
|
return this.guildId;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final List<GuildScheduledEvent> getGuildScheduledEvents() {
|
|
|
|
return this.guildScheduledEvents;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final List<ModelGuildIntegration> getIntegrations() {
|
|
|
|
return this.integrations;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final Long getSelectedItemId() {
|
|
|
|
return this.selectedItemId;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final Map<Long, User> getUsers() {
|
|
|
|
return this.users;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final List<ModelWebhook> getWebhooks() {
|
|
|
|
return this.webhooks;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int hashCode() {
|
|
|
|
int a = b.a(this.guildId) * 31;
|
|
|
|
Map<Long, User> map = this.users;
|
|
|
|
int i = 0;
|
|
|
|
int hashCode = (a + (map != null ? map.hashCode() : 0)) * 31;
|
|
|
|
List<ModelAuditLogEntry> list = this.entries;
|
|
|
|
int hashCode2 = (hashCode + (list != null ? list.hashCode() : 0)) * 31;
|
|
|
|
List<ModelWebhook> list2 = this.webhooks;
|
|
|
|
int hashCode3 = (hashCode2 + (list2 != null ? list2.hashCode() : 0)) * 31;
|
|
|
|
List<ModelGuildIntegration> list3 = this.integrations;
|
|
|
|
int hashCode4 = (hashCode3 + (list3 != null ? list3.hashCode() : 0)) * 31;
|
|
|
|
List<GuildScheduledEvent> list4 = this.guildScheduledEvents;
|
|
|
|
int hashCode5 = (hashCode4 + (list4 != null ? list4.hashCode() : 0)) * 31;
|
|
|
|
Long l = this.selectedItemId;
|
|
|
|
int hashCode6 = (hashCode5 + (l != null ? l.hashCode() : 0)) * 31;
|
|
|
|
AuditLogFilter auditLogFilter = this.filter;
|
|
|
|
int hashCode7 = (hashCode6 + (auditLogFilter != null ? auditLogFilter.hashCode() : 0)) * 31;
|
|
|
|
Map<ModelAuditLogEntry.TargetType, Map<Long, CharSequence>> map2 = this.deletedTargets;
|
|
|
|
if (map2 != null) {
|
|
|
|
i = map2.hashCode();
|
|
|
|
}
|
|
|
|
int i2 = (hashCode7 + i) * 31;
|
|
|
|
boolean z2 = this.isLoading;
|
|
|
|
if (z2) {
|
|
|
|
z2 = true;
|
|
|
|
}
|
|
|
|
int i3 = z2 ? 1 : 0;
|
|
|
|
int i4 = z2 ? 1 : 0;
|
|
|
|
int i5 = z2 ? 1 : 0;
|
|
|
|
return i2 + i3;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final boolean isLoading() {
|
|
|
|
return this.isLoading;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String toString() {
|
|
|
|
StringBuilder L = a.L("AuditLogState(guildId=");
|
|
|
|
L.append(this.guildId);
|
|
|
|
L.append(", users=");
|
|
|
|
L.append(this.users);
|
|
|
|
L.append(", entries=");
|
|
|
|
L.append(this.entries);
|
|
|
|
L.append(", webhooks=");
|
|
|
|
L.append(this.webhooks);
|
|
|
|
L.append(", integrations=");
|
|
|
|
L.append(this.integrations);
|
|
|
|
L.append(", guildScheduledEvents=");
|
|
|
|
L.append(this.guildScheduledEvents);
|
|
|
|
L.append(", selectedItemId=");
|
|
|
|
L.append(this.selectedItemId);
|
|
|
|
L.append(", filter=");
|
|
|
|
L.append(this.filter);
|
|
|
|
L.append(", deletedTargets=");
|
|
|
|
L.append(this.deletedTargets);
|
|
|
|
L.append(", isLoading=");
|
|
|
|
return a.G(L, this.isLoading, ")");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: StoreAuditLog.kt */
|
|
|
|
public static final class Companion {
|
|
|
|
private Companion() {
|
|
|
|
}
|
|
|
|
|
|
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
|
|
this();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public StoreAuditLog(ObservationDeck observationDeck, Dispatcher dispatcher, RestAPI restAPI) {
|
|
|
|
m.checkNotNullParameter(observationDeck, "observationDeck");
|
|
|
|
m.checkNotNullParameter(dispatcher, "dispatcher");
|
|
|
|
m.checkNotNullParameter(restAPI, "restAPI");
|
|
|
|
this.observationDeck = observationDeck;
|
|
|
|
this.dispatcher = dispatcher;
|
|
|
|
this.restAPI = restAPI;
|
|
|
|
AuditLogState auditLogState = new AuditLogState(0, null, null, null, null, null, null, null, null, false, 1023, null);
|
|
|
|
this.state = auditLogState;
|
|
|
|
this.stateSnapshot = auditLogState;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ void access$clearStateInternal(StoreAuditLog storeAuditLog) {
|
|
|
|
storeAuditLog.clearStateInternal();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ void access$fetchAuditLogs(StoreAuditLog storeAuditLog, long j, AuditLogFilter auditLogFilter) {
|
|
|
|
storeAuditLog.fetchAuditLogs(j, auditLogFilter);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ AuditLogState access$getState$p(StoreAuditLog storeAuditLog) {
|
|
|
|
return storeAuditLog.state;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ void access$handleFetchFailure(StoreAuditLog storeAuditLog) {
|
|
|
|
storeAuditLog.handleFetchFailure();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ void access$handleFetchSuccess(StoreAuditLog storeAuditLog, long j, ModelAuditLog modelAuditLog) {
|
|
|
|
storeAuditLog.handleFetchSuccess(j, modelAuditLog);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ void access$setState$p(StoreAuditLog storeAuditLog, AuditLogState auditLogState) {
|
|
|
|
storeAuditLog.state = auditLogState;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ List access$transformEntries(StoreAuditLog storeAuditLog, long j, List list) {
|
|
|
|
return storeAuditLog.transformEntries(j, list);
|
|
|
|
}
|
|
|
|
|
|
|
|
@StoreThread
|
|
|
|
private final void clearStateInternal() {
|
|
|
|
this.cutoffTimestamp = null;
|
|
|
|
this.state = new AuditLogState(0, null, null, null, null, null, null, null, null, false, 1023, null);
|
|
|
|
markChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
@StoreThread
|
|
|
|
private final void fetchAuditLogs(long j, AuditLogFilter auditLogFilter) {
|
|
|
|
ModelAuditLogEntry modelAuditLogEntry;
|
|
|
|
List<ModelAuditLogEntry> entries = this.state.getEntries();
|
|
|
|
Long valueOf = (entries == null || (modelAuditLogEntry = (ModelAuditLogEntry) u.lastOrNull(entries)) == null) ? null : Long.valueOf(modelAuditLogEntry.getId());
|
|
|
|
if (this.cutoffTimestamp == null) {
|
|
|
|
this.cutoffTimestamp = 0L;
|
|
|
|
}
|
|
|
|
if (!m.areEqual(valueOf, this.cutoffTimestamp)) {
|
|
|
|
this.cutoffTimestamp = valueOf;
|
|
|
|
this.state = AuditLogState.copy$default(this.state, j, null, null, null, null, null, null, null, null, true, 510, null);
|
|
|
|
markChanged();
|
|
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.restSubscribeOn$default(this.restAPI.getAuditLogs(j, valueOf, Long.valueOf(auditLogFilter.getUserFilter()), Integer.valueOf(auditLogFilter.getActionFilter())), false, 1, null), StoreAuditLog.class, (Context) null, (Function1) null, new StoreAuditLog$fetchAuditLogs$1(this), (Function0) null, (Function0) null, new StoreAuditLog$fetchAuditLogs$2(this, j), 54, (Object) null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private final void handleFetchFailure() {
|
|
|
|
this.dispatcher.schedule(new StoreAuditLog$handleFetchFailure$1(this));
|
|
|
|
}
|
|
|
|
|
|
|
|
private final void handleFetchSuccess(long j, ModelAuditLog modelAuditLog) {
|
|
|
|
this.dispatcher.schedule(new StoreAuditLog$handleFetchSuccess$1(this, modelAuditLog, j));
|
|
|
|
}
|
|
|
|
|
|
|
|
private final boolean shouldMergeEntries(ModelAuditLogEntry modelAuditLogEntry, ModelAuditLogEntry modelAuditLogEntry2, int i, int i2, int i3) {
|
|
|
|
if (!(modelAuditLogEntry == null || modelAuditLogEntry.getActionTypeId() != modelAuditLogEntry2.getActionTypeId() || modelAuditLogEntry.getTargetId() != modelAuditLogEntry2.getTargetId() || modelAuditLogEntry.getUserId() != modelAuditLogEntry2.getUserId() || !m.areEqual(modelAuditLogEntry.getOptions(), modelAuditLogEntry2.getOptions()) || i >= i3 || modelAuditLogEntry2.getTargetType() == ModelAuditLogEntry.TargetType.INVITE || modelAuditLogEntry2.getActionTypeId() == 72 || modelAuditLogEntry2.getActionTypeId() == 73 || modelAuditLogEntry2.getActionTypeId() == 26 || modelAuditLogEntry2.getActionTypeId() == 27)) {
|
|
|
|
AuditLogUtils auditLogUtils = AuditLogUtils.INSTANCE;
|
|
|
|
if (Math.abs(auditLogUtils.getTimestampStart(modelAuditLogEntry2) - auditLogUtils.getTimestampStart(modelAuditLogEntry)) < ((long) i2) * 60000) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static /* synthetic */ boolean shouldMergeEntries$default(StoreAuditLog storeAuditLog, ModelAuditLogEntry modelAuditLogEntry, ModelAuditLogEntry modelAuditLogEntry2, int i, int i2, int i3, int i4, Object obj) {
|
|
|
|
return storeAuditLog.shouldMergeEntries(modelAuditLogEntry, modelAuditLogEntry2, i, (i4 & 8) != 0 ? 30 : i2, (i4 & 16) != 0 ? 50 : i3);
|
|
|
|
}
|
|
|
|
|
|
|
|
private final List<ModelAuditLogEntry> transformEntries(long j, List<? extends ModelAuditLogEntry> list) {
|
|
|
|
ModelAuditLogEntry.Change change;
|
|
|
|
ModelAuditLogEntry.Change change2;
|
|
|
|
ModelAuditLogEntry.Options options;
|
|
|
|
List<ModelAuditLogEntry.Change> changes;
|
|
|
|
ArrayList arrayList = new ArrayList();
|
|
|
|
while (true) {
|
|
|
|
int i = 0;
|
|
|
|
for (ModelAuditLogEntry modelAuditLogEntry : s.asReversed(list)) {
|
|
|
|
ArrayList arrayList2 = new ArrayList();
|
|
|
|
if (modelAuditLogEntry.getReason() != null) {
|
|
|
|
arrayList2.add(new ModelAuditLogEntry.Change("reason", null, modelAuditLogEntry.getReason()));
|
|
|
|
}
|
|
|
|
List<ModelAuditLogEntry.Change> changes2 = modelAuditLogEntry.getChanges();
|
|
|
|
if (changes2 != null) {
|
|
|
|
ModelAuditLogEntry.Change change3 = null;
|
|
|
|
ModelAuditLogEntry.Change change4 = null;
|
|
|
|
for (ModelAuditLogEntry.Change change5 : changes2) {
|
|
|
|
m.checkNotNullExpressionValue(change5, "change");
|
|
|
|
String key = change5.getKey();
|
|
|
|
if (key != null) {
|
|
|
|
switch (key.hashCode()) {
|
|
|
|
case 3079692:
|
|
|
|
if (key.equals("deny")) {
|
|
|
|
arrayList2.addAll(AuditLogChangeUtils.INSTANCE.transformPermissionOverride(change5));
|
|
|
|
break;
|
|
|
|
} else {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 92906313:
|
|
|
|
if (key.equals("allow")) {
|
|
|
|
arrayList2.addAll(AuditLogChangeUtils.INSTANCE.transformPermissionOverride(change5));
|
|
|
|
break;
|
|
|
|
} else {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 108404047:
|
|
|
|
if (key.equals("reset")) {
|
|
|
|
arrayList2.addAll(AuditLogChangeUtils.INSTANCE.transformPermissionOverride(change5));
|
|
|
|
break;
|
|
|
|
} else {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 1133704324:
|
|
|
|
if (key.equals("permissions")) {
|
|
|
|
arrayList2.addAll(AuditLogChangeUtils.INSTANCE.transformPermissionChange(change5));
|
|
|
|
break;
|
|
|
|
} else {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
arrayList2.add(change5);
|
|
|
|
String key2 = change5.getKey();
|
|
|
|
if (key2 != null) {
|
|
|
|
int hashCode = key2.hashCode();
|
|
|
|
if (hashCode != 3373707) {
|
|
|
|
if (hashCode == 3575610 && key2.equals("type")) {
|
|
|
|
change4 = change5;
|
|
|
|
}
|
|
|
|
} else if (key2.equals("name")) {
|
|
|
|
change3 = change5;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
change2 = change3;
|
|
|
|
change = change4;
|
|
|
|
} else {
|
|
|
|
change2 = null;
|
|
|
|
change = null;
|
|
|
|
}
|
|
|
|
if (modelAuditLogEntry.getActionTypeId() == 21) {
|
|
|
|
ModelAuditLogEntry.Options options2 = modelAuditLogEntry.getOptions();
|
|
|
|
arrayList2.add(new ModelAuditLogEntry.Change("prune_delete_days", null, Integer.valueOf(options2 != null ? options2.getDeleteMemberDays() : 1)));
|
|
|
|
}
|
|
|
|
ModelAuditLogEntry modelAuditLogEntry2 = new ModelAuditLogEntry(modelAuditLogEntry.getId(), modelAuditLogEntry.getActionTypeId(), modelAuditLogEntry.getTargetId(), modelAuditLogEntry.getUserId(), arrayList2, modelAuditLogEntry.getOptions(), j, null);
|
|
|
|
ModelAuditLogEntry modelAuditLogEntry3 = (ModelAuditLogEntry) u.firstOrNull((List<? extends Object>) arrayList);
|
|
|
|
List list2 = null;
|
|
|
|
if (shouldMergeEntries$default(this, modelAuditLogEntry3, modelAuditLogEntry2, i, 0, 0, 24, null)) {
|
|
|
|
long id2 = modelAuditLogEntry3 != null ? modelAuditLogEntry3.getId() : modelAuditLogEntry2.getId();
|
|
|
|
int actionTypeId = modelAuditLogEntry3 != null ? modelAuditLogEntry3.getActionTypeId() : modelAuditLogEntry2.getActionTypeId();
|
|
|
|
long targetId = modelAuditLogEntry3 != null ? modelAuditLogEntry3.getTargetId() : modelAuditLogEntry2.getTargetId();
|
|
|
|
long userId = modelAuditLogEntry3 != null ? modelAuditLogEntry3.getUserId() : modelAuditLogEntry2.getUserId();
|
|
|
|
if (!(modelAuditLogEntry3 == null || (changes = modelAuditLogEntry3.getChanges()) == null)) {
|
|
|
|
list2 = u.toMutableList((Collection) changes);
|
|
|
|
}
|
|
|
|
if (list2 != null) {
|
|
|
|
List<ModelAuditLogEntry.Change> changes3 = modelAuditLogEntry2.getChanges();
|
|
|
|
if (changes3 == null) {
|
|
|
|
changes3 = n.emptyList();
|
|
|
|
}
|
|
|
|
list2.addAll(changes3);
|
|
|
|
} else {
|
|
|
|
modelAuditLogEntry2.getChanges();
|
|
|
|
}
|
|
|
|
if (modelAuditLogEntry3 == null || (options = modelAuditLogEntry3.getOptions()) == null) {
|
|
|
|
options = modelAuditLogEntry2.getOptions();
|
|
|
|
}
|
|
|
|
arrayList.set(0, new ModelAuditLogEntry(id2, actionTypeId, targetId, userId, list2, options, j, Long.valueOf(AuditLogUtils.INSTANCE.getTimestampStart(modelAuditLogEntry2))));
|
|
|
|
i++;
|
|
|
|
} else {
|
|
|
|
Map mutableMap = h0.toMutableMap(this.state.getDeletedTargets());
|
|
|
|
if (modelAuditLogEntry2.getActionType() == ModelAuditLogEntry.ActionType.DELETE && change2 != null) {
|
|
|
|
String str = (String) change2.getOldValue();
|
|
|
|
if (modelAuditLogEntry2.getTargetType() == ModelAuditLogEntry.TargetType.CHANNEL) {
|
|
|
|
if (m.areEqual(change != null ? change.getOldValue() : null, 0)) {
|
|
|
|
str = '#' + str;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (mutableMap.get(modelAuditLogEntry2.getTargetType()) == null) {
|
|
|
|
ModelAuditLogEntry.TargetType targetType = modelAuditLogEntry2.getTargetType();
|
|
|
|
m.checkNotNullExpressionValue(targetType, "entry.targetType");
|
|
|
|
mutableMap.put(targetType, h0.mutableMapOf(o.to(Long.valueOf(modelAuditLogEntry2.getTargetId()), str)));
|
|
|
|
} else {
|
|
|
|
Map map = (Map) mutableMap.get(modelAuditLogEntry2.getTargetType());
|
|
|
|
if (map != null) {
|
|
|
|
CharSequence charSequence = (CharSequence) map.put(Long.valueOf(modelAuditLogEntry2.getTargetId()), str);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.state = AuditLogState.copy$default(this.state, 0, null, null, null, null, null, null, null, mutableMap, false, 767, null);
|
|
|
|
}
|
|
|
|
arrayList.add(0, modelAuditLogEntry2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return arrayList;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public final void clearState() {
|
|
|
|
this.dispatcher.schedule(new StoreAuditLog$clearState$1(this));
|
|
|
|
}
|
|
|
|
|
|
|
|
public final void fetchAuditLogIfNeeded(long j) {
|
|
|
|
this.dispatcher.schedule(new StoreAuditLog$fetchAuditLogIfNeeded$1(this, j));
|
|
|
|
}
|
|
|
|
|
|
|
|
public final void fetchMoreAuditLogEntries() {
|
|
|
|
this.dispatcher.schedule(new StoreAuditLog$fetchMoreAuditLogEntries$1(this));
|
|
|
|
}
|
|
|
|
|
|
|
|
public final AuditLogState getAuditLogState(long j) {
|
|
|
|
AuditLogState auditLogState = this.stateSnapshot;
|
|
|
|
if (j == auditLogState.getGuildId()) {
|
|
|
|
return auditLogState;
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final Observable<AuditLogState> observeAuditLogState(long j) {
|
2021-07-03 23:36:06 +00:00
|
|
|
Observable t = ObservationDeck.connectRx$default(this.observationDeck, new ObservationDeck.UpdateSource[]{this}, false, null, null, new StoreAuditLog$observeAuditLogState$1(this, j), 14, null).r().t(new StoreAuditLog$observeAuditLogState$2(this, j));
|
|
|
|
m.checkNotNullExpressionValue(t, "observationDeck.connectR…ditLogIfNeeded(guildId) }");
|
|
|
|
Observable<AuditLogState> F = t.x(ObservableExtensionsKt$filterNull$1.INSTANCE).F(ObservableExtensionsKt$filterNull$2.INSTANCE);
|
|
|
|
m.checkNotNullExpressionValue(F, "filter { it != null }.map { it!! }");
|
|
|
|
return F;
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public final void setAuditLogFilterActionId(int i) {
|
|
|
|
this.dispatcher.schedule(new StoreAuditLog$setAuditLogFilterActionId$1(this, i));
|
|
|
|
}
|
|
|
|
|
|
|
|
public final void setAuditLogFilterUserId(long j) {
|
|
|
|
this.dispatcher.schedule(new StoreAuditLog$setAuditLogFilterUserId$1(this, j));
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.stores.StoreV2
|
|
|
|
public void snapshotData() {
|
|
|
|
super.snapshotData();
|
|
|
|
AuditLogState auditLogState = this.state;
|
|
|
|
HashMap hashMap = new HashMap(this.state.getUsers());
|
|
|
|
List<ModelAuditLogEntry> entries = this.state.getEntries();
|
|
|
|
ArrayList arrayList = entries != null ? new ArrayList(entries) : null;
|
|
|
|
ArrayList arrayList2 = new ArrayList(this.state.getWebhooks());
|
|
|
|
ArrayList arrayList3 = new ArrayList(this.state.getIntegrations());
|
|
|
|
ArrayList arrayList4 = new ArrayList(this.state.getGuildScheduledEvents());
|
|
|
|
Map<ModelAuditLogEntry.TargetType, Map<Long, CharSequence>> deletedTargets = this.state.getDeletedTargets();
|
|
|
|
LinkedHashMap linkedHashMap = new LinkedHashMap(g0.mapCapacity(deletedTargets.size()));
|
|
|
|
Iterator<T> it = deletedTargets.entrySet().iterator();
|
|
|
|
while (it.hasNext()) {
|
|
|
|
Map.Entry entry = (Map.Entry) it.next();
|
|
|
|
linkedHashMap.put(entry.getKey(), new HashMap((Map) entry.getValue()));
|
|
|
|
}
|
|
|
|
this.stateSnapshot = AuditLogState.copy$default(auditLogState, 0, hashMap, arrayList, arrayList2, arrayList3, arrayList4, null, null, linkedHashMap, false, 705, null);
|
|
|
|
}
|
|
|
|
|
|
|
|
public final void toggleSelectedState(long j) {
|
|
|
|
this.dispatcher.schedule(new StoreAuditLog$toggleSelectedState$1(this, j));
|
|
|
|
}
|
|
|
|
}
|