diff --git a/TMessagesProj/build.gradle b/TMessagesProj/build.gradle index 6930b5c4e..ee88c9428 100644 --- a/TMessagesProj/build.gradle +++ b/TMessagesProj/build.gradle @@ -290,7 +290,7 @@ android { } } - defaultConfig.versionCode = 2196 + defaultConfig.versionCode = 2197 applicationVariants.all { variant -> variant.outputs.all { output -> diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java b/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java index 7b4a25faa..b648960ed 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java @@ -18,7 +18,7 @@ public class BuildVars { public static boolean LOGS_ENABLED = false; public static boolean USE_CLOUD_STRINGS = true; public static boolean CHECK_UPDATES = true; - public static int BUILD_VERSION = 2196; + public static int BUILD_VERSION = 2197; public static String BUILD_VERSION_STRING = "7.3.0"; public static int APP_ID = 4; public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103"; diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MessageObject.java b/TMessagesProj/src/main/java/org/telegram/messenger/MessageObject.java index 29e7f5eee..e203a4c8c 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/MessageObject.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/MessageObject.java @@ -4254,7 +4254,8 @@ public class MessageObject { } int selfUserId = UserConfig.getInstance(currentAccount).getClientUserId(); if (getDialogId() == selfUserId) { - return messageOwner.fwd_from.from_id instanceof TLRPC.TL_peerUser && messageOwner.fwd_from.from_id.user_id == selfUserId && (messageOwner.fwd_from.saved_from_peer == null || messageOwner.fwd_from.saved_from_peer.user_id == selfUserId) || messageOwner.fwd_from.saved_from_peer != null && messageOwner.fwd_from.saved_from_peer.user_id == selfUserId; + return messageOwner.fwd_from.from_id instanceof TLRPC.TL_peerUser && messageOwner.fwd_from.from_id.user_id == selfUserId && (messageOwner.fwd_from.saved_from_peer == null || messageOwner.fwd_from.saved_from_peer.user_id == selfUserId) + || messageOwner.fwd_from.saved_from_peer != null && messageOwner.fwd_from.saved_from_peer.user_id == selfUserId && (messageOwner.fwd_from.from_id == null || messageOwner.fwd_from.from_id.user_id == selfUserId); } return messageOwner.fwd_from.saved_from_peer == null || messageOwner.fwd_from.saved_from_peer.user_id == selfUserId; } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesStorage.java b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesStorage.java index f21b75caa..51b76084e 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesStorage.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesStorage.java @@ -9744,7 +9744,6 @@ public class MessagesStorage extends BaseController { public void putMessages(final TLRPC.messages_Messages messages, final long dialog_id, final int load_type, final int max_id, final boolean createDialog, final boolean scheduled) { storageQueue.postRunnable(() -> { try { - FileLog.d("put messages to " + dialog_id); if (scheduled) { database.executeFast(String.format(Locale.US, "DELETE FROM scheduled_messages WHERE uid = %d AND mid > 0", dialog_id)).stepThis().dispose(); SQLitePreparedStatement state_messages = database.executeFast("REPLACE INTO scheduled_messages VALUES(?, ?, ?, ?, ?, ?, NULL)"); diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/SendMessagesHelper.java b/TMessagesProj/src/main/java/org/telegram/messenger/SendMessagesHelper.java index 3e20381e9..4063f27f7 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/SendMessagesHelper.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/SendMessagesHelper.java @@ -1239,9 +1239,9 @@ public class SendMessagesHelper extends BaseController implements NotificationCe int lower_id = (int) peer; int sendResult = 0; int myId = getUserConfig().getClientUserId(); + boolean isChannel = false; if (lower_id != 0) { final TLRPC.Peer peer_id = getMessagesController().getPeer((int) peer); - boolean isMegagroup = false; boolean isSignature = false; boolean canSendStickers = true; boolean canSendMedia = true; @@ -1259,10 +1259,10 @@ public class SendMessagesHelper extends BaseController implements NotificationCe } else { chat = getMessagesController().getChat(-lower_id); if (ChatObject.isChannel(chat)) { - isMegagroup = chat.megagroup; isSignature = chat.signatures; + isChannel = !chat.megagroup; - if (!isMegagroup && chat.has_link) { + if (isChannel && chat.has_link) { TLRPC.ChatFull chatFull = getMessagesController().getChatFull(chat.id); if (chatFull != null) { linkedToGroup = chatFull.linked_chat_id; @@ -1331,7 +1331,7 @@ public class SendMessagesHelper extends BaseController implements NotificationCe newMsg.fwd_from.flags |= 8; newMsg.fwd_from.post_author = msgObj.messageOwner.fwd_from.post_author; } - if ((msgObj.messageOwner.fwd_from.flags & 16) != 0 && !UserObject.isReplyUser(msgObj.getDialogId())) { + if ((peer == myId || isChannel) && (msgObj.messageOwner.fwd_from.flags & 16) != 0 && !UserObject.isReplyUser(msgObj.getDialogId())) { newMsg.fwd_from.flags |= 16; newMsg.fwd_from.saved_from_peer = msgObj.messageOwner.fwd_from.saved_from_peer; newMsg.fwd_from.saved_from_msg_id = msgObj.messageOwner.fwd_from.saved_from_msg_id; @@ -1457,7 +1457,7 @@ public class SendMessagesHelper extends BaseController implements NotificationCe newMsg.grouped_id = gId; newMsg.flags |= 131072; } - if (peer_id.channel_id != 0 && !isMegagroup) { + if (peer_id.channel_id != 0 && isChannel) { if (isSignature) { newMsg.from_id = new TLRPC.TL_peerUser(); newMsg.from_id.user_id = myId; @@ -1483,7 +1483,7 @@ public class SendMessagesHelper extends BaseController implements NotificationCe messagesByRandomIds.put(newMsg.random_id, newMsg); ids.add(newMsg.fwd_msg_id); newMsg.date = scheduleDate != 0 ? scheduleDate : getConnectionsManager().getCurrentTime(); - if (inputPeer instanceof TLRPC.TL_inputPeerChannel && !isMegagroup) { + if (inputPeer instanceof TLRPC.TL_inputPeerChannel && isChannel) { if (scheduleDate == 0) { newMsg.views = 1; newMsg.flags |= TLRPC.MESSAGE_FLAG_HAS_VIEWS; @@ -5063,7 +5063,7 @@ public class SendMessagesHelper extends BaseController implements NotificationCe } } } - sentMessage.message = newMsg.message; + newMsg.message = sentMessage.message; sentMessage.attachPath = newMsg.attachPath; newMsg.media.photo.id = sentMessage.media.photo.id; newMsg.media.photo.dc_id = sentMessage.media.photo.dc_id; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BottomSheet.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BottomSheet.java index 465077462..cec521da7 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BottomSheet.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BottomSheet.java @@ -845,6 +845,20 @@ public class BottomSheet extends Dialog { window.setAttributes(params); } + public void setUseLightStatusBar(boolean value) { + useLightStatusBar = value; + if (Build.VERSION.SDK_INT >= 23) { + int color = Theme.getColor(Theme.key_actionBarDefault, null, true); + int flags = container.getSystemUiVisibility(); + if (useLightStatusBar && color == 0xffffffff) { + flags |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR; + } else { + flags &=~ View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR; + } + container.setSystemUiVisibility(flags); + } + } + public boolean isFocusable() { return focusable; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java index 792d6b0eb..059d22b8e 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java @@ -11910,26 +11910,35 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not endReached[loadIndex] = true; } - if (isThreadChat() && load_type == 0 && forwardEndReached[0] && !pendingSendMessages.isEmpty()) { - int pasteIndex = 0; - int date = pendingSendMessages.get(0).messageOwner.date; - if (!messArr.isEmpty()) { - if (date >= messArr.get(0).messageOwner.date) { - pasteIndex = 0; - } else if (date <= messArr.get(messArr.size() - 1).messageOwner.date) { - pasteIndex = messArr.size(); - } else { - for (int a = 0, N = messArr.size(); a < N - 1; a++) { - if (messArr.get(a).messageOwner.date >= date && messArr.get(a + 1).messageOwner.date <= date) { - pasteIndex = a + 1; + if (load_type == 0 && forwardEndReached[0] && !pendingSendMessages.isEmpty()) { + for (int a = 0, N = messArr.size(); a < N; a++) { + MessageObject existing = pendingSendMessagesDict.get(messArr.get(a).getId()); + if (existing != null) { + pendingSendMessagesDict.remove(existing.getId()); + pendingSendMessages.remove(existing); + } + } + if (!pendingSendMessages.isEmpty()) { + int pasteIndex = 0; + int date = pendingSendMessages.get(0).messageOwner.date; + if (!messArr.isEmpty()) { + if (date >= messArr.get(0).messageOwner.date) { + pasteIndex = 0; + } else if (date <= messArr.get(messArr.size() - 1).messageOwner.date) { + pasteIndex = messArr.size(); + } else { + for (int a = 0, N = messArr.size(); a < N - 1; a++) { + if (messArr.get(a).messageOwner.date >= date && messArr.get(a + 1).messageOwner.date <= date) { + pasteIndex = a + 1; + } } } } + messArr = new ArrayList<>(messArr); + messArr.addAll(pasteIndex, pendingSendMessages); + pendingSendMessages.clear(); + pendingSendMessagesDict.clear(); } - messArr = new ArrayList<>(messArr); - messArr.addAll(pasteIndex, pendingSendMessages); - pendingSendMessages.clear(); - pendingSendMessagesDict.clear(); } if (!threadMessageAdded && isThreadChat() && (load_type == 0 && messArr.size() < count || (load_type == 2 || load_type == 3) && endReached[0])) { @@ -14426,10 +14435,10 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not if (messageId > 0 && messageId <= (messageObject.isOut() ? threadMaxOutboxReadId : threadMaxInboxReadId)) { messageObject.setIsRead(); } - if (!forwardEndReached[0] && messageId < 0) { - pendingSendMessagesDict.put(messageId, messageObject); - pendingSendMessages.add(messageObject); - } + } + if (currentEncryptedChat == null && !forwardEndReached[0] && messageId < 0) { + pendingSendMessagesDict.put(messageId, messageObject); + pendingSendMessages.add(0, messageObject); } if (messageObject.isDice() && !messageObject.isForwarded()) { messageObject.wasUnread = true; @@ -16017,7 +16026,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } private boolean hidePinnedMessageView(boolean animated) { - if (pinnedMessageView.getTag() == null) { + if (pinnedMessageView != null && pinnedMessageView.getTag() == null) { for (int a = 0; a < pinnedNextAnimation.length; a++) { if (pinnedNextAnimation[a] != null) { pinnedNextAnimation[a].cancel(); @@ -19778,6 +19787,10 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } private void openOriginalReplyChat(MessageObject messageObject) { + if (UserObject.isUserSelf(currentUser) && messageObject.messageOwner.fwd_from.saved_from_peer.user_id == currentUser.id) { + scrollToMessageId(messageObject.messageOwner.fwd_from.saved_from_msg_id, messageObject.getId(), true, 0, true, 0); + return; + } Bundle args = new Bundle(); if (messageObject.messageOwner.fwd_from.saved_from_peer.channel_id != 0) { args.putInt("chat_id", messageObject.messageOwner.fwd_from.saved_from_peer.channel_id); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatActivityEnterView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatActivityEnterView.java index bc88335a6..fcd009cc4 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatActivityEnterView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatActivityEnterView.java @@ -3807,7 +3807,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe } return; } - CharSequence[] message = new CharSequence[]{messageEditText.getText()}; + CharSequence[] message = new CharSequence[]{AndroidUtilities.getTrimmedString(messageEditText.getText())}; ArrayList entities = MediaDataController.getInstance(currentAccount).getEntities(message, supportsSendingNewEntities()); if (!TextUtils.equals(message[0], editingMessageObject.messageText) || entities != null && !entities.isEmpty() || editingMessageObject.messageOwner.media instanceof TLRPC.TL_messageMediaWebPage) { editingMessageObject.editingMessage = message[0]; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/SearchViewPager.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/SearchViewPager.java index 652fb0f1c..0f613356c 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/SearchViewPager.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/SearchViewPager.java @@ -263,7 +263,9 @@ public class SearchViewPager extends ViewPagerFixed implements FilteredSearchVie emptyView.showProgress(!dialogsSearchAdapter.isSearching(), false); emptyView.showProgress(dialogsSearchAdapter.isSearching(), false); } else { - emptyView.showProgress(dialogsSearchAdapter.isSearching(), true); + if (!dialogsSearchAdapter.hasRecentSearch()) { + emptyView.showProgress(dialogsSearchAdapter.isSearching(), true); + } } if (reset) { noMediaFiltersSearchView.setVisibility(View.GONE); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/GroupCallActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/GroupCallActivity.java index c998526cf..d5bbc7b25 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/GroupCallActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/GroupCallActivity.java @@ -1799,6 +1799,7 @@ public class GroupCallActivity extends BottomSheet implements NotificationCenter actionBarAnimation.cancel(); actionBarAnimation = null; } + setUseLightStatusBar(actionBar.getTag() == null); actionBar.getBackButton().animate() .scaleX(show ? 1.0f : 0.9f) diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java index 9d7be1993..47cf21f10 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java @@ -2055,6 +2055,16 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. break; } } + if (view == null) { + view = listView.getChildAt(0); + if (view != null) { + RecyclerView.ViewHolder holder = listView.findContainingViewHolder(view); + pos = holder.getAdapterPosition(); + if (pos == RecyclerView.NO_POSITION) { + pos = holder.getPosition(); + } + } + } int top = 0; if (view != null) {