From 8d7d00cd6bdc046895092b1afd0576257f9eb282 Mon Sep 17 00:00:00 2001 From: Marino Faggiana Date: Sat, 26 Oct 2024 13:48:32 +0200 Subject: [PATCH 1/3] cleaning Signed-off-by: Marino Faggiana --- iOSClient/SceneDelegate.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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() From 31617f23b212624735cee3e2a7d2a87d581cd000 Mon Sep 17 00:00:00 2001 From: Marino Faggiana Date: Sat, 26 Oct 2024 14:09:00 +0200 Subject: [PATCH 2/3] duplicate Signed-off-by: Marino Faggiana --- iOSClient/Networking/NCNetworkingProcess.swift | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) 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) From 5b4c068064d4dfbec6544e3933af7986b8b1eff0 Mon Sep 17 00:00:00 2001 From: Marino Faggiana Date: Sat, 26 Oct 2024 14:10:04 +0200 Subject: [PATCH 3/3] lint Signed-off-by: Marino Faggiana --- iOSClient/Settings/AutoUpload/NCAutoUploadModel.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) }