407 lines
16 KiB
Smali
407 lines
16 KiB
Smali
|
.class public final Lcom/discord/widgets/servers/communityguild/WidgetServerSettingsCommunityOverviewViewModel;
|
||
|
.super Lf/a/b/q0;
|
||
|
.source "WidgetServerSettingsCommunityOverviewViewModel.kt"
|
||
|
|
||
|
# interfaces
|
||
|
.implements Lcom/discord/app/AppComponent;
|
||
|
|
||
|
|
||
|
# annotations
|
||
|
.annotation system Ldalvik/annotation/MemberClasses;
|
||
|
value = {
|
||
|
Lcom/discord/widgets/servers/communityguild/WidgetServerSettingsCommunityOverviewViewModel$ViewState;,
|
||
|
Lcom/discord/widgets/servers/communityguild/WidgetServerSettingsCommunityOverviewViewModel$StoreState;,
|
||
|
Lcom/discord/widgets/servers/communityguild/WidgetServerSettingsCommunityOverviewViewModel$Event;,
|
||
|
Lcom/discord/widgets/servers/communityguild/WidgetServerSettingsCommunityOverviewViewModel$Factory;
|
||
|
}
|
||
|
.end annotation
|
||
|
|
||
|
.annotation system Ldalvik/annotation/Signature;
|
||
|
value = {
|
||
|
"Lf/a/b/q0<",
|
||
|
"Lcom/discord/widgets/servers/communityguild/WidgetServerSettingsCommunityOverviewViewModel$ViewState;",
|
||
|
">;",
|
||
|
"Lcom/discord/app/AppComponent;"
|
||
|
}
|
||
|
.end annotation
|
||
|
|
||
|
|
||
|
# instance fields
|
||
|
.field public final eventSubject:Lrx/subjects/PublishSubject;
|
||
|
.annotation system Ldalvik/annotation/Signature;
|
||
|
value = {
|
||
|
"Lrx/subjects/PublishSubject<",
|
||
|
"Lcom/discord/widgets/servers/communityguild/WidgetServerSettingsCommunityOverviewViewModel$Event;",
|
||
|
">;"
|
||
|
}
|
||
|
.end annotation
|
||
|
.end field
|
||
|
|
||
|
.field public final guildId:J
|
||
|
|
||
|
.field public final storeStateObservable:Lrx/Observable;
|
||
|
.annotation system Ldalvik/annotation/Signature;
|
||
|
value = {
|
||
|
"Lrx/Observable<",
|
||
|
"Lcom/discord/widgets/servers/communityguild/WidgetServerSettingsCommunityOverviewViewModel$StoreState;",
|
||
|
">;"
|
||
|
}
|
||
|
.end annotation
|
||
|
.end field
|
||
|
|
||
|
|
||
|
# direct methods
|
||
|
.method public constructor <init>(JLrx/Observable;)V
|
||
|
.locals 9
|
||
|
.annotation system Ldalvik/annotation/Signature;
|
||
|
value = {
|
||
|
"(J",
|
||
|
"Lrx/Observable<",
|
||
|
"Lcom/discord/widgets/servers/communityguild/WidgetServerSettingsCommunityOverviewViewModel$StoreState;",
|
||
|
">;)V"
|
||
|
}
|
||
|
.end annotation
|
||
|
|
||
|
const-string v0, "storeStateObservable"
|
||
|
|
||
|
invoke-static {p3, v0}, Lk0/n/c/i;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
|
||
|
|
||
|
sget-object v0, Lcom/discord/widgets/servers/communityguild/WidgetServerSettingsCommunityOverviewViewModel$ViewState$Uninitialized;->INSTANCE:Lcom/discord/widgets/servers/communityguild/WidgetServerSettingsCommunityOverviewViewModel$ViewState$Uninitialized;
|
||
|
|
||
|
invoke-direct {p0, v0}, Lf/a/b/q0;-><init>(Ljava/lang/Object;)V
|
||
|
|
||
|
iput-wide p1, p0, Lcom/discord/widgets/servers/communityguild/WidgetServerSettingsCommunityOverviewViewModel;->guildId:J
|
||
|
|
||
|
iput-object p3, p0, Lcom/discord/widgets/servers/communityguild/WidgetServerSettingsCommunityOverviewViewModel;->storeStateObservable:Lrx/Observable;
|
||
|
|
||
|
invoke-static {}, Lrx/subjects/PublishSubject;->g0()Lrx/subjects/PublishSubject;
|
||
|
|
||
|
move-result-object p1
|
||
|
|
||
|
iput-object p1, p0, Lcom/discord/widgets/servers/communityguild/WidgetServerSettingsCommunityOverviewViewModel;->eventSubject:Lrx/subjects/PublishSubject;
|
||
|
|
||
|
iget-object p1, p0, Lcom/discord/widgets/servers/communityguild/WidgetServerSettingsCommunityOverviewViewModel;->storeStateObservable:Lrx/Observable;
|
||
|
|
||
|
invoke-static {p1}, Lcom/discord/utilities/rx/ObservableExtensionsKt;->computationLatest(Lrx/Observable;)Lrx/Observable;
|
||
|
|
||
|
move-result-object p1
|
||
|
|
||
|
const/4 p2, 0x0
|
||
|
|
||
|
const/4 p3, 0x2
|
||
|
|
||
|
invoke-static {p1, p0, p2, p3, p2}, Lcom/discord/utilities/rx/ObservableExtensionsKt;->ui$default(Lrx/Observable;Lcom/discord/app/AppComponent;Lcom/discord/utilities/mg_recycler/MGRecyclerAdapterSimple;ILjava/lang/Object;)Lrx/Observable;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
const-class v1, Lcom/discord/widgets/servers/communityguild/WidgetServerSettingsCommunityOverviewViewModel;
|
||
|
|
||
|
new-instance v6, Lcom/discord/widgets/servers/communityguild/WidgetServerSettingsCommunityOverviewViewModel$1;
|
||
|
|
||
|
invoke-direct {v6, p0}, Lcom/discord/widgets/servers/communityguild/WidgetServerSettingsCommunityOverviewViewModel$1;-><init>(Lcom/discord/widgets/servers/communityguild/WidgetServerSettingsCommunityOverviewViewModel;)V
|
||
|
|
||
|
const/4 v2, 0x0
|
||
|
|
||
|
const/4 v3, 0x0
|
||
|
|
||
|
const/4 v4, 0x0
|
||
|
|
||
|
const/4 v5, 0x0
|
||
|
|
||
|
const/16 v7, 0x1e
|
||
|
|
||
|
const/4 v8, 0x0
|
||
|
|
||
|
invoke-static/range {v0 .. v8}, 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$getEventSubject$p(Lcom/discord/widgets/servers/communityguild/WidgetServerSettingsCommunityOverviewViewModel;)Lrx/subjects/PublishSubject;
|
||
|
.locals 0
|
||
|
|
||
|
iget-object p0, p0, Lcom/discord/widgets/servers/communityguild/WidgetServerSettingsCommunityOverviewViewModel;->eventSubject:Lrx/subjects/PublishSubject;
|
||
|
|
||
|
return-object p0
|
||
|
.end method
|
||
|
|
||
|
.method public static final synthetic access$handleGuildUpdateError(Lcom/discord/widgets/servers/communityguild/WidgetServerSettingsCommunityOverviewViewModel;)V
|
||
|
.locals 0
|
||
|
|
||
|
invoke-direct {p0}, Lcom/discord/widgets/servers/communityguild/WidgetServerSettingsCommunityOverviewViewModel;->handleGuildUpdateError()V
|
||
|
|
||
|
return-void
|
||
|
.end method
|
||
|
|
||
|
.method public static final synthetic access$handleStoreState(Lcom/discord/widgets/servers/communityguild/WidgetServerSettingsCommunityOverviewViewModel;Lcom/discord/widgets/servers/communityguild/WidgetServerSettingsCommunityOverviewViewModel$StoreState;)V
|
||
|
.locals 0
|
||
|
|
||
|
invoke-direct {p0, p1}, Lcom/discord/widgets/servers/communityguild/WidgetServerSettingsCommunityOverviewViewModel;->handleStoreState(Lcom/discord/widgets/servers/communityguild/WidgetServerSettingsCommunityOverviewViewModel$StoreState;)V
|
||
|
|
||
|
return-void
|
||
|
.end method
|
||
|
|
||
|
.method private final handleGuildUpdateError()V
|
||
|
.locals 2
|
||
|
|
||
|
iget-object v0, p0, Lcom/discord/widgets/servers/communityguild/WidgetServerSettingsCommunityOverviewViewModel;->eventSubject:Lrx/subjects/PublishSubject;
|
||
|
|
||
|
sget-object v1, Lcom/discord/widgets/servers/communityguild/WidgetServerSettingsCommunityOverviewViewModel$Event$Error;->INSTANCE:Lcom/discord/widgets/servers/communityguild/WidgetServerSettingsCommunityOverviewViewModel$Event$Error;
|
||
|
|
||
|
iget-object v0, v0, Lrx/subjects/PublishSubject;->e:Lrx/subjects/PublishSubject$b;
|
||
|
|
||
|
invoke-virtual {v0, v1}, Lrx/subjects/PublishSubject$b;->onNext(Ljava/lang/Object;)V
|
||
|
|
||
|
return-void
|
||
|
.end method
|
||
|
|
||
|
.method private final handleStoreState(Lcom/discord/widgets/servers/communityguild/WidgetServerSettingsCommunityOverviewViewModel$StoreState;)V
|
||
|
.locals 7
|
||
|
|
||
|
instance-of v0, p1, Lcom/discord/widgets/servers/communityguild/WidgetServerSettingsCommunityOverviewViewModel$StoreState$Valid;
|
||
|
|
||
|
if-nez v0, :cond_0
|
||
|
|
||
|
sget-object p1, Lcom/discord/widgets/servers/communityguild/WidgetServerSettingsCommunityOverviewViewModel$ViewState$Invalid;->INSTANCE:Lcom/discord/widgets/servers/communityguild/WidgetServerSettingsCommunityOverviewViewModel$ViewState$Invalid;
|
||
|
|
||
|
invoke-virtual {p0, p1}, Lf/a/b/q0;->updateViewState(Ljava/lang/Object;)V
|
||
|
|
||
|
return-void
|
||
|
|
||
|
:cond_0
|
||
|
check-cast p1, Lcom/discord/widgets/servers/communityguild/WidgetServerSettingsCommunityOverviewViewModel$StoreState$Valid;
|
||
|
|
||
|
invoke-virtual {p1}, Lcom/discord/widgets/servers/communityguild/WidgetServerSettingsCommunityOverviewViewModel$StoreState$Valid;->getGuild()Lcom/discord/models/domain/ModelGuild;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
invoke-virtual {p1}, Lcom/discord/widgets/servers/communityguild/WidgetServerSettingsCommunityOverviewViewModel$StoreState$Valid;->getMe()Lcom/discord/models/domain/ModelUser;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
invoke-virtual {p1}, Lcom/discord/widgets/servers/communityguild/WidgetServerSettingsCommunityOverviewViewModel$StoreState$Valid;->getPermissions()Ljava/lang/Long;
|
||
|
|
||
|
move-result-object v2
|
||
|
|
||
|
invoke-virtual {p1}, Lcom/discord/widgets/servers/communityguild/WidgetServerSettingsCommunityOverviewViewModel$StoreState$Valid;->getRulesChannel()Lcom/discord/models/domain/ModelChannel;
|
||
|
|
||
|
move-result-object v3
|
||
|
|
||
|
invoke-virtual {p1}, Lcom/discord/widgets/servers/communityguild/WidgetServerSettingsCommunityOverviewViewModel$StoreState$Valid;->getUpdatesChannel()Lcom/discord/models/domain/ModelChannel;
|
||
|
|
||
|
move-result-object p1
|
||
|
|
||
|
invoke-virtual {v1}, Lcom/discord/models/domain/ModelUser;->getId()J
|
||
|
|
||
|
move-result-wide v4
|
||
|
|
||
|
invoke-virtual {v0, v4, v5}, Lcom/discord/models/domain/ModelGuild;->isOwner(J)Z
|
||
|
|
||
|
move-result v4
|
||
|
|
||
|
if-nez v4, :cond_2
|
||
|
|
||
|
const-wide/16 v4, 0x20
|
||
|
|
||
|
invoke-virtual {v1}, Lcom/discord/models/domain/ModelUser;->isMfaEnabled()Z
|
||
|
|
||
|
move-result v1
|
||
|
|
||
|
invoke-virtual {v0}, Lcom/discord/models/domain/ModelGuild;->getMfaLevel()I
|
||
|
|
||
|
move-result v6
|
||
|
|
||
|
invoke-static {v4, v5, v2, v1, v6}, Lcom/discord/utilities/permissions/PermissionUtils;->canAndIsElevated(JLjava/lang/Long;ZI)Z
|
||
|
|
||
|
move-result v1
|
||
|
|
||
|
if-eqz v1, :cond_1
|
||
|
|
||
|
goto :goto_0
|
||
|
|
||
|
:cond_1
|
||
|
const/4 v1, 0x0
|
||
|
|
||
|
goto :goto_1
|
||
|
|
||
|
:cond_2
|
||
|
:goto_0
|
||
|
const/4 v1, 0x1
|
||
|
|
||
|
:goto_1
|
||
|
if-nez v1, :cond_3
|
||
|
|
||
|
sget-object p1, Lcom/discord/widgets/servers/communityguild/WidgetServerSettingsCommunityOverviewViewModel$ViewState$Invalid;->INSTANCE:Lcom/discord/widgets/servers/communityguild/WidgetServerSettingsCommunityOverviewViewModel$ViewState$Invalid;
|
||
|
|
||
|
invoke-virtual {p0, p1}, Lf/a/b/q0;->updateViewState(Ljava/lang/Object;)V
|
||
|
|
||
|
return-void
|
||
|
|
||
|
:cond_3
|
||
|
new-instance v1, Lcom/discord/widgets/servers/communityguild/WidgetServerSettingsCommunityOverviewViewModel$ViewState$Loaded;
|
||
|
|
||
|
invoke-direct {v1, v0, v3, p1}, Lcom/discord/widgets/servers/communityguild/WidgetServerSettingsCommunityOverviewViewModel$ViewState$Loaded;-><init>(Lcom/discord/models/domain/ModelGuild;Lcom/discord/models/domain/ModelChannel;Lcom/discord/models/domain/ModelChannel;)V
|
||
|
|
||
|
invoke-virtual {p0, v1}, Lf/a/b/q0;->updateViewState(Ljava/lang/Object;)V
|
||
|
|
||
|
return-void
|
||
|
.end method
|
||
|
|
||
|
.method private final saveCommunityGuildSettings(Lcom/discord/restapi/RestAPIParams$UpdatePublicGuild;)V
|
||
|
.locals 12
|
||
|
|
||
|
sget-object v0, Lcom/discord/utilities/rest/RestAPI;->Companion:Lcom/discord/utilities/rest/RestAPI$Companion;
|
||
|
|
||
|
invoke-virtual {v0}, Lcom/discord/utilities/rest/RestAPI$Companion;->getApi()Lcom/discord/utilities/rest/RestAPI;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
iget-wide v1, p0, Lcom/discord/widgets/servers/communityguild/WidgetServerSettingsCommunityOverviewViewModel;->guildId:J
|
||
|
|
||
|
invoke-virtual {v0, v1, v2, p1}, Lcom/discord/utilities/rest/RestAPI;->updatePublicGuild(JLcom/discord/restapi/RestAPIParams$UpdatePublicGuild;)Lrx/Observable;
|
||
|
|
||
|
move-result-object p1
|
||
|
|
||
|
const/4 v0, 0x0
|
||
|
|
||
|
const/4 v1, 0x1
|
||
|
|
||
|
const/4 v2, 0x0
|
||
|
|
||
|
invoke-static {p1, v0, v1, v2}, Lcom/discord/utilities/rx/ObservableExtensionsKt;->restSubscribeOn$default(Lrx/Observable;ZILjava/lang/Object;)Lrx/Observable;
|
||
|
|
||
|
move-result-object p1
|
||
|
|
||
|
const/4 v0, 0x2
|
||
|
|
||
|
invoke-static {p1, p0, v2, v0, v2}, Lcom/discord/utilities/rx/ObservableExtensionsKt;->ui$default(Lrx/Observable;Lcom/discord/app/AppComponent;Lcom/discord/utilities/mg_recycler/MGRecyclerAdapterSimple;ILjava/lang/Object;)Lrx/Observable;
|
||
|
|
||
|
move-result-object v3
|
||
|
|
||
|
const-class v4, Lcom/discord/widgets/servers/communityguild/WidgetServerSettingsCommunityOverviewViewModel;
|
||
|
|
||
|
new-instance v7, Lcom/discord/widgets/servers/communityguild/WidgetServerSettingsCommunityOverviewViewModel$saveCommunityGuildSettings$1;
|
||
|
|
||
|
invoke-direct {v7, p0}, Lcom/discord/widgets/servers/communityguild/WidgetServerSettingsCommunityOverviewViewModel$saveCommunityGuildSettings$1;-><init>(Lcom/discord/widgets/servers/communityguild/WidgetServerSettingsCommunityOverviewViewModel;)V
|
||
|
|
||
|
new-instance v9, Lcom/discord/widgets/servers/communityguild/WidgetServerSettingsCommunityOverviewViewModel$saveCommunityGuildSettings$2;
|
||
|
|
||
|
invoke-direct {v9, p0}, Lcom/discord/widgets/servers/communityguild/WidgetServerSettingsCommunityOverviewViewModel$saveCommunityGuildSettings$2;-><init>(Lcom/discord/widgets/servers/communityguild/WidgetServerSettingsCommunityOverviewViewModel;)V
|
||
|
|
||
|
const/4 v5, 0x0
|
||
|
|
||
|
const/4 v6, 0x0
|
||
|
|
||
|
const/4 v8, 0x0
|
||
|
|
||
|
const/16 v10, 0x16
|
||
|
|
||
|
const/4 v11, 0x0
|
||
|
|
||
|
invoke-static/range {v3 .. v11}, 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
|
||
|
|
||
|
|
||
|
# virtual methods
|
||
|
.method public final observeEvents()Lrx/Observable;
|
||
|
.locals 2
|
||
|
.annotation system Ldalvik/annotation/Signature;
|
||
|
value = {
|
||
|
"()",
|
||
|
"Lrx/Observable<",
|
||
|
"Lcom/discord/widgets/servers/communityguild/WidgetServerSettingsCommunityOverviewViewModel$Event;",
|
||
|
">;"
|
||
|
}
|
||
|
.end annotation
|
||
|
|
||
|
iget-object v0, p0, Lcom/discord/widgets/servers/communityguild/WidgetServerSettingsCommunityOverviewViewModel;->eventSubject:Lrx/subjects/PublishSubject;
|
||
|
|
||
|
const-string v1, "eventSubject"
|
||
|
|
||
|
invoke-static {v0, v1}, Lk0/n/c/i;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V
|
||
|
|
||
|
return-object v0
|
||
|
.end method
|
||
|
|
||
|
.method public final saveCommunityUpdatesChannel(J)V
|
||
|
.locals 7
|
||
|
|
||
|
new-instance v6, Lcom/discord/restapi/RestAPIParams$UpdatePublicGuild;
|
||
|
|
||
|
invoke-static {p1, p2}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;
|
||
|
|
||
|
move-result-object v2
|
||
|
|
||
|
const/4 v1, 0x0
|
||
|
|
||
|
const/4 v3, 0x0
|
||
|
|
||
|
const/4 v4, 0x5
|
||
|
|
||
|
const/4 v5, 0x0
|
||
|
|
||
|
move-object v0, v6
|
||
|
|
||
|
invoke-direct/range {v0 .. v5}, Lcom/discord/restapi/RestAPIParams$UpdatePublicGuild;-><init>(Ljava/lang/Long;Ljava/lang/Long;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||
|
|
||
|
invoke-direct {p0, v6}, Lcom/discord/widgets/servers/communityguild/WidgetServerSettingsCommunityOverviewViewModel;->saveCommunityGuildSettings(Lcom/discord/restapi/RestAPIParams$UpdatePublicGuild;)V
|
||
|
|
||
|
return-void
|
||
|
.end method
|
||
|
|
||
|
.method public final saveLocale(Ljava/lang/String;)V
|
||
|
.locals 7
|
||
|
|
||
|
const-string v0, "locale"
|
||
|
|
||
|
invoke-static {p1, v0}, Lk0/n/c/i;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
|
||
|
|
||
|
new-instance v0, Lcom/discord/restapi/RestAPIParams$UpdatePublicGuild;
|
||
|
|
||
|
const/4 v2, 0x0
|
||
|
|
||
|
const/4 v3, 0x0
|
||
|
|
||
|
const/4 v5, 0x3
|
||
|
|
||
|
const/4 v6, 0x0
|
||
|
|
||
|
move-object v1, v0
|
||
|
|
||
|
move-object v4, p1
|
||
|
|
||
|
invoke-direct/range {v1 .. v6}, Lcom/discord/restapi/RestAPIParams$UpdatePublicGuild;-><init>(Ljava/lang/Long;Ljava/lang/Long;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||
|
|
||
|
invoke-direct {p0, v0}, Lcom/discord/widgets/servers/communityguild/WidgetServerSettingsCommunityOverviewViewModel;->saveCommunityGuildSettings(Lcom/discord/restapi/RestAPIParams$UpdatePublicGuild;)V
|
||
|
|
||
|
return-void
|
||
|
.end method
|
||
|
|
||
|
.method public final saveRulesChannel(J)V
|
||
|
.locals 7
|
||
|
|
||
|
new-instance v6, Lcom/discord/restapi/RestAPIParams$UpdatePublicGuild;
|
||
|
|
||
|
invoke-static {p1, p2}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
const/4 v2, 0x0
|
||
|
|
||
|
const/4 v3, 0x0
|
||
|
|
||
|
const/4 v4, 0x6
|
||
|
|
||
|
const/4 v5, 0x0
|
||
|
|
||
|
move-object v0, v6
|
||
|
|
||
|
invoke-direct/range {v0 .. v5}, Lcom/discord/restapi/RestAPIParams$UpdatePublicGuild;-><init>(Ljava/lang/Long;Ljava/lang/Long;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||
|
|
||
|
invoke-direct {p0, v6}, Lcom/discord/widgets/servers/communityguild/WidgetServerSettingsCommunityOverviewViewModel;->saveCommunityGuildSettings(Lcom/discord/restapi/RestAPIParams$UpdatePublicGuild;)V
|
||
|
|
||
|
return-void
|
||
|
.end method
|