Skip to content

Commit

Permalink
swift fixes mirrored in objc
Browse files Browse the repository at this point in the history
Change-Id: Ib50b83d29664863c0d4f52fe50f5194fe48348be
ulukaya committed Mar 9, 2017
1 parent 8c4c7c8 commit 66766ec
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Classes/MediaItem.h
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@
@property(nonatomic, strong, readonly) NSURL *imageURL;
/** The list of child items, if any. If this is not a group, this will be an
* empty array. */
@property(nonatomic, strong, readonly) NSMutableArray *items;
@property(nonatomic, strong, readonly) NSMutableArray *children;
/** If this is a media item, the media information object. */
@property(nonatomic, strong, readonly) GCKMediaInformation *mediaInfo;
/** The parent item of this item, or <code>nil</code> if this is the root item.
4 changes: 2 additions & 2 deletions Classes/MediaItem.m
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ @interface MediaItem ()

@property(nonatomic, strong, readwrite) NSString *title;
@property(nonatomic, strong, readwrite) NSURL *imageURL;
@property(nonatomic, strong, readwrite) NSMutableArray *items;
@property(nonatomic, strong, readwrite) NSMutableArray *children;
@property(nonatomic, strong, readwrite) GCKMediaInformation *mediaInfo;
@property(nonatomic, strong, readwrite) MediaItem *parent;
@property(nonatomic, assign, readwrite) BOOL nowPlaying;
@@ -34,7 +34,7 @@ - (instancetype)initWithTitle:(NSString *)title
parent:(MediaItem *)parent {
if (self = [super init]) {
_title = title;
_items = [[NSMutableArray alloc] init];
_children = [[NSMutableArray alloc] init];
_imageURL = imageURL;
_parent = parent;
}
2 changes: 1 addition & 1 deletion Classes/MediaListModel.m
Original file line number Diff line number Diff line change
@@ -315,7 +315,7 @@ - (void)decodeItemListFromArray:(NSArray *)array

MediaItem *childItem =
[[MediaItem alloc] initWithMediaInformation:mediaInfo parent:item];
[item.items addObject:childItem];
[item.children addObject:childItem];
}
}

12 changes: 6 additions & 6 deletions Classes/MediaTableViewController.m
Original file line number Diff line number Diff line change
@@ -170,7 +170,7 @@ - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {

- (NSInteger)tableView:(UITableView *)tableView
numberOfRowsInSection:(NSInteger)section {
return (self.rootItem.items).count;
return (self.rootItem.children).count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView
@@ -179,7 +179,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView
[tableView dequeueReusableCellWithIdentifier:@"MediaCell"];

MediaItem *item =
(MediaItem *)(self.rootItem.items)[indexPath.row];
(MediaItem *)(self.rootItem.children)[indexPath.row];

NSString *detail = nil;
GCKMediaInformation *mediaInfo = item.mediaInfo;
@@ -266,7 +266,7 @@ - (IBAction)playButtonClicked:(id)sender {
NSIndexPath *indexPathForCell =
[self.tableView indexPathForCell:tableViewCell];
selectedItem =
(MediaItem *)(self.rootItem.items)[indexPathForCell.row];
(MediaItem *)(self.rootItem.children)[indexPathForCell.row];
BOOL hasConnectedCastSession =
[GCKCastContext sharedInstance].sessionManager.hasConnectedCastSession;
if (selectedItem.mediaInfo && hasConnectedCastSession) {
@@ -294,7 +294,7 @@ - (IBAction)playButtonClickedOld:(id)sender {
NSIndexPath *indexPathForCell =
[self.tableView indexPathForCell:tableViewCell];
selectedItem =
(MediaItem *)(self.rootItem.items)[indexPathForCell.row];
(MediaItem *)(self.rootItem.children)[indexPathForCell.row];
BOOL hasConnectedCastSession =
[GCKCastContext sharedInstance].sessionManager.hasConnectedCastSession;
if (selectedItem.mediaInfo && hasConnectedCastSession) {
@@ -317,7 +317,7 @@ - (IBAction)playButtonClickedOld:(id)sender {

- (void)tableView:(UITableView *)tableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
MediaItem *item = (self.rootItem.items)[indexPath.row];
MediaItem *item = (self.rootItem.children)[indexPath.row];

if (item.mediaInfo) {
[self performSegueWithIdentifier:@"mediaDetails" sender:self];
@@ -403,7 +403,7 @@ - (MediaItem *)getSelectedItem {
NSIndexPath *indexPath = (self.tableView).indexPathForSelectedRow;
if (indexPath) {
NSLog(@"selected row is %@", indexPath);
item = (MediaItem *)(self.rootItem.items)[indexPath.row];
item = (MediaItem *)(self.rootItem.children)[indexPath.row];
}
return item;
}

0 comments on commit 66766ec

Please sign in to comment.