Skip to content

High performance self-hosted photo and video management solution.

chore: do not process cloud ids during sync & hash (#25914)

shenlong2b6055e83002
diff --git a/mobile/lib/domain/services/hash.service.dart b/mobile/lib/domain/services/hash.service.dart
index 8be3c2f224..6781507566 100644
--- a/mobile/lib/domain/services/hash.service.dart
+++ b/mobile/lib/domain/services/hash.service.dart
@@ -41,7 +41,7 @@ class HashService {
final Stopwatch stopwatch = Stopwatch()..start();
try {
// Migrate hashes from cloud ID to local ID so we don't have to re-hash them
- await _localAssetRepository.reconcileHashesFromCloudId();
+ // await _localAssetRepository.reconcileHashesFromCloudId();
// Sorted by backupSelection followed by isCloud
final localAlbums = await _localAlbumRepository.getBackupAlbums();
diff --git a/mobile/lib/domain/services/local_sync.service.dart b/mobile/lib/domain/services/local_sync.service.dart
index e4a129d322..868f153157 100644
--- a/mobile/lib/domain/services/local_sync.service.dart
+++ b/mobile/lib/domain/services/local_sync.service.dart
@@ -19,6 +19,7 @@ import 'package:logging/logging.dart';
class LocalSyncService {
final DriftLocalAlbumRepository _localAlbumRepository;
+ // ignore: unused_field
final DriftLocalAssetRepository _localAssetRepository;
final NativeSyncApi _nativeSyncApi;
final DriftTrashedLocalAssetRepository _trashedLocalAssetRepository;
@@ -53,8 +54,8 @@ class LocalSyncService {
}
if (CurrentPlatform.isIOS) {
- final assets = await _localAssetRepository.getEmptyCloudIdAssets();
- await _mapIosCloudIds(assets);
+ // final assets = await _localAssetRepository.getEmptyCloudIdAssets();
+ // await _mapIosCloudIds(assets);
}
if (full || await _nativeSyncApi.shouldFullSync()) {
@@ -306,27 +307,28 @@ class LocalSyncService {
return true;
}
+ // ignore: avoid-unused-parameters
Future<void> _mapIosCloudIds(List<LocalAsset> assets) async {
- if (!CurrentPlatform.isIOS || assets.isEmpty) {
- return;
- }
-
- final assetIds = assets.map((a) => a.id).toList();
- final cloudMapping = <String, String>{};
- final cloudIds = await _nativeSyncApi.getCloudIdForAssetIds(assetIds);
- for (int i = 0; i < cloudIds.length; i++) {
- final cloudIdResult = cloudIds[i];
- if (cloudIdResult.cloudId != null) {
- cloudMapping[cloudIdResult.assetId] = cloudIdResult.cloudId!;
- } else {
- final asset = assets.firstWhereOrNull((a) => a.id == cloudIdResult.assetId);
- _log.fine(
- "Cannot fetch cloudId for asset with id: ${cloudIdResult.assetId}, name: ${asset?.name}, createdAt: ${asset?.createdAt}. Error: ${cloudIdResult.error ?? "unknown"}",
- );
- }
- }
-
- await _localAlbumRepository.updateCloudMapping(cloudMapping);
+ // if (!CurrentPlatform.isIOS || assets.isEmpty) {
+ return;
+ // }
+
+ // final assetIds = assets.map((a) => a.id).toList();
+ // final cloudMapping = <String, String>{};
+ // final cloudIds = await _nativeSyncApi.getCloudIdForAssetIds(assetIds);
+ // for (int i = 0; i < cloudIds.length; i++) {
+ // final cloudIdResult = cloudIds[i];
+ // if (cloudIdResult.cloudId != null) {
+ // cloudMapping[cloudIdResult.assetId] = cloudIdResult.cloudId!;
+ // } else {
+ // final asset = assets.firstWhereOrNull((a) => a.id == cloudIdResult.assetId);
+ // _log.fine(
+ // "Cannot fetch cloudId for asset with id: ${cloudIdResult.assetId}, name: ${asset?.name}, createdAt: ${asset?.createdAt}. Error: ${cloudIdResult.error ?? "unknown"}",
+ // );
+ // }
+ // }
+
+ // await _localAlbumRepository.updateCloudMapping(cloudMapping);
}
bool _assetsEqual(LocalAsset a, LocalAsset b) {