Browse Source

Rename share permission types + fix file headers

- also remove addShaddow of `NCShareAdvancePermissionFooter`, doesn't seem to work in tablefooterview anyway
- linting: reduce warning range. Functions with 60 lines are still readable and ok, it's just important that functions don't grow enormously (100+)

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

+ 5 - 5
.swiftlint.yml

@@ -10,10 +10,14 @@ empty_count:
   severity: warning
 
 line_length:
-  # warning: 120
+  # warning: 120, error: 200
   warning: 250
   error: 250
 
+function_body_length:
+  # warning: 40
+  warning: 60
+
 type_body_length:
   # error: 350
   error: 500
@@ -106,12 +110,8 @@ excluded:
   - iOSClient/Select/NCSelect.swift
   - iOSClient/Settings/NCEndToEndInitialize.swift
   - iOSClient/Settings/NCManageAutoUploadFileName.swift
-  - iOSClient/Share/NCShareCommentsCell.swift
   - iOSClient/Share/NCShareCommon.swift
-  - iOSClient/Share/NCShareLinkMenuView.swift
   - iOSClient/Share/NCShareNetworking.swift
-  - iOSClient/Share/NCShareQuickStatusMenu.swift
-  - iOSClient/Share/NCShareUserMenuView.swift
   - iOSClient/Shares/NCShares.swift
   - iOSClient/Transfers/NCTransferCell.swift
   - iOSClient/Transfers/NCTransfers.swift

+ 4 - 4
Nextcloud.xcodeproj/project.pbxproj

@@ -69,7 +69,7 @@
 		AFA2AC8527849604008E1EA7 /* NCActivityCommentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFA2AC8427849604008E1EA7 /* NCActivityCommentView.swift */; };
 		AFCE353327E4ED1900FEA6C2 /* UIToolbar+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFCE353227E4ED1900FEA6C2 /* UIToolbar+Extension.swift */; };
 		AFCE353527E4ED5900FEA6C2 /* DateFormatter+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFCE353427E4ED5900FEA6C2 /* DateFormatter+Extension.swift */; };
-		AFCE353727E4ED7B00FEA6C2 /* ShareCells.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFCE353627E4ED7B00FEA6C2 /* ShareCells.swift */; };
+		AFCE353727E4ED7B00FEA6C2 /* NCShareCells.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFCE353627E4ED7B00FEA6C2 /* NCShareCells.swift */; };
 		AFCE353927E5DE0500FEA6C2 /* NCShare+Helper.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFCE353827E5DE0400FEA6C2 /* NCShare+Helper.swift */; };
 		AFD33240276A02C100F5AE02 /* UIApplication+Orientation.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFD3323F276A02C000F5AE02 /* UIApplication+Orientation.swift */; };
 		D575039F27146F93008DC9DC /* String+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7A0D1342591FBC5008F8A13 /* String+Extensions.swift */; };
@@ -527,7 +527,7 @@
 		AFA2AC8427849604008E1EA7 /* NCActivityCommentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCActivityCommentView.swift; sourceTree = "<group>"; };
 		AFCE353227E4ED1900FEA6C2 /* UIToolbar+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIToolbar+Extension.swift"; sourceTree = "<group>"; };
 		AFCE353427E4ED5900FEA6C2 /* DateFormatter+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "DateFormatter+Extension.swift"; sourceTree = "<group>"; };
-		AFCE353627E4ED7B00FEA6C2 /* ShareCells.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareCells.swift; sourceTree = "<group>"; };
+		AFCE353627E4ED7B00FEA6C2 /* NCShareCells.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCShareCells.swift; sourceTree = "<group>"; };
 		AFCE353827E5DE0400FEA6C2 /* NCShare+Helper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NCShare+Helper.swift"; sourceTree = "<group>"; };
 		AFD3323F276A02C000F5AE02 /* UIApplication+Orientation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIApplication+Orientation.swift"; sourceTree = "<group>"; };
 		D5B6AA7727200C7200D49C24 /* NCActivityTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCActivityTableViewCell.swift; sourceTree = "<group>"; };
@@ -1077,7 +1077,7 @@
 			isa = PBXGroup;
 			children = (
 				AF93471627E2361E002537EE /* NCShareAdvancePermission.swift */,
