Skip to content

Commit 85bdb86

Browse files
committed
Remove change password section for Hub Vaults
1 parent 25d7d2f commit 85bdb86

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

Cryptomator/VaultDetail/VaultDetailViewModel.swift

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,20 @@ class VaultDetailViewModel: VaultDetailViewModelProtocol {
8585
private var subscribers = Set<AnyCancellable>()
8686

8787
private lazy var sections: [VaultDetailSection] = {
88+
var sections: [VaultDetailSection] = [.vaultInfoSection, .lockingSection]
89+
8890
if vaultIsEligibleToMove() {
89-
return [.vaultInfoSection, .lockingSection, .moveVaultSection, .changeVaultPasswordSection, .removeVaultSection]
90-
} else {
91-
return [.vaultInfoSection, .lockingSection, .changeVaultPasswordSection, .removeVaultSection]
91+
sections.append(.moveVaultSection)
92+
}
93+
94+
if vaultInfo.vaultConfigType != .hub {
95+
sections.append(.changeVaultPasswordSection)
9296
}
97+
98+
// Ensure removeVaultSection is always the last element
99+
sections.append(.removeVaultSection)
100+
101+
return sections
93102
}()
94103

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

Cryptomator/VaultList/VaultInfo.swift

Lines changed: 10 additions & 0 deletions
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)