mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-08-22 14:09:29 +02:00
Merge pull request #2030 from ImranR98/dev
- Avoid OS version reconciliation for pseudo-versioned apps (#2023) - When importing configs via link, don't show dialog twice - GitHub - do not use filtered asset release dates (#2012)
This commit is contained in:
@@ -275,14 +275,15 @@ class GitHub extends AppSource {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<MapEntry<String, String>> getReleaseAssetUrls(dynamic release) =>
|
findReleaseAssetUrls(dynamic release) =>
|
||||||
(release['assets'] as List<dynamic>?)?.map((e) {
|
(release['assets'] as List<dynamic>?)?.map((e) {
|
||||||
var url = !e['name'].toString().toLowerCase().endsWith('.apk')
|
var url = !e['name'].toString().toLowerCase().endsWith('.apk')
|
||||||
? (e['browser_download_url'] ?? e['url'])
|
? (e['browser_download_url'] ?? e['url'])
|
||||||
: (e['url'] ?? e['browser_download_url']);
|
: (e['url'] ?? e['browser_download_url']);
|
||||||
return (e['name'] != null) && (url != null)
|
e['final_url'] = (e['name'] != null) && (url != null)
|
||||||
? MapEntry(e['name'] as String, url as String)
|
? MapEntry(e['name'] as String, url as String)
|
||||||
: const MapEntry('', '');
|
: const MapEntry('', '');
|
||||||
|
return e;
|
||||||
}).toList() ??
|
}).toList() ??
|
||||||
[];
|
[];
|
||||||
|
|
||||||
@@ -293,7 +294,9 @@ class GitHub extends AppSource {
|
|||||||
? DateTime.parse(rel['commit']['created'])
|
? DateTime.parse(rel['commit']['created'])
|
||||||
: null;
|
: null;
|
||||||
DateTime? getNewestAssetDateFromRelease(dynamic rel) {
|
DateTime? getNewestAssetDateFromRelease(dynamic rel) {
|
||||||
var t = (rel['assets'] as List<dynamic>?)
|
var allAssets = rel['assets'] as List<dynamic>?;
|
||||||
|
var filteredAssets = rel['filteredAssets'] as List<dynamic>?;
|
||||||
|
var t = (filteredAssets ?? allAssets)
|
||||||
?.map((e) {
|
?.map((e) {
|
||||||
return e?['updated_at'] != null
|
return e?['updated_at'] != null
|
||||||
? DateTime.parse(e['updated_at'])
|
? DateTime.parse(e['updated_at'])
|
||||||
@@ -387,18 +390,38 @@ class GitHub extends AppSource {
|
|||||||
.hasMatch(((releases[i]['body'] as String?) ?? '').trim())) {
|
.hasMatch(((releases[i]['body'] as String?) ?? '').trim())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
var allAssetUrls = getReleaseAssetUrls(releases[i]);
|
var allAssetsWithUrls = findReleaseAssetUrls(releases[i]);
|
||||||
List<MapEntry<String, String>> apkUrls = allAssetUrls
|
List<MapEntry<String, String>> allAssetUrls = allAssetsWithUrls
|
||||||
.where((element) => element.key.toLowerCase().endsWith('.apk'))
|
.map((e) => e['final_url'] as MapEntry<String, String>)
|
||||||
|
.toList();
|
||||||
|
var apkAssetsWithUrls = allAssetsWithUrls
|
||||||
|
.where((element) =>
|
||||||
|
(element['final_url'] as MapEntry<String, String>)
|
||||||
|
.key
|
||||||
|
.toLowerCase()
|
||||||
|
.endsWith('.apk'))
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
apkUrls = filterApks(apkUrls, additionalSettings['apkFilterRegEx'],
|
var filteredApkUrls = filterApks(
|
||||||
|
apkAssetsWithUrls
|
||||||
|
.map((e) => e['final_url'] as MapEntry<String, String>)
|
||||||
|
.toList(),
|
||||||
|
additionalSettings['apkFilterRegEx'],
|
||||||
additionalSettings['invertAPKFilter']);
|
additionalSettings['invertAPKFilter']);
|
||||||
if (apkUrls.isEmpty && additionalSettings['trackOnly'] != true) {
|
var filteredApks = apkAssetsWithUrls
|
||||||
|
.where((e) => filteredApkUrls
|
||||||
|
.where((e2) =>
|
||||||
|
e2.key == (e['final_url'] as MapEntry<String, String>).key)
|
||||||
|
.isNotEmpty)
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
if (apkAssetsWithUrls.isEmpty &&
|
||||||
|
additionalSettings['trackOnly'] != true) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
targetRelease = releases[i];
|
targetRelease = releases[i];
|
||||||
targetRelease['apkUrls'] = apkUrls;
|
targetRelease['apkUrls'] = filteredApkUrls;
|
||||||
|
targetRelease['filteredAssets'] = filteredApks;
|
||||||
targetRelease['version'] =
|
targetRelease['version'] =
|
||||||
additionalSettings['releaseTitleAsVersion'] == true
|
additionalSettings['releaseTitleAsVersion'] == true
|
||||||
? nameToFilter
|
? nameToFilter
|
||||||
@@ -420,6 +443,7 @@ class GitHub extends AppSource {
|
|||||||
throw NoReleasesError();
|
throw NoReleasesError();
|
||||||
}
|
}
|
||||||
String? version = targetRelease['version'];
|
String? version = targetRelease['version'];
|
||||||
|
|
||||||
DateTime? releaseDate = getReleaseDateFromRelease(
|
DateTime? releaseDate = getReleaseDateFromRelease(
|
||||||
targetRelease, useLatestAssetDateAsReleaseDate);
|
targetRelease, useLatestAssetDateAsReleaseDate);
|
||||||
if (version == null) {
|
if (version == null) {
|
||||||
|
@@ -838,30 +838,6 @@ class AppsPageState extends State<AppsPage> {
|
|||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
resetSelectedAppsInstallStatuses() async {
|
|
||||||
try {
|
|
||||||
var values = await showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (BuildContext ctx) {
|
|
||||||
return GeneratedFormModal(
|
|
||||||
title: tr('resetInstallStatusForSelectedAppsQuestion'),
|
|
||||||
items: const [],
|
|
||||||
initValid: true,
|
|
||||||
message: tr('installStatusOfXWillBeResetExplanation',
|
|
||||||
args: [plural('apps', selectedAppIds.length)]),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
if (values != null) {
|
|
||||||
appsProvider.saveApps(selectedApps.map((e) {
|
|
||||||
e.installedVersion = null;
|
|
||||||
return e;
|
|
||||||
}).toList());
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
showMoreOptionsDialog() {
|
showMoreOptionsDialog() {
|
||||||
return showDialog(
|
return showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
|
@@ -130,13 +130,18 @@ class _HomePageState extends State<HomePage> {
|
|||||||
|
|
||||||
// Check initial link if app was in cold state (terminated)
|
// Check initial link if app was in cold state (terminated)
|
||||||
final appLink = await _appLinks.getInitialLink();
|
final appLink = await _appLinks.getInitialLink();
|
||||||
|
var initLinked = false;
|
||||||
if (appLink != null) {
|
if (appLink != null) {
|
||||||
await interpretLink(appLink);
|
await interpretLink(appLink);
|
||||||
|
initLinked = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle link when app is in warm state (front or background)
|
// Handle link when app is in warm state (front or background)
|
||||||
_linkSubscription = _appLinks.uriLinkStream.listen((uri) async {
|
_linkSubscription = _appLinks.uriLinkStream.listen((uri) async {
|
||||||
await interpretLink(uri);
|
if (!initLinked) {
|
||||||
|
await interpretLink(uri);
|
||||||
|
} else {
|
||||||
|
initLinked = false;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -19,6 +19,8 @@ import 'package:easy_localization/easy_localization.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:http/io_client.dart';
|
import 'package:http/io_client.dart';
|
||||||
|
import 'package:obtainium/app_sources/directAPKLink.dart';
|
||||||
|
import 'package:obtainium/app_sources/html.dart';
|
||||||
import 'package:obtainium/components/generated_form.dart';
|
import 'package:obtainium/components/generated_form.dart';
|
||||||
import 'package:obtainium/components/generated_form_modal.dart';
|
import 'package:obtainium/components/generated_form_modal.dart';
|
||||||
import 'package:obtainium/custom_errors.dart';
|
import 'package:obtainium/custom_errors.dart';
|
||||||
@@ -1159,17 +1161,25 @@ class AppsProvider with ChangeNotifier {
|
|||||||
if (app?.app == null) {
|
if (app?.app == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
var source = SourceProvider()
|
||||||
|
.getSource(app!.app.url, overrideSource: app.app.overrideSource);
|
||||||
var naiveStandardVersionDetection =
|
var naiveStandardVersionDetection =
|
||||||
app!.app.additionalSettings['naiveStandardVersionDetection'] == true ||
|
app.app.additionalSettings['naiveStandardVersionDetection'] == true ||
|
||||||
SourceProvider()
|
source.naiveStandardVersionDetection;
|
||||||
.getSource(app.app.url, overrideSource: app.app.overrideSource)
|
|
||||||
.naiveStandardVersionDetection;
|
|
||||||
String? realInstalledVersion =
|
String? realInstalledVersion =
|
||||||
app.app.additionalSettings['useVersionCodeAsOSVersion'] == true
|
app.app.additionalSettings['useVersionCodeAsOSVersion'] == true
|
||||||
? app.installedInfo?.versionCode.toString()
|
? app.installedInfo?.versionCode.toString()
|
||||||
: app.installedInfo?.versionName;
|
: app.installedInfo?.versionName;
|
||||||
|
bool isHTMLWithNoVersionDetection =
|
||||||
|
(source.runtimeType == HTML().runtimeType &&
|
||||||
|
(app.app.additionalSettings['versionExtractionRegEx'] as String?)
|
||||||
|
?.isNotEmpty !=
|
||||||
|
true);
|
||||||
|
bool isDirectAPKLink = source.runtimeType == DirectAPKLink().runtimeType;
|
||||||
return app.app.additionalSettings['trackOnly'] != true &&
|
return app.app.additionalSettings['trackOnly'] != true &&
|
||||||
app.app.additionalSettings['releaseDateAsVersion'] != true &&
|
app.app.additionalSettings['releaseDateAsVersion'] != true &&
|
||||||
|
!isHTMLWithNoVersionDetection &&
|
||||||
|
!isDirectAPKLink &&
|
||||||
realInstalledVersion != null &&
|
realInstalledVersion != null &&
|
||||||
app.app.installedVersion != null &&
|
app.app.installedVersion != null &&
|
||||||
(reconcileVersionDifferences(
|
(reconcileVersionDifferences(
|
||||||
@@ -1240,6 +1250,7 @@ class AppsProvider with ChangeNotifier {
|
|||||||
!isVersionDetectionPossible(
|
!isVersionDetectionPossible(
|
||||||
AppInMemory(app, null, installedInfo, null))) {
|
AppInMemory(app, null, installedInfo, null))) {
|
||||||
app.additionalSettings['versionDetection'] = false;
|
app.additionalSettings['versionDetection'] = false;
|
||||||
|
app.installedVersion = app.latestVersion;
|
||||||
logs.add('Could not reconcile version formats for: ${app.id}');
|
logs.add('Could not reconcile version formats for: ${app.id}');
|
||||||
modded = true;
|
modded = true;
|
||||||
}
|
}
|
||||||
|
@@ -151,10 +151,6 @@ appJSONCompatibilityModifiers(Map<String, dynamic> json) {
|
|||||||
additionalSettings['autoApkFilterByArch'] = false;
|
additionalSettings['autoApkFilterByArch'] = false;
|
||||||
}
|
}
|
||||||
if (source.runtimeType == HTML().runtimeType) {
|
if (source.runtimeType == HTML().runtimeType) {
|
||||||
// HTML 'fixed URL' support should be disabled if it previously did not exist
|
|
||||||
if (originalAdditionalSettings['supportFixedAPKURL'] == null) {
|
|
||||||
additionalSettings['supportFixedAPKURL'] = false;
|
|
||||||
}
|
|
||||||
// HTML key rename
|
// HTML key rename
|
||||||
if (originalAdditionalSettings['sortByFileNamesNotLinks'] != null) {
|
if (originalAdditionalSettings['sortByFileNamesNotLinks'] != null) {
|
||||||
additionalSettings['sortByLastLinkSegment'] =
|
additionalSettings['sortByLastLinkSegment'] =
|
||||||
|
@@ -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: 1.1.34+2291
|
version: 1.1.35+2292
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=3.0.0 <4.0.0'
|
sdk: '>=3.0.0 <4.0.0'
|
||||||
|
Reference in New Issue
Block a user