marinofaggiana пре 3 година
родитељ
комит
a041c39e53

+ 2 - 2
iOSClient/Brand/NCBrand.swift

@@ -307,7 +307,7 @@ class NCBrandColor: NSObject {
         cacheImages.buttonRestore = UIImage(named: "restore")!.image(color: gray, size: 50)
     }
     
-#if !EXTENSION
+    #if !EXTENSION
     public func settingThemingColor(account: String) {
         
         let darker: CGFloat = 30    // %
@@ -356,7 +356,7 @@ class NCBrandColor: NSObject {
             NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterChangeTheming)
         }
     }
-#endif
+    #endif
     
     @objc func settingBrandColor(_ themingColor: String?, themingColorElement: String?, themingColorText: String?) {
                 

+ 4 - 4
iOSClient/Data/NCManageDatabase.swift

@@ -148,9 +148,9 @@ class NCManageDatabase: NSObject {
             } catch {
                 if let databaseFilePath = databaseFilePath {
                     do {
-#if !EXTENSION
+                        #if !EXTENSION
                         NCContentPresenter.shared.messageNotification("_error_", description: "_database_corrupt_", delay: NCGlobal.shared.dismissAfterSecondLong, type: NCContentPresenter.messageType.info, errorCode: NCGlobal.shared.errorInternalError, forced: true)
-#endif
+                        #endif
                         try FileManager.default.removeItem(at: databaseFilePath)
                     } catch {}
                 }
@@ -170,9 +170,9 @@ class NCManageDatabase: NSObject {
         } catch {
             if let databaseFilePath = databaseFilePath {
                 do {
-#if !EXTENSION
+                    #if !EXTENSION
                     NCContentPresenter.shared.messageNotification("_error_", description: "_database_corrupt_", delay: NCGlobal.shared.dismissAfterSecondLong, type: NCContentPresenter.messageType.info, errorCode: NCGlobal.shared.errorInternalError, forced: true)
-#endif
+                    #endif
                     try FileManager.default.removeItem(at: databaseFilePath)
                 } catch {}
             }

+ 34 - 35
iOSClient/Networking/NCNetworking.swift

@@ -75,7 +75,7 @@ import Queuer
         return session
     }()
     
-#if EXTENSION
+    #if EXTENSION
     @objc public lazy var sessionManagerBackgroundExtension: URLSession = {
         let configuration = URLSessionConfiguration.background(withIdentifier: sessionIdentifierBackgroundExtension)
         configuration.allowsCellularAccess = true
@@ -87,26 +87,26 @@ import Queuer
         let session = URLSession(configuration: configuration, delegate: NCCommunicationBackground.shared, delegateQueue: OperationQueue.main)
         return session
     }()
-#endif
+    #endif
     
     //MARK: - init
     
     override init() {
         super.init()
         
-#if EXTENSION
+        #if EXTENSION
         _ = sessionIdentifierBackgroundExtension
         #else
         _ = sessionManagerBackground
         _ = sessionManagerBackgroundWWan
-#endif
+        #endif
     }
     
     //MARK: - Communication Delegate
        
     func networkReachabilityObserver(_ typeReachability: NCCommunicationCommon.typeReachability) {
         
-#if !EXTENSION
+        #if !EXTENSION
         if typeReachability == NCCommunicationCommon.typeReachability.reachableCellular || typeReachability == NCCommunicationCommon.typeReachability.reachableEthernetOrWiFi {
             
             if !lastReachability {
@@ -123,8 +123,7 @@ import Queuer
         }
         
         networkReachability = typeReachability
-        
-#endif
+        #endif
     }
     
     func authenticationChallenge(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) {
@@ -146,13 +145,13 @@ import Queuer
     
     func urlSessionDidFinishEvents(forBackgroundURLSession session: URLSession) {
         
-#if !EXTENSION
+        #if !EXTENSION
         if let appDelegate = UIApplication.shared.delegate as? AppDelegate, let completionHandler = appDelegate.backgroundSessionCompletionHandler {
             NCCommunicationCommon.shared.writeLog("Called urlSessionDidFinishEvents for Background URLSession")
             appDelegate.backgroundSessionCompletionHandler = nil
             completionHandler()
         }
-#endif
+        #endif
     }
     
     //MARK: - Pinning check
@@ -210,12 +209,12 @@ import Queuer
                     }
                     
                     if !trusted && certificateSavedFound {
-#if !EXTENSION
+                        #if !EXTENSION
                         DispatchQueue.main.async {
                             let appDelegate = UIApplication.shared.delegate as! AppDelegate
                             CCUtility.setCertificateError(appDelegate.account)
                         }
-#endif
+                        #endif
                     }
                 }
             }
@@ -338,23 +337,23 @@ import Queuer
                 NCManageDatabase.shared.setMetadataSession(ocId: metadata.ocId, session: "", sessionError: "", sessionSelector: selector, sessionTaskIdentifier: 0, status: NCGlobal.shared.metadataStatusNormal, etag: etag)
                 NCManageDatabase.shared.addLocalFile(metadata: metadata)
                 
-#if !EXTENSION
+                #if !EXTENSION
                 if let result = NCManageDatabase.shared.getE2eEncryption(predicate: NSPredicate(format: "fileNameIdentifier == %@ AND serverUrl == %@", metadata.fileName, metadata.serverUrl)) {
                     
                     NCEndToEndEncryption.sharedManager()?.decryptFileName(metadata.fileName, fileNameView: metadata.fileNameView, ocId: metadata.ocId, key: result.key, initializationVector: result.initializationVector, authenticationTag: result.authenticationTag)
                 }
                 CCUtility.setExif(metadata) { (latitude, longitude, location, date, lensMode) in };
-#endif
+                #endif
                                 
             } else {
                                 
                 NCManageDatabase.shared.setMetadataSession(ocId: metadata.ocId, session: "", sessionError: errorDescription, sessionSelector: selector, sessionTaskIdentifier: 0, status: NCGlobal.shared.metadataStatusDownloadError)
                 
-#if !EXTENSION
+                #if !EXTENSION
                 if errorCode == 401 || errorCode == 403 {
                     NCNetworkingCheckRemoteUser.shared.checkRemoteUser(account: metadata.account)
                 } 
-#endif
+                #endif
             }
             
             self.downloadRequest[fileNameLocalPath] = nil
@@ -400,9 +399,9 @@ import Queuer
             NCManageDatabase.shared.addMetadata(metadata)
            
             if metadata.e2eEncrypted {
-#if !EXTENSION_FILE_PROVIDER_EXTENSION
+                #if !EXTENSION_FILE_PROVIDER_EXTENSION
                 NCNetworkingE2EE.shared.upload(metadata: tableMetadata.init(value: metadata), account: account, start: { start() }, completion: completion)
-#endif
+                #endif
             } else if metadata.chunk {
                 uploadChunkedFile(metadata: tableMetadata.init(value: metadata), userId: account.userId, start: { start() }, completion: completion)
             } else if metadata.session == NCCommunicationCommon.shared.sessionIdentifierUpload {
@@ -427,9 +426,9 @@ import Queuer
                 NCManageDatabase.shared.addMetadata(extractMetadata)
                
                 if metadata.e2eEncrypted {
-#if !EXTENSION_FILE_PROVIDER_EXTENSION
+                    #if !EXTENSION_FILE_PROVIDER_EXTENSION
                     NCNetworkingE2EE.shared.upload(metadata: tableMetadata.init(value: extractMetadata), account: account, start: { start() }, completion: completion)
-#endif
+                    #endif
                 } else if metadata.chunk {
                     self.uploadChunkedFile(metadata: tableMetadata.init(value: metadata), userId: account.userId, start: { start() }, completion: completion)
                 } else if metadata.session == NCCommunicationCommon.shared.sessionIdentifierUpload {
@@ -554,7 +553,7 @@ import Queuer
                 NCManageDatabase.shared.addMetadata(metadata)
                 NCManageDatabase.shared.deleteMetadata(predicate: NSPredicate(format: "ocId == %@", ocIdTemp))
                 
-#if !EXTENSION
+                #if !EXTENSION
                 self.getOcIdInBackgroundSession { (listOcId) in
                     if listOcId.count == 0 && self.uploadRequest.count == 0 {
                         let appDelegate = UIApplication.shared.delegate as! AppDelegate
@@ -562,7 +561,7 @@ import Queuer
                     }
                 }
                 CCUtility.setExif(metadata) { (latitude, longitude, location, date, lensMode) in };
-#endif
+                #endif
                 
                 NCCommunicationCommon.shared.writeLog("Upload complete " + serverUrl + "/" + fileName + ", result: success(\(size) bytes)")
                 NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterUploadedFile, userInfo: ["ocId":metadata.ocId, "ocIdTemp":ocIdTemp, "errorCode":errorCode, "errorDescription":""])
@@ -586,9 +585,9 @@ import Queuer
                 
                 } else if errorCode == 401 || errorCode == 403 {
                     
-#if !EXTENSION
+                    #if !EXTENSION
                     NCNetworkingCheckRemoteUser.shared.checkRemoteUser(account: metadata.account)
-#endif
+                    #endif
                     
                     NCManageDatabase.shared.setMetadataSession(ocId: metadata.ocId, session: nil, sessionError: errorDescription, sessionTaskIdentifier: 0, status: NCGlobal.shared.metadataStatusUploadError)
 
@@ -743,9 +742,9 @@ import Queuer
             }
         }
         
-#if !EXTENSION
+        #if !EXTENSION
         NCOperationQueue.shared.downloadCancelAll()
-#endif
+        #endif
     }
         
     //MARK: - WebDav Read file, folder
