Skip to content

Commit

Permalink
Fix podcast/playlist search
Browse files Browse the repository at this point in the history
  • Loading branch information
Feichtmeier committed May 9, 2024
1 parent 80e4c7b commit c0b1f5c
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 7 deletions.
1 change: 0 additions & 1 deletion lib/src/playlists/view/liked_audio_page.dart
Expand Up @@ -66,7 +66,6 @@ class LikedAudioPage extends StatelessWidget with WatchItMixin {
audioPageType: AudioPageType.likedAudio,
pageId: kLikedAudiosPageId,
pageTitle: context.l10n.likedSongs,
// pageSubTitle: context.l10n.likedSongsSubtitle,
pageLabel: context.l10n.likedSongsSubtitle,
image: FallBackHeaderImage(
child: Icon(
Expand Down
1 change: 1 addition & 0 deletions lib/src/playlists/view/playlist_page.dart
Expand Up @@ -354,6 +354,7 @@ class _PlaylistPageBody extends StatelessWidget with WatchItMixin {
audios: audios,
pageId: pageId,
audioPageType: AudioPageType.playlist,
onSubTitleTab: onArtistTap,
),
],
),
Expand Down
6 changes: 3 additions & 3 deletions lib/src/podcasts/podcast_model.dart
Expand Up @@ -25,8 +25,8 @@ class PodcastModel extends SafeChangeNotifier {

SearchResult? get searchResult => _podcastService.searchResult;

bool _searchActive = false;
bool get searchActive => _searchActive;
bool? _searchActive;
bool? get searchActive => _searchActive;
void setSearchActive(bool value) {
if (value == _searchActive) return;
_searchActive = value;
Expand Down Expand Up @@ -107,7 +107,7 @@ class PodcastModel extends SafeChangeNotifier {
}) async {
await _podcastService.init(forceInit: forceInit);

_searchActive = _libraryService.podcasts.isEmpty;
_searchActive ??= _libraryService.podcasts.isEmpty;

_country ??= Country.values.firstWhereOrNull(
(c) => c.code == (_libraryService.lastCountryCode ?? countryCode),
Expand Down
2 changes: 2 additions & 0 deletions lib/src/podcasts/view/podcast_page.dart
Expand Up @@ -38,6 +38,8 @@ class PodcastPage extends StatelessWidget with WatchItMixin {
void onTap(text) {
final podcastModel = getIt<PodcastModel>();
Navigator.of(context).maybePop();
getIt<LibraryModel>().setIndex(2);
podcastModel.setSearchActive(true);
podcastModel.setSearchQuery(text);
podcastModel.search(searchQuery: text);
}
Expand Down
5 changes: 3 additions & 2 deletions lib/src/podcasts/view/podcasts_page.dart
Expand Up @@ -43,7 +43,8 @@ class _PodcastsPageState extends State<PodcastsPage> {

final model = getIt<PodcastModel>();

final searchActive = watchPropertyValue((PodcastModel m) => m.searchActive);
final searchActive =
watchPropertyValue((PodcastModel m) => m.searchActive ?? false);
final setSearchActive = model.setSearchActive;

final search = model.search;
Expand Down Expand Up @@ -81,7 +82,7 @@ class _PodcastsPageState extends State<PodcastsPage> {
padding: appBarActionSpacing,
child: SearchButton(
active: searchActive,
onPressed: () => setSearchActive(!searchActive),
onPressed: () => setSearchActive(!(searchActive)),
),
),
),
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
@@ -1,6 +1,6 @@
name: musicpod
description: Ubuntu music, radio and podcast player.
version: 1.3.8
version: 1.3.9

publish_to: "none"

Expand Down

0 comments on commit c0b1f5c

Please sign in to comment.