Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import androidx.collection.LongSparseArray;

import org.telegram.PhoneFormat.PhoneFormat;
import org.telegram.messenger.forkgram.HiddenAccountHelper;
import org.telegram.tgnet.ConnectionsManager;
import org.telegram.tgnet.TLObject;
import org.telegram.tgnet.TLRPC;
Expand Down Expand Up @@ -397,7 +398,7 @@ public void checkAppAccount() {
boolean found = false;
for (int b = 0; b < UserConfig.MAX_ACCOUNT_COUNT; b++) {
TLRPC.User user = UserConfig.getInstance(b).getCurrentUser();
if (user != null) {
if (user != null && HiddenAccountHelper.isVisibleActivatedAccount(b)) {
if (acc.name.equals("" + user.id)) {
if (b == currentAccount) {
systemAccount = acc;
Expand All @@ -419,7 +420,7 @@ public void checkAppAccount() {
} catch (Throwable ignore) {

}
if (getUserConfig().isClientActivated()) {
if (HiddenAccountHelper.isVisibleActivatedAccount(currentAccount)) {
readContacts();
if (systemAccount == null) {
try {
Expand All @@ -443,7 +444,7 @@ public void deleteUnknownAppAccounts() {
boolean found = false;
for (int b = 0; b < UserConfig.MAX_ACCOUNT_COUNT; b++) {
TLRPC.User user = UserConfig.getInstance(b).getCurrentUser();
if (user != null) {
if (user != null && HiddenAccountHelper.isVisibleActivatedAccount(b)) {
if (acc.name.equals("" + user.id)) {
found = true;
break;
Expand Down Expand Up @@ -530,11 +531,13 @@ public void deleteAllContacts(final Runnable runnable) {
} catch (Throwable ignore) {

}
try {
systemAccount = new Account("" + getUserConfig().getClientUserId(), "org.telegram.messenger");
am.addAccountExplicitly(systemAccount, "", null);
} catch (Exception ignore) {
if (HiddenAccountHelper.isVisibleActivatedAccount(currentAccount)) {
try {
systemAccount = new Account("" + getUserConfig().getClientUserId(), "org.telegram.messenger");
am.addAccountExplicitly(systemAccount, "", null);
} catch (Exception ignore) {

}
}
getMessagesStorage().putCachedPhoneBook(new HashMap<>(), false, true);
getMessagesStorage().putContacts(new ArrayList<>(), true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@

import com.google.common.collect.Lists;

import org.telegram.messenger.forkgram.HiddenAccountHelper;
import org.telegram.messenger.support.LongSparseIntArray;
import org.telegram.messenger.utils.tlutils.TlUtils;
import org.telegram.messenger.voip.VoIPGroupNotification;
Expand Down Expand Up @@ -1719,7 +1720,7 @@ public void processLoadedUnreadMessages(LongSparseArray<Integer> dialogs, ArrayL
private int getTotalAllUnreadCount() {
int count = 0;
for (int a = 0; a < UserConfig.MAX_ACCOUNT_COUNT; a++) {
if (!UserConfig.getInstance(a).isClientActivated() || !SharedConfig.showNotificationsForAllAccounts && UserConfig.selectedAccount != a) {
if (!UserConfig.getInstance(a).isClientActivated() || HiddenAccountHelper.isAccountHidden(a) || !SharedConfig.showNotificationsForAllAccounts && UserConfig.selectedAccount != a) {
continue;
}
NotificationsController controller = getInstance(a);
Expand Down Expand Up @@ -4063,7 +4064,7 @@ private String validateChannelId(long dialogId, long topicId, String name, long[
}

private void showOrUpdateNotification(boolean notifyAboutLast) {
if (!getUserConfig().isClientActivated() || pushMessages.isEmpty() && storyPushMessages.isEmpty() || !SharedConfig.showNotificationsForAllAccounts && currentAccount != UserConfig.selectedAccount) {
if (!getUserConfig().isClientActivated() || HiddenAccountHelper.isAccountHidden(currentAccount) || pushMessages.isEmpty() && storyPushMessages.isEmpty() || !SharedConfig.showNotificationsForAllAccounts && currentAccount != UserConfig.selectedAccount) {
dismissNotification();
return;
}
Expand Down Expand Up @@ -4232,7 +4233,7 @@ private void showOrUpdateNotification(boolean notifyAboutLast) {

String detailText;
if (allowSummary) {
if (UserConfig.getActivatedAccountsCount() > 1) {
if (UserConfig.getVisibleAccountsCount() > 1) {
if (pushDialogs.size() == 1) {
detailText = UserObject.getFirstName(getUserConfig().getCurrentUser());
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.telegram.tgnet.SerializedData;
import org.telegram.tgnet.TLRPC;
import org.telegram.tgnet.tl.TL_account;
import org.telegram.messenger.forkgram.HiddenAccountHelper;

import java.util.Arrays;

Expand Down Expand Up @@ -108,6 +109,10 @@ public static int getActivatedAccountsCount() {
return count;
}

public static int getVisibleAccountsCount() {
return HiddenAccountHelper.getVisibleAccountsCount();
}

public UserConfig(int instance) {
super(instance);
}
Expand Down Expand Up @@ -460,6 +465,7 @@ public void updateSaveGalleryExceptions(int type, LongSparseArray<SaveToGalleryS

public void clearConfig() {
getPreferences().edit().clear().apply();
HiddenAccountHelper.clearAccount(currentAccount);

sharingMyLocationUntil = 0;
lastMyLocationShareTime = 0;
Expand Down
Loading