marinofaggiana 4 år sedan
förälder
incheckning
f4b266e2ce

+ 8 - 8
iOSClient/AppDelegate.m

@@ -75,9 +75,9 @@
     NSString *versionApp = [NSString stringWithFormat:@"%@.%@", [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"], [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]];
     NSString *versionNextcloudiOS = [NSString stringWithFormat:[NCBrandOptions sharedInstance].textCopyrightNextcloudiOS, versionApp];
     if (isSimulatorOrTestFlight) {
-        [[NCCommunicationCommon shared] writeLog:[NSString stringWithFormat:@"[LOG] Start session with level %lu %@ (Simulator / TestFlight)", (unsigned long)logLevel, versionNextcloudiOS]];
+        [[NCCommunicationCommon shared] writeLog:[NSString stringWithFormat:@"Start session with level %lu %@ (Simulator / TestFlight)", (unsigned long)logLevel, versionNextcloudiOS]];
     } else {
-        [[NCCommunicationCommon shared] writeLog:[NSString stringWithFormat:@"[LOG] Start session with level %lu %@", (unsigned long)logLevel, versionNextcloudiOS]];
+        [[NCCommunicationCommon shared] writeLog:[NSString stringWithFormat:@"Start session with level %lu %@", (unsigned long)logLevel, versionNextcloudiOS]];
     }
     
     // Set account, if no exists clear all
@@ -268,7 +268,7 @@
 //
 - (void)applicationWillTerminate:(UIApplication *)application
 {    
-    [[NCCommunicationCommon shared] writeLog:@"[LOG] bye bye"];
+    [[NCCommunicationCommon shared] writeLog:@"bye bye"];
 }
 
 #pragma --------------------------------------------------------------------------------------------
@@ -516,7 +516,7 @@
             [[NCCommunication shared] subscribingPushProxyWithProxyServerUrl:proxyServerPath pushToken:self.pushKitToken deviceIdentifier:deviceIdentifier signature:signature publicKey:publicKey userAgent:userAgent completionHandler:^(NSInteger errorCode, NSString *errorDescription) {
                 if (errorCode == 0) {
                     
-                    [[NCCommunicationCommon shared] writeLog:@"[LOG] Subscribed to Push Notification server & proxy successfully"];
+                    [[NCCommunicationCommon shared] writeLog:@"Subscribed to Push Notification server & proxy successfully"];
 
                     [CCUtility setPushNotificationToken:account token:self.pushKitToken];
                     [CCUtility setPushNotificationDeviceIdentifier:account deviceIdentifier:deviceIdentifier];
@@ -545,7 +545,7 @@
             [[NCCommunication shared] unsubscribingPushProxyWithProxyServerUrl:proxyServerPath deviceIdentifier:deviceIdentifier signature:signature publicKey:publicKey userAgent:userAgent completionHandler:^(NSInteger errorCode, NSString *errorDescription) {
                 if (errorCode == 0) {
                 
-                    [[NCCommunicationCommon shared] writeLog:@"[LOG] Unsubscribed to Push Notification server & proxy successfully."];
+                    [[NCCommunicationCommon shared] writeLog:@"Unsubscribed to Push Notification server & proxy successfully."];
                     
                     [CCUtility setPushNotificationPublicKey:account data:nil];
                     [CCUtility setPushNotificationSubscribingPublicKey:account publicKey:nil];
@@ -1002,14 +1002,14 @@
         return;
     }
     
-    [[NCCommunicationCommon shared] writeLog:@"[LOG] Start perform Fetch With Completion Handler"];
+    [[NCCommunicationCommon shared] writeLog:@"Start perform Fetch With Completion Handler"];
     
     // Verify new photo
     [[NCAutoUpload sharedInstance] initStateAutoUpload];
     
     // after 20 sec
     dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 20 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
-        [[NCCommunicationCommon shared] writeLog:@"[LOG] End 20 sec. perform Fetch With Completion Handler"];
+        [[NCCommunicationCommon shared] writeLog:@"End 20 sec. perform Fetch With Completion Handler"];
         completionHandler(UIBackgroundFetchResultNoData);
     });
 }
@@ -1023,7 +1023,7 @@
 //
 - (void)application:(UIApplication *)application handleEventsForBackgroundURLSession:(NSString *)identifier completionHandler:(void (^)(void))completionHandler
 {
-    [[NCCommunicationCommon shared] writeLog:[NSString stringWithFormat:@"[LOG] Start handle Events For Background URLSession: %@", identifier]];
+    [[NCCommunicationCommon shared] writeLog:[NSString stringWithFormat:@"Start handle Events For Background URLSession: %@", identifier]];
     
     [self updateApplicationIconBadgeNumber];
     

+ 6 - 6
iOSClient/AutoUpload/NCAutoUpload.m

@@ -137,13 +137,13 @@
     
     if ([CLLocationManager locationServicesEnabled]) {
         
-        [[NCCommunicationCommon shared] writeLog:[NSString stringWithFormat:@"[LOG] Check if location is enabled: authorizationStatus: %d", [CLLocationManager authorizationStatus]]];
+        [[NCCommunicationCommon shared] writeLog:[NSString stringWithFormat:@"Check if location is enabled: authorizationStatus: %d", [CLLocationManager authorizationStatus]]];
         
         if ([CLLocationManager authorizationStatus] != kCLAuthorizationStatusAuthorizedAlways) {
             
             if ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusNotDetermined ) {
                 
-                [[NCCommunicationCommon shared] writeLog:@"[LOG] Check if location is enabled: Location services not determined"];
+                [[NCCommunicationCommon shared] writeLog:@"Check if location is enabled: Location services not determined"];
                 [[CCManageLocation sharedInstance] startSignificantChangeUpdates];
                 
             } else {
@@ -295,7 +295,7 @@
             //check location
             if ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusAuthorizedAlways) {
                 
-                [[NCCommunicationCommon shared] writeLog:@"[LOG] Changed Location call upload new assets"];
+                [[NCCommunicationCommon shared] writeLog:@"Changed Location call upload new assets"];
                 [self uploadNewAssets];
             }
             
@@ -351,12 +351,12 @@
     // News Assets ? if no verify if blocked Table Auto Upload -> Autostart
     if (newAssetToUpload == nil || [newAssetToUpload count] == 0) {
         
-        [[NCCommunicationCommon shared] writeLog:@"[LOG] Auto upload, no new assets found"];
+        [[NCCommunicationCommon shared] writeLog:@"Auto upload, no new assets found"];
         return;
         
     } else {
         
-        [[NCCommunicationCommon shared] writeLog:[NSString stringWithFormat:@"[LOG] Auto upload, new %lu assets found", (unsigned long)[newAssetToUpload count]]];
+        [[NCCommunicationCommon shared] writeLog:[NSString stringWithFormat:@"Auto upload, new %lu assets found", (unsigned long)[newAssetToUpload count]]];
     }
     
     dispatch_async(dispatch_get_main_queue(), ^{
@@ -588,7 +588,7 @@
     if (assets != nil) {
         (void)[[NCManageDatabase sharedInstance] addPhotoLibrary:(NSArray *)assets account:account.account];
 
-        [[NCCommunicationCommon shared] writeLog:[NSString stringWithFormat:@"[LOG] Align Photo Library %lu", (unsigned long)[assets count]]];
+        [[NCCommunicationCommon shared] writeLog:[NSString stringWithFormat:@"Align Photo Library %lu", (unsigned long)[assets count]]];
     }
 }
 

+ 61 - 61
iOSClient/Database/NCManageDatabase.swift

@@ -191,7 +191,7 @@ class NCManageDatabase: NSObject {
         do {
             try realm.commitWrite()
         } catch let error {
-            NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
         }
     }
     
@@ -234,7 +234,7 @@ class NCManageDatabase: NSObject {
             do {
                 try FileManager.default.removeItem(at: URL)
             } catch let error {
-                NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+                NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
             }
         }
     }
@@ -296,7 +296,7 @@ class NCManageDatabase: NSObject {
         do {
             try realm.commitWrite()
         } catch let error {
-            NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
         }
     }
     
@@ -309,7 +309,7 @@ class NCManageDatabase: NSObject {
                 realm.add(account, update: .all)
             }
         } catch let error {
-            NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
         }
     }
     
@@ -325,7 +325,7 @@ class NCManageDatabase: NSObject {
         do {
             try realm.commitWrite()
         } catch let error {
-            NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
         }
     }
 
@@ -432,7 +432,7 @@ class NCManageDatabase: NSObject {
                 }
             }
         } catch let error {
-            NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
             return nil
         }
         
@@ -453,7 +453,7 @@ class NCManageDatabase: NSObject {
                 result.password = "********"
             }
         } catch let error {
-            NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
         }
     }
 
@@ -475,10 +475,10 @@ class NCManageDatabase: NSObject {
             do {
                 try realm.commitWrite()
             } catch let error {
-                NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+                NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
             }
         } else {
-            print("[LOG] property not found")
+            NCCommunicationCommon.shared.writeLog("Property not found in database")
         }
     }
     
@@ -502,7 +502,7 @@ class NCManageDatabase: NSObject {
                 }
             }
         } catch let error {
-            NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
         }
     }
 
@@ -526,7 +526,7 @@ class NCManageDatabase: NSObject {
                 }
             }
         } catch let error {
-            NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
         }
     }
     
@@ -573,7 +573,7 @@ class NCManageDatabase: NSObject {
                 returnAccount = result
             }
         } catch let error {
-            NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
         }
         
         return tableAccount.init(value: returnAccount)
@@ -607,7 +607,7 @@ class NCManageDatabase: NSObject {
                 returnAccount = result
             }
         } catch let error {
-            NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
         }
         
         return tableAccount.init(value: returnAccount)
@@ -679,7 +679,7 @@ class NCManageDatabase: NSObject {
                 }
             }
         } catch let error {
-            NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
         }
     }
     
@@ -766,7 +766,7 @@ class NCManageDatabase: NSObject {
                 }
             }
         } catch let error {
-            NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
         }
     }
     
