discord-jadx/app/src/main/java/com/discord/utilities/platform/Platform.java

236 lines
11 KiB
Java

package com.discord.utilities.platform;
import androidx.annotation.ColorRes;
import androidx.annotation.DrawableRes;
import c.d.b.a.a;
import com.discord.R;
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", Integer.valueOf((int) R.color.xbox), Integer.valueOf((int) R.drawable.ic_account_xbox), Integer.valueOf((int) R.drawable.ic_xbox_white_24dp), false, true, true, 16, null),
BATTLENET("Battle.Net", Integer.valueOf((int) R.color.battlenet), Integer.valueOf((int) R.drawable.ic_account_bnet), Integer.valueOf((int) R.drawable.ic_bnet_white_24dp), false, false, false, 112, null),
FACEBOOK("Facebook", Integer.valueOf((int) R.color.facebook), Integer.valueOf((int) R.drawable.ic_account_facebook), Integer.valueOf((int) R.drawable.ic_facebook_white_24dp), true, false, true, 32, null),
GOOGLE("Google", Integer.valueOf((int) R.color.google), Integer.valueOf((int) R.drawable.ic_account_google), Integer.valueOf((int) R.drawable.ic_google_white_24dp), false, false, false, 112, null),
LEAGUEOFLEGENDS("League of Legends", Integer.valueOf((int) R.color.league_of_legends), Integer.valueOf((int) R.drawable.ic_account_lol), Integer.valueOf((int) R.drawable.ic_lol_white_24dp), false, false, false, 112, null),
OBS("OBS", null, Integer.valueOf((int) R.drawable.ic_account_obs), null, false, false, false, 122, null),
PATREON("Patreon", null, Integer.valueOf((int) R.drawable.ic_account_patreon), null, false, false, false, 122, null),
REDDIT("Reddit", Integer.valueOf((int) R.color.reddit), Integer.valueOf((int) R.drawable.ic_account_reddit), Integer.valueOf((int) R.drawable.ic_reddit_white_24dp), false, false, true, 48, null),
SAMSUNG("Samsung Galaxy", null, null, null, false, true, false, 94, null),
SKYPE("Skype", Integer.valueOf((int) R.color.skype), Integer.valueOf((int) R.drawable.ic_account_skype), Integer.valueOf((int) R.drawable.ic_skype_white_24dp), false, false, false, 112, null),
SPOTIFY("Spotify", Integer.valueOf((int) R.color.spotify), Integer.valueOf((int) R.drawable.ic_account_spotify), Integer.valueOf((int) R.drawable.ic_spotify_white_24dp), false, true, true, 16, null),
STEAM("Steam", Integer.valueOf((int) R.color.steam), Integer.valueOf((int) R.drawable.ic_account_steam), Integer.valueOf((int) R.drawable.ic_steam_white_24dp), false, false, true, 48, null),
TWITCH("Twitch", Integer.valueOf((int) R.color.twitch), Integer.valueOf((int) R.drawable.ic_account_twitch), Integer.valueOf((int) R.drawable.ic_twitch_white_24dp), false, false, true, 48, null),
TWITTER("Twitter", Integer.valueOf((int) R.color.twitter), Integer.valueOf((int) R.drawable.ic_account_twitter), Integer.valueOf((int) R.drawable.ic_twitter_white_24dp), false, false, true, 48, null),
XSPLIT("XSplit", null, Integer.valueOf((int) R.drawable.ic_account_xsplit), null, false, false, false, 122, null),
YOUTUBE("Youtube", Integer.valueOf((int) R.color.youtube), Integer.valueOf((int) R.drawable.ic_account_youtube), Integer.valueOf((int) R.drawable.ic_youtube_gaming_white_24dp), false, false, true, 48, null),
GITHUB("Github", Integer.valueOf((int) R.color.github), Integer.valueOf((int) R.drawable.ic_account_github), Integer.valueOf((int) R.drawable.ic_github_white), 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;
}
}