1539 lines
72 KiB
Java
1539 lines
72 KiB
Java
package com.discord.widgets.settings.premium;
|
|
|
|
import a0.a.a.b;
|
|
import android.content.Context;
|
|
import androidx.annotation.MainThread;
|
|
import androidx.annotation.StringRes;
|
|
import c.d.b.a.a;
|
|
import com.discord.api.premium.ClaimedOutboundPromotion;
|
|
import com.discord.api.premium.OutboundPromotion;
|
|
import com.discord.app.AppComponent;
|
|
import com.discord.app.AppViewModel;
|
|
import com.discord.models.domain.ModelEntitlement;
|
|
import com.discord.models.domain.ModelGift;
|
|
import com.discord.stores.StoreEntitlements;
|
|
import com.discord.stores.StoreGifting;
|
|
import com.discord.stores.StoreGooglePlayPurchases;
|
|
import com.discord.stores.StoreOutboundPromotions;
|
|
import com.discord.stores.StoreStream;
|
|
import com.discord.stores.StoreUser;
|
|
import com.discord.stores.StoreUserSettingsSystem;
|
|
import com.discord.utilities.billing.GooglePlayBillingManager;
|
|
import com.discord.utilities.rx.ObservableExtensionsKt;
|
|
import com.discord.widgets.settings.premium.ClaimStatus;
|
|
import d0.t.h0;
|
|
import d0.t.n;
|
|
import d0.t.n0;
|
|
import d0.t.o;
|
|
import d0.t.u;
|
|
import d0.z.d.k;
|
|
import d0.z.d.m;
|
|
import java.util.ArrayList;
|
|
import java.util.LinkedHashMap;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Set;
|
|
import java.util.concurrent.atomic.AtomicBoolean;
|
|
import kotlin.NoWhenBranchMatchedException;
|
|
import kotlin.Unit;
|
|
import kotlin.jvm.functions.Function0;
|
|
import kotlin.jvm.functions.Function1;
|
|
import kotlin.jvm.functions.Function2;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
import rx.Observable;
|
|
import rx.functions.Action1;
|
|
import rx.functions.Func4;
|
|
import rx.subjects.BehaviorSubject;
|
|
import rx.subjects.PublishSubject;
|
|
import rx.subscriptions.CompositeSubscription;
|
|
/* compiled from: SettingsGiftingViewModel.kt */
|
|
public final class SettingsGiftingViewModel extends AppViewModel<ViewState> {
|
|
public static final Companion Companion = new Companion(null);
|
|
private final BehaviorSubject<List<ClaimedOutboundPromotion>> claimedPromotionsSubject;
|
|
private final PublishSubject<Event> eventSubject;
|
|
private final PublishSubject<GiftPurchaseEvent> giftPurchaseEventSubject;
|
|
private Function1<? super String, Unit> onGiftCodeResolved;
|
|
private AtomicBoolean shouldCheckClaimedPromos;
|
|
private final StoreEntitlements storeEntitlements;
|
|
private final StoreGifting storeGifting;
|
|
private final StoreOutboundPromotions storeOutboundPromotions;
|
|
private final BehaviorSubject<StoreState> storeStateSubject;
|
|
private final StoreUserSettingsSystem storeUserSettingsSystem;
|
|
private final CompositeSubscription subscriptions;
|
|
|
|
/* compiled from: SettingsGiftingViewModel.kt */
|
|
/* renamed from: com.discord.widgets.settings.premium.SettingsGiftingViewModel$1 reason: invalid class name */
|
|
public static final /* synthetic */ class AnonymousClass1 extends k implements Function1<StoreGooglePlayPurchases.Event, Unit> {
|
|
public AnonymousClass1(SettingsGiftingViewModel settingsGiftingViewModel) {
|
|
super(1, settingsGiftingViewModel, SettingsGiftingViewModel.class, "handleGooglePlayPurchaseEvent", "handleGooglePlayPurchaseEvent(Lcom/discord/stores/StoreGooglePlayPurchases$Event;)V", 0);
|
|
}
|
|
|
|
/* 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(StoreGooglePlayPurchases.Event event) {
|
|
invoke(event);
|
|
return Unit.a;
|
|
}
|
|
|
|
public final void invoke(StoreGooglePlayPurchases.Event event) {
|
|
m.checkNotNullParameter(event, "p1");
|
|
SettingsGiftingViewModel.access$handleGooglePlayPurchaseEvent((SettingsGiftingViewModel) this.receiver, event);
|
|
}
|
|
}
|
|
|
|
/* compiled from: SettingsGiftingViewModel.kt */
|
|
/* renamed from: com.discord.widgets.settings.premium.SettingsGiftingViewModel$2 reason: invalid class name */
|
|
public static final /* synthetic */ class AnonymousClass2 extends k implements Function1<StoreGooglePlayPurchases.QueryState, Unit> {
|
|
public AnonymousClass2(SettingsGiftingViewModel settingsGiftingViewModel) {
|
|
super(1, settingsGiftingViewModel, SettingsGiftingViewModel.class, "handleGooglePlayQueryStateUpdate", "handleGooglePlayQueryStateUpdate(Lcom/discord/stores/StoreGooglePlayPurchases$QueryState;)V", 0);
|
|
}
|
|
|
|
/* 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(StoreGooglePlayPurchases.QueryState queryState) {
|
|
invoke(queryState);
|
|
return Unit.a;
|
|
}
|
|
|
|
public final void invoke(StoreGooglePlayPurchases.QueryState queryState) {
|
|
m.checkNotNullParameter(queryState, "p1");
|
|
SettingsGiftingViewModel.access$handleGooglePlayQueryStateUpdate((SettingsGiftingViewModel) this.receiver, queryState);
|
|
}
|
|
}
|
|
|
|
/* compiled from: SettingsGiftingViewModel.kt */
|
|
/* renamed from: com.discord.widgets.settings.premium.SettingsGiftingViewModel$3 reason: invalid class name */
|
|
public static final class AnonymousClass3<T> implements Action1<StoreState> {
|
|
public final /* synthetic */ SettingsGiftingViewModel this$0;
|
|
|
|
public AnonymousClass3(SettingsGiftingViewModel settingsGiftingViewModel) {
|
|
this.this$0 = settingsGiftingViewModel;
|
|
}
|
|
|
|
public final void call(StoreState storeState) {
|
|
SettingsGiftingViewModel.access$maybeCheckClaimedPromos(this.this$0, storeState.isUserPremium());
|
|
}
|
|
}
|
|
|
|
/* compiled from: SettingsGiftingViewModel.kt */
|
|
/* renamed from: com.discord.widgets.settings.premium.SettingsGiftingViewModel$4 reason: invalid class name */
|
|
public static final /* synthetic */ class AnonymousClass4 extends k implements Function1<StoreState, Unit> {
|
|
public AnonymousClass4(BehaviorSubject behaviorSubject) {
|
|
super(1, behaviorSubject, BehaviorSubject.class, "onNext", "onNext(Ljava/lang/Object;)V", 0);
|
|
}
|
|
|
|
/* 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(StoreState storeState) {
|
|
invoke(storeState);
|
|
return Unit.a;
|
|
}
|
|
|
|
public final void invoke(StoreState storeState) {
|
|
((BehaviorSubject) this.receiver).onNext(storeState);
|
|
}
|
|
}
|
|
|
|
/* compiled from: SettingsGiftingViewModel.kt */
|
|
/* renamed from: com.discord.widgets.settings.premium.SettingsGiftingViewModel$5 reason: invalid class name */
|
|
public static final /* synthetic */ class AnonymousClass5 extends k implements Function2<StoreState, List<? extends ClaimedOutboundPromotion>, GiftAndPromoData> {
|
|
public AnonymousClass5(SettingsGiftingViewModel settingsGiftingViewModel) {
|
|
super(2, settingsGiftingViewModel, SettingsGiftingViewModel.class, "combineData", "combineData(Lcom/discord/widgets/settings/premium/SettingsGiftingViewModel$StoreState;Ljava/util/List;)Lcom/discord/widgets/settings/premium/SettingsGiftingViewModel$GiftAndPromoData;", 0);
|
|
}
|
|
|
|
public final GiftAndPromoData invoke(StoreState storeState, List<ClaimedOutboundPromotion> list) {
|
|
m.checkNotNullParameter(storeState, "p1");
|
|
m.checkNotNullParameter(list, "p2");
|
|
return SettingsGiftingViewModel.access$combineData((SettingsGiftingViewModel) this.receiver, storeState, list);
|
|
}
|
|
|
|
/* 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 // kotlin.jvm.functions.Function2
|
|
public /* bridge */ /* synthetic */ GiftAndPromoData invoke(StoreState storeState, List<? extends ClaimedOutboundPromotion> list) {
|
|
return invoke(storeState, (List<ClaimedOutboundPromotion>) list);
|
|
}
|
|
}
|
|
|
|
/* compiled from: SettingsGiftingViewModel.kt */
|
|
/* renamed from: com.discord.widgets.settings.premium.SettingsGiftingViewModel$6 reason: invalid class name */
|
|
public static final /* synthetic */ class AnonymousClass6 extends k implements Function1<GiftAndPromoData, Unit> {
|
|
public AnonymousClass6(SettingsGiftingViewModel settingsGiftingViewModel) {
|
|
super(1, settingsGiftingViewModel, SettingsGiftingViewModel.class, "handleAsyncData", "handleAsyncData(Lcom/discord/widgets/settings/premium/SettingsGiftingViewModel$GiftAndPromoData;)V", 0);
|
|
}
|
|
|
|
/* 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(GiftAndPromoData giftAndPromoData) {
|
|
invoke(giftAndPromoData);
|
|
return Unit.a;
|
|
}
|
|
|
|
public final void invoke(GiftAndPromoData giftAndPromoData) {
|
|
m.checkNotNullParameter(giftAndPromoData, "p1");
|
|
SettingsGiftingViewModel.access$handleAsyncData((SettingsGiftingViewModel) this.receiver, giftAndPromoData);
|
|
}
|
|
}
|
|
|
|
/* compiled from: SettingsGiftingViewModel.kt */
|
|
public static final class Companion {
|
|
private Companion() {
|
|
}
|
|
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
|
|
public static final /* synthetic */ Observable access$observeStores(Companion companion) {
|
|
return companion.observeStores();
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
/* JADX DEBUG: Type inference failed for r2v2. Raw type applied. Possible types: rx.Observable<R>, rx.Observable */
|
|
/* JADX WARNING: Unknown variable types count: 1 */
|
|
private final Observable<StoreState> observeStores() {
|
|
StoreStream.Companion companion = StoreStream.Companion;
|
|
Observable<StoreEntitlements.State> observeEntitlementState = companion.getEntitlements().observeEntitlementState();
|
|
Observable Y = companion.getUsers().observeMeId().Y(SettingsGiftingViewModel$Companion$observeStores$1.INSTANCE);
|
|
Observable<StoreOutboundPromotions.State> observeState = companion.getOutboundPromotions().observeState();
|
|
Observable F = StoreUser.observeMe$default(companion.getUsers(), false, 1, null).F(SettingsGiftingViewModel$Companion$observeStores$2.INSTANCE);
|
|
SettingsGiftingViewModel$Companion$observeStores$3 settingsGiftingViewModel$Companion$observeStores$3 = SettingsGiftingViewModel$Companion$observeStores$3.INSTANCE;
|
|
if (settingsGiftingViewModel$Companion$observeStores$3 != null) {
|
|
settingsGiftingViewModel$Companion$observeStores$3 = new SettingsGiftingViewModel$sam$rx_functions_Func4$0(settingsGiftingViewModel$Companion$observeStores$3);
|
|
}
|
|
Observable<StoreState> r = Observable.h(observeEntitlementState, Y, observeState, F, (Func4) settingsGiftingViewModel$Companion$observeStores$3).r();
|
|
m.checkNotNullExpressionValue(r, "Observable\n .co… .distinctUntilChanged()");
|
|
return r;
|
|
}
|
|
}
|
|
|
|
/* compiled from: SettingsGiftingViewModel.kt */
|
|
public static abstract class Event {
|
|
|
|
/* compiled from: SettingsGiftingViewModel.kt */
|
|
public static final class ShowPromoBottomSheet extends Event {
|
|
private final String content;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public ShowPromoBottomSheet(String str) {
|
|
super(null);
|
|
m.checkNotNullParameter(str, "content");
|
|
this.content = str;
|
|
}
|
|
|
|
public static /* synthetic */ ShowPromoBottomSheet copy$default(ShowPromoBottomSheet showPromoBottomSheet, String str, int i, Object obj) {
|
|
if ((i & 1) != 0) {
|
|
str = showPromoBottomSheet.content;
|
|
}
|
|
return showPromoBottomSheet.copy(str);
|
|
}
|
|
|
|
public final String component1() {
|
|
return this.content;
|
|
}
|
|
|
|
public final ShowPromoBottomSheet copy(String str) {
|
|
m.checkNotNullParameter(str, "content");
|
|
return new ShowPromoBottomSheet(str);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this != obj) {
|
|
return (obj instanceof ShowPromoBottomSheet) && m.areEqual(this.content, ((ShowPromoBottomSheet) obj).content);
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public final String getContent() {
|
|
return this.content;
|
|
}
|
|
|
|
public int hashCode() {
|
|
String str = this.content;
|
|
if (str != null) {
|
|
return str.hashCode();
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
public String toString() {
|
|
return a.C(a.K("ShowPromoBottomSheet(content="), this.content, ")");
|
|
}
|
|
}
|
|
|
|
/* compiled from: SettingsGiftingViewModel.kt */
|
|
public static final class ShowPromoDialog extends Event {
|
|
private final ClaimStatus claimStatus;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public ShowPromoDialog(ClaimStatus claimStatus) {
|
|
super(null);
|
|
m.checkNotNullParameter(claimStatus, "claimStatus");
|
|
this.claimStatus = claimStatus;
|
|
}
|
|
|
|
public static /* synthetic */ ShowPromoDialog copy$default(ShowPromoDialog showPromoDialog, ClaimStatus claimStatus, int i, Object obj) {
|
|
if ((i & 1) != 0) {
|
|
claimStatus = showPromoDialog.claimStatus;
|
|
}
|
|
return showPromoDialog.copy(claimStatus);
|
|
}
|
|
|
|
public final ClaimStatus component1() {
|
|
return this.claimStatus;
|
|
}
|
|
|
|
public final ShowPromoDialog copy(ClaimStatus claimStatus) {
|
|
m.checkNotNullParameter(claimStatus, "claimStatus");
|
|
return new ShowPromoDialog(claimStatus);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this != obj) {
|
|
return (obj instanceof ShowPromoDialog) && m.areEqual(this.claimStatus, ((ShowPromoDialog) obj).claimStatus);
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public final ClaimStatus getClaimStatus() {
|
|
return this.claimStatus;
|
|
}
|
|
|
|
public int hashCode() {
|
|
ClaimStatus claimStatus = this.claimStatus;
|
|
if (claimStatus != null) {
|
|
return claimStatus.hashCode();
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder K = a.K("ShowPromoDialog(claimStatus=");
|
|
K.append(this.claimStatus);
|
|
K.append(")");
|
|
return K.toString();
|
|
}
|
|
}
|
|
|
|
private Event() {
|
|
}
|
|
|
|
public /* synthetic */ Event(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
}
|
|
|
|
/* compiled from: SettingsGiftingViewModel.kt */
|
|
public static final class GiftAndPromoData {
|
|
private final List<ClaimedOutboundPromotion> claimedOutboundPromotions;
|
|
private final StoreEntitlements.State entitlementState;
|
|
private final Map<Long, List<ModelGift>> myPurchasedGifts;
|
|
private final StoreOutboundPromotions.State outboundPromoState;
|
|
private final ResolvingGiftState resolvingGiftState;
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r4v0, resolved type: java.util.Map<java.lang.Long, ? extends java.util.List<com.discord.models.domain.ModelGift>> */
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public GiftAndPromoData(StoreEntitlements.State state, ResolvingGiftState resolvingGiftState, Map<Long, ? extends List<ModelGift>> map, StoreOutboundPromotions.State state2, List<ClaimedOutboundPromotion> list) {
|
|
m.checkNotNullParameter(state, "entitlementState");
|
|
m.checkNotNullParameter(resolvingGiftState, "resolvingGiftState");
|
|
m.checkNotNullParameter(map, "myPurchasedGifts");
|
|
m.checkNotNullParameter(state2, "outboundPromoState");
|
|
m.checkNotNullParameter(list, "claimedOutboundPromotions");
|
|
this.entitlementState = state;
|
|
this.resolvingGiftState = resolvingGiftState;
|
|
this.myPurchasedGifts = map;
|
|
this.outboundPromoState = state2;
|
|
this.claimedOutboundPromotions = list;
|
|
}
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r3v0, resolved type: com.discord.widgets.settings.premium.SettingsGiftingViewModel$GiftAndPromoData */
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public static /* synthetic */ GiftAndPromoData copy$default(GiftAndPromoData giftAndPromoData, StoreEntitlements.State state, ResolvingGiftState resolvingGiftState, Map map, StoreOutboundPromotions.State state2, List list, int i, Object obj) {
|
|
if ((i & 1) != 0) {
|
|
state = giftAndPromoData.entitlementState;
|
|
}
|
|
if ((i & 2) != 0) {
|
|
resolvingGiftState = giftAndPromoData.resolvingGiftState;
|
|
}
|
|
if ((i & 4) != 0) {
|
|
map = giftAndPromoData.myPurchasedGifts;
|
|
}
|
|
if ((i & 8) != 0) {
|
|
state2 = giftAndPromoData.outboundPromoState;
|
|
}
|
|
if ((i & 16) != 0) {
|
|
list = giftAndPromoData.claimedOutboundPromotions;
|
|
}
|
|
return giftAndPromoData.copy(state, resolvingGiftState, map, state2, list);
|
|
}
|
|
|
|
public final StoreEntitlements.State component1() {
|
|
return this.entitlementState;
|
|
}
|
|
|
|
public final ResolvingGiftState component2() {
|
|
return this.resolvingGiftState;
|
|
}
|
|
|
|
public final Map<Long, List<ModelGift>> component3() {
|
|
return this.myPurchasedGifts;
|
|
}
|
|
|
|
public final StoreOutboundPromotions.State component4() {
|
|
return this.outboundPromoState;
|
|
}
|
|
|
|
public final List<ClaimedOutboundPromotion> component5() {
|
|
return this.claimedOutboundPromotions;
|
|
}
|
|
|
|
public final GiftAndPromoData copy(StoreEntitlements.State state, ResolvingGiftState resolvingGiftState, Map<Long, ? extends List<ModelGift>> map, StoreOutboundPromotions.State state2, List<ClaimedOutboundPromotion> list) {
|
|
m.checkNotNullParameter(state, "entitlementState");
|
|
m.checkNotNullParameter(resolvingGiftState, "resolvingGiftState");
|
|
m.checkNotNullParameter(map, "myPurchasedGifts");
|
|
m.checkNotNullParameter(state2, "outboundPromoState");
|
|
m.checkNotNullParameter(list, "claimedOutboundPromotions");
|
|
return new GiftAndPromoData(state, resolvingGiftState, map, state2, list);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof GiftAndPromoData)) {
|
|
return false;
|
|
}
|
|
GiftAndPromoData giftAndPromoData = (GiftAndPromoData) obj;
|
|
return m.areEqual(this.entitlementState, giftAndPromoData.entitlementState) && m.areEqual(this.resolvingGiftState, giftAndPromoData.resolvingGiftState) && m.areEqual(this.myPurchasedGifts, giftAndPromoData.myPurchasedGifts) && m.areEqual(this.outboundPromoState, giftAndPromoData.outboundPromoState) && m.areEqual(this.claimedOutboundPromotions, giftAndPromoData.claimedOutboundPromotions);
|
|
}
|
|
|
|
public final List<ClaimedOutboundPromotion> getClaimedOutboundPromotions() {
|
|
return this.claimedOutboundPromotions;
|
|
}
|
|
|
|
public final StoreEntitlements.State getEntitlementState() {
|
|
return this.entitlementState;
|
|
}
|
|
|
|
public final Map<Long, List<ModelGift>> getMyPurchasedGifts() {
|
|
return this.myPurchasedGifts;
|
|
}
|
|
|
|
public final StoreOutboundPromotions.State getOutboundPromoState() {
|
|
return this.outboundPromoState;
|
|
}
|
|
|
|
public final ResolvingGiftState getResolvingGiftState() {
|
|
return this.resolvingGiftState;
|
|
}
|
|
|
|
public int hashCode() {
|
|
StoreEntitlements.State state = this.entitlementState;
|
|
int i = 0;
|
|
int hashCode = (state != null ? state.hashCode() : 0) * 31;
|
|
ResolvingGiftState resolvingGiftState = this.resolvingGiftState;
|
|
int hashCode2 = (hashCode + (resolvingGiftState != null ? resolvingGiftState.hashCode() : 0)) * 31;
|
|
Map<Long, List<ModelGift>> map = this.myPurchasedGifts;
|
|
int hashCode3 = (hashCode2 + (map != null ? map.hashCode() : 0)) * 31;
|
|
StoreOutboundPromotions.State state2 = this.outboundPromoState;
|
|
int hashCode4 = (hashCode3 + (state2 != null ? state2.hashCode() : 0)) * 31;
|
|
List<ClaimedOutboundPromotion> list = this.claimedOutboundPromotions;
|
|
if (list != null) {
|
|
i = list.hashCode();
|
|
}
|
|
return hashCode4 + i;
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder K = a.K("GiftAndPromoData(entitlementState=");
|
|
K.append(this.entitlementState);
|
|
K.append(", resolvingGiftState=");
|
|
K.append(this.resolvingGiftState);
|
|
K.append(", myPurchasedGifts=");
|
|
K.append(this.myPurchasedGifts);
|
|
K.append(", outboundPromoState=");
|
|
K.append(this.outboundPromoState);
|
|
K.append(", claimedOutboundPromotions=");
|
|
return a.D(K, this.claimedOutboundPromotions, ")");
|
|
}
|
|
}
|
|
|
|
/* compiled from: SettingsGiftingViewModel.kt */
|
|
public static abstract class GiftPurchaseEvent {
|
|
|
|
/* compiled from: SettingsGiftingViewModel.kt */
|
|
public static final class CompleteGiftPurchase extends GiftPurchaseEvent {
|
|
private final String newGiftCode;
|
|
private final String skuName;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public CompleteGiftPurchase(String str, String str2) {
|
|
super(null);
|
|
m.checkNotNullParameter(str, "skuName");
|
|
m.checkNotNullParameter(str2, "newGiftCode");
|
|
this.skuName = str;
|
|
this.newGiftCode = str2;
|
|
}
|
|
|
|
public static /* synthetic */ CompleteGiftPurchase copy$default(CompleteGiftPurchase completeGiftPurchase, String str, String str2, int i, Object obj) {
|
|
if ((i & 1) != 0) {
|
|
str = completeGiftPurchase.skuName;
|
|
}
|
|
if ((i & 2) != 0) {
|
|
str2 = completeGiftPurchase.newGiftCode;
|
|
}
|
|
return completeGiftPurchase.copy(str, str2);
|
|
}
|
|
|
|
public final String component1() {
|
|
return this.skuName;
|
|
}
|
|
|
|
public final String component2() {
|
|
return this.newGiftCode;
|
|
}
|
|
|
|
public final CompleteGiftPurchase copy(String str, String str2) {
|
|
m.checkNotNullParameter(str, "skuName");
|
|
m.checkNotNullParameter(str2, "newGiftCode");
|
|
return new CompleteGiftPurchase(str, str2);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof CompleteGiftPurchase)) {
|
|
return false;
|
|
}
|
|
CompleteGiftPurchase completeGiftPurchase = (CompleteGiftPurchase) obj;
|
|
return m.areEqual(this.skuName, completeGiftPurchase.skuName) && m.areEqual(this.newGiftCode, completeGiftPurchase.newGiftCode);
|
|
}
|
|
|
|
public final String getNewGiftCode() {
|
|
return this.newGiftCode;
|
|
}
|
|
|
|
public final String getSkuName() {
|
|
return this.skuName;
|
|
}
|
|
|
|
public int hashCode() {
|
|
String str = this.skuName;
|
|
int i = 0;
|
|
int hashCode = (str != null ? str.hashCode() : 0) * 31;
|
|
String str2 = this.newGiftCode;
|
|
if (str2 != null) {
|
|
i = str2.hashCode();
|
|
}
|
|
return hashCode + i;
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder K = a.K("CompleteGiftPurchase(skuName=");
|
|
K.append(this.skuName);
|
|
K.append(", newGiftCode=");
|
|
return a.C(K, this.newGiftCode, ")");
|
|
}
|
|
}
|
|
|
|
/* compiled from: SettingsGiftingViewModel.kt */
|
|
public static final class ErrorGiftPurchase extends GiftPurchaseEvent {
|
|
private final int message;
|
|
|
|
public ErrorGiftPurchase(@StringRes int i) {
|
|
super(null);
|
|
this.message = i;
|
|
}
|
|
|
|
public static /* synthetic */ ErrorGiftPurchase copy$default(ErrorGiftPurchase errorGiftPurchase, int i, int i2, Object obj) {
|
|
if ((i2 & 1) != 0) {
|
|
i = errorGiftPurchase.message;
|
|
}
|
|
return errorGiftPurchase.copy(i);
|
|
}
|
|
|
|
public final int component1() {
|
|
return this.message;
|
|
}
|
|
|
|
public final ErrorGiftPurchase copy(@StringRes int i) {
|
|
return new ErrorGiftPurchase(i);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this != obj) {
|
|
return (obj instanceof ErrorGiftPurchase) && this.message == ((ErrorGiftPurchase) obj).message;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public final int getMessage() {
|
|
return this.message;
|
|
}
|
|
|
|
public int hashCode() {
|
|
return this.message;
|
|
}
|
|
|
|
public String toString() {
|
|
return a.w(a.K("ErrorGiftPurchase(message="), this.message, ")");
|
|
}
|
|
}
|
|
|
|
/* compiled from: SettingsGiftingViewModel.kt */
|
|
public static final class NotInProgress extends GiftPurchaseEvent {
|
|
public static final NotInProgress INSTANCE = new NotInProgress();
|
|
|
|
private NotInProgress() {
|
|
super(null);
|
|
}
|
|
}
|
|
|
|
/* compiled from: SettingsGiftingViewModel.kt */
|
|
public static final class StartGiftPurchase extends GiftPurchaseEvent {
|
|
public static final StartGiftPurchase INSTANCE = new StartGiftPurchase();
|
|
|
|
private StartGiftPurchase() {
|
|
super(null);
|
|
}
|
|
}
|
|
|
|
private GiftPurchaseEvent() {
|
|
}
|
|
|
|
public /* synthetic */ GiftPurchaseEvent(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
}
|
|
|
|
/* compiled from: SettingsGiftingViewModel.kt */
|
|
public static abstract class OutboundPromoData {
|
|
|
|
/* compiled from: SettingsGiftingViewModel.kt */
|
|
public static final class Loaded extends OutboundPromoData {
|
|
private final List<OutboundPromoItem> outboundPromos;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public Loaded(List<OutboundPromoItem> list) {
|
|
super(null);
|
|
m.checkNotNullParameter(list, "outboundPromos");
|
|
this.outboundPromos = list;
|
|
}
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r0v0, resolved type: com.discord.widgets.settings.premium.SettingsGiftingViewModel$OutboundPromoData$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.outboundPromos;
|
|
}
|
|
return loaded.copy(list);
|
|
}
|
|
|
|
public final List<OutboundPromoItem> component1() {
|
|
return this.outboundPromos;
|
|
}
|
|
|
|
public final Loaded copy(List<OutboundPromoItem> list) {
|
|
m.checkNotNullParameter(list, "outboundPromos");
|
|
return new Loaded(list);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this != obj) {
|
|
return (obj instanceof Loaded) && m.areEqual(this.outboundPromos, ((Loaded) obj).outboundPromos);
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public final List<OutboundPromoItem> getOutboundPromos() {
|
|
return this.outboundPromos;
|
|
}
|
|
|
|
public int hashCode() {
|
|
List<OutboundPromoItem> list = this.outboundPromos;
|
|
if (list != null) {
|
|
return list.hashCode();
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
public String toString() {
|
|
return a.D(a.K("Loaded(outboundPromos="), this.outboundPromos, ")");
|
|
}
|
|
}
|
|
|
|
/* compiled from: SettingsGiftingViewModel.kt */
|
|
public static final class Loading extends OutboundPromoData {
|
|
public static final Loading INSTANCE = new Loading();
|
|
|
|
private Loading() {
|
|
super(null);
|
|
}
|
|
}
|
|
|
|
private OutboundPromoData() {
|
|
}
|
|
|
|
public /* synthetic */ OutboundPromoData(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
}
|
|
|
|
/* compiled from: SettingsGiftingViewModel.kt */
|
|
public static final class OutboundPromoItem {
|
|
private final ClaimStatus claimStatus;
|
|
|
|
/* renamed from: id reason: collision with root package name */
|
|
private final long f2171id;
|
|
private final String imageUrl;
|
|
private final String terms;
|
|
private final String title;
|
|
|
|
public OutboundPromoItem(ClaimStatus claimStatus, long j, String str, String str2, String str3) {
|
|
m.checkNotNullParameter(claimStatus, "claimStatus");
|
|
m.checkNotNullParameter(str, "title");
|
|
m.checkNotNullParameter(str2, "terms");
|
|
m.checkNotNullParameter(str3, "imageUrl");
|
|
this.claimStatus = claimStatus;
|
|
this.f2171id = j;
|
|
this.title = str;
|
|
this.terms = str2;
|
|
this.imageUrl = str3;
|
|
}
|
|
|
|
public static /* synthetic */ OutboundPromoItem copy$default(OutboundPromoItem outboundPromoItem, ClaimStatus claimStatus, long j, String str, String str2, String str3, int i, Object obj) {
|
|
if ((i & 1) != 0) {
|
|
claimStatus = outboundPromoItem.claimStatus;
|
|
}
|
|
if ((i & 2) != 0) {
|
|
j = outboundPromoItem.f2171id;
|
|
}
|
|
if ((i & 4) != 0) {
|
|
str = outboundPromoItem.title;
|
|
}
|
|
if ((i & 8) != 0) {
|
|
str2 = outboundPromoItem.terms;
|
|
}
|
|
if ((i & 16) != 0) {
|
|
str3 = outboundPromoItem.imageUrl;
|
|
}
|
|
return outboundPromoItem.copy(claimStatus, j, str, str2, str3);
|
|
}
|
|
|
|
public final ClaimStatus component1() {
|
|
return this.claimStatus;
|
|
}
|
|
|
|
public final long component2() {
|
|
return this.f2171id;
|
|
}
|
|
|
|
public final String component3() {
|
|
return this.title;
|
|
}
|
|
|
|
public final String component4() {
|
|
return this.terms;
|
|
}
|
|
|
|
public final String component5() {
|
|
return this.imageUrl;
|
|
}
|
|
|
|
public final OutboundPromoItem copy(ClaimStatus claimStatus, long j, String str, String str2, String str3) {
|
|
m.checkNotNullParameter(claimStatus, "claimStatus");
|
|
m.checkNotNullParameter(str, "title");
|
|
m.checkNotNullParameter(str2, "terms");
|
|
m.checkNotNullParameter(str3, "imageUrl");
|
|
return new OutboundPromoItem(claimStatus, j, str, str2, str3);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof OutboundPromoItem)) {
|
|
return false;
|
|
}
|
|
OutboundPromoItem outboundPromoItem = (OutboundPromoItem) obj;
|
|
return m.areEqual(this.claimStatus, outboundPromoItem.claimStatus) && this.f2171id == outboundPromoItem.f2171id && m.areEqual(this.title, outboundPromoItem.title) && m.areEqual(this.terms, outboundPromoItem.terms) && m.areEqual(this.imageUrl, outboundPromoItem.imageUrl);
|
|
}
|
|
|
|
public final ClaimStatus getClaimStatus() {
|
|
return this.claimStatus;
|
|
}
|
|
|
|
public final long getId() {
|
|
return this.f2171id;
|
|
}
|
|
|
|
public final String getImageUrl() {
|
|
return this.imageUrl;
|
|
}
|
|
|
|
public final String getTerms() {
|
|
return this.terms;
|
|
}
|
|
|
|
public final String getTitle() {
|
|
return this.title;
|
|
}
|
|
|
|
public int hashCode() {
|
|
ClaimStatus claimStatus = this.claimStatus;
|
|
int i = 0;
|
|
int a = (b.a(this.f2171id) + ((claimStatus != null ? claimStatus.hashCode() : 0) * 31)) * 31;
|
|
String str = this.title;
|
|
int hashCode = (a + (str != null ? str.hashCode() : 0)) * 31;
|
|
String str2 = this.terms;
|
|
int hashCode2 = (hashCode + (str2 != null ? str2.hashCode() : 0)) * 31;
|
|
String str3 = this.imageUrl;
|
|
if (str3 != null) {
|
|
i = str3.hashCode();
|
|
}
|
|
return hashCode2 + i;
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder K = a.K("OutboundPromoItem(claimStatus=");
|
|
K.append(this.claimStatus);
|
|
K.append(", id=");
|
|
K.append(this.f2171id);
|
|
K.append(", title=");
|
|
K.append(this.title);
|
|
K.append(", terms=");
|
|
K.append(this.terms);
|
|
K.append(", imageUrl=");
|
|
return a.C(K, this.imageUrl, ")");
|
|
}
|
|
}
|
|
|
|
/* compiled from: SettingsGiftingViewModel.kt */
|
|
public static abstract class ResolvingGiftState {
|
|
|
|
/* compiled from: SettingsGiftingViewModel.kt */
|
|
public static final class Error extends ResolvingGiftState {
|
|
public static final Error INSTANCE = new Error();
|
|
|
|
private Error() {
|
|
super(null);
|
|
}
|
|
}
|
|
|
|
/* compiled from: SettingsGiftingViewModel.kt */
|
|
public static final class NotResolving extends ResolvingGiftState {
|
|
public static final NotResolving INSTANCE = new NotResolving();
|
|
|
|
private NotResolving() {
|
|
super(null);
|
|
}
|
|
}
|
|
|
|
/* compiled from: SettingsGiftingViewModel.kt */
|
|
public static final class Resolving extends ResolvingGiftState {
|
|
public static final Resolving INSTANCE = new Resolving();
|
|
|
|
private Resolving() {
|
|
super(null);
|
|
}
|
|
}
|
|
|
|
private ResolvingGiftState() {
|
|
}
|
|
|
|
public /* synthetic */ ResolvingGiftState(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
}
|
|
|
|
/* compiled from: SettingsGiftingViewModel.kt */
|
|
public static final class StoreState {
|
|
private final StoreEntitlements.State entitlementState;
|
|
private final boolean isUserPremium;
|
|
private final List<ModelGift> myResolvedGifts;
|
|
private final StoreOutboundPromotions.State outboundPromoState;
|
|
|
|
public StoreState(StoreEntitlements.State state, List<ModelGift> list, StoreOutboundPromotions.State state2, boolean z2) {
|
|
m.checkNotNullParameter(state, "entitlementState");
|
|
m.checkNotNullParameter(list, "myResolvedGifts");
|
|
m.checkNotNullParameter(state2, "outboundPromoState");
|
|
this.entitlementState = state;
|
|
this.myResolvedGifts = list;
|
|
this.outboundPromoState = state2;
|
|
this.isUserPremium = z2;
|
|
}
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r0v0, resolved type: com.discord.widgets.settings.premium.SettingsGiftingViewModel$StoreState */
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public static /* synthetic */ StoreState copy$default(StoreState storeState, StoreEntitlements.State state, List list, StoreOutboundPromotions.State state2, boolean z2, int i, Object obj) {
|
|
if ((i & 1) != 0) {
|
|
state = storeState.entitlementState;
|
|
}
|
|
if ((i & 2) != 0) {
|
|
list = storeState.myResolvedGifts;
|
|
}
|
|
if ((i & 4) != 0) {
|
|
state2 = storeState.outboundPromoState;
|
|
}
|
|
if ((i & 8) != 0) {
|
|
z2 = storeState.isUserPremium;
|
|
}
|
|
return storeState.copy(state, list, state2, z2);
|
|
}
|
|
|
|
public final StoreEntitlements.State component1() {
|
|
return this.entitlementState;
|
|
}
|
|
|
|
public final List<ModelGift> component2() {
|
|
return this.myResolvedGifts;
|
|
}
|
|
|
|
public final StoreOutboundPromotions.State component3() {
|
|
return this.outboundPromoState;
|
|
}
|
|
|
|
public final boolean component4() {
|
|
return this.isUserPremium;
|
|
}
|
|
|
|
public final StoreState copy(StoreEntitlements.State state, List<ModelGift> list, StoreOutboundPromotions.State state2, boolean z2) {
|
|
m.checkNotNullParameter(state, "entitlementState");
|
|
m.checkNotNullParameter(list, "myResolvedGifts");
|
|
m.checkNotNullParameter(state2, "outboundPromoState");
|
|
return new StoreState(state, list, state2, z2);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof StoreState)) {
|
|
return false;
|
|
}
|
|
StoreState storeState = (StoreState) obj;
|
|
return m.areEqual(this.entitlementState, storeState.entitlementState) && m.areEqual(this.myResolvedGifts, storeState.myResolvedGifts) && m.areEqual(this.outboundPromoState, storeState.outboundPromoState) && this.isUserPremium == storeState.isUserPremium;
|
|
}
|
|
|
|
public final StoreEntitlements.State getEntitlementState() {
|
|
return this.entitlementState;
|
|
}
|
|
|
|
public final List<ModelGift> getMyResolvedGifts() {
|
|
return this.myResolvedGifts;
|
|
}
|
|
|
|
public final StoreOutboundPromotions.State getOutboundPromoState() {
|
|
return this.outboundPromoState;
|
|
}
|
|
|
|
public int hashCode() {
|
|
StoreEntitlements.State state = this.entitlementState;
|
|
int i = 0;
|
|
int hashCode = (state != null ? state.hashCode() : 0) * 31;
|
|
List<ModelGift> list = this.myResolvedGifts;
|
|
int hashCode2 = (hashCode + (list != null ? list.hashCode() : 0)) * 31;
|
|
StoreOutboundPromotions.State state2 = this.outboundPromoState;
|
|
if (state2 != null) {
|
|
i = state2.hashCode();
|
|
}
|
|
int i2 = (hashCode2 + i) * 31;
|
|
boolean z2 = this.isUserPremium;
|
|
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 isUserPremium() {
|
|
return this.isUserPremium;
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder K = a.K("StoreState(entitlementState=");
|
|
K.append(this.entitlementState);
|
|
K.append(", myResolvedGifts=");
|
|
K.append(this.myResolvedGifts);
|
|
K.append(", outboundPromoState=");
|
|
K.append(this.outboundPromoState);
|
|
K.append(", isUserPremium=");
|
|
return a.F(K, this.isUserPremium, ")");
|
|
}
|
|
}
|
|
|
|
/* compiled from: SettingsGiftingViewModel.kt */
|
|
public static abstract class ViewState {
|
|
|
|
/* compiled from: SettingsGiftingViewModel.kt */
|
|
public static final class Failure extends ViewState {
|
|
public static final Failure INSTANCE = new Failure();
|
|
|
|
private Failure() {
|
|
super(null);
|
|
}
|
|
}
|
|
|
|
/* compiled from: SettingsGiftingViewModel.kt */
|
|
public static final class Loaded extends ViewState {
|
|
private final Set<Long> expandedSkuOrPlanIds;
|
|
private final String lastCopiedCode;
|
|
private final Map<Long, List<ModelEntitlement>> myEntitlements;
|
|
private final Map<Long, List<ModelGift>> myPurchasedGifts;
|
|
private final List<OutboundPromoItem> outboundPromos;
|
|
private final ResolvingGiftState resolvingGiftState;
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r2v0, resolved type: java.util.Map<java.lang.Long, ? extends java.util.List<com.discord.models.domain.ModelEntitlement>> */
|
|
/* JADX DEBUG: Multi-variable search result rejected for r6v0, resolved type: java.util.Map<java.lang.Long, ? extends java.util.List<com.discord.models.domain.ModelGift>> */
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public Loaded(Map<Long, ? extends List<ModelEntitlement>> map, ResolvingGiftState resolvingGiftState, Set<Long> set, List<OutboundPromoItem> list, Map<Long, ? extends List<ModelGift>> map2, String str) {
|
|
super(null);
|
|
m.checkNotNullParameter(map, "myEntitlements");
|
|
m.checkNotNullParameter(resolvingGiftState, "resolvingGiftState");
|
|
m.checkNotNullParameter(set, "expandedSkuOrPlanIds");
|
|
m.checkNotNullParameter(list, "outboundPromos");
|
|
m.checkNotNullParameter(map2, "myPurchasedGifts");
|
|
this.myEntitlements = map;
|
|
this.resolvingGiftState = resolvingGiftState;
|
|
this.expandedSkuOrPlanIds = set;
|
|
this.outboundPromos = list;
|
|
this.myPurchasedGifts = map2;
|
|
this.lastCopiedCode = str;
|
|
}
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r4v0, resolved type: com.discord.widgets.settings.premium.SettingsGiftingViewModel$ViewState$Loaded */
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public static /* synthetic */ Loaded copy$default(Loaded loaded, Map map, ResolvingGiftState resolvingGiftState, Set set, List list, Map map2, String str, int i, Object obj) {
|
|
if ((i & 1) != 0) {
|
|
map = loaded.myEntitlements;
|
|
}
|
|
if ((i & 2) != 0) {
|
|
resolvingGiftState = loaded.resolvingGiftState;
|
|
}
|
|
if ((i & 4) != 0) {
|
|
set = loaded.expandedSkuOrPlanIds;
|
|
}
|
|
if ((i & 8) != 0) {
|
|
list = loaded.outboundPromos;
|
|
}
|
|
if ((i & 16) != 0) {
|
|
map2 = loaded.myPurchasedGifts;
|
|
}
|
|
if ((i & 32) != 0) {
|
|
str = loaded.lastCopiedCode;
|
|
}
|
|
return loaded.copy(map, resolvingGiftState, set, list, map2, str);
|
|
}
|
|
|
|
public final Map<Long, List<ModelEntitlement>> component1() {
|
|
return this.myEntitlements;
|
|
}
|
|
|
|
public final ResolvingGiftState component2() {
|
|
return this.resolvingGiftState;
|
|
}
|
|
|
|
public final Set<Long> component3() {
|
|
return this.expandedSkuOrPlanIds;
|
|
}
|
|
|
|
public final List<OutboundPromoItem> component4() {
|
|
return this.outboundPromos;
|
|
}
|
|
|
|
public final Map<Long, List<ModelGift>> component5() {
|
|
return this.myPurchasedGifts;
|
|
}
|
|
|
|
public final String component6() {
|
|
return this.lastCopiedCode;
|
|
}
|
|
|
|
public final Loaded copy(Map<Long, ? extends List<ModelEntitlement>> map, ResolvingGiftState resolvingGiftState, Set<Long> set, List<OutboundPromoItem> list, Map<Long, ? extends List<ModelGift>> map2, String str) {
|
|
m.checkNotNullParameter(map, "myEntitlements");
|
|
m.checkNotNullParameter(resolvingGiftState, "resolvingGiftState");
|
|
m.checkNotNullParameter(set, "expandedSkuOrPlanIds");
|
|
m.checkNotNullParameter(list, "outboundPromos");
|
|
m.checkNotNullParameter(map2, "myPurchasedGifts");
|
|
return new Loaded(map, resolvingGiftState, set, list, map2, str);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof Loaded)) {
|
|
return false;
|
|
}
|
|
Loaded loaded = (Loaded) obj;
|
|
return m.areEqual(this.myEntitlements, loaded.myEntitlements) && m.areEqual(this.resolvingGiftState, loaded.resolvingGiftState) && m.areEqual(this.expandedSkuOrPlanIds, loaded.expandedSkuOrPlanIds) && m.areEqual(this.outboundPromos, loaded.outboundPromos) && m.areEqual(this.myPurchasedGifts, loaded.myPurchasedGifts) && m.areEqual(this.lastCopiedCode, loaded.lastCopiedCode);
|
|
}
|
|
|
|
public final Set<Long> getExpandedSkuOrPlanIds() {
|
|
return this.expandedSkuOrPlanIds;
|
|
}
|
|
|
|
public final String getLastCopiedCode() {
|
|
return this.lastCopiedCode;
|
|
}
|
|
|
|
public final Map<Long, List<ModelEntitlement>> getMyEntitlements() {
|
|
return this.myEntitlements;
|
|
}
|
|
|
|
public final Map<Long, List<ModelGift>> getMyPurchasedGifts() {
|
|
return this.myPurchasedGifts;
|
|
}
|
|
|
|
public final List<OutboundPromoItem> getOutboundPromos() {
|
|
return this.outboundPromos;
|
|
}
|
|
|
|
public final ResolvingGiftState getResolvingGiftState() {
|
|
return this.resolvingGiftState;
|
|
}
|
|
|
|
public int hashCode() {
|
|
Map<Long, List<ModelEntitlement>> map = this.myEntitlements;
|
|
int i = 0;
|
|
int hashCode = (map != null ? map.hashCode() : 0) * 31;
|
|
ResolvingGiftState resolvingGiftState = this.resolvingGiftState;
|
|
int hashCode2 = (hashCode + (resolvingGiftState != null ? resolvingGiftState.hashCode() : 0)) * 31;
|
|
Set<Long> set = this.expandedSkuOrPlanIds;
|
|
int hashCode3 = (hashCode2 + (set != null ? set.hashCode() : 0)) * 31;
|
|
List<OutboundPromoItem> list = this.outboundPromos;
|
|
int hashCode4 = (hashCode3 + (list != null ? list.hashCode() : 0)) * 31;
|
|
Map<Long, List<ModelGift>> map2 = this.myPurchasedGifts;
|
|
int hashCode5 = (hashCode4 + (map2 != null ? map2.hashCode() : 0)) * 31;
|
|
String str = this.lastCopiedCode;
|
|
if (str != null) {
|
|
i = str.hashCode();
|
|
}
|
|
return hashCode5 + i;
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder K = a.K("Loaded(myEntitlements=");
|
|
K.append(this.myEntitlements);
|
|
K.append(", resolvingGiftState=");
|
|
K.append(this.resolvingGiftState);
|
|
K.append(", expandedSkuOrPlanIds=");
|
|
K.append(this.expandedSkuOrPlanIds);
|
|
K.append(", outboundPromos=");
|
|
K.append(this.outboundPromos);
|
|
K.append(", myPurchasedGifts=");
|
|
K.append(this.myPurchasedGifts);
|
|
K.append(", lastCopiedCode=");
|
|
return a.C(K, this.lastCopiedCode, ")");
|
|
}
|
|
}
|
|
|
|
/* compiled from: SettingsGiftingViewModel.kt */
|
|
public static final class Loading extends ViewState {
|
|
public static final Loading INSTANCE = new Loading();
|
|
|
|
private Loading() {
|
|
super(null);
|
|
}
|
|
}
|
|
|
|
private ViewState() {
|
|
}
|
|
|
|
public /* synthetic */ ViewState(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
}
|
|
|
|
public SettingsGiftingViewModel() {
|
|
this(null, null, null, null, null, null, null, 127, null);
|
|
}
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public SettingsGiftingViewModel(StoreEntitlements storeEntitlements, StoreGifting storeGifting, StoreUserSettingsSystem storeUserSettingsSystem, StoreOutboundPromotions storeOutboundPromotions, StoreGooglePlayPurchases storeGooglePlayPurchases, GooglePlayBillingManager googlePlayBillingManager, Observable<StoreState> observable) {
|
|
super(ViewState.Loading.INSTANCE);
|
|
m.checkNotNullParameter(storeEntitlements, "storeEntitlements");
|
|
m.checkNotNullParameter(storeGifting, "storeGifting");
|
|
m.checkNotNullParameter(storeUserSettingsSystem, "storeUserSettingsSystem");
|
|
m.checkNotNullParameter(storeOutboundPromotions, "storeOutboundPromotions");
|
|
m.checkNotNullParameter(storeGooglePlayPurchases, "storeGooglePlayPurchases");
|
|
m.checkNotNullParameter(googlePlayBillingManager, "gPlayBillingManager");
|
|
m.checkNotNullParameter(observable, "storeObservable");
|
|
this.storeEntitlements = storeEntitlements;
|
|
this.storeGifting = storeGifting;
|
|
this.storeUserSettingsSystem = storeUserSettingsSystem;
|
|
this.storeOutboundPromotions = storeOutboundPromotions;
|
|
BehaviorSubject<StoreState> k0 = BehaviorSubject.k0();
|
|
this.storeStateSubject = k0;
|
|
BehaviorSubject<List<ClaimedOutboundPromotion>> k02 = BehaviorSubject.k0();
|
|
this.claimedPromotionsSubject = k02;
|
|
this.shouldCheckClaimedPromos = new AtomicBoolean(true);
|
|
this.giftPurchaseEventSubject = PublishSubject.k0();
|
|
this.eventSubject = PublishSubject.k0();
|
|
this.onGiftCodeResolved = SettingsGiftingViewModel$onGiftCodeResolved$1.INSTANCE;
|
|
this.subscriptions = new CompositeSubscription();
|
|
storeEntitlements.fetchMyGiftEntitlements();
|
|
googlePlayBillingManager.queryPurchases();
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(storeGooglePlayPurchases.observeEvents(), this, null, 2, null), SettingsGiftingViewModel.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new AnonymousClass1(this), 62, (Object) null);
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(storeGooglePlayPurchases.observeQueryState(), this, null, 2, null), SettingsGiftingViewModel.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new AnonymousClass2(this), 62, (Object) null);
|
|
Observable t = ObservableExtensionsKt.computationLatest(observable).t(new AnonymousClass3(this));
|
|
m.checkNotNullExpressionValue(t, "storeObservable\n …oreState.isUserPremium) }");
|
|
ObservableExtensionsKt.appSubscribe$default(t, SettingsGiftingViewModel.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new AnonymousClass4(k0), 62, (Object) null);
|
|
m.checkNotNullExpressionValue(k0, "storeStateSubject");
|
|
Observable computationLatest = ObservableExtensionsKt.computationLatest(k0);
|
|
m.checkNotNullExpressionValue(k02, "claimedPromotionsSubject");
|
|
Observable r = Observable.j(computationLatest, ObservableExtensionsKt.computationLatest(k02), new SettingsGiftingViewModel$sam$rx_functions_Func2$0(new AnonymousClass5(this))).r();
|
|
m.checkNotNullExpressionValue(r, "Observable.combineLatest… .distinctUntilChanged()");
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(r, this, null, 2, null), SettingsGiftingViewModel.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new AnonymousClass6(this), 62, (Object) null);
|
|
}
|
|
|
|
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
|
|
public /* synthetic */ SettingsGiftingViewModel(StoreEntitlements storeEntitlements, StoreGifting storeGifting, StoreUserSettingsSystem storeUserSettingsSystem, StoreOutboundPromotions storeOutboundPromotions, StoreGooglePlayPurchases storeGooglePlayPurchases, GooglePlayBillingManager googlePlayBillingManager, Observable observable, int i, DefaultConstructorMarker defaultConstructorMarker) {
|
|
this((i & 1) != 0 ? StoreStream.Companion.getEntitlements() : storeEntitlements, (i & 2) != 0 ? StoreStream.Companion.getGifting() : storeGifting, (i & 4) != 0 ? StoreStream.Companion.getUserSettingsSystem() : storeUserSettingsSystem, (i & 8) != 0 ? StoreStream.Companion.getOutboundPromotions() : storeOutboundPromotions, (i & 16) != 0 ? StoreStream.Companion.getGooglePlayPurchases() : storeGooglePlayPurchases, (i & 32) != 0 ? GooglePlayBillingManager.INSTANCE : googlePlayBillingManager, (i & 64) != 0 ? Companion.access$observeStores(Companion) : observable);
|
|
}
|
|
|
|
public static final /* synthetic */ GiftAndPromoData access$combineData(SettingsGiftingViewModel settingsGiftingViewModel, StoreState storeState, List list) {
|
|
return settingsGiftingViewModel.combineData(storeState, list);
|
|
}
|
|
|
|
public static final /* synthetic */ PublishSubject access$getGiftPurchaseEventSubject$p(SettingsGiftingViewModel settingsGiftingViewModel) {
|
|
return settingsGiftingViewModel.giftPurchaseEventSubject;
|
|
}
|
|
|
|
public static final /* synthetic */ AtomicBoolean access$getShouldCheckClaimedPromos$p(SettingsGiftingViewModel settingsGiftingViewModel) {
|
|
return settingsGiftingViewModel.shouldCheckClaimedPromos;
|
|
}
|
|
|
|
public static final /* synthetic */ StoreEntitlements access$getStoreEntitlements$p(SettingsGiftingViewModel settingsGiftingViewModel) {
|
|
return settingsGiftingViewModel.storeEntitlements;
|
|
}
|
|
|
|
public static final /* synthetic */ CompositeSubscription access$getSubscriptions$p(SettingsGiftingViewModel settingsGiftingViewModel) {
|
|
return settingsGiftingViewModel.subscriptions;
|
|
}
|
|
|
|
public static final /* synthetic */ void access$handleAsyncData(SettingsGiftingViewModel settingsGiftingViewModel, GiftAndPromoData giftAndPromoData) {
|
|
settingsGiftingViewModel.handleAsyncData(giftAndPromoData);
|
|
}
|
|
|
|
public static final /* synthetic */ void access$handleGooglePlayPurchaseEvent(SettingsGiftingViewModel settingsGiftingViewModel, StoreGooglePlayPurchases.Event event) {
|
|
settingsGiftingViewModel.handleGooglePlayPurchaseEvent(event);
|
|
}
|
|
|
|
public static final /* synthetic */ void access$handleGooglePlayQueryStateUpdate(SettingsGiftingViewModel settingsGiftingViewModel, StoreGooglePlayPurchases.QueryState queryState) {
|
|
settingsGiftingViewModel.handleGooglePlayQueryStateUpdate(queryState);
|
|
}
|
|
|
|
public static final /* synthetic */ void access$maybeCheckClaimedPromos(SettingsGiftingViewModel settingsGiftingViewModel, boolean z2) {
|
|
settingsGiftingViewModel.maybeCheckClaimedPromos(z2);
|
|
}
|
|
|
|
public static final /* synthetic */ void access$onHandleGiftCode(SettingsGiftingViewModel settingsGiftingViewModel, StoreGifting.GiftState giftState) {
|
|
settingsGiftingViewModel.onHandleGiftCode(giftState);
|
|
}
|
|
|
|
public static final /* synthetic */ void access$setShouldCheckClaimedPromos$p(SettingsGiftingViewModel settingsGiftingViewModel, AtomicBoolean atomicBoolean) {
|
|
settingsGiftingViewModel.shouldCheckClaimedPromos = atomicBoolean;
|
|
}
|
|
|
|
@MainThread
|
|
private final ViewState buildViewState(StoreEntitlements.State state, ResolvingGiftState resolvingGiftState, Map<Long, ? extends List<ModelGift>> map, OutboundPromoData outboundPromoData) {
|
|
Set<Long> set;
|
|
if (!(state instanceof StoreEntitlements.State.Loaded) || !(outboundPromoData instanceof OutboundPromoData.Loaded)) {
|
|
return state instanceof StoreEntitlements.State.Failure ? ViewState.Failure.INSTANCE : ViewState.Loading.INSTANCE;
|
|
}
|
|
ViewState viewState = getViewState();
|
|
String str = null;
|
|
if (!(viewState instanceof ViewState.Loaded)) {
|
|
viewState = null;
|
|
}
|
|
ViewState.Loaded loaded = (ViewState.Loaded) viewState;
|
|
if (loaded == null || (set = loaded.getExpandedSkuOrPlanIds()) == null) {
|
|
set = n0.emptySet();
|
|
}
|
|
ViewState viewState2 = getViewState();
|
|
if (!(viewState2 instanceof ViewState.Loaded)) {
|
|
viewState2 = null;
|
|
}
|
|
ViewState.Loaded loaded2 = (ViewState.Loaded) viewState2;
|
|
if (loaded2 != null) {
|
|
str = loaded2.getLastCopiedCode();
|
|
}
|
|
return new ViewState.Loaded(((StoreEntitlements.State.Loaded) state).getGiftableEntitlements(), resolvingGiftState, set, ((OutboundPromoData.Loaded) outboundPromoData).getOutboundPromos(), map, str);
|
|
}
|
|
|
|
private final GiftAndPromoData combineData(StoreState storeState, List<ClaimedOutboundPromotion> list) {
|
|
ResolvingGiftState resolvingGiftState;
|
|
ViewState viewState = getViewState();
|
|
if (!(viewState instanceof ViewState.Loaded)) {
|
|
viewState = null;
|
|
}
|
|
ViewState.Loaded loaded = (ViewState.Loaded) viewState;
|
|
if (loaded == null || (resolvingGiftState = loaded.getResolvingGiftState()) == null) {
|
|
resolvingGiftState = ResolvingGiftState.NotResolving.INSTANCE;
|
|
}
|
|
StoreEntitlements.State entitlementState = storeState.getEntitlementState();
|
|
StoreOutboundPromotions.State outboundPromoState = storeState.getOutboundPromoState();
|
|
LinkedHashMap linkedHashMap = new LinkedHashMap();
|
|
if (entitlementState instanceof StoreEntitlements.State.Loaded) {
|
|
for (ModelGift modelGift : storeState.getMyResolvedGifts()) {
|
|
Long subscriptionPlanId = modelGift.getSubscriptionPlanId();
|
|
long longValue = subscriptionPlanId != null ? subscriptionPlanId.longValue() : modelGift.getSkuId();
|
|
if (!linkedHashMap.containsKey(Long.valueOf(longValue))) {
|
|
linkedHashMap.put(Long.valueOf(longValue), new ArrayList());
|
|
}
|
|
List list2 = (List) linkedHashMap.get(Long.valueOf(longValue));
|
|
if (list2 != null) {
|
|
list2.add(modelGift);
|
|
}
|
|
}
|
|
}
|
|
return new GiftAndPromoData(entitlementState, resolvingGiftState, linkedHashMap, outboundPromoState, list);
|
|
}
|
|
|
|
private final String getPromoImageUrl(long j) {
|
|
String str = m.areEqual(this.storeUserSettingsSystem.getTheme(), "light") ? "logo-light" : "logo-dark";
|
|
String str2 = "https://cdn.discordapp.com";
|
|
if (!(str2.length() > 0)) {
|
|
str2 = null;
|
|
}
|
|
if (str2 == null) {
|
|
str2 = "https://discord.com/api/";
|
|
}
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append(str2);
|
|
sb.append("/promotions/");
|
|
sb.append(j);
|
|
sb.append('/');
|
|
return a.C(sb, str, "?size=256");
|
|
}
|
|
|
|
private final List<OutboundPromoItem> getPromos(List<OutboundPromotion> list, List<ClaimedOutboundPromotion> list2) {
|
|
LinkedHashMap linkedHashMap = new LinkedHashMap();
|
|
for (OutboundPromotion outboundPromotion : list) {
|
|
OutboundPromoItem outboundPromoItem = new OutboundPromoItem(new ClaimStatus.Unclaimed(outboundPromotion.b(), outboundPromotion.a()), outboundPromotion.b(), outboundPromotion.g(), outboundPromotion.f(), getPromoImageUrl(outboundPromotion.b()));
|
|
linkedHashMap.put(Long.valueOf(outboundPromoItem.getId()), outboundPromoItem);
|
|
}
|
|
for (ClaimedOutboundPromotion claimedOutboundPromotion : list2) {
|
|
OutboundPromoItem outboundPromoItem2 = new OutboundPromoItem(new ClaimStatus.Claimed(claimedOutboundPromotion.b().b(), claimedOutboundPromotion.a(), claimedOutboundPromotion.b().c(), claimedOutboundPromotion.d(), claimedOutboundPromotion.c()), claimedOutboundPromotion.b().b(), claimedOutboundPromotion.b().g(), claimedOutboundPromotion.b().f(), getPromoImageUrl(claimedOutboundPromotion.b().b()));
|
|
linkedHashMap.put(Long.valueOf(outboundPromoItem2.getId()), outboundPromoItem2);
|
|
}
|
|
return u.toList(linkedHashMap.values());
|
|
}
|
|
|
|
@MainThread
|
|
private final void handleAsyncData(GiftAndPromoData giftAndPromoData) {
|
|
OutboundPromoData outboundPromoData;
|
|
StoreOutboundPromotions.State outboundPromoState = giftAndPromoData.getOutboundPromoState();
|
|
if (outboundPromoState instanceof StoreOutboundPromotions.State.Loaded) {
|
|
outboundPromoData = new OutboundPromoData.Loaded(getPromos(((StoreOutboundPromotions.State.Loaded) outboundPromoState).getValidActivePromotions(), giftAndPromoData.getClaimedOutboundPromotions()));
|
|
} else if (outboundPromoState instanceof StoreOutboundPromotions.State.Failed) {
|
|
outboundPromoData = new OutboundPromoData.Loaded(n.emptyList());
|
|
} else if (outboundPromoState instanceof StoreOutboundPromotions.State.Loading) {
|
|
outboundPromoData = OutboundPromoData.Loading.INSTANCE;
|
|
} else {
|
|
throw new NoWhenBranchMatchedException();
|
|
}
|
|
ViewState buildViewState = buildViewState(giftAndPromoData.getEntitlementState(), giftAndPromoData.getResolvingGiftState(), giftAndPromoData.getMyPurchasedGifts(), outboundPromoData);
|
|
if (buildViewState instanceof ViewState.Loaded) {
|
|
this.storeOutboundPromotions.markSeen();
|
|
}
|
|
updateViewState(buildViewState);
|
|
}
|
|
|
|
private final void handleGooglePlayPurchaseEvent(StoreGooglePlayPurchases.Event event) {
|
|
if (event instanceof StoreGooglePlayPurchases.Event.PurchaseQuerySuccess) {
|
|
StoreGooglePlayPurchases.Event.PurchaseQuerySuccess purchaseQuerySuccess = (StoreGooglePlayPurchases.Event.PurchaseQuerySuccess) event;
|
|
if (purchaseQuerySuccess.getGiftCode() != null) {
|
|
this.storeEntitlements.fetchMyGiftEntitlements();
|
|
PublishSubject<GiftPurchaseEvent> publishSubject = this.giftPurchaseEventSubject;
|
|
publishSubject.j.onNext(new GiftPurchaseEvent.CompleteGiftPurchase(purchaseQuerySuccess.getNewSkuName(), purchaseQuerySuccess.getGiftCode()));
|
|
return;
|
|
}
|
|
StoreGifting storeGifting = this.storeGifting;
|
|
Long skuId = purchaseQuerySuccess.getSkuId();
|
|
m.checkNotNull(skuId);
|
|
storeGifting.generateGiftCode(skuId.longValue(), purchaseQuerySuccess.getSubscriptionPlanId(), new SettingsGiftingViewModel$handleGooglePlayPurchaseEvent$2(this, event), new SettingsGiftingViewModel$handleGooglePlayPurchaseEvent$1(this));
|
|
} else if (event instanceof StoreGooglePlayPurchases.Event.PurchaseQueryFailure) {
|
|
PublishSubject<GiftPurchaseEvent> publishSubject2 = this.giftPurchaseEventSubject;
|
|
publishSubject2.j.onNext(new GiftPurchaseEvent.ErrorGiftPurchase(2131886889));
|
|
}
|
|
}
|
|
|
|
private final void handleGooglePlayQueryStateUpdate(StoreGooglePlayPurchases.QueryState queryState) {
|
|
if (m.areEqual(queryState, StoreGooglePlayPurchases.QueryState.InProgress.INSTANCE)) {
|
|
PublishSubject<GiftPurchaseEvent> publishSubject = this.giftPurchaseEventSubject;
|
|
publishSubject.j.onNext(GiftPurchaseEvent.StartGiftPurchase.INSTANCE);
|
|
} else if (m.areEqual(queryState, StoreGooglePlayPurchases.QueryState.NotInProgress.INSTANCE)) {
|
|
PublishSubject<GiftPurchaseEvent> publishSubject2 = this.giftPurchaseEventSubject;
|
|
publishSubject2.j.onNext(GiftPurchaseEvent.NotInProgress.INSTANCE);
|
|
}
|
|
}
|
|
|
|
private final void maybeCheckClaimedPromos(boolean z2) {
|
|
if (!this.shouldCheckClaimedPromos.compareAndSet(true, false)) {
|
|
return;
|
|
}
|
|
if (z2) {
|
|
Observable L = ObservableExtensionsKt.restSubscribeOn$default(this.storeOutboundPromotions.fetchClaimedOutboundPromotions(), false, 1, null).s(new SettingsGiftingViewModel$maybeCheckClaimedPromos$1(this)).L(SettingsGiftingViewModel$maybeCheckClaimedPromos$2.INSTANCE);
|
|
m.checkNotNullExpressionValue(L, "storeOutboundPromotions.…rorReturn { emptyList() }");
|
|
ObservableExtensionsKt.appSubscribe$default(L, SettingsGiftingViewModel.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new SettingsGiftingViewModel$maybeCheckClaimedPromos$3(this.claimedPromotionsSubject), 62, (Object) null);
|
|
return;
|
|
}
|
|
this.claimedPromotionsSubject.onNext(n.emptyList());
|
|
}
|
|
|
|
@MainThread
|
|
private final void onHandleGiftCode(StoreGifting.GiftState giftState) {
|
|
ViewState viewState;
|
|
ModelGift gift;
|
|
ViewState viewState2 = getViewState();
|
|
ModelGift modelGift = null;
|
|
if (!(viewState2 instanceof ViewState.Loaded)) {
|
|
viewState2 = null;
|
|
}
|
|
ViewState.Loaded loaded = (ViewState.Loaded) viewState2;
|
|
if (loaded != null) {
|
|
StoreEntitlements.State.Loaded loaded2 = new StoreEntitlements.State.Loaded(loaded.getMyEntitlements(), h0.emptyMap());
|
|
OutboundPromoData.Loaded loaded3 = new OutboundPromoData.Loaded(loaded.getOutboundPromos());
|
|
if ((giftState instanceof StoreGifting.GiftState.Loading) || (giftState instanceof StoreGifting.GiftState.Redeeming)) {
|
|
viewState = buildViewState(loaded2, ResolvingGiftState.Resolving.INSTANCE, loaded.getMyPurchasedGifts(), loaded3);
|
|
} else if (!(giftState instanceof StoreGifting.GiftState.LoadFailed) && !(giftState instanceof StoreGifting.GiftState.RedeemedFailed) && !(giftState instanceof StoreGifting.GiftState.Invalid)) {
|
|
boolean z2 = giftState instanceof StoreGifting.GiftState.Revoking;
|
|
if (!z2 && !(giftState instanceof StoreGifting.GiftState.Resolved)) {
|
|
throw new NoWhenBranchMatchedException();
|
|
}
|
|
StoreGifting.GiftState.Resolved resolved = (StoreGifting.GiftState.Resolved) (!(giftState instanceof StoreGifting.GiftState.Resolved) ? null : giftState);
|
|
if (resolved == null || (gift = resolved.getGift()) == null) {
|
|
if (!z2) {
|
|
giftState = null;
|
|
}
|
|
StoreGifting.GiftState.Revoking revoking = (StoreGifting.GiftState.Revoking) giftState;
|
|
if (revoking != null) {
|
|
modelGift = revoking.getGift();
|
|
}
|
|
} else {
|
|
modelGift = gift;
|
|
}
|
|
if (modelGift != null) {
|
|
if (!modelGift.isClaimedByMe()) {
|
|
this.onGiftCodeResolved.invoke(modelGift.getCode());
|
|
}
|
|
viewState = buildViewState(loaded2, ResolvingGiftState.NotResolving.INSTANCE, loaded.getMyPurchasedGifts(), loaded3);
|
|
} else {
|
|
return;
|
|
}
|
|
} else {
|
|
viewState = buildViewState(loaded2, ResolvingGiftState.Error.INSTANCE, loaded.getMyPurchasedGifts(), loaded3);
|
|
}
|
|
updateViewState(viewState);
|
|
}
|
|
}
|
|
|
|
@MainThread
|
|
public final void handleClaimedPromo(ClaimStatus.Claimed claimed) {
|
|
m.checkNotNullParameter(claimed, "claimedStatus");
|
|
ViewState viewState = getViewState();
|
|
if (!(viewState instanceof ViewState.Loaded)) {
|
|
viewState = null;
|
|
}
|
|
ViewState.Loaded loaded = (ViewState.Loaded) viewState;
|
|
if (loaded != null) {
|
|
List<OutboundPromoItem> outboundPromos = loaded.getOutboundPromos();
|
|
ArrayList arrayList = new ArrayList(o.collectionSizeOrDefault(outboundPromos, 10));
|
|
for (OutboundPromoItem outboundPromoItem : outboundPromos) {
|
|
if (outboundPromoItem.getId() == claimed.getPromoId()) {
|
|
outboundPromoItem = OutboundPromoItem.copy$default(outboundPromoItem, claimed, 0, null, null, null, 30, null);
|
|
}
|
|
arrayList.add(outboundPromoItem);
|
|
}
|
|
updateViewState(ViewState.Loaded.copy$default(loaded, null, null, null, arrayList, null, null, 55, null));
|
|
}
|
|
}
|
|
|
|
@MainThread
|
|
public final void handleCopyClicked(String str) {
|
|
m.checkNotNullParameter(str, "giftCode");
|
|
ViewState viewState = getViewState();
|
|
if (!(viewState instanceof ViewState.Loaded)) {
|
|
viewState = null;
|
|
}
|
|
ViewState.Loaded loaded = (ViewState.Loaded) viewState;
|
|
if (loaded != null) {
|
|
updateViewState(ViewState.Loaded.copy$default(loaded, null, null, null, null, null, str, 31, null));
|
|
}
|
|
}
|
|
|
|
public final void handlePromoButtonClicked(OutboundPromoItem outboundPromoItem) {
|
|
m.checkNotNullParameter(outboundPromoItem, "promoItem");
|
|
PublishSubject<Event> publishSubject = this.eventSubject;
|
|
publishSubject.j.onNext(new Event.ShowPromoDialog(outboundPromoItem.getClaimStatus()));
|
|
}
|
|
|
|
public final void handlePromoMoreDetailsClicked(OutboundPromoItem outboundPromoItem) {
|
|
m.checkNotNullParameter(outboundPromoItem, "promoItem");
|
|
PublishSubject<Event> publishSubject = this.eventSubject;
|
|
publishSubject.j.onNext(new Event.ShowPromoBottomSheet(outboundPromoItem.getTerms()));
|
|
}
|
|
|
|
@MainThread
|
|
public final void handleSkuClicked(long j, Long l) {
|
|
ViewState viewState = getViewState();
|
|
if (!(viewState instanceof ViewState.Loaded)) {
|
|
viewState = null;
|
|
}
|
|
ViewState.Loaded loaded = (ViewState.Loaded) viewState;
|
|
if (loaded != null) {
|
|
Set mutableSet = u.toMutableSet(loaded.getExpandedSkuOrPlanIds());
|
|
long longValue = l != null ? l.longValue() : j;
|
|
if (mutableSet.contains(Long.valueOf(longValue))) {
|
|
mutableSet.remove(Long.valueOf(longValue));
|
|
} else {
|
|
mutableSet.add(Long.valueOf(longValue));
|
|
this.storeGifting.fetchMyGiftsForSku(j, l);
|
|
}
|
|
updateViewState(ViewState.Loaded.copy$default(loaded, null, null, mutableSet, null, null, null, 59, null));
|
|
}
|
|
}
|
|
|
|
public final Observable<Event> observeEvents() {
|
|
PublishSubject<Event> publishSubject = this.eventSubject;
|
|
m.checkNotNullExpressionValue(publishSubject, "eventSubject");
|
|
return publishSubject;
|
|
}
|
|
|
|
public final PublishSubject<GiftPurchaseEvent> observeGiftPurchaseEvents() {
|
|
PublishSubject<GiftPurchaseEvent> publishSubject = this.giftPurchaseEventSubject;
|
|
m.checkNotNullExpressionValue(publishSubject, "giftPurchaseEventSubject");
|
|
return publishSubject;
|
|
}
|
|
|
|
@Override // com.discord.app.AppViewModel, androidx.lifecycle.ViewModel
|
|
public void onCleared() {
|
|
super.onCleared();
|
|
this.subscriptions.b();
|
|
}
|
|
|
|
@MainThread
|
|
public final void redeemGiftCode(String str, AppComponent appComponent) {
|
|
m.checkNotNullParameter(str, "giftCode");
|
|
m.checkNotNullParameter(appComponent, "appComponent");
|
|
if (getViewState() instanceof ViewState.Loaded) {
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(this.storeGifting.requestGift(str), appComponent, null, 2, null), SettingsGiftingViewModel.class, (Context) null, new SettingsGiftingViewModel$redeemGiftCode$1(this), (Function1) null, (Function0) null, (Function0) null, new SettingsGiftingViewModel$redeemGiftCode$2(this), 58, (Object) null);
|
|
}
|
|
}
|
|
|
|
public final void setOnGiftCodeResolved(Function1<? super String, Unit> function1) {
|
|
m.checkNotNullParameter(function1, "onGiftCodeResolved");
|
|
this.onGiftCodeResolved = function1;
|
|
}
|
|
}
|