diff --git a/assets/translations/en.json b/assets/translations/en.json index c026b2f..16e2bb9 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -143,8 +143,10 @@ "noNewUpdates": "No new updates.", "xHasAnUpdate": "{} has an update.", "appsUpdated": "Apps Updated", + "appsNotUpdated": "Failed to update applications", "appsUpdatedNotifDescription": "Notifies the user that updates to one or more Apps were applied in the background", "xWasUpdatedToY": "{} was updated to {}.", + "xWasNotUpdatedToY": "Failed to update {} to {}.", "errorCheckingUpdates": "Error Checking for Updates", "errorCheckingUpdatesNotifDescription": "A notification that shows when background update checking fails", "appsRemoved": "Apps Removed", @@ -352,6 +354,10 @@ "one": "{} and 1 more app was updated.", "other": "{} and {} more apps were updated." }, + "xAndNMoreUpdatesFailed": { + "one": "Failed to update {} and 1 more app.", + "other": "Failed to update {} and {} more apps." + }, "xAndNMoreUpdatesPossiblyInstalled": { "one": "{} and 1 more app may have been updated.", "other": "{} and {} more apps may have been updated." diff --git a/assets/translations/ru.json b/assets/translations/ru.json index 9b912b0..964eb85 100644 --- a/assets/translations/ru.json +++ b/assets/translations/ru.json @@ -143,8 +143,10 @@ "noNewUpdates": "Нет новых обновлений", "xHasAnUpdate": "{} есть обновление", "appsUpdated": "Приложения обновлены", + "appsNotUpdated": "Не удалось обновить приложения", "appsUpdatedNotifDescription": "Уведомляет об обновлении одного или нескольких приложений в фоновом режиме", "xWasUpdatedToY": "{} была обновлена до версии {}", + "xWasNotUpdatedToY": "Не удалось обновить {} до версии {}", "errorCheckingUpdates": "Ошибка при проверке обновлений", "errorCheckingUpdatesNotifDescription": "Уведомление о завершении проверки обновлений в фоновом режиме с ошибкой", "appsRemoved": "Приложение удалено", @@ -352,6 +354,10 @@ "one": "{} и ещё 1 приложение были обновлены", "other": "{} и ещё {} приложений были обновлены" }, + "xAndNMoreUpdatesFailed": { + "one": "Не удалось обновить {} и ещё 1 приложение", + "other": "Не удалось обновить {} и ещё {} приложений" + }, "xAndNMoreUpdatesPossiblyInstalled": { "one": "{} и ещё 1 приложение могли быть обновлены", "other": "{} и ещё {} приложений могли быть обновлены" diff --git a/lib/providers/apps_provider.dart b/lib/providers/apps_provider.dart index 44793a0..e90fa29 100644 --- a/lib/providers/apps_provider.dart +++ b/lib/providers/apps_provider.dart @@ -854,7 +854,7 @@ class AppsProvider with ChangeNotifier { var contextIfNewInstall = apps[id]?.installedInfo == null ? context : null; if (downloadedFile != null) { - if (willBeSilent && context == null) { + if (willBeSilent && context == null && !settingsProvider.useShizuku) { installApk(downloadedFile, contextIfNewInstall, needsBGWorkaround: true); } else { @@ -862,7 +862,7 @@ class AppsProvider with ChangeNotifier { await installApk(downloadedFile, contextIfNewInstall); } } else { - if (willBeSilent && context == null) { + if (willBeSilent && context == null && !settingsProvider.useShizuku) { installXApkDir(downloadedDir!, contextIfNewInstall, needsBGWorkaround: true); } else { @@ -870,7 +870,12 @@ class AppsProvider with ChangeNotifier { await installXApkDir(downloadedDir!, contextIfNewInstall); } } - if (willBeSilent && context == null) { + if (willBeSilent && settingsProvider.useShizuku) { + notificationsProvider?.notify(SilentUpdateNotification( + [apps[id]!.app], + sayInstalled, + id: id.hashCode)); + } else if (willBeSilent && context == null) { notificationsProvider?.notify(SilentUpdateAttemptNotification( [apps[id]!.app], id: id.hashCode)); diff --git a/lib/providers/notifications_provider.dart b/lib/providers/notifications_provider.dart index 898126b..d0c51ed 100644 --- a/lib/providers/notifications_provider.dart +++ b/lib/providers/notifications_provider.dart @@ -41,20 +41,26 @@ class UpdateNotification extends ObtainiumNotification { } class SilentUpdateNotification extends ObtainiumNotification { - SilentUpdateNotification(List updates, {int? id}) + SilentUpdateNotification(List updates, bool succeeded, {int? id}) : super( id ?? 3, - tr('appsUpdated'), + succeeded + ? tr('appsUpdated') + : tr('appsNotUpdated'), '', 'APPS_UPDATED', tr('appsUpdatedNotifChannel'), tr('appsUpdatedNotifDescription'), Importance.defaultImportance) { message = updates.length == 1 - ? tr('xWasUpdatedToY', - args: [updates[0].finalName, updates[0].latestVersion]) - : plural('xAndNMoreUpdatesInstalled', updates.length - 1, - args: [updates[0].finalName, (updates.length - 1).toString()]); + ? tr(succeeded + ? 'xWasUpdatedToY' + : 'xWasNotUpdatedToY', + args: [updates[0].finalName, updates[0].latestVersion]) + : plural(succeeded + ? 'xAndNMoreUpdatesInstalled' + : "xAndNMoreUpdatesFailed", + updates.length - 1, args: [updates[0].finalName, (updates.length - 1).toString()]); } }