feat(mobile): show local assets (#905)

* introduce Asset as composition of AssetResponseDTO and AssetEntity

* filter out duplicate assets (that are both local and remote, take only remote for now)

* only allow remote images to be added to albums

* introduce ImmichImage to render Asset using local or remote data

* optimized deletion of local assets

* local video file playback

* allow multiple methods to wait on background service finished

* skip local assets when adding to album from home screen

* fix and optimize delete

* show gray box placeholder for local assets

* add comments

* fix bug: duplicate assets in state after onNewAssetUploaded
This commit is contained in:
Fynn Petersen-Frey
2022-11-08 18:00:24 +01:00
committed by GitHub
parent 99da181cfc
commit 1633af7af6
41 changed files with 830 additions and 514 deletions

View File

@@ -1,13 +1,14 @@
import 'dart:convert';
import 'package:collection/collection.dart';
import 'package:immich_mobile/shared/models/asset.dart';
import 'package:openapi/api.dart';
class SearchResultPageState {
final bool isLoading;
final bool isSuccess;
final bool isError;
final List<AssetResponseDto> searchResult;
final List<Asset> searchResult;
SearchResultPageState({
required this.isLoading,
@@ -20,7 +21,7 @@ class SearchResultPageState {
bool? isLoading,
bool? isSuccess,
bool? isError,
List<AssetResponseDto>? searchResult,
List<Asset>? searchResult,
}) {
return SearchResultPageState(
isLoading: isLoading ?? this.isLoading,
@@ -44,8 +45,9 @@ class SearchResultPageState {
isLoading: map['isLoading'] ?? false,
isSuccess: map['isSuccess'] ?? false,
isError: map['isError'] ?? false,
searchResult: List<AssetResponseDto>.from(
map['searchResult']?.map((x) => AssetResponseDto.mapFromJson(x)),
searchResult: List<Asset>.from(
map['searchResult']
?.map((x) => Asset.remote(AssetResponseDto.fromJson(x))),
),
);
}