mirror of
https://github.com/ReVanced/revanced-manager.git
synced 2026-01-10 21:26:18 +00:00
fix: "Save patched app" attempts to copy APK when patching fails (#2565)
This commit is contained in:
@@ -125,7 +125,7 @@ class InstallerViewModel extends BaseViewModel {
|
|||||||
});
|
});
|
||||||
await WakelockPlus.enable();
|
await WakelockPlus.enable();
|
||||||
await handlePlatformChannelMethods();
|
await handlePlatformChannelMethods();
|
||||||
await runPatcher(context);
|
await runPatcher();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<dynamic> handlePlatformChannelMethods() async {
|
Future<dynamic> handlePlatformChannelMethods() async {
|
||||||
@@ -164,6 +164,16 @@ class InstallerViewModel extends BaseViewModel {
|
|||||||
_managerAPI.setLastUsedPatchesVersion(
|
_managerAPI.setLastUsedPatchesVersion(
|
||||||
version: _managerAPI.patchesVersion,
|
version: _managerAPI.patchesVersion,
|
||||||
);
|
);
|
||||||
|
_app.appliedPatches = _patches.map((p) => p.name).toList();
|
||||||
|
if (_managerAPI.isLastPatchedAppEnabled()) {
|
||||||
|
await _managerAPI.setLastPatchedApp(_app, _patcherAPI.outFile!);
|
||||||
|
} else {
|
||||||
|
_app.patchedFilePath = _patcherAPI.outFile!.path;
|
||||||
|
}
|
||||||
|
final homeViewModel = locator<HomeViewModel>();
|
||||||
|
_managerAPI
|
||||||
|
.reAssessPatchedApps()
|
||||||
|
.then((_) => homeViewModel.getPatchedApps());
|
||||||
} else if (value == -100.0) {
|
} else if (value == -100.0) {
|
||||||
isPatching = false;
|
isPatching = false;
|
||||||
hasErrors = true;
|
hasErrors = true;
|
||||||
@@ -187,7 +197,7 @@ class InstallerViewModel extends BaseViewModel {
|
|||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> runPatcher(BuildContext context) async {
|
Future<void> runPatcher() async {
|
||||||
try {
|
try {
|
||||||
await _patcherAPI.runPatcher(
|
await _patcherAPI.runPatcher(
|
||||||
_app.packageName,
|
_app.packageName,
|
||||||
@@ -195,16 +205,6 @@ class InstallerViewModel extends BaseViewModel {
|
|||||||
_patches,
|
_patches,
|
||||||
_app.isFromStorage,
|
_app.isFromStorage,
|
||||||
);
|
);
|
||||||
_app.appliedPatches = _patches.map((p) => p.name).toList();
|
|
||||||
if (_managerAPI.isLastPatchedAppEnabled()) {
|
|
||||||
await _managerAPI.setLastPatchedApp(_app, _patcherAPI.outFile!);
|
|
||||||
} else {
|
|
||||||
_app.patchedFilePath = _patcherAPI.outFile!.path;
|
|
||||||
}
|
|
||||||
final homeViewModel = locator<HomeViewModel>();
|
|
||||||
_managerAPI
|
|
||||||
.reAssessPatchedApps()
|
|
||||||
.then((_) => homeViewModel.getPatchedApps());
|
|
||||||
} on Exception catch (e) {
|
} on Exception catch (e) {
|
||||||
update(
|
update(
|
||||||
-100.0,
|
-100.0,
|
||||||
@@ -506,7 +506,7 @@ class InstallerViewModel extends BaseViewModel {
|
|||||||
_app.isRooted = installAsRoot;
|
_app.isRooted = installAsRoot;
|
||||||
if (headerLogs != 'Installing...') {
|
if (headerLogs != 'Installing...') {
|
||||||
update(
|
update(
|
||||||
.85,
|
-1.0,
|
||||||
'Installing...',
|
'Installing...',
|
||||||
_app.isRooted ? 'Mounting patched app' : 'Installing patched app',
|
_app.isRooted ? 'Mounting patched app' : 'Installing patched app',
|
||||||
);
|
);
|
||||||
@@ -534,7 +534,7 @@ class InstallerViewModel extends BaseViewModel {
|
|||||||
update(1.0, 'Installed', 'Installed');
|
update(1.0, 'Installed', 'Installed');
|
||||||
} else if (response == 3) {
|
} else if (response == 3) {
|
||||||
update(
|
update(
|
||||||
.85,
|
-1.0,
|
||||||
'Installation canceled',
|
'Installation canceled',
|
||||||
'Installation canceled',
|
'Installation canceled',
|
||||||
);
|
);
|
||||||
@@ -542,7 +542,7 @@ class InstallerViewModel extends BaseViewModel {
|
|||||||
installResult(context, installAsRoot);
|
installResult(context, installAsRoot);
|
||||||
} else {
|
} else {
|
||||||
update(
|
update(
|
||||||
.85,
|
-1.0,
|
||||||
'Installation failed',
|
'Installation failed',
|
||||||
'Installation failed',
|
'Installation failed',
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user