marinofaggiana 3 years ago
parent
commit
d2b02f91d0
1 changed files with 18 additions and 13 deletions
  1. 18 13
      iOSClient/Settings/CCManageAccount.m

+ 18 - 13
iOSClient/Settings/CCManageAccount.m

@@ -379,18 +379,6 @@
 {
 {
     [super formRowDescriptorValueHasChanged:rowDescriptor oldValue:oldValue newValue:newValue];
     [super formRowDescriptorValueHasChanged:rowDescriptor oldValue:oldValue newValue:newValue];
     
     
-    NSArray *accounts = [[NCManageDatabase shared] getAllAccount];
-    tableAccount *activeAccount = [[NCManageDatabase shared] getActiveAccount];
-
-    for (tableAccount *account in accounts) {
-        if ([rowDescriptor.tag isEqualToString:account.account]) {
-            if (![account.account isEqualToString:activeAccount.account]) {
-                [appDelegate changeAccount:account.account];
-                [self initializeForm];
-            }
-        }
-    }
-    
     if ([rowDescriptor.tag isEqualToString:@"accountRequest"]) {
     if ([rowDescriptor.tag isEqualToString:@"accountRequest"]) {
         
         
         if ([[rowDescriptor.value valueData] boolValue] == YES) {
         if ([[rowDescriptor.value valueData] boolValue] == YES) {
@@ -400,13 +388,30 @@
         }
         }
     }
     }
     
     
-    if ([rowDescriptor.tag isEqualToString:@"alias"]) {
+    else if ([rowDescriptor.tag isEqualToString:@"alias"]) {
+        
         if ([newValue isEqual:[NSNull null]]) {
         if ([newValue isEqual:[NSNull null]]) {
             [[NCManageDatabase shared] setAccountAlias:@""];
             [[NCManageDatabase shared] setAccountAlias:@""];
         } else {
         } else {
             [[NCManageDatabase shared] setAccountAlias:newValue];
             [[NCManageDatabase shared] setAccountAlias:newValue];
         }
         }
     }
     }
+    
+    else {
+        
+        NSArray *accounts = [[NCManageDatabase shared] getAllAccount];
+        tableAccount *activeAccount = [[NCManageDatabase shared] getActiveAccount];
+
+        for (tableAccount *account in accounts) {
+            if ([rowDescriptor.tag isEqualToString:account.account]) {
+                if (![account.account isEqualToString:activeAccount.account]) {
+                    [appDelegate changeAccount:account.account];
+                }
+            }
+        }
+        
+        [self initializeForm];
+    }
 }
 }
 
 
 -(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
 -(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {