App edit bugfixes

This commit is contained in:
Imran Remtulla
2023-02-18 21:39:26 -05:00
parent 435116e10b
commit 859158e84a

View File

@@ -283,50 +283,53 @@ class _AppPageState extends State<AppPage> {
); );
}).then((values) { }).then((values) {
if (app != null && values != null) { if (app != null && values != null) {
var changedApp = app.app; Map<String, dynamic>
changedApp.additionalSettings = originalSettings =
values; app.app.additionalSettings;
app.app.additionalSettings = values;
if (source.enforceTrackOnly) { if (source.enforceTrackOnly) {
changedApp.additionalSettings[ app.app.additionalSettings[
'trackOnly'] = true; 'trackOnly'] = true;
showError( showError(
tr('appsFromSourceAreTrackOnly'), tr('appsFromSourceAreTrackOnly'),
context); context);
} }
if (changedApp.additionalSettings[ if (app.app.additionalSettings[
'releaseDateAsVersion'] == 'releaseDateAsVersion'] ==
true) { true) {
changedApp.additionalSettings[ app.app.additionalSettings[
'noVersionDetection'] = true; 'noVersionDetection'] = true;
if (app.app.additionalSettings[ if (originalSettings[
'releaseDateAsVersion'] != 'releaseDateAsVersion'] !=
true) { true) {
if (app.app.releaseDate != null) { if (app.app.releaseDate != null) {
changedApp.latestVersion = app bool isUpdated =
app.app.installedVersion ==
app.app.latestVersion;
app.app.latestVersion = app
.app .app
.releaseDate! .releaseDate!
.microsecondsSinceEpoch .microsecondsSinceEpoch
.toString(); .toString();
if (app.app.installedVersion == if (isUpdated) {
app.app.latestVersion) { app.app.installedVersion =
changedApp.installedVersion = app.app.latestVersion;
changedApp.latestVersion;
} }
} }
} }
} else if (app.app.additionalSettings[ } else if (originalSettings[
'releaseDateAsVersion'] == 'releaseDateAsVersion'] ==
true) { true) {
changedApp.additionalSettings[ app.app.additionalSettings[
'noVersionDetection'] = false; 'noVersionDetection'] = false;
changedApp.installedVersion = app app.app.installedVersion = app
.installedInfo .installedInfo
?.versionName ?? ?.versionName ??
changedApp.installedVersion; app.app.installedVersion;
} }
appsProvider.saveApps( appsProvider.saveApps([app.app]).then(
[changedApp]).then((value) { (value) {
getUpdate(changedApp.id); getUpdate(app.app.id);
}); });
} }
}); });