2021-08-10 21:19:22 +00:00
|
|
|
package com.discord.widgets.hubs;
|
|
|
|
|
|
|
|
import android.content.Context;
|
|
|
|
import androidx.fragment.app.Fragment;
|
|
|
|
import androidx.fragment.app.FragmentViewModelLazyKt;
|
2021-08-13 06:23:11 +00:00
|
|
|
import c.a.d.f0;
|
2021-08-11 06:37:47 +00:00
|
|
|
import c.a.d.h0;
|
2021-08-10 21:19:22 +00:00
|
|
|
import c.d.b.a.a;
|
|
|
|
import com.discord.R;
|
|
|
|
import com.discord.app.AppFragment;
|
|
|
|
import com.discord.databinding.WidgetHubWaitlistBinding;
|
|
|
|
import com.discord.stores.utilities.Loading;
|
|
|
|
import com.discord.stores.utilities.RestCallStateKt;
|
|
|
|
import com.discord.utilities.rx.ObservableExtensionsKt;
|
|
|
|
import com.discord.utilities.view.validators.ValidationManager;
|
|
|
|
import com.discord.utilities.viewbinding.FragmentViewBindingDelegate;
|
|
|
|
import com.discord.utilities.viewbinding.FragmentViewBindingDelegateKt;
|
|
|
|
import com.google.android.material.textfield.TextInputEditText;
|
|
|
|
import d0.g;
|
|
|
|
import d0.z.d.a0;
|
|
|
|
import d0.z.d.m;
|
|
|
|
import kotlin.Lazy;
|
|
|
|
import kotlin.jvm.functions.Function0;
|
|
|
|
import kotlin.jvm.functions.Function1;
|
|
|
|
import kotlin.reflect.KProperty;
|
|
|
|
/* compiled from: WidgetHubWaitlist.kt */
|
|
|
|
public final class WidgetHubWaitlist extends AppFragment {
|
2021-08-25 07:02:36 +00:00
|
|
|
public static final /* synthetic */ KProperty[] $$delegatedProperties = {a.Y(WidgetHubWaitlist.class, "binding", "getBinding()Lcom/discord/databinding/WidgetHubWaitlistBinding;", 0)};
|
2021-08-10 21:19:22 +00:00
|
|
|
private final Lazy args$delegate = g.lazy(new WidgetHubWaitlist$$special$$inlined$args$1(this, "intent_args_key"));
|
|
|
|
private final FragmentViewBindingDelegate binding$delegate = FragmentViewBindingDelegateKt.viewBinding$default(this, WidgetHubWaitlist$binding$2.INSTANCE, null, 2, null);
|
|
|
|
private final Lazy validationManager$delegate;
|
|
|
|
private final Lazy viewModel$delegate;
|
|
|
|
|
|
|
|
public WidgetHubWaitlist() {
|
|
|
|
super(R.layout.widget_hub_waitlist);
|
|
|
|
WidgetHubWaitlist$viewModel$2 widgetHubWaitlist$viewModel$2 = new WidgetHubWaitlist$viewModel$2(this);
|
2021-08-13 06:23:11 +00:00
|
|
|
f0 f0Var = new f0(this);
|
|
|
|
this.viewModel$delegate = FragmentViewModelLazyKt.createViewModelLazy(this, a0.getOrCreateKotlinClass(WidgetHubWaitlistViewModel.class), new WidgetHubWaitlist$appViewModels$$inlined$viewModels$1(f0Var), new h0(widgetHubWaitlist$viewModel$2));
|
2021-08-10 21:19:22 +00:00
|
|
|
this.validationManager$delegate = g.lazy(new WidgetHubWaitlist$validationManager$2(this));
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ void access$configureUI(WidgetHubWaitlist widgetHubWaitlist, HubWaitlistState hubWaitlistState) {
|
|
|
|
widgetHubWaitlist.configureUI(hubWaitlistState);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ void access$maybeSubmitSchoolName(WidgetHubWaitlist widgetHubWaitlist) {
|
|
|
|
widgetHubWaitlist.maybeSubmitSchoolName();
|
|
|
|
}
|
|
|
|
|
|
|
|
private final void configureUI(HubWaitlistState hubWaitlistState) {
|
|
|
|
Context context = getContext();
|
|
|
|
if (context != null) {
|
|
|
|
m.checkNotNullExpressionValue(context, "context ?: return");
|
|
|
|
getBinding().b.setIsLoading(hubWaitlistState.getWaitlistAsync() instanceof Loading);
|
|
|
|
RestCallStateKt.handleResponse$default(hubWaitlistState.getWaitlistAsync(), context, null, null, new WidgetHubWaitlist$configureUI$1(this), 6, null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private final ValidationManager getValidationManager() {
|
|
|
|
return (ValidationManager) this.validationManager$delegate.getValue();
|
|
|
|
}
|
|
|
|
|
|
|
|
private final void maybeSubmitSchoolName() {
|
|
|
|
if (getValidationManager().validate(true)) {
|
|
|
|
WidgetHubWaitlistViewModel viewModel = getViewModel();
|
2021-08-27 06:37:59 +00:00
|
|
|
TextInputEditText textInputEditText = getBinding().f1884c;
|
2021-08-10 21:19:22 +00:00
|
|
|
m.checkNotNullExpressionValue(textInputEditText, "binding.hubWaitlistEditText");
|
|
|
|
viewModel.joinWaitlist(String.valueOf(textInputEditText.getText()));
|
|
|
|
}
|
|
|
|
hideKeyboard(getView());
|
|
|
|
}
|
|
|
|
|
|
|
|
public final HubWaitlistArgs getArgs() {
|
|
|
|
return (HubWaitlistArgs) this.args$delegate.getValue();
|
|
|
|
}
|
|
|
|
|
|
|
|
public final WidgetHubWaitlistBinding getBinding() {
|
|
|
|
return (WidgetHubWaitlistBinding) this.binding$delegate.getValue((Fragment) this, $$delegatedProperties[0]);
|
|
|
|
}
|
|
|
|
|
|
|
|
public final WidgetHubWaitlistViewModel getViewModel() {
|
|
|
|
return (WidgetHubWaitlistViewModel) this.viewModel$delegate.getValue();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.app.AppFragment
|
|
|
|
public void onViewBoundOrOnResume() {
|
|
|
|
super.onViewBoundOrOnResume();
|
2021-08-27 06:37:59 +00:00
|
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui(ObservableExtensionsKt.bindToComponentLifecycle$default(getViewModel().observeViewState(), this, null, 2, null)), WidgetHubWaitlist.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetHubWaitlist$onViewBoundOrOnResume$1(this), 62, (Object) null);
|
2021-08-10 21:19:22 +00:00
|
|
|
getBinding().b.setOnClickListener(new WidgetHubWaitlist$onViewBoundOrOnResume$2(this));
|
|
|
|
}
|
|
|
|
}
|