2021-06-27 20:44:35 +00:00
|
|
|
package com.discord.widgets.user;
|
|
|
|
|
|
|
|
import android.content.Context;
|
|
|
|
import androidx.annotation.DrawableRes;
|
|
|
|
import androidx.fragment.app.FragmentManager;
|
|
|
|
import c.a.l.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)) {
|
2021-06-27 20:53:42 +00:00
|
|
|
arrayList.add(new Badge(2131231872, context.getString(2131893319), null, false, null, 28, null));
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
if (userUtils.isPartner(user)) {
|
2021-06-27 20:53:42 +00:00
|
|
|
arrayList.add(new Badge(2131231861, context.getString(2131891768), null, false, null, 28, null));
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
if (userUtils.isCertifiedModerator(user)) {
|
2021-06-27 20:53:42 +00:00
|
|
|
arrayList.add(new Badge(2131231858, context.getString(2131887215), null, false, null, 28, null));
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
if (userUtils.isHypeSquad(user)) {
|
2021-06-27 20:53:42 +00:00
|
|
|
arrayList.add(new Badge(2131231859, context.getString(2131890193), null, false, null, 28, null));
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
boolean z4 = false;
|
|
|
|
if (userUtils.isHypesquadHouse1(user)) {
|
2021-06-27 20:53:42 +00:00
|
|
|
arrayList.add(new Badge(i == 1 ? 2131231702 : 2131231701, context.getString(2131890201), b.g(context, 2131890210, new Object[]{b.g(context, 2131890201, new Object[0], null, 4)}, null, 4), false, null, 24, null));
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
if (userUtils.isHypesquadHouse2(user)) {
|
2021-06-27 20:53:42 +00:00
|
|
|
arrayList.add(new Badge(i == 2 ? 2131231704 : 2131231703, b.g(context, 2131890202, new Object[0], null, 4), b.g(context, 2131890210, new Object[]{context.getString(2131890202)}, null, 4), false, null, 24, null));
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
if (userUtils.isHypesquadHouse3(user)) {
|
2021-06-27 20:53:42 +00:00
|
|
|
arrayList.add(new Badge(i == 3 ? 2131231706 : 2131231705, context.getString(2131890203), b.g(context, 2131890210, new Object[]{b.g(context, 2131890203, new Object[0], null, 4)}, null, 4), false, null, 24, null));
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
if (userUtils.isBugHunterLevel1(user)) {
|
2021-06-27 20:53:42 +00:00
|
|
|
arrayList.add(new Badge(2131231856, context.getString(2131887073), null, false, null, 28, null));
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
if (userUtils.isBugHunterLevel2(user)) {
|
2021-06-27 20:53:42 +00:00
|
|
|
arrayList.add(new Badge(2131231857, context.getString(2131887073), null, false, null, 28, null));
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
if (userUtils.isVerifiedDeveloper(user)) {
|
2021-06-27 20:53:42 +00:00
|
|
|
arrayList.add(new Badge(2131231873, context.getString(2131894452), null, false, null, 28, null));
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
if (userUtils.isPremiumEarlySupporter(user)) {
|
2021-06-27 20:53:42 +00:00
|
|
|
arrayList.add(new Badge(2131231862, context.getString(2131888197), null, !z2 && z3, "PREMIUM_EARLY_SUPPORTER", 4, null));
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
if (modelUserProfile.isPremium()) {
|
2021-06-27 20:53:42 +00:00
|
|
|
arrayList.add(new Badge(2131231860, context.getString(2131892307), b.g(context, 2131891924, new Object[]{modelUserProfile.getPremiumSince(context)}, null, 4), !z2 && z3, "PREMIUM"));
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
if (modelUserProfile.isPremiumGuildSubscriber()) {
|
|
|
|
Integer premiumGuildMonthsSubscribed = modelUserProfile.getPremiumGuildMonthsSubscribed();
|
2021-06-27 20:53:42 +00:00
|
|
|
int i2 = 2131231863;
|
2021-06-27 20:44:35 +00:00
|
|
|
if (premiumGuildMonthsSubscribed.intValue() >= 24) {
|
2021-06-27 20:53:42 +00:00
|
|
|
i2 = 2131231871;
|
2021-06-27 20:44:35 +00:00
|
|
|
} else if (premiumGuildMonthsSubscribed.intValue() >= 18) {
|
2021-06-27 20:53:42 +00:00
|
|
|
i2 = 2131231870;
|
2021-06-27 20:44:35 +00:00
|
|
|
} else if (premiumGuildMonthsSubscribed.intValue() >= 15) {
|
2021-06-27 20:53:42 +00:00
|
|
|
i2 = 2131231869;
|
2021-06-27 20:44:35 +00:00
|
|
|
} else if (premiumGuildMonthsSubscribed.intValue() >= 12) {
|
2021-06-27 20:53:42 +00:00
|
|
|
i2 = 2131231868;
|
2021-06-27 20:44:35 +00:00
|
|
|
} else if (premiumGuildMonthsSubscribed.intValue() >= 9) {
|
2021-06-27 20:53:42 +00:00
|
|
|
i2 = 2131231867;
|
2021-06-27 20:44:35 +00:00
|
|
|
} else if (premiumGuildMonthsSubscribed.intValue() >= 6) {
|
2021-06-27 20:53:42 +00:00
|
|
|
i2 = 2131231866;
|
2021-06-27 20:44:35 +00:00
|
|
|
} else if (premiumGuildMonthsSubscribed.intValue() >= 3) {
|
2021-06-27 20:53:42 +00:00
|
|
|
i2 = 2131231865;
|
2021-06-27 20:44:35 +00:00
|
|
|
} else if (premiumGuildMonthsSubscribed.intValue() >= 2) {
|
2021-06-27 20:53:42 +00:00
|
|
|
i2 = 2131231864;
|
2021-06-27 20:44:35 +00:00
|
|
|
} else {
|
|
|
|
premiumGuildMonthsSubscribed.intValue();
|
|
|
|
}
|
2021-06-27 20:53:42 +00:00
|
|
|
String string = context.getString(2131892307);
|
|
|
|
CharSequence g = b.g(context, 2131892141, new Object[]{modelUserProfile.getPremiumGuildSince(context)}, null, 4);
|
2021-06-27 20:44:35 +00:00
|
|
|
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 L = a.L("Badge(icon=");
|
|
|
|
L.append(this.icon);
|
|
|
|
L.append(", text=");
|
|
|
|
L.append(this.text);
|
|
|
|
L.append(", tooltip=");
|
|
|
|
L.append(this.tooltip);
|
|
|
|
L.append(", showPremiumUpSell=");
|
|
|
|
L.append(this.showPremiumUpSell);
|
|
|
|
L.append(", objectType=");
|
|
|
|
return a.D(L, this.objectType, ")");
|
|
|
|
}
|
|
|
|
}
|