Browse Source

Add basic ShareConfig UI tableView

Signed-off-by: Henrik Storch <henrik.storch@nextcloud.com>
Henrik Storch 3 years ago
parent
commit
5a72e91225

+ 36 - 0
Nextcloud.xcodeproj/project.pbxproj

@@ -57,6 +57,13 @@
 		AF817EF4274BC781009ED85B /* NCUserBaseUrl.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF817EF0274BC781009ED85B /* NCUserBaseUrl.swift */; };
 		AF8ED1FC2757821000B8DBC4 /* NextcloudTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF8ED1FB2757821000B8DBC4 /* NextcloudTests.swift */; };
 		AF8ED2032757822700B8DBC4 /* NCGlobalTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF8ED2022757822700B8DBC4 /* NCGlobalTests.swift */; };
+		AF93471227E2341B002537EE /* NCShare+Menu.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF93471127E2341B002537EE /* NCShare+Menu.swift */; };
+		AF93471927E2361E002537EE /* NCShareAdvancePermissionFooter.xib in Resources */ = {isa = PBXBuildFile; fileRef = AF93471427E2361E002537EE /* NCShareAdvancePermissionFooter.xib */; };
+		AF93471A27E2361E002537EE /* NCShareAdvancePermissionHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF93471527E2361E002537EE /* NCShareAdvancePermissionHeader.swift */; };
+		AF93471B27E2361E002537EE /* NCShareAdvancePermission.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF93471627E2361E002537EE /* NCShareAdvancePermission.swift */; };
+		AF93471C27E2361E002537EE /* NCShareAdvancePermissionHeader.xib in Resources */ = {isa = PBXBuildFile; fileRef = AF93471727E2361E002537EE /* NCShareAdvancePermissionHeader.xib */; };
+		AF93471D27E2361E002537EE /* NCShareAdvancePermissionFooter.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF93471827E2361E002537EE /* NCShareAdvancePermissionFooter.swift */; };
+		AF93474C27E34120002537EE /* NCUtility+Image.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF93474B27E34120002537EE /* NCUtility+Image.swift */; };
 		AF935067276B84E700BD078F /* NCMenu+FloatingPanel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF935066276B84E700BD078F /* NCMenu+FloatingPanel.swift */; };
 		AFA2AC8527849604008E1EA7 /* NCActivityCommentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFA2AC8427849604008E1EA7 /* NCActivityCommentView.swift */; };
 		AFD33240276A02C100F5AE02 /* UIApplication+Orientation.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFD3323F276A02C000F5AE02 /* UIApplication+Orientation.swift */; };
@@ -504,6 +511,13 @@
 		AF8ED1F92757821000B8DBC4 /* NextcloudTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = NextcloudTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
 		AF8ED1FB2757821000B8DBC4 /* NextcloudTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NextcloudTests.swift; sourceTree = "<group>"; };
 		AF8ED2022757822700B8DBC4 /* NCGlobalTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCGlobalTests.swift; sourceTree = "<group>"; };
+		AF93471127E2341B002537EE /* NCShare+Menu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NCShare+Menu.swift"; sourceTree = "<group>"; };
+		AF93471427E2361E002537EE /* NCShareAdvancePermissionFooter.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = NCShareAdvancePermissionFooter.xib; sourceTree = "<group>"; };
+		AF93471527E2361E002537EE /* NCShareAdvancePermissionHeader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NCShareAdvancePermissionHeader.swift; sourceTree = "<group>"; };
+		AF93471627E2361E002537EE /* NCShareAdvancePermission.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NCShareAdvancePermission.swift; sourceTree = "<group>"; };
+		AF93471727E2361E002537EE /* NCShareAdvancePermissionHeader.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = NCShareAdvancePermissionHeader.xib; sourceTree = "<group>"; };
+		AF93471827E2361E002537EE /* NCShareAdvancePermissionFooter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NCShareAdvancePermissionFooter.swift; sourceTree = "<group>"; };
+		AF93474B27E34120002537EE /* NCUtility+Image.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NCUtility+Image.swift"; sourceTree = "<group>"; };
 		AF935066276B84E700BD078F /* NCMenu+FloatingPanel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NCMenu+FloatingPanel.swift"; sourceTree = "<group>"; };
 		AFA2AC8427849604008E1EA7 /* NCActivityCommentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCActivityCommentView.swift; sourceTree = "<group>"; };
 		AFD3323F276A02C000F5AE02 /* UIApplication+Orientation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIApplication+Orientation.swift"; sourceTree = "<group>"; };
@@ -1035,6 +1049,7 @@
 				F7581D2325EFDDDF004DC699 /* NCMedia+Menu.swift */,
 				F7CBC31B24F78E79004D3812 /* NCSortMenu.swift */,
 				F75D19E225EFE09000D74598 /* NCTrash+Menu.swift */,
+				AF93471127E2341B002537EE /* NCShare+Menu.swift */,
 				F710D2012405826100A6033D /* NCViewer+Menu.swift */,
 			);
 			path = Menu;
@@ -1050,6 +1065,18 @@
 			path = NextcloudTests;
 			sourceTree = "<group>";
 		};
