mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-15 21:03:41 +00:00
Merge branch 'main' into main
This commit is contained in:
18 files changed
+2983
-3
No files matched your search
@@ -13,6 +13,7 @@ import '../../../../app/application/app_appearance_controller.dart';
|
||||
import '../../../../app/application/app_platform_controller.dart';
|
||||
import '../../../../app/application/app_runtime_controller.dart';
|
||||
import '../../../../app/application/location_keep_alive.dart';
|
||||
import '../../../../app/application/continued_processing.dart';
|
||||
import '../../../../core/common/start_config.dart';
|
||||
import '../../../../core/network/gopeed/gopeed_transport.dart';
|
||||
import '../../../../core/utils/breakpoints.dart';
|
||||
@@ -381,6 +382,19 @@ class _SettingsPageState extends ConsumerState<SettingsPage> {
|
||||
onChanged: (value) => unawaited(_setBackgroundLocationKeepAlive(value)),
|
||||
),
|
||||
),
|
||||
if (Util.isIOS())
|
||||
SettingsItem(
|
||||
title: context.l10n.backgroundContinuedProcessing,
|
||||
subtitle:
|
||||
context.l10n.backgroundContinuedProcessingDescription,
|
||||
child: shad.Switch(
|
||||
value:
|
||||
config.extra.backgroundContinuedProcessing,
|
||||
onChanged: (value) => unawaited(
|
||||
_setBackgroundContinuedProcessing(value),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -1281,6 +1295,43 @@ class _SettingsPageState extends ConsumerState<SettingsPage> {
|
||||
_mutateConfig((config) => config.extra.backgroundLocationKeepAlive = enabled);
|
||||
await LocationKeepAliveCoordinator.instance.reconcile(enabled: enabled);
|
||||
}
|
||||
Future<void>
|
||||
_setBackgroundContinuedProcessing(
|
||||
bool enabled,
|
||||
) async {
|
||||
if (enabled &&
|
||||
!await ContinuedProcessing.isSupported()) {
|
||||
if (mounted) {
|
||||
_toast(
|
||||
context.l10n
|
||||
.backgroundContinuedProcessingUnsupported,
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
final applied =
|
||||
await ContinuedProcessing.setEnabled(
|
||||
enabled,
|
||||
);
|
||||
|
||||
if (enabled && !applied) {
|
||||
if (mounted) {
|
||||
_toast(
|
||||
context.l10n
|
||||
.backgroundContinuedProcessingUnsupported,
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
_mutateConfig(
|
||||
(config) =>
|
||||
config.extra
|
||||
.backgroundContinuedProcessing =
|
||||
enabled,
|
||||
);
|
||||
}
|
||||
|
||||
List<String> _lines(String text) {
|
||||
return text.split('\n').map((line) => line.trim()).where((line) => line.isNotEmpty).toList();
|
||||
|
||||
Reference in new issue
Block a user