-
Notifications
You must be signed in to change notification settings - Fork 0
Architecture
Unspool separates presentation, domain rules, Telegram transport, persistence, credentials, and filesystem mutations. SwiftUI views render observable state and send intents; they do not call TDLib, Keychain, or mutating filesystem APIs directly.
flowchart LR
V["SwiftUI Features"] -->|"intents"| A["AppModel<br/>@MainActor"]
A --> S["SetupModel<br/>@MainActor"]
A --> H["AttachmentHistoryService<br/>actor"]
A --> D["DownloadCoordinator<br/>actor"]
A --> P["Persistence actors"]
S --> K["KeychainCredentialStore<br/>actor"]
S --> T["TelegramSessionController<br/>actor"]
H --> C["TDLibClient<br/>actor"]
D --> C
T --> C
C --> R["TDLibReceiveLoop"]
R --> B["TDLibBridge<br/>C++"]
B --> L["TDLib / Telegram"]
D --> F["DestinationAccess<br/>actor"]
F --> U["User-selected folder"]
UnspoolRootView selects setup or the three-destination application shell.
Feature views are grouped into:
- Setup;
- Browse;
- Downloads;
- Settings;
- Shared components and design-system primitives.
AppModel is the main-actor application orchestrator. Extensions separate:
- attachments and selection;
- downloads and recovery;
- runtime lifecycle;
- presentation-derived properties and product error copy.
SetupModel owns setup progress and delegates account-state input to
AuthorizationCoordinator.
Domain values encode behavior without importing SwiftUI or TDLib:
-
TelegramAttachmentandAttachmentIdentity; - filename value and provenance;
- categories, filters, sort, and selection;
- scan limits;
- credentials and validation errors;
- preflight, conflicts, progress, outcomes, history, and pending batches.
These are predominantly immutable value types and conform to Sendable when
they cross actor boundaries.
Owns JSON request/response correlation, receive ordering, authorization, connection state, chat updates, pagination, and attachment mapping.
Owns destination planning, capacity, safe path construction, TDLib file download, bounded scheduling, cancellation, and atomic placement.
Actor-backed JSON stores provide cached chats, attachment snapshots, download history, and interrupted-batch recovery.
The Keychain actor stores the Telegram API credential pair.
Production types accept protocols or concrete dependencies in initializers. Tests replace TDLib transport, session service, stores, preferences, and destination roots with deterministic fakes or temporary files.
Preview fixtures are activated only through an explicit preview/UI-test environment. Ordinary app launches construct the live Telegram environment.
-
project.ymldefines targets, settings, entitlements, and source membership. -
Unspool.xcodeprojis generated and committed for convenience. - Domain and infrastructure code define runtime behavior.
- Regression tests protect important invariants.
- Documentation explains those sources but does not override them.
Continue with TDLib Integration, Concurrency, Cancellation, and Errors, and Codebase Map.
Unspool is an independent project and is not affiliated with Telegram. Repository · Privacy · Security · MIT License
- Getting Started
- Detailed Telegram Setup
- Feature Overview
- Chats and History
- Attachments and Filenames
- Search and Selection
- Download Workflow
- Conflicts and Recovery
- Download History
- Settings
- Accessibility
- Troubleshooting
- Detailed Troubleshooting and FAQ
- Privacy and Security
- Detailed Security Model
- TDLib Integration
- Persistence
- Concurrency and Errors
- Glossary