181 lines
8.2 KiB
Java
181 lines
8.2 KiB
Java
package com.discord.stores;
|
|
|
|
import c.d.b.a.a;
|
|
import com.discord.models.domain.ModelMemberVerificationForm;
|
|
import com.discord.stores.updates.ObservationDeck;
|
|
import com.discord.stores.updates.ObservationDeckProvider;
|
|
import com.discord.utilities.rest.RestAPI;
|
|
import d0.t.h0;
|
|
import d0.z.d.m;
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
import rx.Observable;
|
|
/* compiled from: StoreGuildMemberVerificationForm.kt */
|
|
public final class StoreGuildMemberVerificationForm extends StoreV2 {
|
|
private final Dispatcher dispatcher;
|
|
private Map<Long, MemberVerificationFormData> memberVerificationFormSnapshot;
|
|
private final HashMap<Long, MemberVerificationFormData> memberVerificationFormState;
|
|
private final ObservationDeck observationDeck;
|
|
private final RestAPI restAPI;
|
|
|
|
/* compiled from: StoreGuildMemberVerificationForm.kt */
|
|
public enum FetchStates {
|
|
FETCHING,
|
|
FAILED,
|
|
SUCCEEDED
|
|
}
|
|
|
|
/* compiled from: StoreGuildMemberVerificationForm.kt */
|
|
public static final class MemberVerificationFormData {
|
|
private final FetchStates fetchState;
|
|
private final ModelMemberVerificationForm form;
|
|
|
|
public MemberVerificationFormData(FetchStates fetchStates, ModelMemberVerificationForm modelMemberVerificationForm) {
|
|
m.checkNotNullParameter(fetchStates, "fetchState");
|
|
this.fetchState = fetchStates;
|
|
this.form = modelMemberVerificationForm;
|
|
}
|
|
|
|
public static /* synthetic */ MemberVerificationFormData copy$default(MemberVerificationFormData memberVerificationFormData, FetchStates fetchStates, ModelMemberVerificationForm modelMemberVerificationForm, int i, Object obj) {
|
|
if ((i & 1) != 0) {
|
|
fetchStates = memberVerificationFormData.fetchState;
|
|
}
|
|
if ((i & 2) != 0) {
|
|
modelMemberVerificationForm = memberVerificationFormData.form;
|
|
}
|
|
return memberVerificationFormData.copy(fetchStates, modelMemberVerificationForm);
|
|
}
|
|
|
|
public final FetchStates component1() {
|
|
return this.fetchState;
|
|
}
|
|
|
|
public final ModelMemberVerificationForm component2() {
|
|
return this.form;
|
|
}
|
|
|
|
public final MemberVerificationFormData copy(FetchStates fetchStates, ModelMemberVerificationForm modelMemberVerificationForm) {
|
|
m.checkNotNullParameter(fetchStates, "fetchState");
|
|
return new MemberVerificationFormData(fetchStates, modelMemberVerificationForm);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof MemberVerificationFormData)) {
|
|
return false;
|
|
}
|
|
MemberVerificationFormData memberVerificationFormData = (MemberVerificationFormData) obj;
|
|
return m.areEqual(this.fetchState, memberVerificationFormData.fetchState) && m.areEqual(this.form, memberVerificationFormData.form);
|
|
}
|
|
|
|
public final FetchStates getFetchState() {
|
|
return this.fetchState;
|
|
}
|
|
|
|
public final ModelMemberVerificationForm getForm() {
|
|
return this.form;
|
|
}
|
|
|
|
public int hashCode() {
|
|
FetchStates fetchStates = this.fetchState;
|
|
int i = 0;
|
|
int hashCode = (fetchStates != null ? fetchStates.hashCode() : 0) * 31;
|
|
ModelMemberVerificationForm modelMemberVerificationForm = this.form;
|
|
if (modelMemberVerificationForm != null) {
|
|
i = modelMemberVerificationForm.hashCode();
|
|
}
|
|
return hashCode + i;
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder L = a.L("MemberVerificationFormData(fetchState=");
|
|
L.append(this.fetchState);
|
|
L.append(", form=");
|
|
L.append(this.form);
|
|
L.append(")");
|
|
return L.toString();
|
|
}
|
|
}
|
|
|
|
public StoreGuildMemberVerificationForm(Dispatcher dispatcher, RestAPI restAPI, ObservationDeck observationDeck) {
|
|
m.checkNotNullParameter(dispatcher, "dispatcher");
|
|
m.checkNotNullParameter(restAPI, "restAPI");
|
|
m.checkNotNullParameter(observationDeck, "observationDeck");
|
|
this.dispatcher = dispatcher;
|
|
this.restAPI = restAPI;
|
|
this.observationDeck = observationDeck;
|
|
this.memberVerificationFormSnapshot = h0.emptyMap();
|
|
this.memberVerificationFormState = new HashMap<>();
|
|
}
|
|
|
|
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
|
|
public /* synthetic */ StoreGuildMemberVerificationForm(Dispatcher dispatcher, RestAPI restAPI, ObservationDeck observationDeck, int i, DefaultConstructorMarker defaultConstructorMarker) {
|
|
this(dispatcher, (i & 2) != 0 ? RestAPI.Companion.getApi() : restAPI, (i & 4) != 0 ? ObservationDeckProvider.get() : observationDeck);
|
|
}
|
|
|
|
public static final /* synthetic */ Dispatcher access$getDispatcher$p(StoreGuildMemberVerificationForm storeGuildMemberVerificationForm) {
|
|
return storeGuildMemberVerificationForm.dispatcher;
|
|
}
|
|
|
|
public static final /* synthetic */ HashMap access$getMemberVerificationFormState$p(StoreGuildMemberVerificationForm storeGuildMemberVerificationForm) {
|
|
return storeGuildMemberVerificationForm.memberVerificationFormState;
|
|
}
|
|
|
|
public static final /* synthetic */ RestAPI access$getRestAPI$p(StoreGuildMemberVerificationForm storeGuildMemberVerificationForm) {
|
|
return storeGuildMemberVerificationForm.restAPI;
|
|
}
|
|
|
|
public static final /* synthetic */ void access$handleMemberVerificationFormFetchFailed(StoreGuildMemberVerificationForm storeGuildMemberVerificationForm, long j) {
|
|
storeGuildMemberVerificationForm.handleMemberVerificationFormFetchFailed(j);
|
|
}
|
|
|
|
public static final /* synthetic */ void access$handleMemberVerificationFormFetchStart(StoreGuildMemberVerificationForm storeGuildMemberVerificationForm, long j) {
|
|
storeGuildMemberVerificationForm.handleMemberVerificationFormFetchStart(j);
|
|
}
|
|
|
|
public static final /* synthetic */ void access$handleMemberVerificationFormFetchSuccess(StoreGuildMemberVerificationForm storeGuildMemberVerificationForm, long j, ModelMemberVerificationForm modelMemberVerificationForm) {
|
|
storeGuildMemberVerificationForm.handleMemberVerificationFormFetchSuccess(j, modelMemberVerificationForm);
|
|
}
|
|
|
|
@StoreThread
|
|
private final void handleMemberVerificationFormFetchFailed(long j) {
|
|
this.memberVerificationFormState.put(Long.valueOf(j), new MemberVerificationFormData(FetchStates.FAILED, null));
|
|
markChanged();
|
|
}
|
|
|
|
@StoreThread
|
|
private final void handleMemberVerificationFormFetchStart(long j) {
|
|
this.memberVerificationFormState.put(Long.valueOf(j), new MemberVerificationFormData(FetchStates.FETCHING, null));
|
|
markChanged();
|
|
}
|
|
|
|
@StoreThread
|
|
private final void handleMemberVerificationFormFetchSuccess(long j, ModelMemberVerificationForm modelMemberVerificationForm) {
|
|
this.memberVerificationFormState.put(Long.valueOf(j), new MemberVerificationFormData(FetchStates.SUCCEEDED, modelMemberVerificationForm));
|
|
markChanged();
|
|
}
|
|
|
|
public final void fetchMemberVerificationForm(long j) {
|
|
this.dispatcher.schedule(new StoreGuildMemberVerificationForm$fetchMemberVerificationForm$1(this, j));
|
|
}
|
|
|
|
public final MemberVerificationFormData getMemberVerificationFormData(long j) {
|
|
return this.memberVerificationFormSnapshot.get(Long.valueOf(j));
|
|
}
|
|
|
|
public final Observable<MemberVerificationFormData> observeMemberVerificationFormData(long j) {
|
|
Observable<MemberVerificationFormData> r = ObservationDeck.connectRx$default(this.observationDeck, new ObservationDeck.UpdateSource[]{this}, false, null, null, new StoreGuildMemberVerificationForm$observeMemberVerificationFormData$1(this, j), 14, null).r();
|
|
m.checkNotNullExpressionValue(r, "observationDeck.connectR… }.distinctUntilChanged()");
|
|
return r;
|
|
}
|
|
|
|
@Override // com.discord.stores.StoreV2
|
|
@StoreThread
|
|
public void snapshotData() {
|
|
super.snapshotData();
|
|
this.memberVerificationFormSnapshot = new HashMap(this.memberVerificationFormState);
|
|
}
|
|
}
|