Skip to content

Commit b3d80b8

Browse files
authored
Merge pull request #367 from cryptomator/bugfix/hide-change-password-for-hub-vault
Bugfix/hide change password for hub vault
2 parents 15ccab7 + 6c60058 commit b3d80b8

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

Cryptomator/VaultDetail/VaultDetailViewModel.swift

+7-3
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,15 @@ class VaultDetailViewModel: VaultDetailViewModelProtocol {
8585
private var subscribers = Set<AnyCancellable>()
8686

8787
private lazy var sections: [VaultDetailSection] = {
88+
var sections: [VaultDetailSection] = [.vaultInfoSection, .lockingSection]
8889
if vaultIsEligibleToMove() {
89-
return [.vaultInfoSection, .lockingSection, .moveVaultSection, .changeVaultPasswordSection, .removeVaultSection]
90-
} else {
91-
return [.vaultInfoSection, .lockingSection, .changeVaultPasswordSection, .removeVaultSection]
90+
sections.append(.moveVaultSection)
91+
}
92+
if vaultInfo.vaultConfigType == .masterkeyFile {
93+
sections.append(.changeVaultPasswordSection)
9294
}
95+
sections.append(.removeVaultSection)
96+
return sections
9397
}()
9498

9599
private lazy var lockButton: ButtonCellViewModel<VaultDetailButtonAction> = {

Cryptomator/VaultList/VaultInfo.swift

+10
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,16 @@ public class VaultInfo: Decodable, FetchableRecord {
5757
vaultListPosition.position = newValue
5858
}
5959
}
60+
61+
var vaultConfigType: VaultConfigType {
62+
if let cachedVault = try? VaultDBCache().getCachedVault(withVaultUID: vaultUID),
63+
let vaultConfigToken = cachedVault.vaultConfigToken,
64+
let unverifiedVaultConfig = try? UnverifiedVaultConfig(token: vaultConfigToken) {
65+
return VaultConfigHelper.getType(for: unverifiedVaultConfig)
66+
} else {
67+
return .unknown
68+
}
69+
}
6070
}
6171

6272
extension VaultInfo: Equatable {

0 commit comments

Comments
 (0)