mirror of
https://github.com/vector-im/element-ios.git
synced 2024-09-28 23:32:41 +00:00
Bug Fix Folks expect hitting 'done' when entering an mxid to invite, rather than having to hit +
#487
This commit is contained in:
parent
c0c5215de9
commit
7a8620550f
3 changed files with 44 additions and 2 deletions
|
@ -75,6 +75,10 @@
|
|||
@property (weak, nonatomic) IBOutlet UISearchBar *searchBarView;
|
||||
@property (weak, nonatomic) IBOutlet UIView *searchBarHeaderBorder;
|
||||
|
||||
|
||||
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *searchBarTopConstraint;
|
||||
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *tableViewBottomConstraint;
|
||||
|
||||
/**
|
||||
A matrix room (nil by default).
|
||||
*/
|
||||
|
|
|
@ -100,6 +100,27 @@
|
|||
[[[self class] nib] instantiateWithOwner:self options:nil];
|
||||
}
|
||||
|
||||
// Adjust Top and Bottom constraints to take into account potential navBar and tabBar.
|
||||
[NSLayoutConstraint deactivateConstraints:@[_searchBarTopConstraint, _tableViewBottomConstraint]];
|
||||
|
||||
_searchBarTopConstraint = [NSLayoutConstraint constraintWithItem:self.topLayoutGuide
|
||||
attribute:NSLayoutAttributeBottom
|
||||
relatedBy:NSLayoutRelationEqual
|
||||
toItem:self.searchBarHeader
|
||||
attribute:NSLayoutAttributeTop
|
||||
multiplier:1.0f
|
||||
constant:0.0f];
|
||||
|
||||
_tableViewBottomConstraint = [NSLayoutConstraint constraintWithItem:self.bottomLayoutGuide
|
||||
attribute:NSLayoutAttributeTop
|
||||
relatedBy:NSLayoutRelationEqual
|
||||
toItem:self.tableView
|
||||
attribute:NSLayoutAttributeBottom
|
||||
multiplier:1.0f
|
||||
constant:0.0f];
|
||||
|
||||
[NSLayoutConstraint activateConstraints:@[_searchBarTopConstraint, _tableViewBottomConstraint]];
|
||||
|
||||
// Setup `MXKViewControllerHandling` properties
|
||||
self.defaultBarTintColor = kVectorNavBarTintColor;
|
||||
self.enableBarTintColorStatusChange = NO;
|
||||
|
@ -1668,8 +1689,23 @@
|
|||
|
||||
- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar
|
||||
{
|
||||
// "Done" key has been pressed. Cancel the invitation process
|
||||
[self searchBarCancelButtonClicked:searchBar];
|
||||
// "Done" key has been pressed.
|
||||
|
||||
// Check whether the current search input is a valid email or a Matrix user ID
|
||||
if (currentSearchText.length && ([MXTools isEmailAddress:currentSearchText] || [MXTools isMatrixUserIdentifier:currentSearchText]))
|
||||
{
|
||||
// Select this contact rather than having to hit +
|
||||
MXKContact *contact = invitableContacts[0];
|
||||
|
||||
// Sanity check
|
||||
if (contact)
|
||||
{
|
||||
[self didSelectInvitableContact:contact];
|
||||
}
|
||||
}
|
||||
|
||||
// Dismiss keyboard
|
||||
[_searchBarView resignFirstResponder];
|
||||
}
|
||||
|
||||
- (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar
|
||||
|
|
|
@ -9,8 +9,10 @@
|
|||
<connections>
|
||||
<outlet property="searchBarHeader" destination="Zm7-AB-ZtE" id="6ee-P0-twi"/>
|
||||
<outlet property="searchBarHeaderBorder" destination="gcy-W7-89G" id="tsy-SP-KaJ"/>
|
||||
<outlet property="searchBarTopConstraint" destination="sUb-hD-qXJ" id="rzi-JJ-nnP"/>
|
||||
<outlet property="searchBarView" destination="bsq-3U-VjV" id="x3M-wX-RW8"/>
|
||||
<outlet property="tableView" destination="kNf-Ll-jvH" id="uzM-uQ-peQ"/>
|
||||
<outlet property="tableViewBottomConstraint" destination="jLY-ml-Psl" id="Q2b-sC-Yqn"/>
|
||||
<outlet property="view" destination="iN0-l3-epB" id="csR-cn-S4h"/>
|
||||
</connections>
|
||||
</placeholder>
|
||||
|
|
Loading…
Reference in a new issue