Ver código fonte

Notification view

Marino Faggiana 8 anos atrás
pai
commit
9cb23d21e4

+ 4 - 2
iOSClient/Main/CCMain.m

@@ -1051,7 +1051,11 @@
         old = [old stringByAppendingString:@(notification.idNotification).stringValue];
 
     if (![new isEqualToString:old]) {
+        
         appDelegate.listOfNotifications = [[NSMutableArray alloc] initWithArray:sortedListOfNotifications];
+        
+        // reload Notification view
+        [[NSNotificationCenter defaultCenter] postNotificationName:@"notificationReloadData" object:nil];
     }
     
     // Update NavigationBar
@@ -1072,8 +1076,6 @@
         
         CCNotification *notificationVC = [[UIStoryboard storyboardWithName:@"CCNotification" bundle:nil] instantiateViewControllerWithIdentifier:@"CCNotification"];
         
-        notificationVC.view.superview.frame = CGRectMake(100,100,self.view.bounds.size.width-100,self.view.bounds.size.height-100);
-        
         [self presentViewController:notificationVC animated:YES completion:nil];
     }
 }

+ 7 - 3
iOSClient/Notification/CCNotification.swift

@@ -38,6 +38,9 @@ class CCNotification: UITableViewController, OCNetworkingDelegate {
         self.tableView.separatorColor = UIColor(colorLiteralRed: 153.0/255.0, green: 153.0/255.0, blue: 153.0/255.0, alpha: 0.2)
         self.tableView.tableFooterView = UIView()
 
+        // Register to receive notification reload data
+        NotificationCenter.default.addObserver(self, selector: #selector(self.tableView.reloadData), name: Notification.Name("notificationReloadData"), object: nil)
+
         self.tableView.reloadData()
     }
     
@@ -48,9 +51,10 @@ class CCNotification: UITableViewController, OCNetworkingDelegate {
     
     func viewClose() {
         
-        self.dismiss(animated: true) { 
-            
-        }
+        // Stop listening notification reload data
+        NotificationCenter.default.removeObserver(self, name: Notification.Name("notificationReloadData"), object: nil);
+        
+        self.dismiss(animated: true, completion: nil)
     }
     
     // MARK: - Table