Commit ebd6ae44 authored by Tobias's avatar Tobias

Add property to enabled and disable spotlight indexing.

parent a3b52623
......@@ -42,6 +42,9 @@
// default is group.org.videolan.vlc-ios
@property (nonatomic, copy) NSString *applicationGroupIdentifier;
#if TARGET_OS_IOS
@property (nonatomic, getter = isSpotlightIndexingEnabled) BOOL spotlightIndexingEnabled;
#endif
+ (id)sharedMediaLibrary;
- (BOOL)libraryMigrationNeeded;
......
......@@ -484,7 +484,7 @@ NSString *const MLFileThumbnailWasUpdated = @"MLFileThumbnailWasUpdated";
- (void)updateCoreSpotlightEntry
{
if (SYSTEM_RUNS_IOS9) {
if ([CSSearchableIndex class] && [CSSearchableIndex isIndexingAvailable]) {
/* create final CS item, which will replace the earlier entity */
CSSearchableItemAttributeSet *attributeSet = [self coreSpotlightAttributeSet];
......
......@@ -297,7 +297,9 @@
APLog(@"failed to set that we fetch info for the file");
}
#if TARGET_OS_IOS
if ([[MLMediaLibrary sharedMediaLibrary] isSpotlightIndexingEnabled]) {
[file updateCoreSpotlightEntry];
}
#endif
[self endParsing];
......
......@@ -913,7 +913,7 @@ static NSString *kDecrapifyTitles = @"MLDecrapifyTitles";
if (thumbExists)
[fileManager removeItemAtPath:thumbPath error:nil];
if (SYSTEM_RUNS_IOS9) {
if ([CSSearchableIndex class]) {
/* remove file from CoreSpotlight */
[[CSSearchableIndex defaultSearchableIndex] deleteSearchableItemsWithIdentifiers:@[file.objectID.URIRepresentation.absoluteString]
completionHandler:^(NSError * __nullable error) {
......
......@@ -137,7 +137,9 @@
if (thumbnailImage) {
file.computedThumbnail = [UIImage imageWithCGImage:thumbnail];
#if TARGET_OS_IOS
if ([[MLMediaLibrary sharedMediaLibrary] isSpotlightIndexingEnabled]) {
[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