discord-jadx/app/src/main/java/b/a/a/z/c.java

597 lines
34 KiB
Java
Raw Normal View History

2021-12-17 22:01:24 +00:00
package b.a.a.z;
2021-07-24 02:37:17 +00:00
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
2021-12-17 22:01:24 +00:00
import b.a.i.i4;
import com.discord.R;
2021-07-24 02:37:17 +00:00
import com.discord.api.application.Application;
import com.discord.api.premium.SubscriptionPlan;
import com.discord.app.AppDialog;
import com.discord.app.AppViewFlipper;
import com.discord.models.domain.ModelGift;
import com.discord.models.domain.ModelSku;
import com.discord.models.domain.ModelStoreListing;
2021-11-25 09:11:30 +00:00
import com.discord.rlottie.RLottieImageView;
2021-07-24 02:37:17 +00:00
import com.discord.stores.StoreGifting;
import com.discord.stores.StoreNotices;
import com.discord.stores.StoreStream;
2021-11-25 09:11:30 +00:00
import com.discord.utilities.dimen.DimenUtils;
2021-07-24 02:37:17 +00:00
import com.discord.utilities.error.Error;
import com.discord.utilities.font.FontUtils;
2021-11-25 09:11:30 +00:00
import com.discord.utilities.gifting.GiftStyle;
import com.discord.utilities.gifting.GiftStyleKt;
2021-07-24 02:37:17 +00:00
import com.discord.utilities.icon.IconUtils;
import com.discord.utilities.images.MGImages;
import com.discord.utilities.premium.PremiumUtils;
import com.discord.utilities.resources.StringResourceUtilsKt;
import com.discord.utilities.rx.ObservableExtensionsKt;
import com.discord.utilities.view.text.LinkifiedTextView;
import com.discord.utilities.viewbinding.FragmentViewBindingDelegate;
import com.discord.utilities.viewbinding.FragmentViewBindingDelegateKt;
2021-11-25 09:11:30 +00:00
import com.discord.utilities.views.ViewCoroutineScopeKt;
2021-07-24 02:37:17 +00:00
import com.discord.widgets.home.WidgetHome;
import com.discord.widgets.settings.premium.WidgetSettingsGifting;
import com.facebook.drawee.view.SimpleDraweeView;
import com.google.android.material.button.MaterialButton;
2021-11-25 09:11:30 +00:00
import d0.l;
2021-11-01 07:19:03 +00:00
import d0.t.n;
import d0.z.d.a0;
import d0.z.d.k;
import d0.z.d.m;
import d0.z.d.o;
2021-07-24 02:37:17 +00:00
import java.util.Objects;
import kotlin.NoWhenBranchMatchedException;
import kotlin.Unit;
2021-11-25 09:11:30 +00:00
import kotlin.coroutines.Continuation;
2021-07-24 02:37:17 +00:00
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
2021-11-25 09:11:30 +00:00
import kotlin.jvm.functions.Function2;
2021-07-24 02:37:17 +00:00
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.reflect.KProperty;
2021-11-25 09:11:30 +00:00
import kotlinx.coroutines.CoroutineScope;
import rx.Observable;
import rx.functions.Func2;
2021-07-24 02:37:17 +00:00
/* compiled from: WidgetGiftAcceptDialog.kt */
public final class c extends AppDialog {
2021-12-17 22:01:24 +00:00
public static final /* synthetic */ KProperty[] j = {b.d.b.a.a.b0(c.class, "binding", "getBinding()Lcom/discord/databinding/WidgetAcceptGiftDialogBinding;", 0)};
public static final a k = new a(null);
public final FragmentViewBindingDelegate l = FragmentViewBindingDelegateKt.viewBinding$default(this, b.j, null, 2, null);
2021-07-24 02:37:17 +00:00
/* compiled from: WidgetGiftAcceptDialog.kt */
public static final class a {
/* compiled from: WidgetGiftAcceptDialog.kt */
2021-12-17 22:01:24 +00:00
/* renamed from: b.a.a.z.c$a$a reason: collision with other inner class name */
public static final class C0019a {
2021-11-25 09:11:30 +00:00
public final StoreGifting.GiftState a;
2021-12-17 22:01:24 +00:00
/* renamed from: b reason: collision with root package name */
public final boolean f50b;
public C0019a(StoreGifting.GiftState giftState, boolean z2) {
2021-11-25 09:11:30 +00:00
m.checkNotNullParameter(giftState, "giftState");
this.a = giftState;
2021-12-17 22:01:24 +00:00
this.f50b = z2;
2021-11-25 09:11:30 +00:00
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
2021-12-17 22:01:24 +00:00
if (!(obj instanceof C0019a)) {
2021-11-25 09:11:30 +00:00
return false;
}
2021-12-17 22:01:24 +00:00
C0019a aVar = (C0019a) obj;
return m.areEqual(this.a, aVar.a) && this.f50b == aVar.f50b;
2021-11-25 09:11:30 +00:00
}
public int hashCode() {
StoreGifting.GiftState giftState = this.a;
int hashCode = (giftState != null ? giftState.hashCode() : 0) * 31;
2021-12-17 22:01:24 +00:00
boolean z2 = this.f50b;
2021-11-25 09:11:30 +00:00
if (z2) {
z2 = true;
}
int i = z2 ? 1 : 0;
int i2 = z2 ? 1 : 0;
int i3 = z2 ? 1 : 0;
return hashCode + i;
}
public String toString() {
2021-12-17 22:01:24 +00:00
StringBuilder R = b.d.b.a.a.R("GiftUiState(giftState=");
2021-11-25 09:11:30 +00:00
R.append(this.a);
R.append(", reduceMotion=");
2022-01-17 16:29:36 +00:00
return b.d.b.a.a.M(R, this.f50b, ")");
2021-11-25 09:11:30 +00:00
}
}
/* compiled from: WidgetGiftAcceptDialog.kt */
public static final class b extends o implements Function1<FragmentActivity, Boolean> {
2021-07-24 02:37:17 +00:00
public final /* synthetic */ long $channelId;
public final /* synthetic */ String $giftCode;
public final /* synthetic */ String $source;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
2021-11-25 09:11:30 +00:00
public b(String str, String str2, long j) {
2021-07-24 02:37:17 +00:00
super(1);
this.$giftCode = str;
this.$source = str2;
this.$channelId = j;
}
/* 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 Boolean invoke(FragmentActivity fragmentActivity) {
FragmentActivity fragmentActivity2 = fragmentActivity;
m.checkNotNullParameter(fragmentActivity2, "appActivity");
StoreStream.Companion.getAnalytics().trackOpenGiftAcceptModal(this.$giftCode, this.$source, this.$channelId);
c cVar = new c();
Bundle bundle = new Bundle();
bundle.putString("ARG_GIFT_CODE", this.$giftCode);
cVar.setArguments(bundle);
FragmentManager supportFragmentManager = fragmentActivity2.getSupportFragmentManager();
m.checkNotNullExpressionValue(supportFragmentManager, "appActivity.supportFragmentManager");
cVar.show(supportFragmentManager, a0.getOrCreateKotlinClass(c.class).toString());
return Boolean.TRUE;
}
}
public a(DefaultConstructorMarker defaultConstructorMarker) {
}
public final void a(String str, String str2, long j) {
m.checkNotNullParameter(str, "giftCode");
m.checkNotNullParameter(str2, "source");
m.checkNotNullParameter(str, "giftCode");
2021-11-25 09:11:30 +00:00
StoreStream.Companion.getNotices().requestToShow(new StoreNotices.Notice("gift:" + str, null, 0, 0, false, n.listOf((Object[]) new d0.e0.c[]{a0.getOrCreateKotlinClass(WidgetSettingsGifting.class), a0.getOrCreateKotlinClass(WidgetHome.class)}), 0, false, 0, new b(str, str2, j), FontUtils.MAX_FONT_SCALING, null));
2021-07-24 02:37:17 +00:00
}
}
/* compiled from: WidgetGiftAcceptDialog.kt */
2021-12-17 22:01:24 +00:00
public static final /* synthetic */ class b extends k implements Function1<View, i4> {
public static final b j = new b();
2021-07-24 02:37:17 +00:00
public b() {
2021-12-17 22:01:24 +00:00
super(1, i4.class, "bind", "bind(Landroid/view/View;)Lcom/discord/databinding/WidgetAcceptGiftDialogBinding;", 0);
2021-07-24 02:37:17 +00:00
}
/* 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
2021-12-17 22:01:24 +00:00
public i4 invoke(View view) {
2021-07-24 02:37:17 +00:00
View view2 = view;
m.checkNotNullParameter(view2, "p1");
2021-12-17 22:01:24 +00:00
int i = R.id.accept_gift_body_container;
LinearLayout linearLayout = (LinearLayout) view2.findViewById(R.id.accept_gift_body_container);
2021-07-24 02:37:17 +00:00
if (linearLayout != null) {
2021-12-17 22:01:24 +00:00
i = R.id.accept_gift_body_image;
SimpleDraweeView simpleDraweeView = (SimpleDraweeView) view2.findViewById(R.id.accept_gift_body_image);
2021-07-24 02:37:17 +00:00
if (simpleDraweeView != null) {
2021-12-17 22:01:24 +00:00
i = R.id.accept_gift_body_lottie;
2021-11-25 09:11:30 +00:00
RLottieImageView rLottieImageView = (RLottieImageView) view2.findViewById(R.id.accept_gift_body_lottie);
if (rLottieImageView != null) {
2021-12-17 22:01:24 +00:00
i = R.id.accept_gift_body_text;
2021-11-25 09:11:30 +00:00
TextView textView = (TextView) view2.findViewById(R.id.accept_gift_body_text);
if (textView != null) {
2021-12-17 22:01:24 +00:00
i = R.id.accept_gift_confirm;
2021-11-25 09:11:30 +00:00
MaterialButton materialButton = (MaterialButton) view2.findViewById(R.id.accept_gift_confirm);
if (materialButton != null) {
2021-12-17 22:01:24 +00:00
i = R.id.accept_gift_disclaimer_container;
2021-11-25 09:11:30 +00:00
LinearLayout linearLayout2 = (LinearLayout) view2.findViewById(R.id.accept_gift_disclaimer_container);
if (linearLayout2 != null) {
2021-12-17 22:01:24 +00:00
i = R.id.accept_gift_disclaimer_text;
2021-11-25 09:11:30 +00:00
LinkifiedTextView linkifiedTextView = (LinkifiedTextView) view2.findViewById(R.id.accept_gift_disclaimer_text);
if (linkifiedTextView != null) {
2021-12-17 22:01:24 +00:00
i = R.id.accept_gift_flipper;
2021-11-25 09:11:30 +00:00
AppViewFlipper appViewFlipper = (AppViewFlipper) view2.findViewById(R.id.accept_gift_flipper);
if (appViewFlipper != null) {
2021-12-17 22:01:24 +00:00
i = R.id.accept_gift_header;
2021-11-25 09:11:30 +00:00
TextView textView2 = (TextView) view2.findViewById(R.id.accept_gift_header);
if (textView2 != null) {
2021-12-17 22:01:24 +00:00
i = R.id.accept_gift_progress;
2021-11-25 09:11:30 +00:00
ProgressBar progressBar = (ProgressBar) view2.findViewById(R.id.accept_gift_progress);
if (progressBar != null) {
2021-12-17 22:01:24 +00:00
return new i4((LinearLayout) view2, linearLayout, simpleDraweeView, rLottieImageView, textView, materialButton, linearLayout2, linkifiedTextView, appViewFlipper, textView2, progressBar);
2021-11-25 09:11:30 +00:00
}
2021-07-24 02:37:17 +00:00
}
}
}
}
}
}
}
}
}
2021-12-17 22:01:24 +00:00
throw new NullPointerException("Missing required view with ID: ".concat(view2.getResources().getResourceName(i)));
2021-07-24 02:37:17 +00:00
}
}
/* compiled from: WidgetGiftAcceptDialog.kt */
2021-11-25 09:11:30 +00:00
@d0.w.i.a.e(c = "com.discord.dialogs.gifting.WidgetGiftAcceptDialog$configureUI$1$1", f = "WidgetGiftAcceptDialog.kt", l = {117}, m = "invokeSuspend")
2021-12-17 22:01:24 +00:00
/* renamed from: b.a.a.z.c$c reason: collision with other inner class name */
public static final class C0020c extends d0.w.i.a.k implements Function2<CoroutineScope, Continuation<? super Unit>, Object> {
2021-11-25 09:11:30 +00:00
public final /* synthetic */ RLottieImageView $this_apply;
public int label;
2021-07-24 02:37:17 +00:00
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
2021-12-17 22:01:24 +00:00
public C0020c(RLottieImageView rLottieImageView, Continuation continuation) {
2021-11-25 09:11:30 +00:00
super(2, continuation);
this.$this_apply = rLottieImageView;
2021-07-24 02:37:17 +00:00
}
2021-11-25 09:11:30 +00:00
@Override // d0.w.i.a.a
public final Continuation<Unit> create(Object obj, Continuation<?> continuation) {
m.checkNotNullParameter(continuation, "completion");
2021-12-17 22:01:24 +00:00
return new C0020c(this.$this_apply, continuation);
2021-11-25 09:11:30 +00:00
}
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object, java.lang.Object] */
@Override // kotlin.jvm.functions.Function2
public final Object invoke(CoroutineScope coroutineScope, Continuation<? super Unit> continuation) {
Continuation<? super Unit> continuation2 = continuation;
m.checkNotNullParameter(continuation2, "completion");
2021-12-17 22:01:24 +00:00
return new C0020c(this.$this_apply, continuation2).invokeSuspend(Unit.a);
2021-11-25 09:11:30 +00:00
}
@Override // d0.w.i.a.a
public final Object invokeSuspend(Object obj) {
Object coroutine_suspended = d0.w.h.c.getCOROUTINE_SUSPENDED();
int i = this.label;
if (i == 0) {
l.throwOnFailure(obj);
this.label = 1;
2022-01-17 16:29:36 +00:00
if (b.i.a.f.e.o.f.P(200, this) == coroutine_suspended) {
2021-11-25 09:11:30 +00:00
return coroutine_suspended;
}
} else if (i == 1) {
l.throwOnFailure(obj);
} else {
throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
}
this.$this_apply.b();
2021-07-24 02:37:17 +00:00
return Unit.a;
}
}
/* compiled from: WidgetGiftAcceptDialog.kt */
2021-12-17 22:01:24 +00:00
public static final class d<T1, T2, R> implements Func2<StoreGifting.GiftState, Boolean, a.C0019a> {
public static final d j = new d();
2021-11-25 09:11:30 +00:00
/* 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, java.lang.Object] */
@Override // rx.functions.Func2
2021-12-17 22:01:24 +00:00
public a.C0019a call(StoreGifting.GiftState giftState, Boolean bool) {
2021-11-25 09:11:30 +00:00
StoreGifting.GiftState giftState2 = giftState;
Boolean bool2 = bool;
m.checkNotNullExpressionValue(giftState2, "giftState");
m.checkNotNullExpressionValue(bool2, "reduceMotion");
2021-12-17 22:01:24 +00:00
return new a.C0019a(giftState2, bool2.booleanValue());
2021-11-25 09:11:30 +00:00
}
}
/* compiled from: WidgetGiftAcceptDialog.kt */
2021-12-17 22:01:24 +00:00
public static final class e extends o implements Function1<a.C0019a, Unit> {
2021-07-24 02:37:17 +00:00
public final /* synthetic */ c this$0;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
2021-11-25 09:11:30 +00:00
public e(c cVar) {
2021-07-24 02:37:17 +00:00
super(1);
this.this$0 = cVar;
}
/* 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
2021-12-17 22:01:24 +00:00
public Unit invoke(a.C0019a aVar) {
2021-07-24 02:37:17 +00:00
ModelSku sku;
ModelSku sku2;
String str;
ModelSku sku3;
2021-12-17 22:01:24 +00:00
a.C0019a aVar2 = aVar;
2021-11-25 09:11:30 +00:00
StoreGifting.GiftState giftState = aVar2.a;
2021-07-24 02:37:17 +00:00
int i = 0;
2021-11-25 09:11:30 +00:00
if (giftState instanceof StoreGifting.GiftState.Loading) {
2021-07-24 02:37:17 +00:00
c cVar = this.this$0;
2021-12-17 22:01:24 +00:00
KProperty[] kPropertyArr = c.j;
2021-11-25 09:11:30 +00:00
AppViewFlipper appViewFlipper = cVar.h().h;
2021-07-24 02:37:17 +00:00
m.checkNotNullExpressionValue(appViewFlipper, "binding.acceptGiftFlipper");
appViewFlipper.setDisplayedChild(0);
} else {
CharSequence charSequence = null;
2021-11-25 09:11:30 +00:00
int i2 = 8;
if (giftState instanceof StoreGifting.GiftState.Resolved) {
StoreGifting.GiftState.Resolved resolved = (StoreGifting.GiftState.Resolved) giftState;
2021-07-24 02:37:17 +00:00
if (resolved.getGift().getRedeemed()) {
c cVar2 = this.this$0;
2021-11-25 09:11:30 +00:00
m.checkNotNullExpressionValue(aVar2, "giftUiState");
2021-12-17 22:01:24 +00:00
KProperty[] kPropertyArr2 = c.j;
2021-11-25 09:11:30 +00:00
Objects.requireNonNull(cVar2);
ModelGift gift = resolved.getGift();
cVar2.g(gift, aVar2);
2021-07-24 02:37:17 +00:00
ModelStoreListing storeListing = gift.getStoreListing();
if (storeListing == null || (sku3 = storeListing.getSku()) == null || (str = sku3.getName()) == null) {
str = "";
}
2021-11-25 09:11:30 +00:00
CharSequence i3 = cVar2.i(gift);
2021-12-17 22:01:24 +00:00
LinearLayout linearLayout = b.d.b.a.a.p0(b.d.b.a.a.p0(cVar2.h().i, "binding.acceptGiftHeader", gift.isAnyNitroGift() ? b.a.k.b.k(cVar2, R.string.gift_confirmation_header_success_nitro, new Object[]{str}, null, 4) : b.a.k.b.k(cVar2, R.string.gift_confirmation_header_success, new Object[0], null, 4), cVar2).d, "binding.acceptGiftBodyText", gift.isNitroClassicGift() ? b.a.k.b.k(cVar2, R.string.gift_confirmation_body_success_nitro_classic_mobile, new Object[]{i3}, null, 4) : gift.isNitroGift() ? b.a.k.b.k(cVar2, R.string.gift_confirmation_body_success_nitro_mobile, new Object[]{i3}, null, 4) : b.a.k.b.k(cVar2, R.string.gift_confirmation_body_success_mobile, new Object[]{str}, null, 4), cVar2).f;
2021-07-24 02:37:17 +00:00
m.checkNotNullExpressionValue(linearLayout, "binding.acceptGiftDisclaimerContainer");
linearLayout.setVisibility(8);
2021-11-25 09:11:30 +00:00
MaterialButton materialButton = cVar2.h().e;
2021-07-24 02:37:17 +00:00
m.checkNotNullExpressionValue(materialButton, "binding.acceptGiftConfirm");
Context context = cVar2.getContext();
if (context != null) {
charSequence = context.getText(R.string.gift_confirmation_button_success_mobile);
2021-07-24 02:37:17 +00:00
}
materialButton.setText(charSequence);
2021-11-25 09:11:30 +00:00
cVar2.h().e.setOnClickListener(new d(cVar2));
2021-07-24 02:37:17 +00:00
} else if (resolved.getGift().getMaxUses() == resolved.getGift().getUses()) {
c cVar3 = this.this$0;
2021-11-25 09:11:30 +00:00
m.checkNotNullExpressionValue(aVar2, "giftUiState");
2021-12-17 22:01:24 +00:00
KProperty[] kPropertyArr3 = c.j;
2021-11-25 09:11:30 +00:00
Objects.requireNonNull(cVar3);
cVar3.g(resolved.getGift(), aVar2);
TextView textView = cVar3.h().i;
2021-07-24 02:37:17 +00:00
m.checkNotNullExpressionValue(textView, "binding.acceptGiftHeader");
2021-12-17 22:01:24 +00:00
b.a.k.b.n(textView, R.string.gift_confirmation_header_fail, new Object[0], null, 4);
2021-11-25 09:11:30 +00:00
TextView textView2 = cVar3.h().d;
2021-07-24 02:37:17 +00:00
m.checkNotNullExpressionValue(textView2, "binding.acceptGiftBodyText");
2021-12-17 22:01:24 +00:00
b.a.k.b.n(textView2, R.string.gift_confirmation_body_claimed, new Object[0], null, 4);
2021-11-25 09:11:30 +00:00
LinearLayout linearLayout2 = cVar3.h().f;
2021-07-24 02:37:17 +00:00
m.checkNotNullExpressionValue(linearLayout2, "binding.acceptGiftDisclaimerContainer");
linearLayout2.setVisibility(8);
2021-11-25 09:11:30 +00:00
MaterialButton materialButton2 = cVar3.h().e;
2021-07-24 02:37:17 +00:00
m.checkNotNullExpressionValue(materialButton2, "binding.acceptGiftConfirm");
2021-12-17 22:01:24 +00:00
b.a.k.b.n(materialButton2, R.string.gift_confirmation_button_fail, new Object[0], null, 4);
2021-11-25 09:11:30 +00:00
cVar3.h().e.setOnClickListener(new e(cVar3));
2021-07-24 02:37:17 +00:00
} else {
c cVar4 = this.this$0;
2021-11-25 09:11:30 +00:00
m.checkNotNullExpressionValue(aVar2, "giftUiState");
2021-12-17 22:01:24 +00:00
KProperty[] kPropertyArr4 = c.j;
2021-11-25 09:11:30 +00:00
Objects.requireNonNull(cVar4);
ModelGift gift2 = ((StoreGifting.HasGift) giftState).getGift();
cVar4.g(gift2, aVar2);
ModelStoreListing storeListing2 = gift2.getStoreListing();
2021-07-24 02:37:17 +00:00
String name = (storeListing2 == null || (sku2 = storeListing2.getSku()) == null) ? null : sku2.getName();
2021-12-17 22:01:24 +00:00
LinearLayout linearLayout3 = b.d.b.a.a.p0(b.d.b.a.a.p0(cVar4.h().i, "binding.acceptGiftHeader", gift2.isAnyNitroGift() ? b.a.k.b.k(cVar4, R.string.gift_confirmation_header_confirm_nitro, new Object[]{name}, null, 4) : b.a.k.b.k(cVar4, R.string.gift_confirmation_header_confirm, new Object[0], null, 4), cVar4).d, "binding.acceptGiftBodyText", gift2.isAnyNitroGift() ? b.a.k.b.k(cVar4, R.string.gift_confirmation_body_confirm_nitro, new Object[]{name, cVar4.i(gift2)}, null, 4) : b.a.k.b.k(cVar4, R.string.gift_confirmation_body_confirm, new Object[]{name}, null, 4), cVar4).f;
2021-07-24 02:37:17 +00:00
m.checkNotNullExpressionValue(linearLayout3, "binding.acceptGiftDisclaimerContainer");
2021-11-25 09:11:30 +00:00
if (gift2.isAnyNitroGift()) {
i2 = 0;
2021-07-24 02:37:17 +00:00
}
2021-11-25 09:11:30 +00:00
linearLayout3.setVisibility(i2);
MaterialButton materialButton3 = cVar4.h().e;
2021-07-24 02:37:17 +00:00
m.checkNotNullExpressionValue(materialButton3, "binding.acceptGiftConfirm");
2021-12-17 22:01:24 +00:00
b.a.k.b.n(materialButton3, R.string.gift_confirmation_button_confirm_mobile, new Object[0], null, 4);
2021-11-25 09:11:30 +00:00
cVar4.h().e.setOnClickListener(new f(gift2));
2021-07-24 02:37:17 +00:00
}
2021-11-25 09:11:30 +00:00
} else if (giftState instanceof StoreGifting.GiftState.Redeeming) {
2021-07-24 02:37:17 +00:00
c cVar5 = this.this$0;
2021-11-25 09:11:30 +00:00
m.checkNotNullExpressionValue(aVar2, "giftUiState");
2021-12-17 22:01:24 +00:00
KProperty[] kPropertyArr5 = c.j;
2021-11-25 09:11:30 +00:00
Objects.requireNonNull(cVar5);
ModelGift gift3 = ((StoreGifting.GiftState.Redeeming) giftState).getGift();
cVar5.g(gift3, aVar2);
ModelStoreListing storeListing3 = gift3.getStoreListing();
2021-07-24 02:37:17 +00:00
String name2 = (storeListing3 == null || (sku = storeListing3.getSku()) == null) ? null : sku.getName();
2021-11-25 09:11:30 +00:00
MaterialButton materialButton4 = cVar5.h().e;
2021-07-24 02:37:17 +00:00
m.checkNotNullExpressionValue(materialButton4, "binding.acceptGiftConfirm");
materialButton4.setVisibility(8);
2021-11-25 09:11:30 +00:00
ProgressBar progressBar = cVar5.h().j;
2021-07-24 02:37:17 +00:00
m.checkNotNullExpressionValue(progressBar, "binding.acceptGiftProgress");
progressBar.setVisibility(0);
2021-12-17 22:01:24 +00:00
LinearLayout linearLayout4 = b.d.b.a.a.p0(b.d.b.a.a.p0(cVar5.h().i, "binding.acceptGiftHeader", gift3.isAnyNitroGift() ? b.a.k.b.k(cVar5, R.string.gift_confirmation_header_confirm_nitro, new Object[]{name2}, null, 4) : b.a.k.b.k(cVar5, R.string.gift_confirmation_header_confirm, new Object[0], null, 4), cVar5).d, "binding.acceptGiftBodyText", gift3.isAnyNitroGift() ? b.a.k.b.k(cVar5, R.string.gift_confirmation_body_confirm_nitro, new Object[]{name2, cVar5.i(gift3)}, null, 4) : b.a.k.b.k(cVar5, R.string.gift_confirmation_body_confirm, new Object[]{name2}, null, 4), cVar5).f;
2021-07-24 02:37:17 +00:00
m.checkNotNullExpressionValue(linearLayout4, "binding.acceptGiftDisclaimerContainer");
2021-11-25 09:11:30 +00:00
if (!gift3.isAnyNitroGift()) {
2021-07-24 02:37:17 +00:00
i = 8;
}
linearLayout4.setVisibility(i);
2021-11-25 09:11:30 +00:00
} else if (giftState instanceof StoreGifting.GiftState.RedeemedFailed) {
2021-07-24 02:37:17 +00:00
c cVar6 = this.this$0;
2021-11-25 09:11:30 +00:00
StoreGifting.GiftState.RedeemedFailed redeemedFailed = (StoreGifting.GiftState.RedeemedFailed) giftState;
m.checkNotNullExpressionValue(aVar2, "giftUiState");
2021-12-17 22:01:24 +00:00
KProperty[] kPropertyArr6 = c.j;
2021-07-24 02:37:17 +00:00
Objects.requireNonNull(cVar6);
2021-11-25 09:11:30 +00:00
cVar6.g(redeemedFailed.getGift(), aVar2);
TextView textView3 = cVar6.h().i;
2021-07-24 02:37:17 +00:00
m.checkNotNullExpressionValue(textView3, "binding.acceptGiftHeader");
2021-12-17 22:01:24 +00:00
textView3.setText(b.a.k.b.k(cVar6, R.string.gift_confirmation_header_fail, new Object[0], null, 4));
2021-11-25 09:11:30 +00:00
TextView textView4 = cVar6.h().d;
2021-07-24 02:37:17 +00:00
m.checkNotNullExpressionValue(textView4, "binding.acceptGiftBodyText");
2021-12-17 22:01:24 +00:00
b.a.k.b.n(textView4, R.string.gift_confirmation_body_unknown_error, new Object[0], null, 4);
2021-07-24 02:37:17 +00:00
if (redeemedFailed.getCanRetry()) {
2021-11-25 09:11:30 +00:00
TextView textView5 = cVar6.h().d;
2021-07-24 02:37:17 +00:00
m.checkNotNullExpressionValue(textView5, "binding.acceptGiftBodyText");
2021-12-17 22:01:24 +00:00
b.a.k.b.n(textView5, R.string.gift_confirmation_body_unknown_error, new Object[0], null, 4);
2021-11-25 09:11:30 +00:00
MaterialButton materialButton5 = cVar6.h().e;
2021-07-24 02:37:17 +00:00
m.checkNotNullExpressionValue(materialButton5, "binding.acceptGiftConfirm");
2021-11-25 09:11:30 +00:00
Context context2 = cVar6.getContext();
if (context2 != null) {
charSequence = context2.getText(R.string.retry);
2021-07-24 02:37:17 +00:00
}
materialButton5.setText(charSequence);
2021-11-25 09:11:30 +00:00
cVar6.h().e.setOnClickListener(new g(0, redeemedFailed));
2021-07-24 02:37:17 +00:00
} else {
Integer errorCode = redeemedFailed.getErrorCode();
if (errorCode != null && errorCode.intValue() == 50054) {
2021-11-25 09:11:30 +00:00
cVar6.h().d.setText(R.string.gift_confirmation_body_self_gift_no_payment);
2021-07-24 02:37:17 +00:00
} else if (errorCode != null && errorCode.intValue() == 100024) {
2021-11-25 09:11:30 +00:00
cVar6.h().d.setText(R.string.gift_confirmation_body_error_nitro_upgrade_downgrade);
2021-07-24 02:37:17 +00:00
} else if (errorCode != null && errorCode.intValue() == 100022) {
2021-11-25 09:11:30 +00:00
cVar6.h().d.setText(R.string.gift_confirmation_body_error_subscription_managed);
2021-07-24 02:37:17 +00:00
} else if (errorCode != null && errorCode.intValue() == 100025) {
2021-11-25 09:11:30 +00:00
cVar6.h().d.setText(R.string.gift_confirmation_body_error_invoice_open);
2021-07-24 02:37:17 +00:00
}
2021-11-25 09:11:30 +00:00
MaterialButton materialButton6 = cVar6.h().e;
2021-07-24 02:37:17 +00:00
m.checkNotNullExpressionValue(materialButton6, "binding.acceptGiftConfirm");
2021-11-25 09:11:30 +00:00
Context context3 = cVar6.getContext();
if (context3 != null) {
charSequence = context3.getText(R.string.gift_confirmation_button_fail);
2021-07-24 02:37:17 +00:00
}
materialButton6.setText(charSequence);
2021-11-25 09:11:30 +00:00
cVar6.h().e.setOnClickListener(new g(1, cVar6));
2021-07-24 02:37:17 +00:00
}
2021-11-25 09:11:30 +00:00
} else if ((giftState instanceof StoreGifting.GiftState.Invalid) || (giftState instanceof StoreGifting.GiftState.LoadFailed) || (giftState instanceof StoreGifting.GiftState.Revoking)) {
2021-07-24 02:37:17 +00:00
this.this$0.dismiss();
}
}
return Unit.a;
}
}
2021-11-25 09:11:30 +00:00
/* compiled from: WidgetGiftAcceptDialog.kt */
public static final class f extends o implements Function1<Error, Unit> {
public final /* synthetic */ c this$0;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public f(c cVar) {
super(1);
this.this$0 = cVar;
}
/* 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 Unit invoke(Error error) {
m.checkNotNullParameter(error, "it");
this.this$0.dismiss();
return Unit.a;
}
}
2021-07-24 02:37:17 +00:00
public c() {
super(R.layout.widget_accept_gift_dialog);
2021-07-24 02:37:17 +00:00
}
2021-12-17 22:01:24 +00:00
public final void g(ModelGift modelGift, a.C0019a aVar) {
2021-07-24 02:37:17 +00:00
ModelSku sku;
Application application;
2021-11-25 09:11:30 +00:00
String f2;
2021-07-24 02:37:17 +00:00
ModelSku sku2;
2021-11-25 09:11:30 +00:00
AppViewFlipper appViewFlipper = h().h;
2021-07-24 02:37:17 +00:00
m.checkNotNullExpressionValue(appViewFlipper, "binding.acceptGiftFlipper");
appViewFlipper.setDisplayedChild(1);
2021-11-25 09:11:30 +00:00
String str = null;
2021-07-24 02:37:17 +00:00
if (modelGift.isAnyNitroGift()) {
2021-11-25 09:11:30 +00:00
GiftStyle customStyle = GiftStyleKt.getCustomStyle(modelGift);
if (customStyle != null) {
2021-12-17 22:01:24 +00:00
RLottieImageView rLottieImageView = h().c;
2021-11-25 09:11:30 +00:00
m.checkNotNullExpressionValue(rLottieImageView, "binding.acceptGiftBodyLottie");
rLottieImageView.setVisibility(0);
2022-01-27 08:54:45 +00:00
SimpleDraweeView simpleDraweeView = h().f131b;
2021-11-25 09:11:30 +00:00
m.checkNotNullExpressionValue(simpleDraweeView, "binding.acceptGiftBodyImage");
simpleDraweeView.setVisibility(8);
2021-12-17 22:01:24 +00:00
RLottieImageView rLottieImageView2 = h().c;
if (aVar.f50b) {
2021-11-25 09:11:30 +00:00
rLottieImageView2.setImageResource(customStyle.getStaticRes());
} else {
int animRes = customStyle.getAnimRes();
2021-12-17 22:01:24 +00:00
RLottieImageView rLottieImageView3 = h().c;
2021-11-25 09:11:30 +00:00
m.checkNotNullExpressionValue(rLottieImageView3, "binding.acceptGiftBodyLottie");
int dpToPixels = DimenUtils.dpToPixels(rLottieImageView3.getLayoutParams().width);
2021-12-17 22:01:24 +00:00
RLottieImageView rLottieImageView4 = h().c;
2021-11-25 09:11:30 +00:00
m.checkNotNullExpressionValue(rLottieImageView4, "binding.acceptGiftBodyLottie");
rLottieImageView2.c(animRes, dpToPixels, DimenUtils.dpToPixels(rLottieImageView4.getLayoutParams().height));
CoroutineScope coroutineScope = ViewCoroutineScopeKt.getCoroutineScope(rLottieImageView2);
if (coroutineScope != null) {
2022-01-17 16:29:36 +00:00
b.i.a.f.e.o.f.H0(coroutineScope, null, null, new C0020c(rLottieImageView2, null), 3, null);
2021-11-25 09:11:30 +00:00
}
}
m.checkNotNullExpressionValue(rLottieImageView2, "binding.acceptGiftBodyLo… }\n }\n }");
} else {
MGImages mGImages = MGImages.INSTANCE;
2022-01-27 08:54:45 +00:00
SimpleDraweeView simpleDraweeView2 = h().f131b;
2021-11-25 09:11:30 +00:00
m.checkNotNullExpressionValue(simpleDraweeView2, "binding.acceptGiftBodyImage");
MGImages.setImage$default(mGImages, simpleDraweeView2, PremiumUtils.INSTANCE.getNitroGiftIcon(modelGift), (MGImages.ChangeDetector) null, 4, (Object) null);
}
2021-07-24 02:37:17 +00:00
} else {
ModelStoreListing storeListing = modelGift.getStoreListing();
2021-11-25 09:11:30 +00:00
if (!(storeListing == null || (sku = storeListing.getSku()) == null || (application = sku.getApplication()) == null || (f2 = application.f()) == null)) {
2021-07-24 02:37:17 +00:00
ModelStoreListing storeListing2 = modelGift.getStoreListing();
2021-12-17 22:01:24 +00:00
str = IconUtils.getApplicationIcon$default((storeListing2 == null || (sku2 = storeListing2.getSku()) == null) ? 0 : sku2.getApplicationId(), f2, 0, 4, (Object) null);
2021-07-24 02:37:17 +00:00
}
2022-01-27 08:54:45 +00:00
h().f131b.setImageURI(str);
2021-07-24 02:37:17 +00:00
}
2021-11-25 09:11:30 +00:00
MaterialButton materialButton = h().e;
2021-07-24 02:37:17 +00:00
m.checkNotNullExpressionValue(materialButton, "binding.acceptGiftConfirm");
materialButton.setVisibility(0);
2021-11-25 09:11:30 +00:00
ProgressBar progressBar = h().j;
2021-07-24 02:37:17 +00:00
m.checkNotNullExpressionValue(progressBar, "binding.acceptGiftProgress");
progressBar.setVisibility(8);
}
2021-12-17 22:01:24 +00:00
public final i4 h() {
return (i4) this.l.getValue((Fragment) this, j[0]);
2021-07-24 02:37:17 +00:00
}
public final CharSequence i(ModelGift modelGift) {
2021-12-17 22:01:24 +00:00
int i;
2021-07-24 02:37:17 +00:00
SubscriptionPlan subscriptionPlan = modelGift.getSubscriptionPlan();
if (subscriptionPlan == null) {
return "";
}
int ordinal = subscriptionPlan.b().ordinal();
if (ordinal == 0) {
2021-12-17 22:01:24 +00:00
i = R.plurals.gift_confirmation_nitro_time_frame_months_time;
2021-07-24 02:37:17 +00:00
} else if (ordinal == 1) {
2021-12-17 22:01:24 +00:00
i = R.plurals.gift_confirmation_nitro_time_frame_years_time;
2021-07-24 02:37:17 +00:00
} else {
throw new NoWhenBranchMatchedException();
}
Context requireContext = requireContext();
m.checkNotNullExpressionValue(requireContext, "requireContext()");
2021-12-17 22:01:24 +00:00
CharSequence i18nPluralString = StringResourceUtilsKt.getI18nPluralString(requireContext, i, subscriptionPlan.c(), Integer.valueOf(subscriptionPlan.c()));
2021-07-24 02:37:17 +00:00
int ordinal2 = subscriptionPlan.b().ordinal();
if (ordinal2 == 0) {
2021-12-17 22:01:24 +00:00
return b.a.k.b.k(this, R.string.gift_confirmation_nitro_time_frame_months, new Object[]{i18nPluralString}, null, 4);
2021-07-24 02:37:17 +00:00
}
if (ordinal2 == 1) {
2021-12-17 22:01:24 +00:00
return b.a.k.b.k(this, R.string.gift_confirmation_nitro_time_frame_years, new Object[]{i18nPluralString}, null, 4);
2021-07-24 02:37:17 +00:00
}
throw new NoWhenBranchMatchedException();
}
@Override // androidx.fragment.app.Fragment
public void onDestroy() {
String string;
Bundle arguments = getArguments();
if (!(arguments == null || (string = arguments.getString("ARG_GIFT_CODE")) == null)) {
2021-12-17 22:01:24 +00:00
a aVar = k;
2021-07-24 02:37:17 +00:00
m.checkNotNullExpressionValue(string, "it");
Objects.requireNonNull(aVar);
m.checkNotNullParameter(string, "giftCode");
String str = "gift:" + string;
if (str != null) {
StoreStream.Companion.getNotices().markDialogSeen(str);
}
}
super.onDestroy();
}
@Override // com.discord.app.AppDialog
public void onViewBound(View view) {
m.checkNotNullParameter(view, "view");
super.onViewBound(view);
Bundle arguments = getArguments();
String string = arguments != null ? arguments.getString("ARG_GIFT_CODE") : null;
if (string == null) {
dismiss();
return;
}
2021-11-25 09:11:30 +00:00
LinkifiedTextView linkifiedTextView = h().g;
2021-07-24 02:37:17 +00:00
m.checkNotNullExpressionValue(linkifiedTextView, "binding.acceptGiftDisclaimerText");
2021-12-17 22:01:24 +00:00
b.a.k.b.n(linkifiedTextView, R.string.gift_confirmation_body_confirm_nitro_disclaimer, new Object[]{b.a.d.f.a.a(360055386693L, null)}, null, 4);
2021-11-25 09:11:30 +00:00
StoreStream.Companion companion = StoreStream.Companion;
2021-12-17 22:01:24 +00:00
Observable j2 = Observable.j(companion.getGifting().requestGift(string), companion.getAccessibility().observeReducedMotionEnabled(), d.j);
2021-11-25 09:11:30 +00:00
m.checkNotNullExpressionValue(j2, "Observable.combineLatest…iftState, reduceMotion) }");
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(j2, this, null, 2, null), c.class, (Context) null, (Function1) null, new f(this), (Function0) null, (Function0) null, new e(this), 54, (Object) null);
2021-07-24 02:37:17 +00:00
}
}