mirror of
https://github.com/revanced/revanced-manager
synced 2024-05-14 13:56:57 +02:00
fix: Improve foreground service init and disable
This commit is contained in:
parent
9405334a7d
commit
269a71d336
@ -33,7 +33,7 @@ class InstallerViewModel extends BaseViewModel {
|
|||||||
Future<void> initialize(BuildContext context) async {
|
Future<void> initialize(BuildContext context) async {
|
||||||
if (await Permission.ignoreBatteryOptimizations.isGranted) {
|
if (await Permission.ignoreBatteryOptimizations.isGranted) {
|
||||||
try {
|
try {
|
||||||
await FlutterBackground.initialize(
|
FlutterBackground.initialize(
|
||||||
androidConfig: FlutterBackgroundAndroidConfig(
|
androidConfig: FlutterBackgroundAndroidConfig(
|
||||||
notificationTitle: FlutterI18n.translate(
|
notificationTitle: FlutterI18n.translate(
|
||||||
context,
|
context,
|
||||||
@ -49,8 +49,7 @@ class InstallerViewModel extends BaseViewModel {
|
|||||||
defType: 'drawable',
|
defType: 'drawable',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
).then((value) => FlutterBackground.enableBackgroundExecution());
|
||||||
await FlutterBackground.enableBackgroundExecution();
|
|
||||||
} on Exception {
|
} on Exception {
|
||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
@ -123,9 +122,9 @@ class InstallerViewModel extends BaseViewModel {
|
|||||||
hasErrors = true;
|
hasErrors = true;
|
||||||
update(-1.0, 'Aborting...', 'No app or patches selected! Aborting');
|
update(-1.0, 'Aborting...', 'No app or patches selected! Aborting');
|
||||||
}
|
}
|
||||||
if (await Permission.ignoreBatteryOptimizations.isGranted) {
|
if (FlutterBackground.isBackgroundExecutionEnabled) {
|
||||||
try {
|
try {
|
||||||
await FlutterBackground.disableBackgroundExecution();
|
FlutterBackground.disableBackgroundExecution();
|
||||||
} on Exception {
|
} on Exception {
|
||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user