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

show a message when no public servers are available #678

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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