fix: original.apk not found despite existing (#1052)

This commit is contained in:
aAbed 2023-07-30 09:20:34 +05:45 committed by GitHub
parent 096b315701
commit 64744b2abf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 32 deletions

View File

@ -144,20 +144,6 @@ class PatcherAPI {
);
}
Future<String> getOriginalFilePath(String packageName) async {
try {
final bool hasRootPermissions = await _rootAPI.hasRootPermissions();
if (hasRootPermissions) {
return await _rootAPI.getOriginalFilePath(packageName);
}
} on Exception catch (e) {
if (kDebugMode) {
print(e);
}
}
return '';
}
Future<void> runPatcher(
String packageName,
String apkFilePath,
@ -191,10 +177,7 @@ class PatcherAPI {
_outFile = File('${workDir.path}/out.apk');
final Directory cacheDir = Directory('${workDir.path}/cache');
cacheDir.createSync();
String originalFilePath = await getOriginalFilePath(packageName);
if (originalFilePath.isEmpty) {
originalFilePath = apkFilePath;
}
final String originalFilePath = apkFilePath;
try {
await patcherChannel.invokeMethod(
'runPatcher',

View File

@ -209,20 +209,6 @@ class RootAPI {
return res != null && res.isNotEmpty;
}
Future<String> getOriginalFilePath(String packageName) async {
final String originalPath = '$_revancedDirPath/$packageName/original.apk';
final String oldOrigPath = '$_revancedOldDirPath/$packageName/original.apk';
final bool isInstalled = await isAppInstalled(packageName);
if (isInstalled && await isMounted(packageName)) {
if (await fileExists(originalPath)) {
return originalPath;
} else if (await fileExists(oldOrigPath)) {
return oldOrigPath;
}
}
return '';
}
Future<void> saveOriginalFilePath(
String packageName,
String originalFilePath,