IOS-491 cosmetics
authorDirk Zimmermann <dirk@pep-project.org>
Fri, 19 May 2017 14:40:25 +0200
changeset 2181d8d820586163
parent 2180 6d917e49cd3a
child 2182 30f204afc00b
IOS-491 cosmetics
pEpForiOS/Background/SyncMessagesOperation.swift
pEpForiOS/UI/EmailDisplay/EmailListViewController.swift
     1.1 --- a/pEpForiOS/Background/SyncMessagesOperation.swift	Fri May 19 10:23:00 2017 +0200
     1.2 +++ b/pEpForiOS/Background/SyncMessagesOperation.swift	Fri May 19 14:40:25 2017 +0200
     1.3 @@ -73,7 +73,7 @@
     1.4      }
     1.5  
     1.6      func process(context: NSManagedObjectContext) {
     1.7 -        let folderBuilder = ImapFolderBuilder.init(
     1.8 +        let folderBuilder = ImapFolderBuilder(
     1.9              accountID: self.imapSyncData.connectInfo.accountObjectID,
    1.10              backgroundQueue: self.backgroundQueue)
    1.11          self.imapSyncData.sync?.delegate = self
     2.1 --- a/pEpForiOS/UI/EmailDisplay/EmailListViewController.swift	Fri May 19 10:23:00 2017 +0200
     2.2 +++ b/pEpForiOS/UI/EmailDisplay/EmailListViewController.swift	Fri May 19 14:40:25 2017 +0200
     2.3 @@ -396,34 +396,32 @@
     2.4          if let folder = config?.folder,
     2.5              let message = messageFolder as? Message,
     2.6              folder.contains(message: message, deletedMessagesAreContained: true) {
     2.7 -            if let msg = messageFolder as? Message {
     2.8 -                if msg.isOriginal {
     2.9 -                    // new message has arrived
    2.10 -                    if let index = folder.indexOf(message: msg) {
    2.11 -                        let ip = IndexPath(row: index, section: 0)
    2.12 -                        Log.info(
    2.13 -                            component: #function,
    2.14 -                            content: "insert message at \(index), \(folder.messageCount()) messages")
    2.15 -                        tableView.insertRows(at: [ip], with: .automatic)
    2.16 -                    } else {
    2.17 -                        tableView.reloadData()
    2.18 -                    }
    2.19 -                } else if msg.isGhost {
    2.20 -                    if let cell = cellFor(message: msg), let ip = tableView.indexPath(for: cell) {
    2.21 -                        Log.info(
    2.22 -                            component: #function,
    2.23 -                            content: "delete message at \(index), \(folder.messageCount()) messages")
    2.24 -                        tableView.deleteRows(at: [ip], with: .automatic)
    2.25 -                    } else {
    2.26 -                        tableView.reloadData()
    2.27 -                    }
    2.28 +            if message.isOriginal {
    2.29 +                // new message has arrived
    2.30 +                if let index = folder.indexOf(message: message) {
    2.31 +                    let ip = IndexPath(row: index, section: 0)
    2.32 +                    Log.info(
    2.33 +                        component: #function,
    2.34 +                        content: "insert message at \(index), \(folder.messageCount()) messages")
    2.35 +                    tableView.insertRows(at: [ip], with: .automatic)
    2.36                  } else {
    2.37 -                    // other flags than delete must have been changed
    2.38 -                    if let cell = cellFor(message: msg) {
    2.39 -                        cell.updateFlags(message: message)
    2.40 -                    } else {
    2.41 -                        tableView.reloadData()
    2.42 -                    }
    2.43 +                    tableView.reloadData()
    2.44 +                }
    2.45 +            } else if message.isGhost {
    2.46 +                if let cell = cellFor(message: message), let ip = tableView.indexPath(for: cell) {
    2.47 +                    Log.info(
    2.48 +                        component: #function,
    2.49 +                        content: "delete message at \(index), \(folder.messageCount()) messages")
    2.50 +                    tableView.deleteRows(at: [ip], with: .automatic)
    2.51 +                } else {
    2.52 +                    tableView.reloadData()
    2.53 +                }
    2.54 +            } else {
    2.55 +                // other flags than delete must have been changed
    2.56 +                if let cell = cellFor(message: message) {
    2.57 +                    cell.updateFlags(message: message)
    2.58 +                } else {
    2.59 +                    tableView.reloadData()
    2.60                  }
    2.61              }
    2.62          }