Commit ebd6ae44 authored by Tobias's avatar Tobias

Add property to enabled and disable spotlight indexing.

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