marinofaggiana 5 years ago
parent
commit
2bf8c5998f
2 changed files with 13 additions and 9 deletions
  1. 4 5
      iOSClient/Favorites/CCFavorites.m
  2. 9 4
      iOSClient/Main/CCMain.m

+ 4 - 5
iOSClient/Favorites/CCFavorites.m

@@ -53,6 +53,10 @@
     if (self = [super initWithCoder:aDecoder])  {
         appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
         appDelegate.activeFavorites = self;
+        
+        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(triggerProgressTask:) name:@"NotificationProgressTask" object:nil];
+        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeTheming) name:k_notificationCenter_changeTheming object:nil];
+        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(deleteFile:) name:k_notificationCenter_deleteFile object:nil];
     }
     return self;
 }
@@ -88,11 +92,6 @@
     else
         self.title = NSLocalizedString(@"_favorites_", nil);
     
-    // Notification
-    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(triggerProgressTask:) name:@"NotificationProgressTask" object:nil];
-    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeTheming) name:k_notificationCenter_changeTheming object:nil];
-    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(deleteFile:) name:k_notificationCenter_deleteFile object:nil];
-    
     [self changeTheming];
     
     // Query data source

+ 9 - 4
iOSClient/Main/CCMain.m

@@ -438,10 +438,15 @@
 
 - (void)deleteFile:(NSNotification *)notification
 {
-    if (self.searchController.isActive)
-        [self readFolder:self.serverUrl];
-    else
-        [[NCMainCommon sharedInstance] reloadDatasourceWithServerUrl:self.serverUrl ocId:nil action:k_action_NULL];
+    NSDictionary *userInfo = notification.userInfo;
+    tableMetadata *metadata = userInfo[@"metadata"];
+    if ([metadata.serverUrl isEqualToString:self.serverUrl]) {
+        if (self.searchController.isActive) {
+            [self readFolder:self.serverUrl];
+        } else {
+            [[NCMainCommon sharedInstance] reloadDatasourceWithServerUrl:self.serverUrl ocId:nil action:k_action_NULL];
+        }
+    }
 }
 
 #pragma --------------------------------------------------------------------------------------------