Skip to content

Commit bda7793

Browse files
authored
[Merge] #224 - 사진 삭제 시 포함되어 있던 폴더와 모든 사진에서 반영되지 않던 문제 해결
2 parents e8ca559 + 7555876 commit bda7793

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

Neki-iOS/Features/Archive/Sources/Data/Sources/DefaultArchiveRepository.swift

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,11 +362,18 @@ extension DefaultArchiveRepository {
362362
let endpoint = ArchiveEndpoint.deletePhoto(request: request)
363363
let _ = try await networkProvider.request(endpoint: endpoint)
364364

365-
for (key, var list) in photoCache {
365+
for (folderID, var list) in photoCache {
366+
let originalCount = list.count
366367
list.removeAll { photoIDs.contains($0.photoID) }
367-
photoCache[key] = list
368+
369+
// 기존 갯수보다 줄어들었다면 해당 앨범에서 사진이 삭제되었다는 뜻
370+
if list.count < originalCount {
371+
self.isPhotoCacheDirty[folderID] = true
372+
photoCache[folderID] = list
373+
}
368374
}
369375

376+
self.isPhotoCacheDirty[nil] = true
370377
self.isAlbumCacheDirty = true
371378
self.isFavoriteCacheDirty = true
372379
self.isFavoriteAlbumInfoDirty = true

0 commit comments

Comments
 (0)