Commit 686ea0f9 authored by Tobias's avatar Tobias

use CS_ENABELED define and check for TARGET_OS_WATCH

parent 213b787c
......@@ -26,10 +26,11 @@
*****************************************************************************/
#import <CoreData/CoreData.h>
#if TARGET_OS_IPHONE
#ifndef MLKIT_READONLY_TARGET
#if CS_ENABLED
#import <CoreSpotlight/CoreSpotlight.h>
#endif
#if TARGET_OS_IPHONE
@class UIImage;
#endif
@class MLShowEpisode;
......@@ -87,9 +88,10 @@ extern NSString *const MLFileThumbnailWasUpdated;
@property (nonatomic, strong) NSString *genre;
@property (nonatomic, strong) MLAlbumTrack *albumTrack;
@property (nonatomic, strong) NSString *thumbnailName;
#if TARGET_OS_IPHONE
- (void)setComputedThumbnailScaledForDevice:(UIImage *)thumbnail;
@property (nonatomic, strong) UIImage *computedThumbnail;
#endif
@property (nonatomic, assign) BOOL isSafe;
@property (nonatomic, assign) BOOL isBeingParsed;
@property (nonatomic, assign) BOOL thumbnailTimeouted;
......@@ -127,12 +129,10 @@ extern NSString *const MLFileThumbnailWasUpdated;
- (size_t)fileSizeInBytes;
#if TARGET_OS_IPHONE
#ifndef MLKIT_READONLY_TARGET
#if CS_ENABLED
- (CSSearchableItemAttributeSet *)coreSpotlightAttributeSet;
- (void)updateCoreSpotlightEntry;
#endif
#endif
@end
......
......@@ -20,6 +20,9 @@
* 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>
......
......@@ -40,8 +40,10 @@
#import <UIKit/UIKit.h>
#ifndef MLKIT_READONLY_TARGET
#if !TARGET_OS_WATCH
#import <MobileVLCKit/MobileVLCKit.h>
#endif
#endif
#else
#define HAVE_BLOCK 1
......
......@@ -415,8 +415,7 @@ NSString *const MLFileThumbnailWasUpdated = @"MLFileThumbnailWasUpdated";
return [fileSize unsignedLongLongValue];
}
#if TARGET_OS_IPHONE
#ifndef MLKIT_READONLY_TARGET
#if CS_ENABLED
- (CSSearchableItemAttributeSet *)coreSpotlightAttributeSet
{
if (!SYSTEM_RUNS_IOS9)
......@@ -497,6 +496,5 @@ NSString *const MLFileThumbnailWasUpdated = @"MLFileThumbnailWasUpdated";
}
}
#endif
#endif
@end
......@@ -296,7 +296,7 @@
@catch (NSException *exception) {
APLog(@"failed to set that we fetch info for the file");
}
#if TARGET_OS_IPHONE
#if CS_ENABLED
[file updateCoreSpotlightEntry];
#endif
......
......@@ -39,11 +39,9 @@
#import "MLMediaLibrary+Migration.h"
#import <sys/sysctl.h> // for sysctlbyname
#if TARGET_OS_IPHONE
#ifndef MLKIT_READONLY_TARGET
#if CS_ENABLED
#import <CoreSpotlight/CoreSpotlight.h>
#endif
#endif
#if HAVE_BLOCK
#import "MLMovieInfoGrabber.h"
......@@ -185,7 +183,7 @@ static NSString *kDecrapifyTitles = @"MLDecrapifyTitles";
if (_managedObjectModel)
return _managedObjectModel;
NSString *path = [[NSBundle mainBundle] pathForResource:@"MediaLibrary" ofType:@"momd"];
NSString *path = [[NSBundle bundleForClass:self.class] pathForResource:@"MediaLibrary" ofType:@"momd"];
NSURL *momURL = [NSURL fileURLWithPath:path];
_managedObjectModel = [[NSManagedObjectModel alloc] initWithContentsOfURL:momURL];
......@@ -848,7 +846,7 @@ static NSString *kDecrapifyTitles = @"MLDecrapifyTitles";
[show removeEpisode:file.showEpisode];
}
}
#if TARGET_OS_IPHONE
#if CS_ENABLED
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 TARGET_OS_IPHONE
#if CS_ENABLED
[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