mirror of
				https://github.com/immich-app/immich.git
				synced 2025-10-30 18:22:37 -04:00 
			
		
		
		
	add full sync button
This commit is contained in:
		
							parent
							
								
									7e5f88e678
								
							
						
					
					
						commit
						a41a156ce4
					
				| @ -137,6 +137,6 @@ open class NativeSyncApiImplBase(context: Context) { | ||||
|         return albums.map { album -> | ||||
|             val count = albumsCount[album.id] ?: 0 | ||||
|             album.copy(assetCount = count.toLong()) | ||||
|         } | ||||
|         }.sortedBy { it.id } | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -37,12 +37,12 @@ class DeviceSyncService { | ||||
|   bool get _ignoreIcloudAssets => | ||||
|       _storeService.get(StoreKey.ignoreIcloudAssets, false) == true; | ||||
| 
 | ||||
|   Future<void> sync() async { | ||||
|   Future<void> sync({bool full = false}) async { | ||||
|     final Stopwatch stopwatch = Stopwatch()..start(); | ||||
|     try { | ||||
|       if (await _nativeSyncApi.shouldFullSync()) { | ||||
|         _log.fine("Cannot use partial sync. Performing full sync"); | ||||
|         DLog.log("Cannot use partial sync. Performing full sync"); | ||||
|       if (full || await _nativeSyncApi.shouldFullSync()) { | ||||
|         _log.fine("Full sync request from ${full ? "user" : "native"}"); | ||||
|         DLog.log("Full sync request from ${full ? "user" : "native"}"); | ||||
|         return await fullSync(); | ||||
|       } | ||||
| 
 | ||||
|  | ||||
| @ -23,13 +23,14 @@ class BackgroundSyncManager { | ||||
|   } | ||||
| 
 | ||||
|   // No need to cancel the task, as it can also be run when the user logs out | ||||
|   Future<void> syncLocal() { | ||||
|   Future<void> syncLocal({bool full = false}) { | ||||
|     if (_deviceAlbumSyncTask != null) { | ||||
|       return _deviceAlbumSyncTask!.future; | ||||
|     } | ||||
| 
 | ||||
|     _deviceAlbumSyncTask = runInIsolateGentle( | ||||
|       computation: (ref) => ref.read(deviceSyncServiceProvider).sync(), | ||||
|       computation: (ref) => | ||||
|           ref.read(deviceSyncServiceProvider).sync(full: full), | ||||
|     ); | ||||
| 
 | ||||
|     return _deviceAlbumSyncTask!.whenComplete(() { | ||||
|  | ||||
| @ -21,6 +21,11 @@ final _features = [ | ||||
|     icon: Icons.photo_album_rounded, | ||||
|     onTap: (_, ref) => ref.read(backgroundSyncProvider).syncLocal(), | ||||
|   ), | ||||
|   _Feature( | ||||
|     name: 'Sync Local Full', | ||||
|     icon: Icons.photo_library_rounded, | ||||
|     onTap: (_, ref) => ref.read(backgroundSyncProvider).syncLocal(full: true), | ||||
|   ), | ||||
|   _Feature( | ||||
|     name: 'Sync Remote', | ||||
|     icon: Icons.refresh_rounded, | ||||
| @ -69,6 +74,7 @@ class FeatInDevPage extends StatelessWidget { | ||||
|       body: Column( | ||||
|         children: [ | ||||
|           Flexible( | ||||
|             flex: 1, | ||||
|             child: ListView.builder( | ||||
|               itemBuilder: (_, index) { | ||||
|                 final feat = _features[index]; | ||||
| @ -76,6 +82,7 @@ class FeatInDevPage extends StatelessWidget { | ||||
|                   builder: (ctx, ref, _) => ListTile( | ||||
|                     title: Text(feat.name), | ||||
|                     trailing: Icon(feat.icon), | ||||
|                     visualDensity: VisualDensity.compact, | ||||
|                     onTap: () => unawaited(feat.onTap(ctx, ref)), | ||||
|                   ), | ||||
|                 ); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user