Browse Source

improved code

Marino Faggiana 6 years ago
parent
commit
3ccc3abeed

+ 2 - 0
iOSClient/Activity/CCActivity.m

@@ -156,6 +156,8 @@
             [[CCCertificate sharedManager] presentViewControllerCertificateWithTitle:message viewController:self delegate:self];
         } else if (errorCode != 0) {
             [appDelegate messageNotification:@"_error_" description:message visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:errorCode];
+        } else {
+            NSLog(@"[LOG] It has been changed user during networking process, error.");
         }
         [self reloadDatasource];
     }];

+ 4 - 2
iOSClient/AppDelegate.m

@@ -407,7 +407,7 @@
         } else if (errorCode != 0) {
             NSLog(@"[LOG] Subscribed to Push Notification server & proxy error.");
         } else {
-            NSLog(@"[LOG] It has been changed user during OCNetworking. error.");
+            NSLog(@"[LOG] It has been changed user during networking process, error.");
         }
     }];
 }
@@ -422,8 +422,10 @@
        
         if (errorCode == 0) {
             NSLog(@"[LOG] Unsubscribed to Push Notification server & proxy successfully.");
-        } else {
+        } else if (errorCode != 0) {
             NSLog(@"[LOG] Unsubscribed to Push Notification server & proxy error.");
+        } else {
+            NSLog(@"[LOG] It has been changed user during networking process, error.");
         }
     }];
 }

+ 4 - 0
iOSClient/Favorites/CCFavorites.m

@@ -179,6 +179,8 @@
             [[CCCertificate sharedManager] presentViewControllerCertificateWithTitle:message viewController:self delegate:self];
         } else if (errorCode != 0) {
             [appDelegate messageNotification:@"_error_" description:message visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:errorCode];
+        } else {
+            NSLog(@"[LOG] It has been changed user during networking process, error.");
         }
     }];
 }
@@ -244,6 +246,8 @@
             [[CCCertificate sharedManager] presentViewControllerCertificateWithTitle:message viewController:self delegate:self];
         } else if (errorCode != 0) {
             [appDelegate messageNotification:@"_error_" description:message visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:errorCode];
+        } else {
+            NSLog(@"[LOG] It has been changed user during networking process, error.");
         }
     }];
 }

+ 3 - 0
iOSClient/Main/CCDetail.m

@@ -229,7 +229,10 @@
                         
                         if (errorCode != 0) {
                             [appDelegate messageNotification:@"_error_" description:message visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:errorCode];
+                        } else {
+                            NSLog(@"[LOG] It has been changed user during networking process, error.");
                         }
+                        
                         [self.navigationController popViewControllerAnimated:YES];
                     }
                 }];

+ 18 - 0
iOSClient/Main/CCMain.m

@@ -1142,6 +1142,8 @@
             [[CCCertificate sharedManager] presentViewControllerCertificateWithTitle:message viewController:self delegate:self];
         } else if (errorCode != 0) {
             [appDelegate messageNotification:@"_error_" description:message visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:errorCode];
+        } else {
+            NSLog(@"[LOG] It has been changed user during networking process, error.");
         }
     }];
 }
@@ -1272,6 +1274,8 @@
             [[CCCertificate sharedManager] presentViewControllerCertificateWithTitle:message viewController:self delegate:self];
         } else if (errorCode != 0) {
             [appDelegate messageNotification:@"_error_" description:message visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:errorCode];
+        } else {
+            NSLog(@"[LOG] It has been changed user during networking process, error.");
         }
         
         _loadingFolder = NO;
@@ -1333,6 +1337,8 @@
                 [[CCCertificate sharedManager] presentViewControllerCertificateWithTitle:message viewController:self delegate:self];
             } else if (errorCode != 0) {
                 [appDelegate messageNotification:@"_error_" description:message visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:errorCode];
+            } else {
+                NSLog(@"[LOG] It has been changed user during networking process, error.");
             }
             
             _searchFileName = @"";
