Skip to content
Snippets Groups Projects
Commit 556fb292 authored by Oliver Wiese's avatar Oliver Wiese
Browse files

fix protocols for mailprotocol

parent 5266a7c1
Branches
Tags
2 merge requests!2Swift3,!1Ephemeral mail object
...@@ -12,7 +12,7 @@ import Foundation ...@@ -12,7 +12,7 @@ import Foundation
import CoreData import CoreData
@objc(PersistentMail) @objc(PersistentMail)
open class PersistentMail: NSManagedObject, Comparable { open class PersistentMail: NSManagedObject, Mail {
var showMessage: Bool = false var showMessage: Bool = false
...@@ -180,12 +180,3 @@ open class PersistentMail: NSManagedObject, Comparable { ...@@ -180,12 +180,3 @@ open class PersistentMail: NSManagedObject, Comparable {
return "\(returnString)\(subj)" return "\(returnString)\(subj)"
} }
} }
public func == (lhs: PersistentMail, rhs: PersistentMail) -> Bool {
return lhs.date == rhs.date && lhs.uid == rhs.uid
}
public func < (lhs: PersistentMail, rhs: PersistentMail) -> Bool {
return lhs.date > rhs.date
}
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
import Foundation import Foundation
public protocol MailProtocol{ public protocol Mail: Comparable{
var cc: NSSet? {get} var cc: NSSet? {get}
...@@ -19,5 +19,15 @@ public protocol MailProtocol{ ...@@ -19,5 +19,15 @@ public protocol MailProtocol{
var date: Date{get} var date: Date{get}
var subject: String?{get} var subject: String?{get}
var body: String?{get} var body: String?{get}
var uid: UInt64{get}
}
public func ==<T: Mail> (lhs: T, rhs: T) -> Bool {
return lhs.date == rhs.date && lhs.uid == rhs.uid
}
public func <<T: Mail> (lhs: T, rhs: T) -> Bool {
return lhs.date > rhs.date
} }
...@@ -12,11 +12,12 @@ import UIKit ...@@ -12,11 +12,12 @@ import UIKit
public protocol Record: Comparable { public protocol Record: Comparable {
var name: String { get } var name: String { get }
var hasKey: Bool { get } var hasKey: Bool { get }
var isVerified: Bool { get } var isVerified: Bool { get }
var ezContact: EnzevalosContact { get } var ezContact: EnzevalosContact { get }
var mails: [Mail] { get } var mails: [PersistentMail] { get }
var cnContact: CNContact? { get } var cnContact: CNContact? { get }
var color: UIColor { get } var color: UIColor { get }
var image: UIImage { get } var image: UIImage { get }
...@@ -24,5 +25,5 @@ public protocol Record: Comparable { ...@@ -24,5 +25,5 @@ public protocol Record: Comparable {
func addNewAddress(_ adr: MailAddress) -> Bool func addNewAddress(_ adr: MailAddress) -> Bool
func addNewMail(_ mail: Mail) -> Bool func addNewMail(_ mail:PersistentMail) -> Bool
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment