diff --git a/src/gui/macOS/fileproviderstorageuseenumerationobserver.h b/src/gui/macOS/fileproviderstorageuseenumerationobserver.h index 285b159c3ae7b..897c865c9b235 100644 --- a/src/gui/macOS/fileproviderstorageuseenumerationobserver.h +++ b/src/gui/macOS/fileproviderstorageuseenumerationobserver.h @@ -21,5 +21,6 @@ typedef void(^UsageEnumerationFinishedHandler)(NSError *const error); @property (readwrite, strong) UsageEnumerationFinishedHandler enumerationFinishedHandler; @property (readonly) NSUInteger usage; +@property (readonly) NSSet> *materialisedItems; @end diff --git a/src/gui/macOS/fileproviderstorageuseenumerationobserver.m b/src/gui/macOS/fileproviderstorageuseenumerationobserver.m index c88fa8228e379..7ffc1a0b2bc6d 100644 --- a/src/gui/macOS/fileproviderstorageuseenumerationobserver.m +++ b/src/gui/macOS/fileproviderstorageuseenumerationobserver.m @@ -29,12 +29,17 @@ - (instancetype)init // NSFileProviderEnumerationObserver protocol methods - (void)didEnumerateItems:(NSArray> *)updatedItems { + NSMutableSet> * const existingItems = self.materialisedItems.mutableCopy; + for (const id item in updatedItems) { NSLog(@"StorageUseEnumerationObserver: Enumerating %@ with size %llu", item.filename, item.documentSize.unsignedLongLongValue); _usage += item.documentSize.unsignedLongLongValue; + [existingItems addObject:item]; } + + _materialisedItems = existingItems.copy; } - (void)finishEnumeratingWithError:(NSError *)error