@@ -839,9 +838,9 @@ import Queuer
         let isDirectoryEncrypted = CCUtility.isFolderEncrypted(serverUrl, e2eEncrypted: false, account: account, urlBase: urlBase)
                
         if isDirectoryEncrypted {
-#if !EXTENSION
+            #if !EXTENSION
             NCNetworkingE2EE.shared.createFolder(fileName: fileName, serverUrl: serverUrl, account: account, urlBase: urlBase, completion: completion)
-#endif
+            #endif
         } else {
             createFolderPlain(fileName: fileName, serverUrl: serverUrl, account: account, urlBase: urlBase, overwrite: overwrite, completion: completion)
         }
@@ -960,7 +959,7 @@ import Queuer
         let metadataLive = NCManageDatabase.shared.getMetadataLivePhoto(metadata: metadata)
         
         if isDirectoryEncrypted {
-#if !EXTENSION
+            #if !EXTENSION
             if metadataLive == nil {
                 NCNetworkingE2EE.shared.deleteMetadata(metadata, urlBase: urlBase, completion: completion)
             } else {
@@ -972,7 +971,7 @@ import Queuer
                     }
                 }
             }
-#endif
+            #endif
         } else {
             if metadataLive == nil {
                 self.deleteMetadataPlain(metadata, addCustomHeaders: nil, completion: completion)
@@ -1050,11 +1049,11 @@ import Queuer
                 
                 NCManageDatabase.shared.setMetadataFavorite(ocId: metadata.ocId, favorite: favorite)
                
-#if !EXTENSION
+                #if !EXTENSION
                 if favorite {
                     NCOperationQueue.shared.synchronizationMetadata(metadata, selector: NCGlobal.shared.selectorReadFile)
                 }
-#endif
+                #endif
                 
                 if let metadata = NCManageDatabase.shared.getMetadataFromOcId(ocId) {
                     NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterFavoriteFile, userInfo: ["ocId": metadata.ocId])
@@ -1071,11 +1070,11 @@ import Queuer
                 NCManageDatabase.shared.convertNCCommunicationFilesToMetadatas(files, useMetadataFolder: false, account: account) { (_, _, metadatas) in
                     NCManageDatabase.shared.updateMetadatasFavorite(account: account, metadatas: metadatas)
                     if selector != NCGlobal.shared.selectorListingFavorite {
-#if !EXTENSION
+                        #if !EXTENSION
                         for metadata in metadatas {
                             NCOperationQueue.shared.synchronizationMetadata(metadata, selector: selector)
                         }
-#endif
+                        #endif
                     }
                     completion(account, metadatas, errorCode, errorDescription)
                 }
@@ -1094,7 +1093,7 @@ import Queuer
         let fileNameNewLive = (fileNameNew as NSString).deletingPathExtension + ".mov"
 
         if isDirectoryEncrypted {
-#if !EXTENSION
+            #if !EXTENSION
             if metadataLive == nil {
                 NCNetworkingE2EE.shared.renameMetadata(metadata, fileNameNew: fileNameNew, urlBase: urlBase, completion: completion)
             } else {
@@ -1106,7 +1105,7 @@ import Queuer
                     }
                 }
             }
-#endif
+            #endif
         } else {
             if metadataLive == nil {
                 renameMetadataPlain(metadata, fileNameNew: fileNameNew, completion: completion)

+ 2 - 2
iOSClient/Networking/NCNetworkingE2EE.swift

@@ -325,9 +325,9 @@ import Alamofire
                             
                             if errorCode == 401 || errorCode == 403 {
                             
-#if !EXTENSION
+                                #if !EXTENSION
                                 NCNetworkingCheckRemoteUser.shared.checkRemoteUser(account: metadata.account)
-#endif
+                                #endif
                                 NCManageDatabase.shared.setMetadataSession(ocId: metadata.ocId, session: nil, sessionError: errorDescription, sessionTaskIdentifier: 0, status: NCGlobal.shared.metadataStatusUploadError)
                             
                             } else if errorCode == Int(CFNetworkErrors.cfurlErrorServerCertificateUntrusted.rawValue) {

+ 3 - 3
iOSClient/Utility/NCUtility.swift

@@ -496,7 +496,7 @@ class NCUtility: NSObject {
             self.viewActivityIndicator?.layer.masksToBounds = true
             self.viewActivityIndicator?.backgroundColor = .clear
 
-#if !EXTENSION
+            #if !EXTENSION
             if backgroundView == nil {
                 if let window = UIApplication.shared.keyWindow {
                     self.viewBackgroundActivityIndicator?.removeFromSuperview()
@@ -508,9 +508,9 @@ class NCUtility: NSObject {
             } else {
                 self.viewBackgroundActivityIndicator = backgroundView
             }
-#else
+            #else
             self.viewBackgroundActivityIndicator = backgroundView
-#endif
+            #endif
             // VIEW ACTIVITY INDICATOR
             
             guard let viewActivityIndicator = self.viewActivityIndicator else { return }