mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-05-01 05:36:57 +02:00
room_members_search
Add a dedicated delete button instead of the sliding menu.
This commit is contained in:
@@ -18,6 +18,10 @@
|
||||
|
||||
#import "AppDelegate.h"
|
||||
|
||||
#import "VectorContactTableViewCell.h"
|
||||
|
||||
#import "VectorDesignValues.h"
|
||||
|
||||
@interface RoomCreationStep2ViewController ()
|
||||
{
|
||||
UIBarButtonItem *createBarButtonItem;
|
||||
@@ -102,8 +106,70 @@
|
||||
super.isAddParticipantSearchBarEditing = isAddParticipantSearchBarEditing;
|
||||
}
|
||||
|
||||
#pragma mark - UITableView delegate
|
||||
|
||||
- (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
return [[NSMutableArray alloc] init];
|
||||
}
|
||||
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
UITableViewCell *cell = [super tableView:tableView cellForRowAtIndexPath:indexPath];
|
||||
|
||||
if ([cell isKindOfClass:[VectorContactTableViewCell class]])
|
||||
{
|
||||
cell.accessoryView = nil;
|
||||
|
||||
if (indexPath.section == participantsSection)
|
||||
{
|
||||
if (!userMatrixId || (indexPath.row != 0))
|
||||
{
|
||||
UIImageView* accessView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 24, 24)];
|
||||
accessView.image = [UIImage imageNamed:@"remove_icon"];
|
||||
accessView.tag = indexPath.row;
|
||||
accessView.userInteractionEnabled = YES;
|
||||
|
||||
UITapGestureRecognizer * accessViewTapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onDeleteTap:)];
|
||||
[accessViewTapGesture setNumberOfTouchesRequired:1];
|
||||
[accessViewTapGesture setNumberOfTapsRequired:1];
|
||||
[accessView addGestureRecognizer:accessViewTapGesture];
|
||||
|
||||
cell.accessoryView = accessView;
|
||||
}
|
||||
|
||||
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
}
|
||||
else
|
||||
{
|
||||
cell.selectionStyle = UITableViewCellSelectionStyleDefault;
|
||||
}
|
||||
}
|
||||
|
||||
return cell;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#pragma mark - Actions
|
||||
|
||||
- (void)onDeleteTap:(UIGestureRecognizer*)gestureRecognizer
|
||||
{
|
||||
NSInteger row = gestureRecognizer.view.tag;
|
||||
|
||||
if (userMatrixId)
|
||||
{
|
||||
row --;
|
||||
}
|
||||
|
||||
if (row < mutableParticipants.count)
|
||||
{
|
||||
[mutableParticipants removeObjectAtIndex:row];
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction)onButtonPressed:(id)sender
|
||||
{
|
||||
if (sender == createBarButtonItem && _roomCreationInputs.mxSession)
|
||||
|
||||
Reference in New Issue
Block a user