@@ -34,9 +34,10 @@ extension NCShare {
3434 actions. append (
3535 NCMenuAction (
3636 title: NSLocalizedString ( " _open_in_ " , comment: " " ) ,
37- icon: utility. loadImage ( named: " viewInFolder " ) . imageColor ( NCBrandColor . shared. brandElement) ,
37+ icon: utility. loadImage ( named: " open_file " , colors: [ NCBrandColor . shared. brandElement] ) ,
38+ sender: sender,
3839 action: { _ in
39- NCShareCommon ( ) . copyLink ( link: share. url, viewController: self , sender: sender)
40+ NCShareCommon . copyLink ( link: share. url, viewController: self , sender: sender)
4041 }
4142 )
4243 )
@@ -46,15 +47,16 @@ extension NCShare {
4647 NCMenuAction (
4748// title: NSLocalizedString("_details_", comment: ""),
4849// icon: utility.loadImage(named: "pencil", colors: [NCBrandColor.shared.iconImageColor]),
49- // accessibilityIdentifier: "shareMenu/details",
5050 title: NSLocalizedString ( " _advance_permissions_ " , comment: " " ) ,
51- icon: utility. loadImage ( named: " rename " ) . imageColor ( NCBrandColor . shared. brandElement) ,
51+ icon: utility. loadImage ( named: " rename " , colors: [ NCBrandColor . shared. brandElement] ) ,
52+ accessibilityIdentifier: " shareMenu/details " ,
53+ sender: sender,
5254 action: { _ in
5355 guard
5456 let advancePermission = UIStoryboard ( name: " NCShare " , bundle: nil ) . instantiateViewController ( withIdentifier: " NCShareAdvancePermission " ) as? NCShareAdvancePermission ,
5557 let navigationController = self . navigationController, !share. isInvalidated else { return }
5658 advancePermission. networking = self . networking
57- advancePermission. share = share
59+ advancePermission. share = tableShare ( value : share)
5860 advancePermission. oldTableShare = tableShare ( value: share)
5961 advancePermission. metadata = self . metadata
6062
@@ -66,18 +68,19 @@ extension NCShare {
6668 }
6769 )
6870 )
69-
71+
7072 if sendMail {
7173 actions. append (
7274 NCMenuAction (
7375 title: NSLocalizedString ( " _send_new_email_ " , comment: " " ) ,
74- icon: NCUtility ( ) . loadImage ( named: " email " ) . imageColor ( NCBrandColor . shared. brandElement) ,
76+ icon: utility. loadImage ( named: " email " , colors: [ NCBrandColor . shared. brandElement] ) ,
77+ sender: sender,
7578 action: { menuAction in
7679 let storyboard = UIStoryboard ( name: " NCShare " , bundle: nil )
7780 guard let viewNewUserComment = storyboard. instantiateViewController ( withIdentifier: " NCShareNewUserAddComment " ) as? NCShareNewUserAddComment else { return }
7881 viewNewUserComment. metadata = self . metadata
7982 viewNewUserComment. share = tableShare ( value: share)
80- viewNewUserComment. networking = self . networking
83+ // viewNewUserComment.networking = self.networking
8184 self . navigationController? . pushViewController ( viewNewUserComment, animated: true )
8285 }
8386 )
@@ -87,15 +90,16 @@ extension NCShare {
8790 actions. append (
8891 NCMenuAction (
8992 title: NSLocalizedString ( " _share_unshare_ " , comment: " " ) ,
90- icon: utility. loadImage ( named: " trash " ) . imageColor ( NCBrandColor . shared. brandElement) ,
93+ icon: utility. loadImage ( named: " trashIcon " , colors: [ NCBrandColor . shared. brandElement] ) ,
94+ sender: sender,
9195 action: { _ in
9296 Task {
9397 if share. shareType != NKShare . ShareType. publicLink. rawValue, let metadata = self . metadata, metadata. e2eEncrypted && capabilities. e2EEApiVersion == NCGlobal . shared. e2eeVersionV20 {
9498 if await NCNetworkingE2EE ( ) . isInUpload ( account: metadata. account, serverUrl: metadata. serverUrlFileName) {
9599 let error = NKError ( errorCode: NCGlobal . shared. errorE2EEUploadInProgress, errorDescription: NSLocalizedString ( " _e2e_in_upload_ " , comment: " " ) )
96100 return NCContentPresenter ( ) . showInfo ( error: error)
97101 }
98- let error = await NCNetworkingE2EE ( ) . uploadMetadata ( serverUrl: serverUrl , addUserId: nil , removeUserId: share. shareWith, account: metadata. account)
102+ let error = await NCNetworkingE2EE ( ) . uploadMetadata ( serverUrl: metadata . serverUrlFileName , addUserId: nil , removeUserId: share. shareWith, account: metadata. account)
99103 if error != . success {
100104 return NCContentPresenter ( ) . showError ( error: error)
101105 }
@@ -106,40 +110,56 @@ extension NCShare {
106110 )
107111 )
108112
109- self . presentMenu ( with: actions)
113+ self . presentMenu ( with: actions, sender : sender )
110114 }
111115
112- func toggleUserPermissionMenu ( isDirectory: Bool , tableShare : tableShare ) {
116+ func toggleQuickPermissionsMenu ( isDirectory: Bool , share : tableShare , sender : Any ? ) {
113117 var actions = [ NCMenuAction] ( )
114- let permissions = NCPermissions ( )
115118
116- actions. append (
117- NCMenuAction (
119+ actions. append ( contentsOf :
120+ [ NCMenuAction (
118121 title: NSLocalizedString ( " _share_read_only_ " , comment: " " ) ,
119122 icon: utility. loadImage ( named: " eye " , colors: [ NCBrandColor . shared. iconImageColor] ) ,
120123 selected: share. permissions == ( NKShare . Permission. read. rawValue + NKShare. Permission. share. rawValue) || share. permissions == NKShare . Permission. read. rawValue,
121124 on: false ,
125+ sender: sender,
122126 action: { _ in
123- let canShare = permissions. isPermissionToCanShare ( tableShare. permissions)
124- let permissions = permissions. getPermission ( canEdit: false , canCreate: false , canChange: false , canDelete: false , canShare: canShare, isDirectory: isDirectory)
125- self . updateSharePermissions ( share: tableShare, permissions: permissions)
127+ let permissions = NCSharePermissions . getPermissionValue ( canCreate: false , canEdit: false , canDelete: false , canShare: false , isDirectory: isDirectory)
128+ self . updateSharePermissions ( share: share, permissions: permissions)
126129 }
127- )
128- )
129-
130- actions. append (
130+ ) ,
131131 NCMenuAction (
132- // title: isDirectory ? NSLocalizedString("_share_allow_upload_", comment: "") : NSLocalizedString("_share_editing_", comment: ""),
133132 title: NSLocalizedString ( " _share_editing_ " , comment: " " ) ,
134- icon: UIImage ( ) ,
135- selected: hasUploadPermission ( tableShare: tableShare ) ,
133+ icon: utility . loadImage ( named : " pencil " , colors : [ NCBrandColor . shared . iconImageColor ] ) ,
134+ selected: hasUploadPermission ( tableShare: share ) ,
136135 on: false ,
136+ sender: sender,
137137 action: { _ in
138- let canShare = permissions. isPermissionToCanShare ( tableShare. permissions)
139- let permissions = permissions. getPermission ( canEdit: true , canCreate: true , canChange: true , canDelete: true , canShare: canShare, isDirectory: isDirectory)
140- self . updateSharePermissions ( share: tableShare, permissions: permissions)
138+ let permissions = NCSharePermissions . getPermissionValue ( canCreate: true , canEdit: true , canDelete: true , canShare: true , isDirectory: isDirectory)
139+ self . updateSharePermissions ( share: share, permissions: permissions)
141140 }
142- )
141+ ) ,
142+ // NCMenuAction(
143+ // title: NSLocalizedString("_custom_permissions_", comment: ""),
144+ // icon: utility.loadImage(named: "ellipsis", colors: [NCBrandColor.shared.iconImageColor]),
145+ // sender: sender,
146+ // action: { _ in
147+ // guard
148+ // let advancePermission = UIStoryboard(name: "NCShare", bundle: nil).instantiateViewController(withIdentifier: "NCShareAdvancePermission") as? NCShareAdvancePermission,
149+ // let navigationController = self.navigationController, !share.isInvalidated else { return }
150+ // advancePermission.networking = self.networking
151+ // advancePermission.share = tableShare(value: share)
152+ // advancePermission.oldTableShare = tableShare(value: share)
153+ // advancePermission.metadata = self.metadata
154+ //
155+ // if let downloadLimit = try? self.database.getDownloadLimit(byAccount: self.metadata.account, shareToken: share.token) {
156+ // advancePermission.downloadLimit = .limited(limit: downloadLimit.limit, count: downloadLimit.count)
157+ // }
158+ //
159+ // navigationController.pushViewController(advancePermission, animated: true)
160+ // }
161+ // )
162+ ]
143163 )
144164
145165 if isDirectory && ( share. shareType == NKShare . ShareType. publicLink. rawValue /* public link */ || share. shareType == NKShare . ShareType. email. rawValue) {
@@ -155,17 +175,16 @@ extension NCShare {
155175 }
156176 ) , at: 2 )
157177 }
158-
159- self . presentMenu ( with: actions)
178+
179+ self . presentMenu ( with: actions, sender : sender )
160180 }
161181
162182 fileprivate func hasUploadPermission( tableShare: tableShare ) -> Bool {
163- let permissions = NCPermissions ( )
164183 let uploadPermissions = [
165- permissions . permissionMaxFileShare,
166- permissions . permissionMaxFolderShare,
167- permissions . permissionDefaultFileRemoteShareNoSupportShareOption,
168- permissions . permissionDefaultFolderRemoteShareNoSupportShareOption]
184+ NCSharePermissions . permissionMaxFileShare,
185+ NCSharePermissions . permissionMaxFolderShare,
186+ NCSharePermissions . permissionDefaultFileRemoteShareNoSupportShareOption,
187+ NCSharePermissions . permissionDefaultFolderRemoteShareNoSupportShareOption]
169188 return uploadPermissions. contains ( tableShare. permissions)
170189 }
171190
@@ -179,8 +198,11 @@ extension NCShare {
179198 if let model = try database. getDownloadLimit ( byAccount: metadata. account, shareToken: updatedShare. token) {
180199 downloadLimit = . limited( limit: model. limit, count: model. count)
181200 }
201+ if let model = try database. getDownloadLimit ( byAccount: metadata. account, shareToken: updatedShare. token) {
202+ downloadLimit = . limited( limit: model. limit, count: model. count)
203+ }
182204 } catch {
183- NextcloudKit . shared . nkCommonInstance . writeLog ( " [ERROR] Failed to get download limit from database!" )
205+ nkLog ( error : " Failed to get download limit from database! " )
184206 return
185207 }
186208
0 commit comments