Fix test dc

This commit is contained in:
luvletter2333 2022-02-06 22:06:57 +08:00
parent ba9f84efee
commit 47724d4d61
No known key found for this signature in database
GPG Key ID: A26A8880836E1978
1 changed files with 21 additions and 14 deletions

View File

@ -698,15 +698,13 @@ public class LoginActivity extends BaseFragment implements NotificationCenter.No
exportLoginTokenRequest.api_id = NekoXConfig.currentAppId(); exportLoginTokenRequest.api_id = NekoXConfig.currentAppId();
exportLoginTokenRequest.api_hash = NekoXConfig.currentAppHash(); exportLoginTokenRequest.api_hash = NekoXConfig.currentAppHash();
exportLoginTokenRequest.except_ids = new ArrayList<>(); exportLoginTokenRequest.except_ids = new ArrayList<>();
// if (NekoXConfig.customApi == 0) { for (int a : SharedConfig.activeAccounts) {
// for (int a : SharedConfig.activeAccounts) { UserConfig userConfig = UserConfig.getInstance(a);
// UserConfig userConfig = UserConfig.getInstance(a); if (!userConfig.isClientActivated()) {
// if (!userConfig.isClientActivated()) { continue;
// continue; }
// } exportLoginTokenRequest.except_ids.add(userConfig.clientUserId);
// exportLoginTokenRequest.except_ids.add(a); }
// }
// }
} }
getNotificationCenter().addObserver(this, NotificationCenter.updateLoginToken); getNotificationCenter().addObserver(this, NotificationCenter.updateLoginToken);
@ -1958,12 +1956,19 @@ public class LoginActivity extends BaseFragment implements NotificationCenter.No
TLRPC.TL_help_getCountriesList req = new TLRPC.TL_help_getCountriesList(); TLRPC.TL_help_getCountriesList req = new TLRPC.TL_help_getCountriesList();
req.lang_code = ""; req.lang_code = "";
CountrySelectActivity.Country testNumber = codesMap.get("999");
String testNumberFormat = phoneFormatMap.get("999");
getConnectionsManager().sendRequest(req, (response, error) -> { getConnectionsManager().sendRequest(req, (response, error) -> {
AndroidUtilities.runOnUIThread(() -> { AndroidUtilities.runOnUIThread(() -> {
if (error == null) { if (error == null) {
countriesArray.clear(); countriesArray.clear();
codesMap.clear(); codesMap.clear();
phoneFormatMap.clear(); phoneFormatMap.clear();
if (testNumber != null) {
countriesArray.add(testNumber);
codesMap.put(testNumber.code, testNumber);
phoneFormatMap.put(testNumber.code, testNumberFormat);
}
TLRPC.TL_help_countriesList help_countriesList = (TLRPC.TL_help_countriesList) response; TLRPC.TL_help_countriesList help_countriesList = (TLRPC.TL_help_countriesList) response;
for (int i = 0; i < help_countriesList.countries.size(); i++) { for (int i = 0; i < help_countriesList.countries.size(); i++) {
TLRPC.TL_help_country c = help_countriesList.countries.get(i); TLRPC.TL_help_country c = help_countriesList.countries.get(i);
@ -2055,11 +2060,13 @@ public class LoginActivity extends BaseFragment implements NotificationCenter.No
return; return;
} }
String phone = PhoneFormat.stripExceptNumbers("" + codeField.getText() + phoneField.getText()); String phone = PhoneFormat.stripExceptNumbers("" + codeField.getText() + phoneField.getText());
// boolean isTestBakcend = getConnectionsManager().isTestBackend(); boolean isTestPhone = codeField.getText().toString().equals("999");
// if (isTestBakcend != testBackend) { if (isTestPhone) {
// getConnectionsManager().switchBackend(false); FileLog.w("Login with test numbers");
// isTestBakcend = testBackend; DataCenter.applyTestDataCenter(currentAccount);
// } } else {
DataCenter.applyOfficalDataCanter(currentAccount);
}
if (getParentActivity() instanceof LaunchActivity) { if (getParentActivity() instanceof LaunchActivity) {
for (int a : SharedConfig.activeAccounts) { for (int a : SharedConfig.activeAccounts) {
UserConfig userConfig = UserConfig.getInstance(a); UserConfig userConfig = UserConfig.getInstance(a);