2021-08-09 22:50:52 +00:00
|
|
|
package com.discord.widgets.feedback;
|
|
|
|
|
|
|
|
import android.content.Context;
|
|
|
|
import android.content.DialogInterface;
|
|
|
|
import android.os.Bundle;
|
|
|
|
import androidx.core.widget.NestedScrollView;
|
|
|
|
import androidx.fragment.app.Fragment;
|
|
|
|
import androidx.fragment.app.FragmentViewModelLazyKt;
|
2021-08-18 07:29:27 +00:00
|
|
|
import c.a.d.f0;
|
|
|
|
import c.a.d.h0;
|
2021-08-09 22:50:52 +00:00
|
|
|
import c.d.b.a.a;
|
|
|
|
import com.discord.R;
|
|
|
|
import com.discord.app.AppBottomSheet;
|
|
|
|
import com.discord.databinding.WidgetFeedbackSheetBinding;
|
|
|
|
import com.discord.utilities.rx.ObservableExtensionsKt;
|
|
|
|
import com.discord.utilities.viewbinding.FragmentViewBindingDelegate;
|
|
|
|
import com.discord.utilities.viewbinding.FragmentViewBindingDelegateKt;
|
|
|
|
import com.discord.widgets.feedback.FeedbackSheetViewModel;
|
|
|
|
import com.discord.widgets.guild_delete_feedback.GuildDeleteFeedbackSheetViewModel;
|
|
|
|
import com.discord.widgets.voice.feedback.FeedbackRating;
|
|
|
|
import com.discord.widgets.voice.feedback.FeedbackView;
|
|
|
|
import com.discord.widgets.voice.feedback.WidgetIssueDetailsForm;
|
|
|
|
import com.discord.widgets.voice.feedback.call.CallFeedbackSheetViewModel;
|
|
|
|
import com.discord.widgets.voice.feedback.stream.StreamFeedbackSheetViewModel;
|
|
|
|
import d0.z.d.a0;
|
|
|
|
import d0.z.d.m;
|
|
|
|
import java.io.Serializable;
|
|
|
|
import java.util.Objects;
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
import kotlin.Lazy;
|
|
|
|
import kotlin.NoWhenBranchMatchedException;
|
|
|
|
import kotlin.Unit;
|
|
|
|
import kotlin.jvm.functions.Function0;
|
|
|
|
import kotlin.jvm.functions.Function1;
|
|
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
|
|
import kotlin.reflect.KProperty;
|
|
|
|
import rx.Observable;
|
|
|
|
import rx.subscriptions.CompositeSubscription;
|
|
|
|
/* compiled from: WidgetFeedbackSheet.kt */
|
|
|
|
public final class WidgetFeedbackSheet extends AppBottomSheet {
|
2021-08-18 07:29:27 +00:00
|
|
|
public static final /* synthetic */ KProperty[] $$delegatedProperties = {a.W(WidgetFeedbackSheet.class, "binding", "getBinding()Lcom/discord/databinding/WidgetFeedbackSheetBinding;", 0)};
|
2021-08-09 22:50:52 +00:00
|
|
|
public static final String ARG_CALL_FEEDBACK_CONFIG = "ARG_CONFIG";
|
|
|
|
public static final String ARG_FEEDBACK_TYPE = "ARG_FEEDBACK_TYPE";
|
|
|
|
public static final String ARG_GUILD_DELETE_FEEDBACK_GUILD_ID = "ARG_GUILD_DELETE_FEEDBACK_GUILD_ID";
|
|
|
|
public static final String ARG_STREAM_FEEDBACK_MEDIA_SESSION_ID = "ARG_STREAM_FEEDBACK_MEDIA_SESSION_ID";
|
|
|
|
public static final String ARG_STREAM_FEEDBACK_STREAM_KEY = "ARG_STREAM_FEEDBACK_STREAM_KEY ";
|
|
|
|
public static final Companion Companion = new Companion(null);
|
|
|
|
private static final long SHEET_DISMISS_DELAY_MS = 600;
|
|
|
|
private static final long SHEET_EXPAND_DELAY_MS = 100;
|
|
|
|
private final FragmentViewBindingDelegate binding$delegate = FragmentViewBindingDelegateKt.viewBinding$default(this, WidgetFeedbackSheet$binding$2.INSTANCE, null, 2, null);
|
|
|
|
private boolean isShowingFeedbackIssues;
|
|
|
|
private Function0<Unit> onDismissed = WidgetFeedbackSheet$onDismissed$1.INSTANCE;
|
|
|
|
private final Lazy viewModelCallFeedbackSheet$delegate;
|
|
|
|
private final Lazy viewModelGuildDeleteFeedbackSheet$delegate;
|
|
|
|
private final Lazy viewModelStreamFeedbackSheet$delegate;
|
|
|
|
|
|
|
|
/* compiled from: WidgetFeedbackSheet.kt */
|
|
|
|
public static final class Companion {
|
|
|
|
private Companion() {
|
|
|
|
}
|
|
|
|
|
|
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
|
|
this();
|
|
|
|
}
|
|
|
|
|
|
|
|
public final WidgetFeedbackSheet newInstance(FeedbackType feedbackType) {
|
|
|
|
m.checkNotNullParameter(feedbackType, "feedbackType");
|
|
|
|
WidgetFeedbackSheet widgetFeedbackSheet = new WidgetFeedbackSheet();
|
|
|
|
Bundle bundle = new Bundle();
|
|
|
|
bundle.putSerializable(WidgetFeedbackSheet.ARG_FEEDBACK_TYPE, feedbackType);
|
|
|
|
widgetFeedbackSheet.setArguments(bundle);
|
|
|
|
return widgetFeedbackSheet;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: WidgetFeedbackSheet.kt */
|
|
|
|
public enum FeedbackType {
|
|
|
|
CALL,
|
|
|
|
STREAM,
|
|
|
|
GUILD_DELETE
|
|
|
|
}
|
|
|
|
|
|
|
|
public final /* synthetic */ class WhenMappings {
|
|
|
|
public static final /* synthetic */ int[] $EnumSwitchMapping$0;
|
|
|
|
|
|
|
|
static {
|
|
|
|
FeedbackType.values();
|
|
|
|
int[] iArr = new int[3];
|
|
|
|
$EnumSwitchMapping$0 = iArr;
|
|
|
|
iArr[FeedbackType.CALL.ordinal()] = 1;
|
|
|
|
iArr[FeedbackType.STREAM.ordinal()] = 2;
|
|
|
|
iArr[FeedbackType.GUILD_DELETE.ordinal()] = 3;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public WidgetFeedbackSheet() {
|
|
|
|
super(false, 1, null);
|
|
|
|
WidgetFeedbackSheet$viewModelCallFeedbackSheet$2 widgetFeedbackSheet$viewModelCallFeedbackSheet$2 = new WidgetFeedbackSheet$viewModelCallFeedbackSheet$2(this);
|
2021-08-18 07:29:27 +00:00
|
|
|
f0 f0Var = new f0(this);
|
|
|
|
this.viewModelCallFeedbackSheet$delegate = FragmentViewModelLazyKt.createViewModelLazy(this, a0.getOrCreateKotlinClass(CallFeedbackSheetViewModel.class), new WidgetFeedbackSheet$appViewModels$$inlined$viewModels$1(f0Var), new h0(widgetFeedbackSheet$viewModelCallFeedbackSheet$2));
|
2021-08-09 22:50:52 +00:00
|
|
|
WidgetFeedbackSheet$viewModelStreamFeedbackSheet$2 widgetFeedbackSheet$viewModelStreamFeedbackSheet$2 = new WidgetFeedbackSheet$viewModelStreamFeedbackSheet$2(this);
|
2021-08-18 07:29:27 +00:00
|
|
|
f0 f0Var2 = new f0(this);
|
|
|
|
this.viewModelStreamFeedbackSheet$delegate = FragmentViewModelLazyKt.createViewModelLazy(this, a0.getOrCreateKotlinClass(StreamFeedbackSheetViewModel.class), new WidgetFeedbackSheet$appViewModels$$inlined$viewModels$2(f0Var2), new h0(widgetFeedbackSheet$viewModelStreamFeedbackSheet$2));
|
2021-08-09 22:50:52 +00:00
|
|
|
WidgetFeedbackSheet$viewModelGuildDeleteFeedbackSheet$2 widgetFeedbackSheet$viewModelGuildDeleteFeedbackSheet$2 = new WidgetFeedbackSheet$viewModelGuildDeleteFeedbackSheet$2(this);
|
2021-08-18 07:29:27 +00:00
|
|
|
f0 f0Var3 = new f0(this);
|
|
|
|
this.viewModelGuildDeleteFeedbackSheet$delegate = FragmentViewModelLazyKt.createViewModelLazy(this, a0.getOrCreateKotlinClass(GuildDeleteFeedbackSheetViewModel.class), new WidgetFeedbackSheet$appViewModels$$inlined$viewModels$3(f0Var3), new h0(widgetFeedbackSheet$viewModelGuildDeleteFeedbackSheet$2));
|
2021-08-09 22:50:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ Bundle access$getArgumentsOrDefault$p(WidgetFeedbackSheet widgetFeedbackSheet) {
|
|
|
|
return widgetFeedbackSheet.getArgumentsOrDefault();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ FeedbackSheetViewModel access$getViewModel$p(WidgetFeedbackSheet widgetFeedbackSheet) {
|
|
|
|
return widgetFeedbackSheet.getViewModel();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ void access$handleEvent(WidgetFeedbackSheet widgetFeedbackSheet, FeedbackSheetViewModel.Event event) {
|
|
|
|
widgetFeedbackSheet.handleEvent(event);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ boolean access$isShowingFeedbackIssues$p(WidgetFeedbackSheet widgetFeedbackSheet) {
|
|
|
|
return widgetFeedbackSheet.isShowingFeedbackIssues;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ void access$setShowingFeedbackIssues$p(WidgetFeedbackSheet widgetFeedbackSheet, boolean z2) {
|
|
|
|
widgetFeedbackSheet.isShowingFeedbackIssues = z2;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ void access$updateView(WidgetFeedbackSheet widgetFeedbackSheet, FeedbackSheetViewModel.ViewState viewState) {
|
|
|
|
widgetFeedbackSheet.updateView(viewState);
|
|
|
|
}
|
|
|
|
|
|
|
|
private final WidgetFeedbackSheetBinding getBinding() {
|
|
|
|
return (WidgetFeedbackSheetBinding) this.binding$delegate.getValue((Fragment) this, $$delegatedProperties[0]);
|
|
|
|
}
|
|
|
|
|
|
|
|
private final FeedbackSheetViewModel getViewModel() {
|
|
|
|
Serializable serializable = requireArguments().getSerializable(ARG_FEEDBACK_TYPE);
|
|
|
|
Objects.requireNonNull(serializable, "null cannot be cast to non-null type com.discord.widgets.feedback.WidgetFeedbackSheet.FeedbackType");
|
|
|
|
int ordinal = ((FeedbackType) serializable).ordinal();
|
|
|
|
if (ordinal == 0) {
|
|
|
|
return getViewModelCallFeedbackSheet();
|
|
|
|
}
|
|
|
|
if (ordinal == 1) {
|
|
|
|
return getViewModelStreamFeedbackSheet();
|
|
|
|
}
|
|
|
|
if (ordinal == 2) {
|
|
|
|
return getViewModelGuildDeleteFeedbackSheet();
|
|
|
|
}
|
|
|
|
throw new NoWhenBranchMatchedException();
|
|
|
|
}
|
|
|
|
|
|
|
|
private final CallFeedbackSheetViewModel getViewModelCallFeedbackSheet() {
|
|
|
|
return (CallFeedbackSheetViewModel) this.viewModelCallFeedbackSheet$delegate.getValue();
|
|
|
|
}
|
|
|
|
|
|
|
|
private final GuildDeleteFeedbackSheetViewModel getViewModelGuildDeleteFeedbackSheet() {
|
|
|
|
return (GuildDeleteFeedbackSheetViewModel) this.viewModelGuildDeleteFeedbackSheet$delegate.getValue();
|
|
|
|
}
|
|
|
|
|
|
|
|
private final StreamFeedbackSheetViewModel getViewModelStreamFeedbackSheet() {
|
|
|
|
return (StreamFeedbackSheetViewModel) this.viewModelStreamFeedbackSheet$delegate.getValue();
|
|
|
|
}
|
|
|
|
|
|
|
|
private final void handleEvent(FeedbackSheetViewModel.Event event) {
|
|
|
|
if (event instanceof FeedbackSheetViewModel.Event.Submitted) {
|
|
|
|
if (!((FeedbackSheetViewModel.Event.Submitted) event).getShowConfirmation()) {
|
|
|
|
requireDialog().cancel();
|
|
|
|
return;
|
|
|
|
}
|
2021-08-24 07:28:10 +00:00
|
|
|
Observable<Long> c02 = Observable.c0(SHEET_DISMISS_DELAY_MS, TimeUnit.MILLISECONDS);
|
|
|
|
m.checkNotNullExpressionValue(c02, "Observable\n …S, TimeUnit.MILLISECONDS)");
|
|
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(c02, this, null, 2, null), WidgetFeedbackSheet.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetFeedbackSheet$handleEvent$1(this), 62, (Object) null);
|
2021-08-09 22:50:52 +00:00
|
|
|
} else if (event instanceof FeedbackSheetViewModel.Event.NavigateToIssueDetails) {
|
|
|
|
WidgetIssueDetailsForm.Companion companion = WidgetIssueDetailsForm.Companion;
|
|
|
|
Context requireContext = requireContext();
|
|
|
|
m.checkNotNullExpressionValue(requireContext, "requireContext()");
|
|
|
|
FeedbackSheetViewModel.Event.NavigateToIssueDetails navigateToIssueDetails = (FeedbackSheetViewModel.Event.NavigateToIssueDetails) event;
|
|
|
|
companion.launch(requireContext, navigateToIssueDetails.getPendingFeedback(), navigateToIssueDetails.getShowCxLinkForIssueDetails());
|
|
|
|
requireDialog().cancel();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private final void updateView(FeedbackSheetViewModel.ViewState viewState) {
|
|
|
|
boolean z2 = true;
|
|
|
|
if (this.isShowingFeedbackIssues || !(!viewState.getFeedbackIssues().isEmpty())) {
|
|
|
|
z2 = false;
|
|
|
|
}
|
|
|
|
if (z2) {
|
|
|
|
if (viewState.getShowFaceRatings()) {
|
2021-08-24 07:28:10 +00:00
|
|
|
NestedScrollView nestedScrollView = getBinding().f1802c;
|
2021-08-09 22:50:52 +00:00
|
|
|
m.checkNotNullExpressionValue(nestedScrollView, "binding.feedbackSheetContainer");
|
|
|
|
updatePeekHeightPx(nestedScrollView.getMeasuredHeight());
|
|
|
|
}
|
|
|
|
setBottomSheetState(4);
|
|
|
|
}
|
|
|
|
getBinding().e.setText(viewState.getTitleTextResId());
|
|
|
|
FeedbackView feedbackView = getBinding().d;
|
|
|
|
Integer promptTextResId = viewState.getPromptTextResId();
|
|
|
|
String string = promptTextResId != null ? getString(promptTextResId.intValue()) : null;
|
|
|
|
FeedbackRating selectedFeedbackRating = viewState.getSelectedFeedbackRating();
|
|
|
|
WidgetFeedbackSheet$updateView$2 widgetFeedbackSheet$updateView$2 = new WidgetFeedbackSheet$updateView$2(this);
|
|
|
|
WidgetFeedbackSheet$updateView$3 widgetFeedbackSheet$updateView$3 = new WidgetFeedbackSheet$updateView$3(this);
|
|
|
|
WidgetFeedbackSheet$updateView$4 widgetFeedbackSheet$updateView$4 = new WidgetFeedbackSheet$updateView$4(this);
|
|
|
|
String string2 = getString(viewState.getIssuesHeaderTextResId());
|
|
|
|
m.checkNotNullExpressionValue(string2, "getString(viewState.issuesHeaderTextResId)");
|
|
|
|
feedbackView.updateView(string, selectedFeedbackRating, widgetFeedbackSheet$updateView$2, widgetFeedbackSheet$updateView$3, widgetFeedbackSheet$updateView$4, string2, viewState.getFeedbackIssues(), new WidgetFeedbackSheet$updateView$5(this));
|
|
|
|
if (z2) {
|
2021-08-24 07:28:10 +00:00
|
|
|
Observable<Long> c02 = Observable.c0(100, TimeUnit.MILLISECONDS);
|
|
|
|
m.checkNotNullExpressionValue(c02, "Observable\n .ti…S, TimeUnit.MILLISECONDS)");
|
|
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(c02, this, null, 2, null), WidgetFeedbackSheet.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetFeedbackSheet$updateView$6(this), 62, (Object) null);
|
2021-08-09 22:50:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.app.AppBottomSheet
|
|
|
|
public void bindSubscriptions(CompositeSubscription compositeSubscription) {
|
|
|
|
m.checkNotNullParameter(compositeSubscription, "compositeSubscription");
|
|
|
|
super.bindSubscriptions(compositeSubscription);
|
|
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.bindToComponentLifecycle(getViewModel().observeViewState(), this), WidgetFeedbackSheet.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetFeedbackSheet$bindSubscriptions$1(this), 62, (Object) null);
|
|
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.bindToComponentLifecycle(getViewModel().observeEvents(), this), WidgetFeedbackSheet.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetFeedbackSheet$bindSubscriptions$2(this), 62, (Object) null);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.app.AppBottomSheet
|
|
|
|
public int getContentViewResId() {
|
|
|
|
return R.layout.widget_feedback_sheet;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final Function0<Unit> getOnDismissed() {
|
|
|
|
return this.onDismissed;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // androidx.fragment.app.DialogFragment, android.content.DialogInterface.OnCancelListener
|
|
|
|
public void onCancel(DialogInterface dialogInterface) {
|
|
|
|
m.checkNotNullParameter(dialogInterface, "dialog");
|
|
|
|
super.onCancel(dialogInterface);
|
|
|
|
this.onDismissed.mo1invoke();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.app.AppBottomSheet, androidx.fragment.app.Fragment
|
|
|
|
public void onResume() {
|
|
|
|
super.onResume();
|
|
|
|
requireDialog().setCanceledOnTouchOutside(true);
|
|
|
|
getBinding().b.setOnClickListener(new WidgetFeedbackSheet$onResume$1(this));
|
|
|
|
}
|
|
|
|
|
|
|
|
public final void setOnDismissed(Function0<Unit> function0) {
|
|
|
|
m.checkNotNullParameter(function0, "<set-?>");
|
|
|
|
this.onDismissed = function0;
|
|
|
|
}
|
|
|
|
}
|