-				AFCE353627E4ED7B00FEA6C2 /* ShareCells.swift */,
+				AFCE353627E4ED7B00FEA6C2 /* NCShareCells.swift */,
 				AF93471827E2361E002537EE /* NCShareAdvancePermissionFooter.swift */,
 				AF93471427E2361E002537EE /* NCShareAdvancePermissionFooter.xib */,
 				AF93474D27E3F211002537EE /* NCShareNewUserAddComment.swift */,
@@ -2571,7 +2571,7 @@
 				F78A18B623CDD07D00F681F3 /* NCViewerRichWorkspaceWebView.swift in Sources */,
 				AFA2AC8527849604008E1EA7 /* NCActivityCommentView.swift in Sources */,
 				F716B75F26F09DF600D37EFC /* NCKTVHTTPCache.swift in Sources */,
-				AFCE353727E4ED7B00FEA6C2 /* ShareCells.swift in Sources */,
+				AFCE353727E4ED7B00FEA6C2 /* NCShareCells.swift in Sources */,
 				AF36077127BFA4E8001A243D /* ParallelWorker.swift in Sources */,
 				F75A9EE623796C6F0044CFCE /* NCNetworking.swift in Sources */,
 				F758B460212C56A400515F55 /* NCScan.swift in Sources */,

+ 16 - 1
iOSClient/Extensions/DateFormatter+Extension.swift

@@ -3,7 +3,22 @@
 //  Nextcloud
 //
 //  Created by Henrik Storch on 18.03.22.
-//  Copyright © 2022 Marino Faggiana. All rights reserved.
+//  Copyright © 2022 Henrik Storch. All rights reserved.
+//
+//  Author Henrik Storch <henrik.storch@nextcloud.com>
+//
+//  This program is free software: you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation, either version 3 of the License, or
+//  (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 //
 
 import Foundation

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

@@ -53,27 +53,3 @@ 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
-    }
-}

+ 16 - 1
iOSClient/Extensions/UIToolbar+Extension.swift

@@ -3,7 +3,22 @@
 //  Nextcloud
 //
 //  Created by Henrik Storch on 18.03.22.
-//  Copyright © 2022 Marino Faggiana. All rights reserved.
+//  Copyright © 2022 Henrik Storch. All rights reserved.
+//
+//  Author Henrik Storch <henrik.storch@nextcloud.com>
+//
+//  This program is free software: you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation, either version 3 of the License, or
+//  (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 //
 
 import Foundation

+ 1 - 1
iOSClient/Menu/NCShare+Menu.swift

@@ -38,7 +38,7 @@ extension NCShare {
 
         actions.append(
             NCMenuAction(
-                title: NSLocalizedString("_share_advanced_permissions_", comment: ""),
+                title: NSLocalizedString("_details_", comment: ""),
                 icon: NCUtility.shared.loadImage(named: "edit"),
                 action: { _ in
                     guard

+ 72 - 48
iOSClient/Share/Advanced/NCShareAdvancePermission.swift

@@ -3,7 +3,22 @@
 //  Nextcloud
 //
 //  Created by T-systems on 09/08/21.
-//  Copyright © 2021 Marino Faggiana. All rights reserved.
+//  Copyright © 2022 Henrik Storch. All rights reserved.
+//
+//  Author Henrik Storch <henrik.storch@nextcloud.com>
+//
+//  This program is free software: you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation, either version 3 of the License, or
+//  (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 //
 
 import UIKit
@@ -22,15 +37,15 @@ class NCShareAdvancePermission: UITableViewController, NCShareAdvanceFotterDeleg
         }
     }
 
-    var share: TableShareable!
+    var share: NCTableShareable!
     var isNewShare: Bool { NCManageDatabase.shared.getTableShare(account: share.account, idShare: share.idShare) == nil }
     var metadata: tableMetadata!
-    var shareConfig: ShareConfig!
+    var shareConfig: NCShareConfig!
     var networking: NCShareNetworking?
 
     override func viewDidLoad() {
         super.viewDidLoad()
-        self.shareConfig = ShareConfig(isDirectory: metadata.directory, share: share)
+        self.shareConfig = NCShareConfig(isDirectory: metadata.directory, share: share)
         self.setNavigationTitle()
         if #available(iOS 13.0, *) {
             // disbale pull to dimiss
@@ -69,7 +84,11 @@ class NCShareAdvancePermission: UITableViewController, NCShareAdvanceFotterDeleg
     }
 
     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 }
+        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 {
@@ -77,12 +96,16 @@ class NCShareAdvancePermission: UITableViewController, NCShareAdvanceFotterDeleg
     }
 
     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 }
+        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() }
-        if let cell = cell as? DatePickerTableViewCell {
+        if let cell = cell as? NCShareDateCell {
             cell.onReload = tableView.reloadData
         }
         return cell
@@ -91,49 +114,50 @@ class NCShareAdvancePermission: UITableViewController, NCShareAdvanceFotterDeleg
     override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
         tableView.deselectRow(at: indexPath, animated: true)
         guard let cellConfig = shareConfig.config(for: indexPath) else { return }
-        if let cellConfig = cellConfig as? Advanced {
-            switch cellConfig {
-            case .hideDownload:
-                share.hideDownload.toggle()
-                tableView.reloadData()
-            case .expirationDate:
-                let cell = tableView.cellForRow(at: indexPath) as? DatePickerTableViewCell
-                cell?.textField.becomeFirstResponder()
-            case .password:
-                guard share.password.isEmpty else {
-                    share.password = ""
-                    tableView.reloadData()
-                    return
-                }
-                let alertController = UIAlertController.withTextField(titleKey: "_enforce_password_protection_") { textField in
-                    textField.placeholder = NSLocalizedString("_password_", comment: "")
-                    textField.isSecureTextEntry = true
-                } completion: { password in
-                    self.share.password = password ?? ""
-                    tableView.reloadData()
-                }
-                self.present(alertController, animated: true)
-            case .note:
-                let storyboard = UIStoryboard(name: "NCShare", bundle: nil)
-                guard let viewNewUserComment = storyboard.instantiateViewController(withIdentifier: "NCShareNewUserAddComment") as? NCShareNewUserAddComment else { return }
-                viewNewUserComment.metadata = self.metadata
-                viewNewUserComment.share = self.share
-                viewNewUserComment.onDismiss = tableView.reloadData
-                self.navigationController?.pushViewController(viewNewUserComment, animated: true)
-            case .label:
-                let alertController = UIAlertController.withTextField(titleKey: "_share_link_name_") { textField in
-                    textField.placeholder = cellConfig.title
-                    textField.text = self.share.label
-                } completion: { newValue in
-                    self.share.label = newValue ?? ""
-                    self.setNavigationTitle()
-                    tableView.reloadData()
-                }
-                self.present(alertController, animated: true)
-            }
-        } else {
+        guard let cellConfig = cellConfig as? NCShareDetails else {
             cellConfig.didSelect(for: share)
             tableView.reloadData()
+            return
+        }
+
+        switch cellConfig {
+        case .hideDownload:
+            share.hideDownload.toggle()
+            tableView.reloadData()
+        case .expirationDate:
+            let cell = tableView.cellForRow(at: indexPath) as? NCShareDateCell
+            cell?.textField.becomeFirstResponder()
+        case .password:
+            guard share.password.isEmpty else {
+                share.password = ""
+                tableView.reloadData()
+                return
+            }
+            let alertController = UIAlertController.withTextField(titleKey: "_enforce_password_protection_") { textField in
+                textField.placeholder = NSLocalizedString("_password_", comment: "")
+                textField.isSecureTextEntry = true
+            } completion: { password in
+                self.share.password = password ?? ""
+                tableView.reloadData()
+            }
+            self.present(alertController, animated: true)
+        case .note:
+            let storyboard = UIStoryboard(name: "NCShare", bundle: nil)
+            guard let viewNewUserComment = storyboard.instantiateViewController(withIdentifier: "NCShareNewUserAddComment") as? NCShareNewUserAddComment else { return }
+            viewNewUserComment.metadata = self.metadata
+            viewNewUserComment.share = self.share
+            viewNewUserComment.onDismiss = tableView.reloadData
+            self.navigationController?.pushViewController(viewNewUserComment, animated: true)
+        case .label:
+            let alertController = UIAlertController.withTextField(titleKey: "_share_link_name_") { textField in
+                textField.placeholder = cellConfig.title
+                textField.text = self.share.label
+            } completion: { newValue in
+                self.share.label = newValue ?? ""
+                self.setNavigationTitle()
+                tableView.reloadData()
+            }
+            self.present(alertController, animated: true)
         }
     }
 }

