mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-08-13 10:28:10 +02:00
More changes for XAPK support (#682)
This commit is contained in:
@@ -516,11 +516,29 @@ class AppsProvider with ChangeNotifier {
|
|||||||
.listSync()
|
.listSync()
|
||||||
.where((e) => e.path.toLowerCase().endsWith('.apk'))
|
.where((e) => e.path.toLowerCase().endsWith('.apk'))
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
|
FileSystemEntity? temp;
|
||||||
|
apks.removeWhere((element) {
|
||||||
|
bool res = element.uri.pathSegments.last.startsWith(app.id);
|
||||||
|
if (res) {
|
||||||
|
temp = element;
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
});
|
||||||
|
if (temp != null) {
|
||||||
|
apks = [
|
||||||
|
temp!,
|
||||||
|
...apks,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
for (var i = 0; i < apks.length; i++) {
|
for (var i = 0; i < apks.length; i++) {
|
||||||
try {
|
try {
|
||||||
newInfo = await pm.getPackageArchiveInfo(
|
newInfo =
|
||||||
archiveFilePath: apks.first.path);
|
await pm.getPackageArchiveInfo(archiveFilePath: apks[i].path);
|
||||||
break;
|
if (newInfo != null) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (i == apks.length - 1) {
|
if (i == apks.length - 1) {
|
||||||
rethrow;
|
rethrow;
|
||||||
@@ -654,13 +672,22 @@ class AppsProvider with ChangeNotifier {
|
|||||||
await moveObbFile(file, dir.appId);
|
await moveObbFile(file, dir.appId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
APKFiles.sort((a, b) {
|
|
||||||
if (a.uri.pathSegments.last.startsWith(dir.appId)) {
|
File? temp;
|
||||||
return -1;
|
APKFiles.removeWhere((element) {
|
||||||
} else {
|
bool res = element.uri.pathSegments.last.startsWith(dir.appId);
|
||||||
return 0;
|
if (res) {
|
||||||
|
temp = element;
|
||||||
}
|
}
|
||||||
|
return res;
|
||||||
});
|
});
|
||||||
|
if (temp != null) {
|
||||||
|
APKFiles = [
|
||||||
|
temp!,
|
||||||
|
...APKFiles,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await installApk(
|
await installApk(
|
||||||
DownloadedApk(dir.appId, APKFiles[0]), firstTimeWithContext,
|
DownloadedApk(dir.appId, APKFiles[0]), firstTimeWithContext,
|
||||||
|
Reference in New Issue
Block a user