266 lines
12 KiB
Java
266 lines
12 KiB
Java
package c.a.a.b;
|
|
|
|
import android.content.Context;
|
|
import android.view.View;
|
|
import android.widget.LinearLayout;
|
|
import android.widget.TextView;
|
|
import androidx.fragment.app.Fragment;
|
|
import androidx.fragment.app.FragmentViewModelLazyKt;
|
|
import c.a.a.b.f;
|
|
import c.a.d.f0;
|
|
import c.a.d.h0;
|
|
import c.a.i.r1;
|
|
import com.discord.R;
|
|
import com.discord.app.AppDialog;
|
|
import com.discord.app.AppViewModel;
|
|
import com.discord.models.user.User;
|
|
import com.discord.utilities.icon.IconUtils;
|
|
import com.discord.utilities.images.MGImages;
|
|
import com.discord.utilities.rest.RestAPI;
|
|
import com.discord.utilities.rx.ObservableExtensionsKt;
|
|
import com.discord.utilities.viewbinding.FragmentViewBindingDelegate;
|
|
import com.discord.utilities.viewbinding.FragmentViewBindingDelegateKt;
|
|
import com.discord.widgets.user.UserNameFormatterKt;
|
|
import com.facebook.drawee.view.SimpleDraweeView;
|
|
import d0.z.d.a0;
|
|
import d0.z.d.k;
|
|
import d0.z.d.m;
|
|
import d0.z.d.o;
|
|
import java.util.Objects;
|
|
import kotlin.Lazy;
|
|
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.PublishSubject;
|
|
/* compiled from: UserActionsDialog.kt */
|
|
public final class a extends AppDialog {
|
|
public static final /* synthetic */ KProperty[] i = {c.d.b.a.a.a0(a.class, "binding", "getBinding()Lcom/discord/databinding/UserActionsDialogBinding;", 0)};
|
|
public static final b j = new b(null);
|
|
public final FragmentViewBindingDelegate k = FragmentViewBindingDelegateKt.viewBinding$default(this, c.i, null, 2, null);
|
|
public final Lazy l;
|
|
public final MGImages.DistinctChangeDetector m;
|
|
|
|
/* compiled from: java-style lambda group */
|
|
/* renamed from: c.a.a.b.a$a reason: collision with other inner class name */
|
|
public static final class View$OnClickListenerC0002a implements View.OnClickListener {
|
|
public final /* synthetic */ int i;
|
|
public final /* synthetic */ Object j;
|
|
|
|
public View$OnClickListenerC0002a(int i, Object obj) {
|
|
this.i = i;
|
|
this.j = obj;
|
|
}
|
|
|
|
@Override // android.view.View.OnClickListener
|
|
public final void onClick(View view) {
|
|
int i = this.i;
|
|
if (i == 0) {
|
|
KProperty[] kPropertyArr = a.i;
|
|
f h = ((a) this.j).h();
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(ObservableExtensionsKt.restSubscribeOn$default(RestAPI.addRelationship$default(h.l, "User Profile", h.k, 2, null, 8, null), false, 1, null), h, null, 2, null), f.class, (Context) null, (Function1) null, new h(h), (Function0) null, (Function0) null, new g(h), 54, (Object) null);
|
|
} else if (i == 1) {
|
|
KProperty[] kPropertyArr2 = a.i;
|
|
((a) this.j).h().removeRelationship(R.string.user_has_been_unblocked);
|
|
} else if (i == 2) {
|
|
KProperty[] kPropertyArr3 = a.i;
|
|
((a) this.j).h().removeRelationship(R.string.friend_has_been_deleted);
|
|
} else {
|
|
throw null;
|
|
}
|
|
}
|
|
}
|
|
|
|
/* compiled from: UserActionsDialog.kt */
|
|
public static final class b {
|
|
public b(DefaultConstructorMarker defaultConstructorMarker) {
|
|
}
|
|
}
|
|
|
|
/* compiled from: UserActionsDialog.kt */
|
|
public static final /* synthetic */ class c extends k implements Function1<View, r1> {
|
|
public static final c i = new c();
|
|
|
|
public c() {
|
|
super(1, r1.class, "bind", "bind(Landroid/view/View;)Lcom/discord/databinding/UserActionsDialogBinding;", 0);
|
|
}
|
|
|
|
/* Return type fixed from 'java.lang.Object' to match base method */
|
|
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
|
|
@Override // kotlin.jvm.functions.Function1
|
|
public r1 invoke(View view) {
|
|
View view2 = view;
|
|
m.checkNotNullParameter(view2, "p1");
|
|
int i2 = R.id.user_actions_dialog_avatar;
|
|
SimpleDraweeView simpleDraweeView = (SimpleDraweeView) view2.findViewById(R.id.user_actions_dialog_avatar);
|
|
if (simpleDraweeView != null) {
|
|
i2 = R.id.user_actions_dialog_block_item;
|
|
TextView textView = (TextView) view2.findViewById(R.id.user_actions_dialog_block_item);
|
|
if (textView != null) {
|
|
i2 = R.id.user_actions_dialog_remove_friend_item;
|
|
TextView textView2 = (TextView) view2.findViewById(R.id.user_actions_dialog_remove_friend_item);
|
|
if (textView2 != null) {
|
|
i2 = R.id.user_actions_dialog_unblock_item;
|
|
TextView textView3 = (TextView) view2.findViewById(R.id.user_actions_dialog_unblock_item);
|
|
if (textView3 != null) {
|
|
i2 = R.id.user_actions_dialog_user_name;
|
|
TextView textView4 = (TextView) view2.findViewById(R.id.user_actions_dialog_user_name);
|
|
if (textView4 != null) {
|
|
return new r1((LinearLayout) view2, simpleDraweeView, textView, textView2, textView3, textView4);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
throw new NullPointerException("Missing required view with ID: ".concat(view2.getResources().getResourceName(i2)));
|
|
}
|
|
}
|
|
|
|
/* compiled from: ObservableExtensions.kt */
|
|
public static final class d<T, R> implements j0.k.b<Object, Boolean> {
|
|
public static final d i = new d();
|
|
|
|
/* Return type fixed from 'java.lang.Object' to match base method */
|
|
@Override // j0.k.b
|
|
public Boolean call(Object obj) {
|
|
return Boolean.valueOf(obj instanceof f.d.a);
|
|
}
|
|
}
|
|
|
|
/* compiled from: ObservableExtensions.kt */
|
|
public static final class e<T, R> implements j0.k.b<Object, T> {
|
|
public static final e i = new e();
|
|
|
|
@Override // j0.k.b
|
|
public final T call(Object obj) {
|
|
Objects.requireNonNull(obj, "null cannot be cast to non-null type com.discord.dialogs.useractions.UserActionsDialogViewModel.ViewState.Loaded");
|
|
return (T) ((f.d.a) obj);
|
|
}
|
|
}
|
|
|
|
/* compiled from: UserActionsDialog.kt */
|
|
public static final /* synthetic */ class f extends k implements Function1<f.d.a, Unit> {
|
|
public f(a aVar) {
|
|
super(1, aVar, a.class, "updateView", "updateView(Lcom/discord/dialogs/useractions/UserActionsDialogViewModel$ViewState$Loaded;)V", 0);
|
|
}
|
|
|
|
/* Return type fixed from 'java.lang.Object' to match base method */
|
|
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
|
|
@Override // kotlin.jvm.functions.Function1
|
|
public Unit invoke(f.d.a aVar) {
|
|
f.d.a aVar2 = aVar;
|
|
m.checkNotNullParameter(aVar2, "p1");
|
|
a aVar3 = (a) this.receiver;
|
|
KProperty[] kPropertyArr = a.i;
|
|
SimpleDraweeView simpleDraweeView = aVar3.g().b;
|
|
m.checkNotNullExpressionValue(simpleDraweeView, "binding.userActionsDialogAvatar");
|
|
IconUtils.setIcon$default(simpleDraweeView, IconUtils.getForUser$default(aVar2.a, true, null, 4, null), 0, (Function1) null, aVar3.m, 12, (Object) null);
|
|
TextView textView = aVar3.g().f;
|
|
m.checkNotNullExpressionValue(textView, "binding.userActionsDialogUserName");
|
|
User user = aVar2.a;
|
|
String str = aVar2.b;
|
|
Context requireContext = aVar3.requireContext();
|
|
m.checkNotNullExpressionValue(requireContext, "requireContext()");
|
|
textView.setText(UserNameFormatterKt.getSpannableForUserNameWithDiscrim(user, str, requireContext, R.attr.colorHeaderPrimary, R.attr.font_primary_semibold, R.integer.uikit_textsize_large_sp, R.attr.colorTextMuted, R.attr.font_primary_normal, R.integer.uikit_textsize_large_sp));
|
|
TextView textView2 = aVar3.g().f154c;
|
|
m.checkNotNullExpressionValue(textView2, "binding.userActionsDialogBlockItem");
|
|
int i = 8;
|
|
textView2.setVisibility(aVar2.f36c ? 0 : 8);
|
|
TextView textView3 = aVar3.g().e;
|
|
m.checkNotNullExpressionValue(textView3, "binding.userActionsDialogUnblockItem");
|
|
textView3.setVisibility(aVar2.d ? 0 : 8);
|
|
TextView textView4 = aVar3.g().d;
|
|
m.checkNotNullExpressionValue(textView4, "binding.userActionsDialogRemoveFriendItem");
|
|
if (aVar2.e) {
|
|
i = 0;
|
|
}
|
|
textView4.setVisibility(i);
|
|
return Unit.a;
|
|
}
|
|
}
|
|
|
|
/* compiled from: UserActionsDialog.kt */
|
|
public static final /* synthetic */ class g extends k implements Function1<f.b, Unit> {
|
|
public g(a aVar) {
|
|
super(1, aVar, a.class, "handleEvent", "handleEvent(Lcom/discord/dialogs/useractions/UserActionsDialogViewModel$Event;)V", 0);
|
|
}
|
|
|
|
/* Return type fixed from 'java.lang.Object' to match base method */
|
|
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
|
|
@Override // kotlin.jvm.functions.Function1
|
|
public Unit invoke(f.b bVar) {
|
|
f.b bVar2 = bVar;
|
|
m.checkNotNullParameter(bVar2, "p1");
|
|
a aVar = (a) this.receiver;
|
|
KProperty[] kPropertyArr = a.i;
|
|
Objects.requireNonNull(aVar);
|
|
if (bVar2 instanceof f.b.C0003b) {
|
|
c.a.d.m.i(aVar, ((f.b.C0003b) bVar2).a, 0, 4);
|
|
aVar.dismiss();
|
|
} else if (bVar2 instanceof f.b.a) {
|
|
c.a.d.m.i(aVar, ((f.b.a) bVar2).a, 0, 4);
|
|
aVar.dismiss();
|
|
}
|
|
return Unit.a;
|
|
}
|
|
}
|
|
|
|
/* compiled from: UserActionsDialog.kt */
|
|
public static final class h extends o implements Function0<AppViewModel<f.d>> {
|
|
public final /* synthetic */ a this$0;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public h(a aVar) {
|
|
super(0);
|
|
this.this$0 = aVar;
|
|
}
|
|
|
|
/* Return type fixed from 'java.lang.Object' to match base method */
|
|
@Override // kotlin.jvm.functions.Function0
|
|
/* renamed from: invoke */
|
|
public AppViewModel<f.d> mo1invoke() {
|
|
a aVar = this.this$0;
|
|
KProperty[] kPropertyArr = a.i;
|
|
return new f(aVar.getArgumentsOrDefault().getLong("com.discord.intent.extra.EXTRA_USER_ID", 0), this.this$0.getArgumentsOrDefault().getLong("com.discord.intent.extra.EXTRA_CHANNEL_ID", 0), null, null, 12);
|
|
}
|
|
}
|
|
|
|
public a() {
|
|
super(R.layout.user_actions_dialog);
|
|
h hVar = new h(this);
|
|
f0 f0Var = new f0(this);
|
|
this.l = FragmentViewModelLazyKt.createViewModelLazy(this, a0.getOrCreateKotlinClass(f.class), new m(4, f0Var), new h0(hVar));
|
|
this.m = new MGImages.DistinctChangeDetector();
|
|
}
|
|
|
|
public final r1 g() {
|
|
return (r1) this.k.getValue((Fragment) this, i[0]);
|
|
}
|
|
|
|
public final f h() {
|
|
return (f) this.l.getValue();
|
|
}
|
|
|
|
@Override // com.discord.app.AppDialog
|
|
public void onViewBound(View view) {
|
|
m.checkNotNullParameter(view, "view");
|
|
super.onViewBound(view);
|
|
g().f154c.setOnClickListener(new View$OnClickListenerC0002a(0, this));
|
|
g().e.setOnClickListener(new View$OnClickListenerC0002a(1, this));
|
|
g().d.setOnClickListener(new View$OnClickListenerC0002a(2, this));
|
|
}
|
|
|
|
@Override // com.discord.app.AppDialog
|
|
public void onViewBoundOrOnResume() {
|
|
super.onViewBoundOrOnResume();
|
|
Observable<R> F = h().observeViewState().x(d.i).F(e.i);
|
|
m.checkNotNullExpressionValue(F, "filter { it is T }.map { it as T }");
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.bindToComponentLifecycle$default(F, this, null, 2, null), a.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new f(this), 62, (Object) null);
|
|
PublishSubject<f.b> publishSubject = h().j;
|
|
m.checkNotNullExpressionValue(publishSubject, "eventSubject");
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(publishSubject, this, null, 2, null), a.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new g(this), 62, (Object) null);
|
|
}
|
|
}
|