From e5dc7246c16d4d93b0f58f7982c66b8e4063d95a Mon Sep 17 00:00:00 2001 From: vjrj <vjrj@comunes.org> Date: Thu, 3 Aug 2023 00:20:42 +0200 Subject: [PATCH] Disable VPN check on web --- .../connectivity_widget_wrapper_wrapper.dart | 33 ++++++++++--------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/lib/ui/widgets/connectivity_widget_wrapper_wrapper.dart b/lib/ui/widgets/connectivity_widget_wrapper_wrapper.dart index b260027f..7336efac 100644 --- a/lib/ui/widgets/connectivity_widget_wrapper_wrapper.dart +++ b/lib/ui/widgets/connectivity_widget_wrapper_wrapper.dart @@ -91,27 +91,28 @@ class ConnectivityWidgetWrapperWrapper extends ConnectivityWidgetWrapper { @override Widget build(BuildContext context) { - return FutureBuilder<bool>( - future: CheckVpnConnection.isVpnActive(), - builder: (BuildContext context, AsyncSnapshot<bool> snapshot) { - if (snapshot.hasData && snapshot.data != null) { - final bool isVpnActive = snapshot.data!; - if (isVpnActive) { - return child; - } else { - return super.build(context); - } - } else { - return super.build(context); - } - }); + return kIsWeb + ? super.build(context) + : FutureBuilder<bool>( + future: CheckVpnConnection.isVpnActive(), + builder: (BuildContext context, AsyncSnapshot<bool> snapshot) { + if (snapshot.hasData && snapshot.data != null) { + final bool isVpnActive = snapshot.data!; + if (isVpnActive) { + return child; + } else { + return super.build(context); + } + } else { + return super.build(context); + } + }); } // This package does not work in IOS so we just return true // Also does not detect well in web production mode static Future<bool> get isConnected async { - final bool vpn = await CheckVpnConnection.isVpnActive(); - if (vpn) { + if (!kIsWeb && await CheckVpnConnection.isVpnActive()) { return true; } return kIsWeb || isIOS -- GitLab