feat: Keep screen awake during patching

This commit is contained in:
Alberto Ponces 2022-09-12 00:34:36 +01:00
parent 04bcb1ec24
commit 92a84c3bfb
2 changed files with 5 additions and 3 deletions

View File

@ -10,6 +10,7 @@ import 'package:revanced_manager/services/manager_api.dart';
import 'package:revanced_manager/services/patcher_api.dart';
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
import 'package:stacked/stacked.dart';
import 'package:wakelock/wakelock.dart';
class InstallerViewModel extends BaseViewModel {
final ManagerAPI _managerAPI = locator<ManagerAPI>();
@ -46,6 +47,7 @@ class InstallerViewModel extends BaseViewModel {
),
);
await FlutterBackground.enableBackgroundExecution();
await Wakelock.enable();
} on Exception {
// ignore
}
@ -119,9 +121,8 @@ class InstallerViewModel extends BaseViewModel {
update(1.0, 'Aborting...', 'No app or patches selected! Aborting');
}
try {
if (FlutterBackground.isBackgroundExecutionEnabled) {
await FlutterBackground.disableBackgroundExecution();
}
await FlutterBackground.disableBackgroundExecution();
await Wakelock.disable();
} on Exception {
// ignore
}

View File

@ -52,6 +52,7 @@ dependencies:
stacked_themes: ^0.3.9
timeago: ^3.2.2
url_launcher: ^6.1.5
wakelock: ^0.6.2
dev_dependencies:
build_runner: any