156 lines
8.5 KiB
Java
156 lines
8.5 KiB
Java
package com.discord.stores;
|
|
|
|
import android.content.Context;
|
|
import androidx.core.view.PointerIconCompat;
|
|
import com.discord.models.domain.ModelGift;
|
|
import com.discord.restapi.RestAPIAbortCodes;
|
|
import com.discord.stores.StoreGifting;
|
|
import com.discord.utilities.error.Error;
|
|
import com.discord.utilities.rest.RestAPI;
|
|
import com.discord.utilities.rx.ObservableExtensionsKt;
|
|
import d0.z.d.m;
|
|
import d0.z.d.o;
|
|
import j0.p.a;
|
|
import kotlin.Unit;
|
|
import kotlin.jvm.functions.Function0;
|
|
import kotlin.jvm.functions.Function1;
|
|
import rx.Observable;
|
|
/* compiled from: StoreGifting.kt */
|
|
public final class StoreGifting$acceptGift$1 extends o implements Function0<Unit> {
|
|
public final /* synthetic */ ModelGift $gift;
|
|
public final /* synthetic */ StoreGifting this$0;
|
|
|
|
/* compiled from: StoreGifting.kt */
|
|
/* renamed from: com.discord.stores.StoreGifting$acceptGift$1$1 reason: invalid class name */
|
|
public static final class AnonymousClass1 extends o implements Function1<Error, Unit> {
|
|
public final /* synthetic */ StoreGifting$acceptGift$1 this$0;
|
|
|
|
/* compiled from: StoreGifting.kt */
|
|
/* renamed from: com.discord.stores.StoreGifting$acceptGift$1$1$1 reason: invalid class name */
|
|
public static final class AnonymousClass1 extends o implements Function0<Unit> {
|
|
public final /* synthetic */ Error $error;
|
|
public final /* synthetic */ AnonymousClass1 this$0;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public AnonymousClass1(AnonymousClass1 r1, Error error) {
|
|
super(0);
|
|
this.this$0 = r1;
|
|
this.$error = error;
|
|
}
|
|
|
|
@Override // kotlin.jvm.functions.Function0
|
|
/* renamed from: invoke */
|
|
public final void mo1invoke() {
|
|
if (this.$error.getType() == Error.Type.DISCORD_BAD_REQUEST) {
|
|
this.$error.setShowErrorToasts(false);
|
|
Error.Response response = this.$error.getResponse();
|
|
m.checkNotNullExpressionValue(response, "error.response");
|
|
switch (response.getCode()) {
|
|
case RestAPIAbortCodes.GIFTING_ALREADY_USED_ERROR_CODE /* 50050 */:
|
|
StoreGifting$acceptGift$1 storeGifting$acceptGift$1 = this.this$0.this$0;
|
|
StoreGifting storeGifting = storeGifting$acceptGift$1.this$0;
|
|
String code = storeGifting$acceptGift$1.$gift.getCode();
|
|
ModelGift modelGift = this.this$0.this$0.$gift;
|
|
StoreGifting.access$setGifts(storeGifting, code, new StoreGifting.GiftState.Resolved(ModelGift.copy$default(modelGift, 0, false, null, null, modelGift.getMaxUses(), null, 0, null, null, null, PointerIconCompat.TYPE_CROSSHAIR, null)));
|
|
return;
|
|
case RestAPIAbortCodes.GIFTING_ALREADY_OWNED_ERROR_CODE /* 50051 */:
|
|
StoreGifting$acceptGift$1 storeGifting$acceptGift$12 = this.this$0.this$0;
|
|
StoreGifting.access$setGifts(storeGifting$acceptGift$12.this$0, storeGifting$acceptGift$12.$gift.getCode(), new StoreGifting.GiftState.Resolved(ModelGift.copy$default(this.this$0.this$0.$gift, 0, true, null, null, 0, null, 0, null, null, null, PointerIconCompat.TYPE_GRABBING, null)));
|
|
return;
|
|
default:
|
|
StoreGifting$acceptGift$1 storeGifting$acceptGift$13 = this.this$0.this$0;
|
|
StoreGifting storeGifting2 = storeGifting$acceptGift$13.this$0;
|
|
String code2 = storeGifting$acceptGift$13.$gift.getCode();
|
|
ModelGift modelGift2 = this.this$0.this$0.$gift;
|
|
Error.Response response2 = this.$error.getResponse();
|
|
m.checkNotNullExpressionValue(response2, "error.response");
|
|
StoreGifting.access$setGifts(storeGifting2, code2, new StoreGifting.GiftState.RedeemedFailed(modelGift2, false, Integer.valueOf(response2.getCode())));
|
|
return;
|
|
}
|
|
} else {
|
|
StoreGifting$acceptGift$1 storeGifting$acceptGift$14 = this.this$0.this$0;
|
|
StoreGifting.access$setGifts(storeGifting$acceptGift$14.this$0, storeGifting$acceptGift$14.$gift.getCode(), new StoreGifting.GiftState.RedeemedFailed(this.this$0.this$0.$gift, true, null));
|
|
}
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public AnonymousClass1(StoreGifting$acceptGift$1 storeGifting$acceptGift$1) {
|
|
super(1);
|
|
this.this$0 = storeGifting$acceptGift$1;
|
|
}
|
|
|
|
/* Return type fixed from 'java.lang.Object' to match base method */
|
|
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
|
|
@Override // kotlin.jvm.functions.Function1
|
|
public /* bridge */ /* synthetic */ Unit invoke(Error error) {
|
|
invoke(error);
|
|
return Unit.a;
|
|
}
|
|
|
|
public final void invoke(Error error) {
|
|
m.checkNotNullParameter(error, "error");
|
|
this.this$0.this$0.getDispatcher().schedule(new AnonymousClass1(this, error));
|
|
}
|
|
}
|
|
|
|
/* compiled from: StoreGifting.kt */
|
|
/* renamed from: com.discord.stores.StoreGifting$acceptGift$1$2 reason: invalid class name */
|
|
public static final class AnonymousClass2 extends o implements Function1<Void, Unit> {
|
|
public final /* synthetic */ StoreGifting$acceptGift$1 this$0;
|
|
|
|
/* compiled from: StoreGifting.kt */
|
|
/* renamed from: com.discord.stores.StoreGifting$acceptGift$1$2$1 reason: invalid class name */
|
|
public static final class AnonymousClass1 extends o implements Function0<Unit> {
|
|
public final /* synthetic */ AnonymousClass2 this$0;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public AnonymousClass1(AnonymousClass2 r1) {
|
|
super(0);
|
|
this.this$0 = r1;
|
|
}
|
|
|
|
@Override // kotlin.jvm.functions.Function0
|
|
/* renamed from: invoke */
|
|
public final void mo1invoke() {
|
|
StoreGifting$acceptGift$1 storeGifting$acceptGift$1 = this.this$0.this$0;
|
|
StoreGifting.access$setGifts(storeGifting$acceptGift$1.this$0, storeGifting$acceptGift$1.$gift.getCode(), new StoreGifting.GiftState.Resolved(ModelGift.copy$default(this.this$0.this$0.$gift, 0, true, null, null, 0, null, 0, null, null, null, PointerIconCompat.TYPE_GRABBING, null)));
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public AnonymousClass2(StoreGifting$acceptGift$1 storeGifting$acceptGift$1) {
|
|
super(1);
|
|
this.this$0 = storeGifting$acceptGift$1;
|
|
}
|
|
|
|
/* Return type fixed from 'java.lang.Object' to match base method */
|
|
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
|
|
@Override // kotlin.jvm.functions.Function1
|
|
public /* bridge */ /* synthetic */ Unit invoke(Void r1) {
|
|
invoke(r1);
|
|
return Unit.a;
|
|
}
|
|
|
|
public final void invoke(Void r2) {
|
|
this.this$0.this$0.getDispatcher().schedule(new AnonymousClass1(this));
|
|
StoreStream.Companion.getLibrary().fetchApplications();
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public StoreGifting$acceptGift$1(StoreGifting storeGifting, ModelGift modelGift) {
|
|
super(0);
|
|
this.this$0 = storeGifting;
|
|
this.$gift = modelGift;
|
|
}
|
|
|
|
@Override // kotlin.jvm.functions.Function0
|
|
/* renamed from: invoke */
|
|
public final void mo1invoke() {
|
|
StoreGifting.access$setGifts(this.this$0, this.$gift.getCode(), new StoreGifting.GiftState.Redeeming(this.$gift));
|
|
Observable<Void> X = RestAPI.Companion.getApi().acceptGift(this.$gift.getCode()).X(a.c());
|
|
m.checkNotNullExpressionValue(X, "RestAPI\n .api\n …scribeOn(Schedulers.io())");
|
|
ObservableExtensionsKt.appSubscribe$default(X, this.this$0.getClass(), (Context) null, (Function1) null, new AnonymousClass1(this), (Function0) null, (Function0) null, new AnonymousClass2(this), 54, (Object) null);
|
|
}
|
|
}
|