discord-jadx/app/src/main/java/com/discord/widgets/user/Badge.java

256 lines
11 KiB
Java

package com.discord.widgets.user;
import android.content.Context;
import androidx.annotation.DrawableRes;
import androidx.fragment.app.FragmentManager;
import c.a.k.b;
import c.d.b.a.a;
import com.discord.models.domain.ModelUserProfile;
import com.discord.models.user.User;
import com.discord.utilities.user.UserUtils;
import d0.z.d.m;
import java.util.ArrayList;
import java.util.List;
import kotlin.Unit;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.DefaultConstructorMarker;
/* compiled from: Badge.kt */
public final class Badge {
public static final Companion Companion = new Companion(null);
private static final int PREMIUM_GUILD_SUBSCRIPTION_LEVEL_1_MONTHS = 1;
private static final int PREMIUM_GUILD_SUBSCRIPTION_LEVEL_2_MONTHS = 2;
private static final int PREMIUM_GUILD_SUBSCRIPTION_LEVEL_3_MONTHS = 3;
private static final int PREMIUM_GUILD_SUBSCRIPTION_LEVEL_4_MONTHS = 6;
private static final int PREMIUM_GUILD_SUBSCRIPTION_LEVEL_5_MONTHS = 9;
private static final int PREMIUM_GUILD_SUBSCRIPTION_LEVEL_6_MONTHS = 12;
private static final int PREMIUM_GUILD_SUBSCRIPTION_LEVEL_7_MONTHS = 15;
private static final int PREMIUM_GUILD_SUBSCRIPTION_LEVEL_8_MONTHS = 18;
private static final int PREMIUM_GUILD_SUBSCRIPTION_LEVEL_9_MONTHS = 24;
private final int icon;
private final String objectType;
private final boolean showPremiumUpSell;
private final CharSequence text;
private final CharSequence tooltip;
/* compiled from: Badge.kt */
public static final class Companion {
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
public final List<Badge> getBadgesForUser(User user, ModelUserProfile modelUserProfile, int i, boolean z2, boolean z3, Context context) {
m.checkNotNullParameter(user, "user");
m.checkNotNullParameter(modelUserProfile, "profile");
m.checkNotNullParameter(context, "context");
ArrayList arrayList = new ArrayList(8);
UserUtils userUtils = UserUtils.INSTANCE;
if (userUtils.isStaff(user)) {
arrayList.add(new Badge(2131231899, context.getString(2131893497), null, false, null, 28, null));
}
if (userUtils.isPartner(user)) {
arrayList.add(new Badge(2131231888, context.getString(2131891927), null, false, null, 28, null));
}
if (userUtils.isCertifiedModerator(user)) {
arrayList.add(new Badge(2131231885, context.getString(2131887217), null, false, null, 28, null));
}
if (userUtils.isHypeSquad(user)) {
arrayList.add(new Badge(2131231886, context.getString(2131890337), null, false, null, 28, null));
}
boolean z4 = false;
if (userUtils.isHypesquadHouse1(user)) {
arrayList.add(new Badge(i == 1 ? 2131231726 : 2131231725, context.getString(2131890345), b.g(context, 2131890354, new Object[]{b.g(context, 2131890345, new Object[0], null, 4)}, null, 4), false, null, 24, null));
}
if (userUtils.isHypesquadHouse2(user)) {
arrayList.add(new Badge(i == 2 ? 2131231728 : 2131231727, b.g(context, 2131890346, new Object[0], null, 4), b.g(context, 2131890354, new Object[]{context.getString(2131890346)}, null, 4), false, null, 24, null));
}
if (userUtils.isHypesquadHouse3(user)) {
arrayList.add(new Badge(i == 3 ? 2131231730 : 2131231729, context.getString(2131890347), b.g(context, 2131890354, new Object[]{b.g(context, 2131890347, new Object[0], null, 4)}, null, 4), false, null, 24, null));
}
if (userUtils.isBugHunterLevel1(user)) {
arrayList.add(new Badge(2131231883, context.getString(2131887075), null, false, null, 28, null));
}
if (userUtils.isBugHunterLevel2(user)) {
arrayList.add(new Badge(2131231884, context.getString(2131887075), null, false, null, 28, null));
}
if (userUtils.isVerifiedDeveloper(user)) {
arrayList.add(new Badge(2131231900, context.getString(2131894706), null, false, null, 28, null));
}
if (userUtils.isPremiumEarlySupporter(user)) {
arrayList.add(new Badge(2131231889, context.getString(2131888202), null, !z2 && z3, "PREMIUM_EARLY_SUPPORTER", 4, null));
}
if (modelUserProfile.isPremium()) {
arrayList.add(new Badge(2131231887, context.getString(2131892475), b.g(context, 2131892083, new Object[]{modelUserProfile.getPremiumSince(context)}, null, 4), !z2 && z3, "PREMIUM"));
}
if (modelUserProfile.isPremiumGuildSubscriber()) {
Integer premiumGuildMonthsSubscribed = modelUserProfile.getPremiumGuildMonthsSubscribed();
int i2 = 2131231890;
if (premiumGuildMonthsSubscribed.intValue() >= 24) {
i2 = 2131231898;
} else if (premiumGuildMonthsSubscribed.intValue() >= 18) {
i2 = 2131231897;
} else if (premiumGuildMonthsSubscribed.intValue() >= 15) {
i2 = 2131231896;
} else if (premiumGuildMonthsSubscribed.intValue() >= 12) {
i2 = 2131231895;
} else if (premiumGuildMonthsSubscribed.intValue() >= 9) {
i2 = 2131231894;
} else if (premiumGuildMonthsSubscribed.intValue() >= 6) {
i2 = 2131231893;
} else if (premiumGuildMonthsSubscribed.intValue() >= 3) {
i2 = 2131231892;
} else if (premiumGuildMonthsSubscribed.intValue() >= 2) {
i2 = 2131231891;
} else {
premiumGuildMonthsSubscribed.intValue();
}
String string = context.getString(2131892475);
CharSequence g = b.g(context, 2131892302, new Object[]{modelUserProfile.getPremiumGuildSince(context)}, null, 4);
if (!z2 && z3) {
z4 = true;
}
arrayList.add(new Badge(i2, string, g, z4, "PREMIUM_GUILD"));
}
return arrayList;
}
public final Function1<Badge, Unit> onBadgeClick(FragmentManager fragmentManager, Context context) {
m.checkNotNullParameter(fragmentManager, "fragmentManager");
m.checkNotNullParameter(context, "context");
return new Badge$Companion$onBadgeClick$1(fragmentManager, context);
}
}
public Badge() {
this(0, null, null, false, null, 31, null);
}
public Badge(@DrawableRes int i, CharSequence charSequence, CharSequence charSequence2, boolean z2, String str) {
this.icon = i;
this.text = charSequence;
this.tooltip = charSequence2;
this.showPremiumUpSell = z2;
this.objectType = str;
}
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
public /* synthetic */ Badge(int i, CharSequence charSequence, CharSequence charSequence2, boolean z2, String str, int i2, DefaultConstructorMarker defaultConstructorMarker) {
this((i2 & 1) != 0 ? 0 : i, (i2 & 2) != 0 ? null : charSequence, (i2 & 4) != 0 ? null : charSequence2, (i2 & 8) == 0 ? z2 : false, (i2 & 16) != 0 ? null : str);
}
public static /* synthetic */ Badge copy$default(Badge badge, int i, CharSequence charSequence, CharSequence charSequence2, boolean z2, String str, int i2, Object obj) {
if ((i2 & 1) != 0) {
i = badge.icon;
}
if ((i2 & 2) != 0) {
charSequence = badge.text;
}
if ((i2 & 4) != 0) {
charSequence2 = badge.tooltip;
}
if ((i2 & 8) != 0) {
z2 = badge.showPremiumUpSell;
}
if ((i2 & 16) != 0) {
str = badge.objectType;
}
return badge.copy(i, charSequence, charSequence2, z2, str);
}
public static final Function1<Badge, Unit> onBadgeClick(FragmentManager fragmentManager, Context context) {
return Companion.onBadgeClick(fragmentManager, context);
}
public final int component1() {
return this.icon;
}
public final CharSequence component2() {
return this.text;
}
public final CharSequence component3() {
return this.tooltip;
}
public final boolean component4() {
return this.showPremiumUpSell;
}
public final String component5() {
return this.objectType;
}
public final Badge copy(@DrawableRes int i, CharSequence charSequence, CharSequence charSequence2, boolean z2, String str) {
return new Badge(i, charSequence, charSequence2, z2, str);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof Badge)) {
return false;
}
Badge badge = (Badge) obj;
return this.icon == badge.icon && m.areEqual(this.text, badge.text) && m.areEqual(this.tooltip, badge.tooltip) && this.showPremiumUpSell == badge.showPremiumUpSell && m.areEqual(this.objectType, badge.objectType);
}
public final int getIcon() {
return this.icon;
}
public final String getObjectType() {
return this.objectType;
}
public final boolean getShowPremiumUpSell() {
return this.showPremiumUpSell;
}
public final CharSequence getText() {
return this.text;
}
public final CharSequence getTooltip() {
return this.tooltip;
}
public int hashCode() {
int i = this.icon * 31;
CharSequence charSequence = this.text;
int i2 = 0;
int hashCode = (i + (charSequence != null ? charSequence.hashCode() : 0)) * 31;
CharSequence charSequence2 = this.tooltip;
int hashCode2 = (hashCode + (charSequence2 != null ? charSequence2.hashCode() : 0)) * 31;
boolean z2 = this.showPremiumUpSell;
if (z2) {
z2 = true;
}
int i3 = z2 ? 1 : 0;
int i4 = z2 ? 1 : 0;
int i5 = z2 ? 1 : 0;
int i6 = (hashCode2 + i3) * 31;
String str = this.objectType;
if (str != null) {
i2 = str.hashCode();
}
return i6 + i2;
}
public String toString() {
StringBuilder K = a.K("Badge(icon=");
K.append(this.icon);
K.append(", text=");
K.append(this.text);
K.append(", tooltip=");
K.append(this.tooltip);
K.append(", showPremiumUpSell=");
K.append(this.showPremiumUpSell);
K.append(", objectType=");
return a.C(K, this.objectType, ")");
}
}