1
0
mirror of https://github.com/immich-app/immich.git synced 2025-07-15 07:14:42 +02:00

feat(mobile): new mobile UI (#12582)

This commit is contained in:
Alex
2024-10-10 15:44:14 +07:00
committed by GitHub
parent b59abdff3d
commit e9813315e7
56 changed files with 1960 additions and 1274 deletions

View File

@ -95,10 +95,9 @@ class SyncService {
/// Syncs remote albums to the database
/// returns `true` if there were any changes
Future<bool> syncRemoteAlbumsToDb(
List<Album> remote, {
required bool isShared,
}) =>
_lock.run(() => _syncRemoteAlbumsToDb(remote, isShared));
List<Album> remote,
) =>
_lock.run(() => _syncRemoteAlbumsToDb(remote));
/// Syncs all device albums and their assets to the database
/// Returns `true` if there were any changes
@ -310,17 +309,14 @@ class SyncService {
/// returns `true` if there were any changes
Future<bool> _syncRemoteAlbumsToDb(
List<Album> remoteAlbums,
bool isShared,
) async {
remoteAlbums.sortBy((e) => e.remoteId!);
final User me = await _userRepository.me();
final List<Album> dbAlbums = await _albumRepository.getAll(
remote: true,
shared: isShared ? true : null,
ownerId: isShared ? null : me.isarId,
sortBy: AlbumSort.remoteId,
);
final List<Asset> toDelete = [];
final List<Asset> existing = [];
@ -335,7 +331,7 @@ class SyncService {
onlySecond: (dbAlbum) => _removeAlbumFromDb(dbAlbum, toDelete),
);
if (isShared && toDelete.isNotEmpty) {
if (toDelete.isNotEmpty) {
final List<int> idsToRemove = sharedAssetsToRemove(toDelete, existing);
if (idsToRemove.isNotEmpty) {
await _assetRepository.deleteById(idsToRemove);