+		AF93471327E235EB002537EE /* Advanced */ = {
+			isa = PBXGroup;
+			children = (
+				AF93471627E2361E002537EE /* NCShareAdvancePermission.swift */,
+				AF93471827E2361E002537EE /* NCShareAdvancePermissionFooter.swift */,
+				AF93471427E2361E002537EE /* NCShareAdvancePermissionFooter.xib */,
+				AF93471527E2361E002537EE /* NCShareAdvancePermissionHeader.swift */,
+				AF93471727E2361E002537EE /* NCShareAdvancePermissionHeader.xib */,
+			);
+			path = Advanced;
+			sourceTree = "<group>";
+		};
 		F70211F31BAC56E9003FC03E /* Main */ = {
 			isa = PBXGroup;
 			children = (
@@ -1183,6 +1210,7 @@
 			children = (
 				F700510022DF63AC003A3356 /* NCShare.storyboard */,
 				F700510422DF6A89003A3356 /* NCShare.swift */,
+				AF93471327E235EB002537EE /* Advanced */,
 				AF730AF727834B1400B7520E /* NCShare+NCCellDelegate.swift */,
 				F723B3DC22FC6D1C00301EFE /* NCShareCommentsCell.xib */,
 				F7E4D9C322ED929B003675FD /* NCShareCommentsCell.swift */,
@@ -1537,6 +1565,7 @@
 				F70968A324212C4E00ED60E5 /* NCLivePhoto.swift */,
 				F707C26421A2DC5200F6181E /* NCStoreReview.swift */,
 				F70BFC7320E0FA7C00C67599 /* NCUtility.swift */,
+				AF93474B27E34120002537EE /* NCUtility+Image.swift */,
 				AF817EF0274BC781009ED85B /* NCUserBaseUrl.swift */,
 				F74AF3A3247FB6AE00AC767B /* NCUtilityFileSystem.swift */,
 				AF36077027BFA4E8001A243D /* ParallelWorker.swift */,
@@ -2261,6 +2290,7 @@
 				F7632FBF21832F8700721B71 /* NCTrashSectionHeaderMenu.xib in Resources */,
 				F7F4F10B27ECDBDB008676F9 /* Inconsolata-Light.ttf in Resources */,
 				3704EB2A23D5A58400455C5B /* NCMenu.storyboard in Resources */,
+				AF93471C27E2361E002537EE /* NCShareAdvancePermissionHeader.xib in Resources */,
 				F7D0F33E264144FC0097D4A3 /* Background.xcassets in Resources */,
 				F7F1E54C2492369A00E42386 /* NCMediaCommandView.xib in Resources */,
 				F710E8111EF95C9C00DC2427 /* ImagesIntro.xcassets in Resources */,
@@ -2277,6 +2307,7 @@
 				F717402D24F699A5000C87D5 /* NCFavorite.storyboard in Resources */,
 				F723B3DD22FC6D1D00301EFE /* NCShareCommentsCell.xib in Resources */,
 				F78ACD4B21903F850088454D /* NCTrashListCell.xib in Resources */,
+				AF93471927E2361E002537EE /* NCShareAdvancePermissionFooter.xib in Resources */,
 				F7725A61251F33BB00D125E0 /* NCFiles.storyboard in Resources */,
 				F700510122DF63AC003A3356 /* NCShare.storyboard in Resources */,
 				F787704F22E7019900F287A9 /* NCShareLinkCell.xib in Resources */,
@@ -2507,6 +2538,7 @@
 				F73F537F1E929C8500F8678D /* NCMore.swift in Sources */,
 				F702F2CF25EE5B5C008F8E80 /* NCGlobal.swift in Sources */,
 				F72CD63A25C19EBF00F46F9A /* NCAutoUpload.swift in Sources */,
+				AF93471D27E2361E002537EE /* NCShareAdvancePermissionFooter.swift in Sources */,
 				F7DFB7F0219C5B8000680748 /* NCCreateFormUploadAssets.swift in Sources */,
 				AF1A9B6427D0CA1E00F17A9E /* UIAlertController+Extension.swift in Sources */,
 				F73B422C2476764F00A30FD3 /* NCNotification.swift in Sources */,
@@ -2565,6 +2597,7 @@
 				F702F2F725EE5CED008F8E80 /* NCLogin.swift in Sources */,
 				F7E98C1627E0D0FC001F9F19 /* NCManageDatabase+Video.swift in Sources */,
 				F7F4F11227ECDC52008676F9 /* UIFont+Extension.swift in Sources */,
+				AF93471A27E2361E002537EE /* NCShareAdvancePermissionHeader.swift in Sources */,
 				F7F878AE1FB9E3B900599E4F /* NCEndToEndMetadata.swift in Sources */,
 				F7DBC37C23325E02001A85BA /* NCAppConfigView.swift in Sources */,
 				3781B9B023DB2B7E006B4B1D /* AppDelegate+Menu.swift in Sources */,
@@ -2587,8 +2620,10 @@
 				F7581D2425EFDDDF004DC699 /* NCMedia+Menu.swift in Sources */,
 				F738D4902756740100CD1D38 /* NCLoginNavigationController.swift in Sources */,
 				F77B0E981D118A16002130FE /* CCManageAccount.m in Sources */,
+				AF93474C27E34120002537EE /* NCUtility+Image.swift in Sources */,
 				F77EFC0C26D6751F00806ED6 /* NCShareQuickStatusMenu.swift in Sources */,
 				F702F30125EE5D2C008F8E80 /* NYMnemonic.m in Sources */,
+				AF93471227E2341B002537EE /* NCShare+Menu.swift in Sources */,
 				F7EFA47825ADBA500083159A /* NCViewerProviderContextMenu.swift in Sources */,
 				F755BD9B20594AC7008C5FBB /* NCService.swift in Sources */,
 				AFD33240276A02C100F5AE02 /* UIApplication+Orientation.swift in Sources */,
@@ -2604,6 +2639,7 @@
 				F79A65C62191D95E00FF6DCC /* NCSelect.swift in Sources */,
 				F75D19E325EFE09000D74598 /* NCTrash+Menu.swift in Sources */,
 				F70CAE3A1F8CF31A008125FD /* NCEndToEndEncryption.m in Sources */,
+				AF93471B27E2361E002537EE /* NCShareAdvancePermission.swift in Sources */,
 				F70753EB2542A99800972D44 /* NCViewerMediaPage.swift in Sources */,
 				F74C0436253F1CDC009762AB /* NCShares.swift in Sources */,
 				F7AE00F5230D5F9E007ACF8A /* NCLoginWeb.swift in Sources */,

+ 10 - 0
iOSClient/Brand/NCBrand.swift

@@ -215,6 +215,16 @@ class NCBrandColor: NSObject {
         }
     }
 
+    @objc public var secondaryLabel: UIColor {
+        get {
+            if #available(iOS 13, *) {
+                return .secondaryLabel
+            } else {
+                return UIColor(red: 0.24, green: 0.24, blue: 0.26, alpha: 0.6)
+            }
+        }
+    }
+
     @objc public var separator: UIColor {
         get {
             if #available(iOS 13, *) {

+ 24 - 0
iOSClient/Extensions/UIBarButton+Extension.swift

@@ -53,3 +53,27 @@ extension UIBarButtonItem {
         _action()
     }
 }
+
+extension UIView {
+    enum VerticalLocation: String {
+        case bottom
+        case top
+    }
+
+    func addShadow(location: VerticalLocation, height: CGFloat = 2, color: UIColor = .black, opacity: Float = 0.4, radius: CGFloat = 2) {
+        switch location {
+        case .bottom:
+             addShadow(offset: CGSize(width: 0, height: height), color: color, opacity: opacity, radius: radius)
+        case .top:
+            addShadow(offset: CGSize(width: 0, height: -height), color: color, opacity: opacity, radius: radius)
+        }
+    }
+
+    private func addShadow(offset: CGSize, color: UIColor, opacity: Float, radius: CGFloat) {
+        self.layer.masksToBounds = false
+        self.layer.shadowColor = color.cgColor
+        self.layer.shadowOffset = offset
+        self.layer.shadowOpacity = opacity
+        self.layer.shadowRadius = radius
+    }
+}

+ 68 - 0
iOSClient/Menu/NCShare+Menu.swift

@@ -0,0 +1,68 @@
+//
+//  NCShare+Menu.swift
+//  Nextcloud
+//
+//  Created by Henrik Storch on 16.03.22.
+//  Copyright © 2022 Marino Faggiana. All rights reserved.
+//
+
+import Foundation
+
+extension NCShare {
+    func toggleShareMenu(for tableShare: tableShare) {
+        
+        var actions = [NCMenuAction]()
+        
+//        if !folder {
+//            actions.append(
+//                NCMenuAction(
+//                    title: NSLocalizedString("_open_in_", comment: ""),
+//                    icon: NCUtility.shared.loadImage(named: "viewInFolder").imageColor(NCBrandColor.shared.brandElement),
+//                    action: { menuAction in
+//                        NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterShareViewIn)
+//                    }
+//                )
+//            )
+//        }
+        
+        actions.append(
+            NCMenuAction(
+                title: NSLocalizedString("_advance_permissions_", comment: ""),
+                icon: NCUtility.shared.loadImage(named: "rename").imageColor(NCBrandColor.shared.brandElement),
+                action: { _ in
+                    // TODO: Open Advanced permissions modal view
+                    guard
+                        let advancePermission = UIStoryboard(name: "NCShare", bundle: nil).instantiateViewController(withIdentifier: "NCShareAdvancePermission") as? NCShareAdvancePermission,
+                        let navigationController = self.navigationController else { return }
+                    advancePermission.share = tableShare
+                    advancePermission.metadata = self.metadata
+                    navigationController.pushViewController(advancePermission, animated: true)
+                }
+            )
+        )
+        
+//        if sendMail {
+//            actions.append(
+//                NCMenuAction(
+//                    title: NSLocalizedString("_send_new_email_", comment: ""),
+//                    icon: NCUtility.shared.loadImage(named: "email").imageColor(NCBrandColor.shared.brandElement),
+//                    action: { menuAction in
+//                        NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterShareSendEmail)
+//                    }
+//                )
+//            )
+//        }
+        
+        actions.append(
+            NCMenuAction(
+                title: NSLocalizedString("_share_unshare_", comment: ""),
+                icon: NCUtility.shared.loadImage(named: "delete").imageColor(NCBrandColor.shared.brandElement),
+                action: { _ in
+                    // TODO: Unshare!
+                }
+            )
+        )
+
+        self.presentMenu(with: actions)
+    }
+}

+ 277 - 0
iOSClient/Share/Advanced/NCShareAdvancePermission.swift

@@ -0,0 +1,277 @@
+//
+//  NCShareAdvancePermission.swift
+//  Nextcloud
+//
+//  Created by T-systems on 09/08/21.
+//  Copyright © 2021 Marino Faggiana. All rights reserved.
+//
+
+import UIKit
+import NCCommunication
+import SVGKit
+import CloudKit
+
+class NCShareAdvancePermission: UITableViewController {
+    var share: tableShare!
+    var metadata: tableMetadata!
+    var shareConfig: ShareConfig!
+
+    override func viewDidLoad() {
+        super.viewDidLoad()
+        self.shareConfig = ShareConfig(isDirectory: metadata.directory, share: share)
+    }
+    
+    override func viewWillLayoutSubviews() {
+        super.viewWillLayoutSubviews()
+        guard tableView.tableHeaderView == nil, tableView.tableFooterView == nil else { return }
+        setupHeaderView()
+        setupFooterView()
+    }
+    @objc func cancelClicked() {
+        navigationController?.popViewController(animated: true)
+    }
+
+    @objc func nextClicked() {
+    }
+
+    func setupFooterView() {
+        guard let footerView = (Bundle.main.loadNibNamed("NCShareAdvancePermissionFooter", owner: self, options: nil)?.first as? NCShareAdvancePermissionFooter) else { return }
+        footerView.backgroundColor = .clear
+        footerView.addShadow(location: .top)
+
+        footerView.buttonCancel.addTarget(self, action: #selector(cancelClicked), for: .touchUpInside)
+        footerView.buttonCancel.setTitle(NSLocalizedString("_cancel_", comment: ""), for: .normal)
+        footerView.buttonCancel.layer.cornerRadius = 10
+        footerView.buttonCancel.layer.masksToBounds = true
+        footerView.buttonCancel.layer.borderWidth = 1
+
+        if NCManageDatabase.shared.getTableShare(account: share.account, idShare: share.idShare) == nil {
+            footerView.buttonNext.setTitle(NSLocalizedString("_next_", comment: ""), for: .normal)
+        } else {
+            footerView.buttonNext.setTitle(NSLocalizedString("_apply_changes_", comment: ""), for: .normal)
+        }
+        footerView.buttonNext.layer.cornerRadius = 10
+        footerView.buttonNext.layer.masksToBounds = true
+        footerView.buttonNext.backgroundColor = NCBrandColor.shared.brand
+        footerView.buttonNext.addTarget(self, action: #selector(nextClicked), for: .touchUpInside)
+
+        footerView.frame = CGRect(x: 0, y: 0, width: view.frame.width, height: 100)
+        tableView.tableFooterView = footerView
+        tableView.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: 100, right: 0)
+
+        footerView.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor).isActive = true
+        footerView.leftAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leftAnchor).isActive = true
+        footerView.rightAnchor.constraint(equalTo: view.safeAreaLayoutGuide.rightAnchor).isActive = true
+        footerView.heightAnchor.constraint(equalToConstant: 100).isActive = true
+    }
+
+    func setupHeaderView() {
+        guard let headerView = (Bundle.main.loadNibNamed("NCShareAdvancePermissionHeader", owner: self, options: nil)?.first as? NCShareAdvancePermissionHeader) else { return }
+//        headerView.backgroundColor = NCBrandColor.shared.secondarySystemBackground
+        if FileManager.default.fileExists(atPath: CCUtility.getDirectoryProviderStorageIconOcId(metadata.ocId, etag: metadata.etag)) {
+            headerView.fullWidthImageView.image = NCUtility.shared.getImageMetadata(metadata, for: headerView.frame.height)
+            headerView.fullWidthImageView.contentMode = .scaleAspectFill
+            headerView.imageView.isHidden = true
+        } else {
+            if metadata!.directory {
+                headerView.imageView.image = UIImage(named: "folder")
+            } else if !metadata.iconName.isEmpty {
+                headerView.imageView.image = UIImage(named: metadata.iconName)
+            } else {
+                headerView.imageView.image = UIImage(named: "file")
+            }
+        }
+        headerView.favorite.setNeedsUpdateConstraints()
+        headerView.favorite.layoutIfNeeded()
+        headerView.fileName.text = self.metadata?.fileNameView
+        headerView.fileName.textColor = NCBrandColor.shared.label
+        headerView.favorite.addTarget(self, action: #selector(favoriteClicked), for: .touchUpInside)
+        if metadata.favorite {
+            headerView.favorite.setImage(NCUtility.shared.loadImage(named: "star.fill", color: NCBrandColor.shared.yellowFavorite, size: 24), for: .normal)
+        } else {
+            headerView.favorite.setImage(NCUtility.shared.loadImage(named: "star.fill", color: NCBrandColor.shared.systemGray, size: 24), for: .normal)
+        }
+        headerView.info.textColor = NCBrandColor.shared.secondaryLabel
+        headerView.info.text = CCUtility.transformedSize(metadata.size) + ", " + CCUtility.dateDiff(metadata.date as Date)
+        headerView.frame = CGRect(x: 0, y: 0, width: self.view.frame.size.width, height: 200)
+        tableView.tableHeaderView = headerView
+        headerView.translatesAutoresizingMaskIntoConstraints = false
+        headerView.heightAnchor.constraint(equalToConstant: 200).isActive = true
+        headerView.widthAnchor.constraint(equalTo: view.widthAnchor).isActive = true
+    }
+
+    override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
+        if section == 0 { return NSLocalizedString("_advanced_", comment: "") }
+        else if section == 1 { return NSLocalizedString("_misc_", comment: "") }
+        else { return nil }
+    }
+
+    override func numberOfSections(in tableView: UITableView) -> Int {
+        return 2
+    }
+
+    override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
+        if section == 0 { return shareConfig.permissions.count }
+        else if section == 1 { return shareConfig.advanced.count }
+        else { return 0 }
+    }
+
+    override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
+        guard let cell = shareConfig.cellFor(indexPath: indexPath) else { return UITableViewCell() }
+        return cell
+    }
+
+    @objc func favoriteClicked() {
+        
+    }
+}
+
+protocol ShareCellConfig {
+    var title: String { get }
+    func isOn(for share: tableShare) -> Bool
+    func didChange(_ share: tableShare, to newValue: Bool)
+}
+
+protocol Permission: ShareCellConfig {
+    static var forDirectory: [Self] { get }
+    static var forFile: [Self] { get }
+}
+
+enum UserPermission: CaseIterable, Permission {
+    func didChange(_ share: tableShare, to newValue: Bool) {
+        
+    }
+
+    func isOn(for share: tableShare) -> Bool {
+        switch self {
+        case .reshare: return CCUtility.isPermission(toCanShare: share.permissions)
+        case .edit: return CCUtility.isPermission(toCanChange: share.permissions)
+        case .create: return CCUtility.isPermission(toCanCreate: share.permissions)
+        case .delete: return CCUtility.isPermission(toCanDelete: share.permissions)
+        }
+    }
+
+    func handleAction(for tableShare: tableShare) {
+        switch self {
+        case .reshare: break
+        case .edit: break
+        case .create: break
+        case .delete: break
+        }
+    }
+
+    case reshare, edit, create, delete
+    static let forDirectory: [UserPermission] = UserPermission.allCases
+    static let forFile: [UserPermission] = [.reshare, .edit]
+
+    var title: String {
+        switch self {
+        case .reshare: return NSLocalizedString("_share_can_reshare_", comment: "")
+        case .edit: return NSLocalizedString("_share_can_change_", comment: "")
+        case .create: return NSLocalizedString("_share_can_create_", comment: "")
+        case .delete: return NSLocalizedString("_share_can_delete_", comment: "")
+        }
+    }
+}
+
+enum LinkPermission: Permission {
+    func didChange(_ share: tableShare, to newValue: Bool) {
+        
+    }
+
+    func isOn(for share: tableShare) -> Bool {
+        switch self {
+        case .allowEdit: return CCUtility.isAnyPermission(toEdit: share.permissions)
+        case .viewOnly: return !CCUtility.isAnyPermission(toEdit: share.permissions) && share.permissions != NCGlobal.shared.permissionCreateShare
+        case .uploadEdit: return CCUtility.isAnyPermission(toEdit: share.permissions) && share.permissions != NCGlobal.shared.permissionCreateShare
+        case .fileDrop: return share.permissions == NCGlobal.shared.permissionCreateShare
+        }
+    }
+
+    var title: String {
+        switch self {
+        case .allowEdit: return NSLocalizedString("_share_can_change_", comment: "")
+        case .viewOnly: return NSLocalizedString("_share_read_only_", comment: "")
+        case .uploadEdit: return NSLocalizedString("_share_allow_upload_", comment: "")
+        case .fileDrop: return NSLocalizedString("_share_file_drop_", comment: "")
+        }
+    }
+
+    case allowEdit, viewOnly, uploadEdit, fileDrop
+    static let forDirectory: [LinkPermission] = [.viewOnly, .uploadEdit, .fileDrop]
+    static let forFile: [LinkPermission] = [.allowEdit]
+}
+
+enum Advanced: CaseIterable, ShareCellConfig {
+    func didChange(_ share: tableShare, to newValue: Bool) {
+        
+    }
+
+    func isOn(for share: tableShare) -> Bool {
+        switch self {
+        case .hideDownload: return share.hideDownload
+        case .expirationDate: return share.expirationDate != nil
+        case .password: return !share.shareWith.isEmpty
+        case .note: return false
+        }
+    }
+
+    var title: String {
+        switch self {
+        case .hideDownload: return NSLocalizedString("_share_hide_download_", comment: "")
+        case .expirationDate: return NSLocalizedString("_share_expiration_date_", comment: "")
+        case .password: return NSLocalizedString("_share_password_", comment: "")
+        case .note: return NSLocalizedString("_share_note_recipient_", comment: "")
+        }
+    }
+
+    case hideDownload, expirationDate, password, note
+    static let forLink: [Advanced] = Advanced.allCases
+    static let forUser: [Advanced] = [.expirationDate, .note]
+}
+
+struct ShareConfig {
+
+    let permissions: [Permission]
+    let advanced: [Advanced]
+    let share: tableShare
+
+    init(isDirectory: Bool, share: tableShare) {
+        self.share = share
+        let type: Permission.Type = share.shareType == 3 ? LinkPermission.self : UserPermission.self
+        self.permissions = isDirectory ? type.forDirectory : type.forFile
+        self.advanced = share.shareType == 3 ? Advanced.forLink : Advanced.forUser
+    }
+
+    func cellFor(indexPath: IndexPath) -> UITableViewCell? {
+        let cellConfig: ShareCellConfig
+        if indexPath.section == 0, indexPath.row < permissions.count {
+            cellConfig = permissions[indexPath.row]
+        } else if indexPath.section == 1, indexPath.row < advanced.count {
+            cellConfig = advanced[indexPath.row]
+        } else { return nil }
+        let cell = ToggleCell(isOn: cellConfig.isOn(for: share)) { newValue in
+            cellConfig.didChange(share, to: newValue)
+        }
+        cell.textLabel?.text = cellConfig.title
+        return cell
+    }
+}
+
+class ToggleCell: UITableViewCell {
+    let toggle = UISwitch()
+
+    init(isOn: Bool, didChange: @escaping (Bool) -> Void) {
+        super.init(style: .default, reuseIdentifier: "toggleCell")
+        toggle.frame = .zero
+        toggle.isOn = isOn
+        toggle.action(for: .valueChanged) { _ in
+            didChange(self.toggle.isOn)
+        }
+        self.accessoryView = toggle
+    }
+
+    required init?(coder: NSCoder) {
+        fatalError("init(coder:) has not been implemented")
+    }
+}

+ 14 - 0
iOSClient/Share/Advanced/NCShareAdvancePermissionFooter.swift

@@ -0,0 +1,14 @@
+//
+//  NCShareAdvancePermissionFooter.swift
+//  Nextcloud
+//
+//  Created by T-systems on 10/08/21.
+//  Copyright © 2021 Marino Faggiana. All rights reserved.
+//
+
+import UIKit
+
+class NCShareAdvancePermissionFooter: UIView {
+    @IBOutlet weak var buttonCancel: UIButton!
+    @IBOutlet weak var buttonNext: UIButton!
+}

+ 53 - 0
iOSClient/Share/Advanced/NCShareAdvancePermissionFooter.xib

@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="19529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
+    <device id="retina6_1" orientation="portrait" appearance="light"/>
+    <dependencies>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19519"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
+        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+        <view contentMode="scaleToFill" id="iN0-l3-epB" customClass="NCShareAdvancePermissionFooter" customModule="Nextcloud" customModuleProvider="target">
+            <rect key="frame" x="0.0" y="0.0" width="746" height="100"/>
+            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+            <subviews>
+                <button opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="249" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Mg2-Ou-yoX">
+                    <rect key="frame" x="16" y="16" width="349" height="50"/>
+                    <color key="backgroundColor" red="0.8862745098" green="0.0" blue="0.4549019608" alpha="1" colorSpace="calibratedRGB"/>
+                    <state key="normal" title="Send share"/>
+                    <state key="highlighted">
+                        <color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                    </state>
+                </button>
+                <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="rCI-63-PtL">
+                    <rect key="frame" x="381" y="16" width="349" height="50"/>
+                    <color key="backgroundColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                    <constraints>
+                        <constraint firstAttribute="height" constant="50" id="vdI-sH-cTb"/>
+                    </constraints>
+                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                    <color key="tintColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+                    <state key="normal" title="Cancel"/>
+                </button>
+            </subviews>
+            <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+            <constraints>
+                <constraint firstItem="rCI-63-PtL" firstAttribute="leading" secondItem="Mg2-Ou-yoX" secondAttribute="trailing" constant="16" id="4Px-cS-Hta"/>
+                <constraint firstItem="Mg2-Ou-yoX" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" constant="16" id="53I-Ri-rEO"/>
+                <constraint firstItem="Mg2-Ou-yoX" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="16" id="Jdi-WJ-zVF"/>
+                <constraint firstItem="Mg2-Ou-yoX" firstAttribute="height" secondItem="rCI-63-PtL" secondAttribute="height" id="bNp-Nf-uMw"/>
+                <constraint firstItem="Mg2-Ou-yoX" firstAttribute="width" secondItem="rCI-63-PtL" secondAttribute="width" id="dfu-GZ-P99"/>
+                <constraint firstItem="rCI-63-PtL" firstAttribute="centerY" secondItem="Mg2-Ou-yoX" secondAttribute="centerY" id="hEl-ij-sMX"/>
+                <constraint firstAttribute="trailing" secondItem="rCI-63-PtL" secondAttribute="trailing" constant="16" id="s9t-ud-ofw"/>
+            </constraints>
+            <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
+            <connections>
+                <outlet property="buttonCancel" destination="rCI-63-PtL" id="SoT-Ko-LL5"/>
+                <outlet property="buttonNext" destination="Mg2-Ou-yoX" id="F2d-L5-dHo"/>
+            </connections>
+            <point key="canvasLocation" x="166.66666666666669" y="126.89732142857142"/>
+        </view>
+    </objects>
+</document>

