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( Future<void> runPatcher(
String packageName, String packageName,
String apkFilePath, String apkFilePath,
@ -191,10 +177,7 @@ class PatcherAPI {
_outFile = File('${workDir.path}/out.apk'); _outFile = File('${workDir.path}/out.apk');
final Directory cacheDir = Directory('${workDir.path}/cache'); final Directory cacheDir = Directory('${workDir.path}/cache');
cacheDir.createSync(); cacheDir.createSync();
String originalFilePath = await getOriginalFilePath(packageName); final String originalFilePath = apkFilePath;
if (originalFilePath.isEmpty) {
originalFilePath = apkFilePath;
}
try { try {
await patcherChannel.invokeMethod( await patcherChannel.invokeMethod(
'runPatcher', 'runPatcher',

View file

@ -209,20 +209,6 @@ class RootAPI {
return res != null && res.isNotEmpty; 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( Future<void> saveOriginalFilePath(
String packageName, String packageName,
String originalFilePath, String originalFilePath,