2021-12-17 21:59:34 +00:00
|
|
|
package b.a.a.d;
|
2021-07-24 02:37:17 +00:00
|
|
|
|
|
|
|
import android.content.Context;
|
|
|
|
import androidx.annotation.StringRes;
|
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;
|
2021-11-02 06:38:17 +00:00
|
|
|
import d0.z.d.m;
|
|
|
|
import d0.z.d.o;
|
2021-07-24 02:37:17 +00:00
|
|
|
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 */
|
2022-03-07 09:34:54 +00:00
|
|
|
/* loaded from: classes.dex */
|
2021-07-24 02:37:17 +00:00
|
|
|
public final class f extends AppViewModel<d> {
|
2021-12-02 18:53:44 +00:00
|
|
|
public static final a j = new a(null);
|
|
|
|
public final PublishSubject<b> k;
|
|
|
|
public final long l;
|
|
|
|
public final RestAPI m;
|
2021-07-24 02:37:17 +00:00
|
|
|
|
|
|
|
/* compiled from: UserActionsDialogViewModel.kt */
|
2022-03-07 09:34:54 +00:00
|
|
|
/* loaded from: classes.dex */
|
2021-07-24 02:37:17 +00:00
|
|
|
public static final class a {
|
|
|
|
public a(DefaultConstructorMarker defaultConstructorMarker) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: UserActionsDialogViewModel.kt */
|
2022-03-07 09:34:54 +00:00
|
|
|
/* loaded from: classes.dex */
|
2021-07-24 02:37:17 +00:00
|
|
|
public static abstract class b {
|
|
|
|
|
|
|
|
/* compiled from: UserActionsDialogViewModel.kt */
|
2022-03-07 09:34:54 +00:00
|
|
|
/* loaded from: classes.dex */
|
2021-07-24 02:37:17 +00:00
|
|
|
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() {
|
2022-03-14 07:58:47 +00:00
|
|
|
return b.d.b.a.a.A(b.d.b.a.a.S("Failure(failureMessageStringRes="), this.a, ")");
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: UserActionsDialogViewModel.kt */
|
2021-12-17 21:59:34 +00:00
|
|
|
/* renamed from: b.a.a.d.f$b$b reason: collision with other inner class name */
|
2022-03-07 09:34:54 +00:00
|
|
|
/* loaded from: classes.dex */
|
2022-03-12 00:35:13 +00:00
|
|
|
public static final class C0021b extends b {
|
2021-07-24 02:37:17 +00:00
|
|
|
public final int a;
|
|
|
|
|
2022-03-12 00:35:13 +00:00
|
|
|
public C0021b(int i) {
|
2021-07-24 02:37:17 +00:00
|
|
|
super(null);
|
|
|
|
this.a = i;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean equals(Object obj) {
|
|
|
|
if (this != obj) {
|
2022-03-12 00:35:13 +00:00
|
|
|
return (obj instanceof C0021b) && this.a == ((C0021b) obj).a;
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int hashCode() {
|
|
|
|
return this.a;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String toString() {
|
2022-03-14 07:58:47 +00:00
|
|
|
return b.d.b.a.a.A(b.d.b.a.a.S("Success(successMessageStringRes="), this.a, ")");
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public b() {
|
|
|
|
}
|
|
|
|
|
|
|
|
public b(DefaultConstructorMarker defaultConstructorMarker) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: UserActionsDialogViewModel.kt */
|
2022-03-07 09:34:54 +00:00
|
|
|
/* loaded from: classes.dex */
|
2021-07-24 02:37:17 +00:00
|
|
|
public static final class c {
|
|
|
|
public final User a;
|
|
|
|
|
2021-12-17 21:59:34 +00:00
|
|
|
/* renamed from: b reason: collision with root package name */
|
2022-03-12 00:35:13 +00:00
|
|
|
public final Integer f46b;
|
2021-12-17 21:59:34 +00:00
|
|
|
public final GuildMember c;
|
2021-07-24 02:37:17 +00:00
|
|
|
|
|
|
|
public c(User user, Integer num, GuildMember guildMember) {
|
|
|
|
this.a = user;
|
2022-03-12 00:35:13 +00:00
|
|
|
this.f46b = num;
|
2021-12-17 21:59:34 +00:00
|
|
|
this.c = guildMember;
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: UserActionsDialogViewModel.kt */
|
2022-03-07 09:34:54 +00:00
|
|
|
/* loaded from: classes.dex */
|
2021-07-24 02:37:17 +00:00
|
|
|
public static abstract class d {
|
|
|
|
|
|
|
|
/* compiled from: UserActionsDialogViewModel.kt */
|
2022-03-07 09:34:54 +00:00
|
|
|
/* loaded from: classes.dex */
|
2021-07-24 02:37:17 +00:00
|
|
|
public static final class a extends d {
|
|
|
|
public final User a;
|
|
|
|
|
2021-12-17 21:59:34 +00:00
|
|
|
/* renamed from: b reason: collision with root package name */
|
2022-03-12 00:35:13 +00:00
|
|
|
public final String f47b;
|
2021-12-17 21:59:34 +00:00
|
|
|
public final boolean c;
|
2021-07-24 02:37:17 +00:00
|
|
|
public final boolean d;
|
|
|
|
public final boolean e;
|
|
|
|
|
2022-03-07 09:34:54 +00:00
|
|
|
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
2021-07-24 02:37:17 +00:00
|
|
|
public a(User user, String str, boolean z2, boolean z3, boolean z4) {
|
|
|
|
super(null);
|
|
|
|
m.checkNotNullParameter(user, "user");
|
|
|
|
this.a = user;
|
2022-03-12 00:35:13 +00:00
|
|
|
this.f47b = str;
|
2021-12-17 21:59:34 +00:00
|
|
|
this.c = 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;
|
2022-03-12 00:35:13 +00:00
|
|
|
return m.areEqual(this.a, aVar.a) && m.areEqual(this.f47b, aVar.f47b) && this.c == aVar.c && 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;
|
2022-03-12 00:35:13 +00:00
|
|
|
String str = this.f47b;
|
2021-07-24 02:37:17 +00:00
|
|
|
if (str != null) {
|
|
|
|
i = str.hashCode();
|
|
|
|
}
|
|
|
|
int i2 = (hashCode + i) * 31;
|
2021-12-17 21:59:34 +00:00
|
|
|
boolean z2 = this.c;
|
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() {
|
2022-03-14 07:58:47 +00:00
|
|
|
StringBuilder S = b.d.b.a.a.S("Loaded(user=");
|
|
|
|
S.append(this.a);
|
|
|
|
S.append(", userNickname=");
|
|
|
|
S.append(this.f47b);
|
|
|
|
S.append(", showBlockItem=");
|
|
|
|
S.append(this.c);
|
|
|
|
S.append(", showUnblockItem=");
|
|
|
|
S.append(this.d);
|
|
|
|
S.append(", showRemoveFriendItem=");
|
|
|
|
return b.d.b.a.a.N(S, this.e, ")");
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: UserActionsDialogViewModel.kt */
|
2022-03-07 09:34:54 +00:00
|
|
|
/* loaded from: classes.dex */
|
2021-07-24 02:37:17 +00:00
|
|
|
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 */
|
2022-03-07 09:34:54 +00:00
|
|
|
/* loaded from: classes.dex */
|
2021-07-24 02:37:17 +00:00
|
|
|
public static final class e extends o implements Function1<Void, Unit> {
|
|
|
|
public final /* synthetic */ int $successMessageStringRes;
|
|
|
|
|
2022-03-07 09:34:54 +00:00
|
|
|
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
|
|
|
public e(int i) {
|
2021-07-24 02:37:17 +00:00
|
|
|
super(1);
|
|
|
|
this.$successMessageStringRes = i;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // kotlin.jvm.functions.Function1
|
|
|
|
public Unit invoke(Void r3) {
|
2022-03-07 09:34:54 +00:00
|
|
|
f fVar = f.this;
|
2021-07-24 02:37:17 +00:00
|
|
|
int i = this.$successMessageStringRes;
|
2021-12-02 18:53:44 +00:00
|
|
|
PublishSubject<b> publishSubject = fVar.k;
|
2022-03-12 00:35:13 +00:00
|
|
|
publishSubject.k.onNext(new b.C0021b(i));
|
2021-07-24 02:37:17 +00:00
|
|
|
return Unit.a;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: UserActionsDialogViewModel.kt */
|
2021-12-17 21:59:34 +00:00
|
|
|
/* renamed from: b.a.a.d.f$f reason: collision with other inner class name */
|
2022-03-07 09:34:54 +00:00
|
|
|
/* loaded from: classes.dex */
|
2022-03-12 00:35:13 +00:00
|
|
|
public static final class C0022f extends o implements Function1<Error, Unit> {
|
|
|
|
public C0022f() {
|
2021-07-24 02:37:17 +00:00
|
|
|
super(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // kotlin.jvm.functions.Function1
|
|
|
|
public Unit invoke(Error error) {
|
|
|
|
m.checkNotNullParameter(error, "it");
|
2022-03-07 09:34:54 +00:00
|
|
|
PublishSubject<b> publishSubject = f.this.k;
|
2021-12-02 18:53:44 +00:00
|
|
|
publishSubject.k.onNext(new b.a(R.string.default_failure_to_perform_action_message));
|
2021-07-24 02:37:17 +00:00
|
|
|
return Unit.a;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-07 09:34:54 +00:00
|
|
|
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
2021-12-02 18:53:44 +00:00
|
|
|
public f(long j2, long j3, RestAPI restAPI, Observable observable, int i) {
|
2021-07-24 02:37:17 +00:00
|
|
|
super(d.b.a);
|
|
|
|
Observable observable2;
|
2021-12-02 18:53:44 +00:00
|
|
|
RestAPI api = (i & 4) != 0 ? RestAPI.Companion.getApi() : null;
|
|
|
|
if ((i & 8) != 0) {
|
2021-07-24 02:37:17 +00:00
|
|
|
StoreStream.Companion companion = StoreStream.Companion;
|
|
|
|
StoreUser users = companion.getUsers();
|
|
|
|
StoreUserRelationships userRelationships = companion.getUserRelationships();
|
|
|
|
StoreGuilds guilds = companion.getGuilds();
|
|
|
|
StoreChannels channels = companion.getChannels();
|
2021-12-02 18:53:44 +00:00
|
|
|
Observable<User> observeUser = users.observeUser(j2);
|
|
|
|
Observable<Integer> observe = userRelationships.observe(j2);
|
|
|
|
Observable q = channels.observeChannel(j3).Y(new d(guilds, j2)).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");
|
2021-12-02 18:53:44 +00:00
|
|
|
this.l = j2;
|
|
|
|
this.m = api;
|
|
|
|
this.k = 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);
|
|
|
|
}
|
|
|
|
|
2021-12-02 18:53:44 +00:00
|
|
|
public final void removeRelationship(@StringRes int i) {
|
2022-03-12 00:35:13 +00:00
|
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(ObservableExtensionsKt.restSubscribeOn$default(this.m.removeRelationship("User Profile", this.l), false, 1, null), this, null, 2, null), f.class, (Context) null, (Function1) null, new C0022f(), (Function0) null, (Function0) null, new e(i), 54, (Object) null);
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
}
|