+ 21 - 0
iOSClient/Share/Advanced/NCShareAdvancePermissionHeader.swift

@@ -0,0 +1,21 @@
+//
+//  NCShareAdvancePermissionHeader.swift
+//  Nextcloud
+//
+//  Created by T-systems on 10/08/21.
+//  Copyright © 2021 Marino Faggiana. All rights reserved.
+//
+
+import UIKit
+
+class NCShareAdvancePermissionHeader: UIView {
+    @IBOutlet weak var imageView: UIImageView!
+    @IBOutlet weak var fileName: UILabel!
+    @IBOutlet weak var info: UILabel!
+    @IBOutlet weak var favorite: UIButton!
+    @IBOutlet weak var fullWidthImageView: UIImageView!
+}
+
+protocol NCShareAdvancePermissionHeaderDelegate: AnyObject {
+    func favoriteClicked()
+}

+ 81 - 0
iOSClient/Share/Advanced/NCShareAdvancePermissionHeader.xib

@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="19529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
+    <device id="retina6_1" orientation="portrait" appearance="light"/>
+    <dependencies>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19519"/>
+        <capability name="Safe area layout guides" minToolsVersion="9.0"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
+        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+        <view contentMode="scaleToFill" id="wbW-yR-MZC" customClass="NCShareAdvancePermissionHeader" customModule="Nextcloud" customModuleProvider="target">
+            <rect key="frame" x="0.0" y="0.0" width="414" height="260"/>
+            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+            <subviews>
+                <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="cki-Ql-o1I">
+                    <rect key="frame" x="0.0" y="44" width="414" height="150"/>
+                    <constraints>
+                        <constraint firstAttribute="height" constant="150" id="9GH-KF-f8P"/>
+                    </constraints>
+                </imageView>
+                <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="Dkw-QP-be6">
+                    <rect key="frame" x="16" y="71" width="96" height="96"/>
+                    <constraints>
+                        <constraint firstAttribute="height" constant="96" id="TW7-8v-NRJ"/>
+                        <constraint firstAttribute="width" constant="96" id="Vbz-xZ-L5k"/>
+                    </constraints>
+                </imageView>
+                <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="bm4-az-bTg">
+                    <rect key="frame" x="16" y="199" width="24" height="24"/>
+                    <constraints>
+                        <constraint firstAttribute="width" constant="24" id="CkU-6s-pzs"/>
+                        <constraint firstAttribute="height" constant="24" id="RfD-cs-o1s"/>
+                    </constraints>
+                    <state key="normal" image="star.fill"/>
+                </button>
+                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="pu4-Nd-M08">
+                    <rect key="frame" x="48" y="202" width="351" height="18"/>
+                    <fontDescription key="fontDescription" type="system" weight="semibold" pointSize="15"/>
+                    <nil key="textColor"/>
+                    <nil key="highlightedColor"/>
+                </label>
+                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="VaC-Fz-kHk">
+                    <rect key="frame" x="48" y="224" width="351" height="16"/>
+                    <fontDescription key="fontDescription" type="system" pointSize="13"/>
+                    <color key="textColor" red="0.76862745099999996" green="0.77647058820000003" blue="0.77647058820000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                    <nil key="highlightedColor"/>
+                </label>
+            </subviews>
+            <viewLayoutGuide key="safeArea" id="KLE-vd-Dsn"/>
+            <constraints>
+                <constraint firstAttribute="trailing" secondItem="VaC-Fz-kHk" secondAttribute="trailing" constant="15" id="Ebg-3T-03W"/>
+                <constraint firstItem="Dkw-QP-be6" firstAttribute="leading" secondItem="wbW-yR-MZC" secondAttribute="leading" constant="16" id="KPc-al-RWN"/>
+                <constraint firstItem="KLE-vd-Dsn" firstAttribute="top" secondItem="cki-Ql-o1I" secondAttribute="top" id="KsC-jf-M6F"/>
+                <constraint firstItem="bm4-az-bTg" firstAttribute="leading" secondItem="wbW-yR-MZC" secondAttribute="leading" constant="16" id="NgP-e4-owx"/>
+                <constraint firstItem="pu4-Nd-M08" firstAttribute="centerY" secondItem="bm4-az-bTg" secondAttribute="centerY" id="Pt7-LW-9Yv"/>
+                <constraint firstItem="pu4-Nd-M08" firstAttribute="leading" secondItem="bm4-az-bTg" secondAttribute="trailing" constant="8" id="TXl-5L-34h"/>
+                <constraint firstAttribute="trailing" secondItem="cki-Ql-o1I" secondAttribute="trailing" id="Wdl-Rb-Pjy"/>
+                <constraint firstItem="VaC-Fz-kHk" firstAttribute="leading" secondItem="pu4-Nd-M08" secondAttribute="leading" id="Ycb-wy-uL6"/>
+                <constraint firstItem="cki-Ql-o1I" firstAttribute="leading" secondItem="wbW-yR-MZC" secondAttribute="leading" id="ZlH-LU-x2x"/>
+                <constraint firstItem="Dkw-QP-be6" firstAttribute="centerY" secondItem="cki-Ql-o1I" secondAttribute="centerY" id="dME-jJ-PwO"/>
+                <constraint firstAttribute="trailing" secondItem="pu4-Nd-M08" secondAttribute="trailing" constant="15" id="rFa-oW-WgO"/>
+                <constraint firstItem="bm4-az-bTg" firstAttribute="top" secondItem="cki-Ql-o1I" secondAttribute="bottom" constant="5" id="tUq-fs-PhE"/>
+                <constraint firstItem="VaC-Fz-kHk" firstAttribute="top" secondItem="pu4-Nd-M08" secondAttribute="bottom" constant="4" id="zkb-Jm-sin"/>
+            </constraints>
+            <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
+            <connections>
+                <outlet property="favorite" destination="bm4-az-bTg" id="iz8-yI-BS3"/>
+                <outlet property="fileName" destination="pu4-Nd-M08" id="iLj-ya-6hM"/>
+                <outlet property="fullWidthImageView" destination="cki-Ql-o1I" id="KYn-3Y-SZH"/>
+                <outlet property="imageView" destination="Dkw-QP-be6" id="wzX-Sb-Ajt"/>
+                <outlet property="info" destination="VaC-Fz-kHk" id="n9O-6c-qsd"/>
+            </connections>
+            <point key="canvasLocation" x="36.231884057971016" y="59.598214285714285"/>
+        </view>
+    </objects>
+    <resources>
+        <image name="star.fill" width="512" height="512"/>
+    </resources>
+</document>

+ 2 - 2
iOSClient/Share/NCShare+NCCellDelegate.swift

@@ -37,8 +37,8 @@ extension NCShare: NCShareLinkCellDelegate, NCShareUserCellDelegate {
         let isFilesSharingPublicPasswordEnforced = NCManageDatabase.shared.getCapabilitiesServerBool(account: metadata.account, elements: NCElementsJSON.shared.capabilitiesFileSharingPubPasswdEnforced, exists: false)
 
         if let tableShare = tableShare {
-            // TODO: open share menu
-            
+            // open share menu
+            self.toggleShareMenu(for: tableShare)
         } else if isFilesSharingPublicPasswordEnforced {
             // create share with pw
             let alertController = UIAlertController(title: NSLocalizedString("_enforce_password_protection_", comment: ""), message: "", preferredStyle: .alert)

+ 250 - 12
iOSClient/Share/NCShare.storyboard

@@ -1,10 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="19455" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="Ts3-RO-A9l">
-    <device id="retina5_5" orientation="landscape" appearance="light"/>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="19529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="Ts3-RO-A9l">
+    <device id="retina5_5" orientation="portrait" appearance="light"/>
     <dependencies>
         <deployment identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19454"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19519"/>
         <capability name="Safe area layout guides" minToolsVersion="9.0"/>
+        <capability name="System colors in document resources" minToolsVersion="11.0"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <scenes>
@@ -13,7 +14,7 @@
             <objects>
                 <viewController id="UdT-J4-zvv" customClass="NCSharePaging" customModule="Nextcloud" customModuleProvider="target" sceneMemberID="viewController">
                     <view key="view" contentMode="scaleToFill" id="xka-e7-U7G">
-                        <rect key="frame" x="0.0" y="0.0" width="736" height="414"/>
+                        <rect key="frame" x="0.0" y="0.0" width="414" height="736"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <viewLayoutGuide key="safeArea" id="EQO-kT-aOm"/>
                         <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
@@ -30,7 +31,7 @@
                 <navigationController automaticallyAdjustsScrollViewInsets="NO" id="Ts3-RO-A9l" sceneMemberID="viewController">
                     <toolbarItems/>
                     <navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="RCF-gN-HcM">
-                        <rect key="frame" x="0.0" y="0.0" width="736" height="44"/>
+                        <rect key="frame" x="0.0" y="0.0" width="414" height="44"/>
                         <autoresizingMask key="autoresizingMask"/>
                     </navigationBar>
                     <nil name="viewControllers"/>
@@ -47,18 +48,18 @@
             <objects>
                 <viewController storyboardIdentifier="sharing" id="bgO-Rz-2M1" customClass="NCShare" customModule="Nextcloud" customModuleProvider="target" sceneMemberID="viewController">
                     <view key="view" contentMode="scaleToFill" id="aV2-U6-JTf">
-                        <rect key="frame" x="0.0" y="0.0" width="736" height="414"/>
+                        <rect key="frame" x="0.0" y="0.0" width="414" height="736"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <subviews>
                             <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="X2m-IC-J1u" userLabel="View container">
-                                <rect key="frame" x="5" y="0.0" width="726" height="404"/>
+                                <rect key="frame" x="5" y="0.0" width="404" height="726"/>
                                 <subviews>
                                     <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="none" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="c94-b9-Sim">
-                                        <rect key="frame" x="0.0" y="133" width="726" height="271"/>
+                                        <rect key="frame" x="0.0" y="133" width="404" height="593"/>
                                         <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                                     </tableView>
                                     <view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="oBQ-TP-qof" userLabel="View Shared with you by">
-                                        <rect key="frame" x="-5" y="10" width="731" height="90"/>
+                                        <rect key="frame" x="-5" y="10" width="409" height="90"/>
                                         <subviews>
                                             <imageView clipsSubviews="YES" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="fKv-xM-rVY">
                                                 <rect key="frame" x="10" y="0.0" width="40" height="40"/>
@@ -68,7 +69,7 @@
                                                 </constraints>
                                             </imageView>
                                             <label opaque="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Shared with you by" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ngi-GT-jvv">
-                                                <rect key="frame" x="60" y="11" width="661" height="18"/>
+                                                <rect key="frame" x="60" y="11" width="339" height="18"/>
                                                 <fontDescription key="fontDescription" type="system" pointSize="15"/>
                                                 <nil key="textColor"/>
                                                 <nil key="highlightedColor"/>
@@ -81,7 +82,7 @@
                                                 </constraints>
                                             </imageView>
                                             <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="KHG-xj-wfG" customClass="MarqueeLabel" customModule="MarqueeLabel">
-                                                <rect key="frame" x="95" y="48.666666666666664" width="616" height="17.999999999999993"/>
+                                                <rect key="frame" x="95" y="48.666666666666664" width="294" height="17.999999999999993"/>
                                                 <fontDescription key="fontDescription" type="system" pointSize="15"/>
                                                 <nil key="textColor"/>
                                                 <nil key="highlightedColor"/>
@@ -105,7 +106,7 @@
                                         </constraints>
                                     </view>
                                     <textField opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="249" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" clearButtonMode="always" translatesAutoresizingMaskIntoConstraints="NO" id="iSO-mc-0TB">
-                                        <rect key="frame" x="5" y="95" width="711" height="30"/>
+                                        <rect key="frame" x="5" y="95" width="389" height="30"/>
                                         <constraints>
                                             <constraint firstAttribute="height" constant="30" id="0aG-z9-fcy"/>
                                         </constraints>
@@ -155,6 +156,235 @@
             </objects>
             <point key="canvasLocation" x="2689.8550724637685" y="-167.41071428571428"/>
         </scene>
+        <!--Share New User Add Comment-->
+        <scene sceneID="JJ2-tz-qZ7">
+            <objects>
+                <viewController storyboardIdentifier="NCShareNewUserAddComment" id="VvU-6J-pzy" customClass="NCShareNewUserAddComment" customModule="Nextcloud" customModuleProvider="target" sceneMemberID="viewController">
+                    <view key="view" contentMode="scaleToFill" id="EtF-Pb-SYb">
+                        <rect key="frame" x="0.0" y="0.0" width="414" height="736"/>
+                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                        <subviews>
+                            <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="YMG-hf-HEX">
+                                <rect key="frame" x="0.0" y="0.0" width="414" height="666"/>
+                                <subviews>
+                                    <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Sim-EE-o0o">
+                                        <rect key="frame" x="0.0" y="0.0" width="414" height="666"/>
+                                        <subviews>
+                                            <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="zDS-SG-Pn2">
+                                                <rect key="frame" x="0.0" y="0.0" width="414" height="150"/>
+                                                <constraints>
+                                                    <constraint firstAttribute="height" constant="150" id="HhK-zC-IyB"/>
+                                                </constraints>
+                                            </imageView>
+                                            <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="folder" translatesAutoresizingMaskIntoConstraints="NO" id="Ice-BM-rML">
+                                                <rect key="frame" x="10" y="20" width="120" height="120"/>
+                                                <constraints>
+                                                    <constraint firstAttribute="height" constant="120" id="3Fh-Ni-Dpc"/>
+                                                    <constraint firstAttribute="width" constant="120" id="xux-ld-eFZ"/>
+                                                </constraints>
+                                            </imageView>
+                                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Your Message" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="3yF-lL-GwU">
+                                                <rect key="frame" x="16" y="271" width="382" height="18"/>
+                                                <fontDescription key="fontDescription" type="system" pointSize="15"/>
+                                                <color key="textColor" red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="calibratedRGB"/>
+                                                <nil key="highlightedColor"/>
+                                            </label>
+                                            <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="hgf-O1-P97">
+                                                <rect key="frame" x="16" y="293" width="382" height="343"/>
+                                                <subviews>
+                                                    <textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" textAlignment="natural" translatesAutoresizingMaskIntoConstraints="NO" id="VT0-1l-5HI">
+                                                        <rect key="frame" x="16" y="16" width="350" height="311"/>
+                                                        <color key="textColor" systemColor="labelColor"/>
+                                                        <fontDescription key="fontDescription" type="system" pointSize="14"/>
+                                                        <textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
+                                                        <userDefinedRuntimeAttributes>
+                                                            <userDefinedRuntimeAttribute type="boolean" keyPath="doneAccessory" value="YES"/>
+                                                        </userDefinedRuntimeAttributes>
+                                                        <connections>
+                                                            <outlet property="delegate" destination="VvU-6J-pzy" id="cAt-UZ-6KT"/>
+                                                        </connections>
+                                                    </textView>
+                                                </subviews>
+                                                <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                                <constraints>
+                                                    <constraint firstItem="VT0-1l-5HI" firstAttribute="top" secondItem="hgf-O1-P97" secondAttribute="top" constant="16" id="cc9-jI-nSo"/>
+                                                    <constraint firstItem="VT0-1l-5HI" firstAttribute="centerX" secondItem="hgf-O1-P97" secondAttribute="centerX" id="cj9-1W-zVt"/>
+                                                    <constraint firstItem="VT0-1l-5HI" firstAttribute="leading" secondItem="hgf-O1-P97" secondAttribute="leading" constant="16" id="gE6-6y-BzR"/>
+                                                    <constraint firstAttribute="height" relation="greaterThanOrEqual" constant="90" id="oU3-bC-F89"/>
+                                                    <constraint firstItem="VT0-1l-5HI" firstAttribute="centerY" secondItem="hgf-O1-P97" secondAttribute="centerY" id="u80-BU-AcP"/>
+                                                </constraints>
+                                            </view>
+                                            <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="QIt-ep-Hr1">
+                                                <rect key="frame" x="16" y="160" width="24" height="24"/>
+                                                <constraints>
+                                                    <constraint firstAttribute="width" constant="24" id="A84-zz-3Tn"/>
+                                                    <constraint firstAttribute="height" constant="24" id="wke-u6-2TQ"/>
+                                                </constraints>
+                                                <state key="normal" image="favorite"/>
+                                                <connections>
+                                                    <action selector="touchUpInsideFavorite:" destination="VvU-6J-pzy" eventType="touchUpInside" id="l0V-6d-c6e"/>
+                                                </connections>
+                                            </button>
+                                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="zQp-lp-N4f">
+                                                <rect key="frame" x="48" y="187" width="350" height="15.666666666666657"/>
+                                                <fontDescription key="fontDescription" type="system" pointSize="13"/>
+                                                <color key="textColor" red="0.76862745099999996" green="0.77647058820000003" blue="0.77647058820000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                                <nil key="highlightedColor"/>
+                                            </label>
+                                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Sharing" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="vkm-Pe-6qd">
+                                                <rect key="frame" x="16" y="234.66666666666666" width="382" height="20.333333333333343"/>
+                                                <fontDescription key="fontDescription" type="system" weight="semibold" pointSize="17"/>
+                                                <nil key="textColor"/>
+                                                <nil key="highlightedColor"/>
+                                            </label>
+                                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="DKa-UI-MFJ">
+                                                <rect key="frame" x="48" y="165" width="350" height="18"/>
+                                                <fontDescription key="fontDescription" type="system" weight="semibold" pointSize="15"/>
+                                                <nil key="textColor"/>
+                                                <nil key="highlightedColor"/>
+                                            </label>
+                                        </subviews>
+                                        <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                        <constraints>
+                                            <constraint firstItem="hgf-O1-P97" firstAttribute="centerX" secondItem="Sim-EE-o0o" secondAttribute="centerX" id="2qn-4i-0mr"/>
+                                            <constraint firstItem="Ice-BM-rML" firstAttribute="top" secondItem="Sim-EE-o0o" secondAttribute="top" constant="20" symbolic="YES" id="39a-aZ-VaS"/>
+                                            <constraint firstItem="QIt-ep-Hr1" firstAttribute="centerY" secondItem="DKa-UI-MFJ" secondAttribute="centerY" constant="-2" id="3SD-Uf-acD"/>
+                                            <constraint firstItem="hgf-O1-P97" firstAttribute="centerX" secondItem="3yF-lL-GwU" secondAttribute="centerX" id="4kR-Zi-RSp"/>
+                                            <constraint firstItem="DKa-UI-MFJ" firstAttribute="top" secondItem="zDS-SG-Pn2" secondAttribute="bottom" constant="15" id="8y9-c1-hvP"/>
+                                            <constraint firstItem="vkm-Pe-6qd" firstAttribute="leading" secondItem="QIt-ep-Hr1" secondAttribute="leading" id="9VZ-sX-sG0"/>
+                                            <constraint firstItem="DKa-UI-MFJ" firstAttribute="leading" secondItem="QIt-ep-Hr1" secondAttribute="trailing" constant="8" id="AfZ-aM-u7H"/>
+                                            <constraint firstAttribute="bottom" secondItem="hgf-O1-P97" secondAttribute="bottom" constant="30" id="FLo-nJ-rMa"/>
+                                            <constraint firstItem="zQp-lp-N4f" firstAttribute="trailing" secondItem="DKa-UI-MFJ" secondAttribute="trailing" id="GZO-0a-jnE"/>
+                                            <constraint firstAttribute="trailing" secondItem="DKa-UI-MFJ" secondAttribute="trailing" constant="16" id="IXP-ON-tHe"/>
+                                            <constraint firstItem="zDS-SG-Pn2" firstAttribute="top" secondItem="Sim-EE-o0o" secondAttribute="top" id="PJt-oc-cBb"/>
+                                            <constraint firstItem="3yF-lL-GwU" firstAttribute="top" secondItem="vkm-Pe-6qd" secondAttribute="bottom" constant="16" id="Pv2-r8-csn"/>
+                                            <constraint firstItem="hgf-O1-P97" firstAttribute="leading" secondItem="vkm-Pe-6qd" secondAttribute="leading" id="Vmd-Fq-gmo"/>
+                                            <constraint firstItem="3yF-lL-GwU" firstAttribute="leading" secondItem="vkm-Pe-6qd" secondAttribute="leading" id="Xcb-zy-Cst"/>
+                                            <constraint firstItem="QIt-ep-Hr1" firstAttribute="leading" secondItem="Sim-EE-o0o" secondAttribute="leading" constant="16" id="agy-KC-GI0"/>
+                                            <constraint firstItem="Ice-BM-rML" firstAttribute="leading" secondItem="Sim-EE-o0o" secondAttribute="leading" constant="10" id="cIW-13-88i"/>
+                                            <constraint firstItem="vkm-Pe-6qd" firstAttribute="top" secondItem="zQp-lp-N4f" secondAttribute="bottom" constant="32" id="dDn-fb-wjL"/>
+                                            <constraint firstItem="zQp-lp-N4f" firstAttribute="top" secondItem="DKa-UI-MFJ" secondAttribute="bottom" constant="4" id="g6a-Mc-n7g"/>
+                                            <constraint firstItem="zDS-SG-Pn2" firstAttribute="leading" secondItem="Sim-EE-o0o" secondAttribute="leading" id="kaw-ay-diA"/>
+                                            <constraint firstItem="vkm-Pe-6qd" firstAttribute="centerX" secondItem="Sim-EE-o0o" secondAttribute="centerX" id="ljA-Uj-qZe"/>
+                                            <constraint firstItem="zQp-lp-N4f" firstAttribute="leading" secondItem="DKa-UI-MFJ" secondAttribute="leading" id="odn-aq-ZUU"/>
+                                            <constraint firstAttribute="trailing" secondItem="zDS-SG-Pn2" secondAttribute="trailing" id="wGW-eK-z82"/>
+                                            <constraint firstItem="hgf-O1-P97" firstAttribute="top" secondItem="3yF-lL-GwU" secondAttribute="bottom" constant="4" id="wue-1p-jtc"/>
+                                        </constraints>
+                                    </view>
+                                </subviews>
+                                <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                <constraints>
+                                    <constraint firstItem="Sim-EE-o0o" firstAttribute="top" secondItem="YMG-hf-HEX" secondAttribute="top" id="AWv-WU-KAh"/>
+                                    <constraint firstAttribute="bottom" secondItem="Sim-EE-o0o" secondAttribute="bottom" id="hpz-dR-DMZ"/>
+                                    <constraint firstAttribute="trailing" secondItem="Sim-EE-o0o" secondAttribute="trailing" id="sOj-kO-pw4"/>
+                                    <constraint firstItem="Sim-EE-o0o" firstAttribute="leading" secondItem="YMG-hf-HEX" secondAttribute="leading" id="wYK-bi-7MR"/>
+                                </constraints>
+                            </view>
+                            <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="6Uf-aG-JJh">
+                                <rect key="frame" x="0.0" y="666" width="414" height="70"/>
+                                <subviews>
+                                    <stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" spacing="16" translatesAutoresizingMaskIntoConstraints="NO" id="unm-n9-sCs">
+                                        <rect key="frame" x="16" y="15" width="382" height="40"/>
+                                        <subviews>
+                                            <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="PXq-ga-Rsb">
+                                                <rect key="frame" x="0.0" y="0.0" width="183" height="40"/>
+                                                <color key="backgroundColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                                <constraints>
+                                                    <constraint firstAttribute="height" constant="40" id="iuh-tS-bO0"/>
+                                                </constraints>
+                                                <fontDescription key="fontDescription" type="system" pointSize="16"/>
+                                                <color key="tintColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+                                                <state key="normal" title="Cancel"/>
+                                                <connections>
+                                                    <action selector="cancelClicked:" destination="VvU-6J-pzy" eventType="touchUpInside" id="5cY-VF-9Ms"/>
+                                                </connections>
+                                            </button>
+                                            <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="QBf-Zt-liI">
+                                                <rect key="frame" x="199" y="0.0" width="183" height="40"/>
+                                                <color key="backgroundColor" red="0.8862745098" green="0.0" blue="0.4549019608" alpha="1" colorSpace="calibratedRGB"/>
+                                                <constraints>
+                                                    <constraint firstAttribute="height" constant="40" id="kTz-NL-9BC"/>
+                                                </constraints>
+                                                <state key="normal" title="Send email"/>
+                                                <state key="highlighted">
+                                                    <color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                                </state>
+                                                <connections>
+                                                    <action selector="sendShareClicked:" destination="VvU-6J-pzy" eventType="touchUpInside" id="Zcf-rt-feO"/>
+                                                </connections>
+                                            </button>
+                                        </subviews>
+                                    </stackView>
+                                </subviews>
+                                <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                <constraints>
+                                    <constraint firstAttribute="centerY" secondItem="unm-n9-sCs" secondAttribute="centerY" id="CTN-XT-DKn"/>
+                                    <constraint firstAttribute="centerX" secondItem="unm-n9-sCs" secondAttribute="centerX" id="F3W-VE-Ith"/>
+                                    <constraint firstAttribute="height" constant="70" id="qwj-Ql-vHn"/>
+                                    <constraint firstItem="unm-n9-sCs" firstAttribute="leading" secondItem="6Uf-aG-JJh" secondAttribute="leading" constant="16" id="rJx-nj-7or"/>
+                                </constraints>
+                            </view>
+                        </subviews>
+                        <viewLayoutGuide key="safeArea" id="8hH-o3-iQD"/>
+                        <color key="backgroundColor" systemColor="systemBackgroundColor"/>
+                        <constraints>
+                            <constraint firstItem="YMG-hf-HEX" firstAttribute="top" secondItem="8hH-o3-iQD" secondAttribute="top" id="30k-7u-X9U"/>
+                            <constraint firstItem="6Uf-aG-JJh" firstAttribute="trailing" secondItem="8hH-o3-iQD" secondAttribute="trailing" id="DuI-e6-F8D"/>
+                            <constraint firstItem="6Uf-aG-JJh" firstAttribute="top" secondItem="YMG-hf-HEX" secondAttribute="bottom" id="OD3-KQ-rDq"/>
+                            <constraint firstItem="6Uf-aG-JJh" firstAttribute="leading" secondItem="8hH-o3-iQD" secondAttribute="leading" id="SQ3-PT-s37"/>
+                            <constraint firstItem="YMG-hf-HEX" firstAttribute="leading" secondItem="8hH-o3-iQD" secondAttribute="leading" id="Xvq-Q6-fuk"/>
+                            <constraint firstItem="8hH-o3-iQD" firstAttribute="bottom" secondItem="6Uf-aG-JJh" secondAttribute="bottom" id="p2w-ht-7E0"/>
+                            <constraint firstItem="8hH-o3-iQD" firstAttribute="trailing" secondItem="YMG-hf-HEX" secondAttribute="trailing" id="rvY-v1-7Gj"/>
+                        </constraints>
+                    </view>
+                    <navigationItem key="navigationItem" id="uC3-gg-Wos"/>
+                    <connections>
+                        <outlet property="btnCancel" destination="PXq-ga-Rsb" id="AZ7-aY-ZF9"/>
+                        <outlet property="btnSendShare" destination="QBf-Zt-liI" id="6Wc-a2-0bl"/>
+                        <outlet property="buttonContainerView" destination="6Uf-aG-JJh" id="S6r-di-gKR"/>
+                        <outlet property="commentContainerView" destination="hgf-O1-P97" id="Gqp-JI-zxF"/>
+                        <outlet property="commentTextView" destination="VT0-1l-5HI" id="abA-51-Zgg"/>
+                        <outlet property="favorite" destination="QIt-ep-Hr1" id="feC-Os-QP9"/>
+                        <outlet property="folderImageView" destination="Ice-BM-rML" id="0ER-dy-s0s"/>
+                        <outlet property="imageView" destination="zDS-SG-Pn2" id="DyE-BG-z4e"/>
+                        <outlet property="labelDescription" destination="zQp-lp-N4f" id="uBe-g7-6aG"/>
+                        <outlet property="labelFileName" destination="DKa-UI-MFJ" id="k9b-uk-zfd"/>
+                        <outlet property="labelNote" destination="3yF-lL-GwU" id="uTU-0d-kfS"/>
+                        <outlet property="labelSharing" destination="vkm-Pe-6qd" id="hmo-0H-Tzb"/>
+                    </connections>
+                </viewController>
+                <placeholder placeholderIdentifier="IBFirstResponder" id="LJ3-hs-98b" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
+            </objects>
+            <point key="canvasLocation" x="4262" y="-168"/>
+        </scene>
+        <!--Share Advance Permission-->
+        <scene sceneID="59b-BB-FLA">
+            <objects>
+                <tableViewController storyboardIdentifier="NCShareAdvancePermission" id="r5U-VP-Qhs" customClass="NCShareAdvancePermission" customModule="Nextcloud" customModuleProvider="target" sceneMemberID="viewController">
+                    <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="-1" estimatedSectionHeaderHeight="-1" sectionFooterHeight="-1" estimatedSectionFooterHeight="-1" id="lDu-k5-2hT">
+                        <rect key="frame" x="0.0" y="0.0" width="414" height="736"/>
+                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                        <color key="backgroundColor" systemColor="systemBackgroundColor"/>
+                        <prototypes>
+                            <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" id="0qP-1F-pHW">
+                                <rect key="frame" x="0.0" y="44.666666030883789" width="414" height="43.666667938232422"/>
+                                <autoresizingMask key="autoresizingMask"/>
+                                <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="0qP-1F-pHW" id="z1u-eI-gTZ">
+                                    <rect key="frame" x="0.0" y="0.0" width="414" height="43.666667938232422"/>
+                                    <autoresizingMask key="autoresizingMask"/>
+                                </tableViewCellContentView>
+                            </tableViewCell>
+                        </prototypes>
+                        <connections>
+                            <outlet property="dataSource" destination="r5U-VP-Qhs" id="OET-a5-qea"/>
+                            <outlet property="delegate" destination="r5U-VP-Qhs" id="cDp-4z-0Xt"/>
+                        </connections>
+                    </tableView>
+                </tableViewController>
+                <placeholder placeholderIdentifier="IBFirstResponder" id="ITy-jR-JVD" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
+            </objects>
+            <point key="canvasLocation" x="3510" y="-169"/>
+        </scene>
     </scenes>
     <designables>
         <designable name="KHG-xj-wfG">
@@ -162,6 +392,14 @@
         </designable>
     </designables>
     <resources>
+        <image name="favorite" width="315" height="315"/>
+        <image name="folder" width="300" height="300"/>
         <image name="note.text" width="24" height="24"/>
+        <systemColor name="labelColor">
+            <color white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+        </systemColor>
+        <systemColor name="systemBackgroundColor">
+            <color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+        </systemColor>
     </resources>
 </document>

+ 4 - 4
iOSClient/Share/NCShareHeaderView.xib

@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="19455" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="19529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
     <device id="retina4_0" orientation="landscape" appearance="light"/>
     <dependencies>
         <deployment identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19454"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19519"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
@@ -34,7 +34,7 @@
                         <constraint firstAttribute="width" constant="15" id="GQs-ak-G4R"/>
                         <constraint firstAttribute="height" constant="15" id="gFH-uD-FZ0"/>
                     </constraints>
-                    <state key="normal" image="favorite"/>
+                    <state key="normal" image="star.fill"/>
                     <connections>
                         <action selector="touchUpInsideFavorite:" destination="iN0-l3-epB" eventType="touchUpInside" id="r4F-nS-R08"/>
                     </connections>
@@ -74,6 +74,6 @@
         </designable>
     </designables>
     <resources>
-        <image name="favorite" width="300" height="300"/>
+        <image name="star.fill" width="512" height="512"/>
     </resources>
 </document>

+ 76 - 0
iOSClient/Utility/NCUtility+Image.swift

@@ -0,0 +1,76 @@
+//
+//  NCUtility+Image.swift
+//  Nextcloud
+//
+//  Created by Henrik Storch on 17.03.22.
+//  Copyright © 2022 Marino Faggiana. All rights reserved.
+//
+
+import UIKit
+import SVGKit
+import NCCommunication
+
+extension NCUtility {
+    func getImageMetadata(_ metadata: tableMetadata, for size: CGFloat) -> UIImage? {
+
+        if let image = getImage(metadata: metadata) {
+            return image
+        }
+
+        if metadata.classFile == NCCommunicationCommon.typeClassFile.video.rawValue && !metadata.hasPreview {
+            NCUtility.shared.createImageFrom(fileName: metadata.fileNameView, ocId: metadata.ocId, etag: metadata.etag, classFile: metadata.classFile)
+        }
+
+        if CCUtility.fileProviderStoragePreviewIconExists(metadata.ocId, etag: metadata.etag) {
+            if let imagePreviewPath = CCUtility.getDirectoryProviderStoragePreviewOcId(metadata.ocId, etag: metadata.etag) {
+                return UIImage(contentsOfFile: imagePreviewPath)
+            }
+        }
+
+        if metadata.classFile == NCCommunicationCommon.typeClassFile.video.rawValue {
+            return UIImage(named: "noPreviewVideo")?.image(color: .gray, size: size)
+        } else if metadata.classFile == NCCommunicationCommon.typeClassFile.audio.rawValue {
+            return UIImage(named: "noPreviewAudio")?.image(color: .gray, size: size)
+        } else {
+            return UIImage(named: "noPreview")?.image(color: .gray, size: size)
+        }
+    }
+
+    func getImage(metadata: tableMetadata) -> UIImage? {
+        let ext = CCUtility.getExtension(metadata.fileNameView)
+        var image: UIImage?
+
+        if CCUtility.fileProviderStorageExists(metadata) && metadata.classFile == NCCommunicationCommon.typeClassFile.image.rawValue {
+
+            let previewPath = CCUtility.getDirectoryProviderStoragePreviewOcId(metadata.ocId, etag: metadata.etag)!
+            let imagePath = CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView)!
+
+            if ext == "GIF" {
+                if !FileManager().fileExists(atPath: previewPath) {
+                    NCUtility.shared.createImageFrom(fileName: metadata.fileNameView, ocId: metadata.ocId, etag: metadata.etag, classFile: metadata.classFile)
+                }
+                image = UIImage.animatedImage(withAnimatedGIFURL: URL(fileURLWithPath: imagePath))
+            } else if ext == "SVG" {
+                if let svgImage = SVGKImage(contentsOfFile: imagePath) {
+                    svgImage.size = CGSize(width: NCGlobal.shared.sizePreview, height: NCGlobal.shared.sizePreview)
+                    if let image = svgImage.uiImage {
+                        if !FileManager().fileExists(atPath: previewPath) {
+                            do {
+                                try image.pngData()?.write(to: URL(fileURLWithPath: previewPath), options: .atomic)
+                            } catch { }
+                        }
+                        return image
+                    } else {
+                        return nil
+                    }
+                } else {
+                    return nil
+                }
+            } else {
+                NCUtility.shared.createImageFrom(fileName: metadata.fileNameView, ocId: metadata.ocId, etag: metadata.etag, classFile: metadata.classFile)
+                image = UIImage(contentsOfFile: imagePath)
+            }
+        }
+        return image
+    }
+}