Commit cea292d5 authored by Felix Paul Kühne's avatar Felix Paul Kühne

fix corespotlight integration

parent 686ea0f9
......@@ -26,7 +26,7 @@
*****************************************************************************/
#import <CoreData/CoreData.h>
#if CS_ENABLED
#if TARGET_OS_IOS
#import <CoreSpotlight/CoreSpotlight.h>
#endif
#if TARGET_OS_IPHONE
......@@ -129,7 +129,7 @@ extern NSString *const MLFileThumbnailWasUpdated;
- (size_t)fileSizeInBytes;
#if CS_ENABLED
#if TARGET_OS_IOS
- (CSSearchableItemAttributeSet *)coreSpotlightAttributeSet;
- (void)updateCoreSpotlightEntry;
#endif
......
......@@ -20,9 +20,6 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#define CS_ENABLED TARGET_OS_IPHONE && !TARGET_OS_WATCH && !MLKIT_READONLY_TARGET
#import <MediaLibraryKit/MLFile.h>
#import <MediaLibraryKit/MLLabel.h>
#import <MediaLibraryKit/MLMediaLibrary.h>
......@@ -30,6 +27,7 @@
#import <MediaLibraryKit/MLShowEpisode.h>
#import <MediaLibraryKit/MLAlbum.h>
#import <MediaLibraryKit/MLAlbumTrack.h>
#import <MediaLibraryKit/MLThumbnailerQueue.h>
@class MLFile;
@class MLLabel;
......
......@@ -412,10 +412,10 @@ NSString *const MLFileThumbnailWasUpdated = @"MLFileThumbnailWasUpdated";
NSFileManager *manager = [NSFileManager defaultManager];
NSDictionary *fileAttributes = [manager attributesOfItemAtPath:[self.url path] error:nil];
NSNumber *fileSize = fileAttributes[NSFileSize];
return [fileSize unsignedLongLongValue];
return [fileSize unsignedLongValue];
}
#if CS_ENABLED
#if TARGET_OS_IOS
- (CSSearchableItemAttributeSet *)coreSpotlightAttributeSet
{
if (!SYSTEM_RUNS_IOS9)
......
......@@ -296,7 +296,7 @@
@catch (NSException *exception) {
APLog(@"failed to set that we fetch info for the file");
}
#if CS_ENABLED
#if TARGET_OS_IOS
[file updateCoreSpotlightEntry];
#endif
......
......@@ -39,7 +39,7 @@
#import "MLMediaLibrary+Migration.h"
#import <sys/sysctl.h> // for sysctlbyname
#if CS_ENABLED
#if TARGET_OS_IOS
#import <CoreSpotlight/CoreSpotlight.h>
#endif
......@@ -303,7 +303,7 @@ static NSString *kDecrapifyTitles = @"MLDecrapifyTitles";
if (_managedObjectContext)
return _managedObjectContext;
_managedObjectContext = [[NSManagedObjectContext alloc] init];
_managedObjectContext = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSMainQueueConcurrencyType];
[_managedObjectContext setPersistentStoreCoordinator:self.persistentStoreCoordinator];
if (_managedObjectContext.persistentStoreCoordinator == nil)
return nil;
......@@ -846,7 +846,7 @@ static NSString *kDecrapifyTitles = @"MLDecrapifyTitles";
[show removeEpisode:file.showEpisode];
}
}
#if CS_ENABLED
#if TARGET_OS_IOS
NSString *thumbPath = [file thumbnailPath];
bool thumbExists = [fileManager fileExistsAtPath:thumbPath];
if (thumbExists)
......
......@@ -134,7 +134,7 @@
UIImage *thumbnailImage = [UIImage imageWithCGImage:thumbnail];
if (thumbnailImage) {
file.computedThumbnail = [UIImage imageWithCGImage:thumbnail];
#if CS_ENABLED
#if TARGET_OS_IOS
[file updateCoreSpotlightEntry];
#endif
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment