marinofaggiana há 4 anos atrás
pai
commit
a5f6b72658

+ 2 - 1
iOSClient/Activity/NCActivity.swift

@@ -221,7 +221,8 @@ extension NCActivity: UITableViewDataSource {
                 cell.subjectTrailingConstraint.constant = 50
                 cell.avatar.isHidden = false
                 
-                let fileNameLocalPath = CCUtility.getDirectoryUserData() + "/" + CCUtility.getStringUser(appDelegate.user, urlBase: appDelegate.urlBase) + "-" + activity.user + ".png"
+                var fileNameLocalPath = CCUtility.getDirectoryUserData() + "/" + CCUtility.getStringUser(appDelegate.user, urlBase: appDelegate.urlBase) + "-" + activity.user
+                fileNameLocalPath = fileNameLocalPath + ".png"
                 if FileManager.default.fileExists(atPath: fileNameLocalPath) {
                     if let image = UIImage(contentsOfFile: fileNameLocalPath) {
                         cell.avatar.image = image

+ 9 - 0
iOSClient/AppDelegate.swift

@@ -34,6 +34,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
     var activeViewController: UIViewController?
     var activeViewerVideo: NCViewerVideo?
     
+    var listFilesVC: [String:NCFiles] = [:]
+    var listFavoriteVC: [String:NCFavorite] = [:]
+    var listOfflineVC: [String:NCOffline] = [:]
+    var listProgressMetadata: [String:tableMetadata] = [:]
+    
     var disableSharesView: Bool = false
     var documentPickerViewController: NCDocumentPickerViewController?
     var networkingAutoUpload: NCNetworkingAutoUpload?
@@ -133,5 +138,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
             NCCommunicationCommon.shared.setup(nextcloudVersion: serverVersionMajor)
         }
     }
+    
+    func deleteAccount(_ account: String, wipe: Bool) {
+        
+    }
 }
 

+ 1 - 1
iOSClient/Main/Colleaction Common/NCCollectionCommon.swift

