400 lines
16 KiB
Smali
400 lines
16 KiB
Smali
.class public final Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel;
|
|
.super Landroidx/lifecycle/ViewModel;
|
|
.source "WidgetSettingsGiftingViewModel.kt"
|
|
|
|
|
|
# annotations
|
|
.annotation system Ldalvik/annotation/MemberClasses;
|
|
value = {
|
|
Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel$ViewState;,
|
|
Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel$ResolvingGiftState;
|
|
}
|
|
.end annotation
|
|
|
|
|
|
# instance fields
|
|
.field private redeemingSubscription:Lrx/Subscription;
|
|
|
|
.field private resolvingGiftState:Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel$ResolvingGiftState;
|
|
|
|
.field private resolvingGiftStateSubject:Lrx/subjects/BehaviorSubject;
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"Lrx/subjects/BehaviorSubject<",
|
|
"Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel$ResolvingGiftState;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
.end field
|
|
|
|
.field private subscription:Lrx/Subscription;
|
|
|
|
.field private final viewStateSubject:Lrx/subjects/BehaviorSubject;
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"Lrx/subjects/BehaviorSubject<",
|
|
"Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel$ViewState;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
.end field
|
|
|
|
|
|
# direct methods
|
|
.method public constructor <init>()V
|
|
.locals 11
|
|
|
|
invoke-direct {p0}, Landroidx/lifecycle/ViewModel;-><init>()V
|
|
|
|
sget-object v0, Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel$ViewState$Loading;->INSTANCE:Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel$ViewState$Loading;
|
|
|
|
invoke-static {v0}, Lrx/subjects/BehaviorSubject;->bS(Ljava/lang/Object;)Lrx/subjects/BehaviorSubject;
|
|
|
|
move-result-object v0
|
|
|
|
iput-object v0, p0, Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel;->viewStateSubject:Lrx/subjects/BehaviorSubject;
|
|
|
|
sget-object v0, Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel$ResolvingGiftState$NotResolving;->INSTANCE:Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel$ResolvingGiftState$NotResolving;
|
|
|
|
check-cast v0, Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel$ResolvingGiftState;
|
|
|
|
iput-object v0, p0, Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel;->resolvingGiftState:Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel$ResolvingGiftState;
|
|
|
|
iget-object v0, p0, Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel;->resolvingGiftState:Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel$ResolvingGiftState;
|
|
|
|
invoke-static {v0}, Lrx/subjects/BehaviorSubject;->bS(Ljava/lang/Object;)Lrx/subjects/BehaviorSubject;
|
|
|
|
move-result-object v0
|
|
|
|
iput-object v0, p0, Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel;->resolvingGiftStateSubject:Lrx/subjects/BehaviorSubject;
|
|
|
|
sget-object v0, Lcom/discord/stores/StoreEntitlements$Actions;->INSTANCE:Lcom/discord/stores/StoreEntitlements$Actions;
|
|
|
|
invoke-virtual {v0}, Lcom/discord/stores/StoreEntitlements$Actions;->fetchMyGifts()V
|
|
|
|
sget-object v0, Ljava/util/concurrent/TimeUnit;->MILLISECONDS:Ljava/util/concurrent/TimeUnit;
|
|
|
|
const-wide/16 v1, 0x32
|
|
|
|
invoke-static {v1, v2, v0}, Lrx/Observable;->g(JLjava/util/concurrent/TimeUnit;)Lrx/Observable;
|
|
|
|
move-result-object v0
|
|
|
|
new-instance v1, Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel$1;
|
|
|
|
invoke-direct {v1, p0}, Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel$1;-><init>(Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel;)V
|
|
|
|
check-cast v1, Lrx/functions/b;
|
|
|
|
invoke-virtual {v0, v1}, Lrx/Observable;->g(Lrx/functions/b;)Lrx/Observable;
|
|
|
|
move-result-object v2
|
|
|
|
const-string v0, "Observable.timer(50, Tim\u2026ingGiftState) }\n }"
|
|
|
|
invoke-static {v2, v0}, Lkotlin/jvm/internal/k;->g(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
const-class v3, Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel;
|
|
|
|
new-instance v0, Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel$2;
|
|
|
|
move-object v1, p0
|
|
|
|
check-cast v1, Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel;
|
|
|
|
invoke-direct {v0, v1}, Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel$2;-><init>(Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel;)V
|
|
|
|
move-object v8, v0
|
|
|
|
check-cast v8, Lkotlin/jvm/functions/Function1;
|
|
|
|
new-instance v0, Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel$3;
|
|
|
|
invoke-direct {v0, p0}, Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel$3;-><init>(Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel;)V
|
|
|
|
move-object v5, v0
|
|
|
|
check-cast v5, Lkotlin/jvm/functions/Function1;
|
|
|
|
const/4 v4, 0x0
|
|
|
|
const/4 v6, 0x0
|
|
|
|
const/4 v7, 0x0
|
|
|
|
const/16 v9, 0x1a
|
|
|
|
const/4 v10, 0x0
|
|
|
|
invoke-static/range {v2 .. v10}, Lcom/discord/utilities/rx/ObservableExtensionsKt;->appSubscribe$default(Lrx/Observable;Ljava/lang/Class;Landroid/content/Context;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public static final synthetic access$buildViewState(Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel;Lcom/discord/stores/StoreEntitlements$State;Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel$ResolvingGiftState;)Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel$ViewState;
|
|
.locals 0
|
|
|
|
invoke-direct {p0, p1, p2}, Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel;->buildViewState(Lcom/discord/stores/StoreEntitlements$State;Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel$ResolvingGiftState;)Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel$ViewState;
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static final synthetic access$getRedeemingSubscription$p(Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel;)Lrx/Subscription;
|
|
.locals 0
|
|
|
|
iget-object p0, p0, Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel;->redeemingSubscription:Lrx/Subscription;
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static final synthetic access$getResolvingGiftStateSubject$p(Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel;)Lrx/subjects/BehaviorSubject;
|
|
.locals 0
|
|
|
|
iget-object p0, p0, Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel;->resolvingGiftStateSubject:Lrx/subjects/BehaviorSubject;
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static final synthetic access$getSubscription$p(Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel;)Lrx/Subscription;
|
|
.locals 1
|
|
|
|
iget-object p0, p0, Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel;->subscription:Lrx/Subscription;
|
|
|
|
if-nez p0, :cond_0
|
|
|
|
const-string v0, "subscription"
|
|
|
|
invoke-static {v0}, Lkotlin/jvm/internal/k;->dR(Ljava/lang/String;)V
|
|
|
|
:cond_0
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static final synthetic access$publish(Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel;Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel$ViewState;)V
|
|
.locals 0
|
|
|
|
invoke-direct {p0, p1}, Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel;->publish(Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel$ViewState;)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public static final synthetic access$setRedeemingSubscription$p(Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel;Lrx/Subscription;)V
|
|
.locals 0
|
|
|
|
iput-object p1, p0, Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel;->redeemingSubscription:Lrx/Subscription;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public static final synthetic access$setResolvingGiftStateSubject$p(Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel;Lrx/subjects/BehaviorSubject;)V
|
|
.locals 0
|
|
|
|
iput-object p1, p0, Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel;->resolvingGiftStateSubject:Lrx/subjects/BehaviorSubject;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public static final synthetic access$setSubscription$p(Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel;Lrx/Subscription;)V
|
|
.locals 0
|
|
|
|
iput-object p1, p0, Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel;->subscription:Lrx/Subscription;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method private final buildViewState(Lcom/discord/stores/StoreEntitlements$State;Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel$ResolvingGiftState;)Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel$ViewState;
|
|
.locals 1
|
|
|
|
instance-of v0, p1, Lcom/discord/stores/StoreEntitlements$State$Loading;
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
sget-object p1, Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel$ViewState$Loading;->INSTANCE:Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel$ViewState$Loading;
|
|
|
|
check-cast p1, Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel$ViewState;
|
|
|
|
return-object p1
|
|
|
|
:cond_0
|
|
instance-of v0, p1, Lcom/discord/stores/StoreEntitlements$State$Failure;
|
|
|
|
if-eqz v0, :cond_1
|
|
|
|
sget-object p1, Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel$ViewState$Failure;->INSTANCE:Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel$ViewState$Failure;
|
|
|
|
check-cast p1, Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel$ViewState;
|
|
|
|
return-object p1
|
|
|
|
:cond_1
|
|
instance-of v0, p1, Lcom/discord/stores/StoreEntitlements$State$Loaded;
|
|
|
|
if-eqz v0, :cond_2
|
|
|
|
new-instance v0, Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel$ViewState$Loaded;
|
|
|
|
check-cast p1, Lcom/discord/stores/StoreEntitlements$State$Loaded;
|
|
|
|
invoke-virtual {p1}, Lcom/discord/stores/StoreEntitlements$State$Loaded;->getGiftEntitlementMap()Ljava/util/Map;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-direct {v0, p1, p2}, Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel$ViewState$Loaded;-><init>(Ljava/util/Map;Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel$ResolvingGiftState;)V
|
|
|
|
check-cast v0, Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel$ViewState;
|
|
|
|
return-object v0
|
|
|
|
:cond_2
|
|
new-instance p1, Lkotlin/k;
|
|
|
|
invoke-direct {p1}, Lkotlin/k;-><init>()V
|
|
|
|
throw p1
|
|
.end method
|
|
|
|
.method private final publish(Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel$ViewState;)V
|
|
.locals 1
|
|
|
|
iget-object v0, p0, Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel;->viewStateSubject:Lrx/subjects/BehaviorSubject;
|
|
|
|
invoke-virtual {v0, p1}, Lrx/subjects/BehaviorSubject;->onNext(Ljava/lang/Object;)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public final getViewState()Lrx/Observable;
|
|
.locals 2
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"()",
|
|
"Lrx/Observable<",
|
|
"Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel$ViewState;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
|
|
iget-object v0, p0, Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel;->viewStateSubject:Lrx/subjects/BehaviorSubject;
|
|
|
|
const-string v1, "viewStateSubject"
|
|
|
|
invoke-static {v0, v1}, Lkotlin/jvm/internal/k;->g(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
check-cast v0, Lrx/Observable;
|
|
|
|
return-object v0
|
|
.end method
|
|
|
|
.method public final onCleared()V
|
|
.locals 2
|
|
|
|
invoke-super {p0}, Landroidx/lifecycle/ViewModel;->onCleared()V
|
|
|
|
iget-object v0, p0, Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel;->subscription:Lrx/Subscription;
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
const-string v1, "subscription"
|
|
|
|
invoke-static {v1}, Lkotlin/jvm/internal/k;->dR(Ljava/lang/String;)V
|
|
|
|
:cond_0
|
|
invoke-interface {v0}, Lrx/Subscription;->unsubscribe()V
|
|
|
|
iget-object v0, p0, Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel;->redeemingSubscription:Lrx/Subscription;
|
|
|
|
if-eqz v0, :cond_1
|
|
|
|
invoke-interface {v0}, Lrx/Subscription;->unsubscribe()V
|
|
|
|
:cond_1
|
|
return-void
|
|
.end method
|
|
|
|
.method public final redeemGiftCode(Ljava/lang/String;)V
|
|
.locals 11
|
|
|
|
const-string v0, "giftCode"
|
|
|
|
invoke-static {p1, v0}, Lkotlin/jvm/internal/k;->h(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
iget-object v0, p0, Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel;->viewStateSubject:Lrx/subjects/BehaviorSubject;
|
|
|
|
sget-object v1, Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel$redeemGiftCode$1;->INSTANCE:Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel$redeemGiftCode$1;
|
|
|
|
check-cast v1, Lrx/functions/b;
|
|
|
|
invoke-virtual {v0, v1}, Lrx/subjects/BehaviorSubject;->b(Lrx/functions/b;)Lrx/Observable;
|
|
|
|
move-result-object v2
|
|
|
|
const-string v0, "viewStateSubject\n \u2026 it is ViewState.Loaded }"
|
|
|
|
invoke-static {v2, v0}, Lkotlin/jvm/internal/k;->g(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
const-wide/16 v3, 0x0
|
|
|
|
const/4 v5, 0x0
|
|
|
|
const/4 v6, 0x3
|
|
|
|
const/4 v7, 0x0
|
|
|
|
invoke-static/range {v2 .. v7}, Lcom/discord/utilities/rx/ObservableExtensionsKt;->takeSingleUntilTimeout$default(Lrx/Observable;JZILjava/lang/Object;)Lrx/Observable;
|
|
|
|
move-result-object v0
|
|
|
|
new-instance v1, Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel$redeemGiftCode$2;
|
|
|
|
invoke-direct {v1, p0, p1}, Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel$redeemGiftCode$2;-><init>(Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel;Ljava/lang/String;)V
|
|
|
|
check-cast v1, Lrx/functions/b;
|
|
|
|
invoke-virtual {v0, v1}, Lrx/Observable;->g(Lrx/functions/b;)Lrx/Observable;
|
|
|
|
move-result-object v2
|
|
|
|
const-string p1, "viewStateSubject\n \u2026 }\n }"
|
|
|
|
invoke-static {v2, p1}, Lkotlin/jvm/internal/k;->g(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
invoke-virtual {p0}, Ljava/lang/Object;->getClass()Ljava/lang/Class;
|
|
|
|
move-result-object v3
|
|
|
|
new-instance p1, Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel$redeemGiftCode$3;
|
|
|
|
invoke-direct {p1, p0}, Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel$redeemGiftCode$3;-><init>(Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel;)V
|
|
|
|
move-object v5, p1
|
|
|
|
check-cast v5, Lkotlin/jvm/functions/Function1;
|
|
|
|
new-instance p1, Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel$redeemGiftCode$4;
|
|
|
|
move-object v0, p0
|
|
|
|
check-cast v0, Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel;
|
|
|
|
invoke-direct {p1, v0}, Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel$redeemGiftCode$4;-><init>(Lcom/discord/widgets/settings/nitro/WidgetSettingsGiftingViewModel;)V
|
|
|
|
move-object v8, p1
|
|
|
|
check-cast v8, Lkotlin/jvm/functions/Function1;
|
|
|
|
const/4 v4, 0x0
|
|
|
|
const/4 v6, 0x0
|
|
|
|
const/16 v9, 0x1a
|
|
|
|
const/4 v10, 0x0
|
|
|
|
invoke-static/range {v2 .. v10}, Lcom/discord/utilities/rx/ObservableExtensionsKt;->appSubscribe$default(Lrx/Observable;Ljava/lang/Class;Landroid/content/Context;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)V
|
|
|
|
return-void
|
|
.end method
|