diff --git a/FlowCrypt/App/GeneralConstants.swift b/FlowCrypt/App/GeneralConstants.swift index 8652b8c6f..7efefeb74 100644 --- a/FlowCrypt/App/GeneralConstants.swift +++ b/FlowCrypt/App/GeneralConstants.swift @@ -10,8 +10,9 @@ enum GeneralConstants { static let redirectURL = URL(string: "com.googleusercontent.apps.679326713487-5r16ir2f57bpmuh2d6dal1bcm9m1ffqc:/oauthredirect")! static let mailScope: [GoogleScope] = [.userInfo, .userEmail, .mail] static let contactsScope: [GoogleScope] = mailScope + [.contacts, .otherContacts] + static let trashLabelPath = "TRASH" // Empty pass is For All MAIL - static let standardGmailPaths = ["INBOX", "CHAT", "SENT", "IMPORTANT", "TRASH", "DRAFT", "SPAM", "STARRED", "UNREAD", ""] + static let standardGmailPaths = ["INBOX", "CHAT", "SENT", "IMPORTANT", trashLabelPath, "DRAFT", "SPAM", "STARRED", "UNREAD", ""] static let gmailRecoveryEmailSubjects = [ "Your FlowCrypt Backup", "Your CryptUp Backup", diff --git a/FlowCrypt/Functionality/Mail Provider/Threads/MessagesThreadApiClient.swift b/FlowCrypt/Functionality/Mail Provider/Threads/MessagesThreadApiClient.swift index e4e67013f..0c08acf8a 100644 --- a/FlowCrypt/Functionality/Mail Provider/Threads/MessagesThreadApiClient.swift +++ b/FlowCrypt/Functionality/Mail Provider/Threads/MessagesThreadApiClient.swift @@ -72,7 +72,13 @@ extension GmailService: MessagesThreadApiClient { return continuation.resume(throwing: AppErr.cast("GTLRGmail_Thread")) } - let messages = gmailThread.messages?.compactMap { try? Message(gmailMessage: $0) } ?? [] + var messages = gmailThread.messages?.compactMap { try? Message(gmailMessage: $0) } ?? [] + + // For trash folder: Only display deleted messages in thread + // For othr folders: Exclude deleted messages in thread + // https://github.com/FlowCrypt/flowcrypt-ios/issues/2292 + let isTrashFolder = path == GeneralConstants.Gmail.trashLabelPath + messages = messages.filter { $0.labels.contains(.trash) == isTrashFolder } let thread = MessageThread( identifier: gmailThread.identifier,