feat: add GroupFilterViewModel and GroupFilterView sidebar

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WYqycDFsynHH9VnnK7LNSf
This commit is contained in:
2026-09-19 17:07:44 +02:00
co-authored by Claude Haiku 4.5
parent e653071f80
commit bf93b75bdf
2 changed files with 76 additions and 0 deletions
@@ -0,0 +1,27 @@
import Foundation
import Combine
import MyPassCore
@MainActor
final class GroupFilterViewModel: ObservableObject {
@Published var selectedGroupIds: Set<UUID> = []
private let session: VaultSession
init(session: VaultSession) {
self.session = session
}
func isSelected(_ group: MyPassCore.Group) -> Bool {
selectedGroupIds.contains(group.id)
}
func toggle(_ group: MyPassCore.Group) {
guard let root = session.database?.root else { return }
selectedGroupIds = GroupSelection.toggling(group.id, in: root, current: selectedGroupIds)
}
func clear() {
selectedGroupIds = []
}
}