feat(mobile): Library page rework (album sorting, favorites) (#1501)

* Add album sorting

* Change AppBar to match photos page behaviour

* Add buttons

* First crude implementation of the favorites page

* Clean up

* Add favorite button

* i18n

* Add star indicator to thumbnail

* Add favorite logic to separate provider and fix favorite behavior in album

* Review feedback (Add isFavorite variable)

* dev: style buttons

* dev: styled drop down button

---------

Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
Matthias Rupp
2023-02-05 04:25:11 +01:00
committed by GitHub
parent 0048662182
commit bb0b2a1f53
16 changed files with 478 additions and 56 deletions

View File

@@ -23,7 +23,8 @@ class Asset {
latitude = remote.exifInfo?.latitude?.toDouble(),
longitude = remote.exifInfo?.longitude?.toDouble(),
exifInfo =
remote.exifInfo != null ? ExifInfo.fromDto(remote.exifInfo!) : null;
remote.exifInfo != null ? ExifInfo.fromDto(remote.exifInfo!) : null,
isFavorite = remote.isFavorite;
Asset.local(AssetEntity local, String owner)
: localId = local.id,
@@ -37,6 +38,7 @@ class Asset {
deviceId = Hive.box(userInfoBox).get(deviceIdKey),
ownerId = owner,
modifiedAt = local.modifiedDateTime.toUtc(),
isFavorite = local.isFavorite,
createdAt = local.createDateTime.toUtc() {
if (createdAt.year == 1970) {
createdAt = modifiedAt;
@@ -59,6 +61,7 @@ class Asset {
required this.fileName,
this.livePhotoVideoId,
this.exifInfo,
required this.isFavorite,
});
AssetEntity? _local;
@@ -111,6 +114,8 @@ class Asset {
ExifInfo? exifInfo;
bool isFavorite;
String get id => isLocal ? localId.toString() : remoteId!;
String get name => p.withoutExtension(fileName);
@@ -150,6 +155,7 @@ class Asset {
json["height"] = height;
json["fileName"] = fileName;
json["livePhotoVideoId"] = livePhotoVideoId;
json["isFavorite"] = isFavorite;
if (exifInfo != null) {
json["exifInfo"] = exifInfo!.toJson();
}
@@ -179,6 +185,7 @@ class Asset {
fileName: json["fileName"],
livePhotoVideoId: json["livePhotoVideoId"],
exifInfo: ExifInfo.fromJson(json["exifInfo"]),
isFavorite: json["isFavorite"],
);
}
return null;