Source Code added
This commit is contained in:
parent
800376eafd
commit
9efa9bc6dd
3912 changed files with 754770 additions and 2 deletions
54
mobile/pigeon/background_worker_api.dart
Normal file
54
mobile/pigeon/background_worker_api.dart
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
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 saveNotificationMessage(String title, String body);
|
||||
|
||||
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();
|
||||
|
||||
// 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();
|
||||
}
|
||||
17
mobile/pigeon/background_worker_lock_api.dart
Normal file
17
mobile/pigeon/background_worker_lock_api.dart
Normal 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();
|
||||
}
|
||||
20
mobile/pigeon/connectivity_api.dart
Normal file
20
mobile/pigeon/connectivity_api.dart
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import 'package:pigeon/pigeon.dart';
|
||||
|
||||
@ConfigurePigeon(
|
||||
PigeonOptions(
|
||||
dartOut: 'lib/platform/connectivity_api.g.dart',
|
||||
swiftOut: 'ios/Runner/Connectivity/Connectivity.g.swift',
|
||||
swiftOptions: SwiftOptions(includeErrorClass: false),
|
||||
kotlinOut: 'android/app/src/main/kotlin/app/alextran/immich/connectivity/Connectivity.g.kt',
|
||||
kotlinOptions: KotlinOptions(package: 'app.alextran.immich.connectivity'),
|
||||
dartOptions: DartOptions(),
|
||||
dartPackageName: 'immich_mobile',
|
||||
),
|
||||
)
|
||||
enum NetworkCapability { cellular, wifi, vpn, unmetered }
|
||||
|
||||
@HostApi()
|
||||
abstract class ConnectivityApi {
|
||||
@TaskQueue(type: TaskQueueType.serialBackgroundThread)
|
||||
List<NetworkCapability> getCapabilities();
|
||||
}
|
||||
30
mobile/pigeon/local_image_api.dart
Normal file
30
mobile/pigeon/local_image_api.dart
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
import 'package:pigeon/pigeon.dart';
|
||||
|
||||
@ConfigurePigeon(
|
||||
PigeonOptions(
|
||||
dartOut: 'lib/platform/local_image_api.g.dart',
|
||||
swiftOut: 'ios/Runner/Images/LocalImages.g.swift',
|
||||
swiftOptions: SwiftOptions(includeErrorClass: false),
|
||||
kotlinOut:
|
||||
'android/app/src/main/kotlin/app/alextran/immich/images/LocalImages.g.kt',
|
||||
kotlinOptions: KotlinOptions(package: 'app.alextran.immich.images'),
|
||||
dartOptions: DartOptions(),
|
||||
dartPackageName: 'immich_mobile',
|
||||
),
|
||||
)
|
||||
@HostApi()
|
||||
abstract class LocalImageApi {
|
||||
@async
|
||||
Map<String, int>? requestImage(
|
||||
String assetId, {
|
||||
required int requestId,
|
||||
required int width,
|
||||
required int height,
|
||||
required bool isVideo,
|
||||
});
|
||||
|
||||
void cancelRequest(int requestId);
|
||||
|
||||
@async
|
||||
Map<String, int> getThumbhash(String thumbhash);
|
||||
}
|
||||
135
mobile/pigeon/native_sync_api.dart
Normal file
135
mobile/pigeon/native_sync_api.dart
Normal file
|
|
@ -0,0 +1,135 @@
|
|||
import 'package:pigeon/pigeon.dart';
|
||||
|
||||
@ConfigurePigeon(
|
||||
PigeonOptions(
|
||||
dartOut: 'lib/platform/native_sync_api.g.dart',
|
||||
swiftOut: 'ios/Runner/Sync/Messages.g.swift',
|
||||
swiftOptions: SwiftOptions(),
|
||||
kotlinOut: 'android/app/src/main/kotlin/app/alextran/immich/sync/Messages.g.kt',
|
||||
kotlinOptions: KotlinOptions(package: 'app.alextran.immich.sync'),
|
||||
dartOptions: DartOptions(),
|
||||
dartPackageName: 'immich_mobile',
|
||||
),
|
||||
)
|
||||
class PlatformAsset {
|
||||
final String id;
|
||||
final String name;
|
||||
|
||||
// Follows AssetType enum from base_asset.model.dart
|
||||
final int type;
|
||||
|
||||
// Seconds since epoch
|
||||
final int? createdAt;
|
||||
final int? updatedAt;
|
||||
final int? width;
|
||||
final int? height;
|
||||
final int durationInSeconds;
|
||||
final int orientation;
|
||||
final bool isFavorite;
|
||||
|
||||
final int? adjustmentTime;
|
||||
final double? latitude;
|
||||
final double? longitude;
|
||||
|
||||
const PlatformAsset({
|
||||
required this.id,
|
||||
required this.name,
|
||||
required this.type,
|
||||
this.createdAt,
|
||||
this.updatedAt,
|
||||
this.width,
|
||||
this.height,
|
||||
this.durationInSeconds = 0,
|
||||
this.orientation = 0,
|
||||
this.isFavorite = false,
|
||||
this.adjustmentTime,
|
||||
this.latitude,
|
||||
this.longitude,
|
||||
});
|
||||
}
|
||||
|
||||
class PlatformAlbum {
|
||||
final String id;
|
||||
final String name;
|
||||
|
||||
// Seconds since epoch
|
||||
final int? updatedAt;
|
||||
final bool isCloud;
|
||||
final int assetCount;
|
||||
|
||||
const PlatformAlbum({
|
||||
required this.id,
|
||||
required this.name,
|
||||
this.updatedAt,
|
||||
this.isCloud = false,
|
||||
this.assetCount = 0,
|
||||
});
|
||||
}
|
||||
|
||||
class SyncDelta {
|
||||
final bool hasChanges;
|
||||
final List<PlatformAsset> updates;
|
||||
final List<String> deletes;
|
||||
|
||||
// Asset -> Album mapping
|
||||
final Map<String, List<String>> assetAlbums;
|
||||
|
||||
const SyncDelta({
|
||||
this.hasChanges = false,
|
||||
this.updates = const [],
|
||||
this.deletes = const [],
|
||||
this.assetAlbums = const {},
|
||||
});
|
||||
}
|
||||
|
||||
class HashResult {
|
||||
final String assetId;
|
||||
final String? error;
|
||||
final String? hash;
|
||||
|
||||
const HashResult({required this.assetId, this.error, this.hash});
|
||||
}
|
||||
|
||||
class CloudIdResult {
|
||||
final String assetId;
|
||||
final String? error;
|
||||
final String? cloudId;
|
||||
|
||||
const CloudIdResult({required this.assetId, this.error, this.cloudId});
|
||||
}
|
||||
|
||||
@HostApi()
|
||||
abstract class NativeSyncApi {
|
||||
bool shouldFullSync();
|
||||
|
||||
@TaskQueue(type: TaskQueueType.serialBackgroundThread)
|
||||
SyncDelta getMediaChanges();
|
||||
|
||||
void checkpointSync();
|
||||
|
||||
void clearSyncCheckpoint();
|
||||
|
||||
@TaskQueue(type: TaskQueueType.serialBackgroundThread)
|
||||
List<String> getAssetIdsForAlbum(String albumId);
|
||||
|
||||
@TaskQueue(type: TaskQueueType.serialBackgroundThread)
|
||||
List<PlatformAlbum> getAlbums();
|
||||
|
||||
@TaskQueue(type: TaskQueueType.serialBackgroundThread)
|
||||
int getAssetsCountSince(String albumId, int timestamp);
|
||||
|
||||
@TaskQueue(type: TaskQueueType.serialBackgroundThread)
|
||||
List<PlatformAsset> getAssetsForAlbum(String albumId, {int? updatedTimeCond});
|
||||
|
||||
@async
|
||||
@TaskQueue(type: TaskQueueType.serialBackgroundThread)
|
||||
List<HashResult> hashAssets(List<String> assetIds, {bool allowNetworkAccess = false});
|
||||
|
||||
void cancelHashing();
|
||||
|
||||
@TaskQueue(type: TaskQueueType.serialBackgroundThread)
|
||||
Map<String, List<PlatformAsset>> getTrashedAssets();
|
||||
|
||||
@TaskQueue(type: TaskQueueType.serialBackgroundThread)
|
||||
List<CloudIdResult> getCloudIdForAssetIds(List<String> assetIds);
|
||||
}
|
||||
28
mobile/pigeon/remote_image_api.dart
Normal file
28
mobile/pigeon/remote_image_api.dart
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
import 'package:pigeon/pigeon.dart';
|
||||
|
||||
@ConfigurePigeon(
|
||||
PigeonOptions(
|
||||
dartOut: 'lib/platform/remote_image_api.g.dart',
|
||||
swiftOut: 'ios/Runner/Images/RemoteImages.g.swift',
|
||||
swiftOptions: SwiftOptions(includeErrorClass: false),
|
||||
kotlinOut:
|
||||
'android/app/src/main/kotlin/app/alextran/immich/images/RemoteImages.g.kt',
|
||||
kotlinOptions: KotlinOptions(package: 'app.alextran.immich.images', includeErrorClass: false),
|
||||
dartOptions: DartOptions(),
|
||||
dartPackageName: 'immich_mobile',
|
||||
),
|
||||
)
|
||||
@HostApi()
|
||||
abstract class RemoteImageApi {
|
||||
@async
|
||||
Map<String, int>? requestImage(
|
||||
String url, {
|
||||
required Map<String, String> headers,
|
||||
required int requestId,
|
||||
});
|
||||
|
||||
void cancelRequest(int requestId);
|
||||
|
||||
@async
|
||||
int clearCache();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue