popular sites autocomplete setting
This commit is contained in:
+12
-1
@@ -34,7 +34,8 @@ class EngineSuggestions extends _$EngineSuggestions {
|
||||
/// autocomplete (history/top-domains); when that yields nothing, falls back
|
||||
/// to a popular-domain prefix match from the bundled Tranco-derived
|
||||
/// `sites.db` so typing "git" still completes to "github.com" without any
|
||||
/// local history.
|
||||
/// local history. The fallback can be turned off via the
|
||||
/// `popularSitesAutocompleteEnabled` setting.
|
||||
Future<String?> getAutocompleteSuggestion(String query) async {
|
||||
final engineResult = await ref
|
||||
.read(engineSuggestionsServiceProvider)
|
||||
@@ -47,6 +48,16 @@ class EngineSuggestions extends _$EngineSuggestions {
|
||||
|
||||
if (!ref.mounted) return null;
|
||||
|
||||
final popularSitesEnabled = ref.read(
|
||||
generalSettingsWithDefaultsProvider.select(
|
||||
(s) => s.popularSitesAutocompleteEnabled,
|
||||
),
|
||||
);
|
||||
|
||||
if (!popularSitesEnabled) {
|
||||
return null;
|
||||
}
|
||||
|
||||
final popularSites = await ref
|
||||
.read(popularSitesRepositoryProvider.notifier)
|
||||
.searchByPrefix(query, limit: 1);
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ final class EngineSuggestionsProvider
|
||||
EngineSuggestions create() => EngineSuggestions();
|
||||
}
|
||||
|
||||
String _$engineSuggestionsHash() => r'4918e80a1e7dfb59fe67d0895e62a39f2704851f';
|
||||
String _$engineSuggestionsHash() => r'b2bc587d8df12b5614e2c00494a0d666e2c30746';
|
||||
|
||||
abstract class _$EngineSuggestions
|
||||
extends $StreamNotifier<List<GeckoSuggestion>> {
|
||||
|
||||
Reference in New Issue
Block a user