Search result display: Display the result in a RoomVC from RoomSearchVC

This commit is contained in:
manuroe
2016-03-02 11:52:35 +01:00
parent c55221853e
commit bc99b74051
2 changed files with 67 additions and 3 deletions
@@ -19,13 +19,25 @@
#import "UIViewController+VectorSearch.h"
// Use RoomViewController cells to display results
#import "RoomBubbleCellData.h"
#import "RoomIncomingAttachmentBubbleCell.h"
#import "RoomIncomingTextMsgBubbleCell.h"
#import "RoomViewController.h"
#import "RoomDataSource.h"
#import "VectorDesignValues.h"
#import "RageShakeManager.h"
@interface RoomSearchViewController ()
{
// The event selected in the search results
MXEvent *selectedEvent;
}
@end
@implementation RoomSearchViewController
- (void)viewDidLoad
@@ -132,4 +144,32 @@
return [super tableView:tableView heightForRowAtIndexPath:indexPath] + 1;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
// Data in the cells are actually Vector RoomBubbleCellData
RoomBubbleCellData *cellData = (RoomBubbleCellData*)[self.dataSource cellDataAtIndex:indexPath.row];
selectedEvent = cellData.bubbleComponents[0].event;
// Open the RoomViewController
[self performSegueWithIdentifier:@"showTimeline" sender:self];
}
#pragma mark - Segues
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
[super prepareForSegue:segue sender:sender];
if ([[segue identifier] isEqualToString:@"showTimeline"])
{
RoomViewController *roomViewController = segue.destinationViewController;
RoomDataSource *roomDataSource = [[RoomDataSource alloc] initWithRoomId:selectedEvent.roomId andInitialEventId:selectedEvent.eventId andMatrixSession:self.dataSource.mxSession];
[roomDataSource finalizeInitialization];
[roomViewController displayRoom:roomDataSource];
}
}
@end