Skip to content

Commit d3af5e7

Browse files
immat0x1itsv1eds
authored andcommitted
[debug] bring back test backend
1 parent cc666fa commit d3af5e7

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

TMessagesProj/src/main/assets/countries.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,4 +233,5 @@
233233
1;PR;Puerto Rico;XXX XXX XXXX
234234
1;DO;Dominican Rep.;XXX XXX XXXX
235235
1;CA;Canada;XXX XXX XXXX
236-
1;US;USA;XXX XXX XXXX
236+
1;US;USA;XXX XXX XXXX
237+
999;EX;Test Backend;66 X XXXX

TMessagesProj/src/main/java/org/telegram/ui/LoginActivity.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2107,6 +2107,14 @@ public void afterTextChanged(Editable s) {
21072107
}
21082108
}
21092109
}
2110+
CountrySelectActivity.Country countryWithCode = new CountrySelectActivity.Country();
2111+
String test_code = "999";
2112+
countryWithCode.name = "Test Backend";
2113+
countryWithCode.code = test_code;
2114+
countryWithCode.shortname = "EX";
2115+
countriesArray.add(countryWithCode);
2116+
codesMap.put(test_code, countryWithCode);
2117+
phoneFormatMap.put(test_code, Collections.singletonList("66 X XXXX"));
21102118
}
21112119
});
21122120
}, ConnectionsManager.RequestFlagWithoutLogin | ConnectionsManager.RequestFlagFailOnServerErrors);
@@ -2438,12 +2446,17 @@ private void onConfirm(PhoneNumberConfirmView confirmView) {
24382446
}
24392447
String phone = PhoneFormat.stripExceptNumbers("" + codeField.getText() + phoneField.getText());
24402448
if (activityMode == MODE_LOGIN) {
2441-
boolean testBackend = BuildVars.DEBUG_PRIVATE_VERSION && getConnectionsManager().isTestBackend();
2449+
if (!testBackend && "999".equals(codeField.getText().toString())) {
2450+
testBackend = true;
2451+
if (testBackendCheckBox != null) {
2452+
testBackendCheckBox.setChecked(true, true);
2453+
}
2454+
}
2455+
boolean testBackend = getConnectionsManager().isTestBackend();
24422456
if (testBackend != LoginActivity.this.testBackend) {
24432457
getConnectionsManager().switchBackend(false);
24442458
testBackend = LoginActivity.this.testBackend;
24452459
}
2446-
24472460
if (getParentActivity() instanceof LaunchActivity) {
24482461
for (int a = 0; a < UserConfig.MAX_ACCOUNT_COUNT; a++) {
24492462
UserConfig userConfig = UserConfig.getInstance(a);

0 commit comments

Comments
 (0)