Marino Faggiana 7 жил өмнө
parent
commit
7e923ae424

+ 6 - 4
iOSClient/Favorites/CCFavorites.m

@@ -225,10 +225,8 @@
 
 - (void)listingFavoritesSuccess:(CCMetadataNet *)metadataNet metadatas:(NSArray *)metadatas
 {
-    // verify active user
-    tableAccount *record = [[NCManageDatabase sharedInstance] getAccountActive];
-    
-    if (![record.account isEqualToString:metadataNet.account])
+    // Check Active Account
+    if (![metadataNet.account isEqualToString:appDelegate.activeAccount])
         return;
     
     NSString *father = @"";
@@ -275,6 +273,10 @@
 
 - (void)listingFavoritesFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode
 {
+    // Check Active Account
+    if (![metadataNet.account isEqualToString:appDelegate.activeAccount])
+        return;
+    
     NSLog(@"[LOG] Listing Favorites failure error %d, %@", (int)errorCode, message);
 }
 

+ 24 - 7
iOSClient/Main/CCMain.m

@@ -2663,9 +2663,8 @@
 {
     [_hud hideHud];
     
-    // change account ?
-    tableAccount *record = [[NCManageDatabase sharedInstance] getAccountActive];
-    if([record.account isEqualToString:metadataNet.account] == NO)
+    // Check Active Account
+    if (![metadataNet.account isEqualToString:appDelegate.activeAccount])
         return;
     
     NSArray *result = [[NCManageDatabase sharedInstance] updateShare:items activeUrl:appDelegate.activeUrl];
@@ -2709,11 +2708,14 @@
 {
     [_hud hideHud];
 
+    // Check Active Account
+    if (![metadataNet.account isEqualToString:appDelegate.activeAccount])
+        return;
+    
     // Unauthorized
     if (errorCode == kOCErrorServerUnauthorized)
         [appDelegate openLoginView:self loginType:loginModifyPasswordUser];
-
-    if (errorCode != kOCErrorServerUnauthorized)
+    else
         [appDelegate messageNotification:@"_share_" description:message visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:errorCode];
 
     if (_shareOC)
@@ -2743,6 +2745,10 @@
 {
     [_hud hideHud];
     
+    // Check Active Account
+    if (![metadataNet.account isEqualToString:appDelegate.activeAccount])
+        return;
+    
     // rimuoviamo la condivisione da db
     NSArray *result = [[NCManageDatabase sharedInstance] unShare:metadataNet.share fileName:metadataNet.fileName serverUrl:metadataNet.serverUrl sharesLink:appDelegate.sharesLink sharesUserAndGroup:appDelegate.sharesUserAndGroup];
     
@@ -2796,6 +2802,10 @@
 {
     [_hud hideHud];
     
+    // Check Active Account
+    if (![metadataNet.account isEqualToString:appDelegate.activeAccount])
+        return;
+    
     if (_shareOC)
         [_shareOC reloadUserAndGroup:items];
 }
@@ -2804,11 +2814,14 @@
 {
     [_hud hideHud];
     
+    // Check Active Account
+    if (![metadataNet.account isEqualToString:appDelegate.activeAccount])
+        return;
+    
     // Unauthorized
     if (errorCode == kOCErrorServerUnauthorized)
         [appDelegate openLoginView:self loginType:loginModifyPasswordUser];
-
-    if (errorCode != kOCErrorServerUnauthorized)
+    else
         [appDelegate messageNotification:@"_error_" description:message visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:errorCode];
 }
 
@@ -2899,6 +2912,10 @@
 
 - (void)settingFavoriteSuccess:(CCMetadataNet *)metadataNet
 {
+    // Check Active Account
+    if (![metadataNet.account isEqualToString:appDelegate.activeAccount])
+        return;
+    
     _dateReadDataSource = nil;
     
     [[NCManageDatabase sharedInstance] setMetadataFavoriteWithFileID:metadataNet.fileID favorite:[metadataNet.options boolValue]];

+ 5 - 0
iOSClient/Notification/CCNotification.swift

@@ -195,6 +195,11 @@ class CCNotification: UITableViewController, OCNetworkingDelegate {
     
     func setNotificationServerSuccess(_ metadataNet: CCMetadataNet!) {
         
+        // Check Active Account
+        if (metadataNet.account != appDelegate.activeAccount) {
+            return
+        }
+        
         let listOfNotifications = appDelegate.listOfNotifications as NSArray as! [OCNotifications]
         
         if let index = listOfNotifications.index(where: {$0.idNotification == Int(metadataNet.assetLocalIdentifier)})  {