marinofaggiana 3 éve
szülő
commit
c9616456ea
1 módosított fájl, 14 hozzáadás és 0 törlés
  1. 14 0
      iOSClient/Notification/NCNotification.swift

+ 14 - 0
iOSClient/Notification/NCNotification.swift

@@ -62,9 +62,17 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate, NCEmpty
     override func viewDidAppear(_ animated: Bool) {
         super.viewDidAppear(animated)
         
+        NotificationCenter.default.addObserver(self, selector: #selector(initializeMain), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterInitializeMain), object: nil)
+        
         getNetwokingNotification()
     }
     
+    override func viewDidDisappear(_ animated: Bool) {
+        super.viewDidDisappear(animated)
+        
+        NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterInitializeMain), object: nil)
+    }
+    
     @objc func changeTheming() {
         tableView.reloadData()        
     }
@@ -73,6 +81,12 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate, NCEmpty
         self.dismiss(animated: true, completion: nil)
     }
     
+    // MARK: - NotificationCenter
+
+    @objc func initializeMain() {
+        getNetwokingNotification()
+    }
+    
     // MARK: - Empty
     
     func emptyDataSetView(_ view: NCEmptyView) {