mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-08-01 21:30:16 +02:00
Merge pull request #309 from ImranR98/dev
Release Filter Support for APKMirror (#307) + UI Bugfix (#303)
This commit is contained in:
@@ -1,7 +1,9 @@
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
import 'package:html/parser.dart';
|
import 'package:html/parser.dart';
|
||||||
import 'package:http/http.dart';
|
import 'package:http/http.dart';
|
||||||
|
import 'package:obtainium/components/generated_form.dart';
|
||||||
import 'package:obtainium/custom_errors.dart';
|
import 'package:obtainium/custom_errors.dart';
|
||||||
import 'package:obtainium/providers/source_provider.dart';
|
import 'package:obtainium/providers/source_provider.dart';
|
||||||
|
|
||||||
@@ -9,6 +11,23 @@ class APKMirror extends AppSource {
|
|||||||
APKMirror() {
|
APKMirror() {
|
||||||
host = 'apkmirror.com';
|
host = 'apkmirror.com';
|
||||||
enforceTrackOnly = true;
|
enforceTrackOnly = true;
|
||||||
|
|
||||||
|
additionalSourceAppSpecificSettingFormItems = [
|
||||||
|
[
|
||||||
|
GeneratedFormSwitch('fallbackToOlderReleases',
|
||||||
|
label: tr('fallbackToOlderReleases'), defaultValue: true)
|
||||||
|
],
|
||||||
|
[
|
||||||
|
GeneratedFormTextField('filterReleaseTitlesByRegEx',
|
||||||
|
label: tr('filterReleaseTitlesByRegEx'),
|
||||||
|
required: false,
|
||||||
|
additionalValidators: [
|
||||||
|
(value) {
|
||||||
|
return regExValidator(value);
|
||||||
|
}
|
||||||
|
])
|
||||||
|
]
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -30,11 +49,31 @@ class APKMirror extends AppSource {
|
|||||||
String standardUrl,
|
String standardUrl,
|
||||||
Map<String, dynamic> additionalSettings,
|
Map<String, dynamic> additionalSettings,
|
||||||
) async {
|
) async {
|
||||||
|
bool fallbackToOlderReleases =
|
||||||
|
additionalSettings['fallbackToOlderReleases'] == true;
|
||||||
|
String? regexFilter =
|
||||||
|
(additionalSettings['filterReleaseTitlesByRegEx'] as String?)
|
||||||
|
?.isNotEmpty ==
|
||||||
|
true
|
||||||
|
? additionalSettings['filterReleaseTitlesByRegEx']
|
||||||
|
: null;
|
||||||
Response res = await get(Uri.parse('$standardUrl/feed'));
|
Response res = await get(Uri.parse('$standardUrl/feed'));
|
||||||
if (res.statusCode == 200) {
|
if (res.statusCode == 200) {
|
||||||
var item = parse(res.body).querySelector('item');
|
var items = parse(res.body).querySelectorAll('item');
|
||||||
String? titleString = item?.querySelector('title')?.innerHtml;
|
dynamic targetRelease;
|
||||||
String? dateString = item
|
for (int i = 0; i < items.length; i++) {
|
||||||
|
if (!fallbackToOlderReleases && i > 0) break;
|
||||||
|
String? nameToFilter = items[i].querySelector('title')?.innerHtml;
|
||||||
|
if (regexFilter != null &&
|
||||||
|
nameToFilter != null &&
|
||||||
|
!RegExp(regexFilter).hasMatch(nameToFilter.trim())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
targetRelease = items[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
String? titleString = targetRelease?.querySelector('title')?.innerHtml;
|
||||||
|
String? dateString = targetRelease
|
||||||
?.querySelector('pubDate')
|
?.querySelector('pubDate')
|
||||||
?.innerHtml
|
?.innerHtml
|
||||||
.split(' ')
|
.split(' ')
|
||||||
|
@@ -21,7 +21,7 @@ import 'package:easy_localization/src/easy_localization_controller.dart';
|
|||||||
// ignore: implementation_imports
|
// ignore: implementation_imports
|
||||||
import 'package:easy_localization/src/localization.dart';
|
import 'package:easy_localization/src/localization.dart';
|
||||||
|
|
||||||
const String currentVersion = '0.11.0';
|
const String currentVersion = '0.11.1';
|
||||||
const String currentReleaseTag =
|
const String currentReleaseTag =
|
||||||
'v$currentVersion-beta'; // KEEP THIS IN SYNC WITH GITHUB RELEASES
|
'v$currentVersion-beta'; // KEEP THIS IN SYNC WITH GITHUB RELEASES
|
||||||
|
|
||||||
|
@@ -266,6 +266,7 @@ class AppsPageState extends State<AppsPage> {
|
|||||||
)
|
)
|
||||||
: null,
|
: null,
|
||||||
title: Text(
|
title: Text(
|
||||||
|
maxLines: 1,
|
||||||
listedApps[index].installedInfo?.name ??
|
listedApps[index].installedInfo?.name ??
|
||||||
listedApps[index].app.name,
|
listedApps[index].app.name,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
@@ -298,11 +299,14 @@ class AppsPageState extends State<AppsPage> {
|
|||||||
Row(
|
Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Container(
|
||||||
'${listedApps[index].app.installedVersion ?? tr('notInstalled')}${listedApps[index].app.additionalSettings['trackOnly'] == true ? ' ${tr('estimateInBrackets')}' : ''}',
|
constraints: const BoxConstraints(
|
||||||
overflow: TextOverflow.ellipsis,
|
maxWidth: 150),
|
||||||
textAlign: TextAlign.end,
|
child: Text(
|
||||||
)
|
'${listedApps[index].app.installedVersion ?? tr('notInstalled')}${listedApps[index].app.additionalSettings['trackOnly'] == true ? ' ${tr('estimateInBrackets')}' : ''}',
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
textAlign: TextAlign.end,
|
||||||
|
))
|
||||||
]),
|
]),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: changesUrl == null
|
onTap: changesUrl == null
|
||||||
|
@@ -830,10 +830,10 @@ packages:
|
|||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: webview_flutter
|
name: webview_flutter
|
||||||
sha256: f7ec234830f86d0ef2bd664e8460b0038b8c1a83ff076035cad74ac70273753c
|
sha256: dad1f2caa3272071275436984eb123276a6810dbe7cd6f4c60697640b56a4699
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.0.2"
|
version: "4.0.4"
|
||||||
webview_flutter_android:
|
webview_flutter_android:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@@ -17,7 +17,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
|||||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||||
# In Windows, build-name is used as the major, minor, and patch parts
|
# In Windows, build-name is used as the major, minor, and patch parts
|
||||||
# of the product and file versions while build-number is used as the build suffix.
|
# of the product and file versions while build-number is used as the build suffix.
|
||||||
version: 0.11.0+119 # When changing this, update the tag in main() accordingly
|
version: 0.11.1+120 # When changing this, update the tag in main() accordingly
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=2.18.2 <3.0.0'
|
sdk: '>=2.18.2 <3.0.0'
|
||||||
|
Reference in New Issue
Block a user