Skip to content

Commit

Permalink
refactor: Use if let for previousCursor
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippeWeidmann committed Jan 6, 2025
1 parent dac2560 commit 9af3f56
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions MailCore/Cache/MailboxManager/MailboxManager+Thread.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,12 @@ public extension MailboxManager {
let previousCursor = liveFolder?.cursor
let newCursor: String

if previousCursor == nil {
newCursor = try await fetchOldMessagesUids(folder: folder)
} else {
if let previousCursor {
/// Get delta from last cursor
let messageDeltaResult = try await apiFetcher.messagesDelta(
mailboxUUid: mailbox.uuid,
folderId: folder.remoteId,
signature: previousCursor!
signature: previousCursor
)

let messagesUids = MessagesUids(
Expand All @@ -85,6 +83,8 @@ public extension MailboxManager {

newCursor = messageDeltaResult.cursor
try await handleDelta(messageUids: messagesUids, folder: folder)
} else {
newCursor = try await fetchOldMessagesUids(folder: folder)
}

guard !Task.isCancelled else { return }
Expand Down

0 comments on commit 9af3f56

Please sign in to comment.