Third party GitLab search (#1108)

This commit is contained in:
Imran Remtulla
2023-11-24 18:58:10 -05:00
parent 93036c4e67
commit 756763fcbe
3 changed files with 47 additions and 15 deletions

View File

@@ -4,6 +4,7 @@ import 'dart:io';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:obtainium/app_sources/fdroidrepo.dart';
import 'package:obtainium/components/custom_app_bar.dart';
import 'package:obtainium/components/generated_form.dart';
import 'package:obtainium/components/generated_form_modal.dart';
@@ -189,17 +190,29 @@ class _ImportExportPageState extends State<ImportExportPage> {
items: [
[
GeneratedFormTextField('searchQuery',
label: tr('searchQuery'))
label: tr('searchQuery'),
required: source.name != FDroidRepo().name)
],
...source.searchQuerySettingFormItems.map((e) => [e]),
[
GeneratedFormTextField('url',
label: source.host != null
? tr('overrideSource')
: plural('url', 1).substring(2),
defaultValue: source.host ?? '',
required: true)
],
...source.searchQuerySettingFormItems.map((e) => [e])
],
);
});
if (values != null &&
(values['searchQuery'] as String?)?.isNotEmpty == true) {
if (values != null) {
setState(() {
importInProgress = true;
});
if (values['url'] != source.host) {
source = sourceProvider.getSource(values['url'],
overrideSource: source.runtimeType.toString());
}
var urlsWithDescriptions = await source
.search(values['searchQuery'] as String, querySettings: values);
if (urlsWithDescriptions.isNotEmpty) {