discord-jadx/app/src/main/java/com/discord/widgets/voice/controls/WidgetScreenShareNfxSheet.java

216 lines
10 KiB
Java

package com.discord.widgets.voice.controls;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import b.d.b.a.a;
import com.discord.R;
import com.discord.app.AppBottomSheet;
import com.discord.app.AppTransitionActivity;
import com.discord.databinding.WidgetScreenShareNfxSheetBinding;
import com.discord.utilities.cache.SharedPreferencesProvider;
import com.discord.utilities.viewbinding.FragmentViewBindingDelegate;
import com.discord.utilities.viewbinding.FragmentViewBindingDelegateKt;
import com.discord.widgets.chat.list.TextInVoiceFeatureFlag;
import com.discord.widgets.voice.fullscreen.WidgetCallPreviewFullscreen;
import com.discord.widgets.voice.sheet.WidgetVoiceBottomSheet;
import com.discord.widgets.voice.stream.StreamNavigator;
import d0.z.d.m;
import java.io.Serializable;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.reflect.KProperty;
/* compiled from: WidgetScreenShareNfxSheet.kt */
public final class WidgetScreenShareNfxSheet extends AppBottomSheet {
public static final /* synthetic */ KProperty[] $$delegatedProperties = {a.b0(WidgetScreenShareNfxSheet.class, "binding", "getBinding()Lcom/discord/databinding/WidgetScreenShareNfxSheetBinding;", 0)};
private static final String ARG_VOICE_BOTTOM_SHEET_PARAMS = "ARG_VOICE_BOTTOM_SHEET_PARAMS";
public static final Companion Companion = new Companion(null);
private final FragmentViewBindingDelegate binding$delegate = FragmentViewBindingDelegateKt.viewBinding$default(this, WidgetScreenShareNfxSheet$binding$2.INSTANCE, null, 2, null);
/* compiled from: WidgetScreenShareNfxSheet.kt */
public static final class Companion {
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
public static /* synthetic */ void show$default(Companion companion, FragmentManager fragmentManager, long j, long j2, VoiceBottomSheetParams voiceBottomSheetParams, int i, Object obj) {
if ((i & 8) != 0) {
voiceBottomSheetParams = null;
}
companion.show(fragmentManager, j, j2, voiceBottomSheetParams);
}
public final boolean canShow() {
return !SharedPreferencesProvider.INSTANCE.get().getBoolean("CACHE_KEY_SCREEN_SHARE_NFX_SHEET_SHOWN", false);
}
public final void show(FragmentManager fragmentManager, long j, long j2, VoiceBottomSheetParams voiceBottomSheetParams) {
m.checkNotNullParameter(fragmentManager, "fragmentManager");
WidgetScreenShareNfxSheet widgetScreenShareNfxSheet = new WidgetScreenShareNfxSheet();
Bundle I = a.I("com.discord.intent.extra.EXTRA_CHANNEL_ID", j);
I.putLong("com.discord.intent.extra.EXTRA_GUILD_ID", j2);
I.putSerializable(WidgetScreenShareNfxSheet.ARG_VOICE_BOTTOM_SHEET_PARAMS, voiceBottomSheetParams);
widgetScreenShareNfxSheet.setArguments(I);
widgetScreenShareNfxSheet.show(fragmentManager, WidgetScreenShareNfxSheet.class.getName());
SharedPreferences.Editor edit = SharedPreferencesProvider.INSTANCE.get().edit();
m.checkNotNullExpressionValue(edit, "editor");
edit.putBoolean("CACHE_KEY_SCREEN_SHARE_NFX_SHEET_SHOWN", true);
edit.apply();
}
}
/* compiled from: WidgetScreenShareNfxSheet.kt */
public static final class VoiceBottomSheetParams implements Serializable {
private final WidgetVoiceBottomSheet.FeatureContext featureContext;
private final boolean forwardToFullscreenIfVideoActivated;
public VoiceBottomSheetParams(boolean z2, WidgetVoiceBottomSheet.FeatureContext featureContext) {
m.checkNotNullParameter(featureContext, "featureContext");
this.forwardToFullscreenIfVideoActivated = z2;
this.featureContext = featureContext;
}
public static /* synthetic */ VoiceBottomSheetParams copy$default(VoiceBottomSheetParams voiceBottomSheetParams, boolean z2, WidgetVoiceBottomSheet.FeatureContext featureContext, int i, Object obj) {
if ((i & 1) != 0) {
z2 = voiceBottomSheetParams.forwardToFullscreenIfVideoActivated;
}
if ((i & 2) != 0) {
featureContext = voiceBottomSheetParams.featureContext;
}
return voiceBottomSheetParams.copy(z2, featureContext);
}
public final boolean component1() {
return this.forwardToFullscreenIfVideoActivated;
}
public final WidgetVoiceBottomSheet.FeatureContext component2() {
return this.featureContext;
}
public final VoiceBottomSheetParams copy(boolean z2, WidgetVoiceBottomSheet.FeatureContext featureContext) {
m.checkNotNullParameter(featureContext, "featureContext");
return new VoiceBottomSheetParams(z2, featureContext);
}
@Override // java.lang.Object
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof VoiceBottomSheetParams)) {
return false;
}
VoiceBottomSheetParams voiceBottomSheetParams = (VoiceBottomSheetParams) obj;
return this.forwardToFullscreenIfVideoActivated == voiceBottomSheetParams.forwardToFullscreenIfVideoActivated && m.areEqual(this.featureContext, voiceBottomSheetParams.featureContext);
}
public final WidgetVoiceBottomSheet.FeatureContext getFeatureContext() {
return this.featureContext;
}
public final boolean getForwardToFullscreenIfVideoActivated() {
return this.forwardToFullscreenIfVideoActivated;
}
@Override // java.lang.Object
public int hashCode() {
boolean z2 = this.forwardToFullscreenIfVideoActivated;
if (z2) {
z2 = true;
}
int i = z2 ? 1 : 0;
int i2 = z2 ? 1 : 0;
int i3 = z2 ? 1 : 0;
int i4 = i * 31;
WidgetVoiceBottomSheet.FeatureContext featureContext = this.featureContext;
return i4 + (featureContext != null ? featureContext.hashCode() : 0);
}
@Override // java.lang.Object
public String toString() {
StringBuilder R = a.R("VoiceBottomSheetParams(forwardToFullscreenIfVideoActivated=");
R.append(this.forwardToFullscreenIfVideoActivated);
R.append(", featureContext=");
R.append(this.featureContext);
R.append(")");
return R.toString();
}
}
public WidgetScreenShareNfxSheet() {
super(false, 1, null);
}
public static final /* synthetic */ void access$maybeNavigateToVoiceBottomSheet(WidgetScreenShareNfxSheet widgetScreenShareNfxSheet) {
widgetScreenShareNfxSheet.maybeNavigateToVoiceBottomSheet();
}
private final WidgetScreenShareNfxSheetBinding getBinding() {
return (WidgetScreenShareNfxSheetBinding) this.binding$delegate.getValue((Fragment) this, $$delegatedProperties[0]);
}
private final long getChannelId() {
return requireArguments().getLong("com.discord.intent.extra.EXTRA_CHANNEL_ID");
}
private final long getGuildId() {
return requireArguments().getLong("com.discord.intent.extra.EXTRA_GUILD_ID");
}
private final VoiceBottomSheetParams getVoiceBottomSheetParams() {
return (VoiceBottomSheetParams) requireArguments().getSerializable(ARG_VOICE_BOTTOM_SHEET_PARAMS);
}
private final void maybeNavigateToVoiceBottomSheet() {
VoiceBottomSheetParams voiceBottomSheetParams = getVoiceBottomSheetParams();
if (voiceBottomSheetParams == null) {
return;
}
if (TextInVoiceFeatureFlag.Companion.getINSTANCE().isEnabled(Long.valueOf(getGuildId()))) {
WidgetCallPreviewFullscreen.Companion companion = WidgetCallPreviewFullscreen.Companion;
Context requireContext = requireContext();
m.checkNotNullExpressionValue(requireContext, "requireContext()");
companion.launch(requireContext, getChannelId(), AppTransitionActivity.Transition.TYPE_SLIDE_VERTICAL_WITH_FADE);
return;
}
WidgetVoiceBottomSheet.Companion companion2 = WidgetVoiceBottomSheet.Companion;
FragmentManager parentFragmentManager = getParentFragmentManager();
m.checkNotNullExpressionValue(parentFragmentManager, "parentFragmentManager");
companion2.show(parentFragmentManager, getChannelId(), voiceBottomSheetParams.getForwardToFullscreenIfVideoActivated(), voiceBottomSheetParams.getFeatureContext());
}
@Override // com.discord.app.AppBottomSheet
public int getContentViewResId() {
return R.layout.widget_screen_share_nfx_sheet;
}
@Override // androidx.fragment.app.Fragment
public void onActivityResult(int i, int i2, Intent intent) {
super.onActivityResult(i, i2, intent);
StreamNavigator.handleActivityResult(i, i2, intent, new WidgetScreenShareNfxSheet$onActivityResult$1(this));
}
@Override // androidx.fragment.app.DialogFragment, android.content.DialogInterface.OnCancelListener
public void onCancel(DialogInterface dialogInterface) {
m.checkNotNullParameter(dialogInterface, "dialog");
super.onCancel(dialogInterface);
maybeNavigateToVoiceBottomSheet();
}
@Override // com.discord.app.AppBottomSheet, androidx.fragment.app.Fragment
public void onViewCreated(View view, Bundle bundle) {
m.checkNotNullParameter(view, "view");
super.onViewCreated(view, bundle);
getBinding().c.setOnClickListener(new WidgetScreenShareNfxSheet$onViewCreated$1(this));
getBinding().f2489b.setOnClickListener(new WidgetScreenShareNfxSheet$onViewCreated$2(this));
}
}