mirror of
https://github.com/immich-app/immich.git
synced 2024-11-28 09:33:27 +02:00
fix(mobile): stack count reset when navigating to library (#4647)
Co-authored-by: shalong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
This commit is contained in:
parent
cb0e37e76e
commit
b49b10141e
2
cli/src/api/open-api/api.ts
generated
2
cli/src/api/open-api/api.ts
generated
@ -771,7 +771,7 @@ export interface AssetResponseDto {
|
||||
* @type {number}
|
||||
* @memberof AssetResponseDto
|
||||
*/
|
||||
'stackCount': number;
|
||||
'stackCount': number | null;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
|
@ -83,7 +83,7 @@ class GalleryViewerPage extends HookConsumerWidget {
|
||||
navStack.length > 2 &&
|
||||
navStack.elementAt(navStack.length - 2).name == TrashRoute.name;
|
||||
final stackIndex = useState(-1);
|
||||
final stack = showStack && currentAsset.stackCount > 0
|
||||
final stack = showStack && currentAsset.stackChildrenCount > 0
|
||||
? ref.watch(assetStackStateProvider(currentAsset))
|
||||
: <Asset>[];
|
||||
final stackElements = showStack ? [currentAsset, ...stack] : <Asset>[];
|
||||
|
@ -104,16 +104,16 @@ class ThumbnailImage extends StatelessWidget {
|
||||
right: 5,
|
||||
child: Row(
|
||||
children: [
|
||||
if (asset.stackCount > 1)
|
||||
if (asset.stackChildrenCount > 1)
|
||||
Text(
|
||||
"${asset.stackCount}",
|
||||
"${asset.stackChildrenCount}",
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 10,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
if (asset.stackCount > 1)
|
||||
if (asset.stackChildrenCount > 1)
|
||||
const SizedBox(
|
||||
width: 3,
|
||||
),
|
||||
@ -233,7 +233,7 @@ class ThumbnailImage extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
if (!asset.isImage) buildVideoIcon(),
|
||||
if (asset.isImage && asset.stackCount > 0) buildStackIcon(),
|
||||
if (asset.isImage && asset.stackChildrenCount > 0) buildStackIcon(),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
@ -153,7 +153,10 @@ class Asset {
|
||||
|
||||
String? stackParentId;
|
||||
|
||||
int stackCount;
|
||||
@ignore
|
||||
int get stackChildrenCount => stackCount ?? 0;
|
||||
|
||||
int? stackCount;
|
||||
|
||||
/// `true` if this [Asset] is present on the device
|
||||
@ignore
|
||||
@ -253,7 +256,11 @@ class Asset {
|
||||
isFavorite != a.isFavorite ||
|
||||
isArchived != a.isArchived ||
|
||||
isTrashed != a.isTrashed ||
|
||||
stackCount != a.stackCount;
|
||||
// no local stack count or different count from remote
|
||||
((stackCount == null && a.stackCount != null) ||
|
||||
(stackCount != null &&
|
||||
a.stackCount != null &&
|
||||
stackCount != a.stackCount));
|
||||
}
|
||||
|
||||
/// Returns a new [Asset] with values from this and merged & updated with [a]
|
||||
@ -269,6 +276,7 @@ class Asset {
|
||||
width: a.width ?? width,
|
||||
height: a.height ?? height,
|
||||
exifInfo: a.exifInfo?.copyWith(id: id) ?? exifInfo,
|
||||
stackCount: a.stackCount ?? stackCount,
|
||||
);
|
||||
} else if (isRemote) {
|
||||
return _copyWith(
|
||||
@ -299,7 +307,7 @@ class Asset {
|
||||
height: a.height,
|
||||
livePhotoVideoId: a.livePhotoVideoId,
|
||||
stackParentId: a.stackParentId,
|
||||
stackCount: a.stackCount,
|
||||
stackCount: a.stackCount ?? stackCount,
|
||||
// isFavorite + isArchived are not set by device-only assets
|
||||
isFavorite: a.isFavorite,
|
||||
isArchived: a.isArchived,
|
||||
|
Binary file not shown.
BIN
mobile/openapi/lib/model/asset_response_dto.dart
generated
BIN
mobile/openapi/lib/model/asset_response_dto.dart
generated
Binary file not shown.
@ -6009,6 +6009,7 @@
|
||||
"type": "array"
|
||||
},
|
||||
"stackCount": {
|
||||
"nullable": true,
|
||||
"type": "integer"
|
||||
},
|
||||
"stackParentId": {
|
||||
|
@ -45,7 +45,7 @@ export class AssetResponseDto extends SanitizedAssetResponseDto {
|
||||
stackParentId?: string | null;
|
||||
stack?: AssetResponseDto[];
|
||||
@ApiProperty({ type: 'integer' })
|
||||
stackCount!: number;
|
||||
stackCount!: number | null;
|
||||
}
|
||||
|
||||
export type AssetMapOptions = {
|
||||
@ -102,7 +102,7 @@ export function mapAsset(entity: AssetEntity, options: AssetMapOptions = {}): As
|
||||
checksum: entity.checksum.toString('base64'),
|
||||
stackParentId: entity.stackParentId,
|
||||
stack: withStack ? entity.stack?.map((a) => mapAsset(a, { stripMetadata })) ?? undefined : undefined,
|
||||
stackCount: entity.stack?.length ?? 0,
|
||||
stackCount: entity.stack?.length ?? null,
|
||||
isExternal: entity.isExternal,
|
||||
isOffline: entity.isOffline,
|
||||
isReadOnly: entity.isReadOnly,
|
||||
|
2
web/src/api/open-api/api.ts
generated
2
web/src/api/open-api/api.ts
generated
@ -771,7 +771,7 @@ export interface AssetResponseDto {
|
||||
* @type {number}
|
||||
* @memberof AssetResponseDto
|
||||
*/
|
||||
'stackCount': number;
|
||||
'stackCount': number | null;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
|
Loading…
Reference in New Issue
Block a user