@@ -856,7 +856,7 @@ class NCManageDatabase: NSObject {
         do {
             try realm.commitWrite()
         } catch let error {
-            NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
         }
     }
     
@@ -983,7 +983,7 @@ class NCManageDatabase: NSObject {
                 }
             }
         } catch let error {
-            NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
         }
     }
     
@@ -1050,7 +1050,7 @@ class NCManageDatabase: NSObject {
                 }
             }
         } catch let error {
-            NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
         }
     }
     
@@ -1131,7 +1131,7 @@ class NCManageDatabase: NSObject {
         do {
             try realm.commitWrite()
         } catch let error {
-            NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
         }
     }
     
@@ -1154,7 +1154,7 @@ class NCManageDatabase: NSObject {
                 realm.delete(results)
             }
         } catch let error {
-            NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
         }
     }
     
@@ -1193,7 +1193,7 @@ class NCManageDatabase: NSObject {
                 realm.add(directory, update: .all)
             }
         } catch let error {
-            NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
         }
     }
     
@@ -1237,7 +1237,7 @@ class NCManageDatabase: NSObject {
         do {
             try realm.commitWrite()
         } catch let error {
-            NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
         }
     }
     
@@ -1256,7 +1256,7 @@ class NCManageDatabase: NSObject {
                 result.offline = offline
             }
         } catch let error {
-            NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
         }
     }
     
@@ -1273,7 +1273,7 @@ class NCManageDatabase: NSObject {
         do {
             try realm.commitWrite()
         } catch let error {
-            NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
         }
     }
 
@@ -1290,7 +1290,7 @@ class NCManageDatabase: NSObject {
                 realm.add(e2e, update: .all)
             }
         } catch let error {
-            NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
         }
     }
     
@@ -1305,7 +1305,7 @@ class NCManageDatabase: NSObject {
                 realm.delete(results)
             }
         } catch let error {
-            NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
         }
     }
     
@@ -1366,7 +1366,7 @@ class NCManageDatabase: NSObject {
         do {
             try realm.commitWrite()
         } catch let error {
-            NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
         }
     }
     
@@ -1410,7 +1410,7 @@ class NCManageDatabase: NSObject {
         do {
             try realm.commitWrite()
         } catch let error {
-            NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
         }
     }
     
@@ -1433,7 +1433,7 @@ class NCManageDatabase: NSObject {
         do {
             try realm.commitWrite()
         } catch let error {
-            NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
         }
     }
 
@@ -1460,7 +1460,7 @@ class NCManageDatabase: NSObject {
                 realm.add(addObject)
             }
         } catch let error {
-            NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
         }
     }
     
@@ -1475,7 +1475,7 @@ class NCManageDatabase: NSObject {
                 realm.delete(results)
             }
         } catch let error {
-            NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
         }
     }
     
@@ -1520,7 +1520,7 @@ class NCManageDatabase: NSObject {
         do {
             try realm.commitWrite()
         } catch let error {
-            NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
         }
     }
     
