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

feat: show more stations on scroll #927

Merged
merged 1 commit into from
Sep 20, 2024
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
273 changes: 271 additions & 2 deletions lib/l10n/app_sk.arb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"addToFavorites": "Pridať k obľúbeným",
"removeFromFavorites": "Odstrániť z obľúbených",
"share": "Zdieľať",
"local": "Lokálne",
"localAudio": "Lokálne audio",
"localAudioDescription": "Vaša audio zbierka uložená v počítači.",
"localAudioSubtitle": "Nie je potrebné pripojenie k internetu",
Expand Down Expand Up @@ -304,6 +305,7 @@
"reorder": "Preusporiadať",
"move": "Presunúť",
"pinAlbum": "Pripnúť album na bočný panel",
"unPinAlbum": "Odopnúť album z bočného panela",
"playAll": "Prehrať všetko",
"hearingHistory": "História počúvania",
"emptyHearingHistory": "V tejto relácii aplikácie ste ešte nepočúvali rozhlasové stanice.",
Expand All @@ -322,5 +324,272 @@
"downloadEpisode": "Stiahnuť epizódu",
"removeDownloadEpisode": "Odstrániť stiahnutú epizódu",
"language": "Jazyk",
"duration": "Trvanie"
}
"duration": "Trvanie",
"radioTagDisclaimerTitle": "Táto stanica vysiela veľa označení.",
"radioTagDisclaimerSubTitle": "Niekedy stanice vysielajú označenia, ktoré nezodpovedajú žiadnemu žánru hudby. MusicPod nezodpovedá za obsah!",
"podcastFeedLoadingTimeout": "Načítanie kanála podcastov trvá dlhšie ako zvyčajne...",
"gitHubClientConnectError": "Nepodarilo sa načítať online verziu z GitHubu.",
"replayEpisode": "Znova prehrať epizódu",
"replayAllEpisodes": "Znova prehrať všetky epizódy",
"checkForUpdates": "Skontrolovať aktualizácie",
"playbackWillStopIn": "Prehrávanie sa zastaví o: {duration} ({timeOfDay})",
"schedulePlaybackStopTimer": "Naplánovať čas zastavenia prehrávania",
"alwaysAsk": "Vždy sa pýtať",
"hideToTray": "Skryť na panel",
"closeBtnAction": "Akcia tlačidla Zavrieť",
"whenCloseBtnClicked": "Po kliknutí na tlačidlo Zavrieť",
"closeApp": "Zatvoriť aplikáciu",
"closeMusicPod": "Zatvoriť MusicPod?",
"confirmCloseOrHideTip": "Potvrďte prosím, či potrebujete aplikáciu zatvoriť alebo skryť?",
"doNotAskAgain": "Už sa nepýtaj",
"regionNone": "Žiadny",
"regionAfghanistan": "Afganistan",
"regionAlandislands": "Alandské ostrovy",
"regionAlbania": "Albánsko",
"regionAlgeria": "Alžírsko",
"regionAmericansamoa": "Americká Samoa",
"regionAndorra": "Andorra",
"regionAngolia": "Angolia",
"regionAnguilla": "Anguilla",
"regionAntarctica": "Antarktída",
"regionAntiguaandbarbuda": "Antigua a Barbuda",
"regionArgentina": "Argentína",
"regionArmenia": "Arménsko",
"regionAruba": "Aruba",
"regionAustralia": "Austrália",
"regionAustria": "Rakúsko",
"regionAzerbaijan": "Azerbajdžan",
"regionBahamas": "Bahamy",
"regionBahrain": "Bahrajn",
"regionBangladesh": "Bangladéš",
"regionBarbados": "Barbados",
"regionBelarus": "Bielorusko",
"regionBelgium": "Belgicko",
"regionBelize": "Belize",
"regionBenin": "Benin",
"regionBermuda": "Bermudy",
"regionBhutan": "Bhután",
"regionBolivia": "Bolívia",
"regionBonaire": "Bonaire",
"regionBosniaandherzegovina": "Bosna a Hercegovina",
"regionBotswana": "Botswana",
"regionBouvetisland": "Bouvetov ostrov",
"regionBrazil": "Brazília",
"regionBritishindianoceanterrirory": "Britské indické oceánske územie",
"regionBritishvirginislands": "Britské Panenské ostrovy",
"regionBruneidarussalam": "Brunej Darussalam",
"regionBulgaria": "Bulharsko",
"regionBurkinafaso": "Burkina Faso",
"regionBurundi": "Burundi",
"regionCaboverde": "Kapverdy",
"regionCambodia": "Kambodža",
"regionCameroon": "Kamerun",
"regionCanada": "Kanada",
"regionCaymanislands": "Kajmanské ostrovy",
"regionCentralafricanrepublic": "Stredoafrická republika",
"regionChad": "Čad",
"regionChile": "Čile",
"regionChina": "Čína",
"regionChristmasisland": "Vianočný ostrov",
"regionCocosislands": "Kokosové ostrovy",
"regionColombia": "Kolumbia",
"regionComoros": "Komory",
"regionCongo": "Kongo",
"regionCongodemocraticrepublicof": "Konžská demokratická republika",
"regionCookislands": "Cookove ostrovy",
"regionCostarica": "Kostarika",
"regionCotedivoire": "Pobrežie slonoviny",
"regionCroatia": "Chorvátsko",
"regionCuba": "Kuba",
"regionCuracao": "Curacao",
"regionCyprus": "Cyprus",
"regionCzechia": "Česko",
"regionDenmark": "Dánsko",
"regionDjibouti": "Džibutsko",
"regionDominica": "Dominika",
"regionDominicanrepublic": "Dominikánska republika",
"regionEcuador": "Ekvádor",
"regionEgypt": "Egypt",
"regionElsalvador": "El Salvador",
"regionEquatorialguinea": "Rovníková Guinea",
"regionEritrea": "Eritrea",
"regionEstonia": "Estónsko",
"regionEthiopia": "Etiópia",
"regionFalklandislands": "Falklandské ostrovy",
"regionFaroeislands": "Faerské ostrovy",
"regionFiji": "Fidži",
"regionFinland": "Fínsko",
"regionFrance": "Francúzsko",
"regionFrenchguiana": "Francúzska Guyana",
"regionFrenchpolynesia": "Francúzska Polynézia",
"regionFrenchsouthernterritories": "Francúzske južné územia",
"regionGabon": "Gabon",
"regionGambia": "Gambia",
"regionGeorgia": "Gruzínsko",
"regionGermany": "Nemecko",
"regionGhana": "Ghana",
"regionGibraltar": "Gibraltár",
"regionGreece": "Grécko",
"regionGreenland": "Grónsko",
"regionGrenada": "Grenada",
"regionGuadeloupe": "Guadeloupe",
"regionGuam": "Guam",
"regionGuatemala": "Guatemala",
"regionGuernsey": "Guernsey",
"regionGuinea": "Guinea",
"regionGuineabissau": "Guinea-Bissau",
"regionGuyana": "Guyana",
"regionHaiti": "Haiti",
"regionHeardislandandmcdonaldislands": "Heardov ostrov a McDonaldove ostrovy",
"regionHonduras": "Honduras",
"regionHongkong": "HongKong",
"regionHungary": "Maďarsko",
"regionIceland": "Island",
"regionIndia": "India",
"regionIndonesia": "Indonézia",
"regionIran": "Irán",
"regionIraq": "Irak",
"regionIreland": "Írsko",
"regionIsleofman": "Ostrov Man",
"regionIsrael": "Izrael",
"regionItaly": "Taliansko",
"regionJamaica": "Jamajka",
"regionJapan": "Japonsko",
"regionJersey": "Jersey",
"regionJordan": "Jordánsko",
"regionKazakhstan": "Kazachstan",
"regionKenya": "Keňa",
"regionKiribati": "Kiribati",
"regionKuwait": "Kuvajt",
"regionKyrgyzstan": "Kirgizsko",
"regionLaos": "Laos",
"regionLatvia": "Lotyšsko",
"regionLebanon": "Libanon",
"regionLesotho": "Lesotho",
"regionLiberia": "Libéria",
"regionLibya": "Líbya",
"regionLiechtenstein": "Lichtenštajnsko",
"regionLithuania": "Litva",
"regionLuxembourg": "Luxembursko",
"regionMacao": "Makao",
"regionMacedonia": "Macedónsko",
"regionMadagascar": "Madagaskar",
"regionMalawi": "Malawi",
"regionMalaysia": "Malajzia",
"regionMaldives": "Maldivy",
"regionMali": "Mali",
"regionMalta": "Malta",
"regionMarshallislands": "Marshallove ostrovy",
"regionMartinique": "Martinik",
"regionMauritania": "Mauritánia",
"regionMauritius": "Maurícius",
"regionMayotte": "Mayotte",
"regionMexico": "Mexiko",
"regionMicronesia": "Mikronézia",
"regionMoldova": "Moldavsko",
"regionMonaco": "Monako",
"regionMongolia": "Mongolsko",
"regionMontenegro": "Čierna Hora",
"regionMontserrat": "Montserrat",
"regionMorocco": "Maroko",
"regionMozambique": "Mozambik",
"regionMyanmar": "Mjanmarsko",
"regionNamibia": "Namíbia",
"regionNauru": "Nauru",
"regionNepal": "Nepál",
"regionNetherlands": "Holandsko",
"regionNewcaledonia": "Nová Kaledónia",
"regionNewzealand": "Nový Zéland",
"regionNicaragua": "Nikaragua",
"regionNiger": "Niger",
"regionNigeria": "Nigéria",
"regionNiue": "Niue",
"regionNorfolkisland": "Ostrov Norfolk",
"regionNorthkorea": "Severná Kórea",
"regionNorthernmarianaislands": "Severomarianske ostrovy",
"regionNorway": "Nórsko",
"regionOman": "Oman",
"regionPakistan": "Pakistan",
"regionPalau": "Palau",
"regionPalestine": "Palestína",
"regionPanama": "Panama",
"regionPapuanewguinea": "Papua Nová Guinea",
"regionParaguay": "Paraguaj",
"regionPeru": "Peru",
"regionPhilippines": "Filipíny",
"regionPitcairn": "Pitcairn",
"regionPoland": "Poľsko",
"regionPortugal": "Portugalsko",
"regionPuertorico": "Portoriko",
"regionQatar": "Katar",
"regionReunion": "Reunion",
"regionRomania": "Rumunsko",
"regionRussianfederation": "Rusko",
"regionRwanda": "Rwanda",
"regionSaintbarthelemy": "Svätý Bartolomej",
"regionSainthelena": "Svätá Helena",
"regionSaintkittsandnevis": "Svätý Krištof a Nevis",
"regionSaintlucia": "Saint lucia",
"regionSaintmartin": "Svätý Martin",
"regionSaintpierreandmiquelon": "Svätý Pierre a Miquelon",
"regionSaintvincentandthegrenadines": "Svätý Vincent a Grenadíny",
"regionSamoa": "Samoa",
"regionSanmarino": "San Maríno",
"regionSaotomeandprincipe": "Svätý Tomáš a Princov ostrov",
"regionSaudiarabia": "Saudská Arábia",
"regionSenegal": "Senegal",
"regionSerbia": "Srbsko",
"regionSeychelles": "Seychely",
"regionSierraleone": "Sierra Leone",
"regionSingapore": "Singapur",
"regionSintmaarten": "Svätý Martin",
"regionSlovakia": "Slovensko",
"regionSlovenia": "Slovinsko",
"regionSolomonislands": "Šalamúnove ostrovy",
"regionSomalia": "Somálsko",
"regionSouthafrica": "Južná Afrika",
"regionSouthgeorgiaandthesouthsandwichislands": "Južná Georgia a Južné Sandwichove ostrovy",
"regionSouthkorea": "Južná Kórea",
"regionSouthsudan": "Južný Sudán",
"regionSpain": "Španielsko",
"regionSrilanka": "Srí Lanka",
"regionSudan": "Sudán",
"regionSuriname": "Surinam",
"regionSvalbardandjanmayen": "Svalbard a Jan Mayen",
"regionSwaziland": "Svazijsko",
"regionSweden": "Švédsko",
"regionSwitzerland": "Švajčiarsko",
"regionSyrianarabrepublic": "Sýrska arabská republika",
"regionTaiwan": "Taiwan",
"regionTajikistan": "Tadžikistan",
"regionTanzania": "Tanzánia",
"regionThailand": "Thajsko",
"regionTimorleste": "Východný Timor",
"regionTogo": "Togo",
"regionTokelau": "Tokelau",
"regionTonga": "Tonga",
"regionTrinidadandtobago": "Trinidad a Tobago",
"regionTunisia": "Tunisko",
"regionTurkey": "Turecko",
"regionTurkmenistan": "Turkménsko",
"regionTurksandcaicosislands": "Ostrovy Turks a Caicos",
"regionTuvalu": "Tuvalu",
"regionUganda": "Uganda",
"regionUkraine": "Ukrajina",
"regionUnitedarabemirates": "Spojené arabské emiráty",
"regionUnitedkingdom": "Spojené kráľovstvo",
"regionUnitedstates": "Spojené štáty americké",
"regionUnitedstatesminoroutlyingislands": "Menšie odľahlé ostrovy Spojených štátov amerických",
"regionUruguay": "Uruguaj",
"regionUsvirginislands": "Americké Panenské ostrovy",
"regionUzbekistan": "Uzbekistan",
"regionVanuatu": "Vanuatu",
"regionVaticancity": "Vatikán",
"regionVenezuela": "Venezuela",
"regionVietnam": "Vietnam",
"regionWallisandfutuna": "Wallis a Futuna",
"regionWesternsahara": "Západná Sahara",
"regionYemen": "Jemen",
"regionZambia": "Zambia",
"regionZimbabwe": "Zimbabwe"
}
2 changes: 1 addition & 1 deletion lib/radio/radio_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class RadioService {
String? state,
String? tag,
String? language,
int limit = 100,
required int limit,
}) async {
if (_radioBrowserApi == null) {
return [];
Expand Down
5 changes: 2 additions & 3 deletions lib/radio/view/radio_history_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'package:yaru/constants.dart';
import '../../common/data/audio.dart';
import '../../common/data/mpv_meta_data.dart';
import '../../common/view/icons.dart';
import '../online_art_service.dart';
import '../radio_model.dart';
import 'icy_image.dart';
import '../../common/view/mpv_metadata_dialog.dart';
import '../../common/view/tapable_text.dart';
Expand Down Expand Up @@ -59,8 +59,7 @@ class RadioHistoryTile extends StatelessWidget with PlayerMixin {
onPressed: () => showDialog(
context: context,
builder: (context) {
final image =
di<OnlineArtService>().get(entry.value.icyTitle);
final image = di<RadioModel>().getCover(entry.value.icyTitle);
return MpvMetadataDialog(
mpvMetaData: entry.value,
image: image,
Expand Down
20 changes: 16 additions & 4 deletions lib/search/search_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class SearchModel extends SafeChangeNotifier {
void setSearchQuery(String? value) {
if (value == _searchQuery) return;
_podcastLimit = _podcastDefaultLimit;
_radioLimit = _radioDefaultLimit;
_searchQuery = value;
notifyListeners();
}
Expand Down Expand Up @@ -147,6 +148,14 @@ class SearchModel extends SafeChangeNotifier {
int _podcastLimit = _podcastDefaultLimit;
void incrementPodcastLimit(int value) => _podcastLimit += value;

static const _radioDefaultLimit = 64;
int _radioLimit = _radioDefaultLimit;
void incrementRadioLimit(int value) => _radioLimit += value;

void incrementLimit(int value) => _audioType == AudioType.podcast
? incrementPodcastLimit(value)
: incrementRadioLimit(value);

bool loading = false;
set _loading(bool value) {
loading = value;
Expand Down Expand Up @@ -179,23 +188,26 @@ class SearchModel extends SafeChangeNotifier {
)
.then((_) => _loading = false),
SearchType.radioTag => await _radioService
.search(tag: _tag?.name)
.search(tag: _tag?.name, limit: _radioLimit)
.then(
(v) => setRadioSearchResult(
v?.map((e) => Audio.fromStation(e)).toList(),
),
)
.then((_) => _loading = false),
SearchType.radioCountry => await _radioService
.search(country: _country?.name.camelToSentence)
.search(country: _country?.name.camelToSentence, limit: _radioLimit)
.then(
(v) => setRadioSearchResult(
v?.map((e) => Audio.fromStation(e)).toList(),
),
)
.then((_) => _loading = false),
SearchType.radioLanguage => await _radioService
.search(language: _language?.name.toLowerCase())
.search(
language: _language?.name.toLowerCase(),
limit: _radioLimit,
)
.then(
(v) => setRadioSearchResult(
v?.map((e) => Audio.fromStation(e)).toList(),
Expand Down Expand Up @@ -233,5 +245,5 @@ class SearchModel extends SafeChangeNotifier {
}

Future<List<Station>?> radioNameSearch(String? searchQuery) async =>
_radioService.search(name: searchQuery);
_radioService.search(name: searchQuery, limit: _radioLimit);
}
4 changes: 2 additions & 2 deletions lib/search/view/search_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ class SearchPage extends StatelessWidget with WatchItMixin {
return NotificationListener<UserScrollNotification>(
onNotification: (notification) {
if (notification.direction == ScrollDirection.reverse &&
audioType == AudioType.podcast) {
audioType != AudioType.local) {
di<SearchModel>()
..incrementPodcastLimit(8)
..incrementLimit(8)
..search();
}
return true;
Expand Down
Loading