discord-jadx/app/src/main/java/com/discord/gateway/GatewaySocket$presenceUpdat...

83 lines
3.3 KiB
Java

package com.discord.gateway;
import c.d.b.a.a;
import com.discord.api.activity.Activity;
import com.discord.api.presence.ClientStatus;
import com.discord.gateway.GatewaySocket;
import com.discord.gateway.io.Outgoing;
import com.discord.gateway.io.OutgoingPayload;
import com.discord.gateway.opcodes.Opcode;
import com.discord.utilities.logging.Logger;
import d0.t.n;
import d0.t.u;
import d0.z.d.m;
import d0.z.d.o;
import java.util.List;
import java.util.Locale;
import kotlin.Unit;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
/* compiled from: GatewaySocket.kt */
public final class GatewaySocket$presenceUpdate$1 extends o implements Function0<Unit> {
public final /* synthetic */ List $activities;
public final /* synthetic */ Boolean $afk;
public final /* synthetic */ Long $since;
public final /* synthetic */ ClientStatus $status;
public final /* synthetic */ GatewaySocket this$0;
/* compiled from: GatewaySocket.kt */
/* renamed from: com.discord.gateway.GatewaySocket$presenceUpdate$1$1 reason: invalid class name */
public static final class AnonymousClass1 extends o implements Function1<Activity, CharSequence> {
public static final AnonymousClass1 INSTANCE = new AnonymousClass1();
public AnonymousClass1() {
super(1);
}
public final CharSequence invoke(Activity activity) {
m.checkNotNullParameter(activity, "it");
return activity.h();
}
}
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public GatewaySocket$presenceUpdate$1(GatewaySocket gatewaySocket, ClientStatus clientStatus, List list, Long l, Boolean bool) {
super(0);
this.this$0 = gatewaySocket;
this.$status = clientStatus;
this.$activities = list;
this.$since = l;
this.$afk = bool;
}
@Override // kotlin.jvm.functions.Function0
/* renamed from: invoke */
public final void mo1invoke() {
String name;
GatewaySocket.Companion companion = GatewaySocket.Companion;
Logger access$getLogger$p = GatewaySocket.access$getLogger$p(this.this$0);
StringBuilder K = a.K("Sending self presence update: ");
K.append(this.$status);
K.append(' ');
List list = this.$activities;
String str = null;
K.append(list != null ? u.joinToString$default(list, null, null, null, 0, null, AnonymousClass1.INSTANCE, 31, null) : null);
GatewaySocket.Companion.log$default(companion, access$getLogger$p, K.toString(), false, 2, null);
GatewaySocket gatewaySocket = this.this$0;
Opcode opcode = Opcode.PRESENCE_UPDATE;
ClientStatus clientStatus = this.$status;
if (!(clientStatus == null || (name = clientStatus.name()) == null)) {
Locale locale = Locale.ROOT;
m.checkNotNullExpressionValue(locale, "Locale.ROOT");
str = name.toLowerCase(locale);
m.checkNotNullExpressionValue(str, "(this as java.lang.String).toLowerCase(locale)");
}
Long l = this.$since;
List list2 = this.$activities;
if (list2 == null) {
list2 = n.emptyList();
}
GatewaySocket.send$default(gatewaySocket, new Outgoing(opcode, new OutgoingPayload.PresenceUpdate(str, l, list2, this.$afk)), false, null, 6, null);
}
}