@@ -1564,7 +1564,7 @@ class NCManageDatabase: NSObject {
                 realm.add(addObject, update: .all)
             }
         } catch let error {
-            NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
         }
     }
     
@@ -1579,7 +1579,7 @@ class NCManageDatabase: NSObject {
                 realm.delete(results)
             }
         } catch let error {
-            NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
         }
     }
     
@@ -1615,7 +1615,7 @@ class NCManageDatabase: NSObject {
                 }
             }
         } catch let error {
-            NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
         }
     }
     
@@ -1653,7 +1653,7 @@ class NCManageDatabase: NSObject {
                 result.offline = offline
             }
         } catch let error {
-            NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
         }
     }
 
@@ -1794,7 +1794,7 @@ class NCManageDatabase: NSObject {
                 realm.add(metadata, update: .all)
             }
         } catch let error {
-            NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
         }
     }
     
@@ -1809,7 +1809,7 @@ class NCManageDatabase: NSObject {
                 }
             }
         } catch let error {
-            NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
         }
     }
     
@@ -1868,7 +1868,7 @@ class NCManageDatabase: NSObject {
                 }
             }
         } catch let error {
-            NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
         }
     }
     
@@ -1882,7 +1882,7 @@ class NCManageDatabase: NSObject {
                 realm.delete(results)
             }
         } catch let error {
-            NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
         }
     }
     
@@ -1897,7 +1897,7 @@ class NCManageDatabase: NSObject {
                 }
             }
         } catch let error {
-            NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
         }
     }
     
@@ -1913,7 +1913,7 @@ class NCManageDatabase: NSObject {
                 }
             }
         } catch let error {
-            NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
         }
     }
     
@@ -1929,7 +1929,7 @@ class NCManageDatabase: NSObject {
                 }
             }
         } catch let error {
-            NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
         }
     }
 
@@ -1989,7 +1989,7 @@ class NCManageDatabase: NSObject {
                 }
             }
         } catch let error {
-            NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
         }
         
         for ocId in ocIdsUdate {
@@ -2039,7 +2039,7 @@ class NCManageDatabase: NSObject {
                     }
                 }
             } catch let error {
-                NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+                NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
             }
         }
     }
@@ -2055,7 +2055,7 @@ class NCManageDatabase: NSObject {
                 }
             }
         } catch let error {
-            NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
         }
         
         if let result = realm.objects(tableMetadata.self).filter(NSPredicate(format: "ocId == %@", ocId)).first {
@@ -2081,7 +2081,7 @@ class NCManageDatabase: NSObject {
         do {
             try realm.commitWrite()
         } catch let error {
-            NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
         }
     }
    
@@ -2101,7 +2101,7 @@ class NCManageDatabase: NSObject {
         do {
             try realm.commitWrite()
         } catch let error {
-            NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
         }
     }
        
@@ -2121,7 +2121,7 @@ class NCManageDatabase: NSObject {
         do {
             try realm.commitWrite()
         } catch let error {
-            NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
         }
     }
     
@@ -2261,7 +2261,7 @@ class NCManageDatabase: NSObject {
                 realm.delete(results)
             }
         } catch let error {
-            NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
         }
     }
     
@@ -2279,7 +2279,7 @@ class NCManageDatabase: NSObject {
         do {
             try realm.commitWrite()
         } catch let error {
-            NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
         }
     }
     
@@ -2311,7 +2311,7 @@ class NCManageDatabase: NSObject {
                 }
             }
         } catch let error {
-            NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
         }
     }
     
@@ -2376,7 +2376,7 @@ class NCManageDatabase: NSObject {
                 }
             }
         } catch let error {
-            NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
             return false
         }
         
@@ -2474,7 +2474,7 @@ class NCManageDatabase: NSObject {
         do {
             try realm.commitWrite()
         } catch let error {
-            NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
         }
     }
     
@@ -2547,7 +2547,7 @@ class NCManageDatabase: NSObject {
         do {
             try realm.commitWrite()
         } catch let error {
-            NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
         }
     }
     
@@ -2563,7 +2563,7 @@ class NCManageDatabase: NSObject {
         do {
             try realm.commitWrite()
         } catch let error {
-            NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
         }
     }
     
@@ -2587,7 +2587,7 @@ class NCManageDatabase: NSObject {
                 realm.add(addObject, update: .all)
             }
         } catch let error {
-            NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
         }
     }
     
