Draw verified for NekoX chats and devs

This commit is contained in:
世界 2021-03-20 21:20:32 +08:00
parent 28301ad426
commit 75f5a5e43e
No known key found for this signature in database
GPG Key ID: CD109927C34A63C4
7 changed files with 33 additions and 11 deletions

View File

@ -16,6 +16,9 @@ import org.telegram.messenger.Utilities;
import java.util.ArrayList;
import java.util.HashMap;
import cn.hutool.core.util.ArrayUtil;
import tw.nekomimi.nekogram.NekoXConfig;
@SuppressWarnings("unchecked")
public class TLRPC {
@ -16962,6 +16965,10 @@ public class TLRPC {
public boolean explicit_content;
public ArrayList<TL_restrictionReason> restriction_reason = new ArrayList<>();
public boolean verifiedExtended() {
return verified || ArrayUtil.contains(NekoXConfig.developers, id);
}
public static User TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
User result = null;
switch (constructor) {
@ -33232,6 +33239,10 @@ public class TLRPC {
public TL_chatBannedRights default_banned_rights;
public InputChannel migrated_to;
public boolean verifiedExtended() {
return verified || ArrayUtil.contains(NekoXConfig.officialChats, id);
}
public static Chat TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
Chat result = null;
switch (constructor) {

View File

@ -778,7 +778,7 @@ public class DialogCell extends BaseCell {
drawScam = 2;
Theme.dialogs_fakeDrawable.checkText();
} else {
drawVerified = chat.verified;
drawVerified = chat.verifiedExtended();
}
if (SharedConfig.drawDialogIcons) {
if (useForceThreeLines || SharedConfig.useThreeLinesLayout) {
@ -823,7 +823,7 @@ public class DialogCell extends BaseCell {
drawScam = 2;
Theme.dialogs_fakeDrawable.checkText();
} else {
drawVerified = user.verified;
drawVerified = user.verifiedExtended();
}
if (SharedConfig.drawDialogIcons && user.bot) {
drawNameBot = true;

View File

@ -118,7 +118,7 @@ public class DialogMeUrlCell extends BaseCell {
drawNameGroup = true;
nameLockTop = AndroidUtilities.dp(17.5f);
}
drawVerified = chat.verified;
drawVerified = chat.verifiedExtended();
if (!LocaleController.isRTL) {
nameLockLeft = AndroidUtilities.dp(AndroidUtilities.leftBaseline);
@ -149,7 +149,7 @@ public class DialogMeUrlCell extends BaseCell {
nameLeft = AndroidUtilities.dp(14);
}
}
drawVerified = user.verified;
drawVerified = user.verifiedExtended();
}
nameString = UserObject.getUserName(user);
avatarDrawable.setInfo(user);
@ -179,7 +179,7 @@ public class DialogMeUrlCell extends BaseCell {
drawNameGroup = true;
nameLockTop = AndroidUtilities.dp(17.5f);
}
drawVerified = recentMeUrl.chat_invite.chat.verified;
drawVerified = recentMeUrl.chat_invite.chat.verifiedExtended();
avatarImage.setImage(ImageLocation.getForChat(recentMeUrl.chat_invite.chat, false), "50_50", avatarDrawable, null, recentMeUrl, 0);
} else {
nameString = recentMeUrl.chat_invite.title;

View File

@ -356,7 +356,7 @@ public class GroupCallUserCell extends FrameLayout {
avatarDrawable.setInfo(currentUser);
nameTextView.setText(UserObject.getUserName(currentUser));
nameTextView.setRightDrawable(currentUser != null && currentUser.verified ? new VerifiedDrawable(getContext()) : null);
nameTextView.setRightDrawable(currentUser != null && currentUser.verifiedExtended() ? new VerifiedDrawable(getContext()) : null);
avatarImageView.getImageReceiver().setCurrentAccount(account.getCurrentAccount());
avatarImageView.setImage(ImageLocation.getForUser(currentUser, false), "50_50", avatarDrawable, currentUser);
} else {
@ -366,7 +366,7 @@ public class GroupCallUserCell extends FrameLayout {
if (currentChat != null) {
nameTextView.setText(currentChat.title);
nameTextView.setRightDrawable(currentChat.verified ? new VerifiedDrawable(getContext()) : null);
nameTextView.setRightDrawable(currentChat.verifiedExtended() ? new VerifiedDrawable(getContext()) : null);
avatarImageView.getImageReceiver().setCurrentAccount(account.getCurrentAccount());
avatarImageView.setImage(ImageLocation.getForChat(currentChat, false), "50_50", avatarDrawable, currentChat);
}

View File

@ -250,7 +250,7 @@ public class ProfileSearchCell extends BaseCell {
nameLockTop = AndroidUtilities.dp(24);
}
}
drawCheck = chat.verified;
drawCheck = chat.verifiedExtended();
if (SharedConfig.drawDialogIcons) {
if (!LocaleController.isRTL) {
nameLockLeft = AndroidUtilities.dp(AndroidUtilities.leftBaseline);
@ -286,7 +286,7 @@ public class ProfileSearchCell extends BaseCell {
} else {
nameLockTop = AndroidUtilities.dp(21);
}
drawCheck = user.verified;
drawCheck = user.verifiedExtended();
}
}

View File

@ -5799,7 +5799,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
}
} else if (user.scam || user.fake) {
rightIcon = getScamDrawable(user.scam ? 0 : 1);
} else if (user.verified) {
} else if (user.verifiedExtended()) {
rightIcon = getVerifiedCrossfadeDrawable();
}
nameTextView[a].setLeftDrawable(leftIcon);
@ -5899,7 +5899,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
if (a != 0) {
if (chat.scam || chat.fake) {
nameTextView[a].setRightDrawable(getScamDrawable(chat.scam ? 0 : 1));
} else if (chat.verified) {
} else if (chat.verifiedExtended()) {
nameTextView[a].setRightDrawable(getVerifiedCrossfadeDrawable());
} else {
nameTextView[a].setRightDrawable(null);

View File

@ -12,6 +12,17 @@ public class NekoXConfig {
// public static String FAQ_URL = "https://telegra.ph/NekoX-FAQ-03-31";
public static String FAQ_URL = "https://github.com/NekoX-Dev/NekoX#faq";
public static int[] officialChats = {
1305127566, // NekoX Updates
1151172683, // NekoX Chat
1299578049, // NekoX Chat Channel
1137038259, // NekoX APKs
};
public static int[] developers = {
896711046, // nekohasekai
380570774, // Haruhi
};
public static SharedPreferences preferences = NitritesKt.openMainSharedPreference("nekox_config");