Commit d5b71e51 authored by Alessio Pollero's avatar Alessio Pollero Committed by Felix Paul Kühne

Fix missing title inside Apple TV Network Stream List (refs #16976)

Signed-off-by: Felix Paul Kühne's avatarFelix Paul Kühne <fkuehne@videolan.org>
parent 125060fd
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
@interface VLCOpenNetworkStreamTVViewController () @interface VLCOpenNetworkStreamTVViewController ()
{ {
NSMutableArray *_recentURLs; NSMutableArray *_recentURLs;
NSMutableDictionary *_recentURLTitles;
} }
@property (nonatomic) NSIndexPath *currentlyFocusedIndexPath; @property (nonatomic) NSIndexPath *currentlyFocusedIndexPath;
@end @end
...@@ -62,14 +63,17 @@ ...@@ -62,14 +63,17 @@
/* fetch data from cloud */ /* fetch data from cloud */
_recentURLs = [NSMutableArray arrayWithArray:[ubiquitousKeyValueStore arrayForKey:kVLCRecentURLs]]; _recentURLs = [NSMutableArray arrayWithArray:[ubiquitousKeyValueStore arrayForKey:kVLCRecentURLs]];
_recentURLTitles = [NSMutableDictionary dictionaryWithDictionary:[ubiquitousKeyValueStore dictionaryForKey:kVLCRecentURLTitles]];
[self.previouslyPlayedStreamsTableView reloadData]; [self.previouslyPlayedStreamsTableView reloadData];
[super viewWillAppear:animated];
} }
- (void)ubiquitousKeyValueStoreDidChange:(NSNotification *)notification - (void)ubiquitousKeyValueStoreDidChange:(NSNotification *)notification
{ {
/* TODO: don't blindly trust that the Cloud knows best */ /* TODO: don't blindly trust that the Cloud knows best */
_recentURLs = [NSMutableArray arrayWithArray:[[NSUbiquitousKeyValueStore defaultStore] arrayForKey:kVLCRecentURLs]]; _recentURLs = [NSMutableArray arrayWithArray:[[NSUbiquitousKeyValueStore defaultStore] arrayForKey:kVLCRecentURLs]];
_recentURLTitles = [NSMutableDictionary dictionaryWithDictionary:[[NSUbiquitousKeyValueStore defaultStore] dictionaryForKey:kVLCRecentURLTitles]];
[self.previouslyPlayedStreamsTableView reloadData]; [self.previouslyPlayedStreamsTableView reloadData];
} }
...@@ -88,9 +92,11 @@ ...@@ -88,9 +92,11 @@
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"RecentlyPlayedURLsTableViewCell"]; cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"RecentlyPlayedURLsTableViewCell"];
} }
NSString *content = _recentURLs[indexPath.row]; NSString *content = [_recentURLs[indexPath.row] stringByRemovingPercentEncoding];
cell.textLabel.text = [content lastPathComponent]; NSString *possibleTitle = _recentURLTitles[[@(indexPath.row) stringValue]];
cell.detailTextLabel.text = content; cell.detailTextLabel.text = content;
cell.textLabel.text = (possibleTitle != nil) ? possibleTitle : [content lastPathComponent];
return cell; return cell;
} }
......
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