@@ -389,7 +389,7 @@ class NCCollectionCommon: NSObject, NCSelectDelegate {
         var items = [[String : Any]]()
         
         for ocId in appDelegate.pasteboardOcIds {
-            if let metadata = NCManageDatabase.shared.getMetadataFromOcId(ocId as? String) {
+            if let metadata = NCManageDatabase.shared.getMetadataFromOcId(ocId) {
                 metadatas.append(metadata)
             }
         }

+ 24 - 29
iOSClient/Main/Colleaction Common/NCCollectionViewCommon.swift

@@ -248,9 +248,9 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
         
         self.navigationController?.popToRootViewController(animated: false)
         
-        appDelegate.listFilesVC.removeAllObjects()
-        appDelegate.listFavoriteVC.removeAllObjects()
-        appDelegate.listOfflineVC.removeAllObjects()
+        appDelegate.listFilesVC.removeAll()
+        appDelegate.listFavoriteVC.removeAll()
+        appDelegate.listOfflineVC.removeAll()
         
         reloadDataSource()
     }
@@ -910,11 +910,10 @@ extension NCCollectionViewCommon: UICollectionViewDelegate {
             // FILES
             if layoutKey == NCBrandGlobal.shared.layoutViewFiles {
                 
-                if let viewController = appDelegate.listFilesVC.value(forKey: serverUrlPush) {
-                    guard let vcFiles = (viewController as? NCFiles) else { return }
+                if let viewController = appDelegate.listFilesVC[serverUrlPush] {
                     
-                    if vcFiles.isViewLoaded {
-                        self.navigationController?.pushViewController(vcFiles, animated: true)
+                    if viewController.isViewLoaded {
+                        self.navigationController?.pushViewController(viewController, animated: true)
                     }
                     
                 } else {
@@ -925,8 +924,8 @@ extension NCCollectionViewCommon: UICollectionViewDelegate {
                     vcFiles.serverUrl = serverUrlPush
                     vcFiles.titleCurrentFolder = metadataTouch!.fileNameView
                     
-                    appDelegate.listFilesVC.setValue(vcFiles, forKey: serverUrlPush)
-                    
+                    appDelegate.listFilesVC[serverUrlPush] = vcFiles
+                                        
                     self.navigationController?.pushViewController(vcFiles, animated: true)
                 }
             }
@@ -934,11 +933,10 @@ extension NCCollectionViewCommon: UICollectionViewDelegate {
             // FAVORITE
             if layoutKey == NCBrandGlobal.shared.layoutViewFavorite {
             
-                if let viewController = appDelegate.listFavoriteVC.value(forKey: serverUrlPush) {
-                    guard let vcFavorite = (viewController as? NCFavorite) else { return }
+                if let viewController = appDelegate.listFavoriteVC[serverUrlPush] {
                     
-                    if vcFavorite.isViewLoaded {
-                        self.navigationController?.pushViewController(vcFavorite, animated: true)
+                    if viewController.isViewLoaded {
+                        self.navigationController?.pushViewController(viewController, animated: true)
                     }
 
                 } else {
@@ -948,7 +946,7 @@ extension NCCollectionViewCommon: UICollectionViewDelegate {
                     vcFavorite.serverUrl = serverUrlPush
                     vcFavorite.titleCurrentFolder = metadataTouch!.fileNameView
                 
-                    appDelegate.listFavoriteVC.setValue(vcFavorite, forKey: serverUrlPush)
+                    appDelegate.listFavoriteVC[serverUrlPush] = vcFavorite
                     
                     self.navigationController?.pushViewController(vcFavorite, animated: true)
                 }
@@ -957,11 +955,10 @@ extension NCCollectionViewCommon: UICollectionViewDelegate {
             // OFFLINE
             if layoutKey == NCBrandGlobal.shared.layoutViewOffline {
                 
-                if let viewController = appDelegate.listOfflineVC.value(forKey: serverUrlPush) {
-                    guard let vcOffline = (viewController as? NCOffline) else { return }
+                if let viewController = appDelegate.listOfflineVC[serverUrlPush] {
                     
-                    if vcOffline.isViewLoaded {
-                        self.navigationController?.pushViewController(vcOffline, animated: true)
+                    if viewController.isViewLoaded {
+                        self.navigationController?.pushViewController(viewController, animated: true)
                     }
                     
                 } else {
@@ -971,7 +968,7 @@ extension NCCollectionViewCommon: UICollectionViewDelegate {
                     vcOffline.serverUrl = serverUrlPush
                     vcOffline.titleCurrentFolder = metadataTouch!.fileNameView
                     
-                    appDelegate.listOfflineVC.setValue(vcOffline, forKey: serverUrlPush)
+                    appDelegate.listOfflineVC[serverUrlPush] = vcOffline
                     
                     self.navigationController?.pushViewController(vcOffline, animated: true)
                 }
@@ -980,11 +977,10 @@ extension NCCollectionViewCommon: UICollectionViewDelegate {
             // RECENT ( for push use Files ... he he he )
             if layoutKey == NCBrandGlobal.shared.layoutViewRecent {
                 
-                if let viewController = appDelegate.listFilesVC.value(forKey: serverUrlPush) {
-                    guard let vcFiles = (viewController as? NCFiles) else { return }
+                if let viewController = appDelegate.listFilesVC[serverUrlPush] {
                     
-                    if vcFiles.isViewLoaded {
-                        self.navigationController?.pushViewController(vcFiles, animated: true)
+                    if viewController.isViewLoaded {
+                        self.navigationController?.pushViewController(viewController, animated: true)
                     }
                     
                 } else {
@@ -995,7 +991,7 @@ extension NCCollectionViewCommon: UICollectionViewDelegate {
                     vcFiles.serverUrl = serverUrlPush
                     vcFiles.titleCurrentFolder = metadataTouch!.fileNameView
                     
-                    appDelegate.listFilesVC.setValue(vcFiles, forKey: serverUrlPush)
+                    appDelegate.listFilesVC[serverUrlPush] = vcFiles
                     
                     self.navigationController?.pushViewController(vcFiles, animated: true)
                 }
@@ -1015,11 +1011,10 @@ extension NCCollectionViewCommon: UICollectionViewDelegate {
             // SHARES ( for push use Files ... he he he )
             if layoutKey == NCBrandGlobal.shared.layoutViewShares {
                 
-                if let viewController = appDelegate.listFilesVC.value(forKey: serverUrlPush) {
-                    guard let vcFiles = (viewController as? NCFiles) else { return }
+                if let viewController = appDelegate.listFilesVC[serverUrlPush] {
                     
-                    if vcFiles.isViewLoaded {
-                        self.navigationController?.pushViewController(vcFiles, animated: true)
+                    if viewController.isViewLoaded {
+                        self.navigationController?.pushViewController(viewController, animated: true)
                     }
                     
                 } else {
@@ -1030,7 +1025,7 @@ extension NCCollectionViewCommon: UICollectionViewDelegate {
                     vcFiles.serverUrl = serverUrlPush
                     vcFiles.titleCurrentFolder = metadataTouch!.fileNameView
                     
-                    appDelegate.listFilesVC.setValue(vcFiles, forKey: serverUrlPush)
+                    appDelegate.listFilesVC[serverUrlPush] = vcFiles
                     
                     self.navigationController?.pushViewController(vcFiles, animated: true)
                 }

+ 1 - 1
iOSClient/Main/Create cloud/NCCreateFormUploadConflict.swift

@@ -229,7 +229,7 @@ extension NCCreateFormUploadConflictDelegate {
             
             NCManageDatabase.shared.addMetadatas(metadatasNOConflict)
             
-            appDelegate.networkingAutoUpload.startProcess()
+            appDelegate.networkingAutoUpload?.startProcess()
         }
                 
         dismiss(animated: true)

+ 1 - 1
iOSClient/Networking/NCService.swift

@@ -128,7 +128,7 @@ class NCService: NSObject {
     
     private func requestServerCapabilities() {
         
-        if appDelegate.account == nil || appDelegate.account.count == 0 { return }
+        if appDelegate.account == "" { return }
         
         NCCommunication.shared.getCapabilities() { (account, data, errorCode, errorDescription) in
             

+ 4 - 2
iOSClient/Share/NCShareComments.swift

@@ -67,7 +67,8 @@ class NCShareComments: UIViewController, NCShareCommentsCellDelegate {
             labelUser.text = tabAccount.displayName
         }
         
-        let fileNameLocalPath = CCUtility.getDirectoryUserData() + "/" + CCUtility.getStringUser(appDelegate.user, urlBase: appDelegate.urlBase) + "-" + appDelegate.user + ".png"
+        var fileNameLocalPath = CCUtility.getDirectoryUserData() + "/" + CCUtility.getStringUser(appDelegate.user, urlBase: appDelegate.urlBase) + "-" + appDelegate.user
+        fileNameLocalPath = fileNameLocalPath + ".png"
         if FileManager.default.fileExists(atPath: fileNameLocalPath) {
             if let image = UIImage(contentsOfFile: fileNameLocalPath) {
                 imageItem.image = image
@@ -251,7 +252,8 @@ extension NCShareComments: UITableViewDataSource {
             cell.sizeToFit()
             
             // Image
-            let fileNameLocalPath = CCUtility.getDirectoryUserData() + "/" + CCUtility.getStringUser(appDelegate.user, urlBase: appDelegate.urlBase) + "-" + tableComments.actorId + ".png"
+            var fileNameLocalPath = CCUtility.getDirectoryUserData() + "/" + CCUtility.getStringUser(appDelegate.user, urlBase: appDelegate.urlBase) + "-" + tableComments.actorId
+            fileNameLocalPath = fileNameLocalPath + ".png"
             if FileManager.default.fileExists(atPath: fileNameLocalPath) {
                 if let image = UIImage(contentsOfFile: fileNameLocalPath) { cell.imageItem.image = image }
             } else {

+ 1 - 1
iOSClient/Transfers/NCTransfers.swift

@@ -207,7 +207,7 @@ class NCTransfers: NCCollectionViewCommon, NCTransferCellDelegate  {
         
         // Transfer
         var progress: Float = 0.0
-        var totalBytes: Int64 = 0
+        var totalBytes: Int64 = 0        
         let progressArray = appDelegate.listProgressMetadata.object(forKey: metadata.ocId) as? NSArray
         if progressArray != nil && progressArray?.count == 3 {
             progress = progressArray?.object(at: 0) as? Float ?? 0