+ 17 - 3
iOSClient/Share/Advanced/NCShareAdvancePermissionFooter.swift

@@ -2,8 +2,23 @@
 //  NCShareAdvancePermissionFooter.swift
 //  Nextcloud
 //
-//  Created by T-systems on 10/08/21.
-//  Copyright © 2021 Marino Faggiana. All rights reserved.
+//  Created by T-systems on 09/08/21.
+//  Copyright © 2022 Henrik Storch. All rights reserved.
+//
+//  Author Henrik Storch <henrik.storch@nextcloud.com>
+//
+//  This program is free software: you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation, either version 3 of the License, or
+//  (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 //
 
 import UIKit
@@ -22,7 +37,6 @@ class NCShareAdvancePermissionFooter: UIView {
         self.delegate = delegate
 
         backgroundColor = .clear
-        addShadow(location: .top)
 
         buttonCancel.addTarget(self, action: #selector(cancelClicked), for: .touchUpInside)
         buttonCancel.setTitle(NSLocalizedString("_cancel_", comment: ""), for: .normal)

+ 16 - 1
iOSClient/Share/Advanced/NCShareAdvancePermissionHeader.swift

@@ -3,7 +3,22 @@
 //  Nextcloud
 //
 //  Created by T-systems on 10/08/21.
-//  Copyright © 2021 Marino Faggiana. All rights reserved.
+//  Copyright © 2022 Henrik Storch. All rights reserved.
+//
+//  Author Henrik Storch <henrik.storch@nextcloud.com>
+//
+//  This program is free software: you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation, either version 3 of the License, or
+//  (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 //
 
 import UIKit

+ 56 - 41
iOSClient/Share/Advanced/ShareCells.swift → iOSClient/Share/Advanced/NCShareCells.swift

@@ -3,38 +3,53 @@
 //  Nextcloud
 //
 //  Created by Henrik Storch on 18.03.22.
-//  Copyright © 2022 Marino Faggiana. All rights reserved.
+//  Copyright © 2022 Henrik Storch. All rights reserved.
+//
+//  Author Henrik Storch <henrik.storch@nextcloud.com>
+//
+//  This program is free software: you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation, either version 3 of the License, or
+//  (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 //
 
 import UIKit
 
-protocol ShareCellConfig {
+protocol NCShareCellConfig {
     var title: String { get }
-    func getCell(for share: TableShareable) -> UITableViewCell
-    func didSelect(for share: TableShareable)
+    func getCell(for share: NCTableShareable) -> UITableViewCell
+    func didSelect(for share: NCTableShareable)
 }
 
-protocol ToggleCellConfig: ShareCellConfig {
-    func isOn(for share: TableShareable) -> Bool
-    func didChange(_ share: TableShareable, to newValue: Bool)
+protocol NCToggleCellConfig: NCShareCellConfig {
+    func isOn(for share: NCTableShareable) -> Bool
+    func didChange(_ share: NCTableShareable, to newValue: Bool)
 }
 
-extension ToggleCellConfig {
-    func getCell(for share: TableShareable) -> UITableViewCell {
-        return ToggleCell(isOn: isOn(for: share))
+extension NCToggleCellConfig {
+    func getCell(for share: NCTableShareable) -> UITableViewCell {
+        return NCShareToggleCell(isOn: isOn(for: share))
     }
 
-    func didSelect(for share: TableShareable) {
+    func didSelect(for share: NCTableShareable) {
         didChange(share, to: !isOn(for: share))
     }
 }
 
-protocol Permission: ToggleCellConfig {
+protocol NCPermission: NCToggleCellConfig {
     static var forDirectory: [Self] { get }
     static var forFile: [Self] { get }
 }
 
-enum UserPermission: CaseIterable, Permission {
+enum NCUserPermission: CaseIterable, NCPermission {
     var permissionBitFlag: Int {
         switch self {
         case .reshare: return NCGlobal.shared.permissionShareShare
@@ -44,17 +59,17 @@ enum UserPermission: CaseIterable, Permission {
         }
     }
 
-    func didChange(_ share: TableShareable, to newValue: Bool) {
+    func didChange(_ share: NCTableShareable, to newValue: Bool) {
         share.permissions ^= permissionBitFlag
     }
 
-    func isOn(for share: TableShareable) -> Bool {
+    func isOn(for share: NCTableShareable) -> Bool {
         return (share.permissions & permissionBitFlag) != 0
     }
 
     case reshare, edit, create, delete
-    static let forDirectory: [UserPermission] = UserPermission.allCases
-    static let forFile: [UserPermission] = [.reshare, .edit]
+    static let forDirectory: [NCUserPermission] = NCUserPermission.allCases
+    static let forFile: [NCUserPermission] = [.reshare, .edit]
 
     var title: String {
         switch self {
@@ -66,8 +81,8 @@ enum UserPermission: CaseIterable, Permission {
     }
 }
 
-enum LinkPermission: Permission {
-    func didChange(_ share: TableShareable, to newValue: Bool) {
+enum NCLinkPermission: NCPermission {
+    func didChange(_ share: NCTableShareable, to newValue: Bool) {
         guard self != .allowEdit else {
             // file
             share.permissions = CCUtility.getPermissionsValue(
@@ -104,7 +119,7 @@ enum LinkPermission: Permission {
         }
     }
 
-    func isOn(for share: TableShareable) -> Bool {
+    func isOn(for share: NCTableShareable) -> Bool {
         switch self {
         case .allowEdit: return CCUtility.isAnyPermission(toEdit: share.permissions)
         case .viewOnly: return !CCUtility.isAnyPermission(toEdit: share.permissions) && share.permissions != NCGlobal.shared.permissionCreateShare
@@ -123,12 +138,12 @@ enum LinkPermission: Permission {
     }
 
     case allowEdit, viewOnly, uploadEdit, fileDrop
-    static let forDirectory: [LinkPermission] = [.viewOnly, .uploadEdit, .fileDrop]
-    static let forFile: [LinkPermission] = [.allowEdit]
+    static let forDirectory: [NCLinkPermission] = [.viewOnly, .uploadEdit, .fileDrop]
+    static let forFile: [NCLinkPermission] = [.allowEdit]
 }
 
-enum Advanced: CaseIterable, ShareCellConfig {
-    func didSelect(for share: TableShareable) {
+enum NCShareDetails: CaseIterable, NCShareCellConfig {
+    func didSelect(for share: NCTableShareable) {
         switch self {
         case .hideDownload: share.hideDownload.toggle()
         case .expirationDate: return
@@ -138,13 +153,13 @@ enum Advanced: CaseIterable, ShareCellConfig {
         }
     }
 
-    func getCell(for share: TableShareable) -> UITableViewCell {
+    func getCell(for share: NCTableShareable) -> UITableViewCell {
         switch self {
         case .hideDownload:
-            return ToggleCell(isOn: share.hideDownload)
+            return NCShareToggleCell(isOn: share.hideDownload)
         case .expirationDate:
-            return DatePickerTableViewCell(share: share)
-        case .password: return ToggleCell(isOn: !share.password.isEmpty, customIcons: ("lock", "lock.open"))
+            return NCShareDateCell(share: share)
+        case .password: return NCShareToggleCell(isOn: !share.password.isEmpty, customIcons: ("lock", "lock.open"))
         case .note:
             let cell = UITableViewCell(style: .value1, reuseIdentifier: "shareNote")
             cell.detailTextLabel?.text = share.note
@@ -168,20 +183,20 @@ enum Advanced: CaseIterable, ShareCellConfig {
     }
 
     case label, hideDownload, expirationDate, password, note
-    static let forLink: [Advanced] = Advanced.allCases
-    static let forUser: [Advanced] = [.expirationDate, .note]
+    static let forLink: [NCShareDetails] = NCShareDetails.allCases
+    static let forUser: [NCShareDetails] = [.expirationDate, .note]
 }
 
-struct ShareConfig {
-    let permissions: [Permission]
-    let advanced: [Advanced]
-    let share: TableShareable
+struct NCShareConfig {
+    let permissions: [NCPermission]
+    let advanced: [NCShareDetails]
+    let share: NCTableShareable
 
-    init(isDirectory: Bool, share: TableShareable) {
+    init(isDirectory: Bool, share: NCTableShareable) {
         self.share = share
-        let type: Permission.Type = share.shareType == NCShareCommon.shared.SHARE_TYPE_LINK ? LinkPermission.self : UserPermission.self
+        let type: NCPermission.Type = share.shareType == NCShareCommon.shared.SHARE_TYPE_LINK ? NCLinkPermission.self : NCUserPermission.self
         self.permissions = isDirectory ? type.forDirectory : type.forFile
-        self.advanced = share.shareType == NCShareCommon.shared.SHARE_TYPE_LINK ? Advanced.forLink : Advanced.forUser
+        self.advanced = share.shareType == NCShareCommon.shared.SHARE_TYPE_LINK ? NCShareDetails.forLink : NCShareDetails.forUser
     }
 
     func cellFor(indexPath: IndexPath) -> UITableViewCell? {
@@ -196,7 +211,7 @@ struct ShareConfig {
         cellConfig?.didSelect(for: share)
     }
 
-    func config(for indexPath: IndexPath) -> ShareCellConfig? {
+    func config(for indexPath: IndexPath) -> NCShareCellConfig? {
         if indexPath.section == 0, indexPath.row < permissions.count {
             return  permissions[indexPath.row]
         } else if indexPath.section == 1, indexPath.row < advanced.count {
@@ -205,7 +220,7 @@ struct ShareConfig {
     }
 }
 
-class ToggleCell: UITableViewCell {
+class NCShareToggleCell: UITableViewCell {
     typealias CustomToggleIcon = (onIconName: String?, offIconName: String?)
     init(isOn: Bool, customIcons: CustomToggleIcon? = nil) {
         super.init(style: .default, reuseIdentifier: "toggleCell")
@@ -223,13 +238,13 @@ class ToggleCell: UITableViewCell {
     }
 }
 
-open class DatePickerTableViewCell: UITableViewCell {
+open class NCShareDateCell: UITableViewCell {
     let picker = UIDatePicker()
     let textField = UITextField()
 
     var onReload: (() -> Void)?
 
-    init(share: TableShareable) {
+    init(share: NCTableShareable) {
         super.init(style: .value1, reuseIdentifier: "shareExpDate")
         picker.datePickerMode = .date
         picker.minimumDate = Date()

+ 17 - 3
iOSClient/Share/Advanced/NCShareNewUserAddComment.swift

@@ -3,8 +3,22 @@
 //  Nextcloud
 //
 //  Created by TSI-mc on 21/06/21.
-//  Copyright © 2021 Marino Faggiana. All rights reserved.
-//  Copyright © 2021 TSI-mc. All rights reserved.
+//  Copyright © 2022 Henrik Storch. All rights reserved.
+//
+//  Author Henrik Storch <henrik.storch@nextcloud.com>
+//
+//  This program is free software: you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation, either version 3 of the License, or
+//  (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 //
 
 import UIKit
@@ -21,7 +35,7 @@ class NCShareNewUserAddComment: UIViewController, NCShareDetail {
     let contentInsets: CGFloat = 16
     var onDismiss: (() -> Void)?
 
-    public var share: TableShareable!
+    public var share: NCTableShareable!
     public var metadata: tableMetadata!
 
     override func viewDidLoad() {

+ 23 - 8
iOSClient/Share/NCShare+Helper.swift

@@ -3,14 +3,29 @@
 //  Nextcloud
 //
 //  Created by Henrik Storch on 19.03.22.
-//  Copyright © 2022 Marino Faggiana. All rights reserved.
+//  Copyright © 2022 Henrik Storch. All rights reserved.
+//
+//  Author Henrik Storch <henrik.storch@nextcloud.com>
+//
+//  This program is free software: you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation, either version 3 of the License, or
+//  (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 //
 
 import UIKit
 import NCCommunication
 
-extension tableShare: TableShareable { }
-protocol TableShareable: AnyObject {
+extension tableShare: NCTableShareable { }
+protocol NCTableShareable: AnyObject {
     var shareType: Int { get set }
     var permissions: Int { get set }
 
@@ -27,7 +42,7 @@ protocol TableShareable: AnyObject {
     var shareWithDisplayname: String { get set }
 }
 
-extension TableShareable {
+extension NCTableShareable {
     var expDateString: String? {
         guard let date = expirationDate else { return nil }
         let dateFormatter = DateFormatter()
@@ -36,7 +51,7 @@ extension TableShareable {
     }
 }
 
-class TableShareOptions: TableShareable {
+class NCTableShareOptions: NCTableShareable {
     var shareType: Int
     var permissions: Int
 
@@ -66,13 +81,13 @@ class TableShareOptions: TableShareable {
         self.shareWith = sharee.shareWith
     }
 
-    static func shareLink(metadata: tableMetadata, password: String?) -> TableShareOptions {
-        return TableShareOptions(shareType: NCShareCommon.shared.SHARE_TYPE_LINK, metadata: metadata, password: password)
+    static func shareLink(metadata: tableMetadata, password: String?) -> NCTableShareOptions {
+        return NCTableShareOptions(shareType: NCShareCommon.shared.SHARE_TYPE_LINK, metadata: metadata, password: password)
     }
 }
 
 protocol NCShareDetail {
-    var share: TableShareable! { get }
+    var share: NCTableShareable! { get }
 }
 
 extension NCShareDetail where Self: UIViewController {

+ 16 - 1
iOSClient/Share/NCShare+NCCellDelegate.swift

@@ -3,7 +3,22 @@
 //  Nextcloud
 //
 //  Created by Henrik Storch on 03.01.22.
-//  Copyright © 2022 Marino Faggiana. All rights reserved.
+//  Copyright © 2022 Henrik Storch. All rights reserved.
+//
+//  Author Henrik Storch <henrik.storch@nextcloud.com>
+//
+//  This program is free software: you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation, either version 3 of the License, or
+//  (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 //
 
 import UIKit

+ 3 - 2
iOSClient/Share/NCShare.swift

@@ -4,6 +4,7 @@
 //
 //  Created by Marino Faggiana on 17/07/2019.
 //  Copyright © 2019 Marino Faggiana. All rights reserved.
+//  Copyright © 2022 Henrik Storch. All rights reserved.
 //
 //  Author Marino Faggiana <marino.faggiana@nextcloud.com>
 //  Author Henrik Storch <henrik.storch@nextcloud.com>
@@ -100,7 +101,7 @@ class NCShare: UIViewController, NCShareNetworkingDelegate, NCSharePagingContent
             let metadata = self.metadata else { return }
         self.checkEnforcedPassword { password in
             advancePermission.networking = self.networking
-            advancePermission.share = TableShareOptions.shareLink(metadata: metadata, password: password)
+            advancePermission.share = NCTableShareOptions.shareLink(metadata: metadata, password: password)
             advancePermission.metadata = self.metadata
             navigationController.pushViewController(advancePermission, animated: true)
         }
@@ -252,7 +253,7 @@ class NCShare: UIViewController, NCShareNetworkingDelegate, NCSharePagingContent
                 let advancePermission = UIStoryboard(name: "NCShare", bundle: nil).instantiateViewController(withIdentifier: "NCShareAdvancePermission") as? NCShareAdvancePermission,
                 let navigationController = self.navigationController,
                 let metadata = self.metadata else { return }
-            let shareOptions = TableShareOptions(sharee: sharee, metadata: metadata)
+            let shareOptions = NCTableShareOptions(sharee: sharee, metadata: metadata)
             advancePermission.share = shareOptions
             advancePermission.networking = self.networking
             advancePermission.metadata = metadata

+ 2 - 2
iOSClient/Share/NCShareNetworking.swift

@@ -63,7 +63,7 @@ class NCShareNetworking: NSObject {
         }
     }
     
-    func createShare(option: TableShareable) {
+    func createShare(option: NCTableShareable) {
         // NOTE: Permissions don't work for file drop!
         // https://github.com/nextcloud/server/issues/17504
 
@@ -96,7 +96,7 @@ class NCShareNetworking: NSObject {
         }
     }
 
-    func updateShare(option: TableShareable) {
+    func updateShare(option: NCTableShareable) {
         NCUtility.shared.startActivityIndicator(backgroundView: view, blurEffect: false)
         NCCommunication.shared.updateShare(idShare: option.idShare, password: option.password, expireDate: option.expDateString, permissions: option.permissions, note: option.note, label: option.label, hideDownload: option.hideDownload) { account, share, errorCode, errorDescription in
             NCUtility.shared.stopActivityIndicator()

+ 0 - 1
iOSClient/Supporting Files/en.lproj/Localizable.strings

@@ -593,7 +593,6 @@
 "_new_comment_"                 = "New comment …";
 "_edit_comment_"                = "Edit comment";
 "_delete_comment_"              = "Delete comment";
-"_share_advanced_permissions_"  = "Advanced permissions";
 "_share_allow_editing_"         = "Allow editing";
 "_share_read_only_"             = "View only";
 "_share_editing_"               = "Editing";