forked from Juby210/discord-jadx
224 lines
12 KiB
Java
224 lines
12 KiB
Java
package com.discord.widgets.auth;
|
|
|
|
import android.content.Context;
|
|
import android.util.AttributeSet;
|
|
import android.view.LayoutInflater;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.widget.ImageView;
|
|
import android.widget.LinearLayout;
|
|
import android.widget.RelativeLayout;
|
|
import android.widget.TextView;
|
|
import c.a.k.b;
|
|
import c.d.b.a.a;
|
|
import c0.g0.t;
|
|
import c0.z.d.m;
|
|
import com.discord.R;
|
|
import com.discord.api.channel.Channel;
|
|
import com.discord.api.channel.ChannelUtils;
|
|
import com.discord.api.guild.Guild;
|
|
import com.discord.api.user.User;
|
|
import com.discord.databinding.ViewAuthInviteInfoBinding;
|
|
import com.discord.models.domain.ModelGuildTemplate;
|
|
import com.discord.models.domain.ModelInvite;
|
|
import com.discord.models.user.CoreUser;
|
|
import com.discord.nullserializable.NullSerializable;
|
|
import com.discord.utilities.icon.IconUtils;
|
|
import com.discord.utilities.images.MGImages;
|
|
import com.facebook.drawee.view.SimpleDraweeView;
|
|
import kotlin.jvm.functions.Function1;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
/* compiled from: AuthInviteInfoView.kt */
|
|
public final class AuthInviteInfoView extends RelativeLayout {
|
|
private final ViewAuthInviteInfoBinding binding;
|
|
|
|
public AuthInviteInfoView(Context context) {
|
|
this(context, null, 0, 6, null);
|
|
}
|
|
|
|
public AuthInviteInfoView(Context context, AttributeSet attributeSet) {
|
|
this(context, attributeSet, 0, 4, null);
|
|
}
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public AuthInviteInfoView(Context context, AttributeSet attributeSet, int i) {
|
|
super(context, attributeSet, i);
|
|
m.checkNotNullParameter(context, "context");
|
|
View inflate = LayoutInflater.from(context).inflate(R.layout.view_auth_invite_info, (ViewGroup) this, false);
|
|
addView(inflate);
|
|
int i2 = R.id.auth_invite_info_content;
|
|
LinearLayout linearLayout = (LinearLayout) inflate.findViewById(R.id.auth_invite_info_content);
|
|
if (linearLayout != null) {
|
|
i2 = R.id.auth_invite_info_guild_avatar;
|
|
SimpleDraweeView simpleDraweeView = (SimpleDraweeView) inflate.findViewById(R.id.auth_invite_info_guild_avatar);
|
|
if (simpleDraweeView != null) {
|
|
i2 = R.id.auth_invite_info_guild_name;
|
|
TextView textView = (TextView) inflate.findViewById(R.id.auth_invite_info_guild_name);
|
|
if (textView != null) {
|
|
i2 = R.id.auth_invite_info_invited_text;
|
|
TextView textView2 = (TextView) inflate.findViewById(R.id.auth_invite_info_invited_text);
|
|
if (textView2 != null) {
|
|
i2 = R.id.auth_invite_info_template_icon;
|
|
ImageView imageView = (ImageView) inflate.findViewById(R.id.auth_invite_info_template_icon);
|
|
if (imageView != null) {
|
|
ViewAuthInviteInfoBinding viewAuthInviteInfoBinding = new ViewAuthInviteInfoBinding((RelativeLayout) inflate, linearLayout, simpleDraweeView, textView, textView2, imageView);
|
|
m.checkNotNullExpressionValue(viewAuthInviteInfoBinding, "ViewAuthInviteInfoBindin…rom(context), this, true)");
|
|
this.binding = viewAuthInviteInfoBinding;
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
throw new NullPointerException("Missing required view with ID: ".concat(inflate.getResources().getResourceName(i2)));
|
|
}
|
|
|
|
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
|
|
public /* synthetic */ AuthInviteInfoView(Context context, AttributeSet attributeSet, int i, int i2, DefaultConstructorMarker defaultConstructorMarker) {
|
|
this(context, (i2 & 2) != 0 ? null : attributeSet, (i2 & 4) != 0 ? 0 : i);
|
|
}
|
|
|
|
/* JADX DEBUG: Can't convert new array creation: APUT found in different block: 0x008a: APUT (r2v4 java.lang.Object[]), (0 ??[int, short, byte, char]), (r10v9 java.lang.String) */
|
|
/* JADX WARNING: Code restructure failed: missing block: B:26:0x0060, code lost:
|
|
if ((com.discord.api.channel.ChannelUtils.c(r0).length() == 0) != true) goto L_0x0062;
|
|
*/
|
|
private final CharSequence getIntroText(ModelInvite modelInvite) {
|
|
User inviter = modelInvite.getInviter();
|
|
String r2 = inviter != null ? inviter.r() : null;
|
|
boolean z2 = r2 != null && (t.isBlank(r2) ^ true);
|
|
if (modelInvite.getChannel() == null && modelInvite.getGuild() == null && z2) {
|
|
Context context = getContext();
|
|
m.checkNotNullExpressionValue(context, "context");
|
|
return b.h(context, R.string.instant_invite_you_have_been_invited_to_chat_with, new Object[0], null, 4);
|
|
}
|
|
Channel channel = modelInvite.getChannel();
|
|
if (channel != null && ChannelUtils.v(channel)) {
|
|
Channel channel2 = modelInvite.getChannel();
|
|
if (channel2 != null) {
|
|
}
|
|
if (z2) {
|
|
Context context2 = getContext();
|
|
m.checkNotNullExpressionValue(context2, "context");
|
|
Object[] objArr = new Object[1];
|
|
User inviter2 = modelInvite.getInviter();
|
|
objArr[0] = inviter2 != null ? inviter2.r() : null;
|
|
return b.h(context2, R.string.auth_message_invited_by, objArr, null, 4);
|
|
}
|
|
Context context3 = getContext();
|
|
m.checkNotNullExpressionValue(context3, "context");
|
|
return b.h(context3, R.string.instant_invite_you_have_been_invited_to_join_group_dm, new Object[0], null, 4);
|
|
} else if (modelInvite.getApproximateMemberCount() >= 200 || !z2) {
|
|
Context context4 = getContext();
|
|
m.checkNotNullExpressionValue(context4, "context");
|
|
return b.h(context4, R.string.instant_invite_you_have_been_invited_to_join, new Object[0], null, 4);
|
|
} else {
|
|
Context context5 = getContext();
|
|
m.checkNotNullExpressionValue(context5, "context");
|
|
return b.h(context5, R.string.auth_message_invited_by, new Object[]{r2}, null, 4);
|
|
}
|
|
}
|
|
|
|
public final void configureGuildTemplate(ModelGuildTemplate modelGuildTemplate) {
|
|
m.checkNotNullParameter(modelGuildTemplate, "guildTemplate");
|
|
SimpleDraweeView simpleDraweeView = this.binding.b;
|
|
m.checkNotNullExpressionValue(simpleDraweeView, "binding.authInviteInfoGuildAvatar");
|
|
simpleDraweeView.setVisibility(8);
|
|
ImageView imageView = this.binding.e;
|
|
m.checkNotNullExpressionValue(imageView, "binding.authInviteInfoTemplateIcon");
|
|
imageView.setVisibility(0);
|
|
TextView textView = this.binding.d;
|
|
m.checkNotNullExpressionValue(textView, "binding.authInviteInfoInvitedText");
|
|
b.n(textView, R.string.guild_template_modal_title, new Object[0], null, 4);
|
|
TextView textView2 = this.binding.f2068c;
|
|
m.checkNotNullExpressionValue(textView2, "binding.authInviteInfoGuildName");
|
|
textView2.setText(modelGuildTemplate.getName());
|
|
}
|
|
|
|
public final void configureInvite(ModelInvite modelInvite) {
|
|
String str;
|
|
String f;
|
|
NullSerializable<String> a;
|
|
String r2;
|
|
m.checkNotNullParameter(modelInvite, "invite");
|
|
SimpleDraweeView simpleDraweeView = this.binding.b;
|
|
m.checkNotNullExpressionValue(simpleDraweeView, "binding.authInviteInfoGuildAvatar");
|
|
boolean z2 = false;
|
|
simpleDraweeView.setVisibility(0);
|
|
ImageView imageView = this.binding.e;
|
|
m.checkNotNullExpressionValue(imageView, "binding.authInviteInfoTemplateIcon");
|
|
imageView.setVisibility(8);
|
|
Channel channel = modelInvite.getChannel();
|
|
String str2 = null;
|
|
Integer valueOf = channel != null ? Integer.valueOf(channel.A()) : null;
|
|
if ((valueOf != null && valueOf.intValue() == 5) || ((valueOf != null && valueOf.intValue() == 0) || ((valueOf != null && valueOf.intValue() == 2) || (valueOf != null && valueOf.intValue() == 13)))) {
|
|
Guild guild = modelInvite.getGuild();
|
|
if (guild != null) {
|
|
SimpleDraweeView simpleDraweeView2 = this.binding.b;
|
|
m.checkNotNullExpressionValue(simpleDraweeView2, "binding.authInviteInfoGuildAvatar");
|
|
m.checkNotNullExpressionValue(guild, "inviteGuild");
|
|
IconUtils.setIcon$default(simpleDraweeView2, IconUtils.getForGuild$default(new com.discord.models.guild.Guild(guild), IconUtils.DEFAULT_ICON_BLURPLE, true, null, 8, null), (int) R.dimen.avatar_size_large, (Function1) null, (MGImages.ChangeDetector) null, 24, (Object) null);
|
|
TextView textView = this.binding.d;
|
|
m.checkNotNullExpressionValue(textView, "binding.authInviteInfoInvitedText");
|
|
textView.setText(b.l(getIntroText(modelInvite), new Object[0], null, 2));
|
|
TextView textView2 = this.binding.f2068c;
|
|
m.checkNotNullExpressionValue(textView2, "binding.authInviteInfoGuildName");
|
|
textView2.setText(guild.v());
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
String str3 = "";
|
|
if (valueOf != null && valueOf.intValue() == 3) {
|
|
User inviter = modelInvite.getInviter();
|
|
if (!(inviter == null || (r2 = inviter.r()) == null)) {
|
|
str3 = r2;
|
|
}
|
|
SimpleDraweeView simpleDraweeView3 = this.binding.b;
|
|
m.checkNotNullExpressionValue(simpleDraweeView3, "binding.authInviteInfoGuildAvatar");
|
|
User inviter2 = modelInvite.getInviter();
|
|
IconUtils.setIcon$default(simpleDraweeView3, (inviter2 == null || (a = inviter2.a()) == null) ? null : a.a(), (int) R.dimen.avatar_size_large, (Function1) null, (MGImages.ChangeDetector) null, 24, (Object) null);
|
|
TextView textView3 = this.binding.d;
|
|
m.checkNotNullExpressionValue(textView3, "binding.authInviteInfoInvitedText");
|
|
textView3.setText(b.l(getIntroText(modelInvite), new Object[0], null, 2));
|
|
TextView textView4 = this.binding.f2068c;
|
|
m.checkNotNullExpressionValue(textView4, "binding.authInviteInfoGuildName");
|
|
Channel channel2 = modelInvite.getChannel();
|
|
if (channel2 != null) {
|
|
if (ChannelUtils.c(channel2).length() > 0) {
|
|
z2 = true;
|
|
}
|
|
if (z2) {
|
|
Channel channel3 = modelInvite.getChannel();
|
|
if (channel3 != null) {
|
|
str2 = ChannelUtils.c(channel3);
|
|
}
|
|
str3 = str2;
|
|
}
|
|
}
|
|
textView4.setText(str3);
|
|
} else if (valueOf == null) {
|
|
User inviter3 = modelInvite.getInviter();
|
|
if (inviter3 == null || (str = inviter3.r()) == null) {
|
|
str = str3;
|
|
}
|
|
StringBuilder S = a.S(str, "#");
|
|
User inviter4 = modelInvite.getInviter();
|
|
if (!(inviter4 == null || (f = inviter4.f()) == null)) {
|
|
str3 = f;
|
|
}
|
|
S.append(str3);
|
|
String sb = S.toString();
|
|
SimpleDraweeView simpleDraweeView4 = this.binding.b;
|
|
m.checkNotNullExpressionValue(simpleDraweeView4, "binding.authInviteInfoGuildAvatar");
|
|
User inviter5 = modelInvite.getInviter();
|
|
IconUtils.setIcon$default(simpleDraweeView4, inviter5 != null ? new CoreUser(inviter5) : null, R.dimen.avatar_size_large, null, null, null, 56, null);
|
|
TextView textView5 = this.binding.d;
|
|
m.checkNotNullExpressionValue(textView5, "binding.authInviteInfoInvitedText");
|
|
textView5.setText(b.l(getIntroText(modelInvite), new Object[0], null, 2));
|
|
TextView textView6 = this.binding.f2068c;
|
|
m.checkNotNullExpressionValue(textView6, "binding.authInviteInfoGuildName");
|
|
textView6.setText(sb);
|
|
}
|
|
}
|
|
}
|