mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-05-21 18:20:41 +00:00
f84e94f507
Drive raw `MediaResource` out of the `TelegramEngine` public facade for photo-upload APIs, and complete a first batch of consumer-side migrations. Behavior-preserving. The `_internal_*` Postbox-facing functions are untouched — only the facade signatures change, bridging inside via `_asResource()` / `EngineMediaResource(_:)`. TelegramEngine facades migrated (signatures now take EngineMediaResource): - TelegramEngine.Peers.uploadedPeerPhoto / uploadedPeerVideo - TelegramEngine.Peers.updatePeerPhoto (closure param too) - TelegramEngine.AccountData.updateAccountPhoto / updateFallbackPhoto - TelegramEngine.Contacts.updateContactPhoto - TelegramEngine.Auth.uploadedPeerVideo Consumer-side changes: - MapResourceToAvatarSizes utility: signature is now (engine: TelegramEngine, resource: EngineMediaResource, ...). Uses engine.resources.data(id:) internally. The submodule drops `import Postbox` and the Bazel dep. - AuthorizationUI: avatar-video signal retyped from Signal<TelegramMediaResource?> to Signal<EngineMediaResource?>. - 27 `mapResourceToAvatarSizes(postbox:...)` call sites across 5 TelegramUI/TelegramCallsUI files migrated to the new form. Deferred: - SaveToCameraRoll (planned Task 8) abandoned — module has three public functions taking `postbox: Postbox` (umbrella-type leak, banned by rule 2) and requires a full module-migration wave, not a type swap. Reason recorded in the wave-2 plan doc. - Other TelegramEngine facades still leaking MediaResource (TelegramEngineStickers.uploadSticker; UploadSecureIdFile.* — additionally leaks Postbox) flagged for a future wave. Docs: - CLAUDE.md: new rule 7 (TelegramCore never imports UIKit/Display, shared with Telegram-Mac), and a new "MediaResource → EngineMediaResource consumer migration" section describing the wrap/unwrap helpers and the modify-in-place facade-bridging pattern. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>