Skip to content
Snippets Groups Projects
Commit da2801a3 authored by jakobsbode's avatar jakobsbode
Browse files

UI should be working

parent 2426118e
No related branches found
No related tags found
No related merge requests found
...@@ -15,6 +15,7 @@ class FolderListViewController: UITableViewController { ...@@ -15,6 +15,7 @@ class FolderListViewController: UITableViewController {
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
self.navigationItem.title = folder.name self.navigationItem.title = folder.name
print("Hallo")
} }
override func numberOfSections(in tableView: UITableView) -> Int { override func numberOfSections(in tableView: UITableView) -> Int {
...@@ -28,7 +29,7 @@ class FolderListViewController: UITableViewController { ...@@ -28,7 +29,7 @@ class FolderListViewController: UITableViewController {
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "folderListCell") as! FolderListCell let cell = tableView.dequeueReusableCell(withIdentifier: "folderListCell") as! FolderListCell
let mail = folder.mailsOfFolder[indexPath.row] let mail = folder.mailsOfFolder.sorted()[indexPath.row]
cell.body.text = mail.body cell.body.text = mail.body
if let contact = mail.from.contact { if let contact = mail.from.contact {
...@@ -38,7 +39,7 @@ class FolderListViewController: UITableViewController { ...@@ -38,7 +39,7 @@ class FolderListViewController: UITableViewController {
cell.from.text = mail.from.mailAddress cell.from.text = mail.from.mailAddress
} }
cell.subject.text = mail.subject cell.subject.text = mail.subject
cell.date.text = mail.date.description cell.date.text = mail.timeString
if mail.isSecure { if mail.isSecure {
cell.secureImageView.image = IconsStyleKit.imageOfLetter cell.secureImageView.image = IconsStyleKit.imageOfLetter
...@@ -113,7 +114,7 @@ class FolderListViewController: UITableViewController { ...@@ -113,7 +114,7 @@ class FolderListViewController: UITableViewController {
} }
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
performSegue(withIdentifier: "readFolderMailSegue", sender: folder.mailsOfFolder[indexPath.row]) performSegue(withIdentifier: "readFolderMailSegue", sender: folder.mailsOfFolder.sorted()[indexPath.row])
} }
override func prepare(for segue: UIStoryboardSegue, sender: Any?) { override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
......
...@@ -33,6 +33,10 @@ class FolderViewController: UITableViewController { ...@@ -33,6 +33,10 @@ class FolderViewController: UITableViewController {
} }
} }
} }
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
tableView.reloadData()
}
override func numberOfSections(in tableView: UITableView) -> Int { override func numberOfSections(in tableView: UITableView) -> Int {
var count = 0 var count = 0
...@@ -51,16 +55,16 @@ class FolderViewController: UITableViewController { ...@@ -51,16 +55,16 @@ class FolderViewController: UITableViewController {
return count return count
} }
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if section == 0 { if sectionType(IndexPath.init(row: 0, section: section)) == .inbox {
return 1 return 1
} }
if section == 2 { if sectionType(IndexPath.init(row: 0, section: section)) == .folders {
return 7 return folders.count
} }
return folders.count <= 0 ? 0 : folders.count - 1 return getMails().count
} }
override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if indexPath.section == 2 { if sectionType(indexPath) == .mails {
return 71 return 71
} }
return 44 return 44
...@@ -83,7 +87,7 @@ class FolderViewController: UITableViewController { ...@@ -83,7 +87,7 @@ class FolderViewController: UITableViewController {
cell.from.text = mail.from.mailAddress cell.from.text = mail.from.mailAddress
} }
cell.subject.text = mail.subject cell.subject.text = mail.subject
cell.date.text = mail.date.description cell.date.text = mail.timeString
if mail.isSecure { if mail.isSecure {
cell.secureImageView.image = IconsStyleKit.imageOfLetter cell.secureImageView.image = IconsStyleKit.imageOfLetter
...@@ -91,12 +95,12 @@ class FolderViewController: UITableViewController { ...@@ -91,12 +95,12 @@ class FolderViewController: UITableViewController {
else { else {
cell.secureImageView.image = IconsStyleKit.imageOfPostcard cell.secureImageView.image = IconsStyleKit.imageOfPostcard
} }
if !mail.flag.contains(MCOMessageFlag.seen) { if !mail.isRead {
cell.markImageView.image = "🔵".image() cell.markImageView.image = "🔵".image()
cell.body.font = UIFont.boldSystemFont(ofSize: cell.body.font.pointSize) cell.body.font = UIFont.boldSystemFont(ofSize: cell.body.font.pointSize)
cell.subject.font = UIFont.boldSystemFont(ofSize: cell.subject.font.pointSize) cell.subject.font = UIFont.boldSystemFont(ofSize: cell.subject.font.pointSize)
} }
if mail.flag.contains(MCOMessageFlag.answered) { if mail.isAnwered {
cell.replyImageView.image = "↩️".image() cell.replyImageView.image = "↩️".image()
} }
...@@ -195,7 +199,7 @@ class FolderViewController: UITableViewController { ...@@ -195,7 +199,7 @@ class FolderViewController: UITableViewController {
} }
func getMails() -> [PersistentMail] { func getMails() -> [PersistentMail] {
if let folder = self.presentedFolder { if let folder = self.presentedFolder {
return folder.mailsOfFolder return folder.mailsOfFolder.sorted()
} }
return [] return []
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment