|
|
@ -48,7 +48,7 @@ class UnifiedSearchBloc extends InteractiveBloc implements UnifiedSearchBlocEven |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
|
BehaviorSubject<Result<Map<CoreUnifiedSearchProvider, Result<CoreUnifiedSearchResult>>?>> results = |
|
|
|
BehaviorSubject<Result<Map<CoreUnifiedSearchProvider, Result<CoreUnifiedSearchResult>>?>> results = |
|
|
|
BehaviorSubject.seeded(Result.success(null)); |
|
|
|
BehaviorSubject.seeded(const Result.success(null)); |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
|
void dispose() { |
|
|
|
void dispose() { |
|
|
@ -76,13 +76,13 @@ class UnifiedSearchBloc extends InteractiveBloc implements UnifiedSearchBlocEven |
|
|
|
@override |
|
|
|
@override |
|
|
|
void disable() { |
|
|
|
void disable() { |
|
|
|
enabled.add(false); |
|
|
|
enabled.add(false); |
|
|
|
results.add(Result.success(null)); |
|
|
|
results.add(const Result.success(null)); |
|
|
|
_term = ''; |
|
|
|
_term = ''; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Future<void> _search() async { |
|
|
|
Future<void> _search() async { |
|
|
|
if (_term.isEmpty) { |
|
|
|
if (_term.isEmpty) { |
|
|
|
results.add(Result.success(null)); |
|
|
|
results.add(const Result.success(null)); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -107,12 +107,12 @@ class UnifiedSearchBloc extends InteractiveBloc implements UnifiedSearchBlocEven |
|
|
|
final Iterable<CoreUnifiedSearchProvider> providers, |
|
|
|
final Iterable<CoreUnifiedSearchProvider> providers, |
|
|
|
) sync* { |
|
|
|
) sync* { |
|
|
|
for (final provider in providers) { |
|
|
|
for (final provider in providers) { |
|
|
|
yield MapEntry(provider, Result.loading()); |
|
|
|
yield MapEntry(provider, const Result.loading()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Future<void> _searchProvider(final CoreUnifiedSearchProvider provider) async { |
|
|
|
Future<void> _searchProvider(final CoreUnifiedSearchProvider provider) async { |
|
|
|
_updateResults(provider, Result.loading()); |
|
|
|
_updateResults(provider, const Result.loading()); |
|
|
|
try { |
|
|
|
try { |
|
|
|
final response = await _account.client.core.unifiedSearch.search( |
|
|
|
final response = await _account.client.core.unifiedSearch.search( |
|
|
|
providerId: provider.id, |
|
|
|
providerId: provider.id, |
|
|
|