package c.a.a.c; 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.c.f; import c.a.d.h0; import c.a.d.j0; import c.a.d.o; import c.a.i.k1; 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 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.W(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.c.a$a reason: collision with other inner class name */ public static final class View$OnClickListenerC0006a implements View.OnClickListener { public final /* synthetic */ int i; public final /* synthetic */ Object j; public View$OnClickListenerC0006a(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(2131894229); } else if (i == 2) { KProperty[] kPropertyArr3 = a.i; ((a) this.j).h().removeRelationship(2131888787); } 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 { public static final c i = new c(); public c() { super(1, k1.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 k1 invoke(View view) { View view2 = view; m.checkNotNullParameter(view2, "p1"); int i2 = 2131365362; SimpleDraweeView simpleDraweeView = (SimpleDraweeView) view2.findViewById(2131365362); if (simpleDraweeView != null) { i2 = 2131365363; TextView textView = (TextView) view2.findViewById(2131365363); if (textView != null) { i2 = 2131365364; TextView textView2 = (TextView) view2.findViewById(2131365364); if (textView2 != null) { i2 = 2131365365; TextView textView3 = (TextView) view2.findViewById(2131365365); if (textView3 != null) { i2 = 2131365366; TextView textView4 = (TextView) view2.findViewById(2131365366); if (textView4 != null) { return new k1((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 implements j0.k.b { 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 implements j0.k.b { 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 { 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, 2130968932, 2130969326, 2131427361, 2130968988, 2130969325, 2131427361)); TextView textView2 = aVar3.g().f115c; m.checkNotNullExpressionValue(textView2, "binding.userActionsDialogBlockItem"); int i = 8; textView2.setVisibility(aVar2.f34c ? 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 { 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.C0007b) { o.i(aVar, ((f.b.C0007b) bVar2).a, 0, 4); aVar.dismiss(); } else if (bVar2 instanceof f.b.a) { o.i(aVar, ((f.b.a) bVar2).a, 0, 4); aVar.dismiss(); } return Unit.a; } } /* compiled from: UserActionsDialog.kt */ public static final class h extends d0.z.d.o implements Function0> { 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 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(2131558706); h hVar = new h(this); h0 h0Var = new h0(this); this.l = FragmentViewModelLazyKt.createViewModelLazy(this, a0.getOrCreateKotlinClass(f.class), new m(4, h0Var), new j0(hVar)); this.m = new MGImages.DistinctChangeDetector(); } public final k1 g() { return (k1) 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().f115c.setOnClickListener(new View$OnClickListenerC0006a(0, this)); g().e.setOnClickListener(new View$OnClickListenerC0006a(1, this)); g().d.setOnClickListener(new View$OnClickListenerC0006a(2, this)); } @Override // com.discord.app.AppDialog public void onViewBoundOrOnResume() { super.onViewBoundOrOnResume(); Observable G = h().observeViewState().y(d.i).G(e.i); m.checkNotNullExpressionValue(G, "filter { it is T }.map { it as T }"); ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.bindToComponentLifecycle(G, this), a.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new f(this), 62, (Object) null); PublishSubject 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); } }