mirror of
https://github.com/immich-app/immich.git
synced 2026-07-05 20:57:40 +00:00
Some checks are pending
CodeQL / Analyze (push) Waiting to run
Test / ShellCheck (push) Waiting to run
Test / OpenAPI Clients (push) Waiting to run
Test / SQL Schema Checks (push) Waiting to run
Docker / Build and Push Server (push) Blocked by required conditions
Docker / Docker Build & Push Server Success (push) Blocked by required conditions
Docker / pre-job (push) Waiting to run
Docker / Re-Tag ML (push) Blocked by required conditions
Docker / Docker Build & Push ML Success (push) Blocked by required conditions
Docker / Re-Tag Server (push) Blocked by required conditions
Docker / Build and Push ML (push) Blocked by required conditions
Docs build / pre-job (push) Waiting to run
Docs build / Docs Build (push) Blocked by required conditions
Zizmor / Zizmor (push) Waiting to run
Static Code Analysis / pre-job (push) Waiting to run
Static Code Analysis / Run Dart Code Analysis (push) Blocked by required conditions
Test / Lint Web (push) Blocked by required conditions
Test / pre-job (push) Waiting to run
Test / Test & Lint Server (push) Blocked by required conditions
Test / Unit Test CLI (push) Blocked by required conditions
Test / Unit Test CLI (Windows) (push) Blocked by required conditions
Test / Test Web (push) Blocked by required conditions
Test / Test i18n (push) Blocked by required conditions
Test / End-to-End Lint (push) Blocked by required conditions
Test / Medium Tests (Server) (push) Blocked by required conditions
Test / End-to-End Tests (Server & CLI) (push) Blocked by required conditions
Test / End-to-End Tests (Web) (push) Blocked by required conditions
Test / End-to-End Tests Success (push) Blocked by required conditions
Test / Unit Test Mobile (push) Blocked by required conditions
Test / Unit Test ML (push) Blocked by required conditions
Test / .github Files Formatting (push) Blocked by required conditions
* event-based cancellation wire hash cancellation await cleanup remove forced kill add regression tests abort sync requests fix cleanup ordering in teardown exit isolate test background sync test sigabrt crash cleanup * abort local sync
146 lines
3.3 KiB
Dart
146 lines
3.3 KiB
Dart
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',
|
|
),
|
|
)
|
|
enum PlatformAssetPlaybackStyle { unknown, image, video, imageAnimated, livePhoto, videoLooping }
|
|
|
|
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 durationMs;
|
|
final int orientation;
|
|
final bool isFavorite;
|
|
|
|
final int? adjustmentTime;
|
|
final double? latitude;
|
|
final double? longitude;
|
|
|
|
final PlatformAssetPlaybackStyle playbackStyle;
|
|
|
|
const PlatformAsset({
|
|
required this.id,
|
|
required this.name,
|
|
required this.type,
|
|
this.createdAt,
|
|
this.updatedAt,
|
|
this.width,
|
|
this.height,
|
|
this.durationMs = 0,
|
|
this.orientation = 0,
|
|
this.isFavorite = false,
|
|
this.adjustmentTime,
|
|
this.latitude,
|
|
this.longitude,
|
|
this.playbackStyle = PlatformAssetPlaybackStyle.unknown,
|
|
});
|
|
}
|
|
|
|
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 {
|
|
@async
|
|
bool shouldFullSync();
|
|
|
|
@async
|
|
SyncDelta getMediaChanges();
|
|
|
|
void checkpointSync();
|
|
|
|
void clearSyncCheckpoint();
|
|
|
|
@async
|
|
List<String> getAssetIdsForAlbum(String albumId);
|
|
|
|
@async
|
|
List<PlatformAlbum> getAlbums();
|
|
|
|
@TaskQueue(type: TaskQueueType.serialBackgroundThread)
|
|
int getAssetsCountSince(String albumId, int timestamp);
|
|
|
|
@async
|
|
List<PlatformAsset> getAssetsForAlbum(String albumId, {int? updatedTimeCond});
|
|
|
|
@async
|
|
@TaskQueue(type: TaskQueueType.serialBackgroundThread)
|
|
List<HashResult> hashAssets(List<String> assetIds, {bool allowNetworkAccess = false});
|
|
|
|
void cancelHashing();
|
|
|
|
void cancelSync();
|
|
|
|
@TaskQueue(type: TaskQueueType.serialBackgroundThread)
|
|
Map<String, List<PlatformAsset>> getTrashedAssets();
|
|
|
|
@async
|
|
bool restoreFromTrashById(String mediaId, int type);
|
|
|
|
@TaskQueue(type: TaskQueueType.serialBackgroundThread)
|
|
List<CloudIdResult> getCloudIdForAssetIds(List<String> assetIds);
|
|
}
|