Skip to content

Commit

Permalink
fix: original.apk not found despite existing (#1052)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAabedKhan authored Jul 30, 2023
1 parent 096b315 commit 64744b2
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 32 deletions.
19 changes: 1 addition & 18 deletions lib/services/patcher_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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',
Expand Down
14 changes: 0 additions & 14 deletions lib/services/root_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 64744b2

Please sign in to comment.