discord-jadx/app/src/main/java/com/discord/stores/StoreGuildRoleSubscriptions...

171 lines
6.7 KiB
Java

package com.discord.stores;
import android.content.Context;
import c.d.b.a.a;
import com.discord.api.premium.PriceTierType;
import com.discord.utilities.rest.RestAPI;
import com.discord.utilities.rx.ObservableExtensionsKt;
import d0.z.d.m;
import java.util.List;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.DefaultConstructorMarker;
/* compiled from: StoreGuildRoleSubscriptions.kt */
public final class StoreGuildRoleSubscriptions extends StoreV2 {
private final Dispatcher dispatcher;
private PriceTierState priceTierState;
private PriceTierState priceTierStateSnapshot;
private final RestAPI restAPI;
/* compiled from: StoreGuildRoleSubscriptions.kt */
public static abstract class PriceTierState {
/* compiled from: StoreGuildRoleSubscriptions.kt */
public static final class Failed extends PriceTierState {
private final String errorMessage;
public Failed() {
this(null, 1, null);
}
public Failed(String str) {
super(null);
this.errorMessage = str;
}
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
public /* synthetic */ Failed(String str, int i, DefaultConstructorMarker defaultConstructorMarker) {
this((i & 1) != 0 ? null : str);
}
public final String getErrorMessage() {
return this.errorMessage;
}
}
/* compiled from: StoreGuildRoleSubscriptions.kt */
public static final class Loaded extends PriceTierState {
private final List<Integer> priceTiers;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public Loaded(List<Integer> list) {
super(null);
m.checkNotNullParameter(list, "priceTiers");
this.priceTiers = list;
}
/* JADX DEBUG: Multi-variable search result rejected for r0v0, resolved type: com.discord.stores.StoreGuildRoleSubscriptions$PriceTierState$Loaded */
/* JADX WARN: Multi-variable type inference failed */
public static /* synthetic */ Loaded copy$default(Loaded loaded, List list, int i, Object obj) {
if ((i & 1) != 0) {
list = loaded.priceTiers;
}
return loaded.copy(list);
}
public final List<Integer> component1() {
return this.priceTiers;
}
public final Loaded copy(List<Integer> list) {
m.checkNotNullParameter(list, "priceTiers");
return new Loaded(list);
}
public boolean equals(Object obj) {
if (this != obj) {
return (obj instanceof Loaded) && m.areEqual(this.priceTiers, ((Loaded) obj).priceTiers);
}
return true;
}
public final List<Integer> getPriceTiers() {
return this.priceTiers;
}
public int hashCode() {
List<Integer> list = this.priceTiers;
if (list != null) {
return list.hashCode();
}
return 0;
}
public String toString() {
return a.D(a.K("Loaded(priceTiers="), this.priceTiers, ")");
}
}
/* compiled from: StoreGuildRoleSubscriptions.kt */
public static final class Loading extends PriceTierState {
public static final Loading INSTANCE = new Loading();
private Loading() {
super(null);
}
}
/* compiled from: StoreGuildRoleSubscriptions.kt */
public static final class Uninitialized extends PriceTierState {
public static final Uninitialized INSTANCE = new Uninitialized();
private Uninitialized() {
super(null);
}
}
private PriceTierState() {
}
public /* synthetic */ PriceTierState(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
}
public StoreGuildRoleSubscriptions(Dispatcher dispatcher, RestAPI restAPI) {
m.checkNotNullParameter(dispatcher, "dispatcher");
m.checkNotNullParameter(restAPI, "restAPI");
this.dispatcher = dispatcher;
this.restAPI = restAPI;
PriceTierState.Uninitialized uninitialized = PriceTierState.Uninitialized.INSTANCE;
this.priceTierState = uninitialized;
this.priceTierStateSnapshot = uninitialized;
}
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
public /* synthetic */ StoreGuildRoleSubscriptions(Dispatcher dispatcher, RestAPI restAPI, int i, DefaultConstructorMarker defaultConstructorMarker) {
this(dispatcher, (i & 2) != 0 ? RestAPI.Companion.getApi() : restAPI);
}
public static final /* synthetic */ Dispatcher access$getDispatcher$p(StoreGuildRoleSubscriptions storeGuildRoleSubscriptions) {
return storeGuildRoleSubscriptions.dispatcher;
}
public static final /* synthetic */ PriceTierState access$getPriceTierState$p(StoreGuildRoleSubscriptions storeGuildRoleSubscriptions) {
return storeGuildRoleSubscriptions.priceTierState;
}
public static final /* synthetic */ void access$setPriceTierState$p(StoreGuildRoleSubscriptions storeGuildRoleSubscriptions, PriceTierState priceTierState) {
storeGuildRoleSubscriptions.priceTierState = priceTierState;
}
public final void fetchPriceTiersIfNonExisting() {
PriceTierState priceTierState = this.priceTierState;
if (!(priceTierState instanceof PriceTierState.Loading) && !(priceTierState instanceof PriceTierState.Loaded)) {
this.dispatcher.schedule(new StoreGuildRoleSubscriptions$fetchPriceTiersIfNonExisting$1(this));
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.restSubscribeOn$default(this.restAPI.getPriceTiers(PriceTierType.GUILD_ROLE_SUBSCRIPTIONS.getApiValue()), false, 1, null), StoreGuildRoleSubscriptions.class, (Context) null, (Function1) null, new StoreGuildRoleSubscriptions$fetchPriceTiersIfNonExisting$3(this), (Function0) null, (Function0) null, new StoreGuildRoleSubscriptions$fetchPriceTiersIfNonExisting$2(this), 54, (Object) null);
}
}
public final PriceTierState getPriceTiersState() {
return this.priceTierStateSnapshot;
}
@Override // com.discord.stores.StoreV2
@StoreThread
public void snapshotData() {
super.snapshotData();
this.priceTierStateSnapshot = this.priceTierState;
}
}