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

library view controller: return early and don't set the activity if MLKit...

library view controller: return early and don't set the activity if MLKit fails to provide a media URI description
parent 8928c3d7
......@@ -354,6 +354,11 @@ static NSString *kUsingTableViewToShowData = @"UsingTableViewToShowData";
- (void)createSpotlightItem:(nonnull NSManagedObject *)mediaObject
{
if (![VLCKeychainCoordinator passcodeLockEnabled]) {
NSURL *uriRepresentation = mediaObject.objectID.URIRepresentation;
if (uriRepresentation == nil) {
return;
}
self.userActivity = [[NSUserActivity alloc] initWithActivityType:kVLCUserActivityPlaying];
MLFile *file = nil;
......@@ -364,14 +369,10 @@ static NSString *kUsingTableViewToShowData = @"UsingTableViewToShowData";
} else if ([mediaObject isKindOfClass:[MLFile class]]){
file = (MLFile *)mediaObject;
}
self.userActivity.title = file.title;
self.userActivity.contentAttributeSet = file.coreSpotlightAttributeSet;
NSURL *uriRepresentation = mediaObject.objectID.URIRepresentation;
if (uriRepresentation != nil) {
self.userActivity.userInfo = @{ @"playingmedia": uriRepresentation};
}
self.userActivity.userInfo = @{ @"playingmedia": uriRepresentation};
self.userActivity.eligibleForSearch = YES;
self.userActivity.eligibleForHandoff = YES;
[self.userActivity becomeCurrent];
......
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