Browse Source

improved code

Signed-off-by: Marino Faggiana <marino@marinofaggiana.com>
Marino Faggiana 2 years ago
parent
commit
f6ef3127d5
2 changed files with 14 additions and 8 deletions
  1. 2 2
      .swiftlint.yml
  2. 12 6
      iOSClient/Main/NCActionCenter.swift

+ 2 - 2
.swiftlint.yml

@@ -20,8 +20,8 @@ function_body_length:
    warning: 200
 
 type_body_length:
-  warning: 350
-  error: 500
+  warning: 500
+  error: 700
   
 file_length:
   warning: 1000

+ 12 - 6
iOSClient/Main/NCActionCenter.swift

@@ -28,8 +28,8 @@ import JGProgressHUD
 import SVGKit
 import Photos
 
-@objc class NCActionCenter: NSObject, UIDocumentInteractionControllerDelegate, NCSelectDelegate {
-    @objc public static let shared: NCActionCenter = {
+class NCActionCenter: NSObject, UIDocumentInteractionControllerDelegate, NCSelectDelegate {
+    public static let shared: NCActionCenter = {
         let instance = NCActionCenter()
         NotificationCenter.default.addObserver(instance, selector: #selector(downloadedFile(_:)), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterDownloadedFile), object: nil)
         NotificationCenter.default.addObserver(instance, selector: #selector(uploadedFile(_:)), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterUploadedFile), object: nil)
@@ -218,8 +218,11 @@ import Photos
 
         for metadata in metadatas {
             let fileURL = URL(fileURLWithPath: CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView))
-            if CCUtility.fileProviderStorageExists(metadata) { items.append(fileURL) }
-            else { downloadMetadata.append((metadata, fileURL)) }
+            if CCUtility.fileProviderStorageExists(metadata) {
+                items.append(fileURL)
+            } else {
+                downloadMetadata.append((metadata, fileURL))
+            }
         }
 
         let processor = ParallelWorker(n: 5, titleKey: "_downloading_", totalTasks: downloadMetadata.count, hudView: appDelegate.window?.rootViewController?.view)
@@ -410,8 +413,11 @@ import Photos
             var downloadMetadatas: [tableMetadata] = []
             for ocid in pasteboardOcIds {
                 guard let metadata = NCManageDatabase.shared.getMetadataFromOcId(ocid) else { continue }
-                if let pasteboardItem = metadata.toPasteBoardItem() { items.append(pasteboardItem) }
-                else { downloadMetadatas.append(metadata) }
+                if let pasteboardItem = metadata.toPasteBoardItem() {
+                    items.append(pasteboardItem)
+                } else {
+                    downloadMetadatas.append(metadata)
+                }
             }
 
             DispatchQueue.main.async(execute: hud.dismiss)