fix: prevent background worker when main app is running (#22252)

* fix: prevent background worker only when the main app is actively running

* handle ref disposals better

---------

Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
Co-authored-by: Alex <alex.tran1502@gmail.com>
This commit is contained in:
shenlong 2025-09-22 07:15:47 +05:30 committed by GitHub
parent b33e8abcdd
commit 35b62cd016
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 418 additions and 95 deletions

View file

@ -0,0 +1,17 @@
import 'package:pigeon/pigeon.dart';
@ConfigurePigeon(
PigeonOptions(
dartOut: 'lib/platform/background_worker_lock_api.g.dart',
kotlinOut: 'android/app/src/main/kotlin/app/alextran/immich/background/BackgroundWorkerLock.g.kt',
kotlinOptions: KotlinOptions(package: 'app.alextran.immich.background', includeErrorClass: false),
dartOptions: DartOptions(),
dartPackageName: 'immich_mobile',
),
)
@HostApi()
abstract class BackgroundWorkerLockApi {
void lock();
void unlock();
}