From 0bd9295804b426744e5d2bf0feda3ba12e23c742 Mon Sep 17 00:00:00 2001 From: Ben Hills Date: Wed, 17 Apr 2024 16:31:05 +0100 Subject: [PATCH] Add episode refresh option to podcast details context menu, to compliment pull-down action and work better with screen readers. --- lib/core/environment.dart | 2 +- lib/l10n/L.dart | 10 ++++++++++ lib/l10n/intl_de.arb | 6 ++++++ lib/l10n/intl_en.arb | 6 ++++++ lib/l10n/intl_it.arb | 6 ++++++ lib/l10n/intl_messages.arb | 8 +++++++- lib/l10n/messages_de.dart | 1 + lib/l10n/messages_en.dart | 1 + lib/l10n/messages_it.dart | 9 +++++++++ lib/l10n/messages_messages.dart | 1 + lib/ui/podcast/podcast_context_menu.dart | 23 ++++++++++++++++++++--- pubspec.yaml | 2 +- 12 files changed, 69 insertions(+), 6 deletions(-) diff --git a/lib/core/environment.dart b/lib/core/environment.dart index 9820b91a..4f638991 100644 --- a/lib/core/environment.dart +++ b/lib/core/environment.dart @@ -20,7 +20,7 @@ class Environment { static const _applicationName = 'Anytime'; static const _applicationUrl = 'https://github.com/amugofjava/anytime_podcast_player'; static const _projectVersion = '1.3.8'; - static const _build = '121'; + static const _build = '126'; static var _agentString = userAgentAppString; diff --git a/lib/l10n/L.dart b/lib/l10n/L.dart index 132872cc..18d6260f 100644 --- a/lib/l10n/L.dart +++ b/lib/l10n/L.dart @@ -1557,6 +1557,16 @@ class L { locale: localeName, ); } + + String get refresh_feed_label { + return message('refresh_feed_label') ?? + Intl.message( + 'Refresh episodes', + name: 'refresh_feed_label', + desc: 'Menu item to refresh episodes', + locale: localeName, + ); + } } class AnytimeLocalisationsDelegate extends LocalizationsDelegate { diff --git a/lib/l10n/intl_de.arb b/lib/l10n/intl_de.arb index 00277362..33346f1b 100644 --- a/lib/l10n/intl_de.arb +++ b/lib/l10n/intl_de.arb @@ -968,5 +968,11 @@ "description": "Open show website in browser", "type": "text", "placeholders": {} + }, + "refresh_feed_label": "Holen Sie sich neue Episoden", + "@refresh_feed_label": { + "description": "Menu item to refresh episodes", + "type": "text", + "placeholders": {} } } \ No newline at end of file diff --git a/lib/l10n/intl_en.arb b/lib/l10n/intl_en.arb index fe301663..497c54ed 100644 --- a/lib/l10n/intl_en.arb +++ b/lib/l10n/intl_en.arb @@ -968,5 +968,11 @@ "description": "Open show website in browser", "type": "text", "placeholders": {} + }, + "refresh_feed_label": "Refresh episodes", + "@refresh_feed_label": { + "description": "Menu item to refresh episodes", + "type": "text", + "placeholders": {} } } \ No newline at end of file diff --git a/lib/l10n/intl_it.arb b/lib/l10n/intl_it.arb index 38aa56c3..c2db6097 100644 --- a/lib/l10n/intl_it.arb +++ b/lib/l10n/intl_it.arb @@ -968,5 +968,11 @@ "description": "Open show website in browser", "type": "text", "placeholders": {} + }, + "refresh_feed_label": "Recupera nuovi episodi", + "@refresh_feed_label": { + "description": "Menu item to refresh episodes", + "type": "text", + "placeholders": {} } } \ No newline at end of file diff --git a/lib/l10n/intl_messages.arb b/lib/l10n/intl_messages.arb index 671f7e96..662971bb 100644 --- a/lib/l10n/intl_messages.arb +++ b/lib/l10n/intl_messages.arb @@ -1,5 +1,5 @@ { - "@@last_modified": "2024-04-04T16:54:01.419283", + "@@last_modified": "2024-04-17T14:09:22.222143", "app_title": "Anytime Podcast Player", "@app_title": { "description": "Full title for the application", @@ -913,5 +913,11 @@ "description": "Open show website in browser", "type": "text", "placeholders": {} + }, + "refresh_feed_label": "Refresh episodes", + "@refresh_feed_label": { + "description": "Menu item to refresh episodes", + "type": "text", + "placeholders": {} } } \ No newline at end of file diff --git a/lib/l10n/messages_de.dart b/lib/l10n/messages_de.dart index b7f370c0..d473bc96 100644 --- a/lib/l10n/messages_de.dart +++ b/lib/l10n/messages_de.dart @@ -107,6 +107,7 @@ class MessageLookup extends MessageLookupByLibrary { 'queue_clear_label': MessageLookupByLibrary.simpleMessage('Möchten Sie die Warteschlange wirklich löschen?'), 'queue_clear_label_title': MessageLookupByLibrary.simpleMessage('Warteschlange löschen'), 'queue_remove_label': MessageLookupByLibrary.simpleMessage('Entfernen'), + 'refresh_feed_label': MessageLookupByLibrary.simpleMessage('Holen Sie sich neue Episoden'), 'rewind_button_label': MessageLookupByLibrary.simpleMessage('10 Sekunden zurückspulen'), 'search_back_button_label': MessageLookupByLibrary.simpleMessage('Zurück'), 'search_button_label': MessageLookupByLibrary.simpleMessage('Suche'), diff --git a/lib/l10n/messages_en.dart b/lib/l10n/messages_en.dart index 283e8047..a710523c 100644 --- a/lib/l10n/messages_en.dart +++ b/lib/l10n/messages_en.dart @@ -107,6 +107,7 @@ class MessageLookup extends MessageLookupByLibrary { 'queue_clear_label': MessageLookupByLibrary.simpleMessage('Are you sure you wish to clear the queue?'), 'queue_clear_label_title': MessageLookupByLibrary.simpleMessage('Clear Queue'), 'queue_remove_label': MessageLookupByLibrary.simpleMessage('Remove'), + 'refresh_feed_label': MessageLookupByLibrary.simpleMessage('Refresh episodes'), 'rewind_button_label': MessageLookupByLibrary.simpleMessage('Rewind episode 10 seconds'), 'search_back_button_label': MessageLookupByLibrary.simpleMessage('Back'), 'search_button_label': MessageLookupByLibrary.simpleMessage('Search'), diff --git a/lib/l10n/messages_it.dart b/lib/l10n/messages_it.dart index db355a4a..fc22fed3 100644 --- a/lib/l10n/messages_it.dart +++ b/lib/l10n/messages_it.dart @@ -59,9 +59,16 @@ class MessageLookup extends MessageLookupByLibrary { 'episode_filter_no_episodes_title_label': MessageLookupByLibrary.simpleMessage('Nessun episodio trovato'), 'episode_filter_none_label': MessageLookupByLibrary.simpleMessage('Nessuno'), 'episode_filter_played_label': MessageLookupByLibrary.simpleMessage('Riprodotto'), + 'episode_filter_semantic_label': MessageLookupByLibrary.simpleMessage('Filtra gli episodi'), 'episode_filter_started_label': MessageLookupByLibrary.simpleMessage('Avviato'), 'episode_filter_unplayed_label': MessageLookupByLibrary.simpleMessage('Non riprodotto'), 'episode_label': MessageLookupByLibrary.simpleMessage('Episodio'), + 'episode_sort_alphabetical_ascending_label': MessageLookupByLibrary.simpleMessage('Ordine Alfabetico A-Z'), + 'episode_sort_alphabetical_descending_label': MessageLookupByLibrary.simpleMessage('Ordine Alfabetico Z-A'), + 'episode_sort_earliest_first_label': MessageLookupByLibrary.simpleMessage('I più vecchi'), + 'episode_sort_latest_first_label': MessageLookupByLibrary.simpleMessage('Gli ultimi'), + 'episode_sort_none_label': MessageLookupByLibrary.simpleMessage('Default'), + 'episode_sort_semantic_label': MessageLookupByLibrary.simpleMessage('Ordina gli episodi'), 'error_no_connection': MessageLookupByLibrary.simpleMessage('Impossibile riprodurre l\'episodio. Per favore, verifica la tua connessione e prova di nuovo.'), 'error_playback_fail': MessageLookupByLibrary.simpleMessage('Sì è verificato un errore inatteso durante la riproduzione. Per favore, verifica la tua connessione e prova di nuovo.'), 'fast_forward_button_label': MessageLookupByLibrary.simpleMessage('Manda avanti di 30 secondi'), @@ -86,6 +93,7 @@ class MessageLookup extends MessageLookupByLibrary { 'notes_label': MessageLookupByLibrary.simpleMessage('Note'), 'now_playing_queue_label': MessageLookupByLibrary.simpleMessage('In Riproduzione'), 'ok_button_label': MessageLookupByLibrary.simpleMessage('OK'), + 'open_show_website_label': MessageLookupByLibrary.simpleMessage('Vai al sito web dello show'), 'opml_export_button_label': MessageLookupByLibrary.simpleMessage('Esporta'), 'opml_import_button_label': MessageLookupByLibrary.simpleMessage('Importa'), 'opml_import_export_label': MessageLookupByLibrary.simpleMessage('OPML Importa/Esporta'), @@ -99,6 +107,7 @@ class MessageLookup extends MessageLookupByLibrary { 'queue_clear_label': MessageLookupByLibrary.simpleMessage('Sicuro/a di voler ripulire la coda?'), 'queue_clear_label_title': MessageLookupByLibrary.simpleMessage('Svuota la Coda'), 'queue_remove_label': MessageLookupByLibrary.simpleMessage('Rimuovi'), + 'refresh_feed_label': MessageLookupByLibrary.simpleMessage('Recupera nuovi episodi'), 'rewind_button_label': MessageLookupByLibrary.simpleMessage('Riavvolgi di 10 secondi'), 'search_back_button_label': MessageLookupByLibrary.simpleMessage('Indietro'), 'search_button_label': MessageLookupByLibrary.simpleMessage('Cerca'), diff --git a/lib/l10n/messages_messages.dart b/lib/l10n/messages_messages.dart index d84768ef..fb5592ca 100644 --- a/lib/l10n/messages_messages.dart +++ b/lib/l10n/messages_messages.dart @@ -107,6 +107,7 @@ class MessageLookup extends MessageLookupByLibrary { 'queue_clear_label': MessageLookupByLibrary.simpleMessage('Are you sure you wish to clear the queue?'), 'queue_clear_label_title': MessageLookupByLibrary.simpleMessage('Clear Queue'), 'queue_remove_label': MessageLookupByLibrary.simpleMessage('Remove'), + 'refresh_feed_label': MessageLookupByLibrary.simpleMessage('Refresh episodes'), 'rewind_button_label': MessageLookupByLibrary.simpleMessage('Rewind episode 10 seconds'), 'search_back_button_label': MessageLookupByLibrary.simpleMessage('Back'), 'search_button_label': MessageLookupByLibrary.simpleMessage('Search'), diff --git a/lib/ui/podcast/podcast_context_menu.dart b/lib/ui/podcast/podcast_context_menu.dart index 8f39192d..58e5a430 100644 --- a/lib/ui/podcast/podcast_context_menu.dart +++ b/lib/ui/podcast/podcast_context_menu.dart @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. import 'package:anytime/bloc/podcast/podcast_bloc.dart'; +import 'package:anytime/entities/feed.dart'; import 'package:anytime/entities/podcast.dart'; import 'package:anytime/l10n/L.dart'; import 'package:anytime/state/bloc_state.dart'; @@ -76,6 +77,12 @@ class _MaterialPodcastMenu extends StatelessWidget { child: Text(L.of(context)!.mark_episodes_not_played_label), ), const PopupMenuDivider(), + PopupMenuItem( + value: 'refresh', + enabled: podcast.link?.isNotEmpty ?? false, + child: Text(L.of(context)!.refresh_feed_label), + ), + const PopupMenuDivider(), PopupMenuItem( value: 'web', enabled: podcast.link?.isNotEmpty ?? false, @@ -95,6 +102,11 @@ class _MaterialPodcastMenu extends StatelessWidget { bloc.podcastEvent(PodcastEvent.markAllPlayed); } else if (value == 'ua') { bloc.podcastEvent(PodcastEvent.clearAllPlayed); + } else if (value == 'refresh') { + bloc.load(Feed( + podcast: podcast, + refresh: true, + )); } else if (value == 'web') { final uri = Uri.parse(podcast.link!); @@ -141,10 +153,15 @@ class _CupertinoContextMenu extends StatelessWidget { CupertinoActionSheetAction( isDefaultAction: true, onPressed: () { - bloc.podcastEvent(PodcastEvent.clearAllPlayed); - Navigator.pop(context, 'Cancel'); + bloc.load(Feed( + podcast: podcast, + refresh: true, + )); + if (context.mounted) { + Navigator.pop(context, 'Cancel'); + } }, - child: Text(L.of(context)!.mark_episodes_not_played_label), + child: Text(L.of(context)!.refresh_feed_label), ), CupertinoActionSheetAction( isDefaultAction: true, diff --git a/pubspec.yaml b/pubspec.yaml index 2f6c56f1..212c37b6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: anytime description: Anytime Podcast Player -version: 1.3.8+122 +version: 1.3.8+126 environment: sdk: '>=3.2.0 <4.0.0'