@@ -2603,7 +2603,7 @@ class NCManageDatabase: NSObject {
         do {
             try realm.commitWrite()
         } catch let error {
-            NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
         }
     }
     
@@ -2658,7 +2658,7 @@ class NCManageDatabase: NSObject {
                 }
             }
         } catch let error {
-            NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
         }
     }
     
@@ -2681,7 +2681,7 @@ class NCManageDatabase: NSObject {
         do {
             try realm.commitWrite()
         } catch let error {
-            NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
         }
     }
     
@@ -2704,7 +2704,7 @@ class NCManageDatabase: NSObject {
         do {
             try realm.commitWrite()
         } catch let error {
-            NCCommunicationCommon.shared.writeLog("[LOG] Could not write to database: \(error)")
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
         }
     }
     

+ 1 - 1
iOSClient/Main/CCMain.m

@@ -407,7 +407,7 @@
         }
         [[NCAutoUpload sharedInstance] initStateAutoUpload];
         
-        [[NCCommunicationCommon shared] writeLog:@"[LOG] Request Service Server Nextcloud"];
+        [[NCCommunicationCommon shared] writeLog:@"Request Service Server Nextcloud"];
         [[NCService shared] startRequestServicesServer];
                 
         // Read this folder

+ 2 - 2
iOSClient/ManageLocation+ManageAsset/CCManageLocation.m

@@ -65,7 +65,7 @@
     AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
     CLLocation* location = [locations lastObject];
     
-    [[NCCommunicationCommon shared] writeLog:[NSString stringWithFormat:@"[LOG] update location manager: latitude %+.6f, longitude %+.6f", location.coordinate.latitude, location.coordinate.longitude]];
+    [[NCCommunicationCommon shared] writeLog:[NSString stringWithFormat:@"update location manager: latitude %+.6f, longitude %+.6f", location.coordinate.latitude, location.coordinate.longitude]];
     
     appDelegate.currentLatitude = location.coordinate.latitude;
     appDelegate.currentLongitude = location.coordinate.longitude;
@@ -80,7 +80,7 @@
 
 - (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error
 {
-    [[NCCommunicationCommon shared] writeLog:[NSString stringWithFormat:@"[LOG] Location manager didFailWithError: Unable to start location manager, %@", [error description]]];
+    [[NCCommunicationCommon shared] writeLog:[NSString stringWithFormat:@"Location manager didFailWithError: Unable to start location manager, %@", [error description]]];
     
     [self.delegate statusAuthorizationLocationChanged];
 }

+ 5 - 4
iOSClient/ManageLocation+ManageAsset/PHAsset+Utility.m

@@ -6,8 +6,9 @@
 //
 
 #import "PHAsset+Utility.h"
-@import Photos;
+#import "NCBridgeSwift.h"
 
+@import Photos;
 @implementation PHAsset (Utilities)
 
 #pragma mark Public methods
@@ -19,7 +20,7 @@
             [changeRequest addAssets:@[self]];
         } completionHandler:^(BOOL success, NSError *error) {
             if(success == NO) {
-                NSLog(@"[LOG] Failed to add PHAsset to album: %@ error: %@", title, error.localizedDescription);
+                [[NCCommunicationCommon shared] writeLog:[NSString stringWithFormat:@"Failed to add PHAsset to album %@ error: %@", title, error]];
             }
             return completionBlock(success);
         }];
