mirror of
https://github.com/immich-app/immich.git
synced 2025-02-04 01:09:14 -05:00
fix(mobile): Sorted shared album and added share user doesn't reflect change in album view (#1955)
* fix: sorted shared album * Added TODO comment for tomorrow work * update album shared property after adding user --------- Co-authored-by: Fynn Petersen-Frey <zoodyy@users.noreply.github.com>
This commit is contained in:
parent
ceb81d00fc
commit
416e30ede2
3 changed files with 16 additions and 4 deletions
|
@ -37,12 +37,20 @@ class SharedAlbumNotifier extends StateNotifier<List<Album>> {
|
|||
}
|
||||
|
||||
Future<void> getAllSharedAlbums() async {
|
||||
var albums = await _db.albums.filter().sharedEqualTo(true).findAll();
|
||||
var albums = await _db.albums
|
||||
.filter()
|
||||
.sharedEqualTo(true)
|
||||
.sortByCreatedAtDesc()
|
||||
.findAll();
|
||||
if (!const ListEquality().equals(albums, state)) {
|
||||
state = albums;
|
||||
}
|
||||
await _albumService.refreshRemoteAlbums(isShared: true);
|
||||
albums = await _db.albums.filter().sharedEqualTo(true).findAll();
|
||||
albums = await _db.albums
|
||||
.filter()
|
||||
.sharedEqualTo(true)
|
||||
.sortByCreatedAtDesc()
|
||||
.findAll();
|
||||
if (!const ListEquality().equals(albums, state)) {
|
||||
state = albums;
|
||||
}
|
||||
|
|
|
@ -211,7 +211,11 @@ class AlbumService {
|
|||
if (result != null) {
|
||||
album.sharedUsers
|
||||
.addAll((await _db.users.getAllById(sharedUserIds)).cast());
|
||||
await _db.writeTxn(() => album.sharedUsers.save());
|
||||
album.shared = result.shared;
|
||||
await _db.writeTxn(() async {
|
||||
await _db.albums.put(album);
|
||||
await album.sharedUsers.save();
|
||||
});
|
||||
return true;
|
||||
}
|
||||
} catch (e) {
|
||||
|
|
|
@ -501,7 +501,6 @@ Triple<List<Asset>, List<Asset>, List<Asset>> _diffAssets(
|
|||
(!a.isLocal && b.isLocal) ||
|
||||
(!a.isRemote && b.isRemote)) {
|
||||
toUpdate.add(b.updateFromDb(a));
|
||||
debugPrint("both");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -554,5 +553,6 @@ bool _hasAlbumResponseDtoChanged(AlbumResponseDto dto, Album a) {
|
|||
dto.albumName != a.name ||
|
||||
dto.albumThumbnailAssetId != a.thumbnail.value?.remoteId ||
|
||||
dto.shared != a.shared ||
|
||||
dto.sharedUsers.length != a.sharedUsers.length ||
|
||||
DateTime.parse(dto.updatedAt).toUtc() != a.modifiedAt.toUtc();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue