marinofaggiana 3 년 전
부모
커밋
0d180882b2
2개의 변경된 파일19개의 추가작업 그리고 5개의 파일을 삭제
  1. 15 1
      iOSClient/Activity/NCActivity.swift
  2. 4 4
      iOSClient/Notification/NCNotification.swift

+ 15 - 1
iOSClient/Activity/NCActivity.swift

@@ -64,13 +64,27 @@ class NCActivity: UIViewController, NCEmptyDataSetDelegate {
         
         NotificationCenter.default.addObserver(self, selector: #selector(self.changeTheming), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterChangeTheming), object: nil)
         
+        appDelegate.activeViewController = self
         changeTheming()
     }
     
     override func viewDidAppear(_ animated: Bool) {
         super.viewDidAppear(animated)
         
-        appDelegate.activeViewController = self
+        NotificationCenter.default.addObserver(self, selector: #selector(initializeMain), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterInitializeMain), object: nil)
+        
+        initializeMain()
+    }
+    
+    override func viewDidDisappear(_ animated: Bool) {
+        super.viewDidDisappear(animated)
+        
+        NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterInitializeMain), object: nil)
+    }
+    
+    // MARK: - NotificationCenter
+
+    @objc func initializeMain() {
         loadDataSource()
         loadActivity(idActivity: 0)
     }

+ 4 - 4
iOSClient/Notification/NCNotification.swift

@@ -73,10 +73,6 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate, NCEmpty
         NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterInitializeMain), object: nil)
     }
     
-    @objc func changeTheming() {
-        tableView.reloadData()        
-    }
-
     @objc func viewClose() {
         self.dismiss(animated: true, completion: nil)
     }
@@ -87,6 +83,10 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate, NCEmpty
         getNetwokingNotification()
     }
     
+    @objc func changeTheming() {
+        tableView.reloadData()
+    }
+    
     // MARK: - Empty
     
     func emptyDataSetView(_ view: NCEmptyView) {