mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-11-01 13:53:28 +01:00
Unified version detection setting
This commit is contained in:
@@ -71,10 +71,6 @@ class _AddAppPageState extends State<AddAppPage> {
|
||||
var settingsProvider = context.read<SettingsProvider>();
|
||||
() async {
|
||||
var userPickedTrackOnly = additionalSettings['trackOnly'] == true;
|
||||
var userPickedNoVersionDetection =
|
||||
additionalSettings['noVersionDetection'] == true;
|
||||
var userPickedReleaseDateAsVersion =
|
||||
additionalSettings['releaseDateAsVersion'] == true;
|
||||
var cont = true;
|
||||
if ((userPickedTrackOnly || pickedSource!.enforceTrackOnly) &&
|
||||
// ignore: use_build_context_synchronously
|
||||
@@ -95,13 +91,13 @@ class _AddAppPageState extends State<AddAppPage> {
|
||||
null) {
|
||||
cont = false;
|
||||
}
|
||||
if (userPickedReleaseDateAsVersion && // ignore: use_build_context_synchronously
|
||||
if (additionalSettings['versionDetection'] == 'releaseDateAsVersion' &&
|
||||
// ignore: use_build_context_synchronously
|
||||
await showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext ctx) {
|
||||
return GeneratedFormModal(
|
||||
title: tr('useReleaseDateAsVersion'),
|
||||
title: tr('releaseDateAsVersion'),
|
||||
items: const [],
|
||||
message: tr('releaseDateAsVersionExplanation'),
|
||||
);
|
||||
@@ -109,8 +105,7 @@ class _AddAppPageState extends State<AddAppPage> {
|
||||
null) {
|
||||
cont = false;
|
||||
}
|
||||
if (!userPickedReleaseDateAsVersion &&
|
||||
userPickedNoVersionDetection &&
|
||||
if (additionalSettings['versionDetection'] == 'noVersionDetection' &&
|
||||
// ignore: use_build_context_synchronously
|
||||
await showDialog(
|
||||
context: context,
|
||||
@@ -129,9 +124,7 @@ class _AddAppPageState extends State<AddAppPage> {
|
||||
var trackOnly = pickedSource!.enforceTrackOnly || userPickedTrackOnly;
|
||||
App app = await sourceProvider.getApp(
|
||||
pickedSource!, userInput, additionalSettings,
|
||||
trackOnlyOverride: trackOnly,
|
||||
noVersionDetectionOverride: userPickedNoVersionDetection,
|
||||
releaseDateAsVersionOverride: userPickedReleaseDateAsVersion);
|
||||
trackOnlyOverride: trackOnly);
|
||||
if (!trackOnly) {
|
||||
await settingsProvider.getInstallPermission();
|
||||
}
|
||||
|
||||
@@ -42,8 +42,6 @@ class _AppPageState extends State<AppPage> {
|
||||
getUpdate(app.app.id);
|
||||
}
|
||||
var trackOnly = app?.app.additionalSettings['trackOnly'] == true;
|
||||
var noVersionDetection =
|
||||
app?.app.additionalSettings['noVersionDetection'] == true;
|
||||
|
||||
var infoColumn = Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
@@ -207,7 +205,8 @@ class _AppPageState extends State<AppPage> {
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
if (noVersionDetection &&
|
||||
if (app?.app.additionalSettings['versionDetection'] !=
|
||||
'standardVersionDetection' &&
|
||||
!trackOnly &&
|
||||
app?.app.installedVersion != null &&
|
||||
app?.app.installedVersion != app?.app.latestVersion)
|
||||
@@ -295,13 +294,11 @@ class _AppPageState extends State<AppPage> {
|
||||
context);
|
||||
}
|
||||
if (app.app.additionalSettings[
|
||||
'releaseDateAsVersion'] ==
|
||||
true) {
|
||||
app.app.additionalSettings[
|
||||
'noVersionDetection'] = true;
|
||||
'versionDetection'] ==
|
||||
'releaseDateAsVersion') {
|
||||
if (originalSettings[
|
||||
'releaseDateAsVersion'] !=
|
||||
true) {
|
||||
'versionDetection'] !=
|
||||
'releaseDateAsVersion') {
|
||||
if (app.app.releaseDate != null) {
|
||||
bool isUpdated =
|
||||
app.app.installedVersion ==
|
||||
@@ -318,10 +315,8 @@ class _AppPageState extends State<AppPage> {
|
||||
}
|
||||
}
|
||||
} else if (originalSettings[
|
||||
'releaseDateAsVersion'] ==
|
||||
true) {
|
||||
app.app.additionalSettings[
|
||||
'noVersionDetection'] = false;
|
||||
'versionDetection'] ==
|
||||
'releaseDateAsVersion') {
|
||||
app.app.installedVersion = app
|
||||
.installedInfo
|
||||
?.versionName ??
|
||||
|
||||
@@ -704,7 +704,7 @@ class AppsPageState extends State<AppsPage> {
|
||||
onPressed: () {
|
||||
HapticFeedback.selectionClick();
|
||||
appsProvider.saveApps(selectedApps.map((a) {
|
||||
if (a.installedVersion != null && a.additionalSettings['noVersionDetection'] == true) {
|
||||
if (a.installedVersion != null && a.additionalSettings['versionDetection'] != 'standardVersionDetection') {
|
||||
a.installedVersion = a.latestVersion;
|
||||
}
|
||||
return a;
|
||||
|
||||
Reference in New Issue
Block a user