background upload plugin

add schemas

sync variants

formatting

initial implementation

use existing db, wip

move to separate folder

fix table definitions

wip

wiring it up

repository pattern
This commit is contained in:
mertalev
2025-11-22 11:09:34 -05:00
parent 41f013387f
commit 92bc22620b
19 changed files with 939 additions and 582 deletions
@@ -5,6 +5,7 @@ import 'package:immich_mobile/infrastructure/entities/store.entity.dart';
import 'package:immich_mobile/infrastructure/entities/store.entity.drift.dart';
import 'package:immich_mobile/infrastructure/repositories/db.repository.dart';
import 'package:immich_mobile/infrastructure/repositories/user.repository.dart';
import 'package:immich_mobile/providers/infrastructure/platform.provider.dart';
import 'package:isar/isar.dart';
// Temporary interface until Isar is removed to make the service work with both Isar and Sqlite
@@ -141,6 +142,7 @@ class DriftStoreRepository extends DriftDatabaseRepository implements IStoreRepo
@override
Future<bool> upsert<T>(StoreKey<T> key, T value) async {
await _db.storeEntity.insertOnConflictUpdate(await _fromValue(key, value));
await uploadApi.onConfigChange(key.id);
return true;
}
+27 -3
View File
@@ -41,9 +41,6 @@ enum UploadApiErrorCode {
networkError,
photosInternalError,
photosUnknownError,
noServerUrl,
noDeviceId,
noAccessToken,
interrupted,
cancelled,
downloadStalled,
@@ -53,6 +50,10 @@ enum UploadApiErrorCode {
uploadTimeout,
iCloudRateLimit,
iCloudThrottled,
invalidResponse,
badRequest,
internalServerError,
unauthorized,
}
enum UploadApiStatus {
@@ -339,6 +340,29 @@ class UploadApi {
return;
}
}
Future<void> onConfigChange(int key) async {
final String pigeonVar_channelName =
'dev.flutter.pigeon.immich_mobile.UploadApi.onConfigChange$pigeonVar_messageChannelSuffix';
final BasicMessageChannel<Object?> pigeonVar_channel = BasicMessageChannel<Object?>(
pigeonVar_channelName,
pigeonChannelCodec,
binaryMessenger: pigeonVar_binaryMessenger,
);
final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(<Object?>[key]);
final List<Object?>? pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;
if (pigeonVar_replyList == null) {
throw _createConnectionError(pigeonVar_channelName);
} else if (pigeonVar_replyList.length > 1) {
throw PlatformException(
code: pigeonVar_replyList[0]! as String,
message: pigeonVar_replyList[1] as String?,
details: pigeonVar_replyList[2],
);
} else {
return;
}
}
}
Stream<UploadApiTaskStatus> streamStatus({String instanceName = ''}) {