SPB Git

Repository Public

AppModel+Main.swift 2.5 KB 40 lines swift

1// Author: Simon-Pierre Boucher — contact@spboucher.ai2// File: Sources/Shared/Model/AppModel+Main.swift3// Description: The former AppModel surface for navigation state, forwarded to the main window's MailScene — existing call sites4// (self-test, template studio, app delegates) keep working unchanged after the extraction.5import SPMailCore6import SwiftUI78extension AppModel {9    var currentAccount: String? { main.currentAccount }10    var selection: SidebarItem? { get { main.selection } set { main.selection = newValue } }11    var mailboxes: [Mailbox] { main.mailboxes }12    func mailbox(_ role: MailboxRole) -> Mailbox? { main.mailbox(role) }13    var rows: [ThreadSummary] { main.rows }14    var selectedIds: Set<String> { get { main.list.selectedIds } set { main.list.selectedIds = newValue } }15    var conversation: [EmailSummary] { main.reader.conversation }16    var bodies: [String: EmailBody] { main.reader.bodies }17    var readingAccount: String? { main.reader.account }18    var searchText: String { get { main.search.text } set { main.search.text = newValue } }19    var searchResults: [EmailSummary]? { get { main.search.results } set { main.search.results = newValue } }20    var searchIsOffline: Bool { main.search.isOffline }21    var unifiedRows: [UnifiedMessage] { main.unified.rows }22    var unifiedIsOffline: Bool { main.unified.isOffline }23    var composeRequest: String? { get { main.composeRequest } set { main.composeRequest = newValue } }24    var studioRequest: Int { get { main.studioRequest } set { main.studioRequest = newValue } }25    var showStudio: Bool { get { main.showStudio } set { main.showStudio = newValue } }2627    func switchAccount(_ id: String) async { await main.switchAccount(id) }28    func didSelectSidebar() { main.didSelectSidebar() }29    func reloadThreads() async { await main.reloadThreads() }30    func refresh() async { await main.refresh() }31    func open(emailId: String) async { await main.open(emailId: emailId) }32    func perform(_ action: MailAction, on ids: Set<String>? = nil) async { await main.perform(action, on: ids) }33    func runSearch() async { await main.runSearch() }34    func compose(_ kind: ComposeKind) async { await main.compose(kind) }35    func reloadUnified() async { await main.reloadUnified() }36    func openUnified(_ row: UnifiedMessage) async { await main.openUnified(row) }37    func performUnified(_ action: MailAction, on rows: [UnifiedMessage]) async { await main.performUnified(action, on: rows) }38    func file(for part: BodyPart) async throws -> URL { try await main.file(for: part) }39}40
Files main
Menu

Theme