mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-10-20 17:53:46 +02:00
Re-enable auto-filtering for farsroid.com w/ toggle to disable it (#2441)
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:html/parser.dart';
|
||||
import 'package:obtainium/app_sources/html.dart';
|
||||
import 'package:obtainium/components/generated_form.dart';
|
||||
import 'package:obtainium/custom_errors.dart';
|
||||
import 'package:obtainium/providers/source_provider.dart';
|
||||
|
||||
@@ -10,6 +12,16 @@ class Farsroid extends AppSource {
|
||||
hosts = ['farsroid.com'];
|
||||
name = 'Farsroid';
|
||||
naiveStandardVersionDetection = true;
|
||||
|
||||
additionalSourceAppSpecificSettingFormItems = [
|
||||
[
|
||||
GeneratedFormSwitch(
|
||||
'useFirstApkOfVersion',
|
||||
label: tr('useFirstApkOfVersion'),
|
||||
defaultValue: true,
|
||||
),
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -64,6 +76,16 @@ class Farsroid extends AppSource {
|
||||
additionalSettings,
|
||||
)).map((l) => MapEntry(Uri.parse(l.key).pathSegments.last, l.key)).toList();
|
||||
|
||||
if (additionalSettings['useFirstApkOfVersion'] == true) {
|
||||
apkLinks = apkLinks
|
||||
.where(
|
||||
(l) => l.key.toLowerCase().startsWith(
|
||||
'$appName-$version'.toLowerCase(),
|
||||
),
|
||||
)
|
||||
.toList();
|
||||
}
|
||||
|
||||
if (apkLinks.isEmpty) {
|
||||
throw NoAPKError();
|
||||
}
|
||||
|
Reference in New Issue
Block a user