Browse Source

Notification view

Marino Faggiana 8 years ago
parent
commit
9ef4c89706
1 changed files with 8 additions and 2 deletions
  1. 8 2
      iOSClient/Notification/CCNotification.swift

+ 8 - 2
iOSClient/Notification/CCNotification.swift

@@ -33,7 +33,7 @@ class CCNotification: UITableViewController, OCNetworkingDelegate {
         super.viewDidLoad()
         
         self.navigationController?.navigationBar.topItem?.title = NSLocalizedString("_notification_", comment: "")
-        self.navigationItem.setRightBarButton(UIBarButtonItem(barButtonSystemItem: .done, target: self, action: #selector(close)), animated: true)
+        self.navigationItem.setRightBarButton(UIBarButtonItem(barButtonSystemItem: .done, target: self, action: #selector(viewClose)), animated: true)
         
         self.tableView.separatorColor = UIColor(colorLiteralRed: 153.0/255.0, green: 153.0/255.0, blue: 153.0/255.0, alpha: 0.2)
         
@@ -45,13 +45,15 @@ class CCNotification: UITableViewController, OCNetworkingDelegate {
     }
 
     
-    func close() {
+    func viewClose() {
         
         self.dismiss(animated: true) { 
             
         }
     }
     
+    // MARK: - Table
+
     func getSataSourceAt(indexPath: IndexPath) -> OCNotifications {
         
         let idsNotification: [String] = appDelegate.listOfNotifications.allKeys as! [String]
@@ -188,6 +190,10 @@ class CCNotification: UITableViewController, OCNetworkingDelegate {
         appDelegate.listOfNotifications.removeObject(forKey: metadataNet.identifier)
         
         self.tableView.reloadData()
+        
+        if appDelegate.listOfNotifications.count == 0 {
+            viewClose()
+        }
     }
     
     // MARK: - Get Image from url