diff --git a/assets/locales/en.po b/assets/locales/en.po index 3db43c510d..04eef61ae1 100644 --- a/assets/locales/en.po +++ b/assets/locales/en.po @@ -150,9 +150,6 @@ msgstr "Automatically chooses fastest location" msgid "pro_locations" msgstr "Pro locations:" -msgid "currently_unavailable" -msgstr "Currently Unavailable:" - msgid "choose_your_location_with_lantern_pro" msgstr "Choose your location with Lantern Pro:" @@ -937,21 +934,6 @@ msgstr "Private Servers" msgid "fastest_server" msgstr "Fastest Server" -msgid "server_may_be_unreachable" -msgstr "May be unreachable" - -msgid "server_may_be_unreachable_title" -msgstr "This Server may be unreachable" - -msgid "server_may_be_unreachable_message" -msgstr "This Server may not work from your current network. Use Smart Location to pick a working server automatically." - -msgid "use_smart_location" -msgstr "Use Smart Location" - -msgid "try_anyway" -msgstr "Try Anyway" - msgid "join_my_private_server" msgstr "Join My Lantern Private Server" @@ -1672,4 +1654,3 @@ msgid "configuration_message" msgstr "Your old configuration has been cleared. Turn the VPN on to automatically download the latest." - diff --git a/lib/core/common/common.dart b/lib/core/common/common.dart index 5c2676fb03..98ea81a593 100644 --- a/lib/core/common/common.dart +++ b/lib/core/common/common.dart @@ -68,7 +68,6 @@ export 'package:lantern/core/widgets/lantern_logo.dart'; export 'package:lantern/core/widgets/platform_card.dart'; export 'package:lantern/core/widgets/pro_banner.dart'; export 'package:lantern/core/widgets/pro_button.dart'; -export 'package:lantern/core/widgets/server_reachability_warning_icon.dart'; export 'package:lantern/features/home/data_usage.dart'; export '../../core/widgets/divider_space.dart'; diff --git a/lib/core/widgets/server_reachability_warning_icon.dart b/lib/core/widgets/server_reachability_warning_icon.dart deleted file mode 100644 index eddcec31d6..0000000000 --- a/lib/core/widgets/server_reachability_warning_icon.dart +++ /dev/null @@ -1,29 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:lantern/core/common/app_asset.dart'; -import 'package:lantern/core/common/app_image_paths.dart'; -import 'package:lantern/core/common/app_semantic_colors.dart'; -import 'package:lantern/core/localization/i18n.dart'; - -/// Warning icon shown when a server may be unreachable. -class ServerReachabilityWarningIcon extends StatelessWidget { - const ServerReachabilityWarningIcon({super.key, this.size}); - - final double? size; - - @override - Widget build(BuildContext context) { - final label = 'server_may_be_unreachable'.i18n; - return Tooltip( - message: label, - child: Semantics( - label: label, - child: AppImage( - path: AppImagePaths.info, - height: size, - width: size, - color: context.statusWarningBgDot, - ), - ), - ); - } -} diff --git a/lib/features/vpn/location_setting.dart b/lib/features/vpn/location_setting.dart index 92dfb9efb2..8cc31f50b1 100644 --- a/lib/features/vpn/location_setting.dart +++ b/lib/features/vpn/location_setting.dart @@ -1,7 +1,6 @@ import 'package:flutter/material.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:lantern/core/widgets/setting_tile.dart'; -import 'package:lantern/features/vpn/provider/available_servers_notifier.dart'; import 'package:lantern/features/vpn/provider/server_location_notifier.dart'; import '../../core/common/common.dart'; @@ -13,17 +12,6 @@ class LocationSetting extends HookConsumerWidget { Widget build(BuildContext context, WidgetRef ref) { final serverLocation = ref.watch(serverLocationProvider); final serverType = serverLocation.serverType.toServerLocationType; - final selectedServer = ref - .watch(availableServersProvider) - .maybeWhen( - data: (servers) => servers.serverByTag(serverLocation.serverName), - orElse: () => null, - ); - final isManualLanternLocation = - serverType == ServerLocationType.lanternLocation; - final shouldWarnBeforeManualSelection = - isManualLanternLocation && - selectedServer?.shouldWarnBeforeManualSelection == true; String title = ''; String value = ''; @@ -62,17 +50,11 @@ class LocationSetting extends HookConsumerWidget { tileKey: const Key('home.location_setting'), label: title, value: value.i18n, - subtitle: shouldWarnBeforeManualSelection - ? 'server_may_be_unreachable'.i18n - : protocol, + subtitle: protocol, icon: flag.isEmpty ? AppImagePaths.location : Flag(countryCode: flag), actions: [ if (serverType == ServerLocationType.auto) AppImage(path: AppImagePaths.blot, useThemeColor: false), - if (shouldWarnBeforeManualSelection) ...[ - const ServerReachabilityWarningIcon(), - const SizedBox(width: 8), - ], const SizedBox(width: 8), IconButton( onPressed: () => appRouter.push(const ServerSelection()), diff --git a/lib/features/vpn/server_selection.dart b/lib/features/vpn/server_selection.dart index ef00d70c70..e7d48fb010 100644 --- a/lib/features/vpn/server_selection.dart +++ b/lib/features/vpn/server_selection.dart @@ -346,49 +346,10 @@ class _ServerLocationListViewState return const Center(child: Text("No locations available")); } - final List sections; - if (widget.userPro) { - // Pro users get the reachable / currently-unavailable split. - final reachableLocations = allLocations - .where((s) => !s.shouldWarnBeforeManualSelection) - .toList(); - final unavailableLocations = - allLocations - .where((s) => s.shouldWarnBeforeManualSelection) - .toList() - ..sort(_compareServersByLocation); - - sections = [ - if (reachableLocations.isNotEmpty) ...[ - _sectionHeader('pro_locations'.i18n), - _sectionCard( - _reachableLocationTiles( - reachableLocations, - selectedTag, - ), - ), - ], - if (unavailableLocations.isNotEmpty) ...[ - SizedBox(height: reachableLocations.isEmpty ? 4 : size24), - _sectionHeader('currently_unavailable'.i18n), - _sectionCard( - _unavailableLocationTiles( - unavailableLocations, - selectedTag, - ), - ), - ], - ]; - } else { - // Free users see every location in a single list, without the - // reachable / unavailable distinction. - sections = [ - _sectionHeader('pro_locations'.i18n), - _sectionCard( - _reachableLocationTiles(allLocations, selectedTag), - ), - ]; - } + final sections = [ + _sectionHeader('pro_locations'.i18n), + _sectionCard(_locationTiles(allLocations, selectedTag)), + ]; return Stack( children: [ @@ -445,10 +406,7 @@ class _ServerLocationListViewState ); } - List _reachableLocationTiles( - List locations, - String selectedTag, - ) { + List _locationTiles(List locations, String selectedTag) { final grouped = _groupLocationsByCountry(locations); final countryEntries = grouped.entries.toList() ..sort((a, b) => a.key.compareTo(b.key)); @@ -464,7 +422,6 @@ class _ServerLocationListViewState onServerSelected: onServerSelected, server: serverData, isSelected: selectedTag == serverData.tag, - showReachabilityWarning: widget.userPro, ); } @@ -473,22 +430,6 @@ class _ServerLocationListViewState locations: countryLocations, selectedServerTag: selectedTag, onServerSelected: onServerSelected, - showReachabilityWarning: widget.userPro, - ); - }).toList(); - } - - List _unavailableLocationTiles( - List locations, - String selectedTag, - ) { - return locations.map((server) { - return SingleCityServerView( - key: ValueKey(server.tag), - onServerSelected: onServerSelected, - server: server, - isSelected: selectedTag == server.tag, - showReachabilityWarning: widget.userPro, ); }).toList(); } @@ -504,14 +445,6 @@ class _ServerLocationListViewState return children; } - int _compareServersByLocation(Server a, Server b) { - final country = a.location.country.compareTo(b.location.country); - if (country != 0) return country; - final city = a.location.city.compareTo(b.location.city); - if (city != 0) return city; - return a.tag.compareTo(b.tag); - } - Future onServerSelected(Server selectedServer) async { if (PlatformUtils.isMacOS) { /// Check for if extension permission is granted before connecting to server, if not show the permission dialog first @@ -522,87 +455,9 @@ class _ServerLocationListViewState } } - // The unreachable-server warning is part of the Pro reachability - // experience; free users select any location without it. - if (widget.userPro && selectedServer.shouldWarnBeforeManualSelection) { - _showManualServerWarning(selectedServer); - return; - } - await _connectToServer(selectedServer); } - void _showManualServerWarning(Server selectedServer) { - AppDialog.customDialog( - context: context, - content: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - const SizedBox(height: 24), - const Center(child: ServerReachabilityWarningIcon(size: 48)), - const SizedBox(height: 16), - Center( - child: Text( - 'server_may_be_unreachable_title'.i18n, - textAlign: TextAlign.center, - style: Theme.of(context).textTheme.headlineMedium, - ), - ), - const SizedBox(height: 16), - Text( - 'server_may_be_unreachable_message'.i18n, - style: Theme.of(context).textTheme.bodyMedium, - ), - ], - ), - action: [ - AppTextButton( - label: 'try_anyway'.i18n, - textColor: context.textTertiary, - onPressed: () async { - appRouter.maybePop(); - await _connectToServer(selectedServer); - }, - ), - AppTextButton( - label: 'use_smart_location'.i18n, - onPressed: () async { - appRouter.maybePop(); - await _switchToSmartLocation(); - }, - ), - ], - ); - } - - Future _switchToSmartLocation({bool skipConflictCheck = false}) async { - final result = await ref - .read(vpnProvider.notifier) - .startVPN(force: true, skipConflictCheck: skipConflictCheck); - if (!mounted) return; - - result.fold( - (failure) { - if (failure is VpnConflictFailure) { - AppDialog.vpnConflictDialog( - context: context, - onConnectAnyway: () async { - appRouter.maybePop(); - await _switchToSmartLocation(skipConflictCheck: true); - }, - ); - } else { - context.showSnackBar(failure.localizedErrorMessage); - } - }, - (_) async { - await ref.read(serverLocationProvider.notifier).switchToAuto(); - appRouter.popUntilRoot(); - }, - ); - } - Future _connectToServer(Server selectedServer) async { final result = await ref .read(vpnProvider.notifier) @@ -679,14 +534,12 @@ class _CountryCityListView extends StatefulWidget { final List locations; final String selectedServerTag; final OnServerSelected onServerSelected; - final bool showReachabilityWarning; const _CountryCityListView({ required this.country, required this.locations, required this.selectedServerTag, required this.onServerSelected, - this.showReachabilityWarning = true, }); @override @@ -739,11 +592,6 @@ class _CountryCityListViewState extends State<_CountryCityListView> { color: context.textSecondary, ), ), - trailing: !widget.showReachabilityWarning - ? null - : server.isProbedUnreachable - ? const ServerReachabilityWarningIcon() - : null, tileTextStyle: Theme.of( context, ).textTheme.bodyMedium!.copyWith(color: context.textPrimary), @@ -789,7 +637,6 @@ class _CountryCityListViewState extends State<_CountryCityListView> { return SingleCityServerView( nested: true, - showReachabilityWarning: widget.showReachabilityWarning, onServerSelected: (selected) { Navigator.of(bottomSheetContext).pop(); widget.onServerSelected(selected); diff --git a/lib/features/vpn/single_city_server_view.dart b/lib/features/vpn/single_city_server_view.dart index 6777d00b71..9ffe1be8b8 100644 --- a/lib/features/vpn/single_city_server_view.dart +++ b/lib/features/vpn/single_city_server_view.dart @@ -1,6 +1,5 @@ import 'package:flutter/material.dart'; import 'package:lantern/core/models/available_servers.dart'; -import 'package:lantern/features/vpn/server_selection.dart'; import '../../core/common/common.dart'; @@ -8,21 +7,16 @@ import '../../core/common/common.dart'; class SingleCityServerView extends StatefulWidget { final Server server; - final OnServerSelected onServerSelected; + final ValueChanged onServerSelected; final bool isSelected; final bool nested; - /// Whether to surface the "may be unreachable" warning icon. Disabled for - /// free users, who see every location without the reachability distinction. - final bool showReachabilityWarning; - const SingleCityServerView({ super.key, required this.onServerSelected, required this.server, this.isSelected = false, this.nested = false, - this.showReachabilityWarning = true, }); @override @@ -48,11 +42,6 @@ class _SingleCityServerViewState extends State { color: context.textTertiary, ), ), - trailing: !widget.showReachabilityWarning - ? null - : widget.server.isProbedUnreachable - ? const ServerReachabilityWarningIcon() - : null, icon: Flag(countryCode: widget.server.location.countryCode), onPressed: () { widget.onServerSelected(widget.server);