mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-08-13 10:28:10 +02:00
Shizuku logic 3: Prettify
This commit is contained in:
@@ -713,8 +713,8 @@ class AppsProvider with ChangeNotifier {
|
|||||||
List<String> archs = (await DeviceInfoPlugin().androidInfo).supportedAbis;
|
List<String> archs = (await DeviceInfoPlugin().androidInfo).supportedAbis;
|
||||||
|
|
||||||
if (urlsToSelectFrom.length > 1 && context != null) {
|
if (urlsToSelectFrom.length > 1 && context != null) {
|
||||||
// ignore: use_build_context_synchronously
|
|
||||||
appFileUrl = await showDialog(
|
appFileUrl = await showDialog(
|
||||||
|
// ignore: use_build_context_synchronously
|
||||||
context: context,
|
context: context,
|
||||||
builder: (BuildContext ctx) {
|
builder: (BuildContext ctx) {
|
||||||
return AppFilePicker(
|
return AppFilePicker(
|
||||||
@@ -734,10 +734,9 @@ class AppsProvider with ChangeNotifier {
|
|||||||
if (appFileUrl != null &&
|
if (appFileUrl != null &&
|
||||||
getHost(appFileUrl.value) != getHost(app.url) &&
|
getHost(appFileUrl.value) != getHost(app.url) &&
|
||||||
context != null) {
|
context != null) {
|
||||||
// ignore: use_build_context_synchronously
|
|
||||||
if (!(settingsProvider.hideAPKOriginWarning) &&
|
if (!(settingsProvider.hideAPKOriginWarning) &&
|
||||||
// ignore: use_build_context_synchronously
|
|
||||||
await showDialog(
|
await showDialog(
|
||||||
|
// ignore: use_build_context_synchronously
|
||||||
context: context,
|
context: context,
|
||||||
builder: (BuildContext ctx) {
|
builder: (BuildContext ctx) {
|
||||||
return APKOriginWarningDialog(
|
return APKOriginWarningDialog(
|
||||||
@@ -830,8 +829,7 @@ class AppsProvider with ChangeNotifier {
|
|||||||
throw ObtainiumError(tr('cancelled'));
|
throw ObtainiumError(tr('cancelled'));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
String? code = await ShizukuApkInstaller.checkPermission();
|
switch((await ShizukuApkInstaller.checkPermission())!){
|
||||||
switch(code!){
|
|
||||||
case 'binder_not_found':
|
case 'binder_not_found':
|
||||||
throw ObtainiumError(tr('shizukuBinderNotFound'));
|
throw ObtainiumError(tr('shizukuBinderNotFound'));
|
||||||
case 'old_shizuku':
|
case 'old_shizuku':
|
||||||
@@ -853,32 +851,32 @@ class AppsProvider with ChangeNotifier {
|
|||||||
bool sayInstalled = true;
|
bool sayInstalled = true;
|
||||||
var contextIfNewInstall =
|
var contextIfNewInstall =
|
||||||
apps[id]?.installedInfo == null ? context : null;
|
apps[id]?.installedInfo == null ? context : null;
|
||||||
|
bool needBGWorkaround = willBeSilent && context == null && !settingsProvider.useShizuku;
|
||||||
if (downloadedFile != null) {
|
if (downloadedFile != null) {
|
||||||
if (willBeSilent && context == null && !settingsProvider.useShizuku) {
|
if (needBGWorkaround) {
|
||||||
installApk(downloadedFile, contextIfNewInstall,
|
// ignore: use_build_context_synchronously
|
||||||
needsBGWorkaround: true);
|
installApk(downloadedFile, contextIfNewInstall, needsBGWorkaround: true);
|
||||||
} else {
|
} else {
|
||||||
sayInstalled =
|
// ignore: use_build_context_synchronously
|
||||||
await installApk(downloadedFile, contextIfNewInstall);
|
sayInstalled = await installApk(downloadedFile, contextIfNewInstall);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (willBeSilent && context == null && !settingsProvider.useShizuku) {
|
if (needBGWorkaround) {
|
||||||
installXApkDir(downloadedDir!, contextIfNewInstall,
|
// ignore: use_build_context_synchronously
|
||||||
needsBGWorkaround: true);
|
installXApkDir(downloadedDir!, contextIfNewInstall, needsBGWorkaround: true);
|
||||||
} else {
|
} else {
|
||||||
sayInstalled =
|
// ignore: use_build_context_synchronously
|
||||||
await installXApkDir(downloadedDir!, contextIfNewInstall);
|
sayInstalled = await installXApkDir(downloadedDir!, contextIfNewInstall);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (willBeSilent && settingsProvider.useShizuku) {
|
if (willBeSilent && context == null) {
|
||||||
notificationsProvider?.notify(SilentUpdateNotification(
|
if (!settingsProvider.useShizuku) {
|
||||||
[apps[id]!.app],
|
notificationsProvider?.notify(SilentUpdateAttemptNotification(
|
||||||
sayInstalled,
|
[apps[id]!.app], id: id.hashCode));
|
||||||
id: id.hashCode));
|
} else {
|
||||||
} else if (willBeSilent && context == null) {
|
notificationsProvider?.notify(SilentUpdateNotification(
|
||||||
notificationsProvider?.notify(SilentUpdateAttemptNotification(
|
[apps[id]!.app], sayInstalled, id: id.hashCode));
|
||||||
[apps[id]!.app],
|
}
|
||||||
id: id.hashCode));
|
|
||||||
}
|
}
|
||||||
if (sayInstalled) {
|
if (sayInstalled) {
|
||||||
installedIds.add(id);
|
installedIds.add(id);
|
||||||
|
Reference in New Issue
Block a user