Skip to content

Commit

Permalink
Merge pull request #678 from lamarios/feature/add-error-message-when-…
Browse files Browse the repository at this point in the history
…there-are-no-public-servers

show a message when no public servers are available
  • Loading branch information
lamarios authored Mar 8, 2025
2 parents d14eb06 + f29ed14 commit 51f8fc2
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 48 deletions.
5 changes: 4 additions & 1 deletion lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
90 changes: 54 additions & 36 deletions lib/settings/views/components/manager_server_inner.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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(
Expand Down
28 changes: 18 additions & 10 deletions lib/settings/views/tv/components/manage_server_inner.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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()
]);
});
}
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: clipious
version: 1.22.7+4070
version: 1.22.8+4071
publish_to: none
description: Client for invidious.
environment:
Expand Down

0 comments on commit 51f8fc2

Please sign in to comment.