feat(mobile): Archive feature on mobile (#2258)

* update asset to include isArchive property

* Not display archived assets on timeline

* replace share button to archive button

* Added archive page

* Add bottom nav bar

* clean up homepage

* remove deadcode

* improve on sync is archive

* show archive asset correctly

* better merge condition

* Added back renderList to re-rendering don't jump around

* Better way to handle showing archive assets

* complete ArchiveSelectionNotifier

* toggle archive

* remove deadcode

* fix unit tests

* update assets in DB when changing assets

* update asset state to reflect archived status

* allow to archive assets via multi-select from timeline

* fixed logic

* Add options to bulk unarchive

* regenerate api

* Change position of toast message

---------

Co-authored-by: Fynn Petersen-Frey <zoodyy@users.noreply.github.com>
This commit is contained in:
Alex
2023-04-17 00:02:07 -05:00
committed by GitHub
parent 635eee9e5e
commit 2e5cd986dd
27 changed files with 523 additions and 114 deletions

View File

@@ -29,7 +29,8 @@ class Asset {
ownerId = fastHash(remote.ownerId),
exifInfo =
remote.exifInfo != null ? ExifInfo.fromDto(remote.exifInfo!) : null,
isFavorite = remote.isFavorite;
isFavorite = remote.isFavorite,
isArchived = remote.isArchived;
Asset.local(AssetEntity local)
: localId = local.id,
@@ -44,6 +45,7 @@ class Asset {
fileModifiedAt = local.modifiedDateTime,
updatedAt = local.modifiedDateTime,
isFavorite = local.isFavorite,
isArchived = false,
fileCreatedAt = local.createDateTime {
if (fileCreatedAt.year == 1970) {
fileCreatedAt = fileModifiedAt;
@@ -70,6 +72,7 @@ class Asset {
this.exifInfo,
required this.isFavorite,
required this.isLocal,
required this.isArchived,
});
@ignore
@@ -132,6 +135,8 @@ class Asset {
bool isLocal;
bool isArchived;
@ignore
ExifInfo? exifInfo;
@@ -168,7 +173,8 @@ class Asset {
fileName == other.fileName &&
livePhotoVideoId == other.livePhotoVideoId &&
isFavorite == other.isFavorite &&
isLocal == other.isLocal;
isLocal == other.isLocal &&
isArchived == other.isArchived;
}
@override
@@ -189,7 +195,8 @@ class Asset {
fileName.hashCode ^
livePhotoVideoId.hashCode ^
isFavorite.hashCode ^
isLocal.hashCode;
isLocal.hashCode ^
isArchived.hashCode;
bool updateFromAssetEntity(AssetEntity ae) {
// TODO check more fields;
@@ -217,6 +224,9 @@ class Asset {
height ??= a.height;
exifInfo ??= a.exifInfo;
exifInfo?.id = id;
if (!isRemote) {
isArchived = a.isArchived;
}
return this;
}
@@ -271,7 +281,8 @@ class Asset {
"isFavorite": $isFavorite,
"isLocal": $isLocal,
"width": ${width ?? "N/A"},
"height": ${height ?? "N/A"}
"height": ${height ?? "N/A"},
"isArchived": $isArchived
}""";
}
}