From 057996c90a81016c063e3e3e135f1d3a2fcd6f6a Mon Sep 17 00:00:00 2001 From: Frikkie Snyman Date: Fri, 15 Nov 2019 11:22:02 +0100 Subject: [PATCH] Make it null if nil --- ios/RNPhotosFramework/PHCollectionService.m | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/ios/RNPhotosFramework/PHCollectionService.m b/ios/RNPhotosFramework/PHCollectionService.m index 6dba39d..ece85ee 100644 --- a/ios/RNPhotosFramework/PHCollectionService.m +++ b/ios/RNPhotosFramework/PHCollectionService.m @@ -133,7 +133,7 @@ +(NSMutableDictionary *)generateAlbumsResponseFromParams:(NSDictionary *)params + (NSMutableDictionary *)generateAlbumResponseFromCollection:(PHCollection *)collection numberOfPreviewAssets:(int)numberOfPreviewAssets countType:(RNPFAssetCountType)countType includeMetadata:(BOOL)includeMetadata includeResourcesMetadata:(BOOL)resourcesMetadata cacheAssets:(BOOL)cacheAssets assetFetchParams:(NSDictionary *)assetFetchParams { NSMutableDictionary *albumDictionary = [NSMutableDictionary new]; - + if([collection isKindOfClass:[PHAssetCollection class]]) { PHAssetCollection *phAssetCollection = (PHAssetCollection *)collection; PHAssetCollectionType albumType = [phAssetCollection assetCollectionType]; @@ -186,12 +186,8 @@ + (NSMutableDictionary *)generateAlbumResponseFromCollection:(PHCollection *)col } } - - NSString *title = collection.localizedTitle; - if (!title) { - title = @"Unknown"; - } - [albumDictionary setObject:title forKey:@"title"]; + + [albumDictionary setObject:ObjectOrNull(collection.localizedTitle) forKey:@"title"]; [albumDictionary setObject:collection.localIdentifier forKey:@"localIdentifier"]; NSMutableArray *permittedOperations = [NSMutableArray arrayWithCapacity:7];