mirror of
https://github.com/NekoX-Dev/NekoX.git
synced 2024-12-12 00:09:26 +01:00
test backend
This commit is contained in:
parent
47579eb857
commit
3279799241
@ -1860,14 +1860,14 @@ void ConnectionsManager::setUserId(int32_t userId) {
|
||||
}
|
||||
|
||||
void ConnectionsManager::switchBackend() {
|
||||
scheduleTask([&] {
|
||||
//scheduleTask([&] {
|
||||
currentDatacenterId = 1;
|
||||
testBackend = !testBackend;
|
||||
datacenters.clear();
|
||||
initDatacenters();
|
||||
saveConfig();
|
||||
exit(1);
|
||||
});
|
||||
//exit(1);
|
||||
//});
|
||||
}
|
||||
|
||||
void ConnectionsManager::removeRequestFromGuid(int32_t requestToken) {
|
||||
|
@ -1230,6 +1230,7 @@ public class LoginActivity extends BaseFragment {
|
||||
private TextView textView;
|
||||
private TextView textView2;
|
||||
private CheckBoxCell checkBoxCell;
|
||||
private CheckBoxCell testBackendCell;
|
||||
|
||||
private int countryState = 0;
|
||||
|
||||
@ -1541,6 +1542,39 @@ public class LoginActivity extends BaseFragment {
|
||||
});
|
||||
}
|
||||
|
||||
testBackendCell = new CheckBoxCell(context, 2);
|
||||
testBackendCell.setText(LocaleController.getString("TestBackend", R.string.TestBackend), "", (ConnectionsManager.native_isTestBackend(currentAccount) != 0), false);
|
||||
addView(testBackendCell, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.MATCH_PARENT, Gravity.LEFT | Gravity.TOP, 0, 0, 0, 0));
|
||||
testBackendCell.setOnClickListener(new OnClickListener() {
|
||||
|
||||
private Toast visibleToast;
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (getParentActivity() == null) {
|
||||
return;
|
||||
}
|
||||
CheckBoxCell cell = (CheckBoxCell) v;
|
||||
ConnectionsManager.native_switchBackend(currentAccount);
|
||||
boolean isTestBackend = ConnectionsManager.native_isTestBackend(currentAccount) != 0;
|
||||
cell.setChecked(isTestBackend, true);
|
||||
try {
|
||||
if (visibleToast != null) {
|
||||
visibleToast.cancel();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
}
|
||||
if (isTestBackend) {
|
||||
visibleToast = Toast.makeText(getParentActivity(), LocaleController.getString("TestBackendOn", R.string.TestBackendOn), Toast.LENGTH_SHORT);
|
||||
visibleToast.show();
|
||||
} else {
|
||||
visibleToast = Toast.makeText(getParentActivity(), LocaleController.getString("TestBackendOff", R.string.TestBackendOff), Toast.LENGTH_SHORT);
|
||||
visibleToast.show();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
HashMap<String, String> languageMap = new HashMap<>();
|
||||
try {
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(getResources().getAssets().open("countries.txt")));
|
||||
@ -1729,7 +1763,7 @@ public class LoginActivity extends BaseFragment {
|
||||
continue;
|
||||
}
|
||||
String userPhone = userConfig.getCurrentUser().phone;
|
||||
if (PhoneNumberUtils.compare(phone, userPhone)) {
|
||||
if (PhoneNumberUtils.compare(phone, userPhone) && ConnectionsManager.native_isTestBackend(currentAccount) == ConnectionsManager.native_isTestBackend(a)) {
|
||||
final int num = a;
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||
builder.setTitle(LocaleController.getString("NekogramWithEmoji", R.string.NekogramWithEmoji));
|
||||
|
@ -46,4 +46,7 @@
|
||||
<string name="ShowFireworks">Mostra fuochi d\'artificio*</string>
|
||||
<string name="SomeItemsNeedRestart">Le opzioni con * potrebbero avere bisogno di un riavvio per avere effetto.</string>
|
||||
<string name="DeleteDownloadedFile">Elimina il file scaricato</string>
|
||||
<string name="TestBackend">Test Backend</string>
|
||||
<string name="TestBackendOn">Questo account si connetterà al server di test.</string>
|
||||
<string name="TestBackendOff">Questo account si connetterà al server principale.</string>
|
||||
</resources>
|
||||
|
@ -46,4 +46,7 @@
|
||||
<string name="ShowFireworks">花火を見ましょう*</string>
|
||||
<string name="SomeItemsNeedRestart">注 * オプションを有効にするには、再起動が必要な場合があります。</string>
|
||||
<string name="DeleteDownloadedFile">キャッシュを削除</string>
|
||||
<string name="TestBackend">異世界</string>
|
||||
<string name="TestBackendOn">このアカウントは、テストバックエンドに接続します。</string>
|
||||
<string name="TestBackendOff">このアカウントは、本番バックエンドに接続します。</string>
|
||||
</resources>
|
@ -46,4 +46,7 @@
|
||||
<string name="ShowFireworks">一起去看烟花吧*</string>
|
||||
<string name="SomeItemsNeedRestart">注 * 的选项可能需要重启才能生效。</string>
|
||||
<string name="DeleteDownloadedFile">删除缓存的文件</string>
|
||||
<string name="TestBackend">异世界</string>
|
||||
<string name="TestBackendOn">此账户将连接至测试后端服务器。</string>
|
||||
<string name="TestBackendOff">此账户将连接至生产后端服务器。</string>
|
||||
</resources>
|
@ -46,4 +46,7 @@
|
||||
<string name="ShowFireworks">一起去看煙花吧*</string>
|
||||
<string name="SomeItemsNeedRestart">注 * 的選項可能需要重啟才能生效。</string>
|
||||
<string name="DeleteDownloadedFile">刪除緩存的文件</string>
|
||||
<string name="TestBackend">異世界</string>
|
||||
<string name="TestBackendOn">此賬戶將連接至測試後端伺服器。</string>
|
||||
<string name="TestBackendOff">此賬戶將連接至生產後端伺服器。</string>
|
||||
</resources>
|
@ -51,4 +51,7 @@
|
||||
<string name="ShowFireworks">Show fireworks*</string>
|
||||
<string name="SomeItemsNeedRestart">Options with * may need restart to take effect.</string>
|
||||
<string name="DeleteDownloadedFile">Delete downloaded file</string>
|
||||
<string name="TestBackend">Test Backend</string>
|
||||
<string name="TestBackendOn">This account will connect to the test backend.</string>
|
||||
<string name="TestBackendOff">This account will connect to the production backend.</string>
|
||||
</resources>
|
Loading…
Reference in New Issue
Block a user