Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
8ad8765
fix secret group avatar in ChatRemoveCell
vivabelarus Jun 5, 2025
6fdfe8f
fix secret group profile activity
vivabelarus Jun 5, 2025
f925778
fix new messages loading in secret group
vivabelarus Jun 5, 2025
efc6262
createEncryptedMessagesMapToDelete refactoring
vivabelarus Jun 5, 2025
97ad8d7
fix deleting message group in secret groups
vivabelarus Jun 5, 2025
bb7e6af
fix deleting recently sent messages
vivabelarus Jun 6, 2025
1e6b94a
fix toggling sound in secret groups if inner chats have different values
vivabelarus Jun 6, 2025
0cfab40
fix secret groups unread counter in folders when fake passcode activated
vivabelarus Jun 6, 2025
e785e30
fix crash
vivabelarus Jun 6, 2025
7241c33
fix toggling sound in secret groups if inner chats have different values
vivabelarus Jun 6, 2025
c9f57b1
synchronize notification settings for new secret group members
vivabelarus Jun 6, 2025
f92dfdb
fix retry sending message to secret group
vivabelarus Jun 6, 2025
1ebe51b
Update to 1620
vivabelarus Jun 6, 2025
2ada8f7
fix crash
vivabelarus Jun 6, 2025
64873fb
use incognito keyboard in secret groups
vivabelarus Jun 6, 2025
aa27589
fix toggling sound in secret groups
vivabelarus Jun 6, 2025
060e6fc
refactoring
vivabelarus Jun 7, 2025
f72ab00
add slow secret group creation warning
vivabelarus Jun 7, 2025
c289378
EncryptedGroupCreateActivity refactoring
vivabelarus Jun 7, 2025
f40530d
fix removeAfterReadingMessages in General topic
vivabelarus Jun 7, 2025
221d1e5
fix removeAfterReadingMessages for media
vivabelarus Jun 7, 2025
6086e87
fix retry sending message to secret group for grouped messages
vivabelarus Jun 7, 2025
4bdda3a
Update to 1621
vivabelarus Jun 7, 2025
7aa02da
fix crash
vivabelarus Jun 8, 2025
f9bee3b
fix translation
vivabelarus Jun 8, 2025
7591c8c
show "limit reached" warning during encrypted group creation
vivabelarus Jun 8, 2025
9f9aafa
Update to 1622
vivabelarus Jun 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/alpha.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Save artifact
uses: actions/upload-artifact@master
with:
name: PTelegramAlpha-1619.apk
name: PTelegramAlpha-1622.apk
path: TMessagesProj/build/outputs/apk/afat/alpha/app.apk
- name: Create cleanup request
run: touch delete_request
1 change: 1 addition & 0 deletions TMessagesProj/src/main/assets/strings/strings_be.xml
Original file line number Diff line number Diff line change
Expand Up @@ -305,4 +305,5 @@
<string name="EncryptedGroupMemberRemovalConfirmation">Вы ўпэўненыя, што жадаеце выдаліць гэтага ўдзельніка з сакрэтнай групы? Усе яго паведамленні будуць выдалены.</string>
<string name="EncryptedGroupAvatarChangeForbidden">Нельга змяніць аватар да ініцыялізацыі групы.</string>
<string name="CantAddNewMemberToEncryptedGroupMessage">Неабходна дачакацца пацверджання ад папярэдніх чальцоў перад даданнем новага.</string>
<string name="SlowSecretGroupCreationWarning">Сакрэтная група на 7 і больш удзельнікаў будзе стварацца даўжэй, чым звычайна.</string>
</resources>
1 change: 1 addition & 0 deletions TMessagesProj/src/main/assets/strings/strings_ru.xml
Original file line number Diff line number Diff line change
Expand Up @@ -304,4 +304,5 @@
<string name="EncryptedGroupMemberRemovalConfirmation">Вы уверены, что хотите удалить этого участника из секретной группы? Все его сообщения будут удалены.</string>
<string name="EncryptedGroupAvatarChangeForbidden">Нельзя изменить аватар до инициализации группы.</string>
<string name="CantAddNewMemberToEncryptedGroupMessage">Необходимо дождаться подтверждения от предыдущих членов перед добавлением нового.</string>
<string name="SlowSecretGroupCreationWarning">Секретная группа на 7 и более участников будет создаваться дольше обычного.</string>
</resources>
1 change: 1 addition & 0 deletions TMessagesProj/src/main/assets/strings/strings_uk.xml
Original file line number Diff line number Diff line change
Expand Up @@ -305,4 +305,5 @@
<string name="EncryptedGroupMemberRemovalConfirmation">Ви впевнені, що хочете видалити цього учасника із секретної групи? Усі його повідомлення будуть видалені.</string>
<string name="EncryptedGroupAvatarChangeForbidden">Не можна змінити аватар до ініціалізації групи.</string>
<string name="CantAddNewMemberToEncryptedGroupMessage">Перед додаванням нового необхідно дочекатися підтвердження від попередніх членів.</string>
<string name="SlowSecretGroupCreationWarning">Секретна група на 7 і більше учасників буде створюватися довше, ніж зазвичай.</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
import org.telegram.messenger.browser.Browser;
import org.telegram.messenger.partisan.messageinterception.PartisanMessagesInterceptionController;
import org.telegram.messenger.partisan.secretgroups.EncryptedGroup;
import org.telegram.messenger.partisan.secretgroups.InnerEncryptedChat;
import org.telegram.messenger.support.LongSparseIntArray;
import org.telegram.messenger.support.LongSparseLongArray;
import org.telegram.messenger.voip.VoIPPreNotificationService;
Expand Down Expand Up @@ -14130,7 +14129,7 @@ public void markMessageAsRead(long dialogId, long randomId, int ttl) {
if (!DialogObject.isEncryptedDialog(dialogId)) {
return;
}
if (getEncryptedGroupUtils().doForEachInnerDialogIdIfNeeded(dialogId, innerDialogId -> markMessageAsRead(innerDialogId, randomId, ttl))) {
if (getEncryptedGroupUtils().forEachInnerDialogIdIfEncryptedGroup(dialogId, innerDialogId -> markMessageAsRead(innerDialogId, randomId, ttl))) {
return;
}
TLRPC.EncryptedChat chat = getEncryptedChat(DialogObject.getEncryptedChatId(dialogId));
Expand Down Expand Up @@ -14263,7 +14262,7 @@ public void markMentionsAsRead(long dialogId, long topicId) {
}

public void markDialogAsRead(long dialogId, int maxPositiveId, int maxNegativeId, int maxDate, boolean popup, long threadId, int countDiff, boolean readNow, int scheduledCount) {
getEncryptedGroupUtils().doForEachInnerDialogIdIfNeeded(dialogId, innerDialogId ->
getEncryptedGroupUtils().forEachInnerDialogIdIfEncryptedGroup(dialogId, innerDialogId ->
markDialogAsRead(innerDialogId, maxPositiveId, maxNegativeId, maxDate, popup, threadId, countDiff, readNow, scheduledCount)
);
boolean createReadTask;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1291,7 +1291,7 @@ public void updateMutedDialogsFiltersCounters() {
storageQueue.postRunnable(() -> resetAllUnreadCounters(true));
}

public void removeChatsActionExecuted() {
public void unreadCounterChangedByFakePasscode() {
for (int a = 0, N = dialogFilters.size(); a < N; a++) {
MessagesController.DialogFilter filter = dialogFilters.get(a);
filter.pendingUnreadCount = -1;
Expand Down Expand Up @@ -2855,7 +2855,8 @@ private void calcUnreadCounters(boolean apply) {
if (!encryptedGroupsToLoad.isEmpty()) {
List<EncryptedGroup> encryptedGroups = getEncryptedGroupsInternal(encryptedGroupsToLoad);
for (EncryptedGroup encryptedGroup : encryptedGroups) {
if (FakePasscodeUtils.isHideChat(DialogObject.makeEncryptedDialogId(encryptedGroup.getInternalId()), currentAccount)) {
if (FakePasscodeUtils.isHideChat(DialogObject.makeEncryptedDialogId(encryptedGroup.getInternalId()), currentAccount)
|| FakePasscodeUtils.isFakePasscodeActivated()) {
continue;
}
long did = DialogObject.makeEncryptedDialogId(encryptedGroup.getInternalId());
Expand Down Expand Up @@ -5947,7 +5948,8 @@ private void updateFiltersReadCounter(LongSparseIntArray dialogsToUpdate, LongSp
if (!encryptedGroupsToLoad.isEmpty()) {
List<EncryptedGroup> encryptedGroups = getEncryptedGroupsInternal(encryptedGroupsToLoad);
for (EncryptedGroup encryptedGroup : encryptedGroups) {
if (FakePasscodeUtils.isHideChat(DialogObject.makeEncryptedDialogId(encryptedGroup.getInternalId()), currentAccount)) {
if (FakePasscodeUtils.isHideChat(DialogObject.makeEncryptedDialogId(encryptedGroup.getInternalId()), currentAccount)
|| FakePasscodeUtils.isFakePasscodeActivated()) {
continue;
}
long did = DialogObject.makeEncryptedDialogId(encryptedGroup.getInternalId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6325,7 +6325,7 @@ private int getNotHiddenAccountNum() {
}

private boolean doForEachInnerDialogIdIfNeeded(long encryptedGroupDialogId, Consumer<Long> action) {
return getEncryptedGroupUtils().doForEachInnerDialogIdIfNeeded(encryptedGroupDialogId, action);
return getEncryptedGroupUtils().forEachInnerDialogIdIfEncryptedGroup(encryptedGroupDialogId, action);
}

private String getTitle(TLRPC.Chat chat) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1124,7 +1124,7 @@ public TLRPC.Message processDecryptedObject(TLRPC.EncryptedChat chat, TLRPC.Encr
chat.ttl = serviceMessage.action.ttl_seconds;
newMessage.action.encryptedAction = serviceMessage.action;
getMessagesStorage().updateEncryptedChatTTL(chat);
getEncryptedGroupUtils().syncTtlIfNeeded(chat);
getEncryptedGroupUtils().syncTtlWithOtherMembersIfNeeded(chat);
} else {
newMessage.action = new TLRPC.TL_messageEncryptedAction();
newMessage.action.encryptedAction = serviceMessage.action;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5608,7 +5608,11 @@ public void sendMessage(SendMessageParams sendMessageParams) {
}

if (sendMessageParams.autoDeleteDelay != null) {
RemoveAsReadMessage messageToRemove = new RemoveAsReadMessage(newMsg.id, MessageObject.getTopicId(currentAccount, newMsg, false), newMsg.random_id, newMsg.date, sendMessageParams.autoDeleteDelay);
long topicId = MessageObject.getTopicId(currentAccount, newMsg, false);
if (topicId == 0 && replyToMsg != null && replyToMsg.isTopicMainMessage) {
topicId = replyToMsg.getTopicId();
}
RemoveAsReadMessage messageToRemove = new RemoveAsReadMessage(newMsg.id, topicId, newMsg.random_id, newMsg.date, sendMessageParams.autoDeleteDelay);
RemoveAfterReadingMessages.addMessageToRemove(currentAccount, newMsg.dialog_id, messageToRemove);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1219,6 +1219,7 @@ public static void fakePasscodeActivated(int fakePasscodeIndex) {
if (!overriddenDialogIds.isEmpty()) {
MessagesStorage.getInstance(i).updateOverriddenWidgets(overriddenDialogIds);
}
MessagesStorage.getInstance(i).unreadCounterChangedByFakePasscode();
}
}
FakePasscode passcode = FakePasscodeUtils.getActivatedFakePasscode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.android.exoplayer2.util.Log;
import com.google.common.collect.Lists;

import org.telegram.messenger.AccountInstance;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.BuildConfig;
import org.telegram.messenger.FileLog;
import org.telegram.messenger.LocaleController;
import org.telegram.messenger.MediaDataController;
Expand All @@ -20,6 +18,7 @@
import org.telegram.messenger.Utilities;
import org.telegram.messenger.fakepasscode.results.ActionsResult;
import org.telegram.messenger.fakepasscode.results.RemoveChatsResult;
import org.telegram.messenger.partisan.PartisanLog;
import org.telegram.messenger.partisan.Utils;
import org.telegram.tgnet.ConnectionsManager;
import org.telegram.tgnet.TLRPC;
Expand Down Expand Up @@ -94,8 +93,7 @@ private static String generatePasscodeName() {
return base + " " + (SharedConfig.fakePasscodeIndex);
}

List<Action> actions()
{
private List<Action> getAllActions() {
List<Action> result = new ArrayList<>(Arrays.asList(clearCacheAction, clearDownloadsAction, smsAction));
result.addAll(accountActions);
result.add(clearProxiesAction);
Expand All @@ -106,23 +104,20 @@ List<Action> actions()
public AccountActions getAccountActions(int accountNum) {
for (AccountActions actions : accountActions) {
Integer actionsAccountNum = actions.getAccountNum();
if (actionsAccountNum != null && actionsAccountNum == accountNum) {
if (Objects.equals(actionsAccountNum, accountNum)) {
return actions;
}
}
return null;
}

public AccountActions getOrCreateAccountActions(int accountNum) {
for (AccountActions actions : accountActions) {
Integer actionsAccountNum = actions.getAccountNum();
if (actionsAccountNum != null && actionsAccountNum == accountNum) {
return actions;
}
AccountActions actions = getAccountActions(accountNum);
if (actions == null) {
actions = new AccountActions();
actions.setAccountNum(accountNum);
accountActions.add(actions);
}
AccountActions actions = new AccountActions();
actions.setAccountNum(accountNum);
accountActions.add(actions);
return actions;
}

Expand Down Expand Up @@ -151,18 +146,16 @@ public void executeActions() {
actionsResult.setActivated();
SharedConfig.fakePasscodeActionsResult = actionsResult;
SharedConfig.saveConfig();
for (Action action : actions()) {
for (Action action : getAllActions()) {
action.setExecutionScheduled();
}
Utils.runOnUIThreadAsSoonAsPossible(() -> {
activated = true;
for (Action action : actions()) {
for (Action action : getAllActions()) {
try {
action.execute(this);
} catch (Exception e) {
if (BuildConfig.DEBUG) {
Log.e("FakePasscode", "Error", e);
}
PartisanLog.e("FakePasscode error", e);
}
}
checkClearAfterActivation();
Expand Down Expand Up @@ -191,7 +184,7 @@ public void deactivate() {
}
NotificationCenter notificationCenter = NotificationCenter.getInstance(account);
if (!removeResult.hiddenChatEntries.isEmpty()) {
MessagesStorage.getInstance(account).removeChatsActionExecuted();
MessagesStorage.getInstance(account).unreadCounterChangedByFakePasscode();
notificationCenter.postNotificationName(NotificationCenter.dialogsHidingChanged);
}
if (!removeResult.hiddenFolders.isEmpty()) {
Expand Down Expand Up @@ -249,7 +242,7 @@ public void migrate() {
deletePasscodesAfterActivation.setSelected(Collections.emptyList());
}
deleteOtherPasscodesAfterActivation = null;
actions().stream().forEach(Action::migrate);
getAllActions().stream().forEach(Action::migrate);
if (actionsResult != null) {
actionsResult.migrate();
}
Expand Down Expand Up @@ -285,12 +278,12 @@ public int getHideAccountCount() {
}

private int getMaxAccountCount() {
return hasNotHiddenPremium()
return hasAnyPremiumAccountThatWillNotBeHidden()
? UserConfig.FAKE_PASSCODE_MAX_PREMIUM_ACCOUNT_COUNT
: UserConfig.FAKE_PASSCODE_MAX_ACCOUNT_COUNT;
}

private boolean hasNotHiddenPremium() {
private boolean hasAnyPremiumAccountThatWillNotBeHidden() {
for (int a = 0; a < UserConfig.MAX_ACCOUNT_COUNT; a++) {
UserConfig userConfig = UserConfig.getInstance(a);
if (userConfig.isPremium() && (getAccountActions(a) == null || !getAccountActions(a).isLogOutOrHideAccount())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,15 @@
import static org.telegram.messenger.MessagesController.DIALOG_FILTER_FLAG_ALL_CHATS;
import static org.telegram.messenger.MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED;
import static org.telegram.messenger.MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_READ;
import static org.telegram.messenger.MessagesController.showCantOpenAlert;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.google.android.exoplayer2.util.Log;

import org.telegram.messenger.AccountInstance;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.BuildConfig;
import org.telegram.messenger.ChatObject;
import org.telegram.messenger.DialogObject;
import org.telegram.messenger.MessagesController;
import org.telegram.messenger.MessagesStorage;
import org.telegram.messenger.NotificationCenter;
import org.telegram.messenger.SharedConfig;
import org.telegram.messenger.Utilities;
Expand Down Expand Up @@ -214,7 +211,7 @@ public synchronized void execute(FakePasscode fakePasscode) {
}
unpinHiddenDialogs();
SharedConfig.saveConfig();
getMessagesStorage().removeChatsActionExecuted();
getMessagesStorage().unreadCounterChangedByFakePasscode();
postNotifications(foldersCleared);
LongSparseIntArray dialogsToUpdate = new LongSparseIntArray(hiddenChatEntries.size());
hiddenChatEntries.stream().forEach(entry -> dialogsToUpdate.put(entry.chatId, 0));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

public class PartisanVersion {
public static final String PARTISAN_VERSION_STRING = "4.2.0";
public static int PARTISAN_BUILD_VERSION = 1619;
public static int PARTISAN_BUILD_VERSION = 1622;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.NotificationCenter;
import org.telegram.messenger.SendMessagesHelper;
import org.telegram.messenger.SharedConfig;
import org.telegram.messenger.partisan.AccountControllersProvider;
import org.telegram.tgnet.TLRPC;

Expand Down Expand Up @@ -83,7 +82,7 @@ private void onSecondaryChatCreated(EncryptedGroup encryptedGroup, InnerEncrypte
getEncryptedGroupProtocol().sendSecondaryInnerChatInvitation(encryptedChat, encryptedGroup.getExternalId());
innerChat.setState(InnerEncryptedChatState.INITIALIZED);
getMessagesStorage().updateEncryptedGroupInnerChat(encryptedGroup.getInternalId(), innerChat);
getEncryptedGroupUtils().checkAllEncryptedChatsCreated(encryptedGroup);
getEncryptedGroupUtils().finalizeEncryptedGroupIfAllChatsCreated(encryptedGroup);
}

private void handleEncryptedChatDiscarded(EncryptedGroup encryptedGroup, TLRPC.EncryptedChat encryptedChat) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@

public class EncryptedGroupConstants {
public static final int MAX_MEMBER_COUNT = 10;
public static final int FAST_GROUP_CREATION_MEMBER_COUNT = 6;
}
Loading
Loading