mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Add comments
This commit is contained in:
parent
2e9eb3b925
commit
438164110c
1 changed files with 3 additions and 0 deletions
|
@ -2,6 +2,7 @@
|
|||
enum ContactUtilities {
|
||||
|
||||
static func getAllContacts() -> [String] {
|
||||
// Collect all contacts
|
||||
var result: [String] = []
|
||||
Storage.read { transaction in
|
||||
TSContactThread.enumerateCollectionObjects(with: transaction) { object, _ in
|
||||
|
@ -12,9 +13,11 @@ enum ContactUtilities {
|
|||
func getDisplayName(for publicKey: String) -> String {
|
||||
return Storage.shared.getContact(with: publicKey)?.displayName(for: .regular) ?? publicKey
|
||||
}
|
||||
// Remove the current user
|
||||
if let index = result.firstIndex(of: getUserHexEncodedPublicKey()) {
|
||||
result.remove(at: index)
|
||||
}
|
||||
// Sort alphabetically
|
||||
return result.sorted { getDisplayName(for: $0) < getDisplayName(for: $1) }
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue