879 lines
46 KiB
Java
879 lines
46 KiB
Java
package com.discord.widgets.settings.premium;
|
|
|
|
import android.content.Context;
|
|
import androidx.annotation.MainThread;
|
|
import androidx.annotation.StringRes;
|
|
import c.d.b.a.a;
|
|
import com.android.billingclient.api.Purchase;
|
|
import com.android.billingclient.api.SkuDetails;
|
|
import com.discord.app.AppViewModel;
|
|
import com.discord.models.domain.ModelEntitlement;
|
|
import com.discord.models.domain.ModelPaymentSource;
|
|
import com.discord.models.domain.ModelPremiumGuildSubscriptionSlot;
|
|
import com.discord.models.domain.ModelSubscription;
|
|
import com.discord.models.domain.billing.ModelInvoicePreview;
|
|
import com.discord.models.domain.premium.SubscriptionPlanType;
|
|
import com.discord.restapi.RestAPIParams;
|
|
import com.discord.stores.StoreEntitlements;
|
|
import com.discord.stores.StoreGooglePlayPurchases;
|
|
import com.discord.stores.StoreGooglePlaySkuDetails;
|
|
import com.discord.stores.StorePaymentSources;
|
|
import com.discord.stores.StorePremiumGuildSubscription;
|
|
import com.discord.stores.StoreStream;
|
|
import com.discord.stores.StoreSubscriptions;
|
|
import com.discord.utilities.billing.GooglePlayBillingManager;
|
|
import com.discord.utilities.rest.RestAPI;
|
|
import com.discord.utilities.rx.ObservableExtensionsKt;
|
|
import d0.t.n;
|
|
import d0.t.n0;
|
|
import d0.t.u;
|
|
import d0.z.d.m;
|
|
import d0.z.d.o;
|
|
import j0.l.a.d;
|
|
import j0.l.e.j;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import kotlin.Unit;
|
|
import kotlin.jvm.functions.Function0;
|
|
import kotlin.jvm.functions.Function1;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
import rx.Observable;
|
|
import rx.subjects.PublishSubject;
|
|
/* compiled from: SettingsPremiumViewModel.kt */
|
|
public final class SettingsPremiumViewModel extends AppViewModel<ViewState> {
|
|
public static final Companion Companion = new Companion(null);
|
|
private final PublishSubject<Event> eventSubject;
|
|
private long launchPremiumTabStartTimeMs;
|
|
private final RestAPI restAPI;
|
|
private final StoreEntitlements storeEntitlements;
|
|
private final StorePaymentSources storePaymentsSources;
|
|
private final StorePremiumGuildSubscription storePremiumGuildSubscription;
|
|
private final StoreSubscriptions storeSubscriptions;
|
|
|
|
/* compiled from: SettingsPremiumViewModel.kt */
|
|
/* renamed from: com.discord.widgets.settings.premium.SettingsPremiumViewModel$1 reason: invalid class name */
|
|
public static final class AnonymousClass1 extends o implements Function1<StoreState, Unit> {
|
|
public final /* synthetic */ SettingsPremiumViewModel this$0;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public AnonymousClass1(SettingsPremiumViewModel settingsPremiumViewModel) {
|
|
super(1);
|
|
this.this$0 = settingsPremiumViewModel;
|
|
}
|
|
|
|
/* 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) {
|
|
m.checkNotNullParameter(storeState, "storeState");
|
|
SettingsPremiumViewModel.access$handleStoreState(this.this$0, storeState);
|
|
}
|
|
}
|
|
|
|
/* compiled from: SettingsPremiumViewModel.kt */
|
|
public static final class Companion {
|
|
private Companion() {
|
|
}
|
|
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
|
|
public static final /* synthetic */ Observable access$getSubscriptionsAndInvoicePreview(Companion companion, RestAPI restAPI, StoreSubscriptions.SubscriptionsState subscriptionsState, boolean z2) {
|
|
return companion.getSubscriptionsAndInvoicePreview(restAPI, subscriptionsState, z2);
|
|
}
|
|
|
|
public static final /* synthetic */ Observable access$observeStores(Companion companion, StorePaymentSources storePaymentSources, StoreSubscriptions storeSubscriptions, StoreEntitlements storeEntitlements, StorePremiumGuildSubscription storePremiumGuildSubscription, StoreGooglePlaySkuDetails storeGooglePlaySkuDetails, StoreGooglePlayPurchases storeGooglePlayPurchases, RestAPI restAPI) {
|
|
return companion.observeStores(storePaymentSources, storeSubscriptions, storeEntitlements, storePremiumGuildSubscription, storeGooglePlaySkuDetails, storeGooglePlayPurchases, restAPI);
|
|
}
|
|
|
|
/* JADX DEBUG: Type inference failed for r7v1. Raw type applied. Possible types: rx.Observable<java.lang.Object>, java.lang.Object, rx.Observable<com.discord.widgets.settings.premium.SettingsPremiumViewModel$SubscriptionAndInvoice> */
|
|
private final Observable<SubscriptionAndInvoice> getSubscriptionsAndInvoicePreview(RestAPI restAPI, StoreSubscriptions.SubscriptionsState subscriptionsState, boolean z2) {
|
|
String id2;
|
|
if (subscriptionsState instanceof StoreSubscriptions.SubscriptionsState.Loaded) {
|
|
ModelSubscription modelSubscription = (ModelSubscription) u.firstOrNull((List<? extends Object>) ((StoreSubscriptions.SubscriptionsState.Loaded) subscriptionsState).getSubscriptions());
|
|
if (modelSubscription == null || (id2 = modelSubscription.getId()) == null) {
|
|
j jVar = new j(new SubscriptionAndInvoice(subscriptionsState, new InvoicePreviewFetch.Invoice(null)));
|
|
m.checkNotNullExpressionValue(jVar, "Observable.just(\n …nvoice(null))\n )");
|
|
return jVar;
|
|
}
|
|
Observable<SubscriptionAndInvoice> L = ObservableExtensionsKt.restSubscribeOn$default(restAPI.getInvoicePreview(new RestAPIParams.InvoicePreviewBody(id2, true, z2 && !modelSubscription.isGoogleSubscription())), false, 1, null).F(new SettingsPremiumViewModel$Companion$getSubscriptionsAndInvoicePreview$1(subscriptionsState)).L(new SettingsPremiumViewModel$Companion$getSubscriptionsAndInvoicePreview$2(subscriptionsState));
|
|
m.checkNotNullExpressionValue(L, "restAPI\n .g…ch.Error)\n }");
|
|
return L;
|
|
}
|
|
Observable observable = d.j;
|
|
m.checkNotNullExpressionValue(observable, "Observable.never()");
|
|
return observable;
|
|
}
|
|
|
|
private final Observable<StoreState> observeStores(StorePaymentSources storePaymentSources, StoreSubscriptions storeSubscriptions, StoreEntitlements storeEntitlements, StorePremiumGuildSubscription storePremiumGuildSubscription, StoreGooglePlaySkuDetails storeGooglePlaySkuDetails, StoreGooglePlayPurchases storeGooglePlayPurchases, RestAPI restAPI) {
|
|
Observable<StoreState> e = Observable.e(storePaymentSources.observePaymentSourcesState(), storeSubscriptions.observeSubscriptions().Y(new SettingsPremiumViewModel$Companion$observeStores$1(restAPI)), storeSubscriptions.observeSubscriptions().Y(new SettingsPremiumViewModel$Companion$observeStores$2(restAPI)), storeEntitlements.observeEntitlementState(), StorePremiumGuildSubscription.observePremiumGuildSubscriptionsState$default(storePremiumGuildSubscription, null, 1, null), storeGooglePlaySkuDetails.observeState(), storeGooglePlayPurchases.observeState(), SettingsPremiumViewModel$Companion$observeStores$3.INSTANCE);
|
|
m.checkNotNullExpressionValue(e, "Observable\n .co… )\n }");
|
|
return e;
|
|
}
|
|
}
|
|
|
|
/* compiled from: SettingsPremiumViewModel.kt */
|
|
public static abstract class Event {
|
|
|
|
/* compiled from: SettingsPremiumViewModel.kt */
|
|
public static final class ErrorToast extends Event {
|
|
private final int errorStringResId;
|
|
|
|
public ErrorToast(@StringRes int i) {
|
|
super(null);
|
|
this.errorStringResId = i;
|
|
}
|
|
|
|
public static /* synthetic */ ErrorToast copy$default(ErrorToast errorToast, int i, int i2, Object obj) {
|
|
if ((i2 & 1) != 0) {
|
|
i = errorToast.errorStringResId;
|
|
}
|
|
return errorToast.copy(i);
|
|
}
|
|
|
|
public final int component1() {
|
|
return this.errorStringResId;
|
|
}
|
|
|
|
public final ErrorToast copy(@StringRes int i) {
|
|
return new ErrorToast(i);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this != obj) {
|
|
return (obj instanceof ErrorToast) && this.errorStringResId == ((ErrorToast) obj).errorStringResId;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public final int getErrorStringResId() {
|
|
return this.errorStringResId;
|
|
}
|
|
|
|
public int hashCode() {
|
|
return this.errorStringResId;
|
|
}
|
|
|
|
public String toString() {
|
|
return a.w(a.K("ErrorToast(errorStringResId="), this.errorStringResId, ")");
|
|
}
|
|
}
|
|
|
|
private Event() {
|
|
}
|
|
|
|
public /* synthetic */ Event(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
}
|
|
|
|
/* compiled from: SettingsPremiumViewModel.kt */
|
|
public static abstract class InvoicePreviewFetch {
|
|
|
|
/* compiled from: SettingsPremiumViewModel.kt */
|
|
public static final class Error extends InvoicePreviewFetch {
|
|
public static final Error INSTANCE = new Error();
|
|
|
|
private Error() {
|
|
super(null);
|
|
}
|
|
}
|
|
|
|
/* compiled from: SettingsPremiumViewModel.kt */
|
|
public static final class Invoice extends InvoicePreviewFetch {
|
|
private final ModelInvoicePreview modelInvoicePreview;
|
|
|
|
public Invoice(ModelInvoicePreview modelInvoicePreview) {
|
|
super(null);
|
|
this.modelInvoicePreview = modelInvoicePreview;
|
|
}
|
|
|
|
public static /* synthetic */ Invoice copy$default(Invoice invoice, ModelInvoicePreview modelInvoicePreview, int i, Object obj) {
|
|
if ((i & 1) != 0) {
|
|
modelInvoicePreview = invoice.modelInvoicePreview;
|
|
}
|
|
return invoice.copy(modelInvoicePreview);
|
|
}
|
|
|
|
public final ModelInvoicePreview component1() {
|
|
return this.modelInvoicePreview;
|
|
}
|
|
|
|
public final Invoice copy(ModelInvoicePreview modelInvoicePreview) {
|
|
return new Invoice(modelInvoicePreview);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this != obj) {
|
|
return (obj instanceof Invoice) && m.areEqual(this.modelInvoicePreview, ((Invoice) obj).modelInvoicePreview);
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public final ModelInvoicePreview getModelInvoicePreview() {
|
|
return this.modelInvoicePreview;
|
|
}
|
|
|
|
public int hashCode() {
|
|
ModelInvoicePreview modelInvoicePreview = this.modelInvoicePreview;
|
|
if (modelInvoicePreview != null) {
|
|
return modelInvoicePreview.hashCode();
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder K = a.K("Invoice(modelInvoicePreview=");
|
|
K.append(this.modelInvoicePreview);
|
|
K.append(")");
|
|
return K.toString();
|
|
}
|
|
}
|
|
|
|
private InvoicePreviewFetch() {
|
|
}
|
|
|
|
public /* synthetic */ InvoicePreviewFetch(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
}
|
|
|
|
/* compiled from: SettingsPremiumViewModel.kt */
|
|
public static final class StoreState {
|
|
private final InvoicePreviewFetch currentInvoicePreviewFetch;
|
|
private final StoreEntitlements.State entitlementState;
|
|
private final StorePremiumGuildSubscription.State guildSubscriptionState;
|
|
private final StorePaymentSources.PaymentSourcesState paymentSourcesState;
|
|
private final StoreGooglePlayPurchases.State purchaseState;
|
|
private final InvoicePreviewFetch renewalInvoicePreviewFetch;
|
|
private final StoreGooglePlaySkuDetails.State skuDetailsState;
|
|
private final StoreSubscriptions.SubscriptionsState subscriptionsState;
|
|
|
|
public StoreState(StorePaymentSources.PaymentSourcesState paymentSourcesState, StoreSubscriptions.SubscriptionsState subscriptionsState, StoreEntitlements.State state, StorePremiumGuildSubscription.State state2, InvoicePreviewFetch invoicePreviewFetch, InvoicePreviewFetch invoicePreviewFetch2, StoreGooglePlaySkuDetails.State state3, StoreGooglePlayPurchases.State state4) {
|
|
m.checkNotNullParameter(paymentSourcesState, "paymentSourcesState");
|
|
m.checkNotNullParameter(subscriptionsState, "subscriptionsState");
|
|
m.checkNotNullParameter(state, "entitlementState");
|
|
m.checkNotNullParameter(state2, "guildSubscriptionState");
|
|
m.checkNotNullParameter(invoicePreviewFetch, "renewalInvoicePreviewFetch");
|
|
m.checkNotNullParameter(invoicePreviewFetch2, "currentInvoicePreviewFetch");
|
|
m.checkNotNullParameter(state3, "skuDetailsState");
|
|
m.checkNotNullParameter(state4, "purchaseState");
|
|
this.paymentSourcesState = paymentSourcesState;
|
|
this.subscriptionsState = subscriptionsState;
|
|
this.entitlementState = state;
|
|
this.guildSubscriptionState = state2;
|
|
this.renewalInvoicePreviewFetch = invoicePreviewFetch;
|
|
this.currentInvoicePreviewFetch = invoicePreviewFetch2;
|
|
this.skuDetailsState = state3;
|
|
this.purchaseState = state4;
|
|
}
|
|
|
|
public static /* synthetic */ StoreState copy$default(StoreState storeState, StorePaymentSources.PaymentSourcesState paymentSourcesState, StoreSubscriptions.SubscriptionsState subscriptionsState, StoreEntitlements.State state, StorePremiumGuildSubscription.State state2, InvoicePreviewFetch invoicePreviewFetch, InvoicePreviewFetch invoicePreviewFetch2, StoreGooglePlaySkuDetails.State state3, StoreGooglePlayPurchases.State state4, int i, Object obj) {
|
|
return storeState.copy((i & 1) != 0 ? storeState.paymentSourcesState : paymentSourcesState, (i & 2) != 0 ? storeState.subscriptionsState : subscriptionsState, (i & 4) != 0 ? storeState.entitlementState : state, (i & 8) != 0 ? storeState.guildSubscriptionState : state2, (i & 16) != 0 ? storeState.renewalInvoicePreviewFetch : invoicePreviewFetch, (i & 32) != 0 ? storeState.currentInvoicePreviewFetch : invoicePreviewFetch2, (i & 64) != 0 ? storeState.skuDetailsState : state3, (i & 128) != 0 ? storeState.purchaseState : state4);
|
|
}
|
|
|
|
public final StorePaymentSources.PaymentSourcesState component1() {
|
|
return this.paymentSourcesState;
|
|
}
|
|
|
|
public final StoreSubscriptions.SubscriptionsState component2() {
|
|
return this.subscriptionsState;
|
|
}
|
|
|
|
public final StoreEntitlements.State component3() {
|
|
return this.entitlementState;
|
|
}
|
|
|
|
public final StorePremiumGuildSubscription.State component4() {
|
|
return this.guildSubscriptionState;
|
|
}
|
|
|
|
public final InvoicePreviewFetch component5() {
|
|
return this.renewalInvoicePreviewFetch;
|
|
}
|
|
|
|
public final InvoicePreviewFetch component6() {
|
|
return this.currentInvoicePreviewFetch;
|
|
}
|
|
|
|
public final StoreGooglePlaySkuDetails.State component7() {
|
|
return this.skuDetailsState;
|
|
}
|
|
|
|
public final StoreGooglePlayPurchases.State component8() {
|
|
return this.purchaseState;
|
|
}
|
|
|
|
public final StoreState copy(StorePaymentSources.PaymentSourcesState paymentSourcesState, StoreSubscriptions.SubscriptionsState subscriptionsState, StoreEntitlements.State state, StorePremiumGuildSubscription.State state2, InvoicePreviewFetch invoicePreviewFetch, InvoicePreviewFetch invoicePreviewFetch2, StoreGooglePlaySkuDetails.State state3, StoreGooglePlayPurchases.State state4) {
|
|
m.checkNotNullParameter(paymentSourcesState, "paymentSourcesState");
|
|
m.checkNotNullParameter(subscriptionsState, "subscriptionsState");
|
|
m.checkNotNullParameter(state, "entitlementState");
|
|
m.checkNotNullParameter(state2, "guildSubscriptionState");
|
|
m.checkNotNullParameter(invoicePreviewFetch, "renewalInvoicePreviewFetch");
|
|
m.checkNotNullParameter(invoicePreviewFetch2, "currentInvoicePreviewFetch");
|
|
m.checkNotNullParameter(state3, "skuDetailsState");
|
|
m.checkNotNullParameter(state4, "purchaseState");
|
|
return new StoreState(paymentSourcesState, subscriptionsState, state, state2, invoicePreviewFetch, invoicePreviewFetch2, state3, state4);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof StoreState)) {
|
|
return false;
|
|
}
|
|
StoreState storeState = (StoreState) obj;
|
|
return m.areEqual(this.paymentSourcesState, storeState.paymentSourcesState) && m.areEqual(this.subscriptionsState, storeState.subscriptionsState) && m.areEqual(this.entitlementState, storeState.entitlementState) && m.areEqual(this.guildSubscriptionState, storeState.guildSubscriptionState) && m.areEqual(this.renewalInvoicePreviewFetch, storeState.renewalInvoicePreviewFetch) && m.areEqual(this.currentInvoicePreviewFetch, storeState.currentInvoicePreviewFetch) && m.areEqual(this.skuDetailsState, storeState.skuDetailsState) && m.areEqual(this.purchaseState, storeState.purchaseState);
|
|
}
|
|
|
|
public final InvoicePreviewFetch getCurrentInvoicePreviewFetch() {
|
|
return this.currentInvoicePreviewFetch;
|
|
}
|
|
|
|
public final StoreEntitlements.State getEntitlementState() {
|
|
return this.entitlementState;
|
|
}
|
|
|
|
public final StorePremiumGuildSubscription.State getGuildSubscriptionState() {
|
|
return this.guildSubscriptionState;
|
|
}
|
|
|
|
public final StorePaymentSources.PaymentSourcesState getPaymentSourcesState() {
|
|
return this.paymentSourcesState;
|
|
}
|
|
|
|
public final StoreGooglePlayPurchases.State getPurchaseState() {
|
|
return this.purchaseState;
|
|
}
|
|
|
|
public final InvoicePreviewFetch getRenewalInvoicePreviewFetch() {
|
|
return this.renewalInvoicePreviewFetch;
|
|
}
|
|
|
|
public final StoreGooglePlaySkuDetails.State getSkuDetailsState() {
|
|
return this.skuDetailsState;
|
|
}
|
|
|
|
public final StoreSubscriptions.SubscriptionsState getSubscriptionsState() {
|
|
return this.subscriptionsState;
|
|
}
|
|
|
|
public int hashCode() {
|
|
StorePaymentSources.PaymentSourcesState paymentSourcesState = this.paymentSourcesState;
|
|
int i = 0;
|
|
int hashCode = (paymentSourcesState != null ? paymentSourcesState.hashCode() : 0) * 31;
|
|
StoreSubscriptions.SubscriptionsState subscriptionsState = this.subscriptionsState;
|
|
int hashCode2 = (hashCode + (subscriptionsState != null ? subscriptionsState.hashCode() : 0)) * 31;
|
|
StoreEntitlements.State state = this.entitlementState;
|
|
int hashCode3 = (hashCode2 + (state != null ? state.hashCode() : 0)) * 31;
|
|
StorePremiumGuildSubscription.State state2 = this.guildSubscriptionState;
|
|
int hashCode4 = (hashCode3 + (state2 != null ? state2.hashCode() : 0)) * 31;
|
|
InvoicePreviewFetch invoicePreviewFetch = this.renewalInvoicePreviewFetch;
|
|
int hashCode5 = (hashCode4 + (invoicePreviewFetch != null ? invoicePreviewFetch.hashCode() : 0)) * 31;
|
|
InvoicePreviewFetch invoicePreviewFetch2 = this.currentInvoicePreviewFetch;
|
|
int hashCode6 = (hashCode5 + (invoicePreviewFetch2 != null ? invoicePreviewFetch2.hashCode() : 0)) * 31;
|
|
StoreGooglePlaySkuDetails.State state3 = this.skuDetailsState;
|
|
int hashCode7 = (hashCode6 + (state3 != null ? state3.hashCode() : 0)) * 31;
|
|
StoreGooglePlayPurchases.State state4 = this.purchaseState;
|
|
if (state4 != null) {
|
|
i = state4.hashCode();
|
|
}
|
|
return hashCode7 + i;
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder K = a.K("StoreState(paymentSourcesState=");
|
|
K.append(this.paymentSourcesState);
|
|
K.append(", subscriptionsState=");
|
|
K.append(this.subscriptionsState);
|
|
K.append(", entitlementState=");
|
|
K.append(this.entitlementState);
|
|
K.append(", guildSubscriptionState=");
|
|
K.append(this.guildSubscriptionState);
|
|
K.append(", renewalInvoicePreviewFetch=");
|
|
K.append(this.renewalInvoicePreviewFetch);
|
|
K.append(", currentInvoicePreviewFetch=");
|
|
K.append(this.currentInvoicePreviewFetch);
|
|
K.append(", skuDetailsState=");
|
|
K.append(this.skuDetailsState);
|
|
K.append(", purchaseState=");
|
|
K.append(this.purchaseState);
|
|
K.append(")");
|
|
return K.toString();
|
|
}
|
|
}
|
|
|
|
/* compiled from: SettingsPremiumViewModel.kt */
|
|
public static final class SubscriptionAndInvoice {
|
|
private final InvoicePreviewFetch invoicePreviewFetch;
|
|
private final StoreSubscriptions.SubscriptionsState subscriptionsState;
|
|
|
|
public SubscriptionAndInvoice(StoreSubscriptions.SubscriptionsState subscriptionsState, InvoicePreviewFetch invoicePreviewFetch) {
|
|
m.checkNotNullParameter(subscriptionsState, "subscriptionsState");
|
|
m.checkNotNullParameter(invoicePreviewFetch, "invoicePreviewFetch");
|
|
this.subscriptionsState = subscriptionsState;
|
|
this.invoicePreviewFetch = invoicePreviewFetch;
|
|
}
|
|
|
|
public static /* synthetic */ SubscriptionAndInvoice copy$default(SubscriptionAndInvoice subscriptionAndInvoice, StoreSubscriptions.SubscriptionsState subscriptionsState, InvoicePreviewFetch invoicePreviewFetch, int i, Object obj) {
|
|
if ((i & 1) != 0) {
|
|
subscriptionsState = subscriptionAndInvoice.subscriptionsState;
|
|
}
|
|
if ((i & 2) != 0) {
|
|
invoicePreviewFetch = subscriptionAndInvoice.invoicePreviewFetch;
|
|
}
|
|
return subscriptionAndInvoice.copy(subscriptionsState, invoicePreviewFetch);
|
|
}
|
|
|
|
public final StoreSubscriptions.SubscriptionsState component1() {
|
|
return this.subscriptionsState;
|
|
}
|
|
|
|
public final InvoicePreviewFetch component2() {
|
|
return this.invoicePreviewFetch;
|
|
}
|
|
|
|
public final SubscriptionAndInvoice copy(StoreSubscriptions.SubscriptionsState subscriptionsState, InvoicePreviewFetch invoicePreviewFetch) {
|
|
m.checkNotNullParameter(subscriptionsState, "subscriptionsState");
|
|
m.checkNotNullParameter(invoicePreviewFetch, "invoicePreviewFetch");
|
|
return new SubscriptionAndInvoice(subscriptionsState, invoicePreviewFetch);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof SubscriptionAndInvoice)) {
|
|
return false;
|
|
}
|
|
SubscriptionAndInvoice subscriptionAndInvoice = (SubscriptionAndInvoice) obj;
|
|
return m.areEqual(this.subscriptionsState, subscriptionAndInvoice.subscriptionsState) && m.areEqual(this.invoicePreviewFetch, subscriptionAndInvoice.invoicePreviewFetch);
|
|
}
|
|
|
|
public final InvoicePreviewFetch getInvoicePreviewFetch() {
|
|
return this.invoicePreviewFetch;
|
|
}
|
|
|
|
public final StoreSubscriptions.SubscriptionsState getSubscriptionsState() {
|
|
return this.subscriptionsState;
|
|
}
|
|
|
|
public int hashCode() {
|
|
StoreSubscriptions.SubscriptionsState subscriptionsState = this.subscriptionsState;
|
|
int i = 0;
|
|
int hashCode = (subscriptionsState != null ? subscriptionsState.hashCode() : 0) * 31;
|
|
InvoicePreviewFetch invoicePreviewFetch = this.invoicePreviewFetch;
|
|
if (invoicePreviewFetch != null) {
|
|
i = invoicePreviewFetch.hashCode();
|
|
}
|
|
return hashCode + i;
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder K = a.K("SubscriptionAndInvoice(subscriptionsState=");
|
|
K.append(this.subscriptionsState);
|
|
K.append(", invoicePreviewFetch=");
|
|
K.append(this.invoicePreviewFetch);
|
|
K.append(")");
|
|
return K.toString();
|
|
}
|
|
}
|
|
|
|
/* compiled from: SettingsPremiumViewModel.kt */
|
|
public static abstract class ViewState {
|
|
|
|
/* compiled from: SettingsPremiumViewModel.kt */
|
|
public static final class Failure extends ViewState {
|
|
public static final Failure INSTANCE = new Failure();
|
|
|
|
private Failure() {
|
|
super(null);
|
|
}
|
|
}
|
|
|
|
/* compiled from: SettingsPremiumViewModel.kt */
|
|
public static final class Loaded extends ViewState {
|
|
private final ModelInvoicePreview currentInvoicePreview;
|
|
private final List<ModelEntitlement> entitlements;
|
|
private final Map<Long, ModelPremiumGuildSubscriptionSlot> guildSubscriptions;
|
|
private final boolean hasAnyPremiumGuildSubscriptions;
|
|
private final boolean isBusy;
|
|
private final List<ModelPaymentSource> paymentSources;
|
|
private final ModelSubscription premiumSubscription;
|
|
private final List<Purchase> purchases;
|
|
private final ModelInvoicePreview renewalInvoicePreview;
|
|
private final Map<String, SkuDetails> skuDetails;
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r3v0, resolved type: java.util.List<? extends com.discord.models.domain.ModelPaymentSource> */
|
|
/* JADX DEBUG: Multi-variable search result rejected for r10v0, resolved type: java.util.Map<java.lang.String, ? extends com.android.billingclient.api.SkuDetails> */
|
|
/* JADX DEBUG: Multi-variable search result rejected for r11v0, resolved type: java.util.List<? extends com.android.billingclient.api.Purchase> */
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public Loaded(ModelSubscription modelSubscription, List<? extends ModelPaymentSource> list, boolean z2, List<ModelEntitlement> list2, Map<Long, ModelPremiumGuildSubscriptionSlot> map, boolean z3, ModelInvoicePreview modelInvoicePreview, ModelInvoicePreview modelInvoicePreview2, Map<String, ? extends SkuDetails> map2, List<? extends Purchase> list3) {
|
|
super(null);
|
|
m.checkNotNullParameter(list, "paymentSources");
|
|
m.checkNotNullParameter(list2, "entitlements");
|
|
m.checkNotNullParameter(map, "guildSubscriptions");
|
|
m.checkNotNullParameter(map2, "skuDetails");
|
|
m.checkNotNullParameter(list3, "purchases");
|
|
this.premiumSubscription = modelSubscription;
|
|
this.paymentSources = list;
|
|
this.isBusy = z2;
|
|
this.entitlements = list2;
|
|
this.guildSubscriptions = map;
|
|
this.hasAnyPremiumGuildSubscriptions = z3;
|
|
this.renewalInvoicePreview = modelInvoicePreview;
|
|
this.currentInvoicePreview = modelInvoicePreview2;
|
|
this.skuDetails = map2;
|
|
this.purchases = list3;
|
|
}
|
|
|
|
public static /* synthetic */ Loaded copy$default(Loaded loaded, ModelSubscription modelSubscription, List list, boolean z2, List list2, Map map, boolean z3, ModelInvoicePreview modelInvoicePreview, ModelInvoicePreview modelInvoicePreview2, Map map2, List list3, int i, Object obj) {
|
|
return loaded.copy((i & 1) != 0 ? loaded.premiumSubscription : modelSubscription, (i & 2) != 0 ? loaded.paymentSources : list, (i & 4) != 0 ? loaded.isBusy : z2, (i & 8) != 0 ? loaded.entitlements : list2, (i & 16) != 0 ? loaded.guildSubscriptions : map, (i & 32) != 0 ? loaded.hasAnyPremiumGuildSubscriptions : z3, (i & 64) != 0 ? loaded.renewalInvoicePreview : modelInvoicePreview, (i & 128) != 0 ? loaded.currentInvoicePreview : modelInvoicePreview2, (i & 256) != 0 ? loaded.skuDetails : map2, (i & 512) != 0 ? loaded.purchases : list3);
|
|
}
|
|
|
|
public final ModelSubscription component1() {
|
|
return this.premiumSubscription;
|
|
}
|
|
|
|
public final List<Purchase> component10() {
|
|
return this.purchases;
|
|
}
|
|
|
|
public final List<ModelPaymentSource> component2() {
|
|
return this.paymentSources;
|
|
}
|
|
|
|
public final boolean component3() {
|
|
return this.isBusy;
|
|
}
|
|
|
|
public final List<ModelEntitlement> component4() {
|
|
return this.entitlements;
|
|
}
|
|
|
|
public final Map<Long, ModelPremiumGuildSubscriptionSlot> component5() {
|
|
return this.guildSubscriptions;
|
|
}
|
|
|
|
public final boolean component6() {
|
|
return this.hasAnyPremiumGuildSubscriptions;
|
|
}
|
|
|
|
public final ModelInvoicePreview component7() {
|
|
return this.renewalInvoicePreview;
|
|
}
|
|
|
|
public final ModelInvoicePreview component8() {
|
|
return this.currentInvoicePreview;
|
|
}
|
|
|
|
public final Map<String, SkuDetails> component9() {
|
|
return this.skuDetails;
|
|
}
|
|
|
|
public final Loaded copy(ModelSubscription modelSubscription, List<? extends ModelPaymentSource> list, boolean z2, List<ModelEntitlement> list2, Map<Long, ModelPremiumGuildSubscriptionSlot> map, boolean z3, ModelInvoicePreview modelInvoicePreview, ModelInvoicePreview modelInvoicePreview2, Map<String, ? extends SkuDetails> map2, List<? extends Purchase> list3) {
|
|
m.checkNotNullParameter(list, "paymentSources");
|
|
m.checkNotNullParameter(list2, "entitlements");
|
|
m.checkNotNullParameter(map, "guildSubscriptions");
|
|
m.checkNotNullParameter(map2, "skuDetails");
|
|
m.checkNotNullParameter(list3, "purchases");
|
|
return new Loaded(modelSubscription, list, z2, list2, map, z3, modelInvoicePreview, modelInvoicePreview2, map2, list3);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof Loaded)) {
|
|
return false;
|
|
}
|
|
Loaded loaded = (Loaded) obj;
|
|
return m.areEqual(this.premiumSubscription, loaded.premiumSubscription) && m.areEqual(this.paymentSources, loaded.paymentSources) && this.isBusy == loaded.isBusy && m.areEqual(this.entitlements, loaded.entitlements) && m.areEqual(this.guildSubscriptions, loaded.guildSubscriptions) && this.hasAnyPremiumGuildSubscriptions == loaded.hasAnyPremiumGuildSubscriptions && m.areEqual(this.renewalInvoicePreview, loaded.renewalInvoicePreview) && m.areEqual(this.currentInvoicePreview, loaded.currentInvoicePreview) && m.areEqual(this.skuDetails, loaded.skuDetails) && m.areEqual(this.purchases, loaded.purchases);
|
|
}
|
|
|
|
public final ModelInvoicePreview getCurrentInvoicePreview() {
|
|
return this.currentInvoicePreview;
|
|
}
|
|
|
|
public final List<ModelEntitlement> getEntitlements() {
|
|
return this.entitlements;
|
|
}
|
|
|
|
public final Map<Long, ModelPremiumGuildSubscriptionSlot> getGuildSubscriptions() {
|
|
return this.guildSubscriptions;
|
|
}
|
|
|
|
public final boolean getHasAnyPremiumGuildSubscriptions() {
|
|
return this.hasAnyPremiumGuildSubscriptions;
|
|
}
|
|
|
|
public final List<ModelPaymentSource> getPaymentSources() {
|
|
return this.paymentSources;
|
|
}
|
|
|
|
public final ModelSubscription getPremiumSubscription() {
|
|
return this.premiumSubscription;
|
|
}
|
|
|
|
public final List<Purchase> getPurchases() {
|
|
return this.purchases;
|
|
}
|
|
|
|
public final ModelInvoicePreview getRenewalInvoicePreview() {
|
|
return this.renewalInvoicePreview;
|
|
}
|
|
|
|
public final Map<String, SkuDetails> getSkuDetails() {
|
|
return this.skuDetails;
|
|
}
|
|
|
|
public int hashCode() {
|
|
ModelSubscription modelSubscription = this.premiumSubscription;
|
|
int i = 0;
|
|
int hashCode = (modelSubscription != null ? modelSubscription.hashCode() : 0) * 31;
|
|
List<ModelPaymentSource> list = this.paymentSources;
|
|
int hashCode2 = (hashCode + (list != null ? list.hashCode() : 0)) * 31;
|
|
boolean z2 = this.isBusy;
|
|
int i2 = 1;
|
|
if (z2) {
|
|
z2 = true;
|
|
}
|
|
int i3 = z2 ? 1 : 0;
|
|
int i4 = z2 ? 1 : 0;
|
|
int i5 = z2 ? 1 : 0;
|
|
int i6 = (hashCode2 + i3) * 31;
|
|
List<ModelEntitlement> list2 = this.entitlements;
|
|
int hashCode3 = (i6 + (list2 != null ? list2.hashCode() : 0)) * 31;
|
|
Map<Long, ModelPremiumGuildSubscriptionSlot> map = this.guildSubscriptions;
|
|
int hashCode4 = (hashCode3 + (map != null ? map.hashCode() : 0)) * 31;
|
|
boolean z3 = this.hasAnyPremiumGuildSubscriptions;
|
|
if (!z3) {
|
|
i2 = z3 ? 1 : 0;
|
|
}
|
|
int i7 = (hashCode4 + i2) * 31;
|
|
ModelInvoicePreview modelInvoicePreview = this.renewalInvoicePreview;
|
|
int hashCode5 = (i7 + (modelInvoicePreview != null ? modelInvoicePreview.hashCode() : 0)) * 31;
|
|
ModelInvoicePreview modelInvoicePreview2 = this.currentInvoicePreview;
|
|
int hashCode6 = (hashCode5 + (modelInvoicePreview2 != null ? modelInvoicePreview2.hashCode() : 0)) * 31;
|
|
Map<String, SkuDetails> map2 = this.skuDetails;
|
|
int hashCode7 = (hashCode6 + (map2 != null ? map2.hashCode() : 0)) * 31;
|
|
List<Purchase> list3 = this.purchases;
|
|
if (list3 != null) {
|
|
i = list3.hashCode();
|
|
}
|
|
return hashCode7 + i;
|
|
}
|
|
|
|
public final boolean isBusy() {
|
|
return this.isBusy;
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder K = a.K("Loaded(premiumSubscription=");
|
|
K.append(this.premiumSubscription);
|
|
K.append(", paymentSources=");
|
|
K.append(this.paymentSources);
|
|
K.append(", isBusy=");
|
|
K.append(this.isBusy);
|
|
K.append(", entitlements=");
|
|
K.append(this.entitlements);
|
|
K.append(", guildSubscriptions=");
|
|
K.append(this.guildSubscriptions);
|
|
K.append(", hasAnyPremiumGuildSubscriptions=");
|
|
K.append(this.hasAnyPremiumGuildSubscriptions);
|
|
K.append(", renewalInvoicePreview=");
|
|
K.append(this.renewalInvoicePreview);
|
|
K.append(", currentInvoicePreview=");
|
|
K.append(this.currentInvoicePreview);
|
|
K.append(", skuDetails=");
|
|
K.append(this.skuDetails);
|
|
K.append(", purchases=");
|
|
return a.D(K, this.purchases, ")");
|
|
}
|
|
}
|
|
|
|
/* compiled from: SettingsPremiumViewModel.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 SettingsPremiumViewModel() {
|
|
this(null, null, null, null, null, null, 63, null);
|
|
}
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public SettingsPremiumViewModel(StorePaymentSources storePaymentSources, StoreSubscriptions storeSubscriptions, StoreEntitlements storeEntitlements, StorePremiumGuildSubscription storePremiumGuildSubscription, RestAPI restAPI, Observable<StoreState> observable) {
|
|
super(ViewState.Loading.INSTANCE);
|
|
m.checkNotNullParameter(storePaymentSources, "storePaymentsSources");
|
|
m.checkNotNullParameter(storeSubscriptions, "storeSubscriptions");
|
|
m.checkNotNullParameter(storeEntitlements, "storeEntitlements");
|
|
m.checkNotNullParameter(storePremiumGuildSubscription, "storePremiumGuildSubscription");
|
|
m.checkNotNullParameter(restAPI, "restAPI");
|
|
m.checkNotNullParameter(observable, "storeObservable");
|
|
this.storePaymentsSources = storePaymentSources;
|
|
this.storeSubscriptions = storeSubscriptions;
|
|
this.storeEntitlements = storeEntitlements;
|
|
this.storePremiumGuildSubscription = storePremiumGuildSubscription;
|
|
this.restAPI = restAPI;
|
|
this.eventSubject = PublishSubject.k0();
|
|
fetchData();
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(ObservableExtensionsKt.computationLatest(observable), this, null, 2, null), SettingsPremiumViewModel.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new AnonymousClass1(this), 62, (Object) null);
|
|
}
|
|
|
|
/* JADX WARNING: Illegal instructions before constructor call */
|
|
public /* synthetic */ SettingsPremiumViewModel(StorePaymentSources storePaymentSources, StoreSubscriptions storeSubscriptions, StoreEntitlements storeEntitlements, StorePremiumGuildSubscription storePremiumGuildSubscription, RestAPI restAPI, Observable observable, int i, DefaultConstructorMarker defaultConstructorMarker) {
|
|
this(r0, r1, r2, r3, r4, r5);
|
|
Observable observable2;
|
|
StorePaymentSources paymentSources = (i & 1) != 0 ? StoreStream.Companion.getPaymentSources() : storePaymentSources;
|
|
StoreSubscriptions subscriptions = (i & 2) != 0 ? StoreStream.Companion.getSubscriptions() : storeSubscriptions;
|
|
StoreEntitlements entitlements = (i & 4) != 0 ? StoreStream.Companion.getEntitlements() : storeEntitlements;
|
|
StorePremiumGuildSubscription premiumGuildSubscriptions = (i & 8) != 0 ? StoreStream.Companion.getPremiumGuildSubscriptions() : storePremiumGuildSubscription;
|
|
RestAPI api = (i & 16) != 0 ? RestAPI.Companion.getApi() : restAPI;
|
|
if ((i & 32) != 0) {
|
|
Companion companion = Companion;
|
|
StoreStream.Companion companion2 = StoreStream.Companion;
|
|
observable2 = Companion.access$observeStores(companion, companion2.getPaymentSources(), companion2.getSubscriptions(), companion2.getEntitlements(), companion2.getPremiumGuildSubscriptions(), companion2.getGooglePlaySkuDetails(), companion2.getGooglePlayPurchases(), RestAPI.Companion.getApi());
|
|
} else {
|
|
observable2 = observable;
|
|
}
|
|
}
|
|
|
|
public static final /* synthetic */ void access$fetchData(SettingsPremiumViewModel settingsPremiumViewModel) {
|
|
settingsPremiumViewModel.fetchData();
|
|
}
|
|
|
|
public static final /* synthetic */ void access$handleStoreState(SettingsPremiumViewModel settingsPremiumViewModel, StoreState storeState) {
|
|
settingsPremiumViewModel.handleStoreState(storeState);
|
|
}
|
|
|
|
public static final /* synthetic */ void access$onCancelError(SettingsPremiumViewModel settingsPremiumViewModel) {
|
|
settingsPremiumViewModel.onCancelError();
|
|
}
|
|
|
|
private final void fetchData() {
|
|
this.storePaymentsSources.fetchPaymentSources();
|
|
this.storeSubscriptions.fetchSubscriptions();
|
|
this.storeEntitlements.fetchMyEntitlementsForApplication(521842831262875670L);
|
|
this.storePremiumGuildSubscription.fetchUserGuildPremiumState();
|
|
GooglePlayBillingManager.INSTANCE.querySkuDetails();
|
|
}
|
|
|
|
private final void handleStoreState(StoreState storeState) {
|
|
Object obj;
|
|
Object obj2;
|
|
boolean z2;
|
|
StorePaymentSources.PaymentSourcesState paymentSourcesState = storeState.getPaymentSourcesState();
|
|
StoreSubscriptions.SubscriptionsState subscriptionsState = storeState.getSubscriptionsState();
|
|
StoreEntitlements.State entitlementState = storeState.getEntitlementState();
|
|
StorePremiumGuildSubscription.State guildSubscriptionState = storeState.getGuildSubscriptionState();
|
|
InvoicePreviewFetch renewalInvoicePreviewFetch = storeState.getRenewalInvoicePreviewFetch();
|
|
InvoicePreviewFetch currentInvoicePreviewFetch = storeState.getCurrentInvoicePreviewFetch();
|
|
StoreGooglePlaySkuDetails.State skuDetailsState = storeState.getSkuDetailsState();
|
|
StoreGooglePlayPurchases.State purchaseState = storeState.getPurchaseState();
|
|
if (!(paymentSourcesState instanceof StorePaymentSources.PaymentSourcesState.Loaded) || !(subscriptionsState instanceof StoreSubscriptions.SubscriptionsState.Loaded) || !(entitlementState instanceof StoreEntitlements.State.Loaded) || !(guildSubscriptionState instanceof StorePremiumGuildSubscription.State.Loaded) || !(renewalInvoicePreviewFetch instanceof InvoicePreviewFetch.Invoice) || !(currentInvoicePreviewFetch instanceof InvoicePreviewFetch.Invoice) || !(skuDetailsState instanceof StoreGooglePlaySkuDetails.State.Loaded) || !(purchaseState instanceof StoreGooglePlayPurchases.State.Loaded)) {
|
|
obj = ((paymentSourcesState instanceof StorePaymentSources.PaymentSourcesState.Failure) || (subscriptionsState instanceof StoreSubscriptions.SubscriptionsState.Failure) || (guildSubscriptionState instanceof StorePremiumGuildSubscription.State.Failure) || (renewalInvoicePreviewFetch instanceof InvoicePreviewFetch.Error) || (skuDetailsState instanceof StoreGooglePlaySkuDetails.State.Failure)) ? ViewState.Failure.INSTANCE : ViewState.Loading.INSTANCE;
|
|
} else {
|
|
Iterator<T> it = ((StoreSubscriptions.SubscriptionsState.Loaded) subscriptionsState).getSubscriptions().iterator();
|
|
while (true) {
|
|
if (!it.hasNext()) {
|
|
obj2 = null;
|
|
break;
|
|
}
|
|
obj2 = it.next();
|
|
if (((ModelSubscription) obj2).getType() == ModelSubscription.Type.PREMIUM) {
|
|
z2 = true;
|
|
continue;
|
|
} else {
|
|
z2 = false;
|
|
continue;
|
|
}
|
|
if (z2) {
|
|
break;
|
|
}
|
|
}
|
|
ModelSubscription modelSubscription = (ModelSubscription) obj2;
|
|
boolean hasAnyOfPlans = modelSubscription != null ? modelSubscription.hasAnyOfPlans(n0.setOf((Object[]) new Long[]{Long.valueOf(SubscriptionPlanType.PREMIUM_GUILD_MONTH.getPlanId()), Long.valueOf(SubscriptionPlanType.PREMIUM_GUILD_YEAR.getPlanId())})) : false;
|
|
List<ModelPaymentSource> paymentSources = ((StorePaymentSources.PaymentSourcesState.Loaded) paymentSourcesState).getPaymentSources();
|
|
List<ModelEntitlement> list = ((StoreEntitlements.State.Loaded) entitlementState).getOwnedEntitlements().get(521842831262875670L);
|
|
if (list == null) {
|
|
list = n.emptyList();
|
|
}
|
|
obj = new ViewState.Loaded(modelSubscription, paymentSources, false, list, ((StorePremiumGuildSubscription.State.Loaded) guildSubscriptionState).getPremiumGuildSubscriptionSlotMap(), hasAnyOfPlans, ((InvoicePreviewFetch.Invoice) renewalInvoicePreviewFetch).getModelInvoicePreview(), ((InvoicePreviewFetch.Invoice) currentInvoicePreviewFetch).getModelInvoicePreview(), ((StoreGooglePlaySkuDetails.State.Loaded) skuDetailsState).getSkuDetails(), ((StoreGooglePlayPurchases.State.Loaded) purchaseState).getPurchases());
|
|
}
|
|
updateViewState(obj);
|
|
}
|
|
|
|
private final void markBusy() {
|
|
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, true, null, null, false, null, null, null, null, 1019, null));
|
|
}
|
|
}
|
|
|
|
private final void onCancelError() {
|
|
if (getViewState() instanceof ViewState.Loaded) {
|
|
PublishSubject<Event> publishSubject = this.eventSubject;
|
|
publishSubject.j.onNext(new Event.ErrorToast(2131892081));
|
|
}
|
|
}
|
|
|
|
@MainThread
|
|
public final void cancelSubscription() {
|
|
ModelSubscription premiumSubscription;
|
|
ViewState viewState = getViewState();
|
|
if (!(viewState instanceof ViewState.Loaded)) {
|
|
viewState = null;
|
|
}
|
|
ViewState.Loaded loaded = (ViewState.Loaded) viewState;
|
|
if (loaded != null && (premiumSubscription = loaded.getPremiumSubscription()) != null) {
|
|
markBusy();
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(ObservableExtensionsKt.restSubscribeOn$default(this.restAPI.deleteSubscription(premiumSubscription.getId()), false, 1, null), this, null, 2, null), SettingsPremiumViewModel.class, (Context) null, (Function1) null, new SettingsPremiumViewModel$cancelSubscription$2(this), (Function0) null, (Function0) null, new SettingsPremiumViewModel$cancelSubscription$1(this), 54, (Object) null);
|
|
}
|
|
}
|
|
|
|
@MainThread
|
|
public final Observable<Event> getEventSubject() {
|
|
PublishSubject<Event> publishSubject = this.eventSubject;
|
|
m.checkNotNullExpressionValue(publishSubject, "eventSubject");
|
|
return publishSubject;
|
|
}
|
|
|
|
public final long getLaunchPremiumTabStartTimeMs() {
|
|
return this.launchPremiumTabStartTimeMs;
|
|
}
|
|
|
|
@MainThread
|
|
public final void onRetryClicked() {
|
|
fetchData();
|
|
}
|
|
|
|
public final void setLaunchPremiumTabStartTimeMs(long j) {
|
|
this.launchPremiumTabStartTimeMs = j;
|
|
}
|
|
}
|