Fix broken search (#1006)

This commit is contained in:
Imran Remtulla
2023-10-14 13:25:26 -04:00
parent a726b09f26
commit 9506c11951
4 changed files with 10 additions and 6 deletions

View File

@@ -8,6 +8,7 @@ class FDroidRepo extends AppSource {
FDroidRepo() { FDroidRepo() {
name = tr('fdroidThirdPartyRepo'); name = tr('fdroidThirdPartyRepo');
canSearch = true; canSearch = true;
excludeFromMassSearch = true;
neverAutoSelect = true; neverAutoSelect = true;
additionalSourceAppSpecificSettingFormItems = [ additionalSourceAppSpecificSettingFormItems = [

View File

@@ -153,8 +153,7 @@ class _AddAppPageState extends State<AddAppPage> {
overrideSource: pickedSourceOverride, overrideSource: pickedSourceOverride,
inferAppIdIfOptional: inferAppIdIfOptional); inferAppIdIfOptional: inferAppIdIfOptional);
// Only download the APK here if you need to for the package ID // Only download the APK here if you need to for the package ID
if (isTempId(app) && if (isTempId(app) && app.additionalSettings['trackOnly'] != true) {
app.additionalSettings['trackOnly'] != true) {
// ignore: use_build_context_synchronously // ignore: use_build_context_synchronously
var apkUrl = await appsProvider.confirmApkUrl(app, context); var apkUrl = await appsProvider.confirmApkUrl(app, context);
if (apkUrl == null) { if (apkUrl == null) {
@@ -260,8 +259,9 @@ class _AddAppPageState extends State<AddAppPage> {
searching = true; searching = true;
}); });
try { try {
var results = await Future.wait( var results = await Future.wait(sourceProvider.sources
sourceProvider.sources.where((e) => e.canSearch).map((e) async { .where((e) => e.canSearch && !e.excludeFromMassSearch)
.map((e) async {
try { try {
return await e.search(searchQuery); return await e.search(searchQuery);
} catch (err) { } catch (err) {

View File

@@ -141,7 +141,8 @@ class _ImportExportPageState extends State<ImportExportPage> {
} }
}); });
appsProvider.addMissingCategories(settingsProvider); appsProvider.addMissingCategories(settingsProvider);
showMessage(tr('importedX', args: [plural('apps', value)]), context); showMessage(
tr('importedX', args: [plural('apps', value)]), context);
}); });
} else { } else {
// User canceled the picker // User canceled the picker

View File

@@ -494,6 +494,7 @@ abstract class AppSource {
} }
bool canSearch = false; bool canSearch = false;
bool excludeFromMassSearch = false;
List<GeneratedFormItem> searchQuerySettingFormItems = []; List<GeneratedFormItem> searchQuerySettingFormItems = [];
Future<Map<String, List<String>>> search(String query, Future<Map<String, List<String>>> search(String query,
{Map<String, dynamic> querySettings = const {}}) { {Map<String, dynamic> querySettings = const {}}) {
@@ -605,7 +606,8 @@ class SourceProvider {
} }
} }
if (source == null) { if (source == null) {
for (var s in sources.where((element) => element.host == null && !element.neverAutoSelect)) { for (var s in sources.where(
(element) => element.host == null && !element.neverAutoSelect)) {
try { try {
s.sourceSpecificStandardizeURL(url); s.sourceSpecificStandardizeURL(url);
source = s; source = s;