pEpForiOS/UI/EmailDisplay/EmailListViewController.swift
changeset 965 baea625419a9
parent 941 b53436ddb8c2
child 974 dd8704b932e5
child 1242 4cecb482ae1c
     1.1 --- a/pEpForiOS/UI/EmailDisplay/EmailListViewController.swift	Thu Nov 03 14:23:12 2016 +0100
     1.2 +++ b/pEpForiOS/UI/EmailDisplay/EmailListViewController.swift	Thu Nov 03 14:23:14 2016 +0100
     1.3 @@ -88,11 +88,11 @@
     1.4      }
     1.5  
     1.6      func isRead(message: Message)-> Bool {
     1.7 -        return message.imapFlags.seen
     1.8 +        return message.imapFlags?.seen ?? false
     1.9      }
    1.10  
    1.11      func isImportant(message: Message)-> Bool {
    1.12 -        return message.imapFlags.flagged
    1.13 +        return message.imapFlags?.flagged ?? false
    1.14      }
    1.15  
    1.16      override func viewDidLoad() {
    1.17 @@ -119,7 +119,7 @@
    1.18          state.isSynching = true
    1.19          updateUI()
    1.20  
    1.21 -        message.imapFlags.draft = true
    1.22 +        message.imapFlags?.draft = true
    1.23  
    1.24          // TODO: IOS 222: Save as draft
    1.25          if let folder = draftMessageToStore?.parent as? Folder {
    1.26 @@ -292,7 +292,7 @@
    1.27                  as! ComposeViewController
    1.28              destination.appConfig = config.appConfig
    1.29              if let draft = draftMessageToCompose {
    1.30 -                draft.imapFlags.seen = true
    1.31 +                draft.imapFlags?.seen = true
    1.32                  config.appConfig.model.save()
    1.33  
    1.34                  destination.originalMessage = draft
    1.35 @@ -332,10 +332,10 @@
    1.36          let isFlagCompletionHandler: (UITableViewRowAction, IndexPath) -> Void =
    1.37              { (action, indexPath) in
    1.38                  if (self.isImportant(message: message)) {
    1.39 -                    message.imapFlags.flagged = false
    1.40 +                    message.imapFlags?.flagged = false
    1.41  
    1.42                  } else {
    1.43 -                    message.imapFlags.flagged = true
    1.44 +                    message.imapFlags?.flagged = true
    1.45                  }
    1.46                  self.syncFlagsToServer(message: message)
    1.47                  self.tableView.reloadRows(at: [indexPath], with: .none)
    1.48 @@ -359,7 +359,7 @@
    1.49          let deleteCompletionHandler: (UITableViewRowAction, IndexPath) -> Void =
    1.50              { (action, indexPath) in
    1.51                  let message = self.messageAt(indexPath: indexPath)
    1.52 -                message?.imapFlags.deleted = true
    1.53 +                message?.imapFlags?.deleted = true
    1.54                  self.syncFlagsToServer(message: message!)
    1.55          }
    1.56  
    1.57 @@ -386,9 +386,9 @@
    1.58          let isReadCompletionHandler: (UITableViewRowAction, IndexPath) -> Void =
    1.59              { (action, indexPath) in
    1.60                  if (self.isRead(message: message)) {
    1.61 -                    message.imapFlags.seen = false
    1.62 +                    message.imapFlags?.seen = false
    1.63                  } else {
    1.64 -                    message.imapFlags.seen = true
    1.65 +                    message.imapFlags?.seen = true
    1.66                  }
    1.67                  self.syncFlagsToServer(message: message)
    1.68                  self.tableView.reloadRows(at: [indexPath], with: .none)