From 4e91347163a097a5f90daf0bb9a17a2d8bf57e41 Mon Sep 17 00:00:00 2001 From: NekoInverter Date: Wed, 8 Dec 2021 18:41:43 +0800 Subject: [PATCH] Fix some official client bugs --- .../org/telegram/messenger/MessagesController.java | 14 ++++++++++++++ .../java/org/telegram/ui/Cells/ChatActionCell.java | 2 +- .../org/telegram/ui/ChannelAdminLogActivity.java | 2 +- .../main/java/org/telegram/ui/ChatActivity.java | 2 +- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java index 1343f45b5..c6da027c8 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java @@ -333,6 +333,7 @@ public class MessagesController extends BaseController implements NotificationCe public Set exportPrivateUri; public boolean autoarchiveAvailable; public int groipCallVideoMaxParticipants; + public int chatReadMarkSizeThreshold; public boolean suggestStickersApiOnly; public ArrayList gifSearchEmojies = new ArrayList<>(); public HashSet diceEmojies; @@ -880,6 +881,7 @@ public class MessagesController extends BaseController implements NotificationCe showFiltersTooltip = mainPreferences.getBoolean("showFiltersTooltip", false); autoarchiveAvailable = mainPreferences.getBoolean("autoarchiveAvailable", false); groipCallVideoMaxParticipants = mainPreferences.getInt("groipCallVideoMaxParticipants", 30); + chatReadMarkSizeThreshold = mainPreferences.getInt("chatReadMarkSizeThreshold", 100); suggestStickersApiOnly = mainPreferences.getBoolean("suggestStickersApiOnly", false); roundVideoSize = mainPreferences.getInt("roundVideoSize", 384); roundVideoBitrate = mainPreferences.getInt("roundVideoBitrate", 1000); @@ -1747,6 +1749,18 @@ public class MessagesController extends BaseController implements NotificationCe } break; } + case "chat_read_mark_size_threshold": { + if (value.value instanceof TLRPC.TL_jsonNumber) { + TLRPC.TL_jsonNumber number = (TLRPC.TL_jsonNumber) value.value; + Log.e("test", chatReadMarkSizeThreshold + ""); + if (number.value != chatReadMarkSizeThreshold) { + chatReadMarkSizeThreshold = (int) number.value; + editor.putInt("chatReadMarkSizeThreshold", chatReadMarkSizeThreshold); + changed = true; + } + } + break; + } case "inapp_update_check_delay": { if (value.value instanceof TLRPC.TL_jsonNumber) { TLRPC.TL_jsonNumber number = (TLRPC.TL_jsonNumber) value.value; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatActionCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatActionCell.java index 51c7bdc67..78dd6fcaf 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatActionCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatActionCell.java @@ -378,7 +378,7 @@ public class ChatActionCell extends BaseCell implements DownloadController.FileD } else if (url.startsWith("http")) { Browser.openUrl(getContext(), url); } else { - delegate.needOpenUserProfile(Integer.parseInt(url)); + delegate.needOpenUserProfile(Long.parseLong(url)); } } result = true; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChannelAdminLogActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChannelAdminLogActivity.java index 0be9b213b..e616c8ef3 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChannelAdminLogActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChannelAdminLogActivity.java @@ -2158,7 +2158,7 @@ public class ChannelAdminLogActivity extends BaseFragment implements Notificatio ((URLSpanMono) url).copyToClipboard(); Toast.makeText(getParentActivity(), LocaleController.getString("TextCopied", R.string.TextCopied), Toast.LENGTH_SHORT).show(); } else if (url instanceof URLSpanUserMention) { - long peerId = Utilities.parseInt(((URLSpanUserMention) url).getURL()); + long peerId = Utilities.parseLong(((URLSpanUserMention) url).getURL()); if (peerId > 0) { TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(peerId); if (user != null) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java index 9b1a84360..9bac83944 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java @@ -21274,7 +21274,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } }); scrimPopupContainerLayout.setOrientation(LinearLayout.VERTICAL); - boolean showMessageSeen = !isInScheduleMode() && currentChat != null && message.isOutOwner() && message.isSent() && !message.isEditing() && !message.isSending() && !message.isSendError() && !message.isContentUnread() && !message.isUnread() && (ConnectionsManager.getInstance(currentAccount).getCurrentTime() - message.messageOwner.date < 7 * 86400) && (ChatObject.isMegagroup(currentChat) || !ChatObject.isChannel(currentChat)) && chatInfo != null && chatInfo.participants_count < 50 && !(message.messageOwner.action instanceof TLRPC.TL_messageActionChatJoinedByRequest) && (v instanceof ChatMessageCell); + boolean showMessageSeen = !isInScheduleMode() && currentChat != null && message.isOutOwner() && message.isSent() && !message.isEditing() && !message.isSending() && !message.isSendError() && !message.isContentUnread() && !message.isUnread() && (ConnectionsManager.getInstance(currentAccount).getCurrentTime() - message.messageOwner.date < 7 * 86400) && (ChatObject.isMegagroup(currentChat) || !ChatObject.isChannel(currentChat)) && chatInfo != null && chatInfo.participants_count < getMessagesController().chatReadMarkSizeThreshold && !(message.messageOwner.action instanceof TLRPC.TL_messageActionChatJoinedByRequest) && (v instanceof ChatMessageCell); boolean showNoForwards = getMessagesController().isChatNoForwards(currentChat) && message.messageOwner.action == null && message.isSent() && !message.isEditing() && chatMode != MODE_SCHEDULED; MessageSeenView messageSeenView = null; if (showMessageSeen) {