@@ -1564,11 +1570,15 @@
                             
                         } else if (errorCode != 0) {
                             [appDelegate messageNotification:@"_rename_" description:message visible:true delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:errorCode];
+                        } else {
+                            NSLog(@"[LOG] It has been changed user during networking process, error.");
                         }
                     }];
                 } else {
                     [appDelegate messageNotification:@"_error_" description:message visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:errorCode];
                 }
+            } else {
+                NSLog(@"[LOG] It has been changed user during networking process, error.");
             }
         }];
     }
@@ -1655,6 +1665,8 @@
                             [self readFolder:metadata.serverUrl];
                         else
                             [[NCMainCommon sharedInstance] reloadDatasourceWithServerUrl:metadata.serverUrl fileID:nil action:k_action_NULL];
+                    } else {
+                        NSLog(@"[LOG] It has been changed user during networking process, error.");
                     }
                 }];
                 
@@ -1662,6 +1674,8 @@
             } else {
                 [appDelegate messageNotification:@"_error_" description:message visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:errorCode];
             }
+        } else {
+            NSLog(@"[LOG] It has been changed user during networking process, error.");
         }
     }];
 }
@@ -1810,6 +1824,8 @@
                 [[CCCertificate sharedManager] presentViewControllerCertificateWithTitle:message viewController:self delegate:self];
             } else if (errorCode != 0) {
                 [appDelegate messageNotification:@"_create_folder_" description:message visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:errorCode];
+            } else {
+                NSLog(@"[LOG] It has been changed user during networking process, error.");
             }
         }
     }];
@@ -2188,6 +2204,8 @@
             [[CCCertificate sharedManager] presentViewControllerCertificateWithTitle:message viewController:self delegate:self];
         } else if (errorCode != 0) {
             [appDelegate messageNotification:@"_error_" description:message visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:errorCode];
+        } else {
+            NSLog(@"[LOG] It has been changed user during networking process, error.");
         }
     }];
 }

+ 6 - 1
iOSClient/Main/Create cloud/NCCreateFormUploadRichdocuments.swift

@@ -271,6 +271,8 @@ class NCCreateFormUploadRichdocuments: XLFormViewController, NCSelectDelegate, U
                 }
             } else if errorCode != 0 {
                 self.appDelegate.messageNotification("_error_", description: message, visible: true, delay: TimeInterval(k_dismissAfterSecond), type: TWMessageBarMessageType.error, errorCode: errorCode)
+            } else {
+                print("[LOG] It has been changed user during networking process, error.")
             }
         })
     }
@@ -307,8 +309,9 @@ class NCCreateFormUploadRichdocuments: XLFormViewController, NCSelectDelegate, U
                 self.collectionView.reloadData()
                 
             } else if errorCode != 0 {
-                
                 self.appDelegate.messageNotification("_error_", description: message, visible: true, delay: TimeInterval(k_dismissAfterSecond), type: TWMessageBarMessageType.error, errorCode: errorCode)
+            } else {
+                print("[LOG] It has been changed user during networking process, error.")
             }
         })
     }
@@ -323,6 +326,8 @@ class NCCreateFormUploadRichdocuments: XLFormViewController, NCSelectDelegate, U
                 self.collectionView.reloadItems(at: [indexPath])
             } else if errorCode != 0 {
                 print("\(errorCode)")
+            } else {
+                print("[LOG] It has been changed user during networking process, error.")
             }
         })
     }

+ 0 - 1
iOSClient/Main/NCMainCommon.swift

