forked from Juby210/discord-jadx
153 lines
8.6 KiB
Java
153 lines
8.6 KiB
Java
|
package com.discord.widgets.guildscheduledevent;
|
||
|
|
||
|
import android.content.Context;
|
||
|
import android.content.Intent;
|
||
|
import android.view.View;
|
||
|
import android.widget.TextView;
|
||
|
import androidx.fragment.app.Fragment;
|
||
|
import androidx.fragment.app.FragmentViewModelLazyKt;
|
||
|
import c.a.d.f0;
|
||
|
import c.a.d.h0;
|
||
|
import c.a.d.j;
|
||
|
import c.d.b.a.a;
|
||
|
import c0.g;
|
||
|
import c0.z.d.a0;
|
||
|
import c0.z.d.m;
|
||
|
import com.discord.BuildConfig;
|
||
|
import com.discord.R;
|
||
|
import com.discord.app.AppFragment;
|
||
|
import com.discord.databinding.WidgetGuildScheduledEventCreateSuccessBinding;
|
||
|
import com.discord.models.domain.ModelInvite;
|
||
|
import com.discord.models.experiments.domain.Experiment;
|
||
|
import com.discord.utilities.rx.ObservableExtensionsKt;
|
||
|
import com.discord.utilities.viewbinding.FragmentViewBindingDelegate;
|
||
|
import com.discord.utilities.viewbinding.FragmentViewBindingDelegateKt;
|
||
|
import com.discord.views.CheckedSetting;
|
||
|
import com.discord.widgets.guilds.invite.GuildInviteUiHelperKt;
|
||
|
import com.discord.widgets.guilds.invite.WidgetInviteModel;
|
||
|
import com.discord.widgets.guildscheduledevent.WidgetGuildScheduledEventCreateSuccessViewModel;
|
||
|
import kotlin.Lazy;
|
||
|
import kotlin.jvm.functions.Function0;
|
||
|
import kotlin.jvm.functions.Function1;
|
||
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
||
|
import kotlin.reflect.KProperty;
|
||
|
import rx.Observable;
|
||
|
/* compiled from: WidgetGuildScheduledEventCreateSuccess.kt */
|
||
|
public final class WidgetGuildScheduledEventCreateSuccess extends AppFragment {
|
||
|
public static final /* synthetic */ KProperty[] $$delegatedProperties = {a.Z(WidgetGuildScheduledEventCreateSuccess.class, "binding", "getBinding()Lcom/discord/databinding/WidgetGuildScheduledEventCreateSuccessBinding;", 0)};
|
||
|
public static final Companion Companion = new Companion(null);
|
||
|
private final FragmentViewBindingDelegate binding$delegate = FragmentViewBindingDelegateKt.viewBinding$default(this, WidgetGuildScheduledEventCreateSuccess$binding$2.INSTANCE, null, 2, null);
|
||
|
private final Lazy channelId$delegate = g.lazy(new WidgetGuildScheduledEventCreateSuccess$channelId$2(this));
|
||
|
private final Lazy guildId$delegate = g.lazy(new WidgetGuildScheduledEventCreateSuccess$guildId$2(this));
|
||
|
private final Lazy guildScheduledEventId$delegate = g.lazy(new WidgetGuildScheduledEventCreateSuccess$guildScheduledEventId$2(this));
|
||
|
private final Lazy viewModel$delegate;
|
||
|
|
||
|
/* compiled from: WidgetGuildScheduledEventCreateSuccess.kt */
|
||
|
public static final class Companion {
|
||
|
private Companion() {
|
||
|
}
|
||
|
|
||
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
||
|
this();
|
||
|
}
|
||
|
|
||
|
public final void launch(Context context, Long l, long j, long j2) {
|
||
|
m.checkNotNullParameter(context, "context");
|
||
|
Intent intent = new Intent();
|
||
|
intent.putExtra("com.discord.intent.extra.EXTRA_CHANNEL_ID", l);
|
||
|
intent.putExtra("com.discord.intent.extra.EXTRA_GUILD_ID", j);
|
||
|
intent.putExtra("com.discord.intent.extra.EXTRA_GUILD_SCHEDULED_EVENT_ID", j2);
|
||
|
j.d(context, WidgetGuildScheduledEventCreateSuccess.class, intent);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public WidgetGuildScheduledEventCreateSuccess() {
|
||
|
super(R.layout.widget_guild_scheduled_event_create_success);
|
||
|
WidgetGuildScheduledEventCreateSuccess$viewModel$2 widgetGuildScheduledEventCreateSuccess$viewModel$2 = new WidgetGuildScheduledEventCreateSuccess$viewModel$2(this);
|
||
|
f0 f0Var = new f0(this);
|
||
|
this.viewModel$delegate = FragmentViewModelLazyKt.createViewModelLazy(this, a0.getOrCreateKotlinClass(WidgetGuildScheduledEventCreateSuccessViewModel.class), new WidgetGuildScheduledEventCreateSuccess$appViewModels$$inlined$viewModels$1(f0Var), new h0(widgetGuildScheduledEventCreateSuccess$viewModel$2));
|
||
|
}
|
||
|
|
||
|
public static final /* synthetic */ void access$configureUI(WidgetGuildScheduledEventCreateSuccess widgetGuildScheduledEventCreateSuccess, WidgetGuildScheduledEventCreateSuccessViewModel.ViewState.Loaded loaded) {
|
||
|
widgetGuildScheduledEventCreateSuccess.configureUI(loaded);
|
||
|
}
|
||
|
|
||
|
public static final /* synthetic */ WidgetGuildScheduledEventCreateSuccessBinding access$getBinding$p(WidgetGuildScheduledEventCreateSuccess widgetGuildScheduledEventCreateSuccess) {
|
||
|
return widgetGuildScheduledEventCreateSuccess.getBinding();
|
||
|
}
|
||
|
|
||
|
public static final /* synthetic */ Long access$getChannelId$p(WidgetGuildScheduledEventCreateSuccess widgetGuildScheduledEventCreateSuccess) {
|
||
|
return widgetGuildScheduledEventCreateSuccess.getChannelId();
|
||
|
}
|
||
|
|
||
|
public static final /* synthetic */ long access$getGuildId$p(WidgetGuildScheduledEventCreateSuccess widgetGuildScheduledEventCreateSuccess) {
|
||
|
return widgetGuildScheduledEventCreateSuccess.getGuildId();
|
||
|
}
|
||
|
|
||
|
public static final /* synthetic */ long access$getGuildScheduledEventId$p(WidgetGuildScheduledEventCreateSuccess widgetGuildScheduledEventCreateSuccess) {
|
||
|
return widgetGuildScheduledEventCreateSuccess.getGuildScheduledEventId();
|
||
|
}
|
||
|
|
||
|
public static final /* synthetic */ WidgetGuildScheduledEventCreateSuccessViewModel access$getViewModel$p(WidgetGuildScheduledEventCreateSuccess widgetGuildScheduledEventCreateSuccess) {
|
||
|
return widgetGuildScheduledEventCreateSuccess.getViewModel();
|
||
|
}
|
||
|
|
||
|
private final void configureUI(WidgetGuildScheduledEventCreateSuccessViewModel.ViewState.Loaded loaded) {
|
||
|
WidgetInviteModel widgetInviteModel = loaded.getWidgetInviteModel();
|
||
|
ModelInvite invite = widgetInviteModel.getInvite();
|
||
|
TextView textView = getBinding().f2277c;
|
||
|
m.checkNotNullExpressionValue(textView, "binding.guildInviteLink");
|
||
|
textView.setText(getInviteLink(invite));
|
||
|
getBinding().f2277c.setOnClickListener(new WidgetGuildScheduledEventCreateSuccess$configureUI$1(this, invite));
|
||
|
ModelInvite.Settings settings = widgetInviteModel.getSettings();
|
||
|
boolean z2 = settings != null && settings.getMaxAge() == 0;
|
||
|
CheckedSetting checkedSetting = getBinding().d;
|
||
|
m.checkNotNullExpressionValue(checkedSetting, "binding.guildInviteNeverExpire");
|
||
|
checkedSetting.setChecked(z2);
|
||
|
Experiment defaultInviteExperiment = getViewModel().getDefaultInviteExperiment();
|
||
|
CheckedSetting.i(getBinding().d, GuildInviteUiHelperKt.getInviteLinkText(requireContext(), defaultInviteExperiment), false, 2);
|
||
|
getBinding().d.e(new WidgetGuildScheduledEventCreateSuccess$configureUI$2(this, widgetInviteModel, defaultInviteExperiment));
|
||
|
getBinding().b.setOnClickListener(new WidgetGuildScheduledEventCreateSuccess$configureUI$3(this));
|
||
|
getBinding().e.setOnClickListener(new WidgetGuildScheduledEventCreateSuccess$configureUI$4(this, invite));
|
||
|
}
|
||
|
|
||
|
private final WidgetGuildScheduledEventCreateSuccessBinding getBinding() {
|
||
|
return (WidgetGuildScheduledEventCreateSuccessBinding) this.binding$delegate.getValue((Fragment) this, $$delegatedProperties[0]);
|
||
|
}
|
||
|
|
||
|
private final Long getChannelId() {
|
||
|
return (Long) this.channelId$delegate.getValue();
|
||
|
}
|
||
|
|
||
|
private final long getGuildId() {
|
||
|
return ((Number) this.guildId$delegate.getValue()).longValue();
|
||
|
}
|
||
|
|
||
|
private final long getGuildScheduledEventId() {
|
||
|
return ((Number) this.guildScheduledEventId$delegate.getValue()).longValue();
|
||
|
}
|
||
|
|
||
|
private final String getInviteLink(ModelInvite modelInvite) {
|
||
|
return modelInvite == null ? BuildConfig.HOST_INVITE : modelInvite.toLink(getResources(), BuildConfig.HOST_INVITE);
|
||
|
}
|
||
|
|
||
|
private final WidgetGuildScheduledEventCreateSuccessViewModel getViewModel() {
|
||
|
return (WidgetGuildScheduledEventCreateSuccessViewModel) this.viewModel$delegate.getValue();
|
||
|
}
|
||
|
|
||
|
@Override // com.discord.app.AppFragment, androidx.fragment.app.Fragment
|
||
|
public void onResume() {
|
||
|
super.onResume();
|
||
|
Observable<R> F = getViewModel().observeViewState().x(WidgetGuildScheduledEventCreateSuccess$onResume$$inlined$filterIs$1.INSTANCE).F(WidgetGuildScheduledEventCreateSuccess$onResume$$inlined$filterIs$2.INSTANCE);
|
||
|
m.checkNotNullExpressionValue(F, "filter { it is T }.map { it as T }");
|
||
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.bindToComponentLifecycle$default(F, this, null, 2, null), WidgetGuildScheduledEventCreateSuccess.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetGuildScheduledEventCreateSuccess$onResume$1(this), 62, (Object) null);
|
||
|
}
|
||
|
|
||
|
@Override // com.discord.app.AppFragment
|
||
|
public void onViewBound(View view) {
|
||
|
m.checkNotNullParameter(view, "view");
|
||
|
super.onViewBound(view);
|
||
|
getViewModel().generateInviteLink(getChannelId());
|
||
|
}
|
||
|
}
|