From 8c50468b356b98e3147edf9e141551d29d3af466 Mon Sep 17 00:00:00 2001 From: Feichtmeier Date: Fri, 5 Jan 2024 16:21:30 +0100 Subject: [PATCH] Lookup audios by pageId --- lib/constants.dart | 10 +- lib/src/app/master_detail_page.dart | 3 +- lib/src/app/master_item.dart | 7 +- lib/src/app/master_items.dart | 18 ++-- lib/src/common/master_tile.dart | 149 +++++++++++++++----------- lib/src/library/library_model.dart | 12 +++ lib/src/library/library_service.dart | 8 +- lib/src/library/liked_audio_page.dart | 2 +- lib/src/local_audio/titles_view.dart | 2 +- 9 files changed, 124 insertions(+), 87 deletions(-) diff --git a/lib/constants.dart b/lib/constants.dart index eec014d43..130247330 100644 --- a/lib/constants.dart +++ b/lib/constants.dart @@ -92,7 +92,6 @@ const kAudioQueueThreshHold = 100; const kMainPageIconPadding = EdgeInsets.only(right: 4.0); const kLikedAudiosFileName = 'likedAudios.json'; -const kLikedAudios = 'likedAudios'; const kTagFavsFileName = 'tagFavs.json'; const kLastFav = 'lastFav'; const kPlaylistsFileName = 'playlists.json'; @@ -107,7 +106,6 @@ const kLocalAudioCacheFileName = 'localaudiocache.json'; const kDownloads = 'downloads.json'; const kFeedsWithDownloads = 'feedswithdownloads.json'; const kLocalAudioCache = 'localAudioCache'; -const kLocalAudio = 'localAudio'; const kUseLocalAudioCache = 'cacheSuggestionDisposed'; const kCreateCacheLimit = 1000; const kDirectoryProperty = 'directory'; @@ -123,9 +121,11 @@ const kPodcastIndex = 'podcastIndex'; const kNeverShowImportFails = 'neverShowImportFails'; const kLastCountryCode = 'lastCountryCode'; const kSearchResult = 'searchResult'; -const kPodcasts = 'podcasts'; -const kRadio = 'radio'; -const kNewPlaylist = 'newPlaylist'; +const kLocalAudioPageId = 'localAudio'; +const kPodcastsPageId = 'podcasts'; +const kRadioPageId = 'radio'; +const kNewPlaylistPageId = 'newPlaylist'; +const kLikedAudiosPageId = 'likedAudios'; const shops = { 'https://us.7digital.com/': '7digital', diff --git a/lib/src/app/master_detail_page.dart b/lib/src/app/master_detail_page.dart index 1ae9bf19c..dbd5bf112 100644 --- a/lib/src/app/master_detail_page.dart +++ b/lib/src/app/master_detail_page.dart @@ -55,8 +55,7 @@ class MasterDetailPage extends StatelessWidget { final item = masterItems[index]; return MasterTile( - audios: item.content.$2, - pageId: item.content.$1, + pageId: item.pageId, libraryModel: libraryModel, selected: selected, title: item.titleBuilder(context), diff --git a/lib/src/app/master_item.dart b/lib/src/app/master_item.dart index d962771eb..0c67ba335 100644 --- a/lib/src/app/master_item.dart +++ b/lib/src/app/master_item.dart @@ -1,20 +1,17 @@ import 'package:flutter/widgets.dart'; -import '../../data.dart'; - class MasterItem { MasterItem({ required this.titleBuilder, this.subtitleBuilder, required this.pageBuilder, this.iconBuilder, - required this.content, + required this.pageId, }); final WidgetBuilder titleBuilder; final WidgetBuilder? subtitleBuilder; final WidgetBuilder pageBuilder; final Widget Function(BuildContext context, bool selected)? iconBuilder; - // TODO: lookup Set for pageID instead of copying it - final (String, Set