diff --git a/Vector/Model/RoomList/RecentsDataSource.m b/Vector/Model/RoomList/RecentsDataSource.m index d3d6d8bea..fe928376f 100644 --- a/Vector/Model/RoomList/RecentsDataSource.m +++ b/Vector/Model/RoomList/RecentsDataSource.m @@ -209,48 +209,31 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - id roomData = [self cellDataAtIndexPath:indexPath]; - if (roomData && self.delegate) + UITableViewCell* cell = [super tableView:tableView cellForRowAtIndexPath:indexPath]; + + + // on invite cell, add listeners on accept / reject buttons + if (cell && [cell isKindOfClass:[InviteRecentTableViewCell class]]) { - NSString *cellIdentifier = [self.delegate cellReuseIdentifierForCellData:roomData]; - - if (cellIdentifier) - { - UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier forIndexPath:indexPath]; - - // Make the bubble display the data - [cell render:roomData]; - - // Clear the user flag, if only one recents list is available - if (displayedRecentsDataSourceArray.count == 1 && [cell isKindOfClass:[MXKInterleavedRecentTableViewCell class]]) + id roomData = [self cellDataAtIndexPath:indexPath]; + InviteRecentTableViewCell* inviteRecentTableViewCell = (InviteRecentTableViewCell*)cell; + + inviteRecentTableViewCell.onRejectClick = ^(){ + if (self.onRoomInvitationReject) { - ((MXKInterleavedRecentTableViewCell*)cell).userFlag.backgroundColor = [UIColor clearColor]; + self.onRoomInvitationReject(roomData.roomDataSource.room); } - - // on invite cell, add listeners on accept / reject buttons - if ([cell isKindOfClass:[InviteRecentTableViewCell class]]) + }; + + inviteRecentTableViewCell.onJoinClick = ^(){ + if (self.onRoomInvitationAccept) { - InviteRecentTableViewCell* inviteRecentTableViewCell = (InviteRecentTableViewCell*)cell; - - inviteRecentTableViewCell.onRejectClick = ^(){ - if (self.onRoomInvitationReject) - { - self.onRoomInvitationReject(roomData.roomDataSource.room); - } - }; - - inviteRecentTableViewCell.onJoinClick = ^(){ - if (self.onRoomInvitationAccept) - { - self.onRoomInvitationAccept(roomData.roomDataSource.room); - } - }; + self.onRoomInvitationAccept(roomData.roomDataSource.room); } - - return cell; - } + }; } - return nil; + + return cell; } - (id)cellDataAtIndexPath:(NSIndexPath *)indexPath diff --git a/Vector/Utils/VectorDesignValues.h b/Vector/Utils/VectorDesignValues.h index 06f66fce7..80078945c 100644 --- a/Vector/Utils/VectorDesignValues.h +++ b/Vector/Utils/VectorDesignValues.h @@ -17,7 +17,7 @@ // the green text color #define VECTOR_GREEN_COLOR [UIColor colorWithRed:(98.0/256.0) green:(206.0/256.0) blue:(156.0/256.0) alpha:1.0] -#define VECTOR_TEXT_GRAY_COLOR [UIColor colorWithRed:(164.0 / 256.0) green:(164.0 / 256.0) blue:(164.0 / 256.0) alpha:1.0] +#define VECTOR_TEXT_GRAY_COLOR [UIColor colorWithRed:(157.0 / 256.0) green:(157.0 / 256.0) blue:(157.0 / 256.0) alpha:1.0] #define VECTOR_LIGHT_GRAY_COLOR [UIColor colorWithRed:(242.0 / 256.0) green:(242.0 / 256.0) blue:(242.0 / 256.0) alpha:1.0] diff --git a/Vector/ViewController/RecentsViewController.m b/Vector/ViewController/RecentsViewController.m index 3e26aaca4..f3c3c07db 100644 --- a/Vector/ViewController/RecentsViewController.m +++ b/Vector/ViewController/RecentsViewController.m @@ -440,27 +440,17 @@ static NSMutableDictionary* backgroundByImageNameDict; - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - if (self.delegate) + UITableViewCell* cell = [self.recentsTableView cellForRowAtIndexPath:indexPath]; + + if ([cell isKindOfClass:[InviteRecentTableViewCell class]]) { - id cellData = [self.dataSource cellDataAtIndexPath:indexPath]; - - // the invited rooms cannot be selected. - // the invitation is accepted / rejected with dedicated buttons inside the cell. - // cell.userInteractionEnabled = NO would also disable the button so - // the cell selection is trapped. - if (NSNotFound == [cellData.recentsDataSource.mxSession.invitedRooms indexOfObject:cellData.roomDataSource.room]) - { - [self.delegate recentListViewController:self didSelectRoom:cellData.roomDataSource.roomId inMatrixSession:cellData.roomDataSource.mxSession]; - } + // hide the selection + [tableView deselectRowAtIndexPath:indexPath animated:NO]; + } + else + { + [super tableView:tableView didSelectRowAtIndexPath:indexPath]; } - - // Hide the keyboard when user select a room - // do not hide the searchBar until the view controller disappear - // on tablets / iphone 6+, the user could expect to search again while looking at a room - [self.recentsSearchBar resignFirstResponder]; - - // hide the selection - [tableView deselectRowAtIndexPath:indexPath animated:NO]; } #pragma mark - Actions