Room Details: Add 'Files' tab

Display now the index of room files
This commit is contained in:
giomfo
2016-10-12 12:03:39 +02:00
parent b6a934d5f9
commit 4a96bb84fc
8 changed files with 284 additions and 18 deletions
@@ -0,0 +1,123 @@
/*
Copyright 2016 OpenMarket Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#import "RoomFilesViewController.h"
#import "FilesSearchTableViewCell.h"
#import "AppDelegate.h"
#import "VectorDesignValues.h"
#import "RageShakeManager.h"
@implementation RoomFilesViewController
#pragma mark -
- (instancetype)initWithNibName:(nullable NSString *)nibNameOrNil bundle:(nullable NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self)
{
self.autoJoinInvitedRoom = NO;
}
return self;
}
- (nullable instancetype)initWithCoder:(NSCoder *)aDecoder
{
self = [super initWithCoder:aDecoder];
if (self)
{
self.autoJoinInvitedRoom = NO;
}
return self;
}
#pragma mark -
- (void)viewDidLoad
{
[super viewDidLoad];
// Do not show toolbar
[self setRoomInputToolbarViewClass:nil];
// Update the inputToolBar height
[UIView setAnimationsEnabled:NO];
[self roomInputToolbarView:self.inputToolbarView heightDidChanged:0 completion:nil];
[UIView setAnimationsEnabled:YES];
// set the default extra
[self setRoomActivitiesViewClass:nil];
self.defaultBarTintColor = kVectorNavBarTintColor;
self.enableBarTintColorStatusChange = NO;
// Register first customized cell view classes used to render bubbles
[self.bubblesTableView registerClass:FilesSearchTableViewCell.class forCellReuseIdentifier:FilesSearchTableViewCell.defaultReuseIdentifier];
}
#pragma mark - MXKDataSourceDelegate
- (Class<MXKCellRendering>)cellViewClassForCellData:(MXKCellData*)cellData
{
Class cellViewClass = nil;
// Sanity check
if ([cellData conformsToProtocol:@protocol(MXKRoomBubbleCellDataStoring)])
{
id<MXKRoomBubbleCellDataStoring> bubbleData = (id<MXKRoomBubbleCellDataStoring>)cellData;
// Select the suitable table view cell class
if (bubbleData.attachment)
{
cellViewClass = FilesSearchTableViewCell.class;
}
}
return cellViewClass;
}
- (NSString *)cellReuseIdentifierForCellData:(MXKCellData*)cellData
{
Class class = [self cellViewClassForCellData:cellData];
if ([class respondsToSelector:@selector(defaultReuseIdentifier)])
{
return [class defaultReuseIdentifier];
}
return nil;
}
#pragma mark - UITableView delegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if (tableView == self.bubblesTableView)
{
UITableViewCell *cell = [self.bubblesTableView cellForRowAtIndexPath:indexPath];
[self showAttachmentInCell:cell];
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
}
@end