mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
feat: beta background sync (#21243)
* feat: ios background sync # Conflicts: # mobile/ios/Runner/Info.plist * feat: Android sync * add local sync worker and rename stuff * group upload notifications * uncomment onresume beta handling * rename methods --------- 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:
parent
e78144ea31
commit
0df88fc22b
28 changed files with 1933 additions and 81 deletions
48
mobile/pigeon/background_worker_api.dart
Normal file
48
mobile/pigeon/background_worker_api.dart
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
import 'package:pigeon/pigeon.dart';
|
||||
|
||||
@ConfigurePigeon(
|
||||
PigeonOptions(
|
||||
dartOut: 'lib/platform/background_worker_api.g.dart',
|
||||
swiftOut: 'ios/Runner/Background/BackgroundWorker.g.swift',
|
||||
swiftOptions: SwiftOptions(includeErrorClass: false),
|
||||
kotlinOut: 'android/app/src/main/kotlin/app/alextran/immich/background/BackgroundWorker.g.kt',
|
||||
kotlinOptions: KotlinOptions(package: 'app.alextran.immich.background'),
|
||||
dartOptions: DartOptions(),
|
||||
dartPackageName: 'immich_mobile',
|
||||
),
|
||||
)
|
||||
@HostApi()
|
||||
abstract class BackgroundWorkerFgHostApi {
|
||||
void enableSyncWorker();
|
||||
|
||||
// Enables the background upload service with the given callback handle
|
||||
void enableUploadWorker(int callbackHandle);
|
||||
|
||||
// Disables the background upload service
|
||||
void disableUploadWorker();
|
||||
}
|
||||
|
||||
@HostApi()
|
||||
abstract class BackgroundWorkerBgHostApi {
|
||||
// Called from the background flutter engine when it has bootstrapped and established the
|
||||
// required platform channels to notify the native side to start the background upload
|
||||
void onInitialized();
|
||||
}
|
||||
|
||||
@FlutterApi()
|
||||
abstract class BackgroundWorkerFlutterApi {
|
||||
// Android & iOS: Called when the local sync is triggered
|
||||
@async
|
||||
void onLocalSync(int? maxSeconds);
|
||||
|
||||
// iOS Only: Called when the iOS background upload is triggered
|
||||
@async
|
||||
void onIosUpload(bool isRefresh, int? maxSeconds);
|
||||
|
||||
// Android Only: Called when the Android background upload is triggered
|
||||
@async
|
||||
void onAndroidUpload();
|
||||
|
||||
@async
|
||||
void cancel();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue