package c.a.a.c; import android.content.Context; import androidx.annotation.StringRes; import com.discord.app.AppViewModel; import com.discord.models.member.GuildMember; import com.discord.models.user.User; import com.discord.stores.StoreChannels; import com.discord.stores.StoreGuilds; import com.discord.stores.StoreStream; import com.discord.stores.StoreUser; import com.discord.stores.StoreUserRelationships; import com.discord.utilities.error.Error; import com.discord.utilities.rest.RestAPI; import com.discord.utilities.rx.ObservableExtensionsKt; import d0.z.d.m; import d0.z.d.o; import kotlin.Unit; import kotlin.jvm.functions.Function0; import kotlin.jvm.functions.Function1; import kotlin.jvm.internal.DefaultConstructorMarker; import rx.Observable; import rx.subjects.PublishSubject; /* compiled from: UserActionsDialogViewModel.kt */ public final class f extends AppViewModel { public static final a i = new a(null); public final PublishSubject j; public final long k; public final RestAPI l; /* compiled from: UserActionsDialogViewModel.kt */ public static final class a { public a(DefaultConstructorMarker defaultConstructorMarker) { } } /* compiled from: UserActionsDialogViewModel.kt */ public static abstract class b { /* compiled from: UserActionsDialogViewModel.kt */ public static final class a extends b { public final int a; public a(int i) { super(null); this.a = i; } public boolean equals(Object obj) { if (this != obj) { return (obj instanceof a) && this.a == ((a) obj).a; } return true; } public int hashCode() { return this.a; } public String toString() { return c.d.b.a.a.z(c.d.b.a.a.L("Failure(failureMessageStringRes="), this.a, ")"); } } /* compiled from: UserActionsDialogViewModel.kt */ /* renamed from: c.a.a.c.f$b$b reason: collision with other inner class name */ public static final class C0007b extends b { public final int a; public C0007b(int i) { super(null); this.a = i; } public boolean equals(Object obj) { if (this != obj) { return (obj instanceof C0007b) && this.a == ((C0007b) obj).a; } return true; } public int hashCode() { return this.a; } public String toString() { return c.d.b.a.a.z(c.d.b.a.a.L("Success(successMessageStringRes="), this.a, ")"); } } public b() { } public b(DefaultConstructorMarker defaultConstructorMarker) { } } /* compiled from: UserActionsDialogViewModel.kt */ public static final class c { public final User a; public final Integer b; /* renamed from: c reason: collision with root package name */ public final GuildMember f33c; public c(User user, Integer num, GuildMember guildMember) { this.a = user; this.b = num; this.f33c = guildMember; } } /* compiled from: UserActionsDialogViewModel.kt */ public static abstract class d { /* compiled from: UserActionsDialogViewModel.kt */ public static final class a extends d { public final User a; public final String b; /* renamed from: c reason: collision with root package name */ public final boolean f34c; public final boolean d; public final boolean e; /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public a(User user, String str, boolean z2, boolean z3, boolean z4) { super(null); m.checkNotNullParameter(user, "user"); this.a = user; this.b = str; this.f34c = z2; this.d = z3; this.e = z4; } public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof a)) { return false; } a aVar = (a) obj; return m.areEqual(this.a, aVar.a) && m.areEqual(this.b, aVar.b) && this.f34c == aVar.f34c && this.d == aVar.d && this.e == aVar.e; } public int hashCode() { User user = this.a; int i = 0; int hashCode = (user != null ? user.hashCode() : 0) * 31; String str = this.b; if (str != null) { i = str.hashCode(); } int i2 = (hashCode + i) * 31; boolean z2 = this.f34c; int i3 = 1; if (z2) { z2 = true; } int i4 = z2 ? 1 : 0; int i5 = z2 ? 1 : 0; int i6 = z2 ? 1 : 0; int i7 = (i2 + i4) * 31; boolean z3 = this.d; if (z3) { z3 = true; } int i8 = z3 ? 1 : 0; int i9 = z3 ? 1 : 0; int i10 = z3 ? 1 : 0; int i11 = (i7 + i8) * 31; boolean z4 = this.e; if (!z4) { i3 = z4 ? 1 : 0; } return i11 + i3; } public String toString() { StringBuilder L = c.d.b.a.a.L("Loaded(user="); L.append(this.a); L.append(", userNickname="); L.append(this.b); L.append(", showBlockItem="); L.append(this.f34c); L.append(", showUnblockItem="); L.append(this.d); L.append(", showRemoveFriendItem="); return c.d.b.a.a.G(L, this.e, ")"); } } /* compiled from: UserActionsDialogViewModel.kt */ public static final class b extends d { public static final b a = new b(); public b() { super(null); } } public d(DefaultConstructorMarker defaultConstructorMarker) { } } /* compiled from: UserActionsDialogViewModel.kt */ public static final class e extends o implements Function1 { public final /* synthetic */ int $successMessageStringRes; public final /* synthetic */ f this$0; /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public e(f fVar, int i) { super(1); this.this$0 = fVar; this.$successMessageStringRes = i; } /* 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(Void r3) { f fVar = this.this$0; int i = this.$successMessageStringRes; PublishSubject publishSubject = fVar.j; publishSubject.j.onNext(new b.C0007b(i)); return Unit.a; } } /* compiled from: UserActionsDialogViewModel.kt */ /* renamed from: c.a.a.c.f$f reason: collision with other inner class name */ public static final class C0008f extends o implements Function1 { public final /* synthetic */ f this$0; /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public C0008f(f fVar) { super(1); this.this$0 = fVar; } /* 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(Error error) { m.checkNotNullParameter(error, "it"); PublishSubject publishSubject = this.this$0.j; publishSubject.j.onNext(new b.a(2131888049)); return Unit.a; } } /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public f(long j, long j2, RestAPI restAPI, Observable observable, int i2) { super(d.b.a); Observable observable2; RestAPI api = (i2 & 4) != 0 ? RestAPI.Companion.getApi() : null; if ((i2 & 8) != 0) { StoreStream.Companion companion = StoreStream.Companion; StoreUser users = companion.getUsers(); StoreUserRelationships userRelationships = companion.getUserRelationships(); StoreGuilds guilds = companion.getGuilds(); StoreChannels channels = companion.getChannels(); Observable observeUser = users.observeUser(j); Observable observe = userRelationships.observe(j); Observable s2 = channels.observeChannel(j2).Z(new d(guilds, j)).s(); m.checkNotNullExpressionValue(s2, "storeChannels\n … .distinctUntilChanged()"); observable2 = Observable.i(observeUser, observe, s2, e.a).s(); m.checkNotNullExpressionValue(observable2, "Observable.combineLatest… .distinctUntilChanged()"); } else { observable2 = null; } m.checkNotNullParameter(api, "restAPI"); m.checkNotNullParameter(observable2, "storeObservable"); this.k = j; this.l = api; this.j = PublishSubject.l0(); ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(ObservableExtensionsKt.computationLatest(observable2), this, null, 2, null), f.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new b(this), 62, (Object) null); } public final void removeRelationship(@StringRes int i2) { ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(ObservableExtensionsKt.restSubscribeOn$default(this.l.removeRelationship("User Profile", this.k), false, 1, null), this, null, 2, null), f.class, (Context) null, (Function1) null, new C0008f(this), (Function0) null, (Function0) null, new e(this, i2), 54, (Object) null); } }