mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-07-05 19:28:46 +02:00
Postbox -> TelegramEngine wave 26: resourceRangesStatus + removeCachedResources facades + sweep
Adds two TelegramEngine.Resources facades and migrates 4 Shape-A sites across 3 consumer files. Also imports RangeSet in TelegramEngineResources.swift to disambiguate the RangeSet type from Swift stdlib's iOS-18-only type. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
939873f6f4
commit
fa68639b25
5 changed files with 38 additions and 4 deletions
25
CLAUDE.md
25
CLAUDE.md
|
|
@ -669,6 +669,31 @@ Net: 3 consumer files + 1 TelegramCore file + CLAUDE.md. TelegramEngineResources
|
|||
|
||||
Plan / record: (no plan doc this wave — mechanical sweep).
|
||||
|
||||
### Wave 26 outcome (2026-04-21)
|
||||
|
||||
`resourceRangesStatus` + `removeCachedResources` facade additions + consumer sweep. Combines two independent small sweeps into one commit.
|
||||
|
||||
**Two facades added:**
|
||||
- `resourceRangesStatus(resource: EngineMediaResource) -> Signal<RangeSet<Int64>, NoError>` wraps the single `(MediaResource) -> Signal<RangeSet<Int64>, NoError>` overload. Takes `EngineMediaResource` (not `id:`) because Postbox's overload only accepts a resource, not an id — consumers pass `.resource` already. Facade unwraps via `_asResource()`.
|
||||
- `removeCachedResources(ids: [EngineMediaResource.Id], force: Bool = false, notify: Bool = false) -> Signal<Float, NoError>` wraps the `([MediaResourceId], force:, notify:) -> Signal<Float, NoError>` overload. Maps ids internally.
|
||||
|
||||
**`import RangeSet` added to `TelegramEngineResources.swift`.** The `RangeSet<Int64>` return type caused a name collision with Swift stdlib's `RangeSet` (iOS 18+ only) until the local `RangeSet` module is imported. `TelegramCore/BUILD` already declared the dep at line 23 (`//submodules/Utils/RangeSet:RangeSet`), so no BUILD change needed.
|
||||
|
||||
**4 Shape-A consumer sites migrated (3 files):**
|
||||
- `PhotoResources/Sources/PhotoResources.swift` (1)
|
||||
- `TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryChatContent.swift` (1)
|
||||
- `ChatListUI/Sources/ChatListSearchContainerNode.swift` (2)
|
||||
|
||||
For `ChatListSearchContainerNode.swift:1398`, the caller uses a `Set<MediaResourceId>` local — wave leaves the local as-is and maps at the call site via `resourceIds.map { EngineMediaResource.Id($0) }`. Migrating the local to `Set<EngineMediaResource.Id>` is out of scope (module keeps `import Postbox` for unrelated reasons).
|
||||
|
||||
**Build validation.** Clean build (563 processes, 265s, 0 errors) on the second attempt after adding `import RangeSet`.
|
||||
|
||||
**Lesson — Swift-stdlib-vs-third-party-module name collisions.** When a facade signature references a type name that exists both in Swift stdlib (potentially availability-restricted) and in a third-party module, the compiler picks the stdlib one by default. Fix: import the third-party module explicitly. In this codebase, `RangeSet` is provided by `submodules/Utils/RangeSet:RangeSet`, and TelegramCore already depends on it. Use `import RangeSet` at the file top.
|
||||
|
||||
Net: 3 consumer files + 1 TelegramCore file + CLAUDE.md. TelegramEngineResources.swift: +9 / -0 (including `import RangeSet`).
|
||||
|
||||
Plan / record: (no plan doc this wave — mechanical sweep).
|
||||
|
||||
### Modules currently free of `import Postbox` (running tally)
|
||||
|
||||
Consumer modules that no longer import Postbox, across all waves and standalone commits:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue