93 lines
4.6 KiB
Java
93 lines
4.6 KiB
Java
package com.discord.widgets.user.presence;
|
|
|
|
import com.discord.api.activity.Activity;
|
|
import com.discord.api.activity.ActivityAssets;
|
|
import com.discord.models.presence.Presence;
|
|
import com.discord.utilities.presence.ActivityUtilsKt;
|
|
import com.discord.utilities.presence.StageCallRichPresencePartyData;
|
|
import d0.f0.q;
|
|
import d0.t.m0;
|
|
import d0.t.n0;
|
|
import d0.t.u;
|
|
import d0.z.d.o;
|
|
import j0.k.b;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import kotlin.jvm.functions.Function1;
|
|
/* compiled from: ModelStageRichPresence.kt */
|
|
public final class ModelStageRichPresence$Companion$observeStageRichPresence$1<T, R> implements b<Map<Long, ? extends Presence>, List<? extends ModelStageRichPresence>> {
|
|
public static final ModelStageRichPresence$Companion$observeStageRichPresence$1 INSTANCE = new ModelStageRichPresence$Companion$observeStageRichPresence$1();
|
|
|
|
/* compiled from: ModelStageRichPresence.kt */
|
|
/* renamed from: com.discord.widgets.user.presence.ModelStageRichPresence$Companion$observeStageRichPresence$1$1 reason: invalid class name */
|
|
public static final class AnonymousClass1 extends o implements Function1<Long, ModelStageRichPresence> {
|
|
public final /* synthetic */ Map $userPresences;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public AnonymousClass1(Map map) {
|
|
super(1);
|
|
this.$userPresences = map;
|
|
}
|
|
|
|
public final ModelStageRichPresence invoke(long j) {
|
|
List<Activity> activities;
|
|
T t;
|
|
StageCallRichPresencePartyData stageChannelRichPresencePartyData;
|
|
String str;
|
|
Presence presence = (Presence) this.$userPresences.get(Long.valueOf(j));
|
|
String str2 = null;
|
|
if (!(presence == null || (activities = presence.getActivities()) == null)) {
|
|
Iterator<T> it = activities.iterator();
|
|
while (true) {
|
|
if (!it.hasNext()) {
|
|
t = null;
|
|
break;
|
|
}
|
|
t = it.next();
|
|
if (ActivityUtilsKt.isStageChannelActivity(t)) {
|
|
break;
|
|
}
|
|
}
|
|
T t2 = t;
|
|
if (!(t2 == null || (stageChannelRichPresencePartyData = ActivityUtilsKt.getStageChannelRichPresencePartyData(t2)) == null)) {
|
|
long channelId = stageChannelRichPresencePartyData.getChannelId();
|
|
long stageInstanceId = stageChannelRichPresencePartyData.getStageInstanceId();
|
|
boolean userIsSpeaker = stageChannelRichPresencePartyData.getUserIsSpeaker();
|
|
long guildId = stageChannelRichPresencePartyData.getGuildId();
|
|
boolean guildIsPartnered = stageChannelRichPresencePartyData.getGuildIsPartnered();
|
|
boolean guildIsVerified = stageChannelRichPresencePartyData.getGuildIsVerified();
|
|
ActivityAssets b = t2.b();
|
|
if (b != null) {
|
|
str2 = b.c();
|
|
}
|
|
ActivityAssets b2 = t2.b();
|
|
if (b2 == null || (str = b2.d()) == null) {
|
|
str = "";
|
|
}
|
|
return new ModelStageRichPresence(channelId, stageInstanceId, userIsSpeaker, guildId, guildIsPartnered, guildIsVerified, str, str2, t2.h(), m0.setOf(Long.valueOf(j)), stageChannelRichPresencePartyData.getUserIsSpeaker() ? m0.setOf(Long.valueOf(j)) : n0.emptySet(), stageChannelRichPresencePartyData.getSpeakerCount(), stageChannelRichPresencePartyData.getAudienceSize());
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
/* 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 /* bridge */ /* synthetic */ ModelStageRichPresence invoke(Long l) {
|
|
return invoke(l.longValue());
|
|
}
|
|
}
|
|
|
|
/* 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 */ List<? extends ModelStageRichPresence> call(Map<Long, ? extends Presence> map) {
|
|
return call((Map<Long, Presence>) map);
|
|
}
|
|
|
|
public final List<ModelStageRichPresence> call(Map<Long, Presence> map) {
|
|
return q.toList(q.mapNotNull(u.asSequence(map.keySet()), new AnonymousClass1(map)));
|
|
}
|
|
}
|