189 lines
9.8 KiB
Java
189 lines
9.8 KiB
Java
package com.discord.widgets.servers.auditlog;
|
|
|
|
import android.annotation.SuppressLint;
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.os.Bundle;
|
|
import android.view.View;
|
|
import androidx.fragment.app.Fragment;
|
|
import androidx.fragment.app.FragmentActivity;
|
|
import androidx.recyclerview.widget.RecyclerView;
|
|
import c.a.d.l;
|
|
import c.d.b.a.a;
|
|
import com.discord.app.AppFragment;
|
|
import com.discord.databinding.WidgetAuditLogFilterSheetBinding;
|
|
import com.discord.stores.StoreGuilds;
|
|
import com.discord.stores.StoreStream;
|
|
import com.discord.utilities.auditlogs.AuditLogUtils;
|
|
import com.discord.utilities.mg_recycler.MGRecyclerAdapter;
|
|
import com.discord.utilities.mg_recycler.MGRecyclerDataPayload;
|
|
import com.discord.utilities.rx.ObservableExtensionsKt;
|
|
import com.discord.utilities.view.extensions.ViewExtensions;
|
|
import com.discord.utilities.viewbinding.FragmentViewBindingDelegate;
|
|
import com.discord.utilities.viewbinding.FragmentViewBindingDelegateKt;
|
|
import com.google.android.material.textfield.TextInputLayout;
|
|
import d0.z.d.m;
|
|
import j0.l.e.j;
|
|
import java.util.List;
|
|
import java.util.Set;
|
|
import java.util.concurrent.TimeUnit;
|
|
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.subjects.BehaviorSubject;
|
|
/* compiled from: WidgetServerSettingsAuditLogFilterSheet.kt */
|
|
public final class WidgetServerSettingsAuditLogFilterSheet extends AppFragment {
|
|
public static final /* synthetic */ KProperty[] $$delegatedProperties = {a.W(WidgetServerSettingsAuditLogFilterSheet.class, "binding", "getBinding()Lcom/discord/databinding/WidgetAuditLogFilterSheetBinding;", 0)};
|
|
private static final String ARG_FILTER_TYPE = "ARG_FILTER_TYPE";
|
|
private static final String ARG_GUILD_ID = "ARG_GUILD_ID";
|
|
public static final Companion Companion = new Companion(null);
|
|
private WidgetServerSettingsAuditLogFilterAdapter adapter;
|
|
private final FragmentViewBindingDelegate binding$delegate = FragmentViewBindingDelegateKt.viewBinding$default(this, WidgetServerSettingsAuditLogFilterSheet$binding$2.INSTANCE, null, 2, null);
|
|
private final BehaviorSubject<String> filterPublisher = BehaviorSubject.l0("");
|
|
private Integer filterType;
|
|
private Long guildId;
|
|
private final Function0<Unit> onFilterSelectedCallback = new WidgetServerSettingsAuditLogFilterSheet$onFilterSelectedCallback$1(this);
|
|
|
|
/* compiled from: WidgetServerSettingsAuditLogFilterSheet.kt */
|
|
public static final class Companion {
|
|
private Companion() {
|
|
}
|
|
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
|
|
public final void show(Context context, long j, int i) {
|
|
m.checkNotNullParameter(context, "context");
|
|
Intent putExtra = new Intent().putExtra("ARG_GUILD_ID", j).putExtra("ARG_FILTER_TYPE", i);
|
|
m.checkNotNullExpressionValue(putExtra, "Intent()\n .putE…_FILTER_TYPE, filterType)");
|
|
l.d(context, WidgetServerSettingsAuditLogFilterSheet.class, putExtra);
|
|
}
|
|
}
|
|
|
|
/* compiled from: WidgetServerSettingsAuditLogFilterSheet.kt */
|
|
public static final class Model {
|
|
public static final Companion Companion = new Companion(null);
|
|
private final List<MGRecyclerDataPayload> listItems;
|
|
|
|
/* compiled from: WidgetServerSettingsAuditLogFilterSheet.kt */
|
|
public static final class Companion {
|
|
private Companion() {
|
|
}
|
|
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
|
|
private final Observable<Set<Long>> getPermissionUserIds(long j) {
|
|
StoreGuilds guilds = StoreStream.Companion.getGuilds();
|
|
Observable<Set<Long>> r = Observable.i(guilds.observeGuild(j), guilds.observeRoles(j), guilds.observeComputed(j), WidgetServerSettingsAuditLogFilterSheet$Model$Companion$getPermissionUserIds$1.INSTANCE).r();
|
|
m.checkNotNullExpressionValue(r, "Observable\n .… .distinctUntilChanged()");
|
|
return r;
|
|
}
|
|
|
|
@SuppressLint({"DefaultLocale"})
|
|
public final Observable<Model> get(Context context, long j, int i, Observable<String> observable) {
|
|
m.checkNotNullParameter(context, "context");
|
|
m.checkNotNullParameter(observable, "filterPublisher");
|
|
Observable<Model> r = Observable.h(StoreStream.Companion.getAuditLog().observeAuditLogState(j), getPermissionUserIds(j).Y(WidgetServerSettingsAuditLogFilterSheet$Model$Companion$get$1.INSTANCE), new j(AuditLogUtils.INSTANCE.getALL_ACTION_TYPES()), ObservableExtensionsKt.leadingEdgeThrottle(observable, 100, TimeUnit.MILLISECONDS).r(), new WidgetServerSettingsAuditLogFilterSheet$Model$Companion$get$2(i, context)).r();
|
|
m.checkNotNullExpressionValue(r, "Observable\n … .distinctUntilChanged()");
|
|
return r;
|
|
}
|
|
}
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r2v0, resolved type: java.util.List<? extends com.discord.utilities.mg_recycler.MGRecyclerDataPayload> */
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public Model(List<? extends MGRecyclerDataPayload> list) {
|
|
m.checkNotNullParameter(list, "listItems");
|
|
this.listItems = list;
|
|
}
|
|
|
|
public final List<MGRecyclerDataPayload> getListItems() {
|
|
return this.listItems;
|
|
}
|
|
}
|
|
|
|
public WidgetServerSettingsAuditLogFilterSheet() {
|
|
super(2131558848);
|
|
}
|
|
|
|
public static final /* synthetic */ void access$configureUI(WidgetServerSettingsAuditLogFilterSheet widgetServerSettingsAuditLogFilterSheet, Model model) {
|
|
widgetServerSettingsAuditLogFilterSheet.configureUI(model);
|
|
}
|
|
|
|
public static final /* synthetic */ BehaviorSubject access$getFilterPublisher$p(WidgetServerSettingsAuditLogFilterSheet widgetServerSettingsAuditLogFilterSheet) {
|
|
return widgetServerSettingsAuditLogFilterSheet.filterPublisher;
|
|
}
|
|
|
|
private final void configureUI(Model model) {
|
|
if (this.filterType == null) {
|
|
FragmentActivity activity = getActivity();
|
|
if (activity != null) {
|
|
activity.finish();
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
WidgetServerSettingsAuditLogFilterAdapter widgetServerSettingsAuditLogFilterAdapter = this.adapter;
|
|
if (widgetServerSettingsAuditLogFilterAdapter != null) {
|
|
widgetServerSettingsAuditLogFilterAdapter.configure(model.getListItems(), this.onFilterSelectedCallback);
|
|
}
|
|
}
|
|
|
|
private final WidgetAuditLogFilterSheetBinding getBinding() {
|
|
return (WidgetAuditLogFilterSheetBinding) this.binding$delegate.getValue((Fragment) this, $$delegatedProperties[0]);
|
|
}
|
|
|
|
@Override // com.discord.app.AppFragment, androidx.fragment.app.Fragment
|
|
public void onPause() {
|
|
super.onPause();
|
|
AppFragment.hideKeyboard$default(this, null, 1, null);
|
|
}
|
|
|
|
@Override // com.discord.app.AppFragment
|
|
public void onViewBoundOrOnResume() {
|
|
super.onViewBoundOrOnResume();
|
|
this.filterType = Integer.valueOf(getMostRecentIntent().getIntExtra("ARG_FILTER_TYPE", -1));
|
|
long j = 0;
|
|
this.guildId = Long.valueOf(getMostRecentIntent().getLongExtra("ARG_GUILD_ID", 0));
|
|
Model.Companion companion = Model.Companion;
|
|
Context requireContext = requireContext();
|
|
Long l = this.guildId;
|
|
if (l != null) {
|
|
j = l.longValue();
|
|
}
|
|
Integer num = this.filterType;
|
|
if (num != null) {
|
|
int intValue = num.intValue();
|
|
BehaviorSubject<String> behaviorSubject = this.filterPublisher;
|
|
m.checkNotNullExpressionValue(behaviorSubject, "filterPublisher");
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(ObservableExtensionsKt.computationLatest(companion.get(requireContext, j, intValue, behaviorSubject)), this, null, 2, null), WidgetServerSettingsAuditLogFilterSheet.class, (Context) null, (Function1) null, new WidgetServerSettingsAuditLogFilterSheet$onViewBoundOrOnResume$1(this), (Function0) null, (Function0) null, new WidgetServerSettingsAuditLogFilterSheet$onViewBoundOrOnResume$2(this), 54, (Object) null);
|
|
}
|
|
}
|
|
|
|
@Override // com.discord.app.AppFragment, androidx.fragment.app.Fragment
|
|
public void onViewCreated(View view, Bundle bundle) {
|
|
m.checkNotNullParameter(view, "view");
|
|
super.onViewCreated(view, bundle);
|
|
AppFragment.setActionBarDisplayHomeAsUpEnabled$default(this, false, 1, null);
|
|
MGRecyclerAdapter.Companion companion = MGRecyclerAdapter.Companion;
|
|
RecyclerView recyclerView = getBinding().f1674c;
|
|
m.checkNotNullExpressionValue(recyclerView, "binding.auditLogFilterRecycler");
|
|
this.adapter = (WidgetServerSettingsAuditLogFilterAdapter) companion.configure(new WidgetServerSettingsAuditLogFilterAdapter(recyclerView));
|
|
setActionBarTitle(2131889801);
|
|
Integer num = this.filterType;
|
|
setActionBarSubtitle((num != null && num.intValue() == 0) ? 2131889749 : 2131889745);
|
|
TextInputLayout textInputLayout = getBinding().b;
|
|
m.checkNotNullExpressionValue(textInputLayout, "binding.auditLogFilterInput");
|
|
Integer num2 = this.filterType;
|
|
ViewExtensions.setSingleLineHint(textInputLayout, (num2 != null && num2.intValue() == 0) ? 2131893263 : 2131893209);
|
|
TextInputLayout textInputLayout2 = getBinding().b;
|
|
m.checkNotNullExpressionValue(textInputLayout2, "binding.auditLogFilterInput");
|
|
ViewExtensions.addBindedTextWatcher(textInputLayout2, this, new WidgetServerSettingsAuditLogFilterSheet$onViewCreated$1(this));
|
|
}
|
|
}
|