Skip to content

Commit

Permalink
add ctrl
Browse files Browse the repository at this point in the history
Signed-off-by: Marino Faggiana <marino@marinofaggiana.com>
  • Loading branch information
marinofaggiana committed Oct 9, 2024
1 parent 2a8be10 commit 7a23bd1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
15 changes: 9 additions & 6 deletions iOSClient/Networking/NCNetworking+WebDAV.swift
Original file line number Diff line number Diff line change
Expand Up @@ -418,9 +418,8 @@ extension NCNetworking {

for metadata in metadatasPlain {
let permission = NCUtility().permissionsContainsString(metadata.permissions, permissions: NCPermissions().permissionCanDelete)
if !metadata.permissions.isEmpty && permission == false {
NCContentPresenter().showInfo(error: NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "_no_permission_delete_file_"))
return
if (!metadata.permissions.isEmpty && permission == false) || metadata.status != global.metadataStatusNormal {
return NCContentPresenter().showInfo(error: NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "_no_permission_delete_file_"))
}

if metadata.status == global.metadataStatusWaitCreateFolder {
Expand All @@ -439,9 +438,9 @@ extension NCNetworking {

func renameMetadata(_ metadata: tableMetadata, fileNameNew: String) {
let permission = utility.permissionsContainsString(metadata.permissions, permissions: NCPermissions().permissionCanRename)
if !metadata.permissions.isEmpty && permission == false {
NCContentPresenter().showInfo(error: NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "_no_permission_modify_file_"))
return
if (!metadata.permissions.isEmpty && permission == false) ||
(metadata.status != global.metadataStatusNormal && metadata.status != global.metadataStatusWaitRename) {
return NCContentPresenter().showInfo(error: NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "_no_permission_modify_file_"))
}

if metadata.isDirectoryE2EE {
Expand Down Expand Up @@ -538,6 +537,10 @@ extension NCNetworking {

func favoriteMetadata(_ metadata: tableMetadata,
completion: @escaping (_ error: NKError) -> Void) {
if metadata.status != global.metadataStatusNormal && metadata.status != global.metadataStatusWaitFavorite {
return NCContentPresenter().showInfo(error: NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "_no_permission_favorite_file_"))
}

self.database.setMetadataFavorite(ocId: metadata.ocId, favorite: !metadata.favorite, status: global.metadataStatusWaitFavorite)

NotificationCenter.default.postOnMainThread(name: self.global.notificationCenterFavoriteFile, userInfo: ["ocId": metadata.ocId, "serverUrl": metadata.serverUrl])
Expand Down
1 change: 1 addition & 0 deletions iOSClient/Supporting Files/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@
"_no_permission_add_file_" = "You don't have permission to add files";
"_no_permission_delete_file_" = "You don't have permission to delete files";
"_no_permission_modify_file_" = "You don't have permission to modify files";
"_no_permission_favorite_file_" = "You don't have permission to add the file to your favorites";
"_request_upload_new_ver_" = "The file has been modified, do you want to upload the new version?";
"_add_folder_info_" = "Add folder info";
"_back_" = "Back";
Expand Down

0 comments on commit 7a23bd1

Please sign in to comment.