diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 50a9e8de..85b5a4a4 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -1385,5 +1385,8 @@ "screenControlsExplanation": "When watching a video in full screen, Vertically dragging from the left or the right will adjust the brightness or volume respectively", "retry": "Retry", "forceTvUi": "Force TV interface", - "forceTvUiExplanation": "Force the interface to be the TV experience, can be useful for some devices that do not have the leanback system config. App restart required" + "forceTvUiExplanation": "Force the interface to be the TV experience, can be useful for some devices that do not have the leanback system config. App restart required", + "noPublicServers": "No public servers are available", + "tapToSeeHow": "Tap to see how to host your own", + "referToInvidiousWebsiteForHostingInstructions": "Refer to Invidious website for instructions on how to host invidious" } diff --git a/lib/settings/views/components/manager_server_inner.dart b/lib/settings/views/components/manager_server_inner.dart index dacb6e80..f4c93ca9 100644 --- a/lib/settings/views/components/manager_server_inner.dart +++ b/lib/settings/views/components/manager_server_inner.dart @@ -9,6 +9,7 @@ import 'package:clipious/settings/models/errors/unreacheable_server.dart'; import 'package:clipious/settings/states/server_list_settings.dart'; import 'package:clipious/settings/states/settings.dart'; import 'package:settings_ui/settings_ui.dart'; +import 'package:url_launcher/url_launcher.dart'; import '../../../utils.dart'; import '../../models/db/server.dart'; @@ -205,42 +206,59 @@ class ManagerServersView extends StatelessWidget { )), ) ] - : filteredPublicServers - .map((s) => SettingsTile( - key: Key(s.url), - title: Row( - children: [ - Expanded(child: Text('${s.url} ')), - Text( - (s.ping != null && - s.ping!.compareTo( - const Duration( - seconds: - pingTimeout)) == - -1) - ? '${s.ping?.inMilliseconds}ms' - : '>${pingTimeout}s', - style: textTheme.labelLarge - ?.copyWith( - color: colorScheme - .secondary)) - ], - ), - value: Wrap( - children: [ - Visibility( - visible: s.flag != null && - s.region != null, - child: Text( - '${s.flag} - ${s.region} - ')), - Text(locals.tapToAddServer) - ], - ), - onPressed: (context) => - showPublicServerActions( - context, state, s), - )) - .toList()), + : (filteredPublicServers.isEmpty + ? [ + SettingsTile( + title: Text(locals.noPublicServers), + description: Text(locals.tapToSeeHow), + leading: const Icon( + Icons.warning_amber_outlined), + onPressed: (context) { + launchUrl( + Uri.parse( + 'https://docs.invidious.io/installation/'), + mode: + LaunchMode.externalApplication); + }, + ) + ] + : filteredPublicServers + .map((s) => SettingsTile( + key: Key(s.url), + title: Row( + children: [ + Expanded( + child: Text('${s.url} ')), + Text( + (s.ping != null && + s.ping!.compareTo( + const Duration( + seconds: + pingTimeout)) == + -1) + ? '${s.ping?.inMilliseconds}ms' + : '>${pingTimeout}s', + style: textTheme.labelLarge + ?.copyWith( + color: colorScheme + .secondary)) + ], + ), + value: Wrap( + children: [ + Visibility( + visible: s.flag != null && + s.region != null, + child: Text( + '${s.flag} - ${s.region} - ')), + Text(locals.tapToAddServer) + ], + ), + onPressed: (context) => + showPublicServerActions( + context, state, s), + )) + .toList())), ], ), Positioned( diff --git a/lib/settings/views/tv/components/manage_server_inner.dart b/lib/settings/views/tv/components/manage_server_inner.dart index 61e46d7c..f7dc5230 100644 --- a/lib/settings/views/tv/components/manage_server_inner.dart +++ b/lib/settings/views/tv/components/manage_server_inner.dart @@ -102,16 +102,24 @@ class TvManageServersInner extends StatelessWidget { )), ) ] - : filteredPublicServers - .map((s) => SettingsTile( - key: Key(s.url), - title: - '${s.url} - ${(s.ping != null && s.ping!.compareTo(const Duration(seconds: pingTimeout)) == -1) ? '${s.ping?.inMilliseconds}ms' : '>${pingTimeout}s'}', - description: - '${(s.flag != null && s.region != null) ? '${s.flag} - ${s.region} - ' : ''} ${locals.tapToAddServer}', - onSelected: (context) => cubit.upsertServer(s), - )) - .toList() + : filteredPublicServers.isEmpty + ? [ + SettingsTile( + title: locals.noPublicServers, + description: locals + .referToInvidiousWebsiteForHostingInstructions, + ) + ] + : filteredPublicServers + .map((s) => SettingsTile( + key: Key(s.url), + title: + '${s.url} - ${(s.ping != null && s.ping!.compareTo(const Duration(seconds: pingTimeout)) == -1) ? '${s.ping?.inMilliseconds}ms' : '>${pingTimeout}s'}', + description: + '${(s.flag != null && s.region != null) ? '${s.flag} - ${s.region} - ' : ''} ${locals.tapToAddServer}', + onSelected: (context) => cubit.upsertServer(s), + )) + .toList() ]); }); } diff --git a/pubspec.yaml b/pubspec.yaml index f3057ffc..3c80b0cd 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: clipious -version: 1.22.7+4070 +version: 1.22.8+4071 publish_to: none description: Client for invidious. environment: