diff --git a/iOSClient/Networking/NCNetworkingProcess.swift b/iOSClient/Networking/NCNetworkingProcess.swift index 3b39d48bb8..b1b2d2ace4 100644 --- a/iOSClient/Networking/NCNetworkingProcess.swift +++ b/iOSClient/Networking/NCNetworkingProcess.swift @@ -96,24 +96,23 @@ class NCNetworkingProcess { let results = self.database.getResultsMetadatas(predicate: NSPredicate(format: "status != %d", self.global.metadataStatusNormal))?.freeze() else { return } self.hasRun = true - + /// Keep screen awake /// Task { let tasks = await self.networking.getAllDataTask() let hasSynchronizationTask = tasks.contains { $0.taskDescription == NCGlobal.shared.taskDescriptionSynchronization } let resultsTransfer = results.filter { self.global.metadataStatusInTransfer.contains($0.status) } - - + if !self.enableControllingScreenAwake { return } - + if resultsTransfer.isEmpty && !hasSynchronizationTask { ScreenAwakeManager.shared.mode = .off } else { ScreenAwakeManager.shared.mode = NCKeychain().screenAwakeMode } } - + if results.isEmpty { /// Remove Photo CameraRoll @@ -315,9 +314,15 @@ class NCNetworkingProcess { for metadata in metadatasWaitCopy { let serverUrlTo = metadata.serverUrlTo let serverUrlFileNameSource = metadata.serverUrl + "/" + metadata.fileName - let serverUrlFileNameDestination = serverUrlTo + "/" + metadata.fileName + var serverUrlFileNameDestination = serverUrlTo + "/" + metadata.fileName let overwrite = (metadata.storeFlag as? NSString)?.boolValue ?? false + /// Within same folder + if metadata.serverUrl == serverUrlTo { + let fileNameCopy = await NCNetworking.shared.createFileName(fileNameBase: metadata.fileName, account: metadata.account, serverUrl: metadata.serverUrl) + serverUrlFileNameDestination = serverUrlTo + "/" + fileNameCopy + } + let result = await networking.copyFileOrFolder(serverUrlFileNameSource: serverUrlFileNameSource, serverUrlFileNameDestination: serverUrlFileNameDestination, overwrite: overwrite, account: metadata.account) database.setMetadataCopyMove(ocId: metadata.ocId, serverUrlTo: "", overwrite: nil, status: global.metadataStatusNormal) diff --git a/iOSClient/SceneDelegate.swift b/iOSClient/SceneDelegate.swift index 423e60d58e..58e0b4ca00 100644 --- a/iOSClient/SceneDelegate.swift +++ b/iOSClient/SceneDelegate.swift @@ -120,14 +120,14 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { hidePrivacyProtectionWindow() - DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { - NCService().startRequestServicesServer(account: session.account, controller: controller) - } - NCAutoUpload.shared.initAutoUpload(controller: nil, account: session.account) { num in NextcloudKit.shared.nkCommonInstance.writeLog("[INFO] Initialize Auto upload with \(num) uploads") } + DispatchQueue.main.asyncAfter(deadline: .now() + 1) { + NCService().startRequestServicesServer(account: session.account, controller: controller) + } + DispatchQueue.main.asyncAfter(deadline: .now() + 2) { Task { await NCNetworking.shared.verifyZombie() diff --git a/iOSClient/Settings/AutoUpload/NCAutoUploadModel.swift b/iOSClient/Settings/AutoUpload/NCAutoUploadModel.swift index f6f334b3b1..adce5bfa33 100644 --- a/iOSClient/Settings/AutoUpload/NCAutoUploadModel.swift +++ b/iOSClient/Settings/AutoUpload/NCAutoUploadModel.swift @@ -153,7 +153,7 @@ class NCAutoUploadModel: ObservableObject, ViewOnAppearHandling { func handleAutoUploadWWAnVideoChange(newValue: Bool) { updateAccountProperty(\.autoUploadWWAnVideo, value: newValue) } - + func handleAutoUploadFavoritesOnlyChange(newValue: Bool) { updateAccountProperty(\.autoUploadFavoritesOnly, value: newValue) }