mirror of
https://github.com/immich-app/immich.git
synced 2025-09-29 15:31:13 -04:00
* feat: add configurable on charging only and delay * Segmented and style the settings --------- Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com> Co-authored-by: Alex <alex.tran1502@gmail.com>
55 lines
1.6 KiB
Dart
55 lines
1.6 KiB
Dart
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',
|
|
),
|
|
)
|
|
class BackgroundWorkerSettings {
|
|
final bool requiresCharging;
|
|
final int minimumDelaySeconds;
|
|
|
|
const BackgroundWorkerSettings({required this.requiresCharging, required this.minimumDelaySeconds});
|
|
}
|
|
|
|
@HostApi()
|
|
abstract class BackgroundWorkerFgHostApi {
|
|
void enable();
|
|
|
|
void configure(BackgroundWorkerSettings settings);
|
|
|
|
void disable();
|
|
}
|
|
|
|
@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();
|
|
|
|
void showNotification(String title, String content);
|
|
|
|
// Called from the background flutter engine to request the native side to cleanup
|
|
void close();
|
|
}
|
|
|
|
@FlutterApi()
|
|
abstract class BackgroundWorkerFlutterApi {
|
|
// 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();
|
|
}
|