mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-10-29 04:23:29 +01:00
Fix broken thrid-party f-droid search (#1094)
This commit is contained in:
@@ -214,7 +214,8 @@ class _ImportExportPageState extends State<ImportExportPage> {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
if (selectedUrls != null && selectedUrls.isNotEmpty) {
|
if (selectedUrls != null && selectedUrls.isNotEmpty) {
|
||||||
var errors = await appsProvider.addAppsByURL(selectedUrls);
|
var errors = await appsProvider.addAppsByURL(selectedUrls,
|
||||||
|
sourceOverride: source);
|
||||||
if (errors.isEmpty) {
|
if (errors.isEmpty) {
|
||||||
// ignore: use_build_context_synchronously
|
// ignore: use_build_context_synchronously
|
||||||
showMessage(
|
showMessage(
|
||||||
|
|||||||
@@ -1217,9 +1217,11 @@ class AppsProvider with ChangeNotifier {
|
|||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<List<String>>> addAppsByURL(List<String> urls) async {
|
Future<List<List<String>>> addAppsByURL(List<String> urls,
|
||||||
|
{AppSource? sourceOverride}) async {
|
||||||
List<dynamic> results = await SourceProvider().getAppsByURLNaive(urls,
|
List<dynamic> results = await SourceProvider().getAppsByURLNaive(urls,
|
||||||
alreadyAddedUrls: apps.values.map((e) => e.app.url).toList());
|
alreadyAddedUrls: apps.values.map((e) => e.app.url).toList(),
|
||||||
|
sourceOverride: sourceOverride);
|
||||||
List<App> pps = results[0];
|
List<App> pps = results[0];
|
||||||
Map<String, dynamic> errorsMap = results[1];
|
Map<String, dynamic> errorsMap = results[1];
|
||||||
for (var app in pps) {
|
for (var app in pps) {
|
||||||
|
|||||||
@@ -706,7 +706,8 @@ class SourceProvider {
|
|||||||
|
|
||||||
// Returns errors in [results, errors] instead of throwing them
|
// Returns errors in [results, errors] instead of throwing them
|
||||||
Future<List<dynamic>> getAppsByURLNaive(List<String> urls,
|
Future<List<dynamic>> getAppsByURLNaive(List<String> urls,
|
||||||
{List<String> alreadyAddedUrls = const []}) async {
|
{List<String> alreadyAddedUrls = const [],
|
||||||
|
AppSource? sourceOverride}) async {
|
||||||
List<App> apps = [];
|
List<App> apps = [];
|
||||||
Map<String, dynamic> errors = {};
|
Map<String, dynamic> errors = {};
|
||||||
for (var url in urls) {
|
for (var url in urls) {
|
||||||
@@ -714,7 +715,7 @@ class SourceProvider {
|
|||||||
if (alreadyAddedUrls.contains(url)) {
|
if (alreadyAddedUrls.contains(url)) {
|
||||||
throw ObtainiumError(tr('appAlreadyAdded'));
|
throw ObtainiumError(tr('appAlreadyAdded'));
|
||||||
}
|
}
|
||||||
var source = getSource(url);
|
var source = sourceOverride ?? getSource(url);
|
||||||
apps.add(await getApp(
|
apps.add(await getApp(
|
||||||
source,
|
source,
|
||||||
url,
|
url,
|
||||||
|
|||||||
Reference in New Issue
Block a user