discord-jadx/app/src/main/java/com/discord/utilities/platform/Platform.java
2021-07-04 01:36:06 +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, 2131231371, 2131232068, false, true, true, 16, null),
BATTLENET("Battle.Net", 2131099687, 2131231353, 2131231446, false, false, false, 112, null),
FACEBOOK("Facebook", 2131099868, 2131231358, 2131231604, true, false, true, 32, null),
GOOGLE("Google", 2131099905, 2131231360, 2131231661, false, false, false, 112, null),
LEAGUEOFLEGENDS("League of Legends", 2131099922, 2131231361, 2131231735, false, false, false, 112, null),
OBS("OBS", null, 2131231363, null, false, false, false, 122, null),
PATREON("Patreon", null, 2131231364, null, false, false, false, 122, null),
REDDIT("Reddit", 2131100216, 2131231365, 2131231893, false, false, true, 48, null),
SAMSUNG("Samsung Galaxy", null, null, null, false, true, false, 94, null),
SKYPE("Skype", 2131100226, 2131231366, 2131231936, false, false, false, 112, null),
SPOTIFY("Spotify", 2131100228, 2131231367, 2131231953, false, true, true, 16, null),
STEAM("Steam", 2131100365, 2131231368, 2131231972, false, false, true, 48, null),
TWITCH("Twitch", 2131100380, 2131231369, 2131232009, false, false, true, 48, null),
TWITTER("Twitter", 2131100382, 2131231370, 2131232011, false, false, true, 48, null),
XSPLIT("XSplit", null, 2131231372, null, false, false, false, 122, null),
YOUTUBE("Youtube", 2131100470, 2131231373, 2131232069, false, false, true, 48, null),
GITHUB("Github", 2131099901, 2131231359, 2131231657, 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 L = a.L("https://www.facebook.com/");
L.append(modelConnectedAccount.getId());
return L.toString();
} else if (ordinal == 7) {
StringBuilder L2 = a.L("https://reddit.com/u/");
L2.append(modelConnectedAccount.getUsername());
return L2.toString();
} else if (ordinal == 15) {
StringBuilder L3 = a.L("https://youtube.com/channel/");
L3.append(modelConnectedAccount.getId());
return L3.toString();
} else if (ordinal != 16) {
switch (ordinal) {
case 10:
StringBuilder L4 = a.L("https://open.spotify.com/user/");
L4.append(modelConnectedAccount.getId());
return L4.toString();
case 11:
StringBuilder L5 = a.L("https://steamcommunity.com/profiles/");
L5.append(modelConnectedAccount.getId());
return L5.toString();
case 12:
StringBuilder L6 = a.L("https://twitch.tv/");
L6.append(modelConnectedAccount.getUsername());
return L6.toString();
case 13:
StringBuilder L7 = a.L("https://www.twitter.com/");
L7.append(modelConnectedAccount.getUsername());
return L7.toString();
default:
return null;
}
} else {
StringBuilder L8 = a.L("https://github.com/");
L8.append(modelConnectedAccount.getUsername());
return L8.toString();
}
}
public final String getProperName() {
return this.properName;
}
public final Integer getWhitePlatformImage() {
return this.whitePlatformImage;
}
}