pEpForiOS/UI/EmailDisplay/EmailListViewController.swift
changeset 2190 4fe9e5ba269d
parent 2189 13cc8dfac328
child 2191 a01eb69e9664
equal deleted inserted replaced
2189:13cc8dfac328 2190:4fe9e5ba269d
   199             }
   199             }
   200             message.save()
   200             message.save()
   201             self.tableView.reloadRows(at: [indexPath], with: .none)
   201             self.tableView.reloadRows(at: [indexPath], with: .none)
   202         }
   202         }
   203 
   203 
   204         var title = "\n\nFlag".localized
   204         var title = "\n\n" + NSLocalizedString("Flag", comment: "Message action (on swipe)")
   205         if message.imapFlags?.flagged ?? true {
   205         if message.imapFlags?.flagged ?? true {
   206             title = "\n\nUnFlag".localized
   206             title = "\n\n" + NSLocalizedString("Unflag", comment: "Message action (on swipe)")
   207         }
   207         }
   208 
   208 
   209         return createRowAction(
   209         return createRowAction(
   210             cell: cell, image: UIImage(named: "swipe-flag"), action: action, title: title)
   210             cell: cell, image: UIImage(named: "swipe-flag"), action: action, title: title)
   211     }
   211     }
   221             self.tableView.reloadData()
   221             self.tableView.reloadData()
   222         }
   222         }
   223 
   223 
   224         return createRowAction(
   224         return createRowAction(
   225             cell: cell, image: UIImage(named: "swipe-trash"), action: action,
   225             cell: cell, image: UIImage(named: "swipe-trash"), action: action,
   226             title: "\n\nDelete".localized)
   226             title: "\n\n" + NSLocalizedString("Delete", comment: "Message action (on swipe)"))
   227     }
   227     }
   228 
   228 
   229     func createMarkAsReadAction(message: Message, cell: EmailListViewCell) -> UITableViewRowAction {
   229     func createMarkAsReadAction(message: Message, cell: EmailListViewCell) -> UITableViewRowAction {
   230         func action(action: UITableViewRowAction, indexPath: IndexPath) -> Void {
   230         func action(action: UITableViewRowAction, indexPath: IndexPath) -> Void {
   231             if cell.haveSeen(message: message) {
   231             if cell.haveSeen(message: message) {
   235             }
   235             }
   236             self.tableView.reloadRows(at: [indexPath], with: .none)
   236             self.tableView.reloadRows(at: [indexPath], with: .none)
   237         }
   237         }
   238 
   238 
   239         var title = NSLocalizedString(
   239         var title = NSLocalizedString(
   240             "Unread", comment: "Unread button title in swipe action on EmailListViewController")
   240             "Unread", comment: "Message action (on swipe)")
   241         if !cell.haveSeen(message: message) {
   241         if !cell.haveSeen(message: message) {
   242             title = NSLocalizedString(
   242             title = NSLocalizedString(
   243                 "Read", comment: "Read button title in swipe action on EmailListViewController")
   243                 "Read", comment: "Message action (on swipe)")
   244         }
   244         }
   245 
   245 
   246         let isReadAction = createRowAction(cell: cell, image: nil, action: action,
   246         let isReadAction = createRowAction(cell: cell, image: nil, action: action,
   247                                            title: title)
   247                                            title: title)
   248         isReadAction.backgroundColor = UIColor.blue
   248         isReadAction.backgroundColor = UIColor.blue
   255             self.showMoreActionSheet(cell: cell)
   255             self.showMoreActionSheet(cell: cell)
   256         }
   256         }
   257 
   257 
   258         return createRowAction(
   258         return createRowAction(
   259             cell: cell, image: UIImage(named: "swipe-more"), action: action,
   259             cell: cell, image: UIImage(named: "swipe-more"), action: action,
   260             title: "\n\nMore".localized)
   260             title: "\n\n" + NSLocalizedString("More", comment: "Message action (on swipe)"))
   261     }
   261     }
   262 
   262 
   263     // MARK: - Action Sheet
   263     // MARK: - Action Sheet
   264 
   264 
   265     func showMoreActionSheet(cell: EmailListViewCell) {
   265     func showMoreActionSheet(cell: EmailListViewCell) {