mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
feat: show remainder assets info (#21114)
* feat: show remainder assets info * pr feedback
This commit is contained in:
parent
66c657ca8a
commit
ab2849781a
11 changed files with 195 additions and 45 deletions
|
|
@ -16,10 +16,6 @@ class LocalImageRequest extends ImageRequest {
|
|||
return null;
|
||||
}
|
||||
|
||||
Stopwatch? stopwatch;
|
||||
if (!kReleaseMode) {
|
||||
stopwatch = Stopwatch()..start();
|
||||
}
|
||||
final Map<String, int> info = await thumbnailApi.requestImage(
|
||||
localId,
|
||||
requestId: requestId,
|
||||
|
|
@ -27,19 +23,13 @@ class LocalImageRequest extends ImageRequest {
|
|||
height: height,
|
||||
isVideo: assetType == AssetType.video,
|
||||
);
|
||||
if (!kReleaseMode) {
|
||||
stopwatch!.stop();
|
||||
debugPrint('Local request $requestId took ${stopwatch.elapsedMilliseconds}ms for $localId of $width x $height');
|
||||
}
|
||||
|
||||
final frame = await _fromPlatformImage(info);
|
||||
return frame == null ? null : ImageInfo(image: frame.image, scale: scale);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> _onCancelled() {
|
||||
if (!kReleaseMode) {
|
||||
debugPrint('Local image request $requestId for $localId of size $width x $height was cancelled');
|
||||
}
|
||||
return thumbnailApi.cancelImageRequest(requestId);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,18 +24,11 @@ class RemoteImageRequest extends ImageRequest {
|
|||
}
|
||||
|
||||
try {
|
||||
Stopwatch? stopwatch;
|
||||
if (!kReleaseMode) {
|
||||
stopwatch = Stopwatch()..start();
|
||||
}
|
||||
final buffer = await _downloadImage(uri);
|
||||
if (buffer == null) {
|
||||
return null;
|
||||
}
|
||||
if (!kReleaseMode) {
|
||||
stopwatch!.stop();
|
||||
debugPrint('Remote image download $requestId took ${stopwatch.elapsedMilliseconds}ms for $uri');
|
||||
}
|
||||
|
||||
return await _decodeBuffer(buffer, decode, scale);
|
||||
} catch (e) {
|
||||
if (_isCancelled) {
|
||||
|
|
@ -139,8 +132,5 @@ class RemoteImageRequest extends ImageRequest {
|
|||
void _onCancelled() {
|
||||
_request?.abort();
|
||||
_request = null;
|
||||
if (!kReleaseMode) {
|
||||
debugPrint('Cancelled remote image request $requestId for $uri');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,9 +17,5 @@ class ThumbhashImageRequest extends ImageRequest {
|
|||
}
|
||||
|
||||
@override
|
||||
void _onCancelled() {
|
||||
if (!kReleaseMode) {
|
||||
debugPrint('Thumbhash request $requestId for $thumbhash was cancelled');
|
||||
}
|
||||
}
|
||||
void _onCancelled() {}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
import 'dart:async';
|
||||
|
||||
import 'package:drift/drift.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:immich_mobile/domain/models/album/local_album.model.dart';
|
||||
|
|
@ -135,4 +137,22 @@ class DriftBackupRepository extends DriftDatabaseRepository {
|
|||
|
||||
return query.map((localAsset) => localAsset.toDto()).get();
|
||||
}
|
||||
|
||||
FutureOr<List<LocalAlbum>> getSourceAlbums(String localAssetId) {
|
||||
final query = _db.localAlbumEntity.select()
|
||||
..where(
|
||||
(lae) =>
|
||||
existsQuery(
|
||||
_db.localAlbumAssetEntity.selectOnly()
|
||||
..addColumns([_db.localAlbumAssetEntity.albumId])
|
||||
..where(
|
||||
_db.localAlbumAssetEntity.albumId.equalsExp(lae.id) &
|
||||
_db.localAlbumAssetEntity.assetId.equals(localAssetId),
|
||||
),
|
||||
) &
|
||||
lae.backupSelection.equalsValue(BackupSelection.selected),
|
||||
)
|
||||
..orderBy([(lae) => OrderingTerm.asc(lae.name)]);
|
||||
return query.map((localAlbum) => localAlbum.toDto()).get();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue