Browse Source

Merge pull request #2082 from nextcloud/fix/411

Fix/411
Marino Faggiana 2 years ago
parent
commit
660e0cdc96

+ 2 - 2
Nextcloud.xcodeproj/project.pbxproj

@@ -2995,7 +2995,7 @@
 				CLANG_WARN_UNREACHABLE_CODE = YES;
 				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
 				COPY_PHASE_STRIP = NO;
-				CURRENT_PROJECT_VERSION = 8;
+				CURRENT_PROJECT_VERSION = 9;
 				DEVELOPMENT_TEAM = 6JLRKY9ZV7;
 				ENABLE_BITCODE = YES;
 				ENABLE_STRICT_OBJC_MSGSEND = YES;
@@ -3058,7 +3058,7 @@
 				CLANG_WARN_UNREACHABLE_CODE = YES;
 				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
 				COPY_PHASE_STRIP = NO;
-				CURRENT_PROJECT_VERSION = 8;
+				CURRENT_PROJECT_VERSION = 9;
 				DEVELOPMENT_TEAM = 6JLRKY9ZV7;
 				ENABLE_BITCODE = YES;
 				ENABLE_STRICT_OBJC_MSGSEND = YES;

+ 1 - 1
iOSClient/Favorites/NCFavorite.swift

@@ -36,7 +36,7 @@ class NCFavorite: NCCollectionViewCommon {
         enableSearchBar = false
         headerMenuButtonsCommand = false
         headerMenuButtonsView = true
-        headerRichWorkspaceDisable = false
+        headerRichWorkspaceDisable = true
         emptyImage = UIImage(named: "star.fill")?.image(color: NCBrandColor.shared.yellowFavorite, size: UIScreen.main.bounds.width)
         emptyTitle = "_favorite_no_files_"
         emptyDescription = "_tutorial_favorite_view_"

+ 1 - 1
iOSClient/FileViewInFolder/NCFileViewInFolder.swift

@@ -39,7 +39,7 @@ class NCFileViewInFolder: NCCollectionViewCommon {
         enableSearchBar = false
         headerMenuButtonsCommand = false
         headerMenuButtonsView = true
-        headerRichWorkspaceDisable = false
+        headerRichWorkspaceDisable = true
         emptyImage = UIImage(named: "folder")?.image(color: NCBrandColor.shared.brandElement, size: UIScreen.main.bounds.width)
         emptyTitle = "_files_no_files_"
         emptyDescription = "_no_file_pull_down_"

+ 1 - 0
iOSClient/Files/NCFiles.swift

@@ -87,6 +87,7 @@ class NCFiles: NCCollectionViewCommon {
             }
             let directory = NCManageDatabase.shared.getTableDirectory(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", self.appDelegate.account, self.serverUrl))
             let metadataTransfer = NCManageDatabase.shared.getMetadata(predicate: NSPredicate(format: "status != %i AND serverUrl == %@", NCGlobal.shared.metadataStatusNormal, self.serverUrl))
+            self.richWorkspaceText = directory?.richWorkspace
 
             // FORCED false: test the directory.etag
             if !forced, let directory = directory, directory.etag == self.dataSource.directory?.etag, metadataTransfer == nil {

+ 8 - 31
iOSClient/Main/Collection Common/NCCollectionViewCommon.swift

@@ -1004,10 +1004,6 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
     @objc func reloadDataSource(forced: Bool = true) {
         guard !appDelegate.account.isEmpty else { return }
 
-        // Get richWorkspace Text
-        let directory = NCManageDatabase.shared.getTableDirectory(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", appDelegate.account, serverUrl))
-        richWorkspaceText = directory?.richWorkspace
-
         // E2EE
         isEncryptedFolder = CCUtility.isFolderEncrypted(serverUrl, e2eEncrypted: metadataFolder?.e2eEncrypted ?? false, account: appDelegate.account, urlBase: appDelegate.urlBase)
 
@@ -1016,7 +1012,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
         autoUploadDirectory = NCManageDatabase.shared.getAccountAutoUploadDirectory(urlBase: appDelegate.urlBase, account: appDelegate.account)
 
         // get layout for view
-        //layoutForView = NCUtility.shared.getLayoutForView(key: layoutKey, serverUrl: serverUrl)
+        layoutForView = NCUtility.shared.getLayoutForView(key: layoutKey, serverUrl: serverUrl)
 
         // set GroupField for Grid
         if !self.isSearching && layoutForView?.layout == NCGlobal.shared.layoutGrid {
@@ -1449,39 +1445,20 @@ extension NCCollectionViewCommon: UICollectionViewDataSource {
                     (cell as! NCCellProtocol).filePreviewImageView?.image = NCBrandColor.cacheImages.file
                 }
 
-                //var urlString: String = ""
                 if !metadata.iconUrl.isEmpty {
                     if let ownerId = NCUtility.shared.getAvatarFromIconUrl(metadata: metadata), let cell = cell as? NCCellProtocol {
                         let fileName = metadata.userBaseUrl + "-" + ownerId + ".png"
                         NCOperationQueue.shared.downloadAvatar(user: ownerId, dispalyName: nil, fileName: fileName, cell: cell, view: collectionView, cellImageView: cell.filePreviewImageView)
                     }
+                }
 
-                    /*
-                    if metadata.iconUrl.starts(with: "/apps") {
-                        //urlString = metadata.urlBase + metadata.iconUrl
-                    } else if metadata.iconUrl.contains("http") && metadata.iconUrl.contains("avatar") {
-                        let splitIconUrl = metadata.iconUrl.components(separatedBy: "/")
-                        var found:Bool = false
-                        var ownerId: String = ""
-                        for item in splitIconUrl {
-                            if found {
-                                ownerId = item
-                                break
-                            }
-                            if item == "avatar" { found = true}
-                        }
-                        let fileName = metadata.userBaseUrl + "-" + ownerId + ".png"
-                        if let cell = cell as? NCCellProtocol {
-                            NCOperationQueue.shared.downloadAvatar(user: ownerId, dispalyName: nil, fileName: fileName, cell: cell, view: collectionView, cellImageView: cell.filePreviewImageView)
-                        }
-                    }
-//                    NCCommunication.shared.downloadContent(serverUrl: urlString) { _, data, errorCode, _ in
-//                        if errorCode == 0, let data = data, let image = UIImage(data: data) {
-//                            (cell as! NCCellProtocol).filePreviewImageView?.image = image
-//                        }
+//                if metadata.iconName.contains("contacts"), let subline = metadata.subline, !subline.isEmpty, let cell = cell as? NCCellProtocol {
+//                    let components = subline.components(separatedBy: "@")
+//                    if let user = components.first {
+//                        let fileName = metadata.userBaseUrl + "-" + user + ".png"
+//                        NCOperationQueue.shared.downloadAvatar(user: user, dispalyName: nil, fileName: fileName, cell: cell, view: collectionView, cellImageView: cell.filePreviewImageView)
 //                    }
-                     */
-                }
+//                }
             }
         }
 

+ 1 - 1
iOSClient/Offline/NCOffline.swift

@@ -36,7 +36,7 @@ class NCOffline: NCCollectionViewCommon {
         enableSearchBar = false
         headerMenuButtonsCommand = false
         headerMenuButtonsView = true
-        headerRichWorkspaceDisable = false
+        headerRichWorkspaceDisable = true
         emptyImage = UIImage(named: "folder")?.image(color: NCBrandColor.shared.brandElement, size: UIScreen.main.bounds.width)
         emptyTitle = "_files_no_files_"
         emptyDescription = "_tutorial_offline_view_"