From 6d4799bccd80b2808b170beee78441aa2ac8644b Mon Sep 17 00:00:00 2001 From: xtaodada Date: Sat, 26 Oct 2024 13:26:58 +0800 Subject: [PATCH 1/3] fix: MyProfile init SharedMedia Tab --- .../main/java/org/telegram/ui/Components/SharedMediaLayout.java | 2 +- .../src/main/java/org/telegram/ui/ProfileActivity.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/SharedMediaLayout.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/SharedMediaLayout.java index 344b9e3405..72410fb547 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/SharedMediaLayout.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/SharedMediaLayout.java @@ -1482,7 +1482,7 @@ public SharedMediaLayout(Context context, long did, SharedMediaPreloader preload this.initialTab = TAB_BOT_PREVIEWS; } else if (userInfo != null && userInfo.bot_info != null && userInfo.bot_info.has_preview_medias) { this.initialTab = TAB_STORIES; - } else if (NaConfig.INSTANCE.getDisableStories().Bool() && (userInfo != null && userInfo.stories_pinned_available || chatInfo != null && chatInfo.stories_pinned_available || isStoriesView())) { + } else if (!NaConfig.INSTANCE.getDisableStories().Bool() && (userInfo != null && userInfo.stories_pinned_available || chatInfo != null && chatInfo.stories_pinned_available || isStoriesView())) { this.initialTab = getInitialTab(); } else if (userInfo != null && userInfo.stargifts_count > 0) { this.initialTab = TAB_GIFTS; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java index cc4dae9c36..902f4156bf 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java @@ -9310,10 +9310,10 @@ private void updateRowsIds() { setAvatarSectionRow = rowCount++; } numberSectionRow = rowCount++; - setUsernameRow = rowCount++; if (!hideNumber) { numberRow = rowCount++; } + setUsernameRow = rowCount++; bioRow = rowCount++; settingsSectionRow = rowCount++; From a06e17f176e4a85dbac4d1396216948ff8ea5d06 Mon Sep 17 00:00:00 2001 From: xtaodada Date: Sat, 26 Oct 2024 11:32:17 +0800 Subject: [PATCH 2/3] fix: Quick Toggle Anonymous in channel --- .../java/org/telegram/ui/Components/ChatActivityEnterView.java | 2 +- .../main/java/org/telegram/ui/Components/SenderSelectPopup.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 d9e8e66f41..9fc60c7763 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatActivityEnterView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatActivityEnterView.java @@ -3737,7 +3737,7 @@ private void createSenderSelectView() { if (chatFull != null) { var chat = controller.getChat(chatFull.id); - if (chat != null && chat.creator) { + if (chat != null && ChatObject.isMegagroup(chat) && chat.creator) { var self = UserConfig.getInstance(currentAccount).getCurrentUser(); if (peer.channel_id == chat.id) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/SenderSelectPopup.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/SenderSelectPopup.java index 9fd1c8eeb6..e4cff96000 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/SenderSelectPopup.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/SenderSelectPopup.java @@ -148,7 +148,7 @@ protected int getSuggestedMinimumWidth() { if (NaConfig.INSTANCE.getQuickToggleAnonymous().Bool()) { var chat = messagesController.getChat(chatFull.id); - if (chat != null && chat.creator) { + if (chat != null && ChatObject.isMegagroup(chat) && chat.creator) { if (peers.stream().noneMatch(peer -> peer.peer.channel_id == chat.id)) { peers.add(peers.size() >= 1 ? 1 : 0, new TLRPC.TL_sendAsPeer() {{ peer = new TLRPC.TL_peerChannel() {{ channel_id = chat.id; }}; From ab96a81fa8455bd4ca6a62d87b3fc4657f174320 Mon Sep 17 00:00:00 2001 From: xtaodada Date: Sat, 26 Oct 2024 22:31:19 +0800 Subject: [PATCH 3/3] fix: apply in common group --- .../Components/DeleteMessagesBottomSheet.java | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/DeleteMessagesBottomSheet.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/DeleteMessagesBottomSheet.java index 41a40683f9..f523fbbe67 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/DeleteMessagesBottomSheet.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/DeleteMessagesBottomSheet.java @@ -253,13 +253,9 @@ void forEach(Utilities.IndexedConsumer action) { } } - boolean checkOption(TLObject object) { - for (int i = 0; i < totalCount; i++) { - if (object == options.get(i)) { - return checks[i] && (filter == null || filter[i]); - } - } - return false; + boolean checkOption(int i) { + if (i > totalCount) return false; + return checks[i] && (filter == null || filter[i]); } } @@ -1009,8 +1005,8 @@ private void performDelete() { applyInCommonGroup.forEachSelected((participant, i) -> { if (participant instanceof TLRPC.User) { - boolean needBan = banOrRestrict.checkOption(participant); - boolean needDelete = banOrRestrict.checkOption(participant); + boolean needBan = banOrRestrict.checkOption(i); + boolean needDelete = deleteAll.checkOption(i); if (!needBan && !needDelete) { return; } @@ -1034,9 +1030,9 @@ private void performDelete() { if (canBan && needBan) { if (restrict) { TLRPC.TL_chatBannedRights rights = bannedRightsOr(bannedRights, participantsBannedRights.get(i)); - MessagesController.getInstance(currentAccount).setParticipantBannedRole(chat_.id, (TLRPC.User) participant, null, rights, false, getBaseFragment()); + MessagesController.getInstance(currentAccount).setParticipantBannedRole(chat_.id, userFinal, null, rights, false, getBaseFragment()); } else { - MessagesController.getInstance(currentAccount).deleteParticipantFromChat(chat_.id, (TLRPC.User) participant, null, false, false); + MessagesController.getInstance(currentAccount).deleteParticipantFromChat(chat_.id, userFinal, null, false, false); } } if (canDelete && needDelete) {