Skip to content

Commit

Permalink
fix: Use random ID instead of hash to allow multiple empty drafts
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippeWeidmann committed Jan 31, 2024
1 parent 3f10c91 commit f4c9c1d
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions MailCore/Models/ComposeMessageIntent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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,
Expand Down

0 comments on commit f4c9c1d

Please sign in to comment.