@@ -36,7 +37,7 @@
             [PHAssetCollectionChangeRequest creationRequestForAssetCollectionWithTitle:title];
         } completionHandler:^(BOOL success, NSError *error) {
             if (!success) {
-                NSLog(@"[LOG] Error creating album: %@", error);
+                [[NCCommunicationCommon shared] writeLog:[NSString stringWithFormat:@"Error creating album: %@", error]];
             } else {
                 PHAssetCollection *assetCollection = [self albumWithTitle:title];
                 saveAssetCollection(assetCollection);
@@ -124,7 +125,7 @@
 
 +(PHAsset*)getAssetFromlocalIdentifier:(NSString*)localIdentifier{
     if(localIdentifier == nil){
-        NSLog(@"[LOG] Cannot get asset from localID because it is nil");
+        [[NCCommunicationCommon shared] writeLog:[NSString stringWithFormat:@"Cannot get asset from localID because it is nil"]];
         return nil;
     }
     

+ 1 - 8
iOSClient/Networking/NCNetworking.swift

@@ -121,13 +121,10 @@ import Queuer
     }
     
     func authenticationChallenge(_ challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) {
-        NCCommunicationCommon.shared.writeLog("[LOG] NCNteworkink.authenticationChallenge")
 
         if checkTrustedChallenge(challenge: challenge, directoryCertificate: CCUtility.getDirectoryCerificates()) {
-            NCCommunicationCommon.shared.writeLog("[LOG] NCNteworkink.authenticationChallenge TRUST")
             completionHandler(URLSession.AuthChallengeDisposition.useCredential, URLCredential.init(trust: challenge.protectionSpace.serverTrust!))
         } else {
-            NCCommunicationCommon.shared.writeLog("[LOG] NCNteworkink.authenticationChallenge ERROR TRUST")
             completionHandler(URLSession.AuthChallengeDisposition.performDefaultHandling, nil)
         }
     }
@@ -519,20 +516,16 @@ import Queuer
             } else if errorCode == Int(CFNetworkErrors.cfurlErrorServerCertificateUntrusted.rawValue) {
                 
                 CCUtility.setCertificateError(metadata.account, error: true)
+                NCManageDatabase.sharedInstance.setMetadataSession(ocId: metadata.ocId, session: nil, sessionError: errorDescription, sessionTaskIdentifier: 0, status: Int(k_metadataStatusUploadError))
                 
-                CCUtility.removeFile(atPath: CCUtility.getDirectoryProviderStorageOcId(metadata.ocId))
-                NCManageDatabase.sharedInstance.deleteMetadata(predicate: NSPredicate(format: "ocId == %@", metadata.ocId))
-                                        
             } else {
                 
                 NCManageDatabase.sharedInstance.setMetadataSession(ocId: metadata.ocId, session: nil, sessionError: errorDescription, sessionTaskIdentifier: 0, status: Int(k_metadataStatusUploadError))
-                
                 NotificationCenter.default.postOnMainThread(name: k_notificationCenter_uploadedFile, userInfo: ["metadata":metadata, "errorCode":errorCode, "errorDescription":errorDescription])
             }
             
             // Delete
             self.uploadMetadata[fileName+serverUrl] = nil
-            
             NotificationCenter.default.postOnMainThread(name: k_notificationCenter_reloadDataSource, userInfo: ["ocId":metadata.ocId, "serverUrl":metadata.serverUrl])
         }
     }

+ 1 - 1
iOSClient/Networking/NCNetworkingAutoUpload.swift

@@ -79,7 +79,7 @@ class NCNetworkingAutoUpload: NSObject {
                 }
                 let metadatas = NCManageDatabase.sharedInstance.getMetadatas(predicate: predicate, page: 1, limit: limit, sorted: "date", ascending: true)
                 if metadatas.count > 0 {
-                    NCCommunicationCommon.shared.writeLog("[LOG] PROCESS-AUTO-UPLOAD find \(metadatas.count) items")
+                    NCCommunicationCommon.shared.writeLog("PROCESS-AUTO-UPLOAD find \(metadatas.count) items")
                 }
                 for metadata in metadatas {
                     if CCUtility.isFolderEncrypted(metadata.serverUrl, e2eEncrypted: metadata.e2eEncrypted, account: metadata.account, urlBase: metadata.urlBase) {

+ 2 - 2
iOSClient/Settings/CCAdvanced.m

@@ -169,9 +169,9 @@
             NSString *versionNextcloudiOS = [NSString stringWithFormat:[NCBrandOptions sharedInstance].textCopyrightNextcloudiOS, versionApp];
             
             if (isSimulatorOrTestFlight) {
-                [[NCCommunicationCommon shared] writeLog:[NSString stringWithFormat:@"[LOG] Clear log with level %lu %@ (Simulator / TestFlight)", (unsigned long)logLevel, versionNextcloudiOS]];
+                [[NCCommunicationCommon shared] writeLog:[NSString stringWithFormat:@"Clear log with level %lu %@ (Simulator / TestFlight)", (unsigned long)logLevel, versionNextcloudiOS]];
             } else {
-                [[NCCommunicationCommon shared] writeLog:[NSString stringWithFormat:@"[LOG] Clear log with level %lu %@", (unsigned long)logLevel, versionNextcloudiOS]];
+                [[NCCommunicationCommon shared] writeLog:[NSString stringWithFormat:@"Clear log with level %lu %@", (unsigned long)logLevel, versionNextcloudiOS]];
             }
         };
         [section addFormRow:row];