Skip to content

Commit

Permalink
fix: Remove useless getUniqueUids
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippeWeidmann committed Jan 6, 2025
1 parent 1fd500d commit 4afcdcf
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions MailCore/Cache/MailboxManager/MailboxManager+Thread.swift
Original file line number Diff line number Diff line change
Expand Up @@ -324,11 +324,10 @@ public extension MailboxManager {
private func addMessages(shortUids: [String], folder: Folder) async throws {
guard !shortUids.isEmpty && !Task.isCancelled else { return }

let uniqueUids: [String] = getUniqueUids(folder: folder, remoteUids: shortUids)
let messageByUidsResult = try await apiFetcher.messagesByUids(
mailboxUuid: mailbox.uuid,
folderId: folder.remoteId,
messageUids: uniqueUids
messageUids: shortUids
)

try? writeTransaction { writableRealm in
Expand Down Expand Up @@ -520,18 +519,6 @@ public extension MailboxManager {
}
}

private func getUniqueUids(folder: Folder, remoteUids: [String]) -> [String] {
let localUids = Set(folder.threads.map { Constants.shortUid(from: $0.uid) })
let remoteUidsSet = Set(remoteUids)
var uniqueUids: Set<String> = Set()
if localUids.isEmpty {
uniqueUids = remoteUidsSet
} else {
uniqueUids = remoteUidsSet.subtracting(localUids)
}
return uniqueUids.toArray()
}

// MARK: - Other

func saveSearchThreads(result: ThreadResult, searchFolder: Folder) async {
Expand Down

0 comments on commit 4afcdcf

Please sign in to comment.