@@ -1168,7 +1168,6 @@ class NCNetworkingMain: NSObject, CCNetworkingDelegate {
             let height = NCUtility.sharedInstance.getScreenHeightForPreview()
             
             OCNetworking.sharedManager().downloadPreview(withAccount: appDelegate.activeAccount, metadata: metadata, withWidth: width, andHeight: height, completion: { (account, message, errorCode) in
-              
                 if errorCode == 0 && account == self.appDelegate.activeAccount {
                     if CCUtility.fileProviderStorageIconExists(metadata.fileID, fileNameView: metadata.fileName) {
                         if view is UICollectionView && NCMainCommon.sharedInstance.isValidIndexPath(indexPath, view: view) {

+ 10 - 0
iOSClient/Media/CCMedia.m

@@ -707,8 +707,18 @@
                 }];
                 
             } else {
+                if (errorCode != 0) {
+                    NSLog(@"[LOG] Search error.");
+                } else {
+                    NSLog(@"[LOG] It has been changed user during networking process, error.");
+                }
+                
                 [self reloadDatasource:nil action:k_action_NULL];
             }
+        } else if (errorCode != 0) {
+            NSLog(@"[LOG] Read file error.");
+        } else {
+            NSLog(@"[LOG] It has been changed user during networking process, error.");
         }
     }];
 }

+ 4 - 2
iOSClient/Move/CCMove.m

@@ -285,7 +285,6 @@
             }
         } else {
             [self readFolder];
-
         }
     }];
 }
@@ -322,6 +321,8 @@
             }]];
             
             [self presentViewController:alertController animated:YES completion:nil];
+        } else {
+            NSLog(@"[LOG] It has been changed user during networking process, error.");
         }
         
         _loadingFolder = NO;
@@ -343,10 +344,11 @@
         if (errorCode == 0 && [account isEqualToString:activeAccount]) {
             [self readFolder];
         } else if (errorCode != 0) {
-            
             UIAlertController *alertController = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"_error_",nil) message:message preferredStyle:UIAlertControllerStyleAlert];
             [alertController addAction: [UIAlertAction actionWithTitle:NSLocalizedString(@"_ok_", nil) style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { }]];
             [self presentViewController:alertController animated:YES completion:nil];
+        } else {
+            NSLog(@"[LOG] It has been changed user during networking process, error.");
         }
     }];
 }

+ 9 - 1
iOSClient/Networking/NCService.swift

@@ -169,6 +169,8 @@ class NCService: NSObject {
                                 }
                                 
                                 NCManageDatabase.sharedInstance.addActivityClient("", fileID: "", action: k_activityDebugActionCapabilities, selector: "Get Notification Server", note: error, type: k_activityTypeFailure, verbose: true, activeUrl: self.appDelegate.activeUrl)
+                            } else {
+                                print("[LOG] It has been changed user during networking process, error.")
                             }
                             
                             // Update Main NavigationBar
@@ -211,6 +213,8 @@ class NCService: NSObject {
                             }
                                 
                             NCManageDatabase.sharedInstance.addActivityClient("", fileID: "", action: k_activityDebugActionCapabilities, selector: "Get external site Server", note: error, type: k_activityTypeFailure, verbose: true, activeUrl: "")
+                        } else {
+                            print("[LOG] It has been changed user during networking process, error.")
                         }
                     })
                    
@@ -251,6 +255,7 @@ class NCService: NSObject {
                 }
                 NCManageDatabase.sharedInstance.addActivityClient("", fileID: "", action: k_activityDebugActionCapabilities, selector: "Get Capabilities of Server", note: error, type: k_activityTypeFailure, verbose: true, activeUrl: "")
             } else {
+                print("[LOG] It has been changed user during networking process, error.")
                 // Change Theming color
                 self.appDelegate.settingThemingColorBrand()
             }
@@ -321,8 +326,9 @@ class NCService: NSObject {
                 }
                 
                 NCManageDatabase.sharedInstance.addActivityClient("", fileID: "", action: k_activityDebugActionCapabilities, selector: "Get user profile Server", note: error, type: k_activityTypeFailure, verbose: true, activeUrl: "")
+            } else {
+                print("[LOG] It has been changed user during networking process, error.")
             }
-            
         })
     }
     
