Auto-enable bundled proxy on first launch; drop in-app download button
- ApplicationLoader now enables a bundled VLESS proxy on a truly fresh install (one-time, guarded by builtin_proxy_autoenabled) so the app can connect even when plain Telegram is blocked; existing users' choices are left untouched - Remove the 'Download FoxiGram' settings row (the app is already installed) and its strings; drop the in-app download mention from READMEs
This commit is contained in:
parent
a46805591b
commit
bbb2b84f07
6 changed files with 53 additions and 14 deletions
|
|
@ -15,9 +15,6 @@ Download `FoxiGram-<version>-<code>-arm64-v8a.apk` from the newest release and
|
|||
install it on your device (you may need to allow installs from unknown
|
||||
sources).
|
||||
|
||||
You can also open the download link straight from the app:
|
||||
**Settings → Foxi → Download FoxiGram**.
|
||||
|
||||
## Built-in proxy servers
|
||||
|
||||
Server credentials are intentionally kept out of this repository.
|
||||
|
|
|
|||
|
|
@ -15,9 +15,6 @@
|
|||
установите его на устройстве (для этого может понадобиться разрешить установку
|
||||
из неизвестных источников).
|
||||
|
||||
Ссылку на скачивание также можно открыть прямо из приложения:
|
||||
**Настройки → Foxi → Скачать FoxiGram**.
|
||||
|
||||
## Встроенные прокси-серверы
|
||||
|
||||
Данные серверов намеренно не хранятся в этом репозитории.
|
||||
|
|
|
|||
|
|
@ -404,6 +404,22 @@ public class ApplicationLoader extends Application {
|
|||
boolean proxyEnabled = prefs.getBoolean("proxy_enabled", false);
|
||||
String proxyIp = prefs.getString("proxy_ip", "");
|
||||
int savedPort = prefs.getInt("proxy_port", 0);
|
||||
|
||||
// First launch: the user has never configured a proxy yet. Auto-enable a
|
||||
// bundled VLESS proxy so the app can connect even if plain Telegram is
|
||||
// blocked. We only do this once (guarded by "builtin_proxy_autoenabled")
|
||||
// and never override a choice an existing user has already made.
|
||||
if (!prefs.getBoolean("builtin_proxy_autoenabled", false)) {
|
||||
if (proxyEnabled || prefs.contains("proxy_ip")) {
|
||||
// Existing user (already has proxy settings): don't touch their
|
||||
// choice, just remember that we've handled the one-time check.
|
||||
prefs.edit().putBoolean("builtin_proxy_autoenabled", true).apply();
|
||||
} else {
|
||||
autoEnableBuiltinProxy(prefs);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!proxyEnabled || !"127.0.0.1".equals(proxyIp)) return;
|
||||
if (XrayController.isRunning()) return;
|
||||
|
||||
|
|
@ -430,6 +446,43 @@ public class ApplicationLoader extends Application {
|
|||
}, "xray-restore").start();
|
||||
}
|
||||
|
||||
private static void autoEnableBuiltinProxy(android.content.SharedPreferences prefs) {
|
||||
SharedConfig.loadProxyList();
|
||||
SharedConfig.ProxyInfo proxy = XrayController.createBuiltinProxy();
|
||||
if (proxy == null) {
|
||||
// No bundled servers configured in this build — mark as handled so we
|
||||
// don't keep probing on every launch.
|
||||
prefs.edit().putBoolean("builtin_proxy_autoenabled", true).apply();
|
||||
return;
|
||||
}
|
||||
|
||||
// Persist the same settings ProxyListActivity writes when a builtin
|
||||
// proxy is selected, so the next launch restores it normally.
|
||||
int localPort = proxy.vlessLocalPort > 0 ? proxy.vlessLocalPort : 10808;
|
||||
prefs.edit()
|
||||
.putString("proxy_ip", "127.0.0.1")
|
||||
.putString("proxy_pass", "")
|
||||
.putString("proxy_user", "")
|
||||
.putInt("proxy_port", localPort)
|
||||
.putString("proxy_secret", "")
|
||||
.putBoolean("proxy_enabled", true)
|
||||
.putBoolean("proxy_enabled_calls", false)
|
||||
.putBoolean("builtin_proxy_autoenabled", true)
|
||||
.apply();
|
||||
SharedConfig.currentProxy = proxy;
|
||||
|
||||
final SharedConfig.ProxyInfo proxyToStart = proxy;
|
||||
new Thread(() -> {
|
||||
boolean ok = XrayController.start(proxyToStart.toVlessConfig());
|
||||
if (ok) {
|
||||
ConnectionsManager.setProxySettings(
|
||||
true, "127.0.0.1", proxyToStart.vlessLocalPort, "", "", "");
|
||||
} else {
|
||||
FileLog.e("XrayController: failed to auto-enable builtin proxy on first launch");
|
||||
}
|
||||
}, "xray-autoenable").start();
|
||||
}
|
||||
|
||||
private void initPushServices() {
|
||||
AndroidUtilities.runOnUIThread(() -> {
|
||||
if (getPushProvider().hasServices()) {
|
||||
|
|
|
|||
|
|
@ -65,7 +65,6 @@ public class NekoSettingsActivity extends BaseNekoSettingsActivity implements Fa
|
|||
private final int accessibilityRow = rowId++;
|
||||
|
||||
private final int sourceCodeRow = rowId++;
|
||||
private final int downloadRow = rowId++;
|
||||
private final int translationRow = rowId++;
|
||||
private final int donateRow = rowId++;
|
||||
private final int checkUpdateRow = rowId++;
|
||||
|
|
@ -169,7 +168,6 @@ public class NekoSettingsActivity extends BaseNekoSettingsActivity implements Fa
|
|||
items.add(UItem.asShadow(null));
|
||||
|
||||
items.add(UItem.asButton(sourceCodeRow, R.drawable.msg_link, LocaleController.getString(R.string.ViewSourceCode), "GitHub").slug("sourceCode"));
|
||||
items.add(UItem.asButtonSubtext(downloadRow, R.drawable.msg_download, LocaleController.getString(R.string.FoxiDownload), LocaleController.getString(R.string.FoxiDownloadAbout)).slug("download"));
|
||||
items.add(UItem.asButtonSubtext(translationRow, R.drawable.msg_translate, LocaleController.getString(R.string.Translation), LocaleController.getString(R.string.TranslationAbout)).slug("translation"));
|
||||
items.add(UItem.asButtonSubtext(donateRow, R.drawable.msg_input_like, LocaleController.getString(R.string.Donate), LocaleController.getString(R.string.DonateAbout)).slug("donate"));
|
||||
items.add(UItem.asButtonSubtext(checkUpdateRow, R.drawable.msg_reset, LocaleController.getString(R.string.CheckUpdate), UpdateHelper.formatDateUpdate(SharedConfig.lastUpdateCheckTime)).slug("checkUpdate"));
|
||||
|
|
@ -225,8 +223,6 @@ public class NekoSettingsActivity extends BaseNekoSettingsActivity implements Fa
|
|||
Browser.openUrl(getParentActivity(), "https://neko.crowdin.com/nekogram");
|
||||
} else if (id == sourceCodeRow) {
|
||||
Browser.openUrl(getParentActivity(), "https://github.com/instant992/FoxiGram");
|
||||
} else if (id == downloadRow) {
|
||||
Browser.openUrl(getParentActivity(), "https://github.com/instant992/FoxiGram/releases");
|
||||
} else if (id >= sponsorRow) {
|
||||
var news = newsList.get(id - sponsorRow);
|
||||
Browser.openUrl(getParentActivity(), news.url);
|
||||
|
|
|
|||
|
|
@ -103,8 +103,6 @@
|
|||
<string name="ProviderMicrosoftTranslator">Microsoft Translator</string>
|
||||
<string name="TranslationProviderShort">Поставщик</string>
|
||||
<string name="ViewSourceCode">Посмотреть исходный код</string>
|
||||
<string name="FoxiDownload">Скачать FoxiGram</string>
|
||||
<string name="FoxiDownloadAbout">Скачайте свежую версию и поделитесь с друзьями</string>
|
||||
<string name="AvatarAsBackground">Фото профиля в качестве фона</string>
|
||||
<string name="BlurAvatarBackground">Размытие фотографии профиля</string>
|
||||
<string name="DarkenAvatarBackground">Затемнение фотографии профиля</string>
|
||||
|
|
|
|||
|
|
@ -112,8 +112,6 @@
|
|||
<string name="ProviderMicrosoftTranslator">Microsoft Translator</string>
|
||||
<string name="TranslationProviderShort">Provider</string>
|
||||
<string name="ViewSourceCode">View source code</string>
|
||||
<string name="FoxiDownload">Download FoxiGram</string>
|
||||
<string name="FoxiDownloadAbout">Get the latest version and share it with friends</string>
|
||||
<string name="AvatarAsBackground">Profile picture as background</string>
|
||||
<string name="BlurAvatarBackground">Blur profile picture</string>
|
||||
<string name="DarkenAvatarBackground">Darken profile picture</string>
|
||||
|
|
|
|||
Loading…
Reference in a new issue