68 lines
2.5 KiB
Java
68 lines
2.5 KiB
Java
|
package com.discord.utilities.rest;
|
||
|
|
||
|
import com.airbnb.lottie.parser.AnimatableValueParser;
|
||
|
import com.discord.api.channel.Channel;
|
||
|
import com.discord.models.user.User;
|
||
|
import com.discord.restapi.RestAPIParams;
|
||
|
import com.discord.stores.StoreStream;
|
||
|
import com.discord.utilities.rx.ObservableExtensionsKt;
|
||
|
import j0.k.b;
|
||
|
import j0.l.e.j;
|
||
|
import java.util.Iterator;
|
||
|
import java.util.Map;
|
||
|
import rx.Observable;
|
||
|
import rx.functions.Action1;
|
||
|
/* compiled from: RestAPI.kt */
|
||
|
public final class RestAPI$createOrFetchDM$1<T, R> implements b<Map<Long, ? extends Channel>, Observable<? extends Channel>> {
|
||
|
public final /* synthetic */ long $userId;
|
||
|
public final /* synthetic */ RestAPI this$0;
|
||
|
|
||
|
/* compiled from: RestAPI.kt */
|
||
|
/* renamed from: com.discord.utilities.rest.RestAPI$createOrFetchDM$1$1 reason: invalid class name */
|
||
|
public static final class AnonymousClass1<T> implements Action1<Channel> {
|
||
|
public static final AnonymousClass1 INSTANCE = new AnonymousClass1();
|
||
|
|
||
|
public final void call(Channel channel) {
|
||
|
StoreStream.Companion.getGatewaySocket().getChannelCreateOrUpdate().j.onNext(channel);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public RestAPI$createOrFetchDM$1(RestAPI restAPI, long j) {
|
||
|
this.this$0 = restAPI;
|
||
|
this.$userId = j;
|
||
|
}
|
||
|
|
||
|
/* 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 // j0.k.b
|
||
|
public /* bridge */ /* synthetic */ Observable<? extends Channel> call(Map<Long, ? extends Channel> map) {
|
||
|
return call((Map<Long, Channel>) map);
|
||
|
}
|
||
|
|
||
|
public final Observable<? extends Channel> call(Map<Long, Channel> map) {
|
||
|
T t;
|
||
|
boolean z2;
|
||
|
Iterator<T> it = map.values().iterator();
|
||
|
while (true) {
|
||
|
if (!it.hasNext()) {
|
||
|
t = null;
|
||
|
break;
|
||
|
}
|
||
|
t = it.next();
|
||
|
User v0 = AnimatableValueParser.v0(t);
|
||
|
if (v0 == null || v0.getId() != this.$userId) {
|
||
|
z2 = false;
|
||
|
continue;
|
||
|
} else {
|
||
|
z2 = true;
|
||
|
continue;
|
||
|
}
|
||
|
if (z2) {
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
T t2 = t;
|
||
|
return t2 != null ? new j(t2) : ObservableExtensionsKt.restSubscribeOn$default(RestAPI.access$get_api$p(this.this$0).userCreateChannel(new RestAPIParams.CreateChannel(this.$userId)), false, 1, null).t(AnonymousClass1.INSTANCE);
|
||
|
}
|
||
|
}
|