mirror of
https://github.com/revanced/revanced-manager.git
synced 2025-06-12 12:47:37 +02:00
fix: use a try-finally while handling background task creation, prevent opening patches while disabled and fix loading label
This commit is contained in:
@ -17,20 +17,23 @@ class InstallerViewModel extends BaseViewModel {
|
||||
bool isInstalled = false;
|
||||
|
||||
Future<void> initialize() async {
|
||||
await FlutterBackground.initialize(
|
||||
androidConfig: const FlutterBackgroundAndroidConfig(
|
||||
notificationTitle: 'Patching',
|
||||
notificationText: 'ReVanced Manager is patching',
|
||||
notificationImportance: AndroidNotificationImportance.Default,
|
||||
notificationIcon: AndroidResource(
|
||||
name: 'ic_notification',
|
||||
defType: 'drawable',
|
||||
try {
|
||||
await FlutterBackground.initialize(
|
||||
androidConfig: const FlutterBackgroundAndroidConfig(
|
||||
notificationTitle: 'Patching',
|
||||
notificationText: 'ReVanced Manager is patching',
|
||||
notificationImportance: AndroidNotificationImportance.Default,
|
||||
notificationIcon: AndroidResource(
|
||||
name: 'ic_notification',
|
||||
defType: 'drawable',
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
await FlutterBackground.enableBackgroundExecution();
|
||||
await locator<PatcherAPI>().handlePlatformChannelMethods();
|
||||
await runPatcher();
|
||||
);
|
||||
await FlutterBackground.enableBackgroundExecution();
|
||||
} finally {
|
||||
await locator<PatcherAPI>().handlePlatformChannelMethods();
|
||||
await runPatcher();
|
||||
}
|
||||
}
|
||||
|
||||
void updateProgress(double value) {
|
||||
@ -95,8 +98,11 @@ class InstallerViewModel extends BaseViewModel {
|
||||
} else {
|
||||
updateLog('No app or patches selected! Aborting');
|
||||
}
|
||||
await FlutterBackground.disableBackgroundExecution();
|
||||
isPatching = false;
|
||||
try {
|
||||
await FlutterBackground.disableBackgroundExecution();
|
||||
} finally {
|
||||
isPatching = false;
|
||||
}
|
||||
}
|
||||
|
||||
void installResult() async {
|
||||
|
Reference in New Issue
Block a user