Typo: 'Installed' not 'Updated' (#1469) + Bugfix: Don't incorrectly show message when user cancels

This commit is contained in:
Imran Remtulla
2024-03-17 04:01:09 -04:00
parent 3943caeedb
commit e95f575530
2 changed files with 13 additions and 6 deletions

View File

@@ -361,6 +361,9 @@ class _AppPageState extends State<AppPage> {
!areDownloadsRunning
? () async {
try {
var successMessage = app?.app.installedVersion == null
? tr('installed')
: tr('appsUpdated');
HapticFeedback.heavyImpact();
var res = await appsProvider.downloadAndInstallLatestApps(
app?.app.id != null ? [app!.app.id] : [],
@@ -368,7 +371,7 @@ class _AppPageState extends State<AppPage> {
);
if (res.isNotEmpty && !trackOnly) {
// ignore: use_build_context_synchronously
showMessage(tr('appsUpdated'), context);
showMessage(successMessage, context);
}
if (res.isNotEmpty && mounted) {
Navigator.of(context).pop();

View File

@@ -563,13 +563,13 @@ class AppsProvider with ChangeNotifier {
zipFile: File(filePath), destinationDir: Directory(destinationPath));
}
Future<void> installXApkDir(DownloadedXApkDir dir,
Future<bool> installXApkDir(DownloadedXApkDir dir,
{bool needsBGWorkaround = false}) async {
// We don't know which APKs in an XAPK are supported by the user's device
// So we try installing all of them and assume success if at least one installed
// If 0 APKs installed, throw the first install error encountered
var somethingInstalled = false;
try {
var somethingInstalled = false;
MultiAppMultiError errors = MultiAppMultiError();
for (var file in dir.extracted
.listSync(recursive: true, followLinks: false)
@@ -596,6 +596,7 @@ class AppsProvider with ChangeNotifier {
} finally {
dir.extracted.delete(recursive: true);
}
return somethingInstalled;
}
Future<bool> installApk(DownloadedApk file,
@@ -828,17 +829,18 @@ class AppsProvider with ChangeNotifier {
notifyListeners();
try {
if (!skipInstalls) {
bool sayInstalled = true;
if (downloadedFile != null) {
if (willBeSilent && context == null) {
installApk(downloadedFile, needsBGWorkaround: true);
} else {
await installApk(downloadedFile);
sayInstalled = await installApk(downloadedFile);
}
} else {
if (willBeSilent && context == null) {
installXApkDir(downloadedDir!, needsBGWorkaround: true);
} else {
await installXApkDir(downloadedDir!);
sayInstalled = await installXApkDir(downloadedDir!);
}
}
if (willBeSilent && context == null) {
@@ -846,7 +848,9 @@ class AppsProvider with ChangeNotifier {
[apps[id]!.app],
id: id.hashCode));
}
installedIds.add(id);
if (sayInstalled) {
installedIds.add(id);
}
}
} finally {
apps[id]?.downloadProgress = null;