mirror of
				https://github.com/KevinMidboe/immich.git
				synced 2025-10-29 17:40:28 +00:00 
			
		
		
		
	feat(mobile): sync remote assets without thumbs (#2705)
This commit is contained in:
		
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							55b6b28afb
						
					
				
				
					commit
					8f5214724c
				
			| @@ -66,8 +66,11 @@ class AssetService { | |||||||
|     try { |     try { | ||||||
|       final etag = hasCache ? _db.eTags.getByIdSync(user.id)?.value : null; |       final etag = hasCache ? _db.eTags.getByIdSync(user.id)?.value : null; | ||||||
|       final (List<AssetResponseDto>? assets, String? newETag) = |       final (List<AssetResponseDto>? assets, String? newETag) = | ||||||
|           await _apiService.assetApi |           await _apiService.assetApi.getAllAssetsWithETag( | ||||||
|               .getAllAssetsWithETag(eTag: etag, userId: user.id); |         eTag: etag, | ||||||
|  |         userId: user.id, | ||||||
|  |         withoutThumbs: true, | ||||||
|  |       ); | ||||||
|       if (assets == null) { |       if (assets == null) { | ||||||
|         return null; |         return null; | ||||||
|       } else if (assets.isNotEmpty && assets.first.ownerId != user.id) { |       } else if (assets.isNotEmpty && assets.first.ownerId != user.id) { | ||||||
|   | |||||||
| @@ -1,6 +1,7 @@ | |||||||
| import 'package:cached_network_image/cached_network_image.dart'; | import 'package:cached_network_image/cached_network_image.dart'; | ||||||
| import 'package:flutter/material.dart'; | import 'package:flutter/material.dart'; | ||||||
| import 'package:flutter/services.dart'; | import 'package:flutter/services.dart'; | ||||||
|  | import 'package:flutter_cache_manager/flutter_cache_manager.dart'; | ||||||
| import 'package:immich_mobile/shared/models/asset.dart'; | import 'package:immich_mobile/shared/models/asset.dart'; | ||||||
| import 'package:immich_mobile/shared/models/store.dart'; | import 'package:immich_mobile/shared/models/store.dart'; | ||||||
| import 'package:immich_mobile/utils/image_url_builder.dart'; | import 'package:immich_mobile/utils/image_url_builder.dart'; | ||||||
| @@ -110,8 +111,12 @@ class ImmichImage extends StatelessWidget { | |||||||
|         ); |         ); | ||||||
|       }, |       }, | ||||||
|       errorWidget: (context, url, error) { |       errorWidget: (context, url, error) { | ||||||
|         debugPrint("Error getting thumbnail $url = $error"); |         if (error is HttpExceptionWithStatus && | ||||||
|         CachedNetworkImage.evictFromCache(thumbnailRequestUrl); |             error.statusCode >= 400 && | ||||||
|  |             error.statusCode < 500) { | ||||||
|  |           debugPrint("Evicting thumbnail '$url' from cache: $error"); | ||||||
|  |           CachedNetworkImage.evictFromCache(url); | ||||||
|  |         } | ||||||
|         return Icon( |         return Icon( | ||||||
|           Icons.image_not_supported_outlined, |           Icons.image_not_supported_outlined, | ||||||
|           color: Theme.of(context).primaryColor, |           color: Theme.of(context).primaryColor, | ||||||
|   | |||||||
| @@ -15,10 +15,16 @@ extension WithETag on AssetApi { | |||||||
|   Future<(List<AssetResponseDto>? assets, String? eTag)> getAllAssetsWithETag({ |   Future<(List<AssetResponseDto>? assets, String? eTag)> getAllAssetsWithETag({ | ||||||
|     String? eTag, |     String? eTag, | ||||||
|     String? userId, |     String? userId, | ||||||
|  |     bool? isFavorite, | ||||||
|  |     bool? isArchived, | ||||||
|  |     bool? withoutThumbs, | ||||||
|   }) async { |   }) async { | ||||||
|     final response = await getAllAssetsWithHttpInfo( |     final response = await getAllAssetsWithHttpInfo( | ||||||
|       ifNoneMatch: eTag, |       ifNoneMatch: eTag, | ||||||
|       userId: userId, |       userId: userId, | ||||||
|  |       isFavorite: isFavorite, | ||||||
|  |       isArchived: isArchived, | ||||||
|  |       withoutThumbs: withoutThumbs, | ||||||
|     ); |     ); | ||||||
|     if (response.statusCode >= HttpStatus.badRequest) { |     if (response.statusCode >= HttpStatus.badRequest) { | ||||||
|       throw ApiException(response.statusCode, await _decodeBodyBytes(response)); |       throw ApiException(response.statusCode, await _decodeBodyBytes(response)); | ||||||
|   | |||||||
| @@ -367,7 +367,7 @@ packages: | |||||||
|     source: hosted |     source: hosted | ||||||
|     version: "0.7.0" |     version: "0.7.0" | ||||||
|   flutter_cache_manager: |   flutter_cache_manager: | ||||||
|     dependency: transitive |     dependency: "direct main" | ||||||
|     description: |     description: | ||||||
|       name: flutter_cache_manager |       name: flutter_cache_manager | ||||||
|       sha256: "32cd900555219333326a2d0653aaaf8671264c29befa65bbd9856d204a4c9fb3" |       sha256: "32cd900555219333326a2d0653aaaf8671264c29befa65bbd9856d204a4c9fb3" | ||||||
|   | |||||||
| @@ -17,6 +17,7 @@ dependencies: | |||||||
|   flutter_hooks: ^0.18.6 |   flutter_hooks: ^0.18.6 | ||||||
|   hooks_riverpod: ^2.2.0 |   hooks_riverpod: ^2.2.0 | ||||||
|   cached_network_image: ^3.2.2 |   cached_network_image: ^3.2.2 | ||||||
|  |   flutter_cache_manager: ^3.3.0 | ||||||
|   intl: ^0.18.0 |   intl: ^0.18.0 | ||||||
|   auto_route: ^5.0.1 |   auto_route: ^5.0.1 | ||||||
|   fluttertoast: ^8.0.8 |   fluttertoast: ^8.0.8 | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user