Shizuku logic 2: Determination of installation

This commit is contained in:
Gregory Velichko
2024-04-18 20:01:40 +03:00
parent 29e13efd66
commit a311894b9f
4 changed files with 32 additions and 9 deletions

View File

@@ -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));

View File

@@ -41,20 +41,26 @@ class UpdateNotification extends ObtainiumNotification {
}
class SilentUpdateNotification extends ObtainiumNotification {
SilentUpdateNotification(List<App> updates, {int? id})
SilentUpdateNotification(List<App> 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()]);
}
}