MESSENGER-3076 display user search results alphabetically

This commit is contained in:
Frank Rotermund
2023-02-23 07:44:38 +01:00
parent 11ed494648
commit 7d3d2f3166
2 changed files with 15 additions and 1 deletions
@@ -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];