@@ -347,6 +353,8 @@ class NCService: NSObject {
                 }
                 
                 NCManageDatabase.sharedInstance.addActivityClient("", fileID: "", action: k_activityDebugActionCapabilities, selector: "Get Activity Server", note: error, type: k_activityTypeFailure, verbose: true, activeUrl: "")
+            } else {
+                print("[LOG] It has been changed user during networking process, error.")
             }
         })
     }

+ 4 - 0
iOSClient/Notification/CCNotification.swift

@@ -102,6 +102,8 @@ class CCNotification: UITableViewController {
                         
                     } else if errorCode != 0 {
                         self.appDelegate.messageNotification("_error_", description: message, visible: true, delay: TimeInterval(k_dismissAfterSecond), type: TWMessageBarMessageType.error, errorCode: errorCode)
+                    } else {
+                        print("[LOG] It has been changed user during networking process, error.")
                     }
                 })
             }
@@ -143,6 +145,8 @@ class CCNotification: UITableViewController {
                                     
                                 } else if errorCode != 0 {
                                     self.appDelegate.messageNotification("_error_", description: message, visible: true, delay: TimeInterval(k_dismissAfterSecond), type: TWMessageBarMessageType.error, errorCode: errorCode)
+                                } else {
+                                    print("[LOG] It has been changed user during networking process, error.")
                                 }
                             })
                         }

+ 2 - 0
iOSClient/PeekPop/CCPeekPop.m

@@ -113,6 +113,8 @@
             
             if (errorCode != 0)  {
                 [appDelegate messageNotification:@"_error_" description:message visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:errorCode];
+            } else {
+                NSLog(@"[LOG] It has been changed user during networking process, error.");
             }
             
             [self dismissViewControllerAnimated:YES completion:nil];

+ 4 - 1
iOSClient/Select/NCSelect.swift

@@ -466,6 +466,8 @@ class NCSelect: UIViewController ,UICollectionViewDataSource, UICollectionViewDe
                 self.loadDatasource(withLoadFolder: true)
             } else if errorCode != 0 {
                 self.appDelegate.messageNotification("_error_", description: message, visible: true, delay: TimeInterval(k_dismissAfterSecond), type: TWMessageBarMessageType.error, errorCode: errorCode)
+            } else {
+                print("[LOG] It has been changed user during networking process, error.")
             }
         })
     }
@@ -494,8 +496,9 @@ class NCSelect: UIViewController ,UICollectionViewDataSource, UICollectionViewDe
                 }
                 
             } else if errorCode != 0 {
-                
                 self.appDelegate.messageNotification("_error_", description: message, visible: true, delay: TimeInterval(k_dismissAfterSecond), type: TWMessageBarMessageType.error, errorCode: errorCode)
+            } else {
+                print("[LOG] It has been changed user during networking process, error.")
             }
             
             self.networkInProgress = false

+ 2 - 0
iOSClient/Share/CCShareInfoCMOC.m

@@ -168,6 +168,8 @@ const PERMISSION_ALL = 31;
             [appDelegate messageNotification:@"_error_" description:message visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:errorCode];
             
             [self dismissViewControllerAnimated:YES completion:nil];
+        } else {
+            NSLog(@"[LOG] It has been changed user during networking process, error.");
         }
     }];
     

+ 2 - 3
iOSClient/Shares/NCShares.m

@@ -174,6 +174,8 @@
             [[CCCertificate sharedManager] presentViewControllerCertificateWithTitle:message viewController:self delegate:self];
         } else if (errorCode != 0) {
             [appDelegate messageNotification:@"_share_" description:message visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:errorCode];
+        } else {
+            NSLog(@"[LOG] It has been changed user during networking process, error.");
         }
     }];
 }
