Commit 7fca7170 authored by Filipe's avatar Filipe Committed by Tobias

This fixes the logic for createSpotlightItem: when it's faced with an

MLShowEpisode

It is crashing, right now. This happens when several
video files get lumped into a tv show folder and the user tries to play
one of them, for example.
It also simplifies handling objects that aren't an MLFile, keeping the
behavior it already had.
Signed-off-by: Tobias's avatarTobias Conradi <videolan@tobias-conradi.de>
parent b4dc90c1
......@@ -310,17 +310,19 @@ static NSString *kUsingTableViewToShowData = @"UsingTableViewToShowData";
{
if ([CSSearchableItemAttributeSet class] != nil && [(VLCAppDelegate *)[UIApplication sharedApplication].delegate passcodeValidated]) {
self.userActivity = [[NSUserActivity alloc] initWithActivityType:kVLCUserActivityPlaying];
self.userActivity.title = ((MLFile *)mediaObject).title;
self.userActivity.userInfo = @{@"playingmedia":mediaObject.objectID.URIRepresentation};
MLFile *file = nil;
if ([mediaObject isKindOfClass:[MLAlbumTrack class]]) {
MLFile *file = [(MLAlbumTrack *)mediaObject anyFileFromTrack];
self.userActivity.contentAttributeSet = file.coreSpotlightAttributeSet;
file = [(MLAlbumTrack *)mediaObject anyFileFromTrack];
} else if ([mediaObject isKindOfClass:[MLShowEpisode class]]) {
MLFile *file = [(MLShowEpisode *)mediaObject anyFileFromEpisode];
self.userActivity.contentAttributeSet = file.coreSpotlightAttributeSet;
} else {
self.userActivity.contentAttributeSet = ((MLFile *)mediaObject).coreSpotlightAttributeSet;
file = [(MLShowEpisode *)mediaObject anyFileFromEpisode];
} else if ([mediaObject isKindOfClass:[MLFile class]]){
file = (MLFile *)mediaObject;
}
self.userActivity.title = file.title;
self.userActivity.contentAttributeSet = file.coreSpotlightAttributeSet;
self.userActivity.userInfo = @{@"playingmedia":mediaObject.objectID.URIRepresentation};
self.userActivity.eligibleForSearch = YES;
self.userActivity.eligibleForHandoff = YES;
//self.userActivity.contentUserAction = NSUserActivityContentUserActionPlay;
......
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