mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-08-05 18:48:38 +02:00
fix(home): keep search visible during provider changes
This commit is contained in:
@@ -137,6 +137,24 @@ class HomeSearchProviderPolicy {
|
||||
return resolveProvider(explicitSearchProvider, extensions) != null;
|
||||
}
|
||||
|
||||
/// Keeps the Home search surface stable while extension/provider state is
|
||||
/// being reconciled. A transient missing search capability must not remove
|
||||
/// the field above an already-visible Home feed; changing providers should
|
||||
/// never be required just to make Search reappear.
|
||||
static bool shouldShowSearchBar({
|
||||
required bool hasSearchProvider,
|
||||
required bool isSearchProviderLoading,
|
||||
required bool hasHomeFeedExtension,
|
||||
required bool hasExploreContent,
|
||||
required bool hasSearchInput,
|
||||
}) {
|
||||
return hasSearchProvider ||
|
||||
isSearchProviderLoading ||
|
||||
hasHomeFeedExtension ||
|
||||
hasExploreContent ||
|
||||
hasSearchInput;
|
||||
}
|
||||
|
||||
static String? sanitizeFilter(
|
||||
String? filter,
|
||||
String? currentSearchProvider,
|
||||
|
||||
@@ -768,7 +768,13 @@ class _HomeTabState extends ConsumerState<HomeTab>
|
||||
explicitSearchProvider,
|
||||
extensions,
|
||||
);
|
||||
final showSearchBar = hasSearchProvider || isSearchProviderLoading;
|
||||
final showSearchBar = HomeSearchProviderPolicy.shouldShowSearchBar(
|
||||
hasSearchProvider: hasSearchProvider,
|
||||
isSearchProviderLoading: isSearchProviderLoading,
|
||||
hasHomeFeedExtension: hasHomeFeedExtension,
|
||||
hasExploreContent: hasExploreContent,
|
||||
hasSearchInput: hasSearchInput,
|
||||
);
|
||||
final hasResults =
|
||||
hasSearchInput || hasActualResults || isLoading || showRecentAccess;
|
||||
final showExplore =
|
||||
|
||||
Reference in New Issue
Block a user