瀏覽代碼

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

Signed-off-by: Felix Paul Kühne <fkuehne@videolan.org>
Alessio Pollero 9 年之前
父節點
當前提交
d5b71e51b3
共有 1 個文件被更改,包括 8 次插入2 次删除
  1. 8 2
      Apple-TV/VLCOpenNetworkStreamTVViewController.m

+ 8 - 2
Apple-TV/VLCOpenNetworkStreamTVViewController.m

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