@@ -294,12 +296,9 @@
         cell.fileImageView.image = [CCGraphics changeThemingColorImage:[UIImage imageNamed:@"file"] multiplier:2 color:[NCBrandColor sharedInstance].brandElement];
         
         [[OCNetworking sharedManager] readFileWithAccount:appDelegate.activeAccount serverUrl:table.serverUrl fileName:table.fileName completion:^(NSString *account, tableMetadata *metadata, NSString *message, NSInteger errorCode) {
-            
             if (errorCode == 0 && [account isEqualToString:appDelegate.activeAccount]) {
-                
                 (void)[[NCManageDatabase sharedInstance] addMetadata:metadata];
                 [self reloadDatasource];
-                
             } 
         }];
     }

+ 8 - 0
iOSClient/Trash/NCTrash.swift

@@ -465,6 +465,8 @@ class NCTrash: UIViewController ,UICollectionViewDataSource, UICollectionViewDel
                 NCManageDatabase.sharedInstance.addTrashs(item as! [tableTrash])                
             } else if errorCode != 0 {
                 self.appDelegate.messageNotification("_error_", description: message, visible: true, delay: TimeInterval(k_dismissAfterSecond), type: TWMessageBarMessageType.error, errorCode: errorCode)
+            } else {
+                print("[LOG] It has been changed user during networking process, error.")
             }
             
             self.loadDatasource()
@@ -486,6 +488,8 @@ class NCTrash: UIViewController ,UICollectionViewDataSource, UICollectionViewDel
                 self.loadDatasource()
             } else if errorCode != 0 {
                 self.appDelegate.messageNotification("_error_", description: message, visible: true, delay: TimeInterval(k_dismissAfterSecond), type: TWMessageBarMessageType.error, errorCode: errorCode)
+            } else {
+                print("[LOG] It has been changed user during networking process, error.")
             }
         })
     }
@@ -497,6 +501,8 @@ class NCTrash: UIViewController ,UICollectionViewDataSource, UICollectionViewDel
                 NCManageDatabase.sharedInstance.deleteTrash(fileID: nil, account: self.appDelegate.activeAccount)
             } else if errorCode != 0 {
                 self.appDelegate.messageNotification("_error_", description: message, visible: true, delay: TimeInterval(k_dismissAfterSecond), type: TWMessageBarMessageType.error, errorCode: errorCode)
+            } else {
+                print("[LOG] It has been changed user during networking process, error.")
             }
             self.loadDatasource()
         })
@@ -516,6 +522,8 @@ class NCTrash: UIViewController ,UICollectionViewDataSource, UICollectionViewDel
                 self.loadDatasource()
             } else if errorCode != 0 {
                 self.appDelegate.messageNotification("_error_", description: message, visible: true, delay: TimeInterval(k_dismissAfterSecond), type: TWMessageBarMessageType.error, errorCode: errorCode)
+            } else {
+                print("[LOG] It has been changed user during networking process, error.")
             }
         })
     }

+ 4 - 0
iOSClient/Viewer/NCViewerRichdocument.swift

@@ -116,6 +116,8 @@ class NCViewerRichdocument: NSObject, WKNavigationDelegate, WKScriptMessageHandl
                     self.webView.evaluateJavaScript(functionJS, completionHandler: { (result, error) in })
                 } else if errorCode != 0 {
                     self.appDelegate.messageNotification("_error_", description: message, visible: true, delay: TimeInterval(k_dismissAfterSecond), type: TWMessageBarMessageType.error, errorCode: Int(k_CCErrorInternalError))
+                } else {
+                    print("[LOG] It has been changed user during networking process, error.")
                 }
             })
         }
@@ -129,6 +131,8 @@ class NCViewerRichdocument: NSObject, WKNavigationDelegate, WKScriptMessageHandl
                 self.webView.evaluateJavaScript(functionJS, completionHandler: { (result, error) in })
             } else if errorCode != 0 {
                 self.appDelegate.messageNotification("_error_", description: message, visible: true, delay: TimeInterval(k_dismissAfterSecond), type: TWMessageBarMessageType.error, errorCode: Int(k_CCErrorInternalError))
+            } else {
+                print("[LOG] It has been changed user during networking process, error.")
             }
         })
     }