Jenkins uses release dates only + APK delete bugfix

This commit is contained in:
Imran Remtulla
2023-04-30 17:00:00 -04:00
parent 76e316422c
commit 779de58f74
4 changed files with 25 additions and 3 deletions

View File

@@ -5,6 +5,10 @@ import 'package:obtainium/custom_errors.dart';
import 'package:obtainium/providers/source_provider.dart'; import 'package:obtainium/providers/source_provider.dart';
class Jenkins extends AppSource { class Jenkins extends AppSource {
Jenkins() {
overrideVersionDetectionFormDefault('releaseDateAsVersion', true);
}
@override @override
String trimJobUrl(String url) { String trimJobUrl(String url) {
RegExp standardUrlRegEx = RegExp('.*/job/[^/]+'); RegExp standardUrlRegEx = RegExp('.*/job/[^/]+');

View File

@@ -166,7 +166,9 @@ class _AddAppPageState extends State<AddAppPage> {
if (appsProvider.apps.containsKey(app.id)) { if (appsProvider.apps.containsKey(app.id)) {
throw ObtainiumError(tr('appAlreadyAdded')); throw ObtainiumError(tr('appAlreadyAdded'));
} }
if (app.additionalSettings['trackOnly'] == true) { if (app.additionalSettings['trackOnly'] == true ||
app.additionalSettings['versionDetection'] !=
'standardVersionDetection') {
app.installedVersion = app.latestVersion; app.installedVersion = app.latestVersion;
} }
app.categories = pickedCategories; app.categories = pickedCategories;

View File

@@ -212,7 +212,7 @@ class AppsProvider with ChangeNotifier {
var fn = file.path.split('/').last; var fn = file.path.split('/').last;
if (fn.startsWith('${app.id}-') && if (fn.startsWith('${app.id}-') &&
fn.endsWith('.apk') && fn.endsWith('.apk') &&
fn != fileName) { fn != downloadedFile.path.split('/').last) {
file.delete(); file.delete();
} }
} }

View File

@@ -320,6 +320,22 @@ abstract class AppSource {
name = runtimeType.toString(); name = runtimeType.toString();
} }
overrideVersionDetectionFormDefault(String vd, bool disableStandard) {
additionalAppSpecificSourceAgnosticSettingFormItems =
additionalAppSpecificSourceAgnosticSettingFormItems.map((e) {
return e.map((e2) {
if (e2.key == 'versionDetection') {
var item = e2 as GeneratedFormDropdown;
item.defaultValue = vd;
if (disableStandard) {
item.disabledOptKeys = ['standardVersionDetection'];
}
}
return e2;
}).toList();
}).toList();
}
String standardizeUrl(String url) { String standardizeUrl(String url) {
url = preStandardizeUrl(url); url = preStandardizeUrl(url);
if (!hostChanged) { if (!hostChanged) {
@@ -342,7 +358,7 @@ abstract class AppSource {
[]; [];
// Some additional data may be needed for Apps regardless of Source // Some additional data may be needed for Apps regardless of Source
final List<List<GeneratedFormItem>> List<List<GeneratedFormItem>>
additionalAppSpecificSourceAgnosticSettingFormItems = [ additionalAppSpecificSourceAgnosticSettingFormItems = [
[ [
GeneratedFormSwitch( GeneratedFormSwitch(