Skip to content

Commit af025fe

Browse files
author
Ioan Moldovan
authored
fix: deleted message still visible in thread issue (#2297)
1 parent b907686 commit af025fe

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

FlowCrypt/App/GeneralConstants.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ enum GeneralConstants {
1010
static let redirectURL = URL(string: "com.googleusercontent.apps.679326713487-5r16ir2f57bpmuh2d6dal1bcm9m1ffqc:/oauthredirect")!
1111
static let mailScope: [GoogleScope] = [.userInfo, .userEmail, .mail]
1212
static let contactsScope: [GoogleScope] = mailScope + [.contacts, .otherContacts]
13+
static let trashLabelPath = "TRASH"
1314
// Empty pass is For All MAIL
14-
static let standardGmailPaths = ["INBOX", "CHAT", "SENT", "IMPORTANT", "TRASH", "DRAFT", "SPAM", "STARRED", "UNREAD", ""]
15+
static let standardGmailPaths = ["INBOX", "CHAT", "SENT", "IMPORTANT", trashLabelPath, "DRAFT", "SPAM", "STARRED", "UNREAD", ""]
1516
static let gmailRecoveryEmailSubjects = [
1617
"Your FlowCrypt Backup",
1718
"Your CryptUp Backup",

FlowCrypt/Functionality/Mail Provider/Threads/MessagesThreadApiClient.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,13 @@ extension GmailService: MessagesThreadApiClient {
7272
return continuation.resume(throwing: AppErr.cast("GTLRGmail_Thread"))
7373
}
7474

75-
let messages = gmailThread.messages?.compactMap { try? Message(gmailMessage: $0) } ?? []
75+
var messages = gmailThread.messages?.compactMap { try? Message(gmailMessage: $0) } ?? []
76+
77+
// For trash folder: Only display deleted messages in thread
78+
// For othr folders: Exclude deleted messages in thread
79+
// https://github.com/FlowCrypt/flowcrypt-ios/issues/2292
80+
let isTrashFolder = path == GeneralConstants.Gmail.trashLabelPath
81+
messages = messages.filter { $0.labels.contains(.trash) == isTrashFolder }
7682

7783
let thread = MessageThread(
7884
identifier: gmailThread.identifier,

0 commit comments

Comments
 (0)