discord-jadx/app/src/main/java/com/discord/api/activity/ActivityPlatformTypeAdapter...

80 lines
2.9 KiB
Java

package com.discord.api.activity;
import com.google.gson.TypeAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import d0.z.d.m;
import java.util.Locale;
/* compiled from: ActivityPlatform.kt */
public final class ActivityPlatformTypeAdapter extends TypeAdapter<ActivityPlatform> {
/* Return type fixed from 'java.lang.Object' to match base method */
@Override // com.google.gson.TypeAdapter
public ActivityPlatform read(JsonReader jsonReader) {
m.checkNotNullParameter(jsonReader, "in");
String J = jsonReader.J();
if (J != null) {
switch (J.hashCode()) {
case -1998723398:
if (J.equals("spotify")) {
return ActivityPlatform.SPOTIFY;
}
break;
case -861391249:
if (J.equals("android")) {
return ActivityPlatform.ANDROID;
}
break;
case 104461:
if (J.equals("ios")) {
return ActivityPlatform.IOS;
}
break;
case 111249:
if (J.equals("ps4")) {
return ActivityPlatform.PS4;
}
break;
case 111250:
if (J.equals("ps5")) {
return ActivityPlatform.PS5;
}
break;
case 3672659:
if (J.equals("xbox")) {
return ActivityPlatform.XBOX;
}
break;
case 1557106716:
if (J.equals("desktop")) {
return ActivityPlatform.DESKTOP;
}
break;
case 1864941562:
if (J.equals("samsung")) {
return ActivityPlatform.SAMSUNG;
}
break;
}
}
return ActivityPlatform.UNKNOWN;
}
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [com.google.gson.stream.JsonWriter, java.lang.Object] */
@Override // com.google.gson.TypeAdapter
public void write(JsonWriter jsonWriter, ActivityPlatform activityPlatform) {
String str;
String name;
ActivityPlatform activityPlatform2 = activityPlatform;
m.checkNotNullParameter(jsonWriter, "out");
if (activityPlatform2 == null || (name = activityPlatform2.name()) == null) {
str = null;
} else {
Locale locale = Locale.ROOT;
m.checkNotNullExpressionValue(locale, "Locale.ROOT");
str = name.toLowerCase(locale);
m.checkNotNullExpressionValue(str, "(this as java.lang.String).toLowerCase(locale)");
}
jsonWriter.H(str);
}
}