|
@@ -41,7 +41,6 @@ extension NCCollectionViewCommon {
|
|
|
let isFolderEncrypted = CCUtility.isFolderEncrypted(metadata.serverUrl, e2eEncrypted: metadata.e2eEncrypted, account: metadata.account, urlBase: metadata.urlBase)
|
|
|
let serverUrlHome = NCUtilityFileSystem.shared.getHomeServer(account: appDelegate.account)
|
|
|
let isOffline: Bool
|
|
|
- let canUnlock = metadata.canUnlock(as: appDelegate.userId)
|
|
|
|
|
|
if metadata.directory, let directory = NCManageDatabase.shared.getTableDirectory(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", appDelegate.account, serverUrl)) {
|
|
|
isOffline = directory.offline
|
|
@@ -104,19 +103,21 @@ extension NCCollectionViewCommon {
|
|
|
//
|
|
|
// FAVORITE
|
|
|
//
|
|
|
- actions.append(
|
|
|
- NCMenuAction(
|
|
|
- title: metadata.favorite ? NSLocalizedString("_remove_favorites_", comment: "") : NSLocalizedString("_add_favorites_", comment: ""),
|
|
|
- icon: NCUtility.shared.loadImage(named: "star.fill", color: NCBrandColor.shared.yellowFavorite),
|
|
|
- action: { _ in
|
|
|
- NCNetworking.shared.favoriteMetadata(metadata) { errorCode, errorDescription in
|
|
|
- if errorCode != 0 {
|
|
|
- NCContentPresenter.shared.messageNotification("_error_", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode)
|
|
|
+ if !metadata.lock {
|
|
|
+ actions.append(
|
|
|
+ NCMenuAction(
|
|
|
+ title: metadata.favorite ? NSLocalizedString("_remove_favorites_", comment: "") : NSLocalizedString("_add_favorites_", comment: ""),
|
|
|
+ icon: NCUtility.shared.loadImage(named: "star.fill", color: NCBrandColor.shared.yellowFavorite),
|
|
|
+ action: { _ in
|
|
|
+ NCNetworking.shared.favoriteMetadata(metadata) { errorCode, errorDescription in
|
|
|
+ if errorCode != 0 {
|
|
|
+ NCContentPresenter.shared.messageNotification("_error_", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
+ )
|
|
|
)
|
|
|
- )
|
|
|
+ }
|
|
|
|
|
|
//
|
|
|
// DETAIL
|
|
@@ -136,7 +137,8 @@ extension NCCollectionViewCommon {
|
|
|
//
|
|
|
// LOCK / UNLOCK
|
|
|
//
|
|
|
- if !metadata.directory, canUnlock, NCManageDatabase.shared.getCapabilitiesServerInt(account: appDelegate.account, elements: NCElementsJSON.shared.capabilitiesFilesLockVersion) >= 1 {
|
|
|
+ let hasLockCapability = NCManageDatabase.shared.getCapabilitiesServerInt(account: appDelegate.account, elements: NCElementsJSON.shared.capabilitiesFilesLockVersion) >= 1
|
|
|
+ if !metadata.directory, metadata.canUnlock(as: appDelegate.userId), hasLockCapability {
|
|
|
let lockAction = NCMenuAction.lockUnlockFiles(shouldLock: !metadata.lock, metadatas: [metadata])
|
|
|
if metadata.lock {
|
|
|
// make unlock first action, after info rows & seperator
|
|
@@ -226,7 +228,7 @@ extension NCCollectionViewCommon {
|
|
|
//
|
|
|
// RENAME
|
|
|
//
|
|
|
- if !(isFolderEncrypted && metadata.serverUrl == serverUrlHome), canUnlock {
|
|
|
+ if !(isFolderEncrypted && metadata.serverUrl == serverUrlHome), !metadata.lock {
|
|
|
actions.append(
|
|
|
NCMenuAction(
|
|
|
title: NSLocalizedString("_rename_", comment: ""),
|