diff --git a/FlowCrypt.xcodeproj/project.pbxproj b/FlowCrypt.xcodeproj/project.pbxproj index cd0706b23..88eb5e7e5 100644 --- a/FlowCrypt.xcodeproj/project.pbxproj +++ b/FlowCrypt.xcodeproj/project.pbxproj @@ -100,7 +100,6 @@ 9F0C3C1A231819C500299985 /* MessageKindProviderType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F0C3C19231819C500299985 /* MessageKindProviderType.swift */; }; 9F0C3C2623194E0A00299985 /* FolderViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F0C3C2523194E0A00299985 /* FolderViewModel.swift */; }; 9F17976D2368EEBD002BF770 /* SetupViewDecorator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F17976C2368EEBD002BF770 /* SetupViewDecorator.swift */; }; - 9F228BAA23C67729005D2CB6 /* DataExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32DCAEFF16F5D91A35791730 /* DataExtensions.swift */; }; 9F23EA50237217140017DFED /* ComposeViewDecorator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F23EA4F237217140017DFED /* ComposeViewDecorator.swift */; }; 9F268891237DC55600428A94 /* SetupManuallyImportKeyViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F268890237DC55600428A94 /* SetupManuallyImportKeyViewController.swift */; }; 9F2AC5B1267BDED100F6149B /* GmailSearchExpressionGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F2AC5B0267BDED100F6149B /* GmailSearchExpressionGenerator.swift */; }; @@ -205,7 +204,6 @@ 9FD364862381EFCB00657302 /* SetupManuallyEnterPassPhraseViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FD364852381EFCB00657302 /* SetupManuallyEnterPassPhraseViewController.swift */; }; 9FDF3654235A218E00614596 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FDF3653235A218E00614596 /* main.swift */; }; 9FDF3656235A22DA00614596 /* AppReset.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FDF3655235A22DA00614596 /* AppReset.swift */; }; - 9FDF3658235A233400614596 /* AppReset.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FDF3655235A22DA00614596 /* AppReset.swift */; }; 9FE1B3802563F85400D6D086 /* MessagesListProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FE1B37F2563F85400D6D086 /* MessagesListProvider.swift */; }; 9FE1B3942563F98600D6D086 /* Imap+MessagesList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FE1B3932563F98600D6D086 /* Imap+MessagesList.swift */; }; 9FE1B3A02565B0CE00D6D086 /* Message.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FE1B39F2565B0CD00D6D086 /* Message.swift */; }; @@ -283,7 +281,7 @@ D274724424FD1932006BA6EF /* FolderObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = D274724324FD1932006BA6EF /* FolderObject.swift */; }; D27B911924EFE79F002DF0A1 /* LocalContactsProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = D27B911824EFE79F002DF0A1 /* LocalContactsProvider.swift */; }; D27B911D24EFE806002DF0A1 /* RecipientObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = D27B911C24EFE806002DF0A1 /* RecipientObject.swift */; }; - D27B911F24EFE828002DF0A1 /* RecipientWithPubKeys.swift in Sources */ = {isa = PBXBuildFile; fileRef = D27B911E24EFE828002DF0A1 /* RecipientWithPubKeys.swift */; }; + D27B911F24EFE828002DF0A1 /* RecipientWithSortedPubKeys.swift in Sources */ = {isa = PBXBuildFile; fileRef = D27B911E24EFE828002DF0A1 /* RecipientWithSortedPubKeys.swift */; }; D28325DD24895F5700D311BD /* Colors.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 949ED9412303E3B400530579 /* Colors.xcassets */; }; D28655912423B4580066F52E /* HeaderNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FDF3639235A0B3B00614596 /* HeaderNode.swift */; }; D28655932423B4EE0066F52E /* MyMenuViewDecorator.swift in Sources */ = {isa = PBXBuildFile; fileRef = D28655922423B4EE0066F52E /* MyMenuViewDecorator.swift */; }; @@ -354,13 +352,6 @@ remoteGlobalIDString = C132B9AF1EC2DBD800763715; remoteInfo = FlowCrypt; }; - 9FDF3646235A1B0100614596 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = C132B9A81EC2DBD800763715 /* Project object */; - proxyType = 1; - remoteGlobalIDString = C132B9AF1EC2DBD800763715; - remoteInfo = FlowCrypt; - }; D2CDC3DB24052D0F002B045F /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = C132B9A81EC2DBD800763715 /* Project object */; @@ -696,7 +687,7 @@ D274724324FD1932006BA6EF /* FolderObject.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FolderObject.swift; sourceTree = ""; }; D27B911824EFE79F002DF0A1 /* LocalContactsProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocalContactsProvider.swift; sourceTree = ""; }; D27B911C24EFE806002DF0A1 /* RecipientObject.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecipientObject.swift; sourceTree = ""; }; - D27B911E24EFE828002DF0A1 /* RecipientWithPubKeys.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecipientWithPubKeys.swift; sourceTree = ""; }; + D27B911E24EFE828002DF0A1 /* RecipientWithSortedPubKeys.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecipientWithSortedPubKeys.swift; sourceTree = ""; }; D28655922423B4EE0066F52E /* MyMenuViewDecorator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyMenuViewDecorator.swift; sourceTree = ""; }; D28655942423BFF60066F52E /* SideMenuOptionalView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SideMenuOptionalView.swift; sourceTree = ""; }; D2891AC124C59EFA008918E3 /* KeyService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyService.swift; sourceTree = ""; }; @@ -748,13 +739,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 9FDF363E235A1B0100614596 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; C132B9AD1EC2DBD800763715 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -1786,7 +1770,7 @@ D27B912024EFE842002DF0A1 /* Models */ = { isa = PBXGroup; children = ( - D27B911E24EFE828002DF0A1 /* RecipientWithPubKeys.swift */, + D27B911E24EFE828002DF0A1 /* RecipientWithSortedPubKeys.swift */, 51B4AE5227144E590001F33B /* PubKey.swift */, 51DA5BD52721AB07001C4359 /* PubKeyState.swift */, ); @@ -2133,10 +2117,6 @@ CreatedOnToolsVersion = 12.4; TestTargetID = C132B9AF1EC2DBD800763715; }; - 9FDF3640235A1B0100614596 = { - CreatedOnToolsVersion = 11.0; - TestTargetID = C132B9AF1EC2DBD800763715; - }; C132B9AF1EC2DBD800763715 = { CreatedOnToolsVersion = 8.3.2; LastSwiftMigration = 1020; @@ -2201,13 +2181,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 9FDF363F235A1B0100614596 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; C132B9AE1EC2DBD800763715 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -2435,15 +2408,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 9FDF363D235A1B0100614596 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 9FDF3658235A233400614596 /* AppReset.swift in Sources */, - 9F228BAA23C67729005D2CB6 /* DataExtensions.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; C132B9AC1EC2DBD800763715 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -2541,7 +2505,7 @@ 9F3EF33123B1785600FA0CEF /* MsgListViewConroller.swift in Sources */, 9F31ABA0232C071700CF87EA /* GlobalRouter.swift in Sources */, 9F5C2A92257E94DF00DE9B4B /* Imap+MessageOperations.swift in Sources */, - D27B911F24EFE828002DF0A1 /* RecipientWithPubKeys.swift in Sources */, + D27B911F24EFE828002DF0A1 /* RecipientWithSortedPubKeys.swift in Sources */, 32DCA1414EEA727B86C337D5 /* Core.swift in Sources */, 9FB22CF725715DC50026EE64 /* KeyServiceErrorHandler.swift in Sources */, 9F0C3C1A231819C500299985 /* MessageKindProviderType.swift in Sources */, @@ -2737,11 +2701,6 @@ target = C132B9AF1EC2DBD800763715 /* FlowCrypt */; targetProxy = 9F2AC5CB267BE99E00F6149B /* PBXContainerItemProxy */; }; - 9FDF3647235A1B0100614596 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = C132B9AF1EC2DBD800763715 /* FlowCrypt */; - targetProxy = 9FDF3646235A1B0100614596 /* PBXContainerItemProxy */; - }; D2CDC3DC24052D0F002B045F /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = D2531F2A23FEEF52007E5198 /* FlowCryptCommon */; diff --git a/FlowCrypt/Controllers/Compose/ComposeViewController.swift b/FlowCrypt/Controllers/Compose/ComposeViewController.swift index 96bba0f28..890cd025b 100644 --- a/FlowCrypt/Controllers/Compose/ComposeViewController.swift +++ b/FlowCrypt/Controllers/Compose/ComposeViewController.swift @@ -629,7 +629,7 @@ extension ComposeViewController { } } - private func getRecipientState(from recipient: RecipientWithPubKeys) -> RecipientState { + private func getRecipientState(from recipient: RecipientWithSortedPubKeys) -> RecipientState { switch recipient.keyState { case .active: return decorator.recipientKeyFoundState @@ -921,7 +921,7 @@ private actor ServiceActor { return try await cloudContactProvider.searchContacts(query: query) } - func searchContact(with email: String) async throws -> RecipientWithPubKeys { + func searchContact(with email: String) async throws -> RecipientWithSortedPubKeys { return try await contactsService.searchContact(with: email) } } diff --git a/FlowCrypt/Controllers/Settings/Contacts/Contacts List/ContactDetailDecorator.swift b/FlowCrypt/Controllers/Settings/Contacts/Contacts List/ContactDetailDecorator.swift index 37e351bad..e82d018f6 100644 --- a/FlowCrypt/Controllers/Settings/Contacts/Contacts List/ContactDetailDecorator.swift +++ b/FlowCrypt/Controllers/Settings/Contacts/Contacts List/ContactDetailDecorator.swift @@ -11,14 +11,14 @@ import Foundation protocol ContactDetailDecoratorType { var title: String { get } - func userNodeInput(with contact: RecipientWithPubKeys) -> ContactUserCellNode.Input + func userNodeInput(with contact: RecipientWithSortedPubKeys) -> ContactUserCellNode.Input func keyNodeInput(with key: PubKey) -> ContactKeyCellNode.Input } struct ContactDetailDecorator: ContactDetailDecoratorType { let title = "contact_detail_screen_title".localized - func userNodeInput(with contact: RecipientWithPubKeys) -> ContactUserCellNode.Input { + func userNodeInput(with contact: RecipientWithSortedPubKeys) -> ContactUserCellNode.Input { ContactUserCellNode.Input( user: (contact.name ?? contact.email).attributed(.regular(16)) ) diff --git a/FlowCrypt/Controllers/Settings/Contacts/Contacts List/ContactDetailViewController.swift b/FlowCrypt/Controllers/Settings/Contacts/Contacts List/ContactDetailViewController.swift index b57de248e..9afe1e584 100644 --- a/FlowCrypt/Controllers/Settings/Contacts/Contacts List/ContactDetailViewController.swift +++ b/FlowCrypt/Controllers/Settings/Contacts/Contacts List/ContactDetailViewController.swift @@ -18,7 +18,7 @@ final class ContactDetailViewController: TableNodeViewController { typealias ContactDetailAction = (Action) -> Void enum Action { - case delete(_ recipient: RecipientWithPubKeys) + case delete(_ recipient: RecipientWithSortedPubKeys) } private enum Section: Int, CaseIterable { @@ -27,13 +27,13 @@ final class ContactDetailViewController: TableNodeViewController { private let decorator: ContactDetailDecoratorType private let contactsProvider: LocalContactsProviderType - private var recipient: RecipientWithPubKeys + private var recipient: RecipientWithSortedPubKeys private let action: ContactDetailAction? init( decorator: ContactDetailDecoratorType = ContactDetailDecorator(), contactsProvider: LocalContactsProviderType = LocalContactsProvider(), - recipient: RecipientWithPubKeys, + recipient: RecipientWithSortedPubKeys, action: ContactDetailAction? ) { self.decorator = decorator diff --git a/FlowCrypt/Controllers/Settings/Contacts/Contacts List/ContactsListDecorator.swift b/FlowCrypt/Controllers/Settings/Contacts/Contacts List/ContactsListDecorator.swift index 8e100bb87..35896432c 100644 --- a/FlowCrypt/Controllers/Settings/Contacts/Contacts List/ContactsListDecorator.swift +++ b/FlowCrypt/Controllers/Settings/Contacts/Contacts List/ContactsListDecorator.swift @@ -11,13 +11,13 @@ import UIKit protocol ContactsListDecoratorType { var title: String { get } - func contactNodeInput(with recipient: RecipientWithPubKeys) -> ContactCellNode.Input + func contactNodeInput(with recipient: RecipientWithSortedPubKeys) -> ContactCellNode.Input } struct ContactsListDecorator: ContactsListDecoratorType { let title = "contacts_screen_title".localized - func contactNodeInput(with recipient: RecipientWithPubKeys) -> ContactCellNode.Input { + func contactNodeInput(with recipient: RecipientWithSortedPubKeys) -> ContactCellNode.Input { let name: String if let recipientName = recipient.name, recipientName.isNotEmpty { diff --git a/FlowCrypt/Controllers/Settings/Contacts/Contacts List/ContactsListViewController.swift b/FlowCrypt/Controllers/Settings/Contacts/Contacts List/ContactsListViewController.swift index 33a73b2b1..2596922b5 100644 --- a/FlowCrypt/Controllers/Settings/Contacts/Contacts List/ContactsListViewController.swift +++ b/FlowCrypt/Controllers/Settings/Contacts/Contacts List/ContactsListViewController.swift @@ -18,7 +18,7 @@ import FlowCryptUI final class ContactsListViewController: TableNodeViewController { private let decorator: ContactsListDecoratorType private let contactsProvider: LocalContactsProviderType - private var recipients: [RecipientWithPubKeys] = [] + private var recipients: [RecipientWithSortedPubKeys] = [] private var selectedIndexPath: IndexPath? init( @@ -109,8 +109,8 @@ extension ContactsListViewController { navigationController?.pushViewController(contactDetailViewController, animated: true) } - private func delete(with context: Either) { - let recipientToRemove: RecipientWithPubKeys + private func delete(with context: Either) { + let recipientToRemove: RecipientWithSortedPubKeys let indexPathToRemove: IndexPath switch context { case .left(let recipient): diff --git a/FlowCrypt/Functionality/Services/Local Pub Key Services/ContactsService.swift b/FlowCrypt/Functionality/Services/Local Pub Key Services/ContactsService.swift index c1300998c..4e7156639 100644 --- a/FlowCrypt/Functionality/Services/Local Pub Key Services/ContactsService.swift +++ b/FlowCrypt/Functionality/Services/Local Pub Key Services/ContactsService.swift @@ -18,7 +18,7 @@ protocol ContactsServiceType: PublicKeyProvider, ContactsProviderType { } protocol ContactsProviderType { - func searchContact(with email: String) async throws -> RecipientWithPubKeys + func searchContact(with email: String) async throws -> RecipientWithSortedPubKeys func searchContacts(query: String) -> [String] } @@ -43,7 +43,7 @@ struct ContactsService: ContactsServiceType { } extension ContactsService: ContactsProviderType { - func searchContact(with email: String) async throws -> RecipientWithPubKeys { + func searchContact(with email: String) async throws -> RecipientWithSortedPubKeys { guard let contact = localContactsProvider.searchRecipient(with: email) else { let recipient = try await pubLookup.lookup(with: email) localContactsProvider.save(recipient: recipient) diff --git a/FlowCrypt/Functionality/Services/Local Pub Key Services/LocalContactsProvider.swift b/FlowCrypt/Functionality/Services/Local Pub Key Services/LocalContactsProvider.swift index b8c408b79..392f762df 100644 --- a/FlowCrypt/Functionality/Services/Local Pub Key Services/LocalContactsProvider.swift +++ b/FlowCrypt/Functionality/Services/Local Pub Key Services/LocalContactsProvider.swift @@ -12,12 +12,12 @@ import RealmSwift protocol LocalContactsProviderType: PublicKeyProvider { func updateLastUsedDate(for email: String) - func searchRecipient(with email: String) -> RecipientWithPubKeys? + func searchRecipient(with email: String) -> RecipientWithSortedPubKeys? func searchEmails(query: String) -> [String] - func save(recipient: RecipientWithPubKeys) - func remove(recipient: RecipientWithPubKeys) - func updateKeys(for recipient: RecipientWithPubKeys) - func getAllRecipients() -> [RecipientWithPubKeys] + func save(recipient: RecipientWithSortedPubKeys) + func remove(recipient: RecipientWithSortedPubKeys) + func updateKeys(for recipient: RecipientWithSortedPubKeys) + func getAllRecipients() -> [RecipientWithSortedPubKeys] } struct LocalContactsProvider { @@ -47,18 +47,18 @@ extension LocalContactsProvider: LocalContactsProviderType { .map { $0.armored } ?? [] } - func save(recipient: RecipientWithPubKeys) { + func save(recipient: RecipientWithSortedPubKeys) { localContactsCache.save(RecipientObject(recipient)) } - func remove(recipient: RecipientWithPubKeys) { + func remove(recipient: RecipientWithSortedPubKeys) { localContactsCache.remove( object: RecipientObject(recipient), with: recipient.email ) } - func updateKeys(for recipient: RecipientWithPubKeys) { + func updateKeys(for recipient: RecipientWithSortedPubKeys) { guard let recipientObject = find(with: recipient.email) else { localContactsCache.save(RecipientObject(recipient)) return @@ -74,7 +74,7 @@ extension LocalContactsProvider: LocalContactsProviderType { } } - func searchRecipient(with email: String) -> RecipientWithPubKeys? { + func searchRecipient(with email: String) -> RecipientWithSortedPubKeys? { guard let recipientObject = find(with: email) else { return nil } return parseRecipient(from: recipientObject) } @@ -86,7 +86,7 @@ extension LocalContactsProvider: LocalContactsProviderType { .map(\.email) } - func getAllRecipients() -> [RecipientWithPubKeys] { + func getAllRecipients() -> [RecipientWithSortedPubKeys] { localContactsCache.realm .objects(RecipientObject.self) .map(parseRecipient) @@ -111,11 +111,11 @@ extension LocalContactsProvider { forPrimaryKey: email) } - private func parseRecipient(from object: RecipientObject) -> RecipientWithPubKeys { + private func parseRecipient(from object: RecipientObject) -> RecipientWithSortedPubKeys { let keyDetails = object.pubKeys .compactMap { try? core.parseKeys(armoredOrBinary: $0.armored.data()).keyDetails } .flatMap { $0 } - return RecipientWithPubKeys(object, keyDetails: Array(keyDetails)) + return RecipientWithSortedPubKeys(object, keyDetails: Array(keyDetails)) } private func add(pubKey: PubKey, to recipient: RecipientObject) { diff --git a/FlowCrypt/Functionality/Services/Local Pub Key Services/Models/RecipientWithPubKeys.swift b/FlowCrypt/Functionality/Services/Local Pub Key Services/Models/RecipientWithSortedPubKeys.swift similarity index 78% rename from FlowCrypt/Functionality/Services/Local Pub Key Services/Models/RecipientWithPubKeys.swift rename to FlowCrypt/Functionality/Services/Local Pub Key Services/Models/RecipientWithSortedPubKeys.swift index 10bbc545d..11010cd3d 100644 --- a/FlowCrypt/Functionality/Services/Local Pub Key Services/Models/RecipientWithPubKeys.swift +++ b/FlowCrypt/Functionality/Services/Local Pub Key Services/Models/RecipientWithSortedPubKeys.swift @@ -8,7 +8,7 @@ import Foundation -struct RecipientWithPubKeys { +struct RecipientWithSortedPubKeys { let email: String /// name if known let name: String? @@ -18,7 +18,7 @@ struct RecipientWithPubKeys { var pubKeys: [PubKey] } -extension RecipientWithPubKeys { +extension RecipientWithSortedPubKeys { init(_ recipientObject: RecipientObject, keyDetails: [KeyDetails] = []) { self.email = recipientObject.email self.name = recipientObject.name.nilIfEmpty @@ -27,7 +27,7 @@ extension RecipientWithPubKeys { } } -extension RecipientWithPubKeys { +extension RecipientWithSortedPubKeys { init(email: String, keyDetails: [KeyDetails]) { self.email = email self.name = keyDetails.first?.users.first ?? email @@ -36,7 +36,7 @@ extension RecipientWithPubKeys { } } -extension RecipientWithPubKeys { +extension RecipientWithSortedPubKeys { mutating func remove(pubKey: PubKey) { pubKeys.removeAll(where: { $0 == pubKey }) } @@ -44,8 +44,8 @@ extension RecipientWithPubKeys { var keyState: PubKeyState { pubKeys.first?.keyState ?? .empty } } -extension RecipientWithPubKeys: Equatable { - static func == (lhs: RecipientWithPubKeys, rhs: RecipientWithPubKeys) -> Bool { +extension RecipientWithSortedPubKeys: Equatable { + static func == (lhs: RecipientWithSortedPubKeys, rhs: RecipientWithSortedPubKeys) -> Bool { lhs.email == rhs.email } } diff --git a/FlowCrypt/Functionality/Services/Remote Pub Key Services/PubLookup.swift b/FlowCrypt/Functionality/Services/Remote Pub Key Services/PubLookup.swift index 671a4e5ac..876e67e51 100644 --- a/FlowCrypt/Functionality/Services/Remote Pub Key Services/PubLookup.swift +++ b/FlowCrypt/Functionality/Services/Remote Pub Key Services/PubLookup.swift @@ -7,7 +7,7 @@ // protocol PubLookupType { - func lookup(with email: String) async throws -> RecipientWithPubKeys + func lookup(with email: String) async throws -> RecipientWithSortedPubKeys } class PubLookup: PubLookupType { @@ -22,13 +22,13 @@ class PubLookup: PubLookupType { self.attesterApi = attesterApi } - func lookup(with email: String) async throws -> RecipientWithPubKeys { + func lookup(with email: String) async throws -> RecipientWithSortedPubKeys { let wkdResult = try await wkd.lookupEmail(email) if !wkdResult.isEmpty { - return RecipientWithPubKeys(email: email, keyDetails: wkdResult) + return RecipientWithSortedPubKeys(email: email, keyDetails: wkdResult) } let attesterResult = try await attesterApi.lookupEmail(email: email) - return RecipientWithPubKeys(email: email, keyDetails: attesterResult) + return RecipientWithSortedPubKeys(email: email, keyDetails: attesterResult) } } diff --git a/FlowCrypt/Models/Realm Models/RecipientObject.swift b/FlowCrypt/Models/Realm Models/RecipientObject.swift index 57c464459..d189df144 100644 --- a/FlowCrypt/Models/Realm Models/RecipientObject.swift +++ b/FlowCrypt/Models/Realm Models/RecipientObject.swift @@ -43,7 +43,7 @@ final class RecipientObject: Object { } extension RecipientObject { - convenience init(_ recipient: RecipientWithPubKeys) { + convenience init(_ recipient: RecipientWithSortedPubKeys) { self.init( email: recipient.email, name: recipient.name,