discord-jadx/app/src/main/java/com/discord/utilities/platform/Platform.java
2021-07-19 21:45:22 +02:00

234 lines
9.5 KiB
Java

package com.discord.utilities.platform;
import androidx.annotation.ColorRes;
import androidx.annotation.DrawableRes;
import c.d.b.a.a;
import com.discord.api.activity.ActivityPlatform;
import com.discord.models.domain.ModelConnectedAccount;
import d0.g0.w;
import d0.z.d.m;
import java.util.Locale;
import java.util.Objects;
import kotlin.jvm.internal.DefaultConstructorMarker;
/* compiled from: Platform.kt */
public enum Platform {
XBOX("Xbox Live", 2131100468, 2131231375, 2131232091, false, true, true, 16, null),
BATTLENET("Battle.Net", 2131099687, 2131231357, 2131231455, false, false, false, 112, null),
FACEBOOK("Facebook", 2131099868, 2131231362, 2131231618, true, false, true, 32, null),
GOOGLE("Google", 2131099905, 2131231364, 2131231675, false, false, false, 112, null),
LEAGUEOFLEGENDS("League of Legends", 2131099922, 2131231365, 2131231752, false, false, false, 112, null),
OBS("OBS", null, 2131231367, null, false, false, false, 122, null),
PATREON("Patreon", null, 2131231368, null, false, false, false, 122, null),
REDDIT("Reddit", 2131100216, 2131231369, 2131231913, false, false, true, 48, null),
SAMSUNG("Samsung Galaxy", null, null, null, false, true, false, 94, null),
SKYPE("Skype", 2131100226, 2131231370, 2131231957, false, false, false, 112, null),
SPOTIFY("Spotify", 2131100228, 2131231371, 2131231974, false, true, true, 16, null),
STEAM("Steam", 2131100365, 2131231372, 2131231993, false, false, true, 48, null),
TWITCH("Twitch", 2131100380, 2131231373, 2131232032, false, false, true, 48, null),
TWITTER("Twitter", 2131100382, 2131231374, 2131232034, false, false, true, 48, null),
XSPLIT("XSplit", null, 2131231376, null, false, false, false, 122, null),
YOUTUBE("Youtube", 2131100470, 2131231377, 2131232092, false, false, true, 48, null),
GITHUB("Github", 2131099901, 2131231363, 2131231671, false, false, true, 48, null),
NONE(null, null, null, null, false, false, false, 127, null);
public static final Companion Companion = new Companion(null);
private final boolean canShowActivity;
private final boolean canSyncFriends;
private final Integer colorResId;
private final boolean enabled;
private final String platformId;
private final Integer platformImage;
private final String properName;
private final Integer whitePlatformImage;
/* compiled from: Platform.kt */
public static final class Companion {
public final /* synthetic */ class WhenMappings {
public static final /* synthetic */ int[] $EnumSwitchMapping$0;
static {
ActivityPlatform.values();
int[] iArr = new int[7];
$EnumSwitchMapping$0 = iArr;
iArr[ActivityPlatform.XBOX.ordinal()] = 1;
iArr[ActivityPlatform.SAMSUNG.ordinal()] = 2;
iArr[ActivityPlatform.SPOTIFY.ordinal()] = 3;
}
}
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
public final Platform from(ActivityPlatform activityPlatform) {
if (activityPlatform != null) {
int ordinal = activityPlatform.ordinal();
if (ordinal == 1) {
return Platform.XBOX;
}
if (ordinal == 4) {
return Platform.SAMSUNG;
}
if (ordinal == 5) {
return Platform.SPOTIFY;
}
}
return Platform.NONE;
}
public final Platform from(ModelConnectedAccount modelConnectedAccount) {
m.checkNotNullParameter(modelConnectedAccount, "connectedAccount");
String type = modelConnectedAccount.getType();
m.checkNotNullExpressionValue(type, "connectedAccount.type");
return from(type);
}
public final Platform from(String str) {
m.checkNotNullParameter(str, "platformName");
try {
String obj = w.trim(str).toString();
Locale locale = Locale.ENGLISH;
m.checkNotNullExpressionValue(locale, "Locale.ENGLISH");
if (obj != null) {
String upperCase = obj.toUpperCase(locale);
m.checkNotNullExpressionValue(upperCase, "(this as java.lang.String).toUpperCase(locale)");
return Platform.valueOf(upperCase);
}
throw new NullPointerException("null cannot be cast to non-null type java.lang.String");
} catch (Exception unused) {
return Platform.NONE;
}
}
}
public final /* synthetic */ class WhenMappings {
public static final /* synthetic */ int[] $EnumSwitchMapping$0;
static {
Platform.values();
int[] iArr = new int[18];
$EnumSwitchMapping$0 = iArr;
iArr[Platform.FACEBOOK.ordinal()] = 1;
iArr[Platform.SPOTIFY.ordinal()] = 2;
iArr[Platform.STEAM.ordinal()] = 3;
iArr[Platform.YOUTUBE.ordinal()] = 4;
iArr[Platform.REDDIT.ordinal()] = 5;
iArr[Platform.TWITTER.ordinal()] = 6;
iArr[Platform.TWITCH.ordinal()] = 7;
iArr[Platform.GITHUB.ordinal()] = 8;
}
}
private Platform(String str, @ColorRes Integer num, @DrawableRes Integer num2, @DrawableRes Integer num3, boolean z2, boolean z3, boolean z4) {
this.properName = str;
this.colorResId = num;
this.platformImage = num2;
this.whitePlatformImage = num3;
this.canSyncFriends = z2;
this.canShowActivity = z3;
this.enabled = z4;
String name = name();
Locale locale = Locale.ENGLISH;
m.checkNotNullExpressionValue(locale, "Locale.ENGLISH");
Objects.requireNonNull(name, "null cannot be cast to non-null type java.lang.String");
String lowerCase = name.toLowerCase(locale);
m.checkNotNullExpressionValue(lowerCase, "(this as java.lang.String).toLowerCase(locale)");
this.platformId = lowerCase;
}
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
public /* synthetic */ Platform(String str, Integer num, Integer num2, Integer num3, boolean z2, boolean z3, boolean z4, int i, DefaultConstructorMarker defaultConstructorMarker) {
this((i & 1) != 0 ? "" : str, (i & 2) != 0 ? null : num, (i & 4) != 0 ? null : num2, (i & 8) != 0 ? null : num3, (i & 16) != 0 ? false : z2, (i & 32) != 0 ? false : z3, (i & 64) != 0 ? false : z4);
}
public static final Platform from(ActivityPlatform activityPlatform) {
return Companion.from(activityPlatform);
}
public static final Platform from(ModelConnectedAccount modelConnectedAccount) {
return Companion.from(modelConnectedAccount);
}
public static final Platform from(String str) {
return Companion.from(str);
}
public final boolean getCanShowActivity() {
return this.canShowActivity;
}
public final boolean getCanSyncFriends() {
return this.canSyncFriends;
}
public final Integer getColorResId() {
return this.colorResId;
}
public final boolean getEnabled() {
return this.enabled;
}
public final String getPlatformId() {
return this.platformId;
}
public final Integer getPlatformImage() {
return this.platformImage;
}
public final String getProfileUrl(ModelConnectedAccount modelConnectedAccount) {
m.checkNotNullParameter(modelConnectedAccount, "connectedAccount");
int ordinal = ordinal();
if (ordinal == 2) {
StringBuilder K = a.K("https://www.facebook.com/");
K.append(modelConnectedAccount.getId());
return K.toString();
} else if (ordinal == 7) {
StringBuilder K2 = a.K("https://reddit.com/u/");
K2.append(modelConnectedAccount.getUsername());
return K2.toString();
} else if (ordinal == 15) {
StringBuilder K3 = a.K("https://youtube.com/channel/");
K3.append(modelConnectedAccount.getId());
return K3.toString();
} else if (ordinal != 16) {
switch (ordinal) {
case 10:
StringBuilder K4 = a.K("https://open.spotify.com/user/");
K4.append(modelConnectedAccount.getId());
return K4.toString();
case 11:
StringBuilder K5 = a.K("https://steamcommunity.com/profiles/");
K5.append(modelConnectedAccount.getId());
return K5.toString();
case 12:
StringBuilder K6 = a.K("https://twitch.tv/");
K6.append(modelConnectedAccount.getUsername());
return K6.toString();
case 13:
StringBuilder K7 = a.K("https://www.twitter.com/");
K7.append(modelConnectedAccount.getUsername());
return K7.toString();
default:
return null;
}
} else {
StringBuilder K8 = a.K("https://github.com/");
K8.append(modelConnectedAccount.getUsername());
return K8.toString();
}
}
public final String getProperName() {
return this.properName;
}
public final Integer getWhitePlatformImage() {
return this.whitePlatformImage;
}
}