fix: limit android background worker duration (#23566)

* fix: limit each android background run to 20 mins

# Conflicts:
#	mobile/lib/domain/services/background_worker.service.dart

* review chages

---------

Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
This commit is contained in:
shenlong
2026-05-12 11:08:17 +07:00
committed by GitHub
parent c6b3127b35
commit 8f4b0fce49
6 changed files with 50 additions and 34 deletions
+4 -2
View File
@@ -277,7 +277,7 @@ abstract class BackgroundWorkerFlutterApi {
Future<void> onIosUpload(bool isRefresh, int? maxSeconds);
Future<void> onAndroidUpload();
Future<void> onAndroidUpload(int? maxMinutes);
Future<void> cancel();
@@ -323,8 +323,10 @@ abstract class BackgroundWorkerFlutterApi {
pigeonVar_channel.setMessageHandler(null);
} else {
pigeonVar_channel.setMessageHandler((Object? message) async {
final List<Object?> args = message! as List<Object?>;
final int? arg_maxMinutes = args[0] as int?;
try {
await api.onAndroidUpload();
await api.onAndroidUpload(arg_maxMinutes);
return wrapResponse(empty: true);
} on PlatformException catch (e) {
return wrapResponse(error: e);