Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/ios.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarino Faggiana <marino@marinofaggiana.com>2022-10-01 21:42:57 +0300
committerMarino Faggiana <marino@marinofaggiana.com>2022-10-01 21:42:57 +0300
commit3c77b2f572452d6f8eff8791991f5fd4700d3860 (patch)
tree4aa694b366d32603dde3f3d182e4dbcbe005cdd5
parente70c69b3258735fb2bce7273d11d99259a9df75f (diff)
coding
Signed-off-by: Marino Faggiana <marino@marinofaggiana.com>
-rw-r--r--iOSClient/AppDelegate.swift2
-rw-r--r--iOSClient/Main/Create cloud/NCCreateFormUploadAssets.swift2
-rw-r--r--iOSClient/Main/Create cloud/NCCreateFormUploadScanDocument.swift2
-rw-r--r--iOSClient/Main/Create cloud/NCCreateFormUploadVoiceNote.swift2
-rw-r--r--iOSClient/Main/NCPickerViewController.swift2
-rw-r--r--iOSClient/Networking/NCAutoUpload.swift4
-rw-r--r--iOSClient/Networking/NCNetworkingProcessUpload.swift21
-rw-r--r--iOSClient/Viewer/NCViewerQuickLook/NCViewerQuickLook.swift2
8 files changed, 22 insertions, 15 deletions
diff --git a/iOSClient/AppDelegate.swift b/iOSClient/AppDelegate.swift
index f9db3a0dd..7c1d8a4d1 100644
--- a/iOSClient/AppDelegate.swift
+++ b/iOSClient/AppDelegate.swift
@@ -952,6 +952,6 @@ extension AppDelegate: NCAudioRecorderViewControllerDelegate {
extension AppDelegate: NCCreateFormUploadConflictDelegate {
func dismissCreateFormUploadConflict(metadatas: [tableMetadata]?) {
guard let metadatas = metadatas, !metadatas.isEmpty else { return }
- networkingProcessUpload?.createProcessUploads(metadatas: metadatas)
+ networkingProcessUpload?.createProcessUploads(metadatas: metadatas, completion: { _ in })
}
}
diff --git a/iOSClient/Main/Create cloud/NCCreateFormUploadAssets.swift b/iOSClient/Main/Create cloud/NCCreateFormUploadAssets.swift
index 79f645884..4bcf4ed7b 100644
--- a/iOSClient/Main/Create cloud/NCCreateFormUploadAssets.swift
+++ b/iOSClient/Main/Create cloud/NCCreateFormUploadAssets.swift
@@ -401,7 +401,7 @@ class NCCreateFormUploadAssets: XLFormViewController, NCSelectDelegate {
} else {
- self.appDelegate.networkingProcessUpload?.createProcessUploads(metadatas: metadatasNOConflict)
+ self.appDelegate.networkingProcessUpload?.createProcessUploads(metadatas: metadatasNOConflict, completion: { _ in })
}
DispatchQueue.main.async {self.dismiss(animated: true, completion: nil) }
diff --git a/iOSClient/Main/Create cloud/NCCreateFormUploadScanDocument.swift b/iOSClient/Main/Create cloud/NCCreateFormUploadScanDocument.swift
index 7347762f8..901361826 100644
--- a/iOSClient/Main/Create cloud/NCCreateFormUploadScanDocument.swift
+++ b/iOSClient/Main/Create cloud/NCCreateFormUploadScanDocument.swift
@@ -580,7 +580,7 @@ class NCCreateFormUploadScanDocument: XLFormViewController, NCSelectDelegate, NC
NCActivityIndicator.shared.stop()
- appDelegate.networkingProcessUpload?.createProcessUploads(metadatas: [metadata])
+ appDelegate.networkingProcessUpload?.createProcessUploads(metadatas: [metadata], completion: { _ in })
// Request delete all image scanned
let alertController = UIAlertController(title: "", message: NSLocalizedString("_delete_all_scanned_images_", comment: ""), preferredStyle: .alert)
diff --git a/iOSClient/Main/Create cloud/NCCreateFormUploadVoiceNote.swift b/iOSClient/Main/Create cloud/NCCreateFormUploadVoiceNote.swift
index 6bf011bb3..36876db4e 100644
--- a/iOSClient/Main/Create cloud/NCCreateFormUploadVoiceNote.swift
+++ b/iOSClient/Main/Create cloud/NCCreateFormUploadVoiceNote.swift
@@ -261,7 +261,7 @@ class NCCreateFormUploadVoiceNote: XLFormViewController, NCSelectDelegate, AVAud
CCUtility.copyFile(atPath: self.fileNamePath, toPath: CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView))
- appDelegate.networkingProcessUpload?.createProcessUploads(metadatas: [metadata])
+ appDelegate.networkingProcessUpload?.createProcessUploads(metadatas: [metadata], completion: { _ in })
self.dismiss(animated: true, completion: nil)
}
diff --git a/iOSClient/Main/NCPickerViewController.swift b/iOSClient/Main/NCPickerViewController.swift
index 71e549f4a..075a39f83 100644
--- a/iOSClient/Main/NCPickerViewController.swift
+++ b/iOSClient/Main/NCPickerViewController.swift
@@ -173,7 +173,7 @@ class NCDocumentPickerViewController: NSObject, UIDocumentPickerDelegate {
}
} else {
- appDelegate.networkingProcessUpload?.createProcessUploads(metadatas: [metadataForUpload])
+ appDelegate.networkingProcessUpload?.createProcessUploads(metadatas: [metadataForUpload], completion: { _ in })
}
} else {
diff --git a/iOSClient/Networking/NCAutoUpload.swift b/iOSClient/Networking/NCAutoUpload.swift
index b0cdf97a0..80a2e4084 100644
--- a/iOSClient/Networking/NCAutoUpload.swift
+++ b/iOSClient/Networking/NCAutoUpload.swift
@@ -167,9 +167,9 @@ class NCAutoUpload: NSObject {
self.endForAssetToUpload = true
if selector == NCGlobal.shared.selectorUploadAutoUploadAll {
- (UIApplication.shared.delegate as? AppDelegate)?.networkingProcessUpload?.createProcessUploads(metadatas: metadatas)
+ (UIApplication.shared.delegate as? AppDelegate)?.networkingProcessUpload?.createProcessUploads(metadatas: metadatas, verifyAlreadyExists: false, completion: completion)
} else {
- (UIApplication.shared.delegate as? AppDelegate)?.networkingProcessUpload?.createProcessUploads(metadatas: metadatas, verifyAlreadyExists: true)
+ (UIApplication.shared.delegate as? AppDelegate)?.networkingProcessUpload?.createProcessUploads(metadatas: metadatas, verifyAlreadyExists: true, completion: completion)
}
completion(metadatas.count)
}
diff --git a/iOSClient/Networking/NCNetworkingProcessUpload.swift b/iOSClient/Networking/NCNetworkingProcessUpload.swift
index 6e613f2e8..931749927 100644
--- a/iOSClient/Networking/NCNetworkingProcessUpload.swift
+++ b/iOSClient/Networking/NCNetworkingProcessUpload.swift
@@ -35,22 +35,27 @@ class NCNetworkingProcessUpload: NSObject {
startTimer()
}
- private func startProcess() {
+ private func startProcess(completion: @escaping (_ items: Int) -> Void) {
if timerProcess?.isValid ?? false {
- DispatchQueue.main.async { self.process() }
+ DispatchQueue.main.async {
+ self.process(completion: completion)
+ }
}
}
func startTimer() {
timerProcess?.invalidate()
- timerProcess = Timer.scheduledTimer(timeInterval: 5, target: self, selector: #selector(process), userInfo: nil, repeats: true)
+ timerProcess = Timer.scheduledTimer(timeInterval: 5, target: self, selector: #selector(processTimer), userInfo: nil, repeats: true)
}
func stopTimer() {
timerProcess?.invalidate()
}
- @objc private func process() {
+ @objc private func processTimer() {
+ self.process { _ in }
+ }
+ private func process(completion: @escaping (_ items: Int) -> Void) {
guard let account = NCManageDatabase.shared.getActiveAccount() else { return }
stopTimer()
@@ -139,7 +144,7 @@ class NCNetworkingProcessUpload: NSObject {
// verify delete Asset Local Identifiers in auto upload (DELETE Photos album)
DispatchQueue.main.async {
- if (counterUpload == 0 && !(UIApplication.shared.delegate as! AppDelegate).isPasscodePresented()) {
+ if UIApplication.shared.applicationState == .active && counterUpload == 0 && !(UIApplication.shared.delegate as! AppDelegate).isPasscodePresented() {
self.deleteAssetLocalIdentifiers(account: account.account) {
self.startTimer()
}
@@ -147,6 +152,8 @@ class NCNetworkingProcessUpload: NSObject {
self.startTimer()
}
}
+
+ completion(counterUpload)
})
}
@@ -180,7 +187,7 @@ class NCNetworkingProcessUpload: NSObject {
// MARK: -
- @objc func createProcessUploads(metadatas: [tableMetadata], verifyAlreadyExists: Bool = false) {
+ @objc func createProcessUploads(metadatas: [tableMetadata], verifyAlreadyExists: Bool = false, completion: @escaping (_ items: Int) -> Void) {
var metadatasForUpload: [tableMetadata] = []
for metadata in metadatas {
@@ -192,7 +199,7 @@ class NCNetworkingProcessUpload: NSObject {
metadatasForUpload.append(metadata)
}
NCManageDatabase.shared.addMetadatas(metadatasForUpload)
- startProcess()
+ startProcess(completion: completion)
}
// MARK: -
diff --git a/iOSClient/Viewer/NCViewerQuickLook/NCViewerQuickLook.swift b/iOSClient/Viewer/NCViewerQuickLook/NCViewerQuickLook.swift
index 2547440f1..aaa9725f3 100644
--- a/iOSClient/Viewer/NCViewerQuickLook/NCViewerQuickLook.swift
+++ b/iOSClient/Viewer/NCViewerQuickLook/NCViewerQuickLook.swift
@@ -153,7 +153,7 @@ extension NCViewerQuickLook: QLPreviewControllerDataSource, QLPreviewControllerD
}
metadataForUpload.size = size
metadataForUpload.status = NCGlobal.shared.metadataStatusWaitUpload
- (UIApplication.shared.delegate as? AppDelegate)?.networkingProcessUpload?.createProcessUploads(metadatas: [metadataForUpload])
+ (UIApplication.shared.delegate as? AppDelegate)?.networkingProcessUpload?.createProcessUploads(metadatas: [metadataForUpload], completion: { _ in })
}
func previewController(_ controller: QLPreviewController, didSaveEditedCopyOf previewItem: QLPreviewItem, at modifiedContentsURL: URL) {