2021-07-24 02:37:17 +00:00
|
|
|
package c.a.a.b;
|
|
|
|
|
|
|
|
import android.content.Context;
|
|
|
|
import androidx.annotation.StringRes;
|
2021-10-15 06:18:26 +00:00
|
|
|
import c0.z.d.m;
|
|
|
|
import c0.z.d.o;
|
2021-08-09 22:51:56 +00:00
|
|
|
import com.discord.R;
|
2021-07-24 02:37:17 +00:00
|
|
|
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 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<d> {
|
|
|
|
public static final a i = new a(null);
|
|
|
|
public final PublishSubject<b> 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() {
|
2021-10-09 06:29:02 +00:00
|
|
|
return c.d.b.a.a.z(c.d.b.a.a.O("Failure(failureMessageStringRes="), this.a, ")");
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: UserActionsDialogViewModel.kt */
|
|
|
|
/* renamed from: c.a.a.b.f$b$b reason: collision with other inner class name */
|
|
|
|
public static final class C0003b extends b {
|
|
|
|
public final int a;
|
|
|
|
|
|
|
|
public C0003b(int i) {
|
|
|
|
super(null);
|
|
|
|
this.a = i;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean equals(Object obj) {
|
|
|
|
if (this != obj) {
|
|
|
|
return (obj instanceof C0003b) && this.a == ((C0003b) obj).a;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int hashCode() {
|
|
|
|
return this.a;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String toString() {
|
2021-10-09 06:29:02 +00:00
|
|
|
return c.d.b.a.a.z(c.d.b.a.a.O("Success(successMessageStringRes="), this.a, ")");
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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 */
|
2021-08-25 07:02:36 +00:00
|
|
|
public final GuildMember f35c;
|
2021-07-24 02:37:17 +00:00
|
|
|
|
|
|
|
public c(User user, Integer num, GuildMember guildMember) {
|
|
|
|
this.a = user;
|
|
|
|
this.b = num;
|
2021-08-25 07:02:36 +00:00
|
|
|
this.f35c = guildMember;
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 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 */
|
2021-08-25 07:02:36 +00:00
|
|
|
public final boolean f36c;
|
2021-07-24 02:37:17 +00:00
|
|
|
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;
|
2021-08-25 07:02:36 +00:00
|
|
|
this.f36c = z2;
|
2021-07-24 02:37:17 +00:00
|
|
|
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;
|
2021-08-25 07:02:36 +00:00
|
|
|
return m.areEqual(this.a, aVar.a) && m.areEqual(this.b, aVar.b) && this.f36c == aVar.f36c && this.d == aVar.d && this.e == aVar.e;
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
2021-08-25 07:02:36 +00:00
|
|
|
boolean z2 = this.f36c;
|
2021-07-24 02:37:17 +00:00
|
|
|
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() {
|
2021-10-09 06:29:02 +00:00
|
|
|
StringBuilder O = c.d.b.a.a.O("Loaded(user=");
|
|
|
|
O.append(this.a);
|
|
|
|
O.append(", userNickname=");
|
|
|
|
O.append(this.b);
|
|
|
|
O.append(", showBlockItem=");
|
|
|
|
O.append(this.f36c);
|
|
|
|
O.append(", showUnblockItem=");
|
|
|
|
O.append(this.d);
|
|
|
|
O.append(", showRemoveFriendItem=");
|
|
|
|
return c.d.b.a.a.K(O, this.e, ")");
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 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<Void, Unit> {
|
|
|
|
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<b> publishSubject = fVar.j;
|
|
|
|
publishSubject.j.onNext(new b.C0003b(i));
|
|
|
|
return Unit.a;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: UserActionsDialogViewModel.kt */
|
|
|
|
/* renamed from: c.a.a.b.f$f reason: collision with other inner class name */
|
|
|
|
public static final class C0004f extends o implements Function1<Error, Unit> {
|
|
|
|
public final /* synthetic */ f this$0;
|
|
|
|
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
|
|
public C0004f(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<b> publishSubject = this.this$0.j;
|
2021-08-09 22:51:56 +00:00
|
|
|
publishSubject.j.onNext(new b.a(R.string.default_failure_to_perform_action_message));
|
2021-07-24 02:37:17 +00:00
|
|
|
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<User> observeUser = users.observeUser(j);
|
|
|
|
Observable<Integer> observe = userRelationships.observe(j);
|
2021-10-22 06:43:45 +00:00
|
|
|
Observable q = channels.observeChannel(j2).Y(new d(guilds, j)).q();
|
2021-10-15 06:18:26 +00:00
|
|
|
m.checkNotNullExpressionValue(q, "storeChannels\n … .distinctUntilChanged()");
|
|
|
|
observable2 = Observable.i(observeUser, observe, q, e.a).q();
|
2021-07-24 02:37:17 +00:00
|
|
|
m.checkNotNullExpressionValue(observable2, "Observable.combineLatest… .distinctUntilChanged()");
|
|
|
|
} else {
|
|
|
|
observable2 = null;
|
|
|
|
}
|
|
|
|
m.checkNotNullParameter(api, "restAPI");
|
|
|
|
m.checkNotNullParameter(observable2, "storeObservable");
|
|
|
|
this.k = j;
|
|
|
|
this.l = api;
|
2021-10-22 06:43:45 +00:00
|
|
|
this.j = PublishSubject.k0();
|
2021-07-24 02:37:17 +00:00
|
|
|
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 C0004f(this), (Function0) null, (Function0) null, new e(this, i2), 54, (Object) null);
|
|
|
|
}
|
|
|
|
}
|