|
@@ -16,8 +16,8 @@ extension NCShare {
|
|
|
if share.shareType == 3 {
|
|
|
actions.append(
|
|
|
NCMenuAction(
|
|
|
- title: NSLocalizedString("_share_add_link_", comment: ""),
|
|
|
- icon: NCUtility.shared.loadImage(named: "rename").imageColor(NCBrandColor.shared.brandElement),
|
|
|
+ title: NSLocalizedString("_share_add_sharelink_", comment: ""),
|
|
|
+ icon: NCUtility.shared.loadImage(named: "shareAdd"),
|
|
|
action: { _ in
|
|
|
self.makeNewLinkShare()
|
|
|
}
|
|
@@ -38,8 +38,8 @@ extension NCShare {
|
|
|
|
|
|
actions.append(
|
|
|
NCMenuAction(
|
|
|
- title: NSLocalizedString("_advance_permissions_", comment: ""),
|
|
|
- icon: NCUtility.shared.loadImage(named: "rename").imageColor(NCBrandColor.shared.brandElement),
|
|
|
+ title: NSLocalizedString("_share_advanced_permissions_", comment: ""),
|
|
|
+ icon: NCUtility.shared.loadImage(named: "edit"),
|
|
|
action: { _ in
|
|
|
guard
|
|
|
let advancePermission = UIStoryboard(name: "NCShare", bundle: nil).instantiateViewController(withIdentifier: "NCShareAdvancePermission") as? NCShareAdvancePermission,
|
|
@@ -68,7 +68,7 @@ extension NCShare {
|
|
|
actions.append(
|
|
|
NCMenuAction(
|
|
|
title: NSLocalizedString("_share_unshare_", comment: ""),
|
|
|
- icon: NCUtility.shared.loadImage(named: "delete").imageColor(NCBrandColor.shared.brandElement),
|
|
|
+ icon: NCUtility.shared.loadImage(named: "trash"),
|
|
|
action: { _ in
|
|
|
self.networking?.unShare(idShare: share.idShare)
|
|
|
}
|
|
@@ -77,4 +77,53 @@ extension NCShare {
|
|
|
|
|
|
self.presentMenu(with: actions)
|
|
|
}
|
|
|
+
|
|
|
+ func toggleUserPermissionMenu(isDirectory: Bool, tableShare: tableShare) {
|
|
|
+ var actions = [NCMenuAction]()
|
|
|
+
|
|
|
+ actions.append(
|
|
|
+ NCMenuAction(
|
|
|
+ title: NSLocalizedString("_share_read_only_", comment: ""),
|
|
|
+ icon: UIImage(),
|
|
|
+ selected: tableShare.permissions == (NCGlobal.shared.permissionReadShare + NCGlobal.shared.permissionShareShare) || tableShare.permissions == NCGlobal.shared.permissionReadShare,
|
|
|
+ on: false,
|
|
|
+ action: { _ in
|
|
|
+ let canShare = CCUtility.isPermission(toCanShare: tableShare.permissions)
|
|
|
+ let permissions = CCUtility.getPermissionsValue(byCanEdit: false, andCanCreate: false, andCanChange: false, andCanDelete: false, andCanShare: canShare, andIsFolder: isDirectory)
|
|
|
+ self.updateSharePermissions(share: tableShare, permissions: permissions)
|
|
|
+ }
|
|
|
+ )
|
|
|
+ )
|
|
|
+
|
|
|
+ actions.append(
|
|
|
+ NCMenuAction(
|
|
|
+ title: isDirectory ? NSLocalizedString("_share_allow_upload_", comment: "") : NSLocalizedString("_share_editing_", comment: ""),
|
|
|
+ icon: UIImage(),
|
|
|
+ selected: hasUploadPermission(tableShare: tableShare),
|
|
|
+ on: false,
|
|
|
+ action: { _ in
|
|
|
+ let canShare = CCUtility.isPermission(toCanShare: tableShare.permissions)
|
|
|
+ let permissions = CCUtility.getPermissionsValue(byCanEdit: true, andCanCreate: true, andCanChange: true, andCanDelete: true, andCanShare: canShare, andIsFolder: isDirectory)
|
|
|
+ self.updateSharePermissions(share: tableShare, permissions: permissions)
|
|
|
+ }
|
|
|
+ )
|
|
|
+ )
|
|
|
+
|
|
|
+ self.presentMenu(with: actions)
|
|
|
+ }
|
|
|
+
|
|
|
+ fileprivate func hasUploadPermission(tableShare: tableShare) -> Bool {
|
|
|
+ let uploadPermissions = [
|
|
|
+ NCGlobal.shared.permissionMaxFileShare,
|
|
|
+ NCGlobal.shared.permissionMaxFolderShare,
|
|
|
+ NCGlobal.shared.permissionDefaultFileRemoteShareNoSupportShareOption,
|
|
|
+ NCGlobal.shared.permissionDefaultFolderRemoteShareNoSupportShareOption]
|
|
|
+ return uploadPermissions.contains(tableShare.permissions)
|
|
|
+ }
|
|
|
+
|
|
|
+ func updateSharePermissions(share: tableShare, permissions: Int) {
|
|
|
+ let updatedShare = tableShare(value: share)
|
|
|
+ updatedShare.permissions = permissions
|
|
|
+ networking?.updateShare(option: updatedShare)
|
|
|
+ }
|
|
|
}
|