From f4c9c1d4fa79f409ead8368931c5535f2e5e918c Mon Sep 17 00:00:00 2001 From: Philippe Weidmann Date: Wed, 31 Jan 2024 13:59:00 +0100 Subject: [PATCH] fix: Use random ID instead of hash to allow multiple empty drafts --- MailCore/Models/ComposeMessageIntent.swift | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/MailCore/Models/ComposeMessageIntent.swift b/MailCore/Models/ComposeMessageIntent.swift index 909b91208e..857d165a76 100644 --- a/MailCore/Models/ComposeMessageIntent.swift +++ b/MailCore/Models/ComposeMessageIntent.swift @@ -19,10 +19,6 @@ import Foundation public struct ComposeMessageIntent: Codable, Identifiable, Hashable { - public var id: Int { - return hashValue - } - public enum IntentType: Codable, Hashable { case new case existing(draftLocalUUID: String) @@ -31,10 +27,18 @@ public struct ComposeMessageIntent: Codable, Identifiable, Hashable { case reply(messageUid: String, replyMode: ReplyMode) } + public let id: UUID public let userId: Int public let mailboxId: Int public let type: IntentType + init(userId: Int, mailboxId: Int, type: IntentType) { + id = UUID() + self.userId = userId + self.mailboxId = mailboxId + self.type = type + } + public static func new(originMailboxManager: MailboxManager) -> ComposeMessageIntent { return ComposeMessageIntent( userId: originMailboxManager.mailbox.userId,