mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-05-14 03:40:00 +02:00
Bug fix: Replace People with Members #51
This commit is contained in:
@@ -15,9 +15,7 @@
|
||||
*/
|
||||
|
||||
// Titles
|
||||
"recents" = "Messages";
|
||||
"accounts" = "Accounts";
|
||||
"account" = "Account";
|
||||
"title_recents" = "Messages";
|
||||
|
||||
// Actions
|
||||
"view" = "View";
|
||||
@@ -67,6 +65,11 @@
|
||||
"room_recents_low_priority" = "LOW PRIORITY";
|
||||
"room_recents_invites" = "INVITES";
|
||||
|
||||
// Search
|
||||
"search_rooms" = "Rooms";
|
||||
"search_messages" = "Messages";
|
||||
"search_people" = "People";
|
||||
|
||||
// Directory
|
||||
"directory_search_results_title" = "Browse directory results";
|
||||
"directory_search_results" = "%tu results found for %@";
|
||||
@@ -160,7 +163,7 @@
|
||||
"room_details_photo" = "Room Photo";
|
||||
"room_details_room_name" = "Room Name";
|
||||
"room_details_topic" = "Topic";
|
||||
"room_details_people" = "People";
|
||||
"room_details_people" = "Members";
|
||||
"room_details_settings" = "Settings";
|
||||
"room_details_fail_to_update_topic" = "Fail to update the topic";
|
||||
"room_details_fail_to_update_room_name" = "Fail to update the room name";
|
||||
|
||||
@@ -50,16 +50,16 @@
|
||||
NSMutableArray* viewControllers = [[NSMutableArray alloc] init];
|
||||
NSMutableArray* titles = [[NSMutableArray alloc] init];
|
||||
|
||||
[titles addObject: NSLocalizedStringFromTable(@"Rooms", @"Vector", nil)];
|
||||
[titles addObject: NSLocalizedStringFromTable(@"search_rooms", @"Vector", nil)];
|
||||
recentsViewController = [RecentsViewController recentListViewController];
|
||||
recentsViewController.delegate = self;
|
||||
[viewControllers addObject:recentsViewController];
|
||||
|
||||
[titles addObject: NSLocalizedStringFromTable(@"Messages", @"Vector", nil)];
|
||||
[titles addObject: NSLocalizedStringFromTable(@"search_messages", @"Vector", nil)];
|
||||
searchViewController = [HomeSearchViewController searchViewController];
|
||||
[viewControllers addObject:searchViewController];
|
||||
|
||||
[titles addObject: NSLocalizedStringFromTable(@"People", @"Vector", nil)];
|
||||
[titles addObject: NSLocalizedStringFromTable(@"search_people", @"Vector", nil)];
|
||||
MXKViewController *tempPeopleVC = [[MXKViewController alloc] init];
|
||||
[viewControllers addObject:tempPeopleVC];
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
|
||||
[super viewDidLoad];
|
||||
|
||||
self.navigationItem.title = NSLocalizedStringFromTable(@"recents", @"Vector", nil);
|
||||
self.navigationItem.title = NSLocalizedStringFromTable(@"title_recents", @"Vector", nil);
|
||||
|
||||
// Add the Vector background image when search bar is empty
|
||||
[self addBackgroundImageViewToView:self.view];
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
self.preferredContentSize = CGSizeMake(320.0, 600.0);
|
||||
}
|
||||
|
||||
self.navigationItem.title = NSLocalizedStringFromTable(@"recents", @"Vector", nil);
|
||||
self.navigationItem.title = NSLocalizedStringFromTable(@"title_recents", @"Vector", nil);
|
||||
}
|
||||
|
||||
- (void)viewDidLoad
|
||||
|
||||
@@ -358,8 +358,10 @@
|
||||
contact.mxMember = mxMember;
|
||||
[mxkContactsById setObject:contact forKey:mxMember.userId];
|
||||
|
||||
// Add this participant (admin is in first position, the other are sorted in alphabetical order).
|
||||
// Add this participant (admin is in first position, the other are sorted in alphabetical order by trimming special character ('@', '_'...).
|
||||
NSUInteger index = 0;
|
||||
NSCharacterSet *specialCharacterSet = [NSCharacterSet characterSetWithCharactersInString:@"_!~`@#$%^&*-+();:={}[],.<>?\\/\"\'"];
|
||||
NSString *trimmedDisplayName = [displayName stringByTrimmingCharactersInSet:specialCharacterSet];
|
||||
if (isAdmin)
|
||||
{
|
||||
// Check whether there is other admin
|
||||
@@ -369,11 +371,20 @@
|
||||
{
|
||||
contact = [mxkContactsById objectForKey:userId];
|
||||
|
||||
// Sort admin in alphabetical order
|
||||
if ([displayName compare:contact.displayName options:NSCaseInsensitiveSearch] != NSOrderedDescending)
|
||||
// Sort admin in alphabetical order (skip symbols before comparing)
|
||||
NSString *trimmedContactName = [contact.displayName stringByTrimmingCharactersInSet:specialCharacterSet];
|
||||
if (!trimmedContactName.length)
|
||||
{
|
||||
if (trimmedDisplayName.length || [displayName compare:contact.displayName options:NSCaseInsensitiveSearch] != NSOrderedDescending)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (trimmedDisplayName.length && [trimmedDisplayName compare:trimmedContactName options:NSCaseInsensitiveSearch] != NSOrderedDescending)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
}
|
||||
@@ -391,11 +402,20 @@
|
||||
{
|
||||
contact = [mxkContactsById objectForKey:userId];
|
||||
|
||||
// Sort in alphabetical order
|
||||
if ([displayName compare:contact.displayName options:NSCaseInsensitiveSearch] != NSOrderedDescending)
|
||||
// Sort in alphabetical order (skip symbols before comparing)
|
||||
NSString *trimmedContactName = [contact.displayName stringByTrimmingCharactersInSet:specialCharacterSet];
|
||||
if (!trimmedContactName.length)
|
||||
{
|
||||
if (trimmedDisplayName.length || [displayName compare:contact.displayName options:NSCaseInsensitiveSearch] != NSOrderedDescending)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (trimmedDisplayName.length && [trimmedDisplayName compare:trimmedContactName options:NSCaseInsensitiveSearch] != NSOrderedDescending)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
}
|
||||
@@ -501,7 +521,16 @@
|
||||
|
||||
if (!contact)
|
||||
{
|
||||
contact = [[Contact alloc] initMatrixContactWithDisplayName:NSLocalizedStringFromTable(@"you", @"Vector", nil) andMatrixID:userMatrixId];
|
||||
// Check whether user is admin
|
||||
BOOL isAdmin = ([self.mxRoom.state memberNormalizedPowerLevel:userMatrixId] == 1);
|
||||
|
||||
NSString *displayName = NSLocalizedStringFromTable(@"you", @"Vector", nil);
|
||||
if (isAdmin)
|
||||
{
|
||||
displayName = [NSString stringWithFormat:NSLocalizedStringFromTable(@"room_participants_admin_name", @"Vector", nil), displayName];
|
||||
}
|
||||
|
||||
contact = [[Contact alloc] initMatrixContactWithDisplayName:displayName andMatrixID:userMatrixId];
|
||||
contact.mxMember = [self.mxRoom.state memberWithUserId:userMatrixId];
|
||||
[mxkContactsById setObject:contact forKey:userMatrixId];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user