Skip to content

Commit

Permalink
Prepare #904: Improve the people invite screens
Browse files Browse the repository at this point in the history
- Make `RoomParticipantsViewController` inherit of the new class `ContactsTableViewController` to handle room members.
  • Loading branch information
giomfo committed Jan 11, 2017
1 parent 5f34edb commit 3b34e17
Show file tree
Hide file tree
Showing 6 changed files with 388 additions and 567 deletions.
2 changes: 2 additions & 0 deletions Vector/Assets/en.lproj/Vector.strings
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
"room_creation_keep_private" = "Keep private";
"room_creation_make_private" = "Make private";
"room_creation_wait_for_creation" = "A room is already being created. Please wait.";
"room_creation_invite_another_user" = "Search / invite by name, email, id";

// Room recents
"room_recents_directory" = "DIRECTORY";
Expand Down Expand Up @@ -134,6 +135,7 @@
"room_participants_remove_prompt_msg" = "Are you sure you want to remove %@ from this chat?";
"room_participants_invite_prompt_title" = "Invite?";
"room_participants_invite_prompt_msg" = "Are you sure you want to invite %@ to this chat?";
"room_participants_filter_room_members" = "Filter room members";
"room_participants_invite_another_user" = "Search / invite by name, email, id";
"room_participants_invite_malformed_id_title" = "Invite Error";
"room_participants_invite_malformed_id" = "Malformed ID. Should be an email address or a Matrix ID like '@localpart:domain'";
Expand Down
11 changes: 2 additions & 9 deletions Vector/ViewController/ContactsTableViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,6 @@ - (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.

// Add each matrix session by default.
NSArray *sessions = [AppDelegate theDelegate].mxSessions;
for (MXSession *mxSession in sessions)
{
[self addMatrixSession:mxSession];
}
}

- (void)didReceiveMemoryWarning
Expand Down Expand Up @@ -170,7 +163,7 @@ - (void)searchWithPattern:(NSString *)searchText forceRefresh:(BOOL)forceRefresh
else if (forceRefresh || !searchProcessingText.length || [searchText hasPrefix:searchProcessingText] == NO)
{
// Retrieve all the local contacts
searchProcessingMatrixContacts = [self unfilteredLocalContactsArray];
searchProcessingLocalContacts = [self unfilteredLocalContactsArray];

// Retrieve all known matrix users
searchProcessingMatrixContacts = [self unfilteredMatrixContactsArray];
Expand Down Expand Up @@ -232,7 +225,7 @@ - (void)searchWithPattern:(NSString *)searchText forceRefresh:(BOOL)forceRefresh
[self refreshTableView];

// Force scroll to top
[self.tableView setContentOffset:CGPointMake(-self.tableView.contentInset.left, -self.tableView.contentInset.top) animated:YES];
[self.tableView setContentOffset:CGPointMake(-self.tableView.contentInset.left, -self.tableView.contentInset.top) animated:NO];
}
else
{
Expand Down
15 changes: 5 additions & 10 deletions Vector/ViewController/RoomParticipantsViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
limitations under the License.
*/

#import <MatrixKit/MatrixKit.h>
#import "ContactsTableViewController.h"

#import "SegmentedViewController.h"

Expand Down Expand Up @@ -42,17 +42,14 @@
'RoomParticipantsViewController' instance is used to edit members of the room defined by the property 'mxRoom'.
When this property is nil, the view controller is empty.
*/
@interface RoomParticipantsViewController : MXKViewController <UITableViewDelegate, UITableViewDataSource, UISearchBarDelegate, MXKRoomMemberDetailsViewControllerDelegate>
@interface RoomParticipantsViewController : ContactsTableViewController <UISearchBarDelegate, UIGestureRecognizerDelegate, MXKRoomMemberDetailsViewControllerDelegate>
{
@protected
/**
Section indexes
*/
NSInteger participantsSection;
NSInteger invitedSection;
NSInteger invitableSectionSearchInput;
NSInteger invitableSectionAddressBookContacts;
NSInteger invitableSectionMatrixContacts;

/**
The current list of joined members.
Expand All @@ -67,15 +64,13 @@
/**
The contact used to describe the current user (nil if the user is not a participant of the room).
*/
Contact *userContact;
Contact *userParticipant;
}

@property (weak, nonatomic) IBOutlet UITableView *tableView;
@property (weak, nonatomic) IBOutlet UIView *searchBarHeader;
@property (weak, nonatomic) IBOutlet UISearchBar *searchBarView;
@property (weak, nonatomic) IBOutlet UIView *searchBarHeaderBorder;


@property (weak, nonatomic) IBOutlet NSLayoutConstraint *searchBarTopConstraint;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *tableViewBottomConstraint;

Expand All @@ -85,9 +80,9 @@
@property (nonatomic) MXRoom *mxRoom;

/**
Tell whether a search session is in progress
Tell whether the inviting people screen is displaying
*/
@property (nonatomic) BOOL isAddParticipantSearchBarEditing;
@property (nonatomic) BOOL isAddParticipantScreenDisplaying;

/**
Enable mention option in member details view. NO by default
Expand Down

0 comments on commit 3b34e17

Please sign in to comment.