mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-22 01:22:46 +02:00
MESSENGER-3076 display user search results alphabetically
This commit is contained in:
@@ -215,8 +215,19 @@
|
||||
|
||||
self->filteredMatrixContacts = [NSMutableArray arrayWithCapacity:userSearchResponse.results.count];
|
||||
|
||||
NSArray *sortedArray;
|
||||
|
||||
if (BWIBuildSettings.shared.sortUserSearchResultsAlphabetically) {
|
||||
sortedArray = [userSearchResponse.results sortedArrayUsingComparator:^NSComparisonResult(MXUser *a, MXUser *b) {
|
||||
return [a.displayname caseInsensitiveCompare:b.displayname];
|
||||
}];
|
||||
} else {
|
||||
sortedArray = userSearchResponse.results;
|
||||
}
|
||||
|
||||
|
||||
// Keep the response order as the hs ordered users by relevance
|
||||
for (MXUser *mxUser in userSearchResponse.results)
|
||||
for (MXUser *mxUser in sortedArray)
|
||||
{
|
||||
MXKContact *contact = [[MXKContact alloc] initMatrixContactWithDisplayName:mxUser.displayname andMatrixID:mxUser.userId];
|
||||
[self->filteredMatrixContacts addObject:contact];
|
||||
|
||||
Reference in New Issue
Block a user