mirror of
https://github.com/revanced/revanced-manager.git
synced 2025-06-12 04:37:37 +02:00
fix: Prevent Manager from crashing when a patcher exception occurs and print its stack trace on installer's log
This commit is contained in:
@ -78,14 +78,20 @@ class InstallerViewModel extends BaseViewModel {
|
||||
}
|
||||
|
||||
void update(double value, String header, String log) {
|
||||
if (value > 0) {
|
||||
if (value >= 0.0) {
|
||||
progress = value;
|
||||
}
|
||||
isPatching = progress == 1.0 ? false : true;
|
||||
if (progress == 0.0) {
|
||||
if (value == 0.0) {
|
||||
logs = '';
|
||||
isPatching = true;
|
||||
isInstalled = false;
|
||||
hasErrors = false;
|
||||
} else if (value == 1.0) {
|
||||
isPatching = false;
|
||||
hasErrors = false;
|
||||
} else if (value == -100.0) {
|
||||
isPatching = false;
|
||||
hasErrors = true;
|
||||
}
|
||||
if (header.isNotEmpty) {
|
||||
headerLogs = header;
|
||||
@ -95,6 +101,9 @@ class InstallerViewModel extends BaseViewModel {
|
||||
logs += '\n';
|
||||
}
|
||||
logs += log;
|
||||
if (logs[logs.length - 1] == '\n') {
|
||||
logs = logs.substring(0, logs.length - 1);
|
||||
}
|
||||
Future.delayed(const Duration(milliseconds: 500)).then((value) {
|
||||
scrollController.animateTo(
|
||||
scrollController.position.maxScrollExtent,
|
||||
@ -117,12 +126,14 @@ class InstallerViewModel extends BaseViewModel {
|
||||
_patches,
|
||||
);
|
||||
} catch (e) {
|
||||
hasErrors = true;
|
||||
update(-1.0, 'Aborting...', 'An error occurred! Aborting\nError: $e');
|
||||
update(
|
||||
-100.0,
|
||||
'Aborting...',
|
||||
'An error occurred! Aborting\nError:\n$e',
|
||||
);
|
||||
}
|
||||
} else {
|
||||
hasErrors = true;
|
||||
update(-1.0, 'Aborting...', 'No app or patches selected! Aborting');
|
||||
update(-100.0, 'Aborting...', 'No app or patches selected! Aborting');
|
||||
}
|
||||
if (FlutterBackground.isBackgroundExecutionEnabled) {
|
||||
try {
|
||||
@ -132,7 +143,6 @@ class InstallerViewModel extends BaseViewModel {
|
||||
}
|
||||
}
|
||||
await Wakelock.disable();
|
||||
isPatching = false;
|
||||
}
|
||||
|
||||
void installResult(BuildContext context, bool installAsRoot) async {
|
||||
|
Reference in New Issue
Block a user