refact: show proxy settings on ios (#13423)

Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
fufesou
2025-11-04 17:55:04 +08:00
committed by GitHub
parent a903f710ea
commit 9b69c7e972
2 changed files with 7 additions and 6 deletions

View File

@@ -685,7 +685,7 @@ class _SettingsState extends State<SettingsPage> with WidgetsBindingObserver {
setState(callback); setState(callback);
}); });
}), }),
if (!isIOS && !_hideNetwork && !_hideProxy) if (!_hideNetwork && !_hideProxy)
SettingsTile( SettingsTile(
title: Text(translate('Socks5/Http(s) Proxy')), title: Text(translate('Socks5/Http(s) Proxy')),
leading: Icon(Icons.network_ping), leading: Icon(Icons.network_ping),

View File

@@ -452,10 +452,8 @@ pub fn install_options() -> String {
pub fn get_socks() -> Vec<String> { pub fn get_socks() -> Vec<String> {
#[cfg(not(any(target_os = "android", target_os = "ios")))] #[cfg(not(any(target_os = "android", target_os = "ios")))]
let s = ipc::get_socks(); let s = ipc::get_socks();
#[cfg(target_os = "android")] #[cfg(any(target_os = "android", target_os = "ios"))]
let s = Config::get_socks(); let s = Config::get_socks();
#[cfg(target_os = "ios")]
let s: Option<config::Socks5Server> = None;
match s { match s {
None => Vec::new(), None => Vec::new(),
Some(s) => { Some(s) => {
@@ -477,7 +475,7 @@ pub fn set_socks(proxy: String, username: String, password: String) {
}; };
#[cfg(not(any(target_os = "android", target_os = "ios")))] #[cfg(not(any(target_os = "android", target_os = "ios")))]
ipc::set_socks(socks).ok(); ipc::set_socks(socks).ok();
#[cfg(target_os = "android")] #[cfg(any(target_os = "android", target_os = "ios"))]
{ {
let _nat = crate::CheckTestNatType::new(); let _nat = crate::CheckTestNatType::new();
if socks.proxy.is_empty() { if socks.proxy.is_empty() {
@@ -485,9 +483,12 @@ pub fn set_socks(proxy: String, username: String, password: String) {
} else { } else {
Config::set_socks(Some(socks)); Config::set_socks(Some(socks));
} }
crate::RendezvousMediator::restart();
log::info!("socks updated"); log::info!("socks updated");
} }
#[cfg(target_os = "android")]
{
crate::RendezvousMediator::restart();
}
} }
#[inline] #[inline]