Skip to content

feat(feed): add search and discovery experience - #90

Merged
y0dac merged 100 commits into
devfrom
feature/feed_search_discovery
May 3, 2026
Merged

feat(feed): add search and discovery experience#90
y0dac merged 100 commits into
devfrom
feature/feed_search_discovery

Conversation

@AliIbrahim174

Copy link
Copy Markdown
Member

Overview

This pull request introduces the full Feed, Search, Discovery, and Home experience for the feature/feed_search_discovery branch and prepares it to be merged into dev.

The branch is currently:

  • Base branch: dev
  • Head branch: feature/feed_search_discovery
  • Status: ahead
  • Ahead by: 99 commits
  • Behind by: 0 commits

This means the branch is up to date with dev and can be opened directly as a pull request targeting dev.


Summary

This PR adds a complete discovery-focused user experience across the app. It replaces the old mock-driven home/search flow with real feature modules, richer routing, API-backed data sources, BLoC/Cubit state management, and UI updates for feed, search, discovery, home, playback, profile, and premium-aware surfaces.

The main work includes:

  • Adding the new Discovery feature.
  • Adding the new Search feature.
  • Adding the new Genre browsing experience.
  • Reworking the Feed feature.
  • Replacing the old mock home page with the new real Home feature.
  • Updating app routing and deep-link behavior.
  • Updating dependency injection registrations.
  • Improving playback integration across feed/search/discovery flows.
  • Updating profile data parsing and profile-page support.
  • Updating tests for routing, search, discovery, feed, home, profile, and related modules.
  • Updating Android and CI/release configuration where needed.

Major Features Added

1. Discovery Feature

This PR adds a new features/discovery module with clean architecture layers.

Added discovery data layer

New files include:

  • lib/features/discovery/data/datasources/discovery_remote_data_source.dart
  • lib/features/discovery/data/dto/resolved_resource_model.dart
  • lib/features/discovery/data/dto/trending_track_model.dart
  • lib/features/discovery/data/repositories/discovery_repository_impl.dart
  • lib/features/discovery/data/repositories/trending_repository_impl.dart

This adds support for:

  • Fetching discovery/trending data from the backend.
  • Resolving shared/deep-linked resources.
  • Mapping backend responses into app-level models.
  • Handling trending track DTO parsing.

Added discovery domain layer

New files include:

  • lib/features/discovery/domain/entities/resolved_resource.dart
  • lib/features/discovery/domain/entities/trending_track.dart
  • lib/features/discovery/domain/repositories/discovery_repository.dart
  • lib/features/discovery/domain/repositories/trending_repository.dart
  • lib/features/discovery/domain/usecases/get_trending_usecase.dart
  • lib/features/discovery/domain/usecases/resolve_resource_usecase.dart

This introduces:

  • ResolvedResource entity for resolving shared links.
  • TrendingTrack entity for discovery content.
  • Repository contracts for discovery and trending data.
  • Use cases for fetching trending content and resolving resources.

Added discovery presentation layer

New files include:

  • lib/features/discovery/presentation/bloc/discovery_cubit.dart
  • lib/features/discovery/presentation/bloc/discovery_state.dart
  • lib/features/discovery/presentation/bloc/trending_cubit.dart
  • lib/features/discovery/presentation/bloc/trending_state.dart
  • lib/features/discovery/presentation/page/discover_page.dart

This adds:

  • Discovery state management.
  • Trending content loading flow.
  • A full discovery screen.
  • Discover/feed toggle navigation.
  • Integration with playback and app navigation.

Search Feature

This PR introduces a full search module and replaces the previous mock search flow.

Added search data layer

New files include:

  • lib/features/search/data/datasources/search_remote_data_source.dart
  • lib/features/search/data/datasources/genre_remote_datasource.dart
  • lib/features/search/data/dto/search_models.dart
  • lib/features/search/data/repositories/search_repository_impl.dart
  • lib/features/search/data/repositories/genre_repository_impl.dart

This adds support for:

  • Backend search requests.
  • Genre-based discovery requests.
  • Search DTO parsing.
  • Track, user, and playlist search result mapping.
  • Genre detail and genre content fetching.

Added search domain layer

New files include:

  • lib/features/search/domain/entities/search_entities.dart
  • lib/features/search/domain/entities/genre_entities.dart
  • lib/features/search/domain/repositories/search_repository.dart
  • lib/features/search/domain/repositories/genre_repository.dart
  • lib/features/search/domain/usecases/search_usecase.dart
  • lib/features/search/domain/usecases/genre_usecase.dart

This introduces:

  • Search result entities for tracks, users, and playlists.
  • Search metadata entity for pagination.
  • Genre domain entities.
  • Repository contracts.
  • Use cases for search and genre browsing.

Added search presentation layer

New and modified files include:

  • lib/features/search/presentation/bloc/search_cubit.dart
  • lib/features/search/presentation/bloc/search_state.dart
  • lib/features/search/presentation/bloc/genre_cubit.dart
  • lib/features/search/presentation/bloc/genre_state.dart
  • lib/features/search/presentation/pages/search_page.dart
  • lib/features/search/presentation/pages/genre_page.dart
  • lib/features/search/presentation/widgets/search_bar_widget.dart
  • lib/features/search/presentation/widgets/search_empty_widget.dart
  • lib/features/search/presentation/widgets/search_error_widget.dart
  • lib/features/search/presentation/widgets/search_idle_widget.dart
  • lib/features/search/presentation/widgets/search_results_widget.dart
  • lib/features/search/presentation/widgets/search_tabs_widget.dart
  • lib/features/search/presentation/widgets/search_widgets.dart

This adds:

  • Search page with genre/vibe browsing.
  • Active search page.
  • Debounced suggestions.
  • Recent searches stored with SharedPreferences.
  • Search result tabs:
    • All
    • Tracks
    • Profiles
    • Playlists
  • Paginated search results.
  • Empty, loading, error, suggestion, recent, and result states.
  • Genre detail pages.
  • Genre-based track and playlist browsing.
  • Improved search UI consistent with the app’s SoundCloud-like design.

Feed Feature Updates

This PR heavily updates the feed module to support the new feed/search/discovery experience.

Feed data updates

Modified files include:

  • lib/features/feed/data/datasources/feed_mock_data_source.dart
  • lib/features/feed/data/datasources/feed_remote_data_sources.dart
  • lib/features/feed/data/dto/feed_item_model.dart
  • lib/features/feed/data/repositories/feed_repository_impl.dart

These updates include:

  • Improved feed API integration.
  • Updated feed DTO parsing.
  • Support for richer feed item payloads.
  • Better mapping between backend feed data and app feed entities.
  • Updated mock data alignment with the new feed model.

Feed domain updates

Modified files include:

  • lib/features/feed/domain/entities/feed_item.dart
  • lib/features/feed/domain/repositories/feed_repository.dart
  • lib/features/feed/domain/usecases/get_feed.dart

These updates include:

  • Updated feed item domain shape.
  • Adjusted repository contract.
  • Simplified or updated feed use-case behavior.
  • Alignment with real backend feed payloads.

Feed presentation updates

Modified files include:

  • lib/features/feed/presentation/bloc/feed_cubit.dart
  • lib/features/feed/presentation/bloc/feed_state.dart
  • lib/features/feed/presentation/pages/feed_page.dart
  • lib/features/feed/presentation/widgets/feed_card.dart
  • lib/features/feed/presentation/widgets/feed_toggle.dart

These changes add or improve:

  • Feed initialization flow.
  • Feed loading, loaded, empty, and error states.
  • Infinite scrolling.
  • Pull-to-refresh.
  • Optimistic like behavior.
  • Optimistic repost behavior.
  • Playback access handling.
  • Better feed card layout.
  • Updated feed/discover toggle behavior.
  • Premium-aware ad banner integration.

Home Feature

This PR adds a new real Home feature and removes the old mock home page implementation.

Added home data layer

New files include:

  • lib/features/home/data/datasources/home_remote_data_source.dart
  • lib/features/home/data/repositories/home_repository_impl.dart

This adds backend-backed home content fetching.


Added home domain layer

New files include:

  • lib/features/home/domain/entities/home_content.dart
  • lib/features/home/domain/repositories/home_repository.dart
  • lib/features/home/domain/usecases/get_home_content_usecase.dart
  • lib/features/home/domain/usecases/get_home_trending_tracks_usecase.dart

This introduces:

  • Home content entity.
  • Top playlists grouping.
  • Trending tracks support.
  • Home repository contract.
  • Use cases for home content and trending tracks.

Added home presentation layer

New files include:

  • lib/features/home/presentation/bloc/home_cubit.dart
  • lib/features/home/presentation/bloc/home_state.dart
  • lib/features/home/presentation/pages/home_page.dart

Removed file:

  • lib/features/home/presentation/pages/mock_home_page.dart

The new home page includes:

  • Top app bar.
  • Profile avatar shortcut.
  • Notification shortcut.
  • Messaging shortcut with unread badge.
  • Upload shortcut.
  • Subscription badge.
  • Premium-aware ad banner.
  • Top playlists section.
  • Genre chips.
  • Trending tracks section.
  • Pull-to-refresh.
  • Loading and error views.

Routing Updates

The app router has been significantly updated.

Modified file:

  • lib/app/router.dart

Key routing updates include:

  • Added /discover.
  • Added /search.
  • Added /search/active.
  • Added /genre/:genreSlug.
  • Added route builder for genre pages.
  • Added search active route with optional initial query.
  • Added deep-link routing support for search and resolvable resources.
  • Added resource resolution support for track, playlist, and artist links.
  • Updated home/feed/search navigation to use the new real pages.
  • Updated fallback routing behavior.
  • Improved integration with deep-link destinations.

Deep Link Updates

Modified files include:

  • lib/core/deep_links/deep_link_destination.dart
  • lib/core/deep_links/deep_link_parser.dart

These changes add or improve:

  • Search deep-link destination support.
  • Resolvable resource deep-link support.
  • Better parsing for track, playlist, artist, and search links.
  • Improved route mapping for resolved resources.

Dependency Injection Updates

Modified file:

  • lib/core/di/injector.dart

This PR updates DI registrations for:

  • Discovery data sources.
  • Discovery repositories.
  • Discovery use cases.
  • Discovery cubits.
  • Trending cubits.
  • Search data sources.
  • Search repositories.
  • Search use cases.
  • Search cubit.
  • Genre cubit.
  • Home data source.
  • Home repository.
  • Home use cases.
  • Home cubit.
  • Feed dependencies.
  • Playback-related dependencies.
  • Profile-related dependencies.

These changes make the new feature modules available through getIt.


Playback Updates

Modified and added files include:

  • lib/core/audio/app_audio_handler.dart
  • lib/core/models/track.dart
  • lib/core/services/implementations/just_audio_player_service.dart
  • lib/features/playback/data/dto/track_detail_dto.dart
  • lib/features/playback/data/repositories/queue_repository.dart
  • lib/features/playback/presentation/bloc/playback_cubit.dart
  • lib/features/playback/presentation/bloc/player_cubit.dart
  • lib/features/playback/presentation/bloc/player_ui_state.dart
  • lib/features/playback/presentation/bloc/track_loader_cubit.dart
  • lib/features/playback/presentation/pages/full_player_page.dart
  • lib/features/playback/presentation/pages/track_deep_link_bridge_page.dart
  • lib/features/playback/presentation/widgets/add_to_playlist_sheet.dart

These changes improve:

  • Playback context support.
  • Queue handling.
  • Playing tracks from feed, home, search, and discovery contexts.
  • Full player page behavior.
  • Track deep-link loading.
  • Track model compatibility with newer feed/search/discovery payloads.
  • Audio handler behavior.

Profile Updates

Modified and added files include:

  • lib/features/profile/data/datasources/profile_remote_data_source.dart
  • lib/features/profile/data/dto/profile_page_dto.dart
  • lib/features/profile/data/repositories/profile_repository_impl.dart
  • lib/features/profile/domain/entities/profile_page_data.dart
  • lib/features/profile/domain/repositories/profile_repository.dart
  • lib/features/profile/presentation/bloc/profile_cubit.dart
  • lib/features/profile/presentation/bloc/profile_state.dart
  • lib/features/profile/presentation/pages/profile_page.dart

These updates add or improve:

  • Aggregate profile-page DTO parsing.
  • Profile playlists support.
  • Liked playlists support.
  • Safer profile loading behavior.
  • Better profile state shape.
  • Updated profile page rendering.

Premium and Ads Integration

Modified files include:

  • lib/features/feed/presentation/pages/feed_page.dart
  • lib/features/home/presentation/pages/home_page.dart
  • lib/features/settings/presentation/page/settings_page.dart
  • lib/core/widgets/update_dialog.dart

This PR includes premium-aware UI updates such as:

  • Premium-aware ad banners on feed and home.
  • Subscription badge updates.
  • Navigation to upgrade/billing pages.
  • Related route and UI adjustments.

Networking and API Updates

Modified files include:

  • lib/core/network/api_constants.dart
  • lib/core/network/interceptors/auth_interceptor.dart
  • lib/core/errors/failure.dart

These updates include:

  • New API constants for search, discovery, feed, home, genre, and resource resolution endpoints.
  • Improved failure handling.
  • Updated auth interceptor behavior.
  • Better backend URL and request compatibility.

Android and Platform Updates

Modified files include:

  • android/app/build.gradle.kts
  • android/app/src/main/AndroidManifest.xml

These updates support:

  • Android platform configuration changes.
  • Manifest updates for app behavior.
  • Related release/build compatibility.

CI and Release Updates

Modified files include:

  • .github/workflows/ci.yml
  • .github/workflows/release.yml

These changes update:

  • CI behavior.
  • Release workflow configuration.
  • Build/release pipeline compatibility.

Tests Added or Updated

This PR adds and updates tests across multiple modules.

App tests

Modified files:

  • test/app/app_test.dart
  • test/app/router_test.dart

Updates include:

  • Router test fixes for new Home page.
  • Router test fixes for real Search page.
  • App wiring updates for new dependencies.

Deep link tests

Modified file:

  • test/core/deep_links/deep_link_parser_test.dart

Updates include:

  • Deep-link parsing updates for new routes and resource formats.

Network tests

Modified file:

  • test/core/network/interceptors/auth_interceptor_test.dart

Updates include:

  • Auth interceptor test updates matching the new interceptor behavior.

Discovery tests

Added files:

  • test/features/discovery/data/dto/resolved_resource_model_test.dart
  • test/features/discovery/data/dto/trending_track_model_test.dart
  • test/features/discovery/presentation/bloc/discovery_cubit_test.dart
  • test/features/discovery/presentation/bloc/trending_cubit_test.dart

These cover:

  • Resolved resource model parsing.
  • Trending track model parsing.
  • Discovery cubit behavior.
  • Trending cubit behavior.

Search tests

Added files include:

  • test/features/search/data/datasources/search_remote_data_source_test.dart
  • test/features/search/data/dto/search_models_test.dart
  • test/features/search/data/repositories/search_repository_impl_test.dart
  • test/features/search/domain/entities/genre_entities_test.dart
  • test/features/search/domain/entities/search_entities_test.dart
  • test/features/search/domain/usecases/genre_usecase_test.dart
  • test/features/search/domain/usecases/search_usecase_test.dart
  • test/features/search/presentation/bloc/genre_cubit_test.dart
  • test/features/search/presentation/bloc/search_cubit_test.dart
  • test/features/search/presentation/bloc/search_state_enums_test.dart
  • test/features/search/presentation/bloc/search_state_test.dart

These cover:

  • Search models.
  • Search entities.
  • Search repository.
  • Search use case.
  • Search cubit behavior.
  • Search state behavior.
  • Genre cubit behavior.
  • Genre state behavior.

Home tests

Added or modified files include:

  • test/features/home/presentation/bloc/home_cubit_test.dart
  • test/features/home/presentation/mock_home_page_premium_ad_test.dart
  • test/features/home/presentation/pages/mock_home_page_test.dart

These reflect the migration from mock home behavior toward the real Home experience.


Feed tests

Modified files include:

  • test/features/feed/bloc/feed_cubit_test.dart
  • test/features/feed/data/repositories/feed_repository_impl_test.dart
  • test/features/feed/presentation/pages/feed_page_premium_ad_test.dart
  • test/features/feed/test_helpers.dart

These align feed tests with:

  • Updated feed models.
  • Updated feed state.
  • Updated feed cubit methods.
  • Premium-aware feed UI behavior.

Profile tests

Added or modified files include:

  • test/features/profile/data/dto/profile_page_dto_test.dart
  • test/features/profile/presentation/bloc/profile_cubit_test.dart
  • test/features/profile/presentation/pages/profile_page_test.dart

These cover:

  • Profile page DTO parsing.
  • Profile loading behavior.
  • Playlist and liked playlist parsing.
  • Profile page rendering updates.

Other test updates

Modified files include:

  • test/features/library/presentation/bloc/library_cubit_test.dart
  • test/features/playback/bloc/player_cubit_test.dart
  • test/features/playback/presentation/bloc/playback_cubit_test.dart
  • test/features/playback/presentation/pages/mini_player_test.dart
  • test/features/playback/presentation/pages/playback_ui_pages_test.dart
  • test/features/playlists/data/datasources/playlists_remote_data_source_test.dart
  • test/platform/android_manifest_premium_test.dart

These tests were updated to stay compatible with the new feature integration.


User-Facing Behavior

After this PR, users should be able to:

  • Open the new Home page with real trending and playlist sections.
  • Navigate between Home, Feed, Search, Library, and Premium.
  • Open the Feed page and view following activity.
  • Switch from Feed to Discovery.
  • View trending/discovery content.
  • Search for tracks, profiles, and playlists.
  • View search suggestions while typing.
  • Submit searches and see results grouped by tabs.
  • Reopen recent searches.
  • Browse genre/vibe pages.
  • Play tracks from feed, home, search, and discovery contexts.
  • Open profile pages with richer profile data.
  • Use updated deep links for tracks, playlists, artists, search, and resolved resources.

Technical Notes

State management

The PR uses Cubit/BLoC patterns across the new and updated modules:

  • SearchCubit
  • GenreCubit
  • DiscoveryCubit
  • TrendingCubit
  • HomeCubit
  • FeedCubit

State classes were added or updated to support:

  • Loading states.
  • Success states.
  • Empty states.
  • Error states.
  • Pagination states.
  • Refreshing states.
  • Recent search state.
  • Suggestion loading state.
  • Active tab state.

Architecture

The new feature areas follow the existing project architecture:

features/
  feature_name/
    data/
      datasources/
      dto/
      repositories/
    domain/
      entities/
      repositories/
      usecases/
    presentation/
      bloc/
      pages/
      widgets/

@AliIbrahim174
AliIbrahim174 requested a review from y0dac May 3, 2026 10:33
@y0dac
y0dac merged commit 61c8006 into dev May 3, 2026
AliIbrahim174 pushed a commit that referenced this pull request May 3, 2026
feat(feed): add search and discovery experience
AliIbrahim174 pushed a commit that referenced this pull request May 3, 2026
feat(feed): add search and discovery experience
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants