Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

无法关闭系统代理 #811

Open
Energetic3906 opened this issue Jan 6, 2025 · 1 comment · May be fixed by #848
Open

无法关闭系统代理 #811

Energetic3906 opened this issue Jan 6, 2025 · 1 comment · May be fixed by #848

Comments

@Energetic3906
Copy link

在「覆写」-「网络」-「重置」,点击重置之后,开关「系统代理」无效。「系统代理」一直保持开启状态。

判断依据:在不开启「系统代理」的情况下,YouTube的视频是通过udp加载的,开启之后则是通过tcp连接的。

@Energetic3906
Copy link
Author

定位到了问题:

class VpnSystemProxyItem extends StatelessWidget {
  const VpnSystemProxyItem({super.key});

  @override
  Widget build(BuildContext context) {
    return Selector<Config, bool>(
      selector: (_, config) => config.vpnProps.systemProxy,
      builder: (_, systemProxy, __) {
        return ListItem.switchItem(
          title: Text(appLocalizations.systemProxy),
          subtitle: Text(appLocalizations.systemProxyDesc),
          delegate: SwitchDelegate(
            value: systemProxy,
            onChanged: (bool value) async {
              final config = globalState.appController.config;
              final vpnProps = config.vpnProps;
              config.vpnProps = vpnProps.copyWith(
                systemProxy: value,
              );
              // 如果关闭系统代理
              if (!value) {
                config.networkProps = config.networkProps.copyWith(
                  systemProxy: false,
                );
              }
            },
          ),
        );
      },
    );
  }
}

class SystemProxyItem extends StatelessWidget {
  const SystemProxyItem({super.key});

  @override
  Widget build(BuildContext context) {
    return Selector<Config, bool>(
      selector: (_, config) => config.networkProps.systemProxy,
      builder: (_, systemProxy, __) {
        return ListItem.switchItem(
          title: Text(appLocalizations.systemProxy),
          subtitle: Text(appLocalizations.systemProxyDesc),
          delegate: SwitchDelegate(
            value: systemProxy,
            onChanged: (bool value) async {
              final config = globalState.appController.config;
              final networkProps = config.networkProps;
              config.networkProps = networkProps.copyWith(
                systemProxy: value,
              );
              // 如果关闭系统代理
              if (Platform.isAndroid && !value) {
                config.vpnProps = config.vpnProps.copyWith(
                  systemProxy: false,
                );
              }
            },
          ),
        );
      },
    );
  }
}

希望开发者可以检查一下。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant