discord-jadx/app/src/main/java/com/discord/widgets/channels/settings/WidgetChannelNotificationSe...

354 lines
17 KiB
Java

package com.discord.widgets.channels.settings;
import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.widget.LinearLayout;
import androidx.fragment.app.Fragment;
import c.a.d.l;
import c.a.k.b;
import c.d.b.a.a;
import com.airbnb.lottie.parser.AnimatableValueParser;
import com.discord.api.channel.Channel;
import com.discord.app.AppFragment;
import com.discord.databinding.WidgetChannelNotificationSettingsBinding;
import com.discord.models.domain.ModelNotificationSettings;
import com.discord.stores.StoreStream;
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.views.RadioManager;
import com.discord.widgets.servers.NotificationMuteSettingsView;
import d0.t.n;
import d0.z.d.m;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Ref$IntRef;
import kotlin.reflect.KProperty;
import rx.Observable;
/* compiled from: WidgetChannelNotificationSettings.kt */
public final class WidgetChannelNotificationSettings extends AppFragment {
public static final /* synthetic */ KProperty[] $$delegatedProperties = {a.V(WidgetChannelNotificationSettings.class, "binding", "getBinding()Lcom/discord/databinding/WidgetChannelNotificationSettingsBinding;", 0)};
public static final Companion Companion = new Companion(null);
private static final String INTENT_SHOW_SYSTEM_SETTINGS = "SHOW_SYSTEM_SETTING";
private final FragmentViewBindingDelegate binding$delegate = FragmentViewBindingDelegateKt.viewBinding$default(this, WidgetChannelNotificationSettings$binding$2.INSTANCE, null, 2, null);
private RadioManager notificationSettingsRadioManager;
/* compiled from: WidgetChannelNotificationSettings.kt */
public static final class Companion {
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
public static /* synthetic */ void launch$default(Companion companion, Context context, long j, boolean z2, int i, Object obj) {
if ((i & 4) != 0) {
z2 = false;
}
companion.launch(context, j, z2);
}
public final void launch(Context context, long j, boolean z2) {
m.checkNotNullParameter(context, "context");
Intent putExtra = new Intent().putExtra("com.discord.intent.extra.EXTRA_CHANNEL_ID", j).putExtra("SHOW_SYSTEM_SETTING", z2);
m.checkNotNullExpressionValue(putExtra, "Intent()\n .putE…TINGS, showSystemSetting)");
l.d(context, WidgetChannelNotificationSettings.class, putExtra);
}
}
/* compiled from: WidgetChannelNotificationSettings.kt */
public static final class Model {
public static final Companion Companion = new Companion(null);
public static final float RADIO_DIMMED_ALPHA = 0.3f;
public static final float RADIO_OPAQUE_ALPHA = 1.0f;
private final Channel channel;
private final boolean channelIsMuted;
private final String channelMuteEndTime;
private final boolean isAboveNotifyAllSize;
private final boolean isGuildMuted;
private final int notificationSetting;
private final boolean notificationSettingIsInherited;
/* compiled from: WidgetChannelNotificationSettings.kt */
public static final class Companion {
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
public final Observable<Model> get(long j) {
Observable<R> Y = StoreStream.Companion.getChannels().observeChannel(j).Y(WidgetChannelNotificationSettings$Model$Companion$get$1.INSTANCE);
m.checkNotNullExpressionValue(Y, "StoreStream\n …ust(null)\n }");
Observable<Model> r = ObservableExtensionsKt.computationBuffered(Y).r();
m.checkNotNullExpressionValue(r, "StoreStream\n … .distinctUntilChanged()");
return r;
}
}
public Model(Channel channel, boolean z2, String str, boolean z3, int i, boolean z4, boolean z5) {
m.checkNotNullParameter(channel, "channel");
this.channel = channel;
this.channelIsMuted = z2;
this.channelMuteEndTime = str;
this.isGuildMuted = z3;
this.notificationSetting = i;
this.notificationSettingIsInherited = z4;
this.isAboveNotifyAllSize = z5;
}
public static /* synthetic */ Model copy$default(Model model, Channel channel, boolean z2, String str, boolean z3, int i, boolean z4, boolean z5, int i2, Object obj) {
if ((i2 & 1) != 0) {
channel = model.channel;
}
if ((i2 & 2) != 0) {
z2 = model.channelIsMuted;
}
if ((i2 & 4) != 0) {
str = model.channelMuteEndTime;
}
if ((i2 & 8) != 0) {
z3 = model.isGuildMuted;
}
if ((i2 & 16) != 0) {
i = model.notificationSetting;
}
if ((i2 & 32) != 0) {
z4 = model.notificationSettingIsInherited;
}
if ((i2 & 64) != 0) {
z5 = model.isAboveNotifyAllSize;
}
return model.copy(channel, z2, str, z3, i, z4, z5);
}
public final Channel component1() {
return this.channel;
}
public final boolean component2() {
return this.channelIsMuted;
}
public final String component3() {
return this.channelMuteEndTime;
}
public final boolean component4() {
return this.isGuildMuted;
}
public final int component5() {
return this.notificationSetting;
}
public final boolean component6() {
return this.notificationSettingIsInherited;
}
public final boolean component7() {
return this.isAboveNotifyAllSize;
}
public final Model copy(Channel channel, boolean z2, String str, boolean z3, int i, boolean z4, boolean z5) {
m.checkNotNullParameter(channel, "channel");
return new Model(channel, z2, str, z3, i, z4, z5);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof Model)) {
return false;
}
Model model = (Model) obj;
return m.areEqual(this.channel, model.channel) && this.channelIsMuted == model.channelIsMuted && m.areEqual(this.channelMuteEndTime, model.channelMuteEndTime) && this.isGuildMuted == model.isGuildMuted && this.notificationSetting == model.notificationSetting && this.notificationSettingIsInherited == model.notificationSettingIsInherited && this.isAboveNotifyAllSize == model.isAboveNotifyAllSize;
}
public final Channel getChannel() {
return this.channel;
}
public final boolean getChannelIsMuted() {
return this.channelIsMuted;
}
public final String getChannelMuteEndTime() {
return this.channelMuteEndTime;
}
public final int getNotificationSetting() {
return this.notificationSetting;
}
public final boolean getNotificationSettingIsInherited() {
return this.notificationSettingIsInherited;
}
public int hashCode() {
Channel channel = this.channel;
int i = 0;
int hashCode = (channel != null ? channel.hashCode() : 0) * 31;
boolean z2 = this.channelIsMuted;
int i2 = 1;
if (z2) {
z2 = true;
}
int i3 = z2 ? 1 : 0;
int i4 = z2 ? 1 : 0;
int i5 = z2 ? 1 : 0;
int i6 = (hashCode + i3) * 31;
String str = this.channelMuteEndTime;
if (str != null) {
i = str.hashCode();
}
int i7 = (i6 + i) * 31;
boolean z3 = this.isGuildMuted;
if (z3) {
z3 = true;
}
int i8 = z3 ? 1 : 0;
int i9 = z3 ? 1 : 0;
int i10 = z3 ? 1 : 0;
int i11 = (((i7 + i8) * 31) + this.notificationSetting) * 31;
boolean z4 = this.notificationSettingIsInherited;
if (z4) {
z4 = true;
}
int i12 = z4 ? 1 : 0;
int i13 = z4 ? 1 : 0;
int i14 = z4 ? 1 : 0;
int i15 = (i11 + i12) * 31;
boolean z5 = this.isAboveNotifyAllSize;
if (!z5) {
i2 = z5 ? 1 : 0;
}
return i15 + i2;
}
public final boolean isAboveNotifyAllSize() {
return this.isAboveNotifyAllSize;
}
public final boolean isGuildMuted() {
return this.isGuildMuted;
}
public String toString() {
StringBuilder K = a.K("Model(channel=");
K.append(this.channel);
K.append(", channelIsMuted=");
K.append(this.channelIsMuted);
K.append(", channelMuteEndTime=");
K.append(this.channelMuteEndTime);
K.append(", isGuildMuted=");
K.append(this.isGuildMuted);
K.append(", notificationSetting=");
K.append(this.notificationSetting);
K.append(", notificationSettingIsInherited=");
K.append(this.notificationSettingIsInherited);
K.append(", isAboveNotifyAllSize=");
return a.F(K, this.isAboveNotifyAllSize, ")");
}
}
public WidgetChannelNotificationSettings() {
super(2131558881);
}
public static final /* synthetic */ void access$configureUI(WidgetChannelNotificationSettings widgetChannelNotificationSettings, Model model) {
widgetChannelNotificationSettings.configureUI(model);
}
public static final /* synthetic */ RadioManager access$getNotificationSettingsRadioManager$p(WidgetChannelNotificationSettings widgetChannelNotificationSettings) {
RadioManager radioManager = widgetChannelNotificationSettings.notificationSettingsRadioManager;
if (radioManager == null) {
m.throwUninitializedPropertyAccessException("notificationSettingsRadioManager");
}
return radioManager;
}
public static final /* synthetic */ void access$setNotificationSettingsRadioManager$p(WidgetChannelNotificationSettings widgetChannelNotificationSettings, RadioManager radioManager) {
widgetChannelNotificationSettings.notificationSettingsRadioManager = radioManager;
}
private final void configureNotificationRadios(Model model) {
Ref$IntRef ref$IntRef = new Ref$IntRef();
ref$IntRef.element = model.getNotificationSetting();
if (AnimatableValueParser.w1(model.getChannel()) && ref$IntRef.element == ModelNotificationSettings.FREQUENCY_ALL) {
ref$IntRef.element = ModelNotificationSettings.FREQUENCY_MENTIONS;
}
WidgetChannelNotificationSettings$configureNotificationRadios$1 widgetChannelNotificationSettings$configureNotificationRadios$1 = new WidgetChannelNotificationSettings$configureNotificationRadios$1(this, ref$IntRef);
CheckedSetting checkedSetting = getBinding().f1697c;
m.checkNotNullExpressionValue(checkedSetting, "binding.frequencyRadioAll");
checkedSetting.setVisibility(AnimatableValueParser.z1(model.getChannel()) ? 0 : 8);
CheckedSetting checkedSetting2 = getBinding().d;
String string = requireContext().getString(AnimatableValueParser.w1(model.getChannel()) ? 2131888667 : 2131888716);
m.checkNotNullExpressionValue(string, "requireContext().getStri…s\n }\n )");
checkedSetting2.setText(b.k(string, new Object[0], null, 2));
CheckedSetting checkedSetting3 = getBinding().f1697c;
m.checkNotNullExpressionValue(checkedSetting3, "binding.frequencyRadioAll");
widgetChannelNotificationSettings$configureNotificationRadios$1.invoke(model, checkedSetting3, ModelNotificationSettings.FREQUENCY_ALL);
CheckedSetting checkedSetting4 = getBinding().d;
m.checkNotNullExpressionValue(checkedSetting4, "binding.frequencyRadioMentions");
widgetChannelNotificationSettings$configureNotificationRadios$1.invoke(model, checkedSetting4, ModelNotificationSettings.FREQUENCY_MENTIONS);
CheckedSetting checkedSetting5 = getBinding().e;
m.checkNotNullExpressionValue(checkedSetting5, "binding.frequencyRadioNothing");
widgetChannelNotificationSettings$configureNotificationRadios$1.invoke(model, checkedSetting5, ModelNotificationSettings.FREQUENCY_NOTHING);
}
private final void configureUI(Model model) {
int i = 0;
setActionBarSubtitle(AnimatableValueParser.A0(model.getChannel(), requireContext(), false, 2));
NotificationMuteSettingsView.ViewState viewState = new NotificationMuteSettingsView.ViewState(model.getChannelIsMuted(), model.getChannelMuteEndTime(), AnimatableValueParser.z1(model.getChannel()) ? b.g(requireContext(), 2131891453, new Object[]{AnimatableValueParser.A0(model.getChannel(), requireContext(), false, 2)}, null, 4) : b.g(requireContext(), 2131891452, new Object[0], null, 4), AnimatableValueParser.z1(model.getChannel()) ? b.g(requireContext(), 2131894294, new Object[]{AnimatableValueParser.A0(model.getChannel(), requireContext(), false, 2)}, null, 4) : b.g(requireContext(), 2131894293, new Object[0], null, 4), b.g(requireContext(), 2131888678, new Object[0], null, 4), AnimatableValueParser.z1(model.getChannel()) ? 2131888679 : 2131888676, AnimatableValueParser.z1(model.getChannel()) ? b.g(requireContext(), 2131888682, new Object[0], null, 4) : b.g(requireContext(), 2131888677, new Object[0], null, 4));
WidgetChannelNotificationSettings$configureUI$onMute$1 widgetChannelNotificationSettings$configureUI$onMute$1 = new WidgetChannelNotificationSettings$configureUI$onMute$1(this, model);
WidgetChannelNotificationSettings$configureUI$onUnmute$1 widgetChannelNotificationSettings$configureUI$onUnmute$1 = new WidgetChannelNotificationSettings$configureUI$onUnmute$1(this, model);
boolean z1 = AnimatableValueParser.z1(model.getChannel());
NotificationMuteSettingsView notificationMuteSettingsView = getBinding().g;
notificationMuteSettingsView.setVisibility(z1 ? 0 : 8);
notificationMuteSettingsView.updateView(viewState, widgetChannelNotificationSettings$configureUI$onMute$1, widgetChannelNotificationSettings$configureUI$onUnmute$1);
View view = getBinding().f;
m.checkNotNullExpressionValue(view, "binding.frequencyTopDivider");
if (!z1) {
i = 8;
}
view.setVisibility(i);
configureNotificationRadios(model);
}
private final WidgetChannelNotificationSettingsBinding getBinding() {
return (WidgetChannelNotificationSettingsBinding) this.binding$delegate.getValue((Fragment) this, $$delegatedProperties[0]);
}
@Override // com.discord.app.AppFragment
public void onViewBound(View view) {
m.checkNotNullParameter(view, "view");
super.onViewBound(view);
setRetainInstance(true);
int i = 0;
AppFragment.setActionBarDisplayHomeAsUpEnabled$default(this, false, 1, null);
setActionBarTitle(2131891689);
this.notificationSettingsRadioManager = new RadioManager(n.listOf((Object[]) new CheckedSetting[]{getBinding().f1697c, getBinding().d, getBinding().e}));
LinearLayout linearLayout = getBinding().b;
m.checkNotNullExpressionValue(linearLayout, "binding.channelNotificationSettingsSystem");
if (!getMostRecentIntent().getBooleanExtra("SHOW_SYSTEM_SETTING", false)) {
i = 8;
}
linearLayout.setVisibility(i);
}
@Override // com.discord.app.AppFragment
public void onViewBoundOrOnResume() {
super.onViewBoundOrOnResume();
long longExtra = getMostRecentIntent().getLongExtra("com.discord.intent.extra.EXTRA_CHANNEL_ID", -1);
getBinding().b.setOnClickListener(new WidgetChannelNotificationSettings$onViewBoundOrOnResume$1(this));
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(Model.Companion.get(longExtra), this, null, 2, null), WidgetChannelNotificationSettings.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetChannelNotificationSettings$onViewBoundOrOnResume$2(this), 62, (Object) null);
}
}