From 81c1a4f1da2e893eb617631fc59d756e4122c771 Mon Sep 17 00:00:00 2001 From: Tom graham Date: Tue, 7 Jan 2025 18:00:35 +1100 Subject: [PATCH] Initial look at fixing issue where images are uploaded to the wrong album if a shared album conflicts with a local users album. --- mobile/lib/providers/album/album.provider.dart | 6 +++--- mobile/lib/services/album.service.dart | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mobile/lib/providers/album/album.provider.dart b/mobile/lib/providers/album/album.provider.dart index b3d619a815..42a87c5176 100644 --- a/mobile/lib/providers/album/album.provider.dart +++ b/mobile/lib/providers/album/album.provider.dart @@ -46,8 +46,8 @@ class AlbumNotifier extends StateNotifier> { ) => _albumService.createAlbum(albumTitle, assets, []); - Future getAlbumByName(String albumName, {bool remoteOnly = false}) => - _albumService.getAlbumByName(albumName, remoteOnly); + Future getAlbumByName(String albumName, {bool? remote, bool? shared}) => + _albumService.getAlbumByName(albumName, remote: remote, shared: shared); /// Create an album on the server with the same name as the selected album for backup /// First this will check if the album already exists on the server with name @@ -55,7 +55,7 @@ class AlbumNotifier extends StateNotifier> { Future createSyncAlbum( String albumName, ) async { - final album = await getAlbumByName(albumName, remoteOnly: true); + final album = await getAlbumByName(albumName, remote: true, shared: false); if (album != null) { return; } diff --git a/mobile/lib/services/album.service.dart b/mobile/lib/services/album.service.dart index 5f013c0e53..ba0eb1d898 100644 --- a/mobile/lib/services/album.service.dart +++ b/mobile/lib/services/album.service.dart @@ -408,8 +408,8 @@ class AlbumService { } } - Future getAlbumByName(String name, bool remoteOnly) => - _albumRepository.getByName(name, remote: remoteOnly ? true : null); + Future getAlbumByName(String name, {bool? remote, bool? shared}) => + _albumRepository.getByName(name, remote: remote, shared: shared); /// /// Add the uploaded asset to the selected albums @@ -419,7 +419,7 @@ class AlbumService { List assetIds, ) async { for (final albumName in albumNames) { - Album? album = await getAlbumByName(albumName, true); + Album? album = await getAlbumByName(albumName, remote: true, shared: false); album ??= await createAlbum(albumName, []); if (album != null && album.remoteId != null) { await _albumApiRepository.addAssets(album.remoteId!, assetIds);