Backed out changeset 26910b27965a IOS-1521
authorbuff <andreas@pep-project.org>
Wed, 22 May 2019 16:57:51 +0200
branchIOS-1521
changeset 8735cbaafef1e65a
parent 8734 67bd87d5d446
child 8742 3ef320a3e08b
Backed out changeset 26910b27965a
pEpForiOS/UI/EmailDisplayList/MessageViewModel.swift
     1.1 --- a/pEpForiOS/UI/EmailDisplayList/MessageViewModel.swift	Wed May 22 16:51:17 2019 +0200
     1.2 +++ b/pEpForiOS/UI/EmailDisplayList/MessageViewModel.swift	Wed May 22 16:57:51 2019 +0200
     1.3 @@ -94,6 +94,13 @@
     1.4          }
     1.5      }
     1.6  
     1.7 +    public func flagsDiffer(from messageViewModel: MessageViewModel) -> Bool {
     1.8 +        if self != messageViewModel {
     1.9 +            return true
    1.10 +        }
    1.11 +        return self.isFlagged != messageViewModel.isFlagged || self.isSeen != messageViewModel.isSeen
    1.12 +    }
    1.13 +
    1.14      func unsubscribeForUpdates() {
    1.15          cancelAllBackgroundOperations()
    1.16      }
    1.17 @@ -293,6 +300,20 @@
    1.18      }
    1.19  }
    1.20  
    1.21 +extension MessageViewModel: Equatable {
    1.22 +    static func ==(lhs: MessageViewModel, rhs: MessageViewModel) -> Bool {
    1.23 +        let oneIsAFakeMessage =
    1.24 +            lhs.uid == Message.uidFakeResponsivenes ||
    1.25 +            rhs.uid == Message.uidFakeResponsivenes
    1.26 +        return lhs.uuid == rhs.uuid &&
    1.27 +            // We consider two messages with different UIDs as equal if one is the fake message
    1.28 +            // of the other.
    1.29 +            (oneIsAFakeMessage || (lhs.uid == rhs.uid)) &&
    1.30 +            lhs.parentFolderName == rhs.parentFolderName &&
    1.31 +            lhs.accountAddress == rhs.accountAddress
    1.32 +    }
    1.33 +}
    1.34 +
    1.35  // MARK: Operations
    1.36  
    1.37  extension MessageViewModel {