Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios

This commit is contained in:
Mikhail Filimonov 2026-04-21 12:11:20 +01:00
commit 365d44f03a
211 changed files with 23093 additions and 22792 deletions

489
CLAUDE.md
View file

@ -57,6 +57,9 @@ MemoryBuffer → EngineMemoryBuffer (added 2026-04)
PostboxDecoder → EnginePostboxDecoder (added 2026-04)
PostboxEncoder → EnginePostboxEncoder (added 2026-04)
AdaptedPostboxDecoder → EngineAdaptedPostboxDecoder (added 2026-04)
ItemCollectionId → EngineItemCollectionId (added 2026-04-20)
FetchResourceSourceType → EngineFetchResourceSourceType (added 2026-04-20)
FetchResourceError → EngineFetchResourceError (added 2026-04-20)
```
For the `MediaResource` Postbox protocol, prefer the TelegramCore subtype `TelegramMediaResource` when the consumer's usage allows (note: `EngineMediaResource` is a wrapper **class**, not a typealias, so it is not interchangeable with the protocol).
@ -102,6 +105,38 @@ Before selecting a wave's module list, grep each candidate for:
Tally impact from a sweep: dozens of consumer modules can become Postbox-free in a single commit. First run (wave 6): 782 candidates, 18 iterations, 183 survivors, **189 modules** newly Postbox-free. Re-run after every 2-3 facade-migration waves.
**Public-Postbox-type inventory (wave-11-pattern planning).** For wave-11-shape candidates (modules whose public init takes `postbox: Postbox, network: Network` purely for avatar/setPeer forwarding), grepping only for `Postbox`/`Network` tokens **undercounts** — public-surface types defined in Postbox can leak without ever naming "Postbox" literally. Wave 16 hit this: the plan missed `EngineMessageHistoryThread.Info?` and `PeerStoryStats?`, both Postbox-defined types whose names don't include "Postbox". Mitigation: build a Postbox-defined-public-types allowlist once, then grep the candidate module against it.
```bash
# Build allowlist once (or re-run if Postbox sources change):
grep -rhE "^public\s+(class|struct|enum|protocol|typealias)\s+\w+" submodules/Postbox/Sources/ \
| awk '{print $3}' | sed 's/[(:<].*//' | sort -u > /tmp/postbox-public-types.txt
# Then, for each candidate module, grep its sources for any of those names:
grep -rhoE "\b($(cat /tmp/postbox-public-types.txt | tr '\n' '|' | sed 's/|$//'))\b" \
submodules/<CandidateModule>/Sources/ | sort -u
```
Any hit in a public-surface position (field type, init param type, enum payload type, generic arg) that isn't already a documented typealias is a blocker. "Engine"-prefixed types can still be Postbox-defined — don't trust naming conventions, grep for the defining module. If the module hits only `Postbox` itself (i.e., literal `Postbox`/`Network` pair), it's a clean wave-11 candidate. Otherwise, decide per leak: (a) move the type to TelegramCore if it's a namespace-only class (wave 16a pattern — prototype: `EngineMessageHistoryThread`), (b) accept that the module can't become Postbox-free and ship a partial `engine:`/`stateManager:` collapse that keeps `import Postbox` (wave 16b pattern — `PeerStoryStats` is too baked into Postbox views to move cleanly), (c) abandon the candidate.
**Wave-shape G: facade addition + consumer sweep in one commit.** Validated at scale across waves 19-26. Six consecutive sessions migrated ~95 consumer sites and added ~15 mediaBox facades, all with clean first-pass builds (exception: wave 26 needed a second pass to add `import RangeSet`). Shape recipe:
1. **Target:** a `MediaBox` (or similar Postbox type) method where Postbox's signature uses clean leaf types (`MediaResourceId`, `Data`, `String`, `Bool`) and the return type is either non-Postbox or has an existing `Engine*` wrapper.
2. **Pre-flight inventory:** grep `context\.account\.postbox\.mediaBox\.<methodName>` over `submodules/` (excluding TelegramCore/Postbox/TelegramApi). Classify each hit:
- **Shape A**: `context.account.postbox.mediaBox.X(...)` → migratable.
- **Shape B**: `context.account.postbox.mediaBox.X(id: ...)` (different overload) → migratable with identical pattern.
- **Shape C**: `account.postbox.mediaBox.X(...)` where `account: Account` is a local (not `AccountContext`) → skip this wave (needs per-module rework).
- **Shape D**: `self.postbox.mediaBox.X(...)` where `postbox: Postbox` is a stored field → skip this wave.
- Plus: check for `accountManager.mediaBox.X(...)` which is Account-manager-scoped, a different migration path entirely. Never migrate via `TelegramEngine.Resources.*`.
3. **Facade design rules:**
- Signatures take `EngineMediaResource.Id` (`MediaResourceId` aliased at call site via `EngineMediaResource.Id(x.id)`) or `EngineMediaResource` (wraps `resource` when the Postbox overload takes a resource with members accessed via `.id`).
- Parameters with `Bool` defaults (`synchronous: Bool = false`) preserve defaults on the facade.
- Return types: prefer `Void`, `String`, `String?`, `Signal<T, NoError>` where `T` is a non-Postbox type or an `Engine*` wrapper. Where Postbox return types are wrapped (e.g., `Signal<MediaResourceData, NoError>``Signal<EngineMediaResource.ResourceData, NoError>`), confirm the `Engine*` wrapper exists and decide whether consumer-side field-access rewrites are acceptable for the wave.
4. **WIP interference check:** before starting, `git status --short | grep -v "^??"` to list modified files. If any Shape-A site is in a WIP file, either skip those sites (document the skip in the outcome) or wait for the WIP to commit. Wave 23 hit this in `ChatMessageInteractiveMediaNode.swift`.
5. **Name collision check:** if a facade return type names a Swift stdlib type that has availability restrictions (e.g., `RangeSet` — iOS 18+), verify the third-party module import is present in `TelegramEngineResources.swift`. Wave 26 needed `import RangeSet`.
6. **Replace_all usage:** for files with duplicate identical call text, `replace_all=true` on the exact call expression (without leading whitespace) batches the migration. When leading whitespace varies across identical-call sites within a file, the tool still matches if the unchanged prefix (`context.account.postbox.mediaBox.X(...)`) is unique enough — but verify via post-edit grep.
7. **Cheapness:** ~5-50 sites per wave, single atomic commit, expected first-pass-clean build. If post-migration grep for `context\.account\.postbox\.mediaBox\.<methodName>` returns empty (exclude Shape-C/D) and build is green, commit.
### Wave 1 outcome (2026-04-16)
4 modules done: `ChatInterfaceState`, `ChatSendMessageActionUI`, `ContactListUI`, `DrawingUI`.
@ -274,6 +309,409 @@ Net: 1 file changed, +22 / -29 lines (7 simplification — new switch-over-tu
Plan / record: `docs/superpowers/plans/2026-04-20-postbox-to-telegramengine-wave-10.md`.
### Wave 11 outcome (2026-04-20)
Revisits `ActionSheetPeerItem` — one of the six wave-1 abandonments. The wave-1 blocker was that the public init took `postbox: Postbox` + `network: Network` explicitly, forcing the module to `import Postbox`, and the sole external caller (ShareController, out-of-wave at the time) couldn't be edited. This wave resolves the blocker without any rule-2 violation by routing the pair through `AccountStateManager`.
**Init-surface collapse.** `ActionSheetPeerItem.init(accountPeerId:postbox:network:contentSettings:peer:…)``.init(accountPeerId:stateManager:contentSettings:peer:…)`. `AccountStateManager` is a TelegramCore public class whose public API surface includes `postbox: Postbox` and `network: Network` fields; passing the manager as a single handle lets the module hold on to the two values without ever naming `Postbox` in its own source. The setItem call site becomes `self.avatarNode.setPeer(…, postbox: item.stateManager.postbox, network: item.stateManager.network, …)` — Swift's type inference resolves `Postbox` through transitive module visibility (TelegramCore → AvatarNode), no `import Postbox` needed in the consumer.
**Convenience init unchanged in shape.** The `(context: AccountContext, …)` convenience delegates to `(accountPeerId:stateManager:contentSettings:…)`; the two callable forms stay aligned.
**Caller (`ShareController.swift:1146`).** Dropped `postbox: info.account.stateManager.postbox, network: info.account.stateManager.network` → single `stateManager: info.account.stateManager`. `ShareControllerAccountContext` (the per-switchable-account protocol) already exposes `stateManager: AccountStateManager`, so this is a collapse, not a signature divergence. ShareController continues to import Postbox for its own unrelated reasons; no change to its dependency profile.
**Reusable pattern.** For any wave-1-style module that was abandoned because a public init takes `postbox: Postbox, network: Network` with avatar-rendering downstream: collapse to `stateManager: AccountStateManager` (TelegramCore type) and unpack inside the setItem/setPeer body. The pattern applies broadly — most wave-1 abandonments used this param-pair for avatar setup. Candidates to try next: `ChatListSearchRecentPeersNode`, `HorizontalPeerItem`, `SelectablePeerNode`, `ItemListPeerItem`, `ItemListAvatarAndNameInfoItem`, `ItemListStickerPackItem` (verify each by grep first — some may use `postbox` for non-avatar reasons).
Net: 3 files changed, +8 / -15 lines. Build green (5854 actions, ~6min).
Plan / record: (no plan doc this wave — single-module, low-complexity).
### Wave 12 outcome (2026-04-20)
Applies the wave-11 `stateManager: AccountStateManager` collapse pattern to `HorizontalPeerItem` — another wave-1-era candidate whose public init leaked `postbox: Postbox, network: Network`. Additionally ripples the collapse one layer up into `ChatListSearchRecentPeersNode`'s public init so the `HorizontalPeerItem` call site has `stateManager:` in scope.
**`HorizontalPeerItem` fully Postbox-free.** `init(postbox: Postbox, network: Network, …)` + matching stored fields → `init(stateManager: AccountStateManager, …)` + `let stateManager`. SelectablePeerNode.setup call site routes via `item.stateManager.postbox` / `.network`. Module drops `import Postbox` and `//submodules/Postbox:Postbox` dep.
**`ChatListSearchRecentPeersNode` public surface migrated, module still imports Postbox.** Public `init(accountPeerId:postbox:network:…)``init(accountPeerId:stateManager:…)`. Two private helpers (`item(…)` on `ChatListSearchRecentPeersEntry` and `preparedRecentPeersTransition(…)`) get the same collapse for forwarding. Internal uses of raw postbox (`_internal_recentPeers`, `postbox.peerView`, `postbox.combinedView`, `_internal_managedUpdatedRecentPeers`) rewritten to `stateManager.postbox` / `stateManager.network` — the module stays on `import Postbox` because of `PostboxViewKey` / `UnreadMessageCountsItem` / `UnreadMessageCountsView` usage inside the peerViews-to-unread-counts pipeline. That pipeline could be rewritten against `EngineDataMap` + `TelegramEngine.EngineData.Item.Peer.Notifications.*` in a future wave, but the public surface simplification is valuable standalone.
**Two external caller sites migrated:**
- `ShareController/Sources/ShareControllerRecentPeersGridItem.swift:66-67``postbox: context.stateManager.postbox, network: context.stateManager.network``stateManager: context.stateManager` (ShareControllerAccountContext protocol already exposes `stateManager`).
- `ChatListUI/Sources/ChatListRecentPeersListItem.swift:125-126``postbox: item.context.account.postbox, network: item.context.account.network``stateManager: item.context.account.stateManager`.
- `SettingsUI/Sources/DeleteAccountPeersItem.swift:51-52` (call site for `HorizontalPeerItem`) — `postbox: context.account.postbox, network: context.account.network``stateManager: context.account.stateManager`.
**Lesson reinforcement.** The wave-11 collapse pattern is very cheap to ripple through intermediate owners. Whenever a consumer module takes `(postbox:Postbox, network:Network)` purely to forward them to another call downstream, collapse to `stateManager: AccountStateManager` — no propagation fan-out required for the raw pair because the stateManager is a single handle. Even when the intermediate owner itself uses raw `postbox.peerView` internally (like this wave's `ChatListSearchRecentPeersNode`), the public surface still gets the collapse at zero cost.
Net: 6 files changed, +26 / -36 lines. Build verified green (incremental, 136 actions).
Plan / record: (no plan doc this wave — pattern-application, low-complexity).
### Wave 13 outcome (2026-04-20)
Targeted `AttachmentTextInputPanelNode` at the user's request. On inspection, the module was already Postbox-free at the source level (swept in wave 6) — its two `.swift` files compile fine without `import Postbox`. Two leftover items were fixed:
1. **Dead `//submodules/Postbox:Postbox` BUILD dep** — wave 6 swept `^import Postbox$` lines from source but never touched BUILD files. `AttachmentTextInputPanelNode/BUILD` (and, it turns out, 97 other modules' BUILDs — see wave 14) still listed the dep despite no source file needing it. Removed.
2. **Two raw `peerId?.namespace == Namespaces.Peer.SecretChat` checks** (lines 436, 2102) migrated to use the existing `PeerId.isSecretChat` extension at `submodules/TelegramCore/Sources/Utils/PeerUtils.swift:615`. (First-pass attempt introduced a duplicate `isSecretChat` extension and failed with "invalid redeclaration" — note for future waves: always grep TelegramCore for an existing helper before adding.)
**No new TelegramEngine methods/types introduced.** The refactor was smaller than anticipated; the module's migration debt had already been paid down by wave 6's source-level sweep. The BUILD-dep leftover and the namespace-equality sites were the only remaining items. Both are quality-of-life cleanups rather than structural migration.
**Observation that drove wave 14.** Wave 6's methodology-note in the "Unused-import sweeps" guidance only measured Postbox-freeness by `^import Postbox$` lines in sources. After touching `AttachmentTextInputPanelNode/BUILD` in this wave, I noticed many other wave-6-swept modules still carry dead BUILD deps, ~= the wave-6 survivor count. That's the whole of wave 14.
Net: 2 files changed, +2 / -3 lines.
Plan / record: (no plan doc this wave — discovery pass).
### Wave 14 outcome (2026-04-20)
Build-dep sweep analogous to wave 6's source-import sweep: drop `//submodules/Postbox:Postbox` (and `//submodules/Postbox`) from every BUILD whose source files no longer `import Postbox`.
**Methodology.**
1. For each `submodules/*/BUILD` referencing `submodules/Postbox`, check whether any `.swift` file in the module's `Sources/` tree has `^import Postbox$`.
2. If none do, speculatively drop the Postbox dep line from the BUILD via `sed -i '' -e '/^[[:space:]]*"\/\/submodules\/Postbox\(:Postbox\)\{0,1\}",[[:space:]]*$/d'`.
3. Full `Make.py build --continueOnError`.
4. Restore any BUILD that now fails to compile (none did).
5. Commit surviving drops.
**Result.** 98 candidate BUILDs identified. **Zero iterations needed** — first-pass build came up green (80 incremental actions, no restores). Net: 98 BUILD files, 98 lines (each lost exactly its `//submodules/Postbox` dep line).
**Why zero iterations.** Bazel Swift rules require source-level `import` for symbol resolution. If a module compiled after wave 6's `import Postbox` sweep, then none of its source files are physically referencing Postbox symbols. The BUILD-level dep was always redundant — it was carried for historical reasons (code likely once imported Postbox but was migrated off) but had no effect on either compilation or the actual dependency graph (Postbox is still transitively pulled in by TelegramCore, which every module depends on). Dropping it is a metadata cleanup with no semantic effect.
**Lesson / reusable pattern.**
- After every source-level `import Postbox` sweep (wave-6 shape), run a matching BUILD-dep sweep immediately. Same candidate set, near-zero execution risk, same commit.
- Script for identifying candidates:
```bash
find submodules -name "BUILD" -type f | while read build; do
dir=$(dirname "$build")
if grep -q "submodules/Postbox" "$build" 2>/dev/null && [ -d "$dir/Sources" ]; then
if ! grep -rq "^import Postbox$" "$dir/Sources" 2>/dev/null; then
echo "$dir"
fi
fi
done
```
- After waves 13+14, 194 modules still list `//submodules/Postbox` in BUILD — all of them have source files still importing Postbox.
Net (wave 14 alone): 98 files changed, 0 insertions / 98 deletions.
Plan / record: (no plan doc this wave — mechanical sweep).
### Wave 15 outcome (2026-04-20)
Applies the wave-11/12 `stateManager: AccountStateManager` collapse pattern to `SelectablePeerNode` — another wave-1-era candidate listed in the post-wave-14 shortlist. Module becomes fully Postbox-free (source + BUILD).
**`SelectablePeerNode` fully Postbox-free.** Two public setup methods migrated:
- `setup(accountPeerId: EnginePeer.Id, postbox: Postbox, network: Network, …)``setup(accountPeerId:, stateManager: AccountStateManager, …)`.
- `setupStoryRepost(accountPeerId: EnginePeer.Id, postbox: Postbox, network: Network, …)``setupStoryRepost(accountPeerId:, stateManager: AccountStateManager, …)`.
Internal forwards rewired: `AvatarNode.setPeer(…, postbox: stateManager.postbox, network: stateManager.network, …)` and `EmojiStatusComponent(postbox: stateManager.postbox, …)`. Neither site names `Postbox` in the consumer — Swift infers through transitive module visibility.
**Namespaces.Peer.SecretChat fixup (×3).** Replaced `peer.peerId.namespace == Namespaces.Peer.SecretChat` checks with `peer.peerId.isSecretChat` at three sites, matching the wave-13 pattern (`PeerId.isSecretChat` at `TelegramCore/Sources/Utils/PeerUtils.swift:611`). The third site (`updateSelection` in the not-selected branch) additionally needed an `?? false` fallback — previous expression was `self.peer?.peerId.namespace == Namespaces.Peer.SecretChat` (optional-equals-non-optional produces `Bool`), new expression is `(self.peer?.peerId.isSecretChat ?? false)`.
**Share-Extension boundary — `stateManager:` over `engine:`.** `SelectablePeerNode` is used by `ShareControllerPeerGridItem`, whose context is `ShareControllerAccountContext`. That protocol exposes `stateManager: AccountStateManager` and `engineData: TelegramEngine.EngineData`, but **no `engine: TelegramEngine`** — and the Share Extension's `ShareControllerAccountContextExtension` concrete impl has no `Account`, so constructing a full `TelegramEngine` (`init(account: Account)`) is physically unreachable there. This is the documented "rare but genuine" fallback to `stateManager:` from the user-preference memory (`feedback_postbox_refactor_handle.md`) — prefer `engine:` except when crossing the Share-Extension boundary.
**Three external call sites migrated:**
- `HorizontalPeerItem/Sources/HorizontalPeerItem.swift:227` (wave 12's `stateManager:` field now forwards directly): `postbox: item.stateManager.postbox, network: item.stateManager.network``stateManager: item.stateManager`.
- `ShareController/Sources/ShareControllerPeerGridItem.swift:237` (setup): `postbox: context.stateManager.postbox, network: context.stateManager.network``stateManager: context.stateManager`.
- `ShareController/Sources/ShareControllerPeerGridItem.swift:273` (setupStoryRepost): same.
**Convenience init unchanged.** `setup(context: AccountContext, …)` now delegates with `stateManager: context.account.stateManager`; signature unchanged — `JoinLinkPreviewPeerContentNode.swift:147` (the one caller using the convenience init) needed no edit.
Net: 4 files changed, +12 / -17 lines. Build verified green (193 actions, 131s — Telegram.ipa target built successfully).
Plan / record: (no plan doc this wave — pattern-application, low-complexity).
### Wave 16 outcome (2026-04-20)
Two-commit wave targeting `ItemListPeerItem`. Planning-time inventory (`project_postbox_wave16_plan.md`) only grepped for `Postbox`/`Network` tokens and missed two Postbox-defined public-surface types: `EngineMessageHistoryThread.Info?` (on `threadInfo`) and `PeerStoryStats?` (on `storyStats`). The first-pass "drop `import Postbox`" attempt failed at build time. Rather than abandon, the wave split into 16a (move `EngineMessageHistoryThread` to TelegramCore — clean, independently valuable) and 16b (partial `engine:` collapse on `ItemListPeerItem`, keeping `import Postbox` because `PeerStoryStats` remains Postbox-defined).
**Wave 16a — move `EngineMessageHistoryThread` to TelegramCore.** Before: Postbox declared an empty `public final class EngineMessageHistoryThread` namespace with a nested `public final class Item`; TelegramCore's `ForumChannels.swift` added the `.Info` nested type via `public extension EngineMessageHistoryThread { final class Info … }`. The outer name's Postbox residency forced every consumer of `.Info` to `import Postbox` too. After: promote Postbox's internal `MutableMessageHistoryThreadIndexView.Item` to a top-level public type `MessageHistoryThreadIndexItem`; delete the empty `EngineMessageHistoryThread` class from Postbox; move the class shell into `ForumChannels.swift`, collapsing the existing extension into a proper class definition (`public final class EngineMessageHistoryThread { class Info … }`).
`MessageHistoryThreadIndexView.items` type changes from `[EngineMessageHistoryThread.Item]` to `[MessageHistoryThreadIndexItem]`; its init simplifies (no more wrap/unwrap conversion — the old init re-built items element-by-element just to swap the outer wrapper name). The second public extension on `EngineMessageHistoryThread` (`.NotificationException`, at `ForumChannels.swift:1318`) works unchanged — same-module extension after the class moves.
Zero consumer-site changes: the two Postbox-consumer iteration sites (`ChatListUI/Sources/Node/ChatListNodeLocation.swift:229`, `ShareController/Sources/ShareControllerNode.swift:2086`) iterate with `for item in view.items` (no type annotation) and access only fields that exist identically on both types (`id`, `info`, `index`, `pinnedIndex`, `tagSummaryInfo`, `topMessage`, `embeddedInterfaceState`).
Commit `3bb22d503c`. Net: 2 files, +67 / 111 (Postbox file nets 174 lines, TelegramCore file +4).
**Wave 16b — `ItemListPeerItem.Context` `engine:` collapse.** Wave-11 pattern applied to `ItemListPeerItem.Context.Custom`. Before: `Context.Custom.init(accountPeerId:, postbox: Postbox, network: Network, animationCache:, animationRenderer:, isPremiumDisabled:, resolveInlineStickers:)` + matching stored fields; `Context` had computed `postbox: Postbox` and `network: Network` that switched over the `.account` / `.custom` cases. After: `Context.Custom.init(accountPeerId:, engine: TelegramEngine, animationCache:, animationRenderer:, isPremiumDisabled:, resolveInlineStickers:)`; `Context` has one computed `engine: TelegramEngine` that returns `context.engine` for the `.account` case and `custom.engine` for the `.custom` case. Six internal forwards rewire from `item.context.postbox` / `item.context.network` to `item.context.engine.account.postbox` / `item.context.engine.account.network` (three `EmojiStatusComponent(postbox:…)` sites and three `AvatarNode.setPeer(…, postbox:…, network:…, …)` sites).
Handle choice: `engine:` (not `stateManager:`). The sole external `.custom(Custom(...))` construction site codebase-wide is `PeerInfoSettingsItems.swift:121` — main-app-only, doesn't cross the Share-Extension boundary. `peerAccountContext` in that loop is typed `AccountContext` (from the `accountsAndPeers: [(AccountContext, EnginePeer, Int32)]` field), so `.engine: TelegramEngine` is directly available. Per the standing guidance from `feedback_postbox_refactor_handle.md`, prefer `engine:` except when physically forced to `stateManager:` by a Share-Extension boundary.
All 37 other `ItemListPeerItem(…)` construction sites use the `.account(context: AccountContext)` convenience overload (at L485) and need no change. `PeerInfoScreenMemberItem.swift:223` forwards its own `context: ItemListPeerItem.Context` field straight through (pass-through) — no change.
Module does **not** become Postbox-free: `PeerStoryStats?` remains on the `storyStats` public-surface field. `PeerStoryStats` is defined in `Postbox/Sources/ChatListView.swift:281` and is deeply baked into Postbox view APIs (`PeerView.storyStats`, `PeerStoryStatsView.storyStats`, `ChatListEntry.storyStats`, `MessageHistoryView.peerStoryStats`, `Postbox.getPeerStoryStats(peerId:)`). Moving it would require a cross-module wrapper rewrite across Postbox, TelegramCore, and every view consumer — out of scope for wave 16.
Commit `a5432e44a8`. Net: 2 files, +17 / 30.
**Lessons.**
- **Public-surface inventory must go beyond the collapse-target tokens.** Waves 11/12/15's `stateManager`/`engine` collapses were clean because their target modules had no other Postbox-defined public types. Wave 16's planning inventory only grepped for `Postbox`/`Network` and missed `EngineMessageHistoryThread` + `PeerStoryStats` — both symbols whose names happen to not include `Postbox`. For future wave-11-pattern candidates, planning-time grep should include the full alphabet of Postbox-defined public types: `^public\s+(class|struct|enum|protocol|typealias)\s+\w+` over `submodules/Postbox/Sources/` to build an exhaustive type-name allowlist, then grep for any of those names in the candidate module's public surface.
- **"Engine"-prefixed types can still be Postbox-defined.** `EngineMessageHistoryThread` has an "Engine" prefix but was declared in Postbox all along; the `.Info` nested type living in TelegramCore was a code-organization half-measure that still forced `import Postbox` on consumers. Don't trust naming conventions; grep for the defining module.
- **Splitting a failing wave into a cleanup + a partial collapse is often the right move.** Wave 16 could have been abandoned entirely when the build failed — instead, the `EngineMessageHistoryThread` move (which had been a latent cleanup opportunity for the entire history of the `.Info` extension) was promoted to a standalone commit (16a), and the partial `engine:` collapse shipped as a second commit (16b). Both are independently valuable; the wave's "module becomes Postbox-free" goal didn't land but other goals did.
- **The "promote internal Postbox `Item` to top-level, drop Postbox wrapper class, move wrapper class to TelegramCore" pattern generalizes.** Any Postbox-defined class whose only role is to namespace a TelegramCore extension is a candidate for this move. Future audit target: `grep -l "public extension <ClassName>" submodules/TelegramCore/Sources/` where `<ClassName>` is a Postbox-defined outer type with no semantic content of its own.
Plan / record: `project_postbox_wave16_plan.md` (updated with outcome).
### Wave 17 outcome (2026-04-20)
Applies the wave-11/12/15 `stateManager: AccountStateManager` collapse pattern to `ItemListAvatarAndNameInfoItem` — another wave-1-era candidate. Module becomes fully Postbox-free (source + BUILD). Clean one-shot execution (no abandonment, no replan).
**`ItemListAvatarAndNameInfoItem.ItemContext` enum case collapsed.** Before: `case other(accountPeerId: EnginePeer.Id, postbox: Postbox, network: Network)` + matching destructure at L761 + `AvatarNode.setPeer(…, postbox: postbox, network: network, …)` internal forward. After: `case other(accountPeerId: EnginePeer.Id, stateManager: AccountStateManager)` + `case let .other(accountPeerId, stateManager):` destructure + `AvatarNode.setPeer(…, postbox: stateManager.postbox, network: stateManager.network, …)` forward. The `.accountContext(AccountContext)` sister case is unchanged.
**Share-Extension-boundary handle choice: `stateManager:`.** The sole external `.other(...)` construction site codebase-wide is `DeviceContactInfoController.swift:413`, inside a ternary that fires only when `arguments.context` is not a `ShareControllerAppAccountContext` — i.e., when running inside the Share Extension. `ShareControllerAccountContext` (protocol at `AccountContext/Sources/ShareController.swift:16`) exposes `stateManager: AccountStateManager` but not `engine: TelegramEngine`, and constructing a full `TelegramEngine` is physically unreachable in the Share Extension's `ShareControllerAccountContextExtension` impl (no `Account`). Per `feedback_postbox_refactor_handle.md` and the wave-15 precedent, use `stateManager:` at Share-Extension boundaries.
**Pre-flight inventory was correct.** Running the public-Postbox-type inventory grep returned only `Postbox` itself (the one enum-case payload leak) — no `EngineMessageHistoryThread`-style surprises. Wave 17 validates the post-wave-16 lesson: when planning-time inventory uses the full Postbox public-types allowlist (not just `Postbox`/`Network` tokens), wave-11-shape candidates execute cleanly.
**Single external caller migrated:**
- `PeerInfoUI/Sources/DeviceContactInfoController.swift:413``postbox: arguments.context.stateManager.postbox, network: arguments.context.stateManager.network``stateManager: arguments.context.stateManager`. The enclosing `PeerInfoUI` module still imports Postbox for its own unrelated reasons; that stays.
The 5 other `ItemListAvatarAndNameInfoItem(itemContext:…)` construction sites codebase-wide all use `.accountContext(arguments.context)` and need no change (`ChannelBannedMemberController.swift:321`, `DeviceContactInfoController.swift:415`, `ChannelAdminController.swift:370`, `CreateChannelController.swift:197`, `CreateGroupController.swift:324`).
**Pattern-consistency note (reinforced).** `accountPeerId: EnginePeer.Id` is kept as a separate enum-case payload even though `AccountStateManager` also exposes `accountPeerId`. This matches waves 11/12/15 (`ActionSheetPeerItem`, `ChatListSearchRecentPeersNode`, `SelectablePeerNode` all kept `accountPeerId` explicit alongside `stateManager`). Future wave-11-pattern executions should default to this shape unless a specific reason exists to collapse further.
Net: 3 files changed, +4 / -5 lines (ItemListAvatarAndNameItem.swift: +2 / -3, DeviceContactInfoController.swift: +1 / -1, BUILD: 1). Build verified green for target modules (`ItemListAvatarAndNameInfoItem`, `PeerInfoUI` both compiled and linked successfully); the one unrelated failing target in the full build (`ChatMessageInteractiveMediaNode.swift`) is user-uncommitted work-in-progress that predates this wave.
Plan / record: (plan doc `project_postbox_wave17_plan.md` deleted post-commit per the plan's own post-commit housekeeping instructions).
### Wave 18 outcome (2026-04-20)
Mixed-shape wave targeting `ItemListStickerPackItem`. Originally shortlisted (post-wave-17) as "likely wave-11 shape", but plan-writing-time inspection invalidated that hypothesis — the module's public API doesn't take `postbox:`/`network:`. Actual shape combined three existing wave patterns plus a narrow typealias addition. Module becomes fully Postbox-free (source + BUILD).
**Three narrow typealiases added to TelegramCore.** `submodules/TelegramCore/Sources/TelegramEngine/Utils/EnginePostboxCoding.swift` grew by 3 lines:
- `EngineItemCollectionId = ItemCollectionId` — needed at public closure-param positions.
- `EngineFetchResourceSourceType = FetchResourceSourceType` — needed at `var updatedFetchSignal` type annotation.
- `EngineFetchResourceError = FetchResourceError` — same.
Per CLAUDE.md rule 1 these narrow-utility typealiases are explicitly allowed (same shape as the existing `EngineMemoryBuffer`/`EnginePostboxDecoder`/… batch). Cheat sheet updated.
**Wave-4 enum-payload migration on `StickerPackThumbnailItem`.** Public enum case `animated(MediaResource, PixelDimensions, Bool, Bool)``animated(EngineMediaResource, PixelDimensions, Bool, Bool)`. Equatable `==` simplified: `lhsResource.isEqual(to: rhsResource)``lhsResource == rhsResource` (uses `EngineMediaResource.==` which has identical semantics). Two construction sites wrapped via `EngineMediaResource(thumbnail.resource)` / `EngineMediaResource(itemFile.resource)`. Two destructure-and-forward sites unwrap via `resource._asResource()` when handing off to `chatMessageStickerPackThumbnail(resource: MediaResource)` and `AnimatedStickerResourceSource(account:, resource: MediaResource, …)`. One `resource.id` site (for `shortLivedResourceCachePathPrefix`) needs the raw `MediaResourceId`, handled by a local `let rawResource = resource._asResource()` that serves both the `.id` read and the `AnimatedStickerResourceSource` init in the same block.
**Wave-3 facade swap.** `fetchedMediaResource(mediaBox: item.context.account.postbox.mediaBox, userLocation: .other, userContentType: .sticker, reference: resourceReference)``item.context.engine.resources.fetch(reference: resourceReference, userLocation: .other, userContentType: .sticker)`. Engine facade (`TelegramEngine.Resources.fetch`) already exists from wave 3; no new TelegramEngine API needed.
**External-caller check confirmed zero source edits needed.** `StickerPackThumbnailItem` has no external consumers (UndoUI declares its own nested-private same-named enum). The 6 external `ItemListStickerPackItem(setPackIdWithRevealedOptions:)` caller sites all pass closures with inferred param types; `EngineItemCollectionId` being a typealias to `ItemCollectionId` makes the types interchangeable. The 3 module-field declarations outside the target module that name `(ItemCollectionId?, ItemCollectionId?) -> Void` explicitly (`SettingsUI/Stickers/ArchivedStickerPacksController.swift:27`, `SettingsUI/Stickers/InstalledStickerPacksController.swift:27`, and the init at L32/L42 of those same files) compile unchanged — those modules still import Postbox for their own reasons, and `EngineItemCollectionId == ItemCollectionId` so no rename is required.
**BUILD dep dropped.** `//submodules/Postbox:Postbox` removed from `submodules/ItemListStickerPackItem/BUILD`.
**Pre-existing `ChatMessageInteractiveMediaNode.swift` WIP still present at build time — no longer failing.** The uncommitted change introduces an `allowSticker` validation around secret-chat sticker playback (~30 lines added in the `currentReplaceAnimatedStickerNode` block). Per wave-17's note it had failed to compile; on this wave's full build (`bazel build Telegram/Telegram`, 565 actions, 258s, 0 errors) it compiled and linked without issue. Either the user fixed it between waves 17 and 18, or the bazel dependency graph simply needed a full rebuild. Either way, wave 18's build was clean end-to-end — `Telegram.ipa` target built successfully, zero errors across the entire project.
**Pattern-consistency note.** Wave 18 is the third wave (after 3 and 9) where the cheapest path requires adding narrow TelegramCore-side typealiases rather than keeping `import Postbox` in the consumer. The threshold is: if the consumer needs to NAME a Postbox-defined type (not just use it via inference), and no engine-prefixed alias exists, adding a narrow typealias is preferred over `import Postbox`. The alternative of refactoring the code to avoid naming the type (e.g., reshaping `var foo: Signal<T, E>?` to infer from first assignment) is usually unwieldy when the var is conditionally-assigned; typealiases win on readability.
Net: 3 files changed.
- `submodules/TelegramCore/Sources/TelegramEngine/Utils/EnginePostboxCoding.swift`: +3 / -0.
- `submodules/ItemListStickerPackItem/Sources/ItemListStickerPackItem.swift`: ~13 lines touched across 9 sites; net +4 / -4.
- `submodules/ItemListStickerPackItem/BUILD`: 0 / -1.
- `CLAUDE.md`: +3 cheat-sheet lines + this outcome paragraph.
Plan / record: `memory/project_postbox_wave18_plan.md` (deleted post-commit per the plan's own housekeeping instructions).
### Wave 19 outcome (2026-04-20)
Single-facade expansion. Additive-only — adds `TelegramEngine.Resources.shortLivedResourceCachePathPrefix(id: EngineMediaResource.Id) -> String` at `submodules/TelegramCore/Sources/TelegramEngine/Resources/TelegramEngineResources.swift:456`. Body: `self.account.postbox.mediaBox.shortLivedResourceCachePathPrefix(MediaResourceId(id.stringRepresentation))`.
No consumer migrations this wave. Known consumers (≥25 call sites across ~15 modules: AvatarVideoNode, DrawingUI, SettingsUI/ThemePickerGridItem, PremiumUI/StickersCarouselComponent, ReactionSelectionNode, ReactionContextNode, ChatSendMessageActionUI, ItemListStickerPackItem, ChatThemeScreen, ThemeCarouselItem, PeerInfoBirthdayOverlay, SettingsThemeWallpaperNode, MediaEditorComposerEntity, ChatQrCodeScreen, ChatMessageAnimatedStickerItemNode, ChatMessageItemView, GiftCompositionComponent) migrate in a follow-up wave using the pattern `X.context.account.postbox.mediaBox.shortLivedResourceCachePathPrefix(Y.resource.id)``X.context.engine.resources.shortLivedResourceCachePathPrefix(id: EngineMediaResource.Id(Y.resource.id))`.
**Why not bundle consumer migration in the same wave?** Wave-3's original shape did bundle (3 facades + 1 full consumer module in one commit), but the consumer pool for this particular facade is large (~25 sites) and each call site only partially de-Postboxes its module — the caller modules need full inventory before deciding whether to drop `import Postbox`. Keeping wave 19 narrow (facade-only) lets follow-up waves approach consumer-module migration on a per-module basis without the facade-addition blocking anything.
Net: 1 file changed, +4 / -0.
Plan / record: (no plan doc this wave — single-method addition, target pre-identified in `project_postbox_refactor_next_wave.md`).
### Wave 20 outcome (2026-04-21)
Consumer sweep for the wave-19 `shortLivedResourceCachePathPrefix` facade. 22 call sites across 16 modules migrated atomically. Pattern (repeated identically at every site): `X.context.account.postbox.mediaBox.shortLivedResourceCachePathPrefix(Y.resource.id)``X.context.engine.resources.shortLivedResourceCachePathPrefix(id: EngineMediaResource.Id(Y.resource.id))`.
**Modules migrated (alphabetical):**
- `AvatarVideoNode/Sources/AvatarVideoNode.swift` (1 site)
- `ChatSendMessageActionUI/Sources/ChatSendMessageContextScreen.swift` (1 site)
- `DrawingUI/Sources/DrawingStickerEntityView.swift` (1 site)
- `ItemListStickerPackItem/Sources/ItemListStickerPackItem.swift` (1 site; simplified from wave-18's `let rawResource = resource._asResource(); …shortLivedResourceCachePathPrefix(rawResource.id)` + `AnimatedStickerResourceSource(…, resource: rawResource, …)` to `…shortLivedResourceCachePathPrefix(id: resource.id)` + `AnimatedStickerResourceSource(…, resource: resource._asResource(), …)` — drops the intermediate `let rawResource`)
- `PremiumUI/Sources/StickersCarouselComponent.swift` (2 sites)
- `ReactionSelectionNode/Sources/ReactionContextNode.swift` (2 sites)
- `ReactionSelectionNode/Sources/ReactionSelectionNode.swift` (6 sites — 4 unique expression templates, handled via targeted Edits against the unique argument expression at each call)
- `SettingsUI/Sources/ThemePickerGridItem.swift` (1 site)
- `TelegramUI/Components/Chat/ChatMessageAnimatedStickerItemNode/Sources/ChatMessageAnimatedStickerItemNode.swift` (2 sites)
- `TelegramUI/Components/Chat/ChatMessageItemView/Sources/ChatMessageItemView.swift` (1 site)
- `TelegramUI/Components/Chat/ChatQrCodeScreen/Sources/ChatQrCodeScreen.swift` (1 site)
- `TelegramUI/Components/ChatThemeScreen/Sources/ChatThemeScreen.swift` (1 site)
- `TelegramUI/Components/Gifts/GiftAnimationComponent/Sources/GiftCompositionComponent.swift` (3 sites)
- `TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoBirthdayOverlay.swift` (2 sites)
- `TelegramUI/Components/Settings/SettingsThemeWallpaperNode/Sources/SettingsThemeWallpaperNode.swift` (1 site)
- `TelegramUI/Components/Settings/ThemeCarouselItem/Sources/ThemeCarouselItem.swift` (1 site)
**One site intentionally skipped:** `TelegramUI/Components/MediaEditor/Sources/MediaEditorComposerEntity.swift:245`. That site uses a local `postbox: Postbox` init-parameter, not `context.account.postbox`, so the migration would require changing the init's parameter from `postbox:` to something engine-based and fanning out to its callers. Out of scope — handled by a future module-scoped wave.
**No modules became Postbox-free this wave.** Each of the 16 migrated modules still has other Postbox usage (raw `Postbox` types in signatures, `fetchedMediaResource(mediaBox:)` calls, `postbox.transaction`, etc.). Consumer-side `shortLivedResourceCachePathPrefix` closure is just one of several reasons these modules import Postbox. Future wave-shape: module-scoped de-Postbox per-module inventory.
**Pattern validation.** This is the most mechanical consumer sweep to date — all 22 sites followed identical shape, allowing `replace_all=true` for sites with duplicate identical call expressions (ReactionSelectionNode hit this at 3 sites for `largeListAnimation`, 2 for `stillAnimation`, 1 for `listAnimation`). First-pass build was clean (35 actions, 0 errors) — no iteration loop. Confirms the wave-19 facade shape is sound.
**Build verification.** `bazel build Telegram/Telegram --keep_going` — 2042 action cache hits + 35 new actions, 0 errors, `Telegram.ipa` up-to-date.
Net: 16 files changed, all edits mechanical (before → after): +22 insertions / -22 deletions at migrated sites, plus 1 deletion in ItemListStickerPackItem (wave-18 `let rawResource` line dropped). Approximate total: +22 / -23.
Plan / record: (no plan doc this wave — mechanical sweep).
### Wave 21 outcome (2026-04-21)
Combined wave-19+wave-20 shape: facade addition + consumer sweep in a single atomic commit. Adds `TelegramEngine.Resources.completedResourcePath(id: EngineMediaResource.Id, pathExtension: String? = nil) -> String?` facade; sweeps 29 consumer sites across 14 files.
**Facade added at `TelegramCore/Sources/TelegramEngine/Resources/TelegramEngineResources.swift:460`.** Body: `self.account.postbox.mediaBox.completedResourcePath(id: MediaResourceId(id.stringRepresentation), pathExtension: pathExtension)`. Wraps the Postbox `MediaBox.completedResourcePath(id: MediaResourceId, pathExtension: String?)` overload; consumers that previously called the resource-taking overload (`MediaBox.completedResourcePath(_ resource: MediaResource, …)`) migrate through the id path (`.resource.id` is already `MediaResourceId`).
**28 Shape-A consumer sites + 1 Shape-B (already-id-overload) migrated:**
- `SettingsUI/Sources/Themes/EditThemeController.swift` (1 site)
- `BrowserUI/Sources/BrowserPdfContent.swift` (1 site)
- `BrowserUI/Sources/BrowserDocumentContent.swift` (1 site)
- `GalleryUI/Sources/SecretMediaPreviewController.swift` (1 site)
- `TelegramUI/Components/MediaEditor/Sources/MediaEditor.swift` (1 site, `pathExtension: "mp4"`)
- `TelegramUI/Components/Settings/WallpaperGridScreen/Sources/WallpaperUtils.swift` (7 sites across 3 functions; 4 unique expression templates, handled via `replace_all=true` where identical)
- `TelegramUI/Components/Settings/ThemeAccentColorScreen/Sources/ThemeAccentColorController.swift` (1 site)
- `TelegramUI/Components/Settings/WallpaperGalleryScreen/Sources/WallpaperGalleryController.swift` (5 sites; 4 used `resource` expr identically via `replace_all=true`, 1 used `file.file.resource`)
- `TelegramUI/Components/MediaEditorScreen/Sources/MediaEditorScreen.swift` (1 site, `pathExtension: nil`)
- `TelegramUI/Components/Chat/ChatMessageWebpageBubbleContentNode/Sources/ChatMessageWebpageBubbleContentNode.swift` (1 site)
- `TelegramUI/Components/Chat/ChatMessageMediaBubbleContentNode/Sources/ChatMessageMediaBubbleContentNode.swift` (7 sites, all identical `telegramFile.resource` — handled via `replace_all=true`)
- `TelegramUI/Components/Chat/ChatMessageAttachedContentNode/Sources/ChatMessageAttachedContentNode.swift` (1 site)
- `TelegramUI/Sources/OpenChatMessage.swift` (1 site)
- `TelegramUI/Sources/Chat/ChatControllerMediaRecording.swift` (1 site)
- `TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryItemImageView.swift` (1 site, Shape B — was already using the `id:` overload; migrated identically to `EngineMediaResource.Id(...)`)
**8 sites intentionally skipped (Shape C/D).** Listed in the plan — 5 Shape-C sites that access a raw `account: Account` parameter (no `.engine` on `Account`) and 3 Shape-D sites that carry a local `postbox: Postbox` stored field. Both shapes need module-scoped init-signature rework rather than per-site sweep; defer to future waves.
**No modules became Postbox-free.** Each consumer has other Postbox usage (signatures, transactions, other mediaBox calls). Matches waves 19/20's expectation.
**Build validation.** `bazel build Telegram/Telegram --keep_going` — clean first-pass build (569 processes, 1556 action cache hits + 30 local + 532 worker, 240s, 0 errors, `Telegram.ipa` up-to-date).
**Pattern validation.** Wave-shape G (facade addition + consumer sweep in a single commit) works well when the consumer pool is bounded and mechanical. 29 sites in 14 files is comfortably within the threshold. Kept waves 19 and 20 separate because 25+ sites across that many modules was at the edge of reviewability; wave 21's similar fan-out fits because the plan pre-classified every site by shape. When the plan does the classification work upfront, combined waves are cheaper to review and ship.
Net: 14 files changed. TelegramEngineResources.swift: +4 / -0. Consumer files: +29 / -29 (mechanical rewrite at each site). CLAUDE.md: +outcome paragraph.
Plan / record: `memory/project_postbox_wave21_plan.md` (deleted post-commit per the plan's own housekeeping instructions).
### Wave 22 outcome (2026-04-21)
Follows wave 21's pattern: facade addition + consumer sweep in a single atomic commit. Adds `TelegramEngine.Resources.storeResourceData(id: EngineMediaResource.Id, data: Data, synchronous: Bool = false)` facade; sweeps 46 consumer sites across 17 files.
**Facade added at `TelegramCore/Sources/TelegramEngine/Resources/TelegramEngineResources.swift:464`.** Body: `self.account.postbox.mediaBox.storeResourceData(MediaResourceId(id.stringRepresentation), data: data, synchronous: synchronous)`. Wraps Postbox's `MediaBox.storeResourceData(_ id: MediaResourceId, data: Data, synchronous: Bool)` full-file overload. The range-store overload (`MediaBox.storeResourceData(_:range:data:)`) is used at a single site inside `HLSVideoJSNativeContentNode.swift:302` via a local `postbox: Postbox` field (Shape D), which is out of scope for this wave; the range overload gets no facade wrapper this round.
**46 Shape-A consumer sites migrated:**
- `ImportStickerPackUI/Sources/ImportStickerPackControllerNode.swift` (2)
- `DebugSettingsUI/Sources/DebugController.swift` (8 — 6 identical `gzippedData` batched via `replace_all=true`; `logData`, `allStatsData` handled individually)
- `BrowserUI/Sources/BrowserWebContent.swift` (1)
- `TelegramUI/Sources/CreateChannelController.swift` (4)
- `TelegramUI/Sources/CreateGroupController.swift` (4)
- `TelegramUI/Sources/Chat/ChatControllerPaste.swift` (1)
- `TelegramUI/Sources/Chat/ChatControllerOpenDocumentScanner.swift` (3)
- `TelegramUI/Sources/Chat/ChatControllerMediaRecording.swift` (2)
- `TelegramUI/Components/LegacyInstantVideoController/Sources/LegacyInstantVideoController.swift` (2)
- `TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoScreenAvatarSetup.swift` (2)
- `TelegramUI/Components/Settings/WallpaperGridScreen/Sources/WallpaperUtils.swift` (6 — 3 `thumbnailResource`, 3 `resource`; both handled via `replace_all=true`)
- `SettingsUI/Sources/Themes/ThemePreviewController.swift` (1)
- `SettingsUI/Sources/Themes/EditThemeController.swift` (1)
- `TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryItemSetContainerViewSendMessage.swift` (3)
- `TelegramUI/Components/VideoMessageCameraScreen/Sources/VideoMessageCameraScreen.swift` (2)
- `TelegramUI/Components/MediaEditorScreen/Sources/CreateLinkOptions.swift` (1)
- `TelegramUI/Components/MediaEditorScreen/Sources/MediaEditorScreen.swift` (3)
**Out of scope — not migrated this wave:**
- `accountManager.mediaBox.storeResourceData(...)` sites (Account-manager-scoped, not account-scoped) — 13+ sites across WallpaperGalleryItem, WallpaperGalleryController, ThemeAccentColorController, WallpaperUtils, WebBrowserSettingsController, ThemeUpdateManager, OpenResolvedUrl, and others. These are a different migration path entirely (not a `TelegramEngine.Resources.*` target) and stay raw.
- `account.postbox.mediaBox.storeResourceData(...)` (raw `Account`, no `AccountContext`) — ~9 sites in LegacyMediaPickerUI, TelegramCallsUI, InAppPurchaseManager, AuthorizationUI, PeerInfoScreenAvatarSetup closures, WallpaperResources. Shape C from wave-21 taxonomy. Needs per-module rework.
- `self.postbox.mediaBox.storeResourceData(...)` / `postbox.mediaBox.storeResourceData(...)` inside TelegramCore internals (`TransformOutgoingMessageMedia.swift`, `AccountStateManager.swift`, `AvailableReactions.swift`, `SaveSecureIdValue.swift`, `PeerPhotoUpdater.swift`, `NotificationSoundList.swift`, `Stories.swift`, `Authorization.swift`, `WebpagePreview.swift`). These are Postbox-internal layer by design — keep as-is.
- `HLSVideoJSNativeContentNode.swift:302` — uses the range-store overload via local `postbox: Postbox` field. Out of scope.
**No modules became Postbox-free.** Matches waves 19/20/21 expectation — each consumer has other Postbox usage.
**Build validation.** `bazel build Telegram/Telegram --keep_going` — clean first-pass build (571 processes, 1554 action cache hits + 30 local + 532 worker, 229s, 0 errors, `Telegram.ipa` up-to-date).
**Pattern validation.** Wave-shape G (facade + consumer sweep in one commit) scales well up to 46 sites in 17 files when the pattern is mechanical. Heavy `replace_all=true` usage where call-text is identical across sites (DebugController's 6 `gzippedData` sites, WallpaperUtils' 6 sites split into 2 batches by first-arg variable, ChatControllerOpenDocumentScanner's identical `(resource.id, data: data, synchronous: true)` pattern) keeps diff noise to the minimum. 46 sites, mostly done via replace_all + a few individual edits.
Net: 17 consumer files + 1 TelegramCore file + CLAUDE.md. TelegramEngineResources.swift: +4 / -0. Consumer files: +46 / -46 (mechanical rewrite).
Plan / record: (no plan doc this wave — mechanical sweep following wave-21 recipe).
### Wave 23 outcome (2026-04-21)
Smallest wave so far: `cancelInteractiveResourceFetch` facade addition + consumer sweep. Same shape as waves 21/22.
**Facade added at `TelegramCore/Sources/TelegramEngine/Resources/TelegramEngineResources.swift:468`.** Body: `self.account.postbox.mediaBox.cancelInteractiveResourceFetch(resourceId: MediaResourceId(id.stringRepresentation))`. Wraps Postbox's `MediaBox.cancelInteractiveResourceFetch(resourceId: MediaResourceId)` overload (the `_ resource: MediaResource` overload delegates to the id version anyway).
**5 of 7 Shape-A consumer sites migrated:**
- `PeerAvatarGalleryUI/Sources/PeerAvatarImageGalleryItem.swift` (1)
- `GalleryUI/Sources/Items/ChatAnimationGalleryItem.swift` (1)
- `GalleryUI/Sources/Items/ChatImageGalleryItem.swift` (1)
- `GalleryUI/Sources/Items/ChatDocumentGalleryItem.swift` (1)
- `GalleryUI/Sources/Items/ChatExternalFileGalleryItem.swift` (1)
**2 sites intentionally skipped:** `ChatMessageInteractiveMediaNode.swift:1474, 1709` — this file has pre-existing uncommitted WIP (the `allowSticker` validation around secret-chat sticker playback, carried forward since before wave 17). Editing the 2 sites would mix my wave-23 changes with the user's WIP in a single git diff, which `git add` can't cleanly separate. Deferred until the WIP lands or a narrow follow-up wave intentionally includes both. Note: a future wave that aims to drop those 2 sites should first either (a) wait for the WIP to be committed or (b) use `git stash --keep-index` + targeted edits + selective staging to split the diff cleanly.
**Pattern note on WIP interference.** This is the first wave to hit this failure mode — previous waves' mechanical sweeps happened not to touch `ChatMessageInteractiveMediaNode.swift`. Future sweeps should grep their candidate set against `git status`'s modified-files list before starting, and either (a) defer sites in WIP files, (b) wait for the WIP to commit, or (c) stage selectively via `git add --patch`-equivalent paths.
**Build validation.** `bazel build Telegram/Telegram --keep_going` — clean first-pass build (558 processes, 1567 action cache hits + 19 local + 532 worker, 236s, 0 errors, `Telegram.ipa` up-to-date).
Net: 5 consumer files + 1 TelegramCore file + CLAUDE.md. TelegramEngineResources.swift: +4 / -0. Consumer files: +5 / -5.
Plan / record: (no plan doc this wave — mechanical sweep).
### Wave 24 outcome (2026-04-21)
`moveResourceData` facade additions + consumer sweep. Same shape as waves 21-23.
**Two facades added at `TelegramCore/Sources/TelegramEngine/Resources/TelegramEngineResources.swift`:**
- `moveResourceData(id: EngineMediaResource.Id, toTempPath: String)` wraps the `(MediaResourceId, toTempPath:)` overload.
- `moveResourceData(from: EngineMediaResource.Id, to: EngineMediaResource.Id, synchronous: Bool = false)` wraps the `(from: MediaResourceId, to: MediaResourceId, synchronous:)` overload.
Postbox's third overload `(MediaResourceId, fromTempPath:)` has no consumer-side usage; no facade added this wave (YAGNI).
**6 Shape-A consumer sites migrated (5 files):**
- `TelegramUI/Sources/Chat/ChatControllerMediaRecording.swift` (1, `toTempPath:`)
- `TelegramUI/Sources/OverlayAudioPlayerController.swift` (1, `from:to:synchronous:`)
- `TelegramUI/Components/ComposePollScreen/Sources/ComposePollScreen.swift` (2)
- `TelegramUI/Components/Chat/ChatMessagePollBubbleContentNode/Sources/ChatMessagePollBubbleContentNode.swift` (2)
**Build validation.** `bazel build Telegram/Telegram --keep_going` — clean first-pass build (563 processes, 272s, 0 errors).
Net: 5 consumer files + 1 TelegramCore file + CLAUDE.md. TelegramEngineResources.swift: +8 / -0. Consumer files: +6 / -6.
Plan / record: (no plan doc this wave — mechanical sweep).
### Wave 25 outcome (2026-04-21)
`copyResourceData` facade additions + consumer sweep. Same shape as waves 21-24.
**Two facades added:** `copyResourceData(id: EngineMediaResource.Id, fromTempPath: String)` and `copyResourceData(from: EngineMediaResource.Id, to: EngineMediaResource.Id, synchronous: Bool = false)`.
**4 Shape-A consumer sites migrated (3 files):**
- `PeerAvatarGalleryUI/Sources/AvatarGalleryController.swift` (2, `from:to:synchronous:`)
- `ImportStickerPackUI/Sources/ImportStickerPackControllerNode.swift` (1, `from:to:` — simplified from `localResource._asResource().id` to `localResource.id` since operands are `EngineMediaResource`)
- `TelegramUI/Sources/Chat/ChatControllerPaste.swift` (1, `id:fromTempPath:`)
**Minor simplification lesson.** When a consumer already has an `EngineMediaResource`-typed local (e.g., from a wave-18-migrated callee), prefer `localResource.id` over `EngineMediaResource.Id(localResource._asResource().id)` — the two are semantically equivalent since `EngineMediaResource.id` is defined as `Id(self.resource.id)`. This halves the verbosity at the call site and removes a redundant unwrap-and-rewrap.
**Build validation.** Clean first-pass build (563 processes, 242s, 0 errors).
Net: 3 consumer files + 1 TelegramCore file + CLAUDE.md. TelegramEngineResources.swift: +8 / -0.
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:
@ -290,12 +728,59 @@ Consumer modules that no longer import Postbox, across all waves and standalone
- `SecureIdVerificationDocumentsContext` (wave 5)
- **Wave 6 batch: 189 additional modules** — see `git show 7b2b74e79b --stat` for the commit that swept unused `import Postbox` lines across 183 files in 16 consumer submodules. Not individually enumerated here for brevity.
- `StorageUsageScreen` (waves 810)
- `ActionSheetPeerItem` (wave 11; revisits wave-1 abandonment)
- `HorizontalPeerItem` (wave 12; applies wave-11 pattern)
- `SelectablePeerNode` (wave 15; applies wave-11 pattern; ShareExtension-boundary stateManager fallback)
- `ItemListAvatarAndNameInfoItem` (wave 17; applies wave-11 pattern; ShareExtension-boundary stateManager fallback)
- `ItemListStickerPackItem` (wave 18; mixed-shape — 3 narrow TelegramCore typealiases + wave-4 enum-payload migration + wave-3 facade swap)
- `AttachmentTextInputPanelNode` BUILD cleanup (wave 13; source was already clean from wave 6)
- **Wave 14 BUILD-dep sweep: 98 modules' BUILDs cleaned** — same modules as the wave-6 batch; this sweep fixed their leftover `//submodules/Postbox:Postbox` BUILD deps. Candidate list in `/tmp/postbox-dep-candidates.txt` at commit time; derivable by the script in "Wave 14 outcome".
### TelegramEngine.Resources facade inventory (as of wave 26)
All mediaBox methods with clean signatures (no Postbox-protocol leaks, no complex return-type migrations) have been migrated to `TelegramEngine.Resources`. Quick reference for consumers — all of these live in `submodules/TelegramCore/Sources/TelegramEngine/Resources/TelegramEngineResources.swift`:
| Facade | Wave | Wraps |
|---|---|---|
| `fetch(reference:userLocation:userContentType:)` | 3 | `fetchedMediaResource` |
| `status(resource:)` | 3 | `MediaBox.resourceStatus` |
| `data(resource:, pathExtension:, waitUntilFetchStatus:)` | 3 | `MediaBox.resourceData` (resource-based) |
| `data(id:, attemptSynchronously:)` | 3 | `MediaBox.resourceData` (id-based, defaults to `.complete(waitUntilFetchStatus: false)`) |
| `custom(id:, fetch:, cacheTimeout:, attemptSynchronously:)` | pre-wave-21 | `MediaBox.customResourceData` |
| `httpData(url:, preserveExactUrl:)` | pre-wave-21 | `fetchHttpResource` |
| `shortLivedResourceCachePathPrefix(id:)` | 19 | `MediaBox.shortLivedResourceCachePathPrefix` |
| `completedResourcePath(id:, pathExtension:)` | 21 | `MediaBox.completedResourcePath(id:, pathExtension:)` |
| `storeResourceData(id:, data:, synchronous:)` | 22 | `MediaBox.storeResourceData(_ id:, data:, synchronous:)` |
| `cancelInteractiveResourceFetch(id:)` | 23 | `MediaBox.cancelInteractiveResourceFetch(resourceId:)` |
| `moveResourceData(id:, toTempPath:)` | 24 | `MediaBox.moveResourceData(_ id:, toTempPath:)` |
| `moveResourceData(from:, to:, synchronous:)` | 24 | `MediaBox.moveResourceData(from:, to:, synchronous:)` |
| `copyResourceData(id:, fromTempPath:)` | 25 | `MediaBox.copyResourceData(_ id:, fromTempPath:)` |
| `copyResourceData(from:, to:, synchronous:)` | 25 | `MediaBox.copyResourceData(from:, to:, synchronous:)` |
| `resourceRangesStatus(resource:)` | 26 | `MediaBox.resourceRangesStatus(_ resource:)` |
| `removeCachedResources(ids:, force:, notify:)` | 26 | `MediaBox.removeCachedResources(_ ids:, force:, notify:)` |
**Facade-shape convention:** all of these take `EngineMediaResource.Id` or `EngineMediaResource` (never raw `MediaResourceId`/`MediaResource`). Return types either don't leak Postbox (`Void`, `String`, `String?`, `Signal<RangeSet<Int64>, NoError>`, `Signal<Float, NoError>`) or wrap via TelegramCore type (`Signal<EngineMediaResource.ResourceData, NoError>`).
**Swift-stdlib-vs-third-party-module name collisions** (learned in wave 26): `RangeSet<Int64>` collides with Swift stdlib's `RangeSet` (iOS 18+ only). Fix: `import RangeSet` at the file top of any TelegramCore file that names `RangeSet` in a signature. `TelegramCore/BUILD` already depends on `//submodules/Utils/RangeSet:RangeSet`. Future facade additions in TelegramEngineResources.swift should re-check this if new signature types are introduced.
### Known future-wave candidates
Surfaced by the wave-2 final review:
**Permanently blocked** (surfaced by the wave-2 final review):
- 4 classes conforming to `TelegramMediaResource` that override `isEqual(to: MediaResource)`: `ICloudFileResource`, `InstantPageExternalMediaResource`, `VideoLibraryMediaResource`, `YoutubeEmbedStoryboardMediaResource`. Either move the class into `TelegramCore` or keep `import Postbox` in its module.
- Classes conforming to `TelegramMediaResource` (need `isEqual(to: MediaResource)` override) remain **permanently blocked** from consumer-side migration: `ICloudFileResource`, `InstantPageExternalMediaResource`, `VideoLibraryMediaResource`, `YoutubeEmbedStoryboardMediaResource`. Either move the class into `TelegramCore` or keep `import Postbox` in its module.
**Higher-friction mediaBox methods** (not yet migrated, as of wave 26):
- `cachedResourceRepresentation`, `cachedRepresentationCompletePath`, `storeCachedResourceRepresentation` — ~9 sites total. All take `CachedMediaResourceRepresentation` (Postbox protocol) as a parameter, so any facade either leaks the protocol or requires moving the protocol (plus every concrete conformer like `CachedPreparedSvgRepresentation`, `CachedVideoFirstFrameRepresentation`, `CachedScaledImageRepresentation`) into TelegramCore. Also: `cachedResourceRepresentation` returns `Signal<MediaResourceData, NoError>` which consumers currently access via `.path`/`.size`/`.complete` — facade would return `Signal<EngineMediaResource.ResourceData, NoError>` (fields become `.path`/`.availableSize`/`.isComplete`), each consumer call site needs per-site field-access rewrite.
- `resourceData` (raw) consumer sweep — ~29 sites. Existing facades at lines 291 and 443 return `EngineMediaResource.ResourceData` not `MediaResourceData`. Same field-access-rewrite cost per site as above.
- `resourceStatus` consumer sweep — ~26 sites. Facade at line 436 returns `EngineMediaResource.FetchStatus` not raw `MediaResourceStatus`. Consumers pattern-match on cases like `.Local`, `.Remote`, `.Fetching`, `.Paused` — engine wrapper has the same case names (confirm per site), so pattern migrations are usually 1:1 but need inspection.
- `storageBox.totalSize()` / `storageBox.reset()` / `cacheStorageBox.totalSize()` — 6 sites. Wrapping `storageBox`/`cacheStorageBox` would require exposing a narrow `EngineResourceStorageBox` class; probably its own small wave.
**Non-mediaBox, established pattern (wave 9 pattern):**
- `preferencesView` consumer sweep — ~36 sites. Pattern: `postbox.combinedView(keys: [.preferences(keys: Set([<key>]))]) + PreferencesView``engine.data.subscribe(TelegramEngine.EngineData.Item.Configuration.ApplicationSpecificPreference(key: <key>))`. Each site needs analysis to confirm what's subscribed and how values are extracted.
- `loadedPeerWithId` — ~59 sites. Engine pattern: `engine.data.get(TelegramEngine.EngineData.Item.Peer.Peer(id:))`. Many sites inside `transaction` blocks can't use the Signal pattern and need different handling.
**Standalone Postbox-class-move opportunities** (wave-16a pattern): audit `submodules/TelegramCore/Sources/` for `public extension <ClassName>` where `<ClassName>` is a Postbox-defined outer class with no semantic content. `EngineMessageHistoryThread` was the prototype (wave 16a).
**Unused-import sweep re-run** (wave-6 pattern): after every 2-3 facade-migration waves, run the source-level `import Postbox` sweep methodology. After waves 21-26 added 15+ facades covering ~95 consumer sites, a fresh sweep could peel off modules whose last Postbox coupling was one of the migrated methods. Script in "Wave 14 outcome" above identifies candidates; run it, speculatively drop, iterate build.
(The seven `TelegramEngine.*` facade leaks surfaced by the 2026-04-20 post-wave-6 scouting pass — `downloadMessage`, `topPeerActiveLiveLocationMessages`, `getSynchronizeAutosaveItemOperations`, `updatedRemotePeer`, `renderStorageUsageStatsMessages`, and three `clearStorage` overloads — landed in wave 7; see "Wave 7 outcome" above.)

View file

@ -0,0 +1,195 @@
# SwiftTL — Optional Layered Schema Generation
**Date:** 2026-04-21
**Tool:** `build-system/SwiftTL`
**Inputs this unblocks:** `telegram-ios-shared/tools/secret_scheme.tl`, invoked by `telegram-ios-shared/tools/generate_and_copy_scheme.sh` with `--api-prefix=SecretApi`.
**Consumers this targets:** `submodules/TelegramCore/Sources/State/ManagedSecretChatOutgoingOperations.swift`, `submodules/TelegramCore/Sources/State/ProcessSecretChatIncomingDecryptedOperations.swift` — both reference `SecretApi{8,46,73,101,144}.<Type>.<ctor>`, symbols currently provided by hand-maintained `submodules/TelegramApi/Sources/SecretApiLayer{8,46,73,101,144}.swift` files.
## Problem
`SwiftTL` parses a flat `.tl` schema and emits one flat `Api` namespace. `secret_scheme.tl` is not flat — it's a multi-version schema separated by `===N===` layer markers (11 layers: 8, 17, 20, 23, 45, 46, 66, 73, 101, 143, 144), where the same constructor name can reappear in later layers with a new constructor ID and new fields (e.g. `decryptedMessage` exists at layers 8, 17, 45, 73, each with a different ID and argument list).
Running `SwiftTL secret_scheme.tl … --api-prefix=SecretApi` today fails: `DescriptionParser` doesn't recognize `===N===` markers, and `Resolver` throws on the first duplicate constructor name. The secret-chat `SecretApi{N}.<Type>.<ctor>` structs that downstream code already uses are hand-maintained and out-of-sync with what SwiftTL would naturally produce.
## Goal
Extend `SwiftTL` with optional layered-schema support so that `secret_scheme.tl` round-trips through the same CLI: one invocation produces one Swift file per declared layer. Flat schemas (`swift_scheme.tl`) continue to produce byte-identical output.
Non-goal: a complete rewrite of the legacy hand-written `SecretApiLayer*.swift` format. Output is "close enough" — same sum-type enums, same constructor IDs, same serialize/parse bodies — not byte-for-byte identical to the legacy files. Existing consumers compile unchanged because they reference the public symbols (`SecretApi8.DecryptedMessage.decryptedMessage(...)`), which the generator preserves.
## Architecture
Four files change in `build-system/SwiftTL/Sources/SwiftTL/`. No new files, no new CLI flags.
### `DescriptionParsing.swift`
The public `parse(data:)` return type changes from a tuple `(constructors, functions)` to a new enum:
```swift
enum ParsedSchema {
case flat(constructors: [ConstructorDescription], functions: [ConstructorDescription])
case layered(layers: [(layerNumber: Int, constructors: [ConstructorDescription])])
}
```
**Detection rule.** If any non-empty line matches the regex `^===\d+===\s*$`, the schema is layered. Every non-skipped constructor must sit under a marker; constructors appearing before the first marker are attached to the lowest-numbered layer. Otherwise the schema is flat (today's behavior, unchanged).
**Input validation** (only enforced in the layered branch):
- Layer numbers must be positive integers and appear in strictly ascending order in the source. Parser throws otherwise.
- `---functions---` is forbidden in layered mode. Parser throws if seen.
- Empty layers (marker followed immediately by the next marker or EOF) are allowed. They produce an output file whose cumulative snapshot is identical to the previous layer's.
The existing `skipPrefixes` / `skipContains` filter (for `true`, `vector`, `error`, `null`, `{X:Type}`) applies unchanged to both branches.
### `Resolution.swift`
A new static method on `Resolver`:
```swift
static func resolveLayeredTypes(
layers: [(layerNumber: Int, constructors: [DescriptionParser.ConstructorDescription])]
) throws -> [(layerNumber: Int, types: [SumType])]
```
Algorithm — walks layers in input order, maintaining a running map `constructorsByName: [QualifiedName: (typeName: QualifiedName, constructor: DescriptionParser.ConstructorDescription)]`. For each layer:
1. For each constructor in the layer: if the name already exists in the running map with a different target type, remove it from the old type's entry before inserting under the new target type.
2. Insert or overwrite the constructor in the running map.
3. At the end of the layer section, build `[SumType]` from the current running map by grouping constructors by their target type and resolving argument type references (same machinery `resolveTypes(constructors:)` already uses, factored into shared helpers).
The output preserves per-layer IDs: layer 8's `decryptedMessage` has ID `0x1f814f1f`, layer 17's has `0x204d3878`, layer 46's has `0x36b091de`, layer 73's has `0x91cc4674` — each landing in its own independent `[SumType]` snapshot.
The existing `resolveTypes(constructors:)` and `resolveFunctions(…)` stay unchanged for the flat path.
### `CodeGeneration.swift`
A new static method on `CodeGenerator`:
```swift
static func generateLayered(
apiPrefix: String,
layerNumber: Int,
types: [SumType]
) throws -> (filename: String, source: String)
```
Returns filename `"\(apiPrefix)Layer\(layerNumber).swift"` and a source string in the shape described below. Reuses the existing private helpers `typeReferenceRepresentation`, `generateFieldSerialization`, `generateFieldParsing`, and `SumType.hasDirectReference(to:typeMap:)` unchanged — the per-argument serialize/parse logic is byte-identical between flat and layered output.
The flat `CodeGenerator.generate(…)` entry point is untouched.
### `main.swift`
Branches on the parser's return value:
```swift
switch try DescriptionParser.parse(data: data) {
case let .flat(constructors, functions):
// existing flow, unchanged
case let .layered(layers):
let resolved = try Resolver.resolveLayeredTypes(layers: layers)
try FileManager.default.createDirectory(
at: URL(fileURLWithPath: outputDirectoryPath),
withIntermediateDirectories: true)
for (layerNumber, types) in resolved {
let (filename, source) = try CodeGenerator.generateLayered(
apiPrefix: apiPrefix, layerNumber: layerNumber, types: types)
let filePath = URL(fileURLWithPath: outputDirectoryPath)
.appendingPathComponent(filename).path
_ = try? FileManager.default.removeItem(atPath: filePath)
try source.write(toFile: filePath, atomically: true, encoding: .utf8)
}
}
```
## Layer semantics
For each emitted layer `N`, the effective constructor set is the ordered union of all constructors declared in layers `L ≤ N`, where a constructor with a given `QualifiedName` in a later layer **replaces** the earlier entry (new ID, new arguments, potentially new target sum type). The latest winner is the only one that appears in layer `N`'s output; earlier IDs are not included in layer `N`'s dispatch table.
Constructors declared only in layers `> N` do not appear in layer `N`.
Pre-marker constructors (e.g. `boolFalse`, `boolTrue` in `secret_scheme.tl`) are attached to the lowest-numbered layer. Rationale: (1) keeps the rule uniform ("every constructor belongs to exactly one declared layer"), (2) matches the natural reading of the schema file, (3) has no observable effect today since no downstream consumer references `Bool` from a secret-schema layer.
## Output format (per layer)
Matches the shape of the existing hand-written `SecretApiLayer{N}.swift` files. One file per layer, named `{apiPrefix}Layer{N}.swift`.
```
<leading blank line>
fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
var dict: [Int32 : (BufferReader) -> Any?] = [:]
dict[-1471112230] = { return $0.readInt32() }
dict[570911930] = { return $0.readInt64() }
dict[571523412] = { return $0.readDouble() }
dict[-1255641564] = { return parseString($0) }
// dict[0x0929C32F] = { return parseInt256($0) } — emitted iff any constructor
// in this layer's cumulative snapshot has a field of type Int256.
dict[<sid>] = { return {apiPrefix}{N}.<TypeName>.parse_<ctorName>($0) }
// ... one entry per (latest) constructor in the cumulative snapshot
return dict
}()
public struct {apiPrefix}{N} {
public static func parse(_ buffer: Buffer) -> Any? { ... }
fileprivate static func parse(_ reader: BufferReader, signature: Int32) -> Any? { ... }
fileprivate static func parseVector<T>(_ reader: BufferReader, elementSignature: Int32, elementType: T.Type) -> [T]? { ... }
public static func serializeObject(_ object: Any, buffer: Buffer, boxed: Swift.Bool) { ... }
public enum <TypeName1> { /* cases, serialize, parse_* */ }
public enum <TypeName2> { ... }
// ...
}
```
**Deliberate differences from the flat-mode `Api0/1/….swift` output:**
- Single file instead of `Api0` header + `Api{1..N}` sharded impl files.
- `public struct` for the namespace instead of `public enum`.
- Nested `public enum <TypeName>` declarations instead of extensions.
- No `Cons_*` helper classes; enum cases use the inline-args shape — i.e. `case decryptedMessage(randomId: Int64, randomBytes: Buffer, message: String, media: …)`. Note the flat generator has a dormant inline-args branch guarded by `useStructPattern = false` that is never taken today; the layered generator renders this shape directly rather than sharing that branch.
- No `descriptionFields()` method, no `TypeConstructorDescription` conformance on the enums.
- `parse_*` methods are `fileprivate`, not `public static`.
- No `---functions---` section (rejected upstream).
The `indirect` keyword is still emitted when a type transitively references itself, via the existing `SumType.hasDirectReference(to:typeMap:)` helper.
## CLI
Unchanged. `swift run SwiftTL <schema> <outputDir> [--api-prefix=<prefix>]`. Layered behavior auto-triggers on `===N===` marker presence. With `--api-prefix=SecretApi` on `secret_scheme.tl`, SwiftTL emits 11 files: `SecretApiLayer{8,17,20,23,45,46,66,73,101,143,144}.swift`.
## Out-of-scope follow-ups
### `generate_and_copy_scheme.sh`
Lives in `telegram-ios-shared/tools/` (sibling repo). Currently invokes SwiftTL on both schemas but only copies `NewScheme/Api*.swift` into `submodules/TelegramApi/Sources/`. After this SwiftTL change lands, the script gains:
```sh
rm -f ../../telegram-ios/submodules/TelegramApi/Sources/SecretApiLayer*.swift
cp NewSecretScheme/SecretApiLayer*.swift ../../telegram-ios/submodules/TelegramApi/Sources/
```
The SwiftTL change produces the right files; the shell-script wiring is a follow-up commit in the sibling repo.
### `submodules/TelegramApi/BUILD`
If `submodules/TelegramApi/BUILD` lists the existing `SecretApiLayer{8,46,73,101,144}.swift` explicitly, it must be updated to include the 6 new layer files (17, 20, 23, 45, 66, 143) before the project will build. Implementation step: grep BUILD for `SecretApiLayer` at the start of implementation — if explicit, either add the 6 new file entries or switch to a `glob(["Sources/SecretApiLayer*.swift"])` pattern, in the same commit that introduces the files.
## Verification
No unit tests exist in this repo (per `CLAUDE.md`). Verification steps:
1. **Layered schema compiles.** `swift run SwiftTL <path>/secret_scheme.tl /tmp/out --api-prefix=SecretApi` succeeds and produces 11 files.
2. **Generated files match legacy by semantics.** Spot-check `SecretApiLayer8.swift`, `SecretApiLayer46.swift`, `SecretApiLayer73.swift`, `SecretApiLayer101.swift`, `SecretApiLayer144.swift` against their hand-written counterparts in `submodules/TelegramApi/Sources/`. Confirm:
- Same set of enum case names per sum type.
- Same constructor IDs in the dispatch table (latest per name only).
- Same argument ordering and types.
- Same indirect-ness for self-referential types.
Cosmetic differences (whitespace, per-helper indentation quirks, absence of `Cons_*`) are acceptable.
3. **Project builds.** Copy the generated files over the hand-written ones in `submodules/TelegramApi/Sources/`, run the full Bazel build (`source ~/.zshrc 2>/dev/null; Make.py build --continueOnError`), and confirm zero compilation errors. `ManagedSecretChatOutgoingOperations.swift` and `ProcessSecretChatIncomingDecryptedOperations.swift` reference `SecretApi{8,46,73,101,144}.<Type>.<ctor>` symbols that the generator preserves.
4. **Flat schema is unchanged.** `swift run SwiftTL <path>/swift_scheme.tl /tmp/out-main` succeeds; diff the generated `Api*.swift` against `submodules/TelegramApi/Sources/Api*.swift`. Expected: byte-identical (flat codepath untouched).
## Risks
- **Legacy-file semantic drift.** The hand-written `SecretApiLayer*.swift` files may contain micro-deviations from what the schema strictly implies (a constructor sneaked in by hand, an ID typo, an argument order tweak). Any such deviations will surface as compile or runtime-parse errors after regeneration. Mitigation: verification step 2 surfaces these before building; if found, the spec takes the schema as authoritative — legacy hand-edits get reverted, not preserved.
- **BUILD glob vs. explicit file list.** If BUILD lists files explicitly, adding the 6 new layer files (17, 20, 23, 45, 66, 143) requires a BUILD update in the same commit. Verification step during implementation.
- **Pre-marker constructor attribution.** `boolFalse`/`boolTrue` land in layer 8 under the spec. If the existing hand-written `SecretApiLayer8.swift` does not contain `Bool` (likely, since no consumer references it), the generator will add a nested `public enum Bool { case boolFalse; case boolTrue }` to layer-8 (and cumulatively to every subsequent layer) and two entries to each cumulative layer's dispatch dict. Harmless addition — build unaffected; diff noise only.

View file

@ -11,7 +11,6 @@ swift_library(
],
deps = [
"//submodules/TelegramCore:TelegramCore",
"//submodules/Postbox",
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
"//submodules/Display:Display",
"//submodules/AvatarNode:AvatarNode",

View file

@ -3,15 +3,13 @@ import UIKit
import AsyncDisplayKit
import Display
import TelegramCore
import Postbox
import TelegramPresentationData
import AvatarNode
import AccountContext
public class ActionSheetPeerItem: ActionSheetItem {
public let accountPeerId: EnginePeer.Id
public let postbox: Postbox
public let network: Network
public let stateManager: AccountStateManager
public let contentSettings: ContentSettings
public let peer: EnginePeer
public let theme: PresentationTheme
@ -19,12 +17,11 @@ public class ActionSheetPeerItem: ActionSheetItem {
public let isSelected: Bool
public let strings: PresentationStrings
public let action: () -> Void
public convenience init(context: AccountContext, peer: EnginePeer, title: String, isSelected: Bool, strings: PresentationStrings, theme: PresentationTheme, action: @escaping () -> Void) {
self.init(
accountPeerId: context.account.peerId,
postbox: context.account.postbox,
network: context.account.network,
stateManager: context.account.stateManager,
contentSettings: context.currentContentSettings.with { $0 },
peer: peer,
title: title,
@ -34,11 +31,10 @@ public class ActionSheetPeerItem: ActionSheetItem {
action: action
)
}
public init(
accountPeerId: EnginePeer.Id,
postbox: Postbox,
network: Network,
stateManager: AccountStateManager,
contentSettings: ContentSettings,
peer: EnginePeer,
title: String,
@ -48,8 +44,7 @@ public class ActionSheetPeerItem: ActionSheetItem {
action: @escaping () -> Void
) {
self.accountPeerId = accountPeerId
self.postbox = postbox
self.network = network
self.stateManager = stateManager
self.contentSettings = contentSettings
self.peer = peer
self.title = title
@ -154,7 +149,7 @@ public class ActionSheetPeerItemNode: ActionSheetItemNode {
let textColor: UIColor = self.theme.primaryTextColor
self.label.attributedText = NSAttributedString(string: item.title, font: defaultFont, textColor: textColor)
self.avatarNode.setPeer(accountPeerId: item.accountPeerId, postbox: item.postbox, network: item.network, contentSettings: item.contentSettings, theme: item.theme, peer: item.peer)
self.avatarNode.setPeer(accountPeerId: item.accountPeerId, postbox: item.stateManager.postbox, network: item.stateManager.network, contentSettings: item.contentSettings, theme: item.theme, peer: item.peer)
self.checkNode.isHidden = !item.isSelected

View file

@ -13,7 +13,6 @@ swift_library(
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
"//submodules/Display:Display",
"//submodules/Postbox:Postbox",
"//submodules/TelegramCore:TelegramCore",
"//submodules/TelegramPresentationData:TelegramPresentationData",
"//submodules/TextFormat:TextFormat",

View file

@ -433,7 +433,7 @@ public class AttachmentTextInputPanelNode: ASDisplayNode, TGCaptionPanelView, AS
self.animationRenderer = context.animationRenderer
var hasSpoilers = true
if presentationInterfaceState.chatLocation.peerId?.namespace == Namespaces.Peer.SecretChat {
if presentationInterfaceState.chatLocation.peerId?.isSecretChat == true {
hasSpoilers = false
}
self.inputMenu = TextInputMenu(hasSpoilers: hasSpoilers)
@ -2099,7 +2099,7 @@ public class AttachmentTextInputPanelNode: ASDisplayNode, TGCaptionPanelView, AS
]
var hasSpoilers = true
if self.presentationInterfaceState?.chatLocation.peerId?.namespace == Namespaces.Peer.SecretChat {
if self.presentationInterfaceState?.chatLocation.peerId?.isSecretChat == true {
hasSpoilers = false
}

View file

@ -12,7 +12,6 @@ swift_library(
deps = [
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
"//submodules/Display:Display",
"//submodules/Postbox:Postbox",
"//submodules/TelegramCore:TelegramCore",
"//submodules/TelegramPresentationData:TelegramPresentationData",
"//submodules/AnimationUI:AnimationUI",

View file

@ -229,7 +229,7 @@ public final class AvatarVideoNode: ASDisplayNode {
if isVisible, let animationNode = self.animationNode, let file = self.animationFile {
if !self.didSetupAnimation {
self.didSetupAnimation = true
let pathPrefix = self.context.account.postbox.mediaBox.shortLivedResourceCachePathPrefix(file.resource.id)
let pathPrefix = self.context.engine.resources.shortLivedResourceCachePathPrefix(id: EngineMediaResource.Id(file.resource.id))
let dimensions = file.dimensions ?? PixelDimensions(width: 512, height: 512)
let fittedDimensions = dimensions.cgSize.aspectFitted(CGSize(width: 384.0, height: 384.0))
let source = AnimatedStickerResourceSource(account: self.context.account, resource: file.resource, isVideo: file.isVideoSticker || file.mimeType == "video/webm")

View file

@ -62,7 +62,7 @@ final class BrowserDocumentContent: UIView, BrowserContent, WKNavigationDelegate
var title: String = "file"
var url = ""
if let path = self.context.account.postbox.mediaBox.completedResourcePath(file.media.resource) {
if let path = self.context.engine.resources.completedResourcePath(id: EngineMediaResource.Id(file.media.resource.id)) {
var updatedPath = path
if let fileName = file.media.fileName {
let tempFile = TempBox.shared.file(path: path, fileName: fileName)

View file

@ -82,7 +82,7 @@ final class BrowserPdfContent: UIView, BrowserContent, UIScrollViewDelegate, PDF
var title = "file"
var url = ""
if let path = self.context.account.postbox.mediaBox.completedResourcePath(file.media.resource) {
if let path = self.context.engine.resources.completedResourcePath(id: EngineMediaResource.Id(file.media.resource.id)) {
var updatedPath = path
if let fileName = file.media.fileName {
let tempFile = TempBox.shared.file(path: path, fileName: fileName)

View file

@ -1673,7 +1673,7 @@ final class BrowserWebContent: UIView, BrowserContent, WKNavigationDelegate, WKU
if let favicon, let imageData = favicon.pngData() {
let resource = LocalFileMediaResource(fileId: Int64.random(in: Int64.min ... Int64.max))
self.context.account.postbox.mediaBox.storeResourceData(resource.id, data: imageData)
self.context.engine.resources.storeResourceData(id: EngineMediaResource.Id(resource.id), data: imageData)
image = TelegramMediaImage(
imageId: MediaId(namespace: Namespaces.Media.LocalImage, id: Int64.random(in: Int64.min ... Int64.max)),
representations: [

View file

@ -14,7 +14,6 @@ swift_library(
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
"//submodules/ComponentFlow:ComponentFlow",
"//submodules/Postbox:Postbox",
"//submodules/TelegramCore:TelegramCore",
"//submodules/AccountContext:AccountContext",
"//submodules/TelegramPresentationData:TelegramPresentationData",

View file

@ -14,7 +14,6 @@ swift_library(
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
"//submodules/Display:Display",
"//submodules/TelegramPresentationData:TelegramPresentationData",
"//submodules/Postbox:Postbox",
"//submodules/TelegramCore:TelegramCore",
"//submodules/AppBundle:AppBundle",
"//third-party/ZipArchive:ZipArchive",

View file

@ -79,8 +79,7 @@ private struct ChatListSearchRecentPeersEntry: Comparable, Identifiable {
func item(
accountPeerId: EnginePeer.Id,
postbox: Postbox,
network: Network,
stateManager: AccountStateManager,
energyUsageSettings: EnergyUsageSettings,
contentSettings: ContentSettings,
animationCache: AnimationCache,
@ -96,8 +95,7 @@ private struct ChatListSearchRecentPeersEntry: Comparable, Identifiable {
strings: self.strings,
mode: mode,
accountPeerId: accountPeerId,
postbox: postbox,
network: network,
stateManager: stateManager,
energyUsageSettings: energyUsageSettings,
contentSettings: contentSettings,
animationCache: animationCache,
@ -126,8 +124,7 @@ private struct ChatListSearchRecentNodeTransition {
private func preparedRecentPeersTransition(
accountPeerId: EnginePeer.Id,
postbox: Postbox,
network: Network,
stateManager: AccountStateManager,
energyUsageSettings: EnergyUsageSettings,
contentSettings: ContentSettings,
animationCache: AnimationCache,
@ -148,8 +145,7 @@ private func preparedRecentPeersTransition(
let deletions = deleteIndices.map { ListViewDeleteItem(index: $0, directionHint: nil) }
let insertions = indicesAndItems.map { ListViewInsertItem(index: $0.0, previousIndex: $0.2, item: $0.1.item(
accountPeerId: accountPeerId,
postbox: postbox,
network: network,
stateManager: stateManager,
energyUsageSettings: energyUsageSettings,
contentSettings: contentSettings,
animationCache: animationCache,
@ -162,8 +158,7 @@ private func preparedRecentPeersTransition(
), directionHint: .Down) }
let updates = updateIndices.map { ListViewUpdateItem(index: $0.0, previousIndex: $0.2, item: $0.1.item(
accountPeerId: accountPeerId,
postbox: postbox,
network: network,
stateManager: stateManager,
energyUsageSettings: energyUsageSettings,
contentSettings: contentSettings,
animationCache: animationCache,
@ -204,8 +199,7 @@ public final class ChatListSearchRecentPeersNode: ASDisplayNode {
public init(
accountPeerId: EnginePeer.Id,
postbox: Postbox,
network: Network,
stateManager: AccountStateManager,
energyUsageSettings: EnergyUsageSettings,
contentSettings: ContentSettings,
animationCache: AnimationCache,
@ -238,7 +232,7 @@ public final class ChatListSearchRecentPeersNode: ASDisplayNode {
let peersDisposable = DisposableSet()
let recent: Signal<([EnginePeer], [EnginePeer.Id: (Int32, Bool)], [EnginePeer.Id : EnginePeer.Presence]), NoError> = _internal_recentPeers(accountPeerId: accountPeerId, postbox: postbox)
let recent: Signal<([EnginePeer], [EnginePeer.Id: (Int32, Bool)], [EnginePeer.Id : EnginePeer.Presence]), NoError> = _internal_recentPeers(accountPeerId: accountPeerId, postbox: stateManager.postbox)
|> filter { value -> Bool in
switch value {
case .disabled:
@ -256,11 +250,11 @@ public final class ChatListSearchRecentPeersNode: ASDisplayNode {
peers.filter {
!$0.isDeleted
}.map {
postbox.peerView(id: $0.id)
stateManager.postbox.peerView(id: $0.id)
}
)
|> mapToSignal { peerViews -> Signal<([EnginePeer], [EnginePeer.Id: (Int32, Bool)], [EnginePeer.Id: EnginePeer.Presence]), NoError> in
return postbox.combinedView(keys: peerViews.map { item -> PostboxViewKey in
return stateManager.postbox.combinedView(keys: peerViews.map { item -> PostboxViewKey in
let key = PostboxViewKey.unreadCounts(items: [UnreadMessageCountsItem.peer(id: item.peerId, handleThreads: true)])
return key
})
@ -324,8 +318,7 @@ public final class ChatListSearchRecentPeersNode: ASDisplayNode {
let transition = preparedRecentPeersTransition(
accountPeerId: accountPeerId,
postbox: postbox,
network: network,
stateManager: stateManager,
energyUsageSettings: energyUsageSettings,
contentSettings: contentSettings,
animationCache: animationCache,
@ -345,7 +338,7 @@ public final class ChatListSearchRecentPeersNode: ASDisplayNode {
}
}))
if case .actionSheet = mode {
peersDisposable.add(_internal_managedUpdatedRecentPeers(accountPeerId: accountPeerId, postbox: postbox, network: network).startStrict())
peersDisposable.add(_internal_managedUpdatedRecentPeers(accountPeerId: accountPeerId, postbox: stateManager.postbox, network: stateManager.network).startStrict())
}
self.disposable.set(peersDisposable)
}

View file

@ -122,8 +122,7 @@ class ChatListRecentPeersListItemNode: ListViewItemNode {
} else {
peersNode = ChatListSearchRecentPeersNode(
accountPeerId: item.context.account.peerId,
postbox: item.context.account.postbox,
network: item.context.account.network,
stateManager: item.context.account.stateManager,
energyUsageSettings: item.context.sharedContext.energyUsageSettings,
contentSettings: item.context.currentContentSettings.with { $0 },
animationCache: item.context.animationCache,

View file

@ -1104,7 +1104,7 @@ public final class ChatListSearchContainerNode: SearchDisplayControllerContentNo
f(.default)
return
}
let _ = (strongSelf.context.account.postbox.mediaBox.removeCachedResources([MediaResourceId(downloadResource.id)], notify: true)
let _ = (strongSelf.context.engine.resources.removeCachedResources(ids: [EngineMediaResource.Id(downloadResource.id)], notify: true)
|> deliverOnMainQueue).startStandalone(completed: {
f(.dismissWithoutContent)
})
@ -1395,7 +1395,7 @@ public final class ChatListSearchContainerNode: SearchDisplayControllerContentNo
}
}
let _ = (strongSelf.context.account.postbox.mediaBox.removeCachedResources(Array(resourceIds), force: true, notify: true)
let _ = (strongSelf.context.engine.resources.removeCachedResources(ids: resourceIds.map { EngineMediaResource.Id($0) }, force: true, notify: true)
|> deliverOnMainQueue).startStandalone(completed: {
guard let strongSelf = self else {
return

View file

@ -12,7 +12,6 @@ swift_library(
deps = [
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
"//submodules/Display:Display",
"//submodules/Postbox:Postbox",
"//submodules/TelegramPresentationData:TelegramPresentationData",
"//submodules/WallpaperBackgroundNode:WallpaperBackgroundNode",
],

View file

@ -1050,7 +1050,7 @@ final class ChatSendMessageContextScreenComponent: Component {
standaloneReactionAnimation.updateLayout(size: effectFrame.size)
self.addSubnode(standaloneReactionAnimation)
let pathPrefix = component.context.account.postbox.mediaBox.shortLivedResourceCachePathPrefix(customEffectResource.id)
let pathPrefix = component.context.engine.resources.shortLivedResourceCachePathPrefix(id: EngineMediaResource.Id(customEffectResource.id))
let source = AnimatedStickerResourceSource(account: component.context.account, resource: customEffectResource, fitzModifier: nil)
standaloneReactionAnimation.setup(source: source, width: Int(effectSize.width * effectiveScale), height: Int(effectSize.height * effectiveScale), playbackMode: .once, mode: .direct(cachePathPrefix: pathPrefix))
standaloneReactionAnimation.completed = { [weak self, weak standaloneReactionAnimation] _ in

View file

@ -13,7 +13,6 @@ swift_library(
"//submodules/SSignalKit/SwiftSignalKit",
"//submodules/AsyncDisplayKit",
"//submodules/Display",
"//submodules/Postbox",
"//submodules/TelegramCore",
"//submodules/AccountContext",
"//submodules/TelegramPresentationData",

View file

@ -13,7 +13,6 @@ swift_library(
"//submodules/Display:Display",
"//submodules/ComponentFlow:ComponentFlow",
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
"//submodules/Postbox:Postbox",
"//submodules/TelegramCore:TelegramCore",
"//submodules/AccountContext:AccountContext",
"//submodules/TelegramPresentationData:TelegramPresentationData",

View file

@ -13,7 +13,6 @@ swift_library(
"//submodules/Display:Display",
"//submodules/ComponentFlow:ComponentFlow",
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
"//submodules/Postbox:Postbox",
"//submodules/TelegramCore:TelegramCore",
"//submodules/AccountContext:AccountContext",
"//submodules/TelegramPresentationData:TelegramPresentationData",

View file

@ -358,7 +358,7 @@ private enum DebugControllerEntry: ItemListNodeEntry {
let id = Int64.random(in: Int64.min ... Int64.max)
let fileResource = LocalFileMediaResource(fileId: id, size: Int64(gzippedData.count), isSecretRelated: false)
context.account.postbox.mediaBox.storeResourceData(fileResource.id, data: gzippedData)
context.engine.resources.storeResourceData(id: EngineMediaResource.Id(fileResource.id), data: gzippedData)
let file = TelegramMediaFile(fileId: MediaId(namespace: Namespaces.Media.LocalFile, id: id), partialReference: nil, resource: fileResource, previewRepresentations: [], videoThumbnails: [], immediateThumbnailData: nil, mimeType: "application/text", size: Int64(gzippedData.count), attributes: [.FileName(fileName: "Log-iOS-Full.txt.zip")], alternativeRepresentations: [])
let message: EnqueueMessage = .message(text: "", attributes: [], inlineStickers: [:], mediaReference: .standalone(media: file), threadId: nil, replyToMessageId: nil, replyToStoryId: nil, localGroupingKey: nil, correlationId: nil, bubbleUpEmojiOrStickersets: [])
@ -438,7 +438,7 @@ private enum DebugControllerEntry: ItemListNodeEntry {
let id = Int64.random(in: Int64.min ... Int64.max)
let fileResource = LocalFileMediaResource(fileId: id, size: Int64(logData.count), isSecretRelated: false)
context.account.postbox.mediaBox.storeResourceData(fileResource.id, data: logData)
context.engine.resources.storeResourceData(id: EngineMediaResource.Id(fileResource.id), data: logData)
let file = TelegramMediaFile(fileId: MediaId(namespace: Namespaces.Media.LocalFile, id: id), partialReference: nil, resource: fileResource, previewRepresentations: [], videoThumbnails: [], immediateThumbnailData: nil, mimeType: "application/text", size: Int64(logData.count), attributes: [.FileName(fileName: "Log-iOS-Short.txt")], alternativeRepresentations: [])
let message: EnqueueMessage = .message(text: "", attributes: [], inlineStickers: [:], mediaReference: .standalone(media: file), threadId: nil, replyToMessageId: nil, replyToStoryId: nil, localGroupingKey: nil, correlationId: nil, bubbleUpEmojiOrStickersets: [])
@ -524,7 +524,7 @@ private enum DebugControllerEntry: ItemListNodeEntry {
let id = Int64.random(in: Int64.min ... Int64.max)
let fileResource = LocalFileMediaResource(fileId: id, size: Int64(gzippedData.count), isSecretRelated: false)
context.account.postbox.mediaBox.storeResourceData(fileResource.id, data: gzippedData)
context.engine.resources.storeResourceData(id: EngineMediaResource.Id(fileResource.id), data: gzippedData)
let file = TelegramMediaFile(fileId: MediaId(namespace: Namespaces.Media.LocalFile, id: id), partialReference: nil, resource: fileResource, previewRepresentations: [], videoThumbnails: [], immediateThumbnailData: nil, mimeType: "application/text", size: Int64(gzippedData.count), attributes: [.FileName(fileName: "Log-iOS-Full.txt.zip")], alternativeRepresentations: [])
let message: EnqueueMessage = .message(text: "", attributes: [], inlineStickers: [:], mediaReference: .standalone(media: file), threadId: nil, replyToMessageId: nil, replyToStoryId: nil, localGroupingKey: nil, correlationId: nil, bubbleUpEmojiOrStickersets: [])
@ -608,7 +608,7 @@ private enum DebugControllerEntry: ItemListNodeEntry {
let id = Int64.random(in: Int64.min ... Int64.max)
let fileResource = LocalFileMediaResource(fileId: id, size: Int64(gzippedData.count), isSecretRelated: false)
context.account.postbox.mediaBox.storeResourceData(fileResource.id, data: gzippedData)
context.engine.resources.storeResourceData(id: EngineMediaResource.Id(fileResource.id), data: gzippedData)
let file = TelegramMediaFile(fileId: MediaId(namespace: Namespaces.Media.LocalFile, id: id), partialReference: nil, resource: fileResource, previewRepresentations: [], videoThumbnails: [], immediateThumbnailData: nil, mimeType: "application/text", size: Int64(gzippedData.count), attributes: [.FileName(fileName: "Log-iOS-Full.txt.zip")], alternativeRepresentations: [])
let message: EnqueueMessage = .message(text: "", attributes: [], inlineStickers: [:], mediaReference: .standalone(media: file), threadId: nil, replyToMessageId: nil, replyToStoryId: nil, localGroupingKey: nil, correlationId: nil, bubbleUpEmojiOrStickersets: [])
@ -693,7 +693,7 @@ private enum DebugControllerEntry: ItemListNodeEntry {
let id = Int64.random(in: Int64.min ... Int64.max)
let fileResource = LocalFileMediaResource(fileId: id, size: Int64(gzippedData.count), isSecretRelated: false)
context.account.postbox.mediaBox.storeResourceData(fileResource.id, data: gzippedData)
context.engine.resources.storeResourceData(id: EngineMediaResource.Id(fileResource.id), data: gzippedData)
let file = TelegramMediaFile(fileId: MediaId(namespace: Namespaces.Media.LocalFile, id: id), partialReference: nil, resource: fileResource, previewRepresentations: [], videoThumbnails: [], immediateThumbnailData: nil, mimeType: "application/text", size: Int64(gzippedData.count), attributes: [.FileName(fileName: "Log-iOS-Full.txt.zip")], alternativeRepresentations: [])
let message: EnqueueMessage = .message(text: "", attributes: [], inlineStickers: [:], mediaReference: .standalone(media: file), threadId: nil, replyToMessageId: nil, replyToStoryId: nil, localGroupingKey: nil, correlationId: nil, bubbleUpEmojiOrStickersets: [])
@ -855,7 +855,7 @@ private enum DebugControllerEntry: ItemListNodeEntry {
let id = Int64.random(in: Int64.min ... Int64.max)
let fileResource = LocalFileMediaResource(fileId: id, size: Int64(gzippedData.count), isSecretRelated: false)
context.account.postbox.mediaBox.storeResourceData(fileResource.id, data: gzippedData)
context.engine.resources.storeResourceData(id: EngineMediaResource.Id(fileResource.id), data: gzippedData)
let file = TelegramMediaFile(fileId: MediaId(namespace: Namespaces.Media.LocalFile, id: id), partialReference: nil, resource: fileResource, previewRepresentations: [], videoThumbnails: [], immediateThumbnailData: nil, mimeType: "application/zip", size: Int64(gzippedData.count), attributes: [.FileName(fileName: "Log-iOS-All.txt.zip")], alternativeRepresentations: [])
let message: EnqueueMessage = .message(text: "", attributes: [], inlineStickers: [:], mediaReference: .standalone(media: file), threadId: nil, replyToMessageId: nil, replyToStoryId: nil, localGroupingKey: nil, correlationId: nil, bubbleUpEmojiOrStickersets: [])
@ -910,7 +910,7 @@ private enum DebugControllerEntry: ItemListNodeEntry {
let id = Int64.random(in: Int64.min ... Int64.max)
let fileResource = LocalFileMediaResource(fileId: id, size: Int64(allStatsData.count), isSecretRelated: false)
context.account.postbox.mediaBox.storeResourceData(fileResource.id, data: allStatsData)
context.engine.resources.storeResourceData(id: EngineMediaResource.Id(fileResource.id), data: allStatsData)
let file = TelegramMediaFile(fileId: MediaId(namespace: Namespaces.Media.LocalFile, id: id), partialReference: nil, resource: fileResource, previewRepresentations: [], videoThumbnails: [], immediateThumbnailData: nil, mimeType: "application/zip", size: Int64(allStatsData.count), attributes: [.FileName(fileName: "StorageReport.txt")], alternativeRepresentations: [])
let message: EnqueueMessage = .message(text: "", attributes: [], inlineStickers: [:], mediaReference: .standalone(media: file), threadId: nil, replyToMessageId: nil, replyToStoryId: nil, localGroupingKey: nil, correlationId: nil, bubbleUpEmojiOrStickersets: [])
@ -1779,7 +1779,7 @@ public func triggerDebugSendLogsUI(context: AccountContext, additionalInfo: Stri
let id = Int64.random(in: Int64.min ... Int64.max)
let fileResource = LocalFileMediaResource(fileId: id, size: Int64(gzippedData.count), isSecretRelated: false)
context.account.postbox.mediaBox.storeResourceData(fileResource.id, data: gzippedData)
context.engine.resources.storeResourceData(id: EngineMediaResource.Id(fileResource.id), data: gzippedData)
let file = TelegramMediaFile(fileId: MediaId(namespace: Namespaces.Media.LocalFile, id: id), partialReference: nil, resource: fileResource, previewRepresentations: [], videoThumbnails: [], immediateThumbnailData: nil, mimeType: "application/text", size: Int64(gzippedData.count), attributes: [.FileName(fileName: "Log-iOS-Full.txt.zip")], alternativeRepresentations: [])
let message: EnqueueMessage = .message(text: "", attributes: [], inlineStickers: [:], mediaReference: .standalone(media: file), threadId: nil, replyToMessageId: nil, replyToStoryId: nil, localGroupingKey: nil, correlationId: nil, bubbleUpEmojiOrStickersets: [])

View file

@ -2672,7 +2672,7 @@ open class ListViewImpl: ASDisplayNode, ListView, ASScrollViewDelegate, ASGestur
if self.experimentalSnapScrollToItem {
self.scrolledToItem = (originalScrollToItem.index, originalScrollToItem.position)
}
if self.items[originalScrollToItem.index].pinToEdgeWithInset {
if originalScrollToItem.index < self.items.count && self.items[originalScrollToItem.index].pinToEdgeWithInset {
self.experimentalSnapScrollToPinnedItem = true
}
} else if let scrolledToItem = self.scrolledToItem, self.experimentalSnapScrollToItem {

View file

@ -478,7 +478,7 @@ public class DrawingStickerEntityView: DrawingEntityView {
let dimensions = file.dimensions ?? PixelDimensions(width: 512, height: 512)
let fittedDimensions = dimensions.cgSize.aspectFitted(CGSize(width: 384.0, height: 384.0))
let source = AnimatedStickerResourceSource(account: self.context.account, resource: file.resource, isVideo: file.isVideoSticker || file.mimeType == "video/webm")
let pathPrefix = self.context.account.postbox.mediaBox.shortLivedResourceCachePathPrefix(file.resource.id)
let pathPrefix = self.context.engine.resources.shortLivedResourceCachePathPrefix(id: EngineMediaResource.Id(file.resource.id))
let playbackMode: AnimatedStickerPlaybackMode = .loop
self.animationNode?.setup(source: source, width: Int(fittedDimensions.width), height: Int(fittedDimensions.height), playbackMode: playbackMode, mode: .direct(cachePathPrefix: pathPrefix))

View file

@ -9,7 +9,8 @@ typedef NS_ENUM(NSUInteger, FFMpegAVFrameColorRange) {
typedef NS_ENUM(NSUInteger, FFMpegAVFramePixelFormat) {
FFMpegAVFramePixelFormatYUV,
FFMpegAVFramePixelFormatYUVA
FFMpegAVFramePixelFormatYUVA,
FFMpegAVFramePixelFormatUnsupported
};
typedef NS_ENUM(NSUInteger, FFMpegAVFrameNativePixelFormat) {
@ -29,7 +30,7 @@ typedef NS_ENUM(NSUInteger, FFMpegAVFrameNativePixelFormat) {
@property (nonatomic, readonly) FFMpegAVFramePixelFormat pixelFormat;
- (instancetype)init;
- (instancetype)initWithPixelFormat:(FFMpegAVFramePixelFormat)pixelFormat width:(int32_t)width height:(int32_t)height;
- (instancetype _Nullable)initWithPixelFormat:(FFMpegAVFramePixelFormat)pixelFormat width:(int32_t)width height:(int32_t)height;
- (void *)impl;
- (FFMpegAVFrameNativePixelFormat)nativePixelFormat;

View file

@ -29,6 +29,8 @@
case FFMpegAVFramePixelFormatYUVA:
_impl->format = AV_PIX_FMT_YUVA420P;
break;
case FFMpegAVFramePixelFormatUnsupported:
return nil;
}
_impl->width = width;
_impl->height = height;
@ -101,8 +103,11 @@
switch (_impl->format) {
case AV_PIX_FMT_YUVA420P:
return FFMpegAVFramePixelFormatYUVA;
default:
case AV_PIX_FMT_YUV420P:
case AV_PIX_FMT_YUVJ420P:
return FFMpegAVFramePixelFormatYUV;
default:
return FFMpegAVFramePixelFormatUnsupported;
}
}

View file

@ -13,7 +13,6 @@ swift_library(
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
"//submodules/Display:Display",
"//submodules/Postbox:Postbox",
"//submodules/TelegramCore:TelegramCore",
"//submodules/AccountContext:AccountContext",
"//submodules/MediaPlayer:UniversalMediaPlayer",

View file

@ -341,7 +341,7 @@ final class ChatAnimationGalleryItemNode: ZoomableContentGalleryItemNode {
if let resource = resource {
switch status {
case .Fetching:
self.context.account.postbox.mediaBox.cancelInteractiveResourceFetch(resource.resource)
self.context.engine.resources.cancelInteractiveResourceFetch(id: EngineMediaResource.Id(resource.resource.id))
case .Remote:
self.fetchDisposable.set(fetchedMediaResource(mediaBox: self.context.account.postbox.mediaBox, userLocation: (self.message?.id.peerId).flatMap(MediaResourceUserLocation.peer) ?? .other, userContentType: .file, reference: resource, statsCategory: statsCategory ?? .generic).start())
default:

View file

@ -386,7 +386,7 @@ class ChatDocumentGalleryItemNode: ZoomableContentGalleryItemNode, WKNavigationD
if let (context, fileReference) = self.contextAndFile, let status = self.status {
switch status {
case .Fetching:
context.account.postbox.mediaBox.cancelInteractiveResourceFetch(fileReference.media.resource)
context.engine.resources.cancelInteractiveResourceFetch(id: EngineMediaResource.Id(fileReference.media.resource.id))
case .Remote:
self.fetchDisposable.set(fetchedMediaResource(mediaBox: context.account.postbox.mediaBox, userLocation: (self.message?.id.peerId).flatMap(MediaResourceUserLocation.peer) ?? .other, userContentType: .file, reference: fileReference.resourceReference(fileReference.media.resource)).start())
default:

View file

@ -320,7 +320,7 @@ class ChatExternalFileGalleryItemNode: GalleryItemNode {
if let (context, fileReference) = self.contextAndFile, let status = self.status {
switch status {
case .Fetching:
context.account.postbox.mediaBox.cancelInteractiveResourceFetch(fileReference.media.resource)
context.engine.resources.cancelInteractiveResourceFetch(id: EngineMediaResource.Id(fileReference.media.resource.id))
case .Remote:
self.fetchDisposable.set(fetchedMediaResource(mediaBox: context.account.postbox.mediaBox, userLocation: (self.message?.id.peerId).flatMap(MediaResourceUserLocation.peer) ?? .other, userContentType: .file, reference: fileReference.resourceReference(fileReference.media.resource)).start())
default:

View file

@ -1196,7 +1196,7 @@ final class ChatImageGalleryItemNode: ZoomableContentGalleryItemNode {
if let resource = resource {
switch status {
case .Fetching:
self.context.account.postbox.mediaBox.cancelInteractiveResourceFetch(resource.resource)
self.context.engine.resources.cancelInteractiveResourceFetch(id: EngineMediaResource.Id(resource.resource.id))
case .Remote:
self.fetchDisposable.set(fetchedMediaResource(mediaBox: self.context.account.postbox.mediaBox, userLocation: (self.message?.id.peerId).flatMap(MediaResourceUserLocation.peer) ?? .other, userContentType: .image, reference: resource, statsCategory: statsCategory ?? .generic).start())
default:

View file

@ -516,7 +516,7 @@ public final class SecretMediaPreviewController: ViewController {
var duration: Double = 0.0
for media in message.media {
if let file = media as? TelegramMediaFile {
if let path = self.context.account.postbox.mediaBox.completedResourcePath(file.resource) {
if let path = self.context.engine.resources.completedResourcePath(id: EngineMediaResource.Id(file.resource.id)) {
let tempFile = TempBox.shared.file(path: path, fileName: file.fileName ?? "file")
self.tempFile = tempFile
tempFilePath = tempFile.path

View file

@ -12,7 +12,6 @@ swift_library(
deps = [
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
"//submodules/TelegramCore:TelegramCore",
"//submodules/Postbox:Postbox",
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
"//submodules/Display:Display",
"//submodules/TelegramPresentationData:TelegramPresentationData",

View file

@ -3,7 +3,6 @@ import UIKit
import Display
import AsyncDisplayKit
import TelegramCore
import Postbox
import SwiftSignalKit
import TelegramPresentationData
import TelegramStringFormatting
@ -27,8 +26,7 @@ public final class HorizontalPeerItem: ListViewItem {
let strings: PresentationStrings
let mode: HorizontalPeerItemMode
let accountPeerId: EnginePeer.Id
let postbox: Postbox
let network: Network
let stateManager: AccountStateManager
let energyUsageSettings: EnergyUsageSettings
let contentSettings: ContentSettings
let animationCache: AnimationCache
@ -48,8 +46,7 @@ public final class HorizontalPeerItem: ListViewItem {
strings: PresentationStrings,
mode: HorizontalPeerItemMode,
accountPeerId: EnginePeer.Id,
postbox: Postbox,
network: Network,
stateManager: AccountStateManager,
energyUsageSettings: EnergyUsageSettings,
contentSettings: ContentSettings,
animationCache: AnimationCache,
@ -67,8 +64,7 @@ public final class HorizontalPeerItem: ListViewItem {
self.strings = strings
self.mode = mode
self.accountPeerId = accountPeerId
self.postbox = postbox
self.network = network
self.stateManager = stateManager
self.energyUsageSettings = energyUsageSettings
self.contentSettings = contentSettings
self.animationCache = animationCache
@ -228,7 +224,7 @@ public final class HorizontalPeerItemNode: ListViewItemNode {
} else {
strongSelf.peerNode.compact = false
}
strongSelf.peerNode.setup(accountPeerId: item.accountPeerId, postbox: item.postbox, network: item.network, energyUsageSettings: item.energyUsageSettings, contentSettings: item.contentSettings, animationCache: item.animationCache, animationRenderer: item.animationRenderer, resolveInlineStickers: item.resolveInlineStickers, theme: item.theme, strings: item.strings, peer: EngineRenderedPeer(peer: item.peer), requiresPremiumForMessaging: false, numberOfLines: 1, synchronousLoad: synchronousLoads)
strongSelf.peerNode.setup(accountPeerId: item.accountPeerId, stateManager: item.stateManager, energyUsageSettings: item.energyUsageSettings, contentSettings: item.contentSettings, animationCache: item.animationCache, animationRenderer: item.animationRenderer, resolveInlineStickers: item.resolveInlineStickers, theme: item.theme, strings: item.strings, peer: EngineRenderedPeer(peer: item.peer), requiresPremiumForMessaging: false, numberOfLines: 1, synchronousLoad: synchronousLoads)
strongSelf.peerNode.frame = CGRect(origin: CGPoint(), size: itemLayout.size)
strongSelf.peerNode.updateSelection(selected: item.isPeerSelected(item.peer.id), animated: false)

View file

@ -12,7 +12,6 @@ swift_library(
deps = [
"//submodules/Display:Display",
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
"//submodules/Postbox:Postbox",
"//submodules/TelegramCore:TelegramCore",
"//submodules/TelegramUIPreferences:TelegramUIPreferences",
"//submodules/AccountContext:AccountContext",

View file

@ -13,7 +13,6 @@ swift_library(
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
"//submodules/Display:Display",
"//submodules/Postbox:Postbox",
"//submodules/TelegramCore:TelegramCore",
"//submodules/TelegramPresentationData:TelegramPresentationData",
"//submodules/AccountContext:AccountContext",

View file

@ -623,7 +623,7 @@ final class ImportStickerPackControllerNode: ViewControllerTracingNode, ASScroll
}
if let resource = self.uploadedStickerResources[item.stickerItem.uuid] {
if let localResource = item.stickerItem.resource {
self.context.account.postbox.mediaBox.copyResourceData(from: localResource._asResource().id, to: resource._asResource().id)
self.context.engine.resources.copyResourceData(from: localResource.id, to: resource.id)
}
stickers.append(ImportSticker(resource: .standalone(resource: resource._asResource()), emojis: item.stickerItem.emojis, dimensions: dimensions, duration: nil, mimeType: item.stickerItem.mimeType, keywords: item.stickerItem.keywords))
} else if let resource = item.stickerItem.resource {
@ -637,7 +637,7 @@ final class ImportStickerPackControllerNode: ViewControllerTracingNode, ASScroll
dimensions = PixelDimensions(image.size)
}
let resource = LocalFileMediaResource(fileId: Int64.random(in: Int64.min ... Int64.max))
self.context.account.postbox.mediaBox.storeResourceData(resource.id, data: thumbnail.data)
self.context.engine.resources.storeResourceData(id: EngineMediaResource.Id(resource.id), data: thumbnail.data)
thumbnailSticker = ImportSticker(resource: .standalone(resource: resource), emojis: [], dimensions: dimensions, duration: nil, mimeType: thumbnail.mimeType, keywords: thumbnail.keywords)
}
@ -796,7 +796,7 @@ final class ImportStickerPackControllerNode: ViewControllerTracingNode, ASScroll
item.resource = resource
} else {
let resource = LocalFileMediaResource(fileId: Int64.random(in: Int64.min ... Int64.max))
self.context.account.postbox.mediaBox.storeResourceData(resource.id, data: item.data)
self.context.engine.resources.storeResourceData(id: EngineMediaResource.Id(resource.id), data: item.data)
item.resource = EngineMediaResource(resource)
self.stickerResources[item.uuid] = EngineMediaResource(resource)
}

View file

@ -13,7 +13,6 @@ swift_library(
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
"//submodules/Display:Display",
"//submodules/Postbox:Postbox",
"//submodules/TelegramCore:TelegramCore",
"//submodules/TelegramPresentationData:TelegramPresentationData",
"//submodules/PeerPresenceStatusManager:PeerPresenceStatusManager",

View file

@ -2,7 +2,6 @@ import Foundation
import UIKit
import Display
import AsyncDisplayKit
import Postbox
import TelegramCore
import SwiftSignalKit
import TelegramPresentationData
@ -135,7 +134,7 @@ public enum ItemListAvatarAndNameInfoItemMode {
public class ItemListAvatarAndNameInfoItem: ListViewItem, ItemListItem, ListItemComponentAdaptor.ItemGenerator {
public enum ItemContext {
case accountContext(AccountContext)
case other(accountPeerId: EnginePeer.Id, postbox: Postbox, network: Network)
case other(accountPeerId: EnginePeer.Id, stateManager: AccountStateManager)
var accountContext: AccountContext? {
if case let .accountContext(accountContext) = self {
@ -758,8 +757,8 @@ public class ItemListAvatarAndNameInfoItemNode: ListViewItemNode, ItemListItemNo
switch item.itemContext {
case let .accountContext(context):
strongSelf.avatarNode.setPeer(context: context, theme: item.presentationData.theme, peer: peer, overrideImage: overrideImage, emptyColor: ignoreEmpty ? nil : item.presentationData.theme.list.mediaPlaceholderColor, synchronousLoad: synchronousLoads)
case let .other(accountPeerId, postbox, network):
strongSelf.avatarNode.setPeer(accountPeerId: accountPeerId, postbox: postbox, network: network, contentSettings: .default, theme: item.presentationData.theme, peer: peer, authorOfMessage: nil, overrideImage: overrideImage, emptyColor: ignoreEmpty ? nil : item.presentationData.theme.list.mediaPlaceholderColor, synchronousLoad: synchronousLoads)
case let .other(accountPeerId, stateManager):
strongSelf.avatarNode.setPeer(accountPeerId: accountPeerId, postbox: stateManager.postbox, network: stateManager.network, contentSettings: .default, theme: item.presentationData.theme, peer: peer, authorOfMessage: nil, overrideImage: overrideImage, emptyColor: ignoreEmpty ? nil : item.presentationData.theme.list.mediaPlaceholderColor, synchronousLoad: synchronousLoads)
}
}

View file

@ -326,25 +326,22 @@ public final class ItemListPeerItem: ListViewItem, ItemListItem {
public enum Context {
public final class Custom {
public let accountPeerId: EnginePeer.Id
public let postbox: Postbox
public let network: Network
public let engine: TelegramEngine
public let animationCache: AnimationCache
public let animationRenderer: MultiAnimationRenderer
public let isPremiumDisabled: Bool
public let resolveInlineStickers: ([Int64]) -> Signal<[Int64: TelegramMediaFile], NoError>
public init(
accountPeerId: EnginePeer.Id,
postbox: Postbox,
network: Network,
engine: TelegramEngine,
animationCache: AnimationCache,
animationRenderer: MultiAnimationRenderer,
isPremiumDisabled: Bool,
resolveInlineStickers: @escaping ([Int64]) -> Signal<[Int64: TelegramMediaFile], NoError>
) {
self.accountPeerId = accountPeerId
self.postbox = postbox
self.network = network
self.engine = engine
self.animationCache = animationCache
self.animationRenderer = animationRenderer
self.isPremiumDisabled = isPremiumDisabled
@ -364,21 +361,12 @@ public final class ItemListPeerItem: ListViewItem, ItemListItem {
}
}
public var postbox: Postbox {
public var engine: TelegramEngine {
switch self {
case let .account(context):
return context.account.postbox
return context.engine
case let .custom(custom):
return custom.postbox
}
}
public var network: Network {
switch self {
case let .account(context):
return context.account.network
case let .custom(custom):
return custom.network
return custom.engine
}
}
@ -1495,7 +1483,7 @@ public class ItemListPeerItemNode: ItemListRevealOptionsItemNode, ItemListItemNo
}
let verifiedIconComponent = EmojiStatusComponent(
postbox: item.context.postbox,
postbox: item.context.engine.account.postbox,
energyUsageSettings: item.context.energyUsageSettings,
resolveInlineStickers: item.context.resolveInlineStickers,
animationCache: animationCache,
@ -1543,7 +1531,7 @@ public class ItemListPeerItemNode: ItemListRevealOptionsItemNode, ItemListItemNo
}
let credibilityIconComponent = EmojiStatusComponent(
postbox: item.context.postbox,
postbox: item.context.engine.account.postbox,
energyUsageSettings: item.context.energyUsageSettings,
resolveInlineStickers: item.context.resolveInlineStickers,
animationCache: animationCache,
@ -1702,7 +1690,7 @@ public class ItemListPeerItemNode: ItemListRevealOptionsItemNode, ItemListItemNo
}
let avatarIconComponent = EmojiStatusComponent(
postbox: item.context.postbox,
postbox: item.context.engine.account.postbox,
energyUsageSettings: item.context.energyUsageSettings,
resolveInlineStickers: item.context.resolveInlineStickers,
animationCache: item.context.animationCache,
@ -1730,8 +1718,8 @@ public class ItemListPeerItemNode: ItemListRevealOptionsItemNode, ItemListItemNo
if item.peer.id == item.context.accountPeerId, case .threatSelfAsSaved = item.aliasHandling {
strongSelf.avatarNode.setPeer(
accountPeerId: item.context.accountPeerId,
postbox: item.context.postbox,
network: item.context.network,
postbox: item.context.engine.account.postbox,
network: item.context.engine.account.network,
contentSettings: item.context.contentSettings,
theme: item.presentationData.theme,
peer: item.peer,
@ -1742,8 +1730,8 @@ public class ItemListPeerItemNode: ItemListRevealOptionsItemNode, ItemListItemNo
} else if item.peer.id.isReplies {
strongSelf.avatarNode.setPeer(
accountPeerId: item.context.accountPeerId,
postbox: item.context.postbox,
network: item.context.network,
postbox: item.context.engine.account.postbox,
network: item.context.engine.account.network,
contentSettings: item.context.contentSettings,
theme: item.presentationData.theme,
peer: item.peer,
@ -1765,8 +1753,8 @@ public class ItemListPeerItemNode: ItemListRevealOptionsItemNode, ItemListItemNo
strongSelf.avatarNode.setPeer(
accountPeerId: item.context.accountPeerId,
postbox: item.context.postbox,
network: item.context.network,
postbox: item.context.engine.account.postbox,
network: item.context.engine.account.network,
contentSettings: item.context.contentSettings,
theme: item.presentationData.theme,
peer: item.peer,

View file

@ -13,7 +13,6 @@ swift_library(
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
"//submodules/Display:Display",
"//submodules/Postbox:Postbox",
"//submodules/TelegramCore:TelegramCore",
"//submodules/TelegramPresentationData:TelegramPresentationData",
"//submodules/ItemListUI:ItemListUI",

View file

@ -3,7 +3,6 @@ import UIKit
import Display
import AsyncDisplayKit
import SwiftSignalKit
import Postbox
import TelegramCore
import TelegramPresentationData
import ItemListUI
@ -52,12 +51,12 @@ public final class ItemListStickerPackItem: ListViewItem, ItemListItem {
let style: ItemListStyle
public let sectionId: ItemListSectionId
let action: (() -> Void)?
let setPackIdWithRevealedOptions: (ItemCollectionId?, ItemCollectionId?) -> Void
let setPackIdWithRevealedOptions: (EngineItemCollectionId?, EngineItemCollectionId?) -> Void
let addPack: () -> Void
let removePack: () -> Void
let toggleSelected: () -> Void
public init(presentationData: ItemListPresentationData, context: AccountContext, systemStyle: ItemListSystemStyle = .legacy, packInfo: StickerPackCollectionInfo.Accessor, itemCount: String, topItem: StickerPackItem?, unread: Bool, control: ItemListStickerPackItemControl, editing: ItemListStickerPackItemEditing, enabled: Bool, playAnimatedStickers: Bool, style: ItemListStyle = .blocks, sectionId: ItemListSectionId, action: (() -> Void)?, setPackIdWithRevealedOptions: @escaping (ItemCollectionId?, ItemCollectionId?) -> Void, addPack: @escaping () -> Void, removePack: @escaping () -> Void, toggleSelected: @escaping () -> Void) {
public init(presentationData: ItemListPresentationData, context: AccountContext, systemStyle: ItemListSystemStyle = .legacy, packInfo: StickerPackCollectionInfo.Accessor, itemCount: String, topItem: StickerPackItem?, unread: Bool, control: ItemListStickerPackItemControl, editing: ItemListStickerPackItemEditing, enabled: Bool, playAnimatedStickers: Bool, style: ItemListStyle = .blocks, sectionId: ItemListSectionId, action: (() -> Void)?, setPackIdWithRevealedOptions: @escaping (EngineItemCollectionId?, EngineItemCollectionId?) -> Void, addPack: @escaping () -> Void, removePack: @escaping () -> Void, toggleSelected: @escaping () -> Void) {
self.presentationData = presentationData
self.context = context
self.systemStyle = systemStyle
@ -126,8 +125,8 @@ public final class ItemListStickerPackItem: ListViewItem, ItemListItem {
public enum StickerPackThumbnailItem: Equatable {
case still(TelegramMediaImageRepresentation)
case animated(MediaResource, PixelDimensions, Bool, Bool)
case animated(EngineMediaResource, PixelDimensions, Bool, Bool)
public static func ==(lhs: StickerPackThumbnailItem, rhs: StickerPackThumbnailItem) -> Bool {
switch lhs {
case let .still(representation):
@ -137,7 +136,7 @@ public enum StickerPackThumbnailItem: Equatable {
return false
}
case let .animated(lhsResource, lhsDimensions, lhsIsVideo, lhsTinted):
if case let .animated(rhsResource, rhsDimensions, rhsIsVideo, rhsTinted) = rhs, lhsResource.isEqual(to: rhsResource), lhsDimensions == rhsDimensions, lhsIsVideo == rhsIsVideo, lhsTinted == rhsTinted {
if case let .animated(rhsResource, rhsDimensions, rhsIsVideo, rhsTinted) = rhs, lhsResource == rhsResource, lhsDimensions == rhsDimensions, lhsIsVideo == rhsIsVideo, lhsTinted == rhsTinted {
return true
} else {
return false
@ -500,7 +499,7 @@ class ItemListStickerPackItemNode: ItemListRevealOptionsItemNode {
var resourceReference: MediaResourceReference?
if item.packInfo.hasThumbnail, let thumbnail = item.packInfo._parse().thumbnail {
if thumbnail.typeHint != .generic {
thumbnailItem = .animated(thumbnail.resource, thumbnail.dimensions, thumbnail.typeHint == .video, item.packInfo.flags.contains(.isCustomTemplateEmoji))
thumbnailItem = .animated(EngineMediaResource(thumbnail.resource), thumbnail.dimensions, thumbnail.typeHint == .video, item.packInfo.flags.contains(.isCustomTemplateEmoji))
} else {
thumbnailItem = .still(thumbnail)
}
@ -508,7 +507,7 @@ class ItemListStickerPackItemNode: ItemListRevealOptionsItemNode {
} else if let item = item.topItem {
let itemFile = item.file._parse()
if itemFile.isAnimatedSticker || itemFile.isVideoSticker {
thumbnailItem = .animated(itemFile.resource, itemFile.dimensions ?? PixelDimensions(width: 100, height: 100), itemFile.isVideoSticker, itemFile.isCustomTemplateEmoji)
thumbnailItem = .animated(EngineMediaResource(itemFile.resource), itemFile.dimensions ?? PixelDimensions(width: 100, height: 100), itemFile.isVideoSticker, itemFile.isCustomTemplateEmoji)
resourceReference = MediaResourceReference.media(media: .standalone(media: itemFile), resource: itemFile.resource)
} else if let dimensions = itemFile.dimensions, let resource = chatMessageStickerResource(file: itemFile, small: true) as? TelegramMediaResource {
thumbnailItem = .still(TelegramMediaImageRepresentation(dimensions: dimensions, resource: resource, progressiveSizes: [], immediateThumbnailData: nil, hasVideo: false, isPersonal: false))
@ -517,7 +516,7 @@ class ItemListStickerPackItemNode: ItemListRevealOptionsItemNode {
}
var updatedImageSignal: Signal<(TransformImageArguments) -> DrawingContext?, NoError>?
var updatedFetchSignal: Signal<FetchResourceSourceType, FetchResourceError>?
var updatedFetchSignal: Signal<EngineFetchResourceSourceType, EngineFetchResourceError>?
let imageBoundingSize = CGSize(width: 34.0, height: 34.0)
var imageApply: (() -> Void)?
@ -537,14 +536,14 @@ class ItemListStickerPackItemNode: ItemListRevealOptionsItemNode {
}
case let .animated(resource, dimensions, _, _):
imageSize = dimensions.cgSize.aspectFitted(imageBoundingSize)
if fileUpdated {
imageApply = makeImageLayout(TransformImageArguments(corners: ImageCorners(), imageSize: imageBoundingSize, boundingSize: imageBoundingSize, intrinsicInsets: UIEdgeInsets()))
updatedImageSignal = chatMessageStickerPackThumbnail(postbox: item.context.account.postbox, resource: resource, animated: true, nilIfEmpty: true)
updatedImageSignal = chatMessageStickerPackThumbnail(postbox: item.context.account.postbox, resource: resource._asResource(), animated: true, nilIfEmpty: true)
}
}
if fileUpdated, let resourceReference = resourceReference {
updatedFetchSignal = fetchedMediaResource(mediaBox: item.context.account.postbox.mediaBox, userLocation: .other, userContentType: .sticker, reference: resourceReference)
updatedFetchSignal = item.context.engine.resources.fetch(reference: resourceReference, userLocation: .other, userContentType: .sticker)
}
} else {
updatedImageSignal = .single({ _ in return nil })
@ -829,9 +828,9 @@ class ItemListStickerPackItemNode: ItemListRevealOptionsItemNode {
}
strongSelf.animationNode = animationNode
strongSelf.addSubnode(animationNode)
let pathPrefix = item.context.account.postbox.mediaBox.shortLivedResourceCachePathPrefix(resource.id)
animationNode.setup(source: AnimatedStickerResourceSource(account: item.context.account, resource: resource, isVideo: isVideo), width: 80, height: 80, playbackMode: .loop, mode: .direct(cachePathPrefix: pathPrefix))
let pathPrefix = item.context.engine.resources.shortLivedResourceCachePathPrefix(id: resource.id)
animationNode.setup(source: AnimatedStickerResourceSource(account: item.context.account, resource: resource._asResource(), isVideo: isVideo), width: 80, height: 80, playbackMode: .loop, mode: .direct(cachePathPrefix: pathPrefix))
}
animationNode.visibility = strongSelf.visibility != .none && item.playAnimatedStickers
animationNode.isHidden = !item.playAnimatedStickers

View file

@ -12,7 +12,6 @@ swift_library(
deps = [
"//submodules/SSignalKit/SSignalKit",
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
"//submodules/Postbox:Postbox",
"//submodules/TelegramCore:TelegramCore",
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
"//submodules/Display:Display",

View file

@ -13,7 +13,6 @@ swift_library(
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
"//submodules/Display:Display",
"//submodules/Postbox:Postbox",
"//submodules/TelegramCore:TelegramCore",
"//submodules/TelegramPresentationData:TelegramPresentationData",
"//submodules/LegacyComponents:LegacyComponents",

View file

@ -13,7 +13,6 @@ swift_library(
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
"//submodules/Display:Display",
"//submodules/Postbox:Postbox",
"//submodules/TelegramCore:TelegramCore",
"//submodules/TelegramPresentationData:TelegramPresentationData",
"//submodules/AccountContext:AccountContext",

View file

@ -7,7 +7,7 @@ final class FFMpegAudioFrameDecoder: MediaTrackFrameDecoder {
private let swrContext: FFMpegSWResample
private var timescale: CMTimeScale = 44000
private let audioFrame: FFMpegAVFrame
private let audioFrame: FFMpegAVFrame?
private var resetDecoderOnNextFrame = true
private let formatDescription: CMAudioFormatDescription
@ -43,11 +43,15 @@ final class FFMpegAudioFrameDecoder: MediaTrackFrameDecoder {
}
func decodeRaw(frame: MediaTrackDecodableFrame) -> Data? {
guard let audioFrame = self.audioFrame else {
return nil
}
let status = frame.packet.send(toDecoder: self.codecContext)
if status == 0 {
let result = self.codecContext.receive(into: self.audioFrame)
let result = self.codecContext.receive(into: audioFrame)
if case .success = result {
guard let data = self.swrContext.resample(self.audioFrame) else {
guard let data = self.swrContext.resample(audioFrame) else {
return nil
}
@ -67,10 +71,14 @@ final class FFMpegAudioFrameDecoder: MediaTrackFrameDecoder {
}
func decode() -> MediaTrackFrame? {
guard let audioFrame = self.audioFrame else {
return nil
}
while true {
let result = self.codecContext.receive(into: self.audioFrame)
let result = self.codecContext.receive(into: audioFrame)
if case .success = result {
if let convertedFrame = convertAudioFrame(self.audioFrame) {
if let convertedFrame = convertAudioFrame(audioFrame) {
self.delayedFrames.append(convertedFrame)
}
} else {

View file

@ -47,7 +47,7 @@ public final class FFMpegMediaVideoFrameDecoder: MediaTrackFrameDecoder {
private let codecContext: FFMpegAVCodecContext
private let videoFrame: FFMpegAVFrame
private let videoFrame: FFMpegAVFrame?
private var resetDecoderOnNextFrame = true
private var isError = false
@ -91,27 +91,29 @@ public final class FFMpegMediaVideoFrameDecoder: MediaTrackFrameDecoder {
}
public func receiveFromDecoder(ptsOffset: CMTime?, displayImmediately: Bool = true) -> ReceiveResult {
guard let videoFrame = self.videoFrame else {
return .error
}
if self.isError {
return .error
}
guard let defaultTimescale = self.defaultTimescale, let defaultDuration = self.defaultDuration else {
return .error
}
let receiveResult = self.codecContext.receive(into: self.videoFrame)
let receiveResult = self.codecContext.receive(into: videoFrame)
switch receiveResult {
case .success:
if self.videoFrame.width * self.videoFrame.height > 4 * 1024 * 4 * 1024 {
if videoFrame.width * videoFrame.height > 4 * 1024 * 4 * 1024 {
self.isError = true
return .error
}
var pts = CMTimeMake(value: self.videoFrame.pts, timescale: defaultTimescale)
var pts = CMTimeMake(value: videoFrame.pts, timescale: defaultTimescale)
if let ptsOffset = ptsOffset {
pts = CMTimeAdd(pts, ptsOffset)
}
if let convertedFrame = convertVideoFrame(self.videoFrame, pts: pts, dts: pts, duration: self.videoFrame.duration > 0 ? CMTimeMake(value: self.videoFrame.duration, timescale: defaultTimescale) : defaultDuration, displayImmediately: displayImmediately) {
if let convertedFrame = convertVideoFrame(videoFrame, pts: pts, dts: pts, duration: videoFrame.duration > 0 ? CMTimeMake(value: videoFrame.duration, timescale: defaultTimescale) : defaultDuration, displayImmediately: displayImmediately) {
return .result(convertedFrame)
} else {
return .error
@ -137,6 +139,9 @@ public final class FFMpegMediaVideoFrameDecoder: MediaTrackFrameDecoder {
}
public func decode(ptsOffset: CMTime?, forceARGB: Bool = false, unpremultiplyAlpha: Bool = true, displayImmediately: Bool = true) -> MediaTrackFrame? {
guard let videoFrame = self.videoFrame else {
return nil
}
if self.isError {
return nil
}
@ -144,23 +149,26 @@ public final class FFMpegMediaVideoFrameDecoder: MediaTrackFrameDecoder {
return nil
}
if self.codecContext.receive(into: self.videoFrame) == .success {
if self.videoFrame.width * self.videoFrame.height > 4 * 1024 * 4 * 1024 {
if self.codecContext.receive(into: videoFrame) == .success {
if videoFrame.width * videoFrame.height > 4 * 1024 * 4 * 1024 {
self.isError = true
return nil
}
var pts = CMTimeMake(value: self.videoFrame.pts, timescale: defaultTimescale)
var pts = CMTimeMake(value: videoFrame.pts, timescale: defaultTimescale)
if let ptsOffset = ptsOffset {
pts = CMTimeAdd(pts, ptsOffset)
}
return convertVideoFrame(self.videoFrame, pts: pts, dts: pts, duration: defaultDuration, forceARGB: forceARGB, unpremultiplyAlpha: unpremultiplyAlpha, displayImmediately: displayImmediately)
return convertVideoFrame(videoFrame, pts: pts, dts: pts, duration: defaultDuration, forceARGB: forceARGB, unpremultiplyAlpha: unpremultiplyAlpha, displayImmediately: displayImmediately)
}
return nil
}
public func receiveRemainingFrames(ptsOffset: CMTime?) -> [MediaTrackFrame] {
guard let videoFrame = self.videoFrame else {
return []
}
guard let defaultTimescale = self.defaultTimescale, let defaultDuration = self.defaultDuration else {
return []
}
@ -173,17 +181,17 @@ public final class FFMpegMediaVideoFrameDecoder: MediaTrackFrameDecoder {
self.delayedFrames.removeAll()
while true {
if case .success = self.codecContext.receive(into: self.videoFrame) {
if self.videoFrame.width * self.videoFrame.height > 4 * 1024 * 4 * 1024 {
if case .success = self.codecContext.receive(into: videoFrame) {
if videoFrame.width * videoFrame.height > 4 * 1024 * 4 * 1024 {
self.isError = true
return []
}
var pts = CMTimeMake(value: self.videoFrame.pts, timescale: defaultTimescale)
var pts = CMTimeMake(value: videoFrame.pts, timescale: defaultTimescale)
if let ptsOffset = ptsOffset {
pts = CMTimeAdd(pts, ptsOffset)
}
if let convertedFrame = convertVideoFrame(self.videoFrame, pts: pts, dts: pts, duration: self.videoFrame.duration > 0 ? CMTimeMake(value: self.videoFrame.duration, timescale: defaultTimescale) : defaultDuration) {
if let convertedFrame = convertVideoFrame(videoFrame, pts: pts, dts: pts, duration: videoFrame.duration > 0 ? CMTimeMake(value: videoFrame.duration, timescale: defaultTimescale) : defaultDuration) {
result.append(convertedFrame)
}
} else {
@ -194,15 +202,18 @@ public final class FFMpegMediaVideoFrameDecoder: MediaTrackFrameDecoder {
}
public func render(frame: MediaTrackDecodableFrame) -> UIImage? {
guard let videoFrame = self.videoFrame else {
return nil
}
let status = frame.packet.send(toDecoder: self.codecContext)
if status == 0 {
if case .success = self.codecContext.receive(into: self.videoFrame) {
if self.videoFrame.width * self.videoFrame.height > 4 * 1024 * 4 * 1024 {
if case .success = self.codecContext.receive(into: videoFrame) {
if videoFrame.width * videoFrame.height > 4 * 1024 * 4 * 1024 {
self.isError = true
return nil
}
return convertVideoFrameToImage(self.videoFrame)
return convertVideoFrameToImage(videoFrame)
}
}
@ -229,7 +240,39 @@ public final class FFMpegMediaVideoFrameDecoder: MediaTrackFrameDecoder {
}
}
private static func isPlanarYUV420Safe(_ frame: FFMpegAVFrame) -> Bool {
// Layout must be a planar YUV/YUVA 420 variant. Anything else (BGRA, NV12, gray8,
// YUV422P, ) must not reach the planar 420 vImage conversion or the planar copy
// path that force-unwraps data[1]/data[2].
let format = frame.pixelFormat
guard format == .YUV || format == .YUVA else {
return false
}
// Reject bottom-up / negative-stride frames before any row-copy loop ffmpeg
// rawdec flips linesize[0] for codec_tag WRAW/cyuv/BottomUp, and other decoders
// (dxtory, mimic, mjpegdec, scpr) flip the chroma planes too.
if frame.lineSize[0] < 0 || frame.lineSize[1] < 0 || frame.lineSize[2] < 0 {
return false
}
if format == .YUVA && frame.lineSize[3] < 0 {
return false
}
if frame.data[0] == nil || frame.data[1] == nil || frame.data[2] == nil {
return false
}
if format == .YUVA && frame.data[3] == nil {
return false
}
if frame.width <= 0 || frame.height <= 0 {
return false
}
return true
}
private func convertVideoFrameToImage(_ frame: FFMpegAVFrame) -> UIImage? {
guard FFMpegMediaVideoFrameDecoder.isPlanarYUV420Safe(frame) else {
return nil
}
var info = vImage_YpCbCrToARGB()
var pixelRange: vImage_YpCbCrPixelRange
@ -314,7 +357,7 @@ public final class FFMpegMediaVideoFrameDecoder: MediaTrackFrameDecoder {
return MediaTrackFrame(type: .video, sampleBuffer: sampleBuffer!, resetDecoder: resetDecoder, decoded: true)
}
if frame.data[0] == nil {
guard FFMpegMediaVideoFrameDecoder.isPlanarYUV420Safe(frame) else {
return nil
}
if frame.lineSize[1] != frame.lineSize[2] {

View file

@ -11,7 +11,6 @@ swift_library(
],
deps = [
"//submodules/Display:Display",
"//submodules/Postbox:Postbox",
"//submodules/TelegramCore:TelegramCore",
"//submodules/TelegramPresentationData:TelegramPresentationData",
"//submodules/TelegramStringFormatting:TelegramStringFormatting",

View file

@ -12,7 +12,6 @@ swift_library(
deps = [
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
"//submodules/Display:Display",
"//submodules/Postbox:Postbox",
"//submodules/TelegramCore:TelegramCore",
"//submodules/TelegramPresentationData:TelegramPresentationData",
"//submodules/ItemListUI:ItemListUI",

View file

@ -13,7 +13,6 @@ swift_library(
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
"//submodules/Display:Display",
"//submodules/Postbox:Postbox",
"//submodules/TelegramCore:TelegramCore",
"//submodules/TelegramPresentationData:TelegramPresentationData",
"//submodules/TelegramUIPreferences:TelegramUIPreferences",

View file

@ -27,7 +27,6 @@ swift_library(
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
"//submodules/Display:Display",
"//submodules/Postbox:Postbox",
"//submodules/TelegramCore:TelegramCore",
"//submodules/AccountContext:AccountContext",
"//submodules/TelegramPresentationData:TelegramPresentationData",

View file

@ -29,7 +29,6 @@ swift_library(
"//submodules/InviteLinksUI:InviteLinksUI",
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
"//submodules/Postbox:Postbox",
"//submodules/TelegramCore:TelegramCore",
"//submodules/TelegramUIPreferences:TelegramUIPreferences",
"//submodules/ItemListUI:ItemListUI",

View file

@ -13,7 +13,6 @@ swift_library(
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
"//submodules/Display:Display",
"//submodules/Postbox:Postbox",
"//submodules/TelegramCore:TelegramCore",
"//submodules/TelegramPresentationData:TelegramPresentationData",
"//submodules/AccountContext:AccountContext",

View file

@ -821,12 +821,12 @@ public class AvatarGalleryController: ViewController, StandalonePresentableContr
for (lhs, rhs) in zip(firstEntry.representations, updatedEntry.representations) {
if lhs.representation.dimensions == rhs.representation.dimensions {
strongSelf.context.account.postbox.mediaBox.copyResourceData(from: lhs.representation.resource.id, to: rhs.representation.resource.id, synchronous: true)
strongSelf.context.engine.resources.copyResourceData(from: EngineMediaResource.Id(lhs.representation.resource.id), to: EngineMediaResource.Id(rhs.representation.resource.id), synchronous: true)
}
}
for (lhs, rhs) in zip(firstEntry.videoRepresentations, updatedEntry.videoRepresentations) {
if lhs.representation.dimensions == rhs.representation.dimensions {
strongSelf.context.account.postbox.mediaBox.copyResourceData(from: lhs.representation.resource.id, to: rhs.representation.resource.id, synchronous: true)
strongSelf.context.engine.resources.copyResourceData(from: EngineMediaResource.Id(lhs.representation.resource.id), to: EngineMediaResource.Id(rhs.representation.resource.id), synchronous: true)
}
}

View file

@ -599,7 +599,7 @@ final class PeerAvatarImageGalleryItemNode: ZoomableContentGalleryItemNode {
if let entry = self.entry, let largestSize = largestImageRepresentation(entry.representations.map({ $0.representation })), let status = self.status {
switch status {
case .Fetching:
self.context.account.postbox.mediaBox.cancelInteractiveResourceFetch(largestSize.resource)
self.context.engine.resources.cancelInteractiveResourceFetch(id: EngineMediaResource.Id(largestSize.resource.id))
case .Remote:
let representations: [ImageRepresentationWithReference]
switch entry {

View file

@ -13,7 +13,6 @@ swift_library(
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
"//submodules/Display:Display",
"//submodules/Postbox:Postbox",
"//submodules/TelegramCore:TelegramCore",
"//submodules/TelegramPresentationData:TelegramPresentationData",
"//submodules/AvatarNode:AvatarNode",

View file

@ -13,7 +13,6 @@ swift_library(
"//submodules/SSignalKit/SwiftSignalKit",
"//submodules/AsyncDisplayKit",
"//submodules/Display",
"//submodules/Postbox",
"//submodules/TelegramCore",
"//submodules/TelegramPresentationData",
"//submodules/AccountContext",

View file

@ -410,7 +410,7 @@ private enum DeviceContactInfoEntry: ItemListNodeEntry {
if let context = arguments.context as? ShareControllerAppAccountContext {
itemContext = .accountContext(context.context)
} else {
itemContext = .other(accountPeerId: arguments.context.accountPeerId, postbox: arguments.context.stateManager.postbox, network: arguments.context.stateManager.network)
itemContext = .other(accountPeerId: arguments.context.accountPeerId, stateManager: arguments.context.stateManager)
}
return ItemListAvatarAndNameInfoItem(itemContext: itemContext, presentationData: presentationData, dateTimeFormat: dateTimeFormat, mode: .contact, peer: peer, presence: nil, label: jobSummary, memberCount: nil, state: state, sectionId: self.section, style: arguments.isPlain ? .plain : .blocks(withTopInset: false, withExtendedBottomInset: true), editingNameUpdated: { editingName in
arguments.updateEditingName(editingName)

View file

@ -2076,7 +2076,7 @@ public func chatMessagePhotoStatus(context: AccountContext, messageId: MessageId
if let range = representationFetchRangeForDisplayAtSize(representation: largestRepresentation, dimension: displayAtSize) {
return combineLatest(
context.fetchManager.fetchStatus(category: .image, location: .chat(messageId.peerId), locationKey: .messageId(messageId), resource: largestRepresentation.resource),
context.account.postbox.mediaBox.resourceRangesStatus(largestRepresentation.resource)
context.engine.resources.resourceRangesStatus(resource: EngineMediaResource(largestRepresentation.resource))
)
|> map { status, rangeStatus -> MediaResourceStatus in
if rangeStatus.isSuperset(of: RangeSet<Int64>(range)) {

View file

@ -1,39 +1,72 @@
import Foundation
final class MutableMessageHistoryThreadIndexView: MutablePostboxView {
final class Item {
let id: Int64
let pinnedIndex: Int?
let index: MessageIndex
var info: CodableEntry
var tagSummaryInfo: [ChatListEntryMessageTagSummaryKey: ChatListMessageTagSummaryInfo]
var topMessage: Message?
var embeddedInterfaceState: StoredPeerChatInterfaceState?
init(
id: Int64,
pinnedIndex: Int?,
index: MessageIndex,
info: CodableEntry,
tagSummaryInfo: [ChatListEntryMessageTagSummaryKey: ChatListMessageTagSummaryInfo],
topMessage: Message?,
embeddedInterfaceState: StoredPeerChatInterfaceState?
) {
self.id = id
self.pinnedIndex = pinnedIndex
self.index = index
self.info = info
self.tagSummaryInfo = tagSummaryInfo
self.topMessage = topMessage
self.embeddedInterfaceState = embeddedInterfaceState
}
public final class MessageHistoryThreadIndexItem: Equatable {
public let id: Int64
public let pinnedIndex: Int?
public let index: MessageIndex
public var info: CodableEntry
public var tagSummaryInfo: [ChatListEntryMessageTagSummaryKey: ChatListMessageTagSummaryInfo]
public var topMessage: Message?
public var embeddedInterfaceState: StoredPeerChatInterfaceState?
public init(
id: Int64,
pinnedIndex: Int?,
index: MessageIndex,
info: CodableEntry,
tagSummaryInfo: [ChatListEntryMessageTagSummaryKey: ChatListMessageTagSummaryInfo],
topMessage: Message?,
embeddedInterfaceState: StoredPeerChatInterfaceState?
) {
self.id = id
self.pinnedIndex = pinnedIndex
self.index = index
self.info = info
self.tagSummaryInfo = tagSummaryInfo
self.topMessage = topMessage
self.embeddedInterfaceState = embeddedInterfaceState
}
public static func ==(lhs: MessageHistoryThreadIndexItem, rhs: MessageHistoryThreadIndexItem) -> Bool {
if lhs.id != rhs.id {
return false
}
if lhs.pinnedIndex != rhs.pinnedIndex {
return false
}
if lhs.index != rhs.index {
return false
}
if lhs.info != rhs.info {
return false
}
if lhs.tagSummaryInfo != rhs.tagSummaryInfo {
return false
}
if let lhsMessage = lhs.topMessage, let rhsMessage = rhs.topMessage {
if lhsMessage.index != rhsMessage.index {
return false
}
if lhsMessage.stableVersion != rhsMessage.stableVersion {
return false
}
} else if (lhs.topMessage == nil) != (rhs.topMessage == nil) {
return false
}
if lhs.embeddedInterfaceState != rhs.embeddedInterfaceState {
return false
}
return true
}
}
final class MutableMessageHistoryThreadIndexView: MutablePostboxView {
fileprivate let peerId: PeerId
fileprivate let summaryComponents: ChatListEntrySummaryComponents
fileprivate var peer: Peer?
fileprivate var peerNotificationSettings: PeerNotificationSettings?
fileprivate var items: [Item] = []
fileprivate var items: [MessageHistoryThreadIndexItem] = []
private var hole: ForumTopicListHolesEntry?
fileprivate var isLoading: Bool = false
@ -99,7 +132,7 @@ final class MutableMessageHistoryThreadIndexView: MutablePostboxView {
var embeddedInterfaceState: StoredPeerChatInterfaceState?
embeddedInterfaceState = postbox.peerChatThreadInterfaceStateTable.get(PeerChatThreadId(peerId: self.peerId, threadId: item.threadId))
self.items.append(Item(
self.items.append(MessageHistoryThreadIndexItem(
id: item.threadId,
pinnedIndex: pinnedIndex,
index: item.index,
@ -152,93 +185,16 @@ final class MutableMessageHistoryThreadIndexView: MutablePostboxView {
}
}
public final class EngineMessageHistoryThread {
public final class Item: Equatable {
public let id: Int64
public let pinnedIndex: Int?
public let index: MessageIndex
public let info: CodableEntry
public let tagSummaryInfo: [ChatListEntryMessageTagSummaryKey: ChatListMessageTagSummaryInfo]
public let topMessage: Message?
public let embeddedInterfaceState: StoredPeerChatInterfaceState?
public init(
id: Int64,
pinnedIndex: Int?,
index: MessageIndex,
info: CodableEntry,
tagSummaryInfo: [ChatListEntryMessageTagSummaryKey: ChatListMessageTagSummaryInfo],
topMessage: Message?,
embeddedInterfaceState: StoredPeerChatInterfaceState?
) {
self.id = id
self.pinnedIndex = pinnedIndex
self.index = index
self.info = info
self.tagSummaryInfo = tagSummaryInfo
self.topMessage = topMessage
self.embeddedInterfaceState = embeddedInterfaceState
}
public static func ==(lhs: Item, rhs: Item) -> Bool {
if lhs.id != rhs.id {
return false
}
if lhs.pinnedIndex != rhs.pinnedIndex {
return false
}
if lhs.index != rhs.index {
return false
}
if lhs.info != rhs.info {
return false
}
if lhs.tagSummaryInfo != rhs.tagSummaryInfo {
return false
}
if let lhsMessage = lhs.topMessage, let rhsMessage = rhs.topMessage {
if lhsMessage.index != rhsMessage.index {
return false
}
if lhsMessage.stableVersion != rhsMessage.stableVersion {
return false
}
} else if (lhs.topMessage == nil) != (rhs.topMessage == nil) {
return false
}
if lhs.embeddedInterfaceState != rhs.embeddedInterfaceState {
return false
}
return true
}
}
}
public final class MessageHistoryThreadIndexView: PostboxView {
public let peer: Peer?
public let peerNotificationSettings: PeerNotificationSettings?
public let items: [EngineMessageHistoryThread.Item]
public let items: [MessageHistoryThreadIndexItem]
public let isLoading: Bool
init(_ view: MutableMessageHistoryThreadIndexView) {
self.peer = view.peer
self.peerNotificationSettings = view.peerNotificationSettings
var items: [EngineMessageHistoryThread.Item] = []
for item in view.items {
items.append(EngineMessageHistoryThread.Item(
id: item.id,
pinnedIndex: item.pinnedIndex,
index: item.index,
info: item.info,
tagSummaryInfo: item.tagSummaryInfo,
topMessage: item.topMessage,
embeddedInterfaceState: item.embeddedInterfaceState
))
}
self.items = items
self.items = view.items
self.isLoading = view.isLoading
}
}

View file

@ -116,7 +116,7 @@ private class StickerNode: ASDisplayNode {
let dimensions = file.dimensions ?? PixelDimensions(width: 512, height: 512)
let fittedDimensions = dimensions.cgSize.aspectFitted(CGSize(width: 240.0, height: 240.0))
let pathPrefix = context.account.postbox.mediaBox.shortLivedResourceCachePathPrefix(file.resource.id)
let pathPrefix = context.engine.resources.shortLivedResourceCachePathPrefix(id: EngineMediaResource.Id(file.resource.id))
animationNode.setup(source: AnimatedStickerResourceSource(account: self.context.account, resource: file.resource, isVideo: file.isVideoSticker), width: Int(fittedDimensions.width * 1.6), height: Int(fittedDimensions.height * 1.6), playbackMode: .loop, mode: .direct(cachePathPrefix: pathPrefix))
self.imageNode.setSignal(chatMessageAnimatedSticker(postbox: context.account.postbox, userLocation: .other, file: file, small: false, size: fittedDimensions))
@ -133,7 +133,7 @@ private class StickerNode: ASDisplayNode {
additionalAnimationNode = DirectAnimatedStickerNode()
var pathPrefix: String?
pathPrefix = context.account.postbox.mediaBox.shortLivedResourceCachePathPrefix(effect.resource.id)
pathPrefix = context.engine.resources.shortLivedResourceCachePathPrefix(id: EngineMediaResource.Id(effect.resource.id))
pathPrefix = nil
additionalAnimationNode.setup(source: source, width: Int(fittedDimensions.width * 1.5), height: Int(fittedDimensions.height * 1.5), playbackMode: .loop, mode: .direct(cachePathPrefix: pathPrefix))

View file

@ -2769,7 +2769,7 @@ public final class ReactionContextNode: ASDisplayNode, ASScrollViewDelegate {
}
let additionalAnimationFile = additionalAnimation._parse()
additionalAnimationNodeValue.setup(source: AnimatedStickerResourceSource(account: itemNode.context.account, resource: additionalAnimationFile.resource), width: Int(effectFrame.width * 2.0), height: Int(effectFrame.height * 2.0), playbackMode: .once, mode: .direct(cachePathPrefix: self.context.account.postbox.mediaBox.shortLivedResourceCachePathPrefix(additionalAnimationFile.resource.id)))
additionalAnimationNodeValue.setup(source: AnimatedStickerResourceSource(account: itemNode.context.account, resource: additionalAnimationFile.resource), width: Int(effectFrame.width * 2.0), height: Int(effectFrame.height * 2.0), playbackMode: .once, mode: .direct(cachePathPrefix: self.context.engine.resources.shortLivedResourceCachePathPrefix(id: EngineMediaResource.Id(additionalAnimationFile.resource.id))))
additionalAnimationNodeValue.frame = effectFrame
additionalAnimationNodeValue.updateLayout(size: effectFrame.size)
self.addSubnode(additionalAnimationNodeValue)
@ -3921,7 +3921,7 @@ public final class StandaloneReactionAnimation: ASDisplayNode {
}
}
additionalAnimationNodeValue.setup(source: AnimatedStickerResourceSource(account: context.account, resource: additionalAnimation.resource), width: Int(effectFrame.width * 2.0), height: Int(effectFrame.height * 2.0), playbackMode: .once, mode: .direct(cachePathPrefix: context.account.postbox.mediaBox.shortLivedResourceCachePathPrefix(additionalAnimation.resource.id)))
additionalAnimationNodeValue.setup(source: AnimatedStickerResourceSource(account: context.account, resource: additionalAnimation.resource), width: Int(effectFrame.width * 2.0), height: Int(effectFrame.height * 2.0), playbackMode: .once, mode: .direct(cachePathPrefix: context.engine.resources.shortLivedResourceCachePathPrefix(id: EngineMediaResource.Id(additionalAnimation.resource.id))))
additionalAnimationNodeValue.frame = effectFrame
additionalAnimationNodeValue.updateLayout(size: effectFrame.size)
self.addSubnode(additionalAnimationNodeValue)

View file

@ -360,10 +360,10 @@ public final class ReactionNode: ASDisplayNode, ReactionItemNode {
if largeExpanded {
let source = AnimatedStickerResourceSource(account: self.context.account, resource: self.item.largeListAnimation._parse().resource, isVideo: self.item.largeListAnimation.isVideoSticker || self.item.largeListAnimation.isVideoEmoji || self.item.largeListAnimation.isStaticSticker || self.item.largeListAnimation.isStaticEmoji)
animationNode.setup(source: source, width: Int(expandedAnimationFrame.width * 2.0), height: Int(expandedAnimationFrame.height * 2.0), playbackMode: .once, mode: .direct(cachePathPrefix: self.context.account.postbox.mediaBox.shortLivedResourceCachePathPrefix(self.item.largeListAnimation._parse().resource.id)))
animationNode.setup(source: source, width: Int(expandedAnimationFrame.width * 2.0), height: Int(expandedAnimationFrame.height * 2.0), playbackMode: .once, mode: .direct(cachePathPrefix: self.context.engine.resources.shortLivedResourceCachePathPrefix(id: EngineMediaResource.Id(self.item.largeListAnimation._parse().resource.id))))
} else {
let source = AnimatedStickerResourceSource(account: self.context.account, resource: self.item.listAnimation._parse().resource, isVideo: self.item.listAnimation.isVideoSticker || self.item.listAnimation.isVideoEmoji || self.item.listAnimation.isVideoSticker || self.item.listAnimation.isStaticSticker || self.item.listAnimation.isStaticEmoji)
animationNode.setup(source: source, width: Int(expandedAnimationFrame.width * 2.0), height: Int(expandedAnimationFrame.height * 2.0), playbackMode: .once, mode: .direct(cachePathPrefix: self.context.account.postbox.mediaBox.shortLivedResourceCachePathPrefix(self.item.listAnimation._parse().resource.id)))
animationNode.setup(source: source, width: Int(expandedAnimationFrame.width * 2.0), height: Int(expandedAnimationFrame.height * 2.0), playbackMode: .once, mode: .direct(cachePathPrefix: self.context.engine.resources.shortLivedResourceCachePathPrefix(id: EngineMediaResource.Id(self.item.listAnimation._parse().resource.id))))
}
animationNode.frame = expandedAnimationFrame
animationNode.updateLayout(size: expandedAnimationFrame.size)
@ -447,7 +447,7 @@ public final class ReactionNode: ASDisplayNode, ReactionItemNode {
self.stillAnimationNode = stillAnimationNode
self.addSubnode(stillAnimationNode)
stillAnimationNode.setup(source: AnimatedStickerResourceSource(account: self.context.account, resource: self.item.stillAnimation._parse().resource, isVideo: self.item.stillAnimation.isVideoEmoji || self.item.stillAnimation.isVideoSticker || self.item.stillAnimation.isStaticSticker || self.item.stillAnimation.isStaticEmoji), width: Int(animationDisplaySize.width * 2.0), height: Int(animationDisplaySize.height * 2.0), playbackMode: self.loopIdle ? .loop : .still(.start), mode: .direct(cachePathPrefix: self.context.account.postbox.mediaBox.shortLivedResourceCachePathPrefix(self.item.stillAnimation._parse().resource.id)))
stillAnimationNode.setup(source: AnimatedStickerResourceSource(account: self.context.account, resource: self.item.stillAnimation._parse().resource, isVideo: self.item.stillAnimation.isVideoEmoji || self.item.stillAnimation.isVideoSticker || self.item.stillAnimation.isStaticSticker || self.item.stillAnimation.isStaticEmoji), width: Int(animationDisplaySize.width * 2.0), height: Int(animationDisplaySize.height * 2.0), playbackMode: self.loopIdle ? .loop : .still(.start), mode: .direct(cachePathPrefix: self.context.engine.resources.shortLivedResourceCachePathPrefix(id: EngineMediaResource.Id(self.item.stillAnimation._parse().resource.id))))
stillAnimationNode.position = animationFrame.center
stillAnimationNode.bounds = CGRect(origin: CGPoint(), size: animationFrame.size)
stillAnimationNode.updateLayout(size: animationFrame.size)
@ -532,9 +532,9 @@ public final class ReactionNode: ASDisplayNode, ReactionItemNode {
self.staticAnimationNode.automaticallyLoadFirstFrame = true
if !self.hasAppearAnimation {
self.staticAnimationNode.setup(source: AnimatedStickerResourceSource(account: self.context.account, resource: self.item.largeListAnimation._parse().resource, isVideo: self.item.largeListAnimation.isVideoEmoji || self.item.largeListAnimation.isVideoSticker || self.item.largeListAnimation.isStaticSticker || self.item.largeListAnimation.isStaticEmoji), width: Int(expandedAnimationFrame.width * 2.0), height: Int(expandedAnimationFrame.height * 2.0), playbackMode: .still(.start), mode: .direct(cachePathPrefix: self.context.account.postbox.mediaBox.shortLivedResourceCachePathPrefix(self.item.largeListAnimation._parse().resource.id)))
self.staticAnimationNode.setup(source: AnimatedStickerResourceSource(account: self.context.account, resource: self.item.largeListAnimation._parse().resource, isVideo: self.item.largeListAnimation.isVideoEmoji || self.item.largeListAnimation.isVideoSticker || self.item.largeListAnimation.isStaticSticker || self.item.largeListAnimation.isStaticEmoji), width: Int(expandedAnimationFrame.width * 2.0), height: Int(expandedAnimationFrame.height * 2.0), playbackMode: .still(.start), mode: .direct(cachePathPrefix: self.context.engine.resources.shortLivedResourceCachePathPrefix(id: EngineMediaResource.Id(self.item.largeListAnimation._parse().resource.id))))
} else {
self.staticAnimationNode.setup(source: AnimatedStickerResourceSource(account: self.context.account, resource: self.item.stillAnimation._parse().resource, isVideo: self.item.stillAnimation.isVideoEmoji || self.item.stillAnimation.isVideoSticker || self.item.stillAnimation.isStaticSticker || self.item.stillAnimation.isStaticEmoji), width: Int(animationDisplaySize.width * 2.0), height: Int(animationDisplaySize.height * 2.0), playbackMode: .still(.start), mode: .direct(cachePathPrefix: self.context.account.postbox.mediaBox.shortLivedResourceCachePathPrefix(self.item.stillAnimation._parse().resource.id)))
self.staticAnimationNode.setup(source: AnimatedStickerResourceSource(account: self.context.account, resource: self.item.stillAnimation._parse().resource, isVideo: self.item.stillAnimation.isVideoEmoji || self.item.stillAnimation.isVideoSticker || self.item.stillAnimation.isStaticSticker || self.item.stillAnimation.isStaticEmoji), width: Int(animationDisplaySize.width * 2.0), height: Int(animationDisplaySize.height * 2.0), playbackMode: .still(.start), mode: .direct(cachePathPrefix: self.context.engine.resources.shortLivedResourceCachePathPrefix(id: EngineMediaResource.Id(self.item.stillAnimation._parse().resource.id))))
}
self.staticAnimationNode.position = animationFrame.center
self.staticAnimationNode.bounds = CGRect(origin: CGPoint(), size: animationFrame.size)
@ -547,7 +547,7 @@ public final class ReactionNode: ASDisplayNode, ReactionItemNode {
}
if let animateInAnimationNode = self.animateInAnimationNode {
animateInAnimationNode.setup(source: AnimatedStickerResourceSource(account: self.context.account, resource: self.item.appearAnimation._parse().resource, isVideo: self.item.appearAnimation.isVideoEmoji || self.item.appearAnimation.isVideoSticker || self.item.appearAnimation.isStaticSticker || self.item.appearAnimation.isStaticEmoji), width: Int(animationDisplaySize.width * 2.0), height: Int(animationDisplaySize.height * 2.0), playbackMode: .once, mode: .direct(cachePathPrefix: self.context.account.postbox.mediaBox.shortLivedResourceCachePathPrefix(self.item.appearAnimation._parse().resource.id)))
animateInAnimationNode.setup(source: AnimatedStickerResourceSource(account: self.context.account, resource: self.item.appearAnimation._parse().resource, isVideo: self.item.appearAnimation.isVideoEmoji || self.item.appearAnimation.isVideoSticker || self.item.appearAnimation.isStaticSticker || self.item.appearAnimation.isStaticEmoji), width: Int(animationDisplaySize.width * 2.0), height: Int(animationDisplaySize.height * 2.0), playbackMode: .once, mode: .direct(cachePathPrefix: self.context.engine.resources.shortLivedResourceCachePathPrefix(id: EngineMediaResource.Id(self.item.appearAnimation._parse().resource.id))))
animateInAnimationNode.position = animationFrame.center
animateInAnimationNode.bounds = CGRect(origin: CGPoint(), size: animationFrame.size)
animateInAnimationNode.updateLayout(size: animationFrame.size)

View file

@ -11,7 +11,6 @@ swift_library(
],
deps = [
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
"//submodules/Postbox:Postbox",
"//submodules/TelegramCore:TelegramCore",
"//submodules/AccountContext:AccountContext",
"//submodules/StringTransliteration:StringTransliteration",

View file

@ -12,7 +12,6 @@ swift_library(
deps = [
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
"//submodules/TelegramCore:TelegramCore",
"//submodules/Postbox:Postbox",
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
"//submodules/Display:Display",
"//submodules/TelegramPresentationData:TelegramPresentationData",

View file

@ -3,7 +3,6 @@ import UIKit
import AsyncDisplayKit
import Display
import TelegramCore
import Postbox
import SwiftSignalKit
import TelegramPresentationData
import AvatarNode
@ -108,7 +107,7 @@ public final class SelectablePeerNode: ASDisplayNode {
didSet {
if !self.theme.isEqual(to: oldValue) {
if let peer = self.peer, let mainPeer = peer.chatMainPeer {
self.textNode.attributedText = NSAttributedString(string: mainPeer.debugDisplayTitle, font: textFont, textColor: self.currentSelected ? self.theme.selectedTextColor : (peer.peerId.namespace == Namespaces.Peer.SecretChat ? self.theme.secretTextColor : self.theme.textColor), paragraphAlignment: .center)
self.textNode.attributedText = NSAttributedString(string: mainPeer.debugDisplayTitle, font: textFont, textColor: self.currentSelected ? self.theme.selectedTextColor : (peer.peerId.isSecretChat ? self.theme.secretTextColor : self.theme.textColor), paragraphAlignment: .center)
}
}
}
@ -159,8 +158,7 @@ public final class SelectablePeerNode: ASDisplayNode {
public func setup(context: AccountContext, theme: PresentationTheme, strings: PresentationStrings, peer: EngineRenderedPeer, requiresPremiumForMessaging: Bool, requiresStars: Int64? = nil, customTitle: String? = nil, iconId: Int64? = nil, iconColor: Int32? = nil, online: Bool = false, numberOfLines: Int = 2, synchronousLoad: Bool) {
self.setup(
accountPeerId: context.account.peerId,
postbox: context.account.postbox,
network: context.account.network,
stateManager: context.account.stateManager,
energyUsageSettings: context.sharedContext.energyUsageSettings,
contentSettings: context.currentContentSettings.with { $0 },
animationCache: context.animationCache,
@ -182,7 +180,7 @@ public final class SelectablePeerNode: ASDisplayNode {
)
}
public func setupStoryRepost(accountPeerId: EnginePeer.Id, postbox: Postbox, network: Network, theme: PresentationTheme, strings: PresentationStrings, synchronousLoad: Bool, storyMode: StoryMode) {
public func setupStoryRepost(accountPeerId: EnginePeer.Id, stateManager: AccountStateManager, theme: PresentationTheme, strings: PresentationStrings, synchronousLoad: Bool, storyMode: StoryMode) {
self.peer = nil
let title: String
@ -202,14 +200,14 @@ public final class SelectablePeerNode: ASDisplayNode {
self.textNode.maximumNumberOfLines = 2
self.textNode.attributedText = NSAttributedString(string: title, font: textFont, textColor: self.theme.textColor, paragraphAlignment: .center)
self.avatarNode.setPeer(accountPeerId: accountPeerId, postbox: postbox, network: network, contentSettings: ContentSettings.default, theme: theme, peer: nil, overrideImage: overrideImage, emptyColor: self.theme.avatarPlaceholderColor, clipStyle: .round, synchronousLoad: synchronousLoad)
self.avatarNode.setPeer(accountPeerId: accountPeerId, postbox: stateManager.postbox, network: stateManager.network, contentSettings: ContentSettings.default, theme: theme, peer: nil, overrideImage: overrideImage, emptyColor: self.theme.avatarPlaceholderColor, clipStyle: .round, synchronousLoad: synchronousLoad)
if case .repostIcon = overrideImage {
self.avatarNode.playRepostAnimation()
}
}
public func setup(accountPeerId: EnginePeer.Id, postbox: Postbox, network: Network, energyUsageSettings: EnergyUsageSettings, contentSettings: ContentSettings, animationCache: AnimationCache, animationRenderer: MultiAnimationRenderer, resolveInlineStickers: @escaping ([Int64]) -> Signal<[Int64: TelegramMediaFile], NoError>, theme: PresentationTheme, strings: PresentationStrings, peer: EngineRenderedPeer, requiresPremiumForMessaging: Bool, requiresStars: Int64? = nil, customTitle: String? = nil, iconId: Int64? = nil, iconColor: Int32? = nil, online: Bool = false, numberOfLines: Int = 2, synchronousLoad: Bool) {
public func setup(accountPeerId: EnginePeer.Id, stateManager: AccountStateManager, energyUsageSettings: EnergyUsageSettings, contentSettings: ContentSettings, animationCache: AnimationCache, animationRenderer: MultiAnimationRenderer, resolveInlineStickers: @escaping ([Int64]) -> Signal<[Int64: TelegramMediaFile], NoError>, theme: PresentationTheme, strings: PresentationStrings, peer: EngineRenderedPeer, requiresPremiumForMessaging: Bool, requiresStars: Int64? = nil, customTitle: String? = nil, iconId: Int64? = nil, iconColor: Int32? = nil, online: Bool = false, numberOfLines: Int = 2, synchronousLoad: Bool) {
let isFirstTime = self.peer == nil
self.peer = peer
guard let mainPeer = peer.chatOrMonoforumMainPeer else {
@ -222,7 +220,7 @@ public final class SelectablePeerNode: ASDisplayNode {
if requiresPremiumForMessaging {
defaultColor = self.theme.textColor.withMultipliedAlpha(0.4)
} else {
defaultColor = peer.peerId.namespace == Namespaces.Peer.SecretChat ? self.theme.secretTextColor : self.theme.textColor
defaultColor = peer.peerId.isSecretChat ? self.theme.secretTextColor : self.theme.textColor
}
var isForum = false
@ -256,7 +254,7 @@ public final class SelectablePeerNode: ASDisplayNode {
} else {
clipStyle = .round
}
self.avatarNode.setPeer(accountPeerId: accountPeerId, postbox: postbox, network: network, contentSettings: contentSettings, theme: theme, peer: mainPeer, overrideImage: overrideImage, emptyColor: self.theme.avatarPlaceholderColor, clipStyle: clipStyle, synchronousLoad: synchronousLoad)
self.avatarNode.setPeer(accountPeerId: accountPeerId, postbox: stateManager.postbox, network: stateManager.network, contentSettings: contentSettings, theme: theme, peer: mainPeer, overrideImage: overrideImage, emptyColor: self.theme.avatarPlaceholderColor, clipStyle: clipStyle, synchronousLoad: synchronousLoad)
if let requiresStars {
let avatarBadgeOutline: UIImageView
@ -373,7 +371,7 @@ public final class SelectablePeerNode: ASDisplayNode {
let iconSize = self.iconView.update(
transition: .easeInOut(duration: 0.2),
component: AnyComponent(EmojiStatusComponent(
postbox: postbox,
postbox: stateManager.postbox,
energyUsageSettings: energyUsageSettings,
resolveInlineStickers: resolveInlineStickers,
animationCache: animationCache,
@ -404,7 +402,7 @@ public final class SelectablePeerNode: ASDisplayNode {
self.currentSelected = selected
if let attributedText = self.textNode.attributedText {
self.textNode.attributedText = NSAttributedString(string: attributedText.string, font: textFont, textColor: selected ? self.theme.selectedTextColor : (self.peer?.peerId.namespace == Namespaces.Peer.SecretChat ? self.theme.secretTextColor : self.theme.textColor), paragraphAlignment: .center)
self.textNode.attributedText = NSAttributedString(string: attributedText.string, font: textFont, textColor: selected ? self.theme.selectedTextColor : ((self.peer?.peerId.isSecretChat ?? false) ? self.theme.secretTextColor : self.theme.textColor), paragraphAlignment: .center)
}
var isForum = false

View file

@ -48,8 +48,7 @@ private struct PeersEntry: Comparable, Identifiable {
strings: self.strings,
mode: .list(compact: true),
accountPeerId: context.account.peerId,
postbox: context.account.postbox,
network: context.account.network,
stateManager: context.account.stateManager,
energyUsageSettings: context.sharedContext.energyUsageSettings,
contentSettings: context.currentContentSettings.with { $0 },
animationCache: context.animationCache,

View file

@ -268,7 +268,7 @@ private final class ThemeGridThemeItemIconNode : ASDisplayNode {
}
self.animatedStickerNode = animatedStickerNode
self.emojiContainerNode.insertSubnode(animatedStickerNode, belowSubnode: self.placeholderNode)
let pathPrefix = item.context.account.postbox.mediaBox.shortLivedResourceCachePathPrefix(file.resource.id)
let pathPrefix = item.context.engine.resources.shortLivedResourceCachePathPrefix(id: EngineMediaResource.Id(file.resource.id))
animatedStickerNode.setup(source: AnimatedStickerResourceSource(account: item.context.account, resource: file.resource), width: 128, height: 128, playbackMode: .still(.start), mode: .direct(cachePathPrefix: pathPrefix))
animatedStickerNode.anchorPoint = CGPoint(x: 0.5, y: 1.0)

View file

@ -575,7 +575,7 @@ public func editThemeController(context: AccountContext, mode: EditThemeControll
let themeThumbnailData: Data?
if let theme = theme, let themeString = encodePresentationTheme(theme), let data = themeString.data(using: .utf8) {
let resource = LocalFileMediaResource(fileId: Int64.random(in: Int64.min ... Int64.max))
context.account.postbox.mediaBox.storeResourceData(resource.id, data: data, synchronous: true)
context.engine.resources.storeResourceData(id: EngineMediaResource.Id(resource.id), data: data, synchronous: true)
context.sharedContext.accountManager.mediaBox.storeResourceData(resource.id, data: data, synchronous: true)
themeResource = resource
themeData = data
@ -612,7 +612,7 @@ public func editThemeController(context: AccountContext, mode: EditThemeControll
let resource = file.file.resource
var data: Data?
if let path = context.account.postbox.mediaBox.completedResourcePath(resource), let maybeData = try? Data(contentsOf: URL(fileURLWithPath: path), options: .mappedRead) {
if let path = context.engine.resources.completedResourcePath(id: EngineMediaResource.Id(resource.id)), let maybeData = try? Data(contentsOf: URL(fileURLWithPath: path), options: .mappedRead) {
data = maybeData
} else if let path = context.sharedContext.accountManager.mediaBox.completedResourcePath(resource), let maybeData = try? Data(contentsOf: URL(fileURLWithPath: path), options: .mappedRead) {
data = maybeData

View file

@ -267,7 +267,7 @@ public final class ThemePreviewController: ViewController {
case .media:
if let strings = encodePresentationTheme(previewTheme), let data = strings.data(using: .utf8) {
let resource = LocalFileMediaResource(fileId: Int64.random(in: Int64.min ... Int64.max))
context.account.postbox.mediaBox.storeResourceData(resource.id, data: data)
context.engine.resources.storeResourceData(id: EngineMediaResource.Id(resource.id), data: data)
context.sharedContext.accountManager.mediaBox.storeResourceData(resource.id, data: data)
theme = .single(.local(PresentationLocalTheme(title: previewTheme.name.string, resource: resource, resolvedWallpaper: nil)))
} else {

View file

@ -1145,8 +1145,7 @@ public final class ShareController: ViewController {
for info in strongSelf.switchableAccounts {
items.append(ActionSheetPeerItem(
accountPeerId: info.account.accountPeerId,
postbox: info.account.stateManager.postbox,
network: info.account.stateManager.network,
stateManager: info.account.stateManager,
contentSettings: info.account.contentSettings,
peer: EnginePeer(info.peer),
title: EnginePeer(info.peer).displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder),

View file

@ -236,8 +236,7 @@ final class ShareControllerPeerGridItemNode: GridItemNode {
let resolveInlineStickers = context.resolveInlineStickers
self.peerNode.setup(
accountPeerId: context.accountPeerId,
postbox: context.stateManager.postbox,
network: context.stateManager.network,
stateManager: context.stateManager,
energyUsageSettings: environment.energyUsageSettings,
contentSettings: context.contentSettings,
animationCache: context.animationCache,
@ -272,8 +271,7 @@ final class ShareControllerPeerGridItemNode: GridItemNode {
}
self.peerNode.setupStoryRepost(
accountPeerId: context.accountPeerId,
postbox: context.stateManager.postbox,
network: context.stateManager.network,
stateManager: context.stateManager,
theme: theme,
strings: strings,
synchronousLoad: synchronousLoad,

View file

@ -63,8 +63,7 @@ final class ShareControllerRecentPeersGridItemNode: GridItemNode {
} else {
peersNode = ChatListSearchRecentPeersNode(
accountPeerId: context.accountPeerId,
postbox: context.stateManager.postbox,
network: context.stateManager.network,
stateManager: context.stateManager,
energyUsageSettings: environment.energyUsageSettings,
contentSettings: context.contentSettings,
animationCache: context.animationCache,

View file

@ -59,7 +59,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[-1194283041] = { return Api.AccountDaysTTL.parse_accountDaysTTL($0) }
dict[-805945687] = { return Api.AiComposeTone.parse_aiComposeTone($0) }
dict[-1683135468] = { return Api.AiComposeTone.parse_aiComposeToneDefault($0) }
dict[-1461961831] = { return Api.AiComposeToneExample.parse_aiComposeToneExample($0) }
dict[-237623060] = { return Api.AiComposeToneExample.parse_aiComposeToneExample($0) }
dict[-653423106] = { return Api.AttachMenuBot.parse_attachMenuBot($0) }
dict[-1297663893] = { return Api.AttachMenuBotIcon.parse_attachMenuBotIcon($0) }
dict[1165423600] = { return Api.AttachMenuBotIconColor.parse_attachMenuBotIconColor($0) }
@ -203,7 +203,6 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[-531931925] = { return Api.ChannelParticipantsFilter.parse_channelParticipantsMentions($0) }
dict[-566281095] = { return Api.ChannelParticipantsFilter.parse_channelParticipantsRecent($0) }
dict[106343499] = { return Api.ChannelParticipantsFilter.parse_channelParticipantsSearch($0) }
dict[-1817845901] = { return Api.ChannelTopic.parse_channelTopic($0) }
dict[473084188] = { return Api.Chat.parse_channel($0) }
dict[399807445] = { return Api.Chat.parse_channelForbidden($0) }
dict[1103884886] = { return Api.Chat.parse_chat($0) }
@ -807,7 +806,6 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[-193510921] = { return Api.PeerSettings.parse_peerSettings($0) }
dict[-1707742823] = { return Api.PeerStories.parse_peerStories($0) }
dict[-404214254] = { return Api.PendingSuggestion.parse_pendingSuggestion($0) }
dict[431767677] = { return Api.PersonalChannel.parse_personalChannel($0) }
dict[810769141] = { return Api.PhoneCall.parse_phoneCall($0) }
dict[912311057] = { return Api.PhoneCall.parse_phoneCallAccepted($0) }
dict[1355435489] = { return Api.PhoneCall.parse_phoneCallDiscarded($0) }
@ -1382,8 +1380,6 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[-541588713] = { return Api.channels.ChannelParticipant.parse_channelParticipant($0) }
dict[-1699676497] = { return Api.channels.ChannelParticipants.parse_channelParticipants($0) }
dict[-266911767] = { return Api.channels.ChannelParticipants.parse_channelParticipantsNotModified($0) }
dict[824755388] = { return Api.channels.Found.parse_found($0) }
dict[-694491059] = { return Api.channels.PersonalChannels.parse_personalChannels($0) }
dict[-191450938] = { return Api.channels.SendAsPeers.parse_sendAsPeers($0) }
dict[1044107055] = { return Api.channels.SponsoredMessageReportResult.parse_sponsoredMessageReportResultAdsHidden($0) }
dict[-2073059774] = { return Api.channels.SponsoredMessageReportResult.parse_sponsoredMessageReportResultChooseOption($0) }
@ -1791,8 +1787,6 @@ public extension Api {
_1.serialize(buffer, boxed)
case let _1 as Api.ChannelParticipantsFilter:
_1.serialize(buffer, boxed)
case let _1 as Api.ChannelTopic:
_1.serialize(buffer, boxed)
case let _1 as Api.Chat:
_1.serialize(buffer, boxed)
case let _1 as Api.ChatAdminRights:
@ -2173,8 +2167,6 @@ public extension Api {
_1.serialize(buffer, boxed)
case let _1 as Api.PendingSuggestion:
_1.serialize(buffer, boxed)
case let _1 as Api.PersonalChannel:
_1.serialize(buffer, boxed)
case let _1 as Api.PhoneCall:
_1.serialize(buffer, boxed)
case let _1 as Api.PhoneCallDiscardReason:
@ -2537,10 +2529,6 @@ public extension Api {
_1.serialize(buffer, boxed)
case let _1 as Api.channels.ChannelParticipants:
_1.serialize(buffer, boxed)
case let _1 as Api.channels.Found:
_1.serialize(buffer, boxed)
case let _1 as Api.channels.PersonalChannels:
_1.serialize(buffer, boxed)
case let _1 as Api.channels.SendAsPeers:
_1.serialize(buffer, boxed)
case let _1 as Api.channels.SponsoredMessageReportResult:

View file

@ -206,9 +206,9 @@ public extension Api {
public extension Api {
enum AiComposeToneExample: TypeConstructorDescription {
public class Cons_aiComposeToneExample: TypeConstructorDescription {
public var from: String
public var to: String
public init(from: String, to: String) {
public var from: Api.TextWithEntities
public var to: Api.TextWithEntities
public init(from: Api.TextWithEntities, to: Api.TextWithEntities) {
self.from = from
self.to = to
}
@ -222,10 +222,10 @@ public extension Api {
switch self {
case .aiComposeToneExample(let _data):
if boxed {
buffer.appendInt32(-1461961831)
buffer.appendInt32(-237623060)
}
serializeString(_data.from, buffer: buffer, boxed: false)
serializeString(_data.to, buffer: buffer, boxed: false)
_data.from.serialize(buffer, true)
_data.to.serialize(buffer, true)
break
}
}
@ -238,10 +238,14 @@ public extension Api {
}
public static func parse_aiComposeToneExample(_ reader: BufferReader) -> AiComposeToneExample? {
var _1: String?
_1 = parseString(reader)
var _2: String?
_2 = parseString(reader)
var _1: Api.TextWithEntities?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.TextWithEntities
}
var _2: Api.TextWithEntities?
if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.TextWithEntities
}
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {

View file

@ -1801,48 +1801,431 @@ public extension Api {
}
}
public extension Api {
enum PersonalChannel: TypeConstructorDescription {
public class Cons_personalChannel: TypeConstructorDescription {
public var userId: Int64
public var channelId: Int64
public init(userId: Int64, channelId: Int64) {
self.userId = userId
self.channelId = channelId
enum PhoneCall: TypeConstructorDescription {
public class Cons_phoneCall: TypeConstructorDescription {
public var flags: Int32
public var id: Int64
public var accessHash: Int64
public var date: Int32
public var adminId: Int64
public var participantId: Int64
public var gAOrB: Buffer
public var keyFingerprint: Int64
public var `protocol`: Api.PhoneCallProtocol
public var connections: [Api.PhoneConnection]
public var startDate: Int32
public var customParameters: Api.DataJSON?
public init(flags: Int32, id: Int64, accessHash: Int64, date: Int32, adminId: Int64, participantId: Int64, gAOrB: Buffer, keyFingerprint: Int64, `protocol`: Api.PhoneCallProtocol, connections: [Api.PhoneConnection], startDate: Int32, customParameters: Api.DataJSON?) {
self.flags = flags
self.id = id
self.accessHash = accessHash
self.date = date
self.adminId = adminId
self.participantId = participantId
self.gAOrB = gAOrB
self.keyFingerprint = keyFingerprint
self.`protocol` = `protocol`
self.connections = connections
self.startDate = startDate
self.customParameters = customParameters
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("personalChannel", [("userId", ConstructorParameterDescription(self.userId)), ("channelId", ConstructorParameterDescription(self.channelId))])
return ("phoneCall", [("flags", ConstructorParameterDescription(self.flags)), ("id", ConstructorParameterDescription(self.id)), ("accessHash", ConstructorParameterDescription(self.accessHash)), ("date", ConstructorParameterDescription(self.date)), ("adminId", ConstructorParameterDescription(self.adminId)), ("participantId", ConstructorParameterDescription(self.participantId)), ("gAOrB", ConstructorParameterDescription(self.gAOrB)), ("keyFingerprint", ConstructorParameterDescription(self.keyFingerprint)), ("`protocol`", ConstructorParameterDescription(self.`protocol`)), ("connections", ConstructorParameterDescription(self.connections)), ("startDate", ConstructorParameterDescription(self.startDate)), ("customParameters", ConstructorParameterDescription(self.customParameters))])
}
}
case personalChannel(Cons_personalChannel)
public class Cons_phoneCallAccepted: TypeConstructorDescription {
public var flags: Int32
public var id: Int64
public var accessHash: Int64
public var date: Int32
public var adminId: Int64
public var participantId: Int64
public var gB: Buffer
public var `protocol`: Api.PhoneCallProtocol
public init(flags: Int32, id: Int64, accessHash: Int64, date: Int32, adminId: Int64, participantId: Int64, gB: Buffer, `protocol`: Api.PhoneCallProtocol) {
self.flags = flags
self.id = id
self.accessHash = accessHash
self.date = date
self.adminId = adminId
self.participantId = participantId
self.gB = gB
self.`protocol` = `protocol`
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("phoneCallAccepted", [("flags", ConstructorParameterDescription(self.flags)), ("id", ConstructorParameterDescription(self.id)), ("accessHash", ConstructorParameterDescription(self.accessHash)), ("date", ConstructorParameterDescription(self.date)), ("adminId", ConstructorParameterDescription(self.adminId)), ("participantId", ConstructorParameterDescription(self.participantId)), ("gB", ConstructorParameterDescription(self.gB)), ("`protocol`", ConstructorParameterDescription(self.`protocol`))])
}
}
public class Cons_phoneCallDiscarded: TypeConstructorDescription {
public var flags: Int32
public var id: Int64
public var reason: Api.PhoneCallDiscardReason?
public var duration: Int32?
public init(flags: Int32, id: Int64, reason: Api.PhoneCallDiscardReason?, duration: Int32?) {
self.flags = flags
self.id = id
self.reason = reason
self.duration = duration
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("phoneCallDiscarded", [("flags", ConstructorParameterDescription(self.flags)), ("id", ConstructorParameterDescription(self.id)), ("reason", ConstructorParameterDescription(self.reason)), ("duration", ConstructorParameterDescription(self.duration))])
}
}
public class Cons_phoneCallEmpty: TypeConstructorDescription {
public var id: Int64
public init(id: Int64) {
self.id = id
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("phoneCallEmpty", [("id", ConstructorParameterDescription(self.id))])
}
}
public class Cons_phoneCallRequested: TypeConstructorDescription {
public var flags: Int32
public var id: Int64
public var accessHash: Int64
public var date: Int32
public var adminId: Int64
public var participantId: Int64
public var gAHash: Buffer
public var `protocol`: Api.PhoneCallProtocol
public init(flags: Int32, id: Int64, accessHash: Int64, date: Int32, adminId: Int64, participantId: Int64, gAHash: Buffer, `protocol`: Api.PhoneCallProtocol) {
self.flags = flags
self.id = id
self.accessHash = accessHash
self.date = date
self.adminId = adminId
self.participantId = participantId
self.gAHash = gAHash
self.`protocol` = `protocol`
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("phoneCallRequested", [("flags", ConstructorParameterDescription(self.flags)), ("id", ConstructorParameterDescription(self.id)), ("accessHash", ConstructorParameterDescription(self.accessHash)), ("date", ConstructorParameterDescription(self.date)), ("adminId", ConstructorParameterDescription(self.adminId)), ("participantId", ConstructorParameterDescription(self.participantId)), ("gAHash", ConstructorParameterDescription(self.gAHash)), ("`protocol`", ConstructorParameterDescription(self.`protocol`))])
}
}
public class Cons_phoneCallWaiting: TypeConstructorDescription {
public var flags: Int32
public var id: Int64
public var accessHash: Int64
public var date: Int32
public var adminId: Int64
public var participantId: Int64
public var `protocol`: Api.PhoneCallProtocol
public var receiveDate: Int32?
public init(flags: Int32, id: Int64, accessHash: Int64, date: Int32, adminId: Int64, participantId: Int64, `protocol`: Api.PhoneCallProtocol, receiveDate: Int32?) {
self.flags = flags
self.id = id
self.accessHash = accessHash
self.date = date
self.adminId = adminId
self.participantId = participantId
self.`protocol` = `protocol`
self.receiveDate = receiveDate
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("phoneCallWaiting", [("flags", ConstructorParameterDescription(self.flags)), ("id", ConstructorParameterDescription(self.id)), ("accessHash", ConstructorParameterDescription(self.accessHash)), ("date", ConstructorParameterDescription(self.date)), ("adminId", ConstructorParameterDescription(self.adminId)), ("participantId", ConstructorParameterDescription(self.participantId)), ("`protocol`", ConstructorParameterDescription(self.`protocol`)), ("receiveDate", ConstructorParameterDescription(self.receiveDate))])
}
}
case phoneCall(Cons_phoneCall)
case phoneCallAccepted(Cons_phoneCallAccepted)
case phoneCallDiscarded(Cons_phoneCallDiscarded)
case phoneCallEmpty(Cons_phoneCallEmpty)
case phoneCallRequested(Cons_phoneCallRequested)
case phoneCallWaiting(Cons_phoneCallWaiting)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .personalChannel(let _data):
case .phoneCall(let _data):
if boxed {
buffer.appendInt32(431767677)
buffer.appendInt32(810769141)
}
serializeInt32(_data.flags, buffer: buffer, boxed: false)
serializeInt64(_data.id, buffer: buffer, boxed: false)
serializeInt64(_data.accessHash, buffer: buffer, boxed: false)
serializeInt32(_data.date, buffer: buffer, boxed: false)
serializeInt64(_data.adminId, buffer: buffer, boxed: false)
serializeInt64(_data.participantId, buffer: buffer, boxed: false)
serializeBytes(_data.gAOrB, buffer: buffer, boxed: false)
serializeInt64(_data.keyFingerprint, buffer: buffer, boxed: false)
_data.`protocol`.serialize(buffer, true)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.connections.count))
for item in _data.connections {
item.serialize(buffer, true)
}
serializeInt32(_data.startDate, buffer: buffer, boxed: false)
if Int(_data.flags) & Int(1 << 7) != 0 {
_data.customParameters!.serialize(buffer, true)
}
break
case .phoneCallAccepted(let _data):
if boxed {
buffer.appendInt32(912311057)
}
serializeInt32(_data.flags, buffer: buffer, boxed: false)
serializeInt64(_data.id, buffer: buffer, boxed: false)
serializeInt64(_data.accessHash, buffer: buffer, boxed: false)
serializeInt32(_data.date, buffer: buffer, boxed: false)
serializeInt64(_data.adminId, buffer: buffer, boxed: false)
serializeInt64(_data.participantId, buffer: buffer, boxed: false)
serializeBytes(_data.gB, buffer: buffer, boxed: false)
_data.`protocol`.serialize(buffer, true)
break
case .phoneCallDiscarded(let _data):
if boxed {
buffer.appendInt32(1355435489)
}
serializeInt32(_data.flags, buffer: buffer, boxed: false)
serializeInt64(_data.id, buffer: buffer, boxed: false)
if Int(_data.flags) & Int(1 << 0) != 0 {
_data.reason!.serialize(buffer, true)
}
if Int(_data.flags) & Int(1 << 1) != 0 {
serializeInt32(_data.duration!, buffer: buffer, boxed: false)
}
break
case .phoneCallEmpty(let _data):
if boxed {
buffer.appendInt32(1399245077)
}
serializeInt64(_data.id, buffer: buffer, boxed: false)
break
case .phoneCallRequested(let _data):
if boxed {
buffer.appendInt32(347139340)
}
serializeInt32(_data.flags, buffer: buffer, boxed: false)
serializeInt64(_data.id, buffer: buffer, boxed: false)
serializeInt64(_data.accessHash, buffer: buffer, boxed: false)
serializeInt32(_data.date, buffer: buffer, boxed: false)
serializeInt64(_data.adminId, buffer: buffer, boxed: false)
serializeInt64(_data.participantId, buffer: buffer, boxed: false)
serializeBytes(_data.gAHash, buffer: buffer, boxed: false)
_data.`protocol`.serialize(buffer, true)
break
case .phoneCallWaiting(let _data):
if boxed {
buffer.appendInt32(-987599081)
}
serializeInt32(_data.flags, buffer: buffer, boxed: false)
serializeInt64(_data.id, buffer: buffer, boxed: false)
serializeInt64(_data.accessHash, buffer: buffer, boxed: false)
serializeInt32(_data.date, buffer: buffer, boxed: false)
serializeInt64(_data.adminId, buffer: buffer, boxed: false)
serializeInt64(_data.participantId, buffer: buffer, boxed: false)
_data.`protocol`.serialize(buffer, true)
if Int(_data.flags) & Int(1 << 0) != 0 {
serializeInt32(_data.receiveDate!, buffer: buffer, boxed: false)
}
serializeInt64(_data.userId, buffer: buffer, boxed: false)
serializeInt64(_data.channelId, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .personalChannel(let _data):
return ("personalChannel", [("userId", ConstructorParameterDescription(_data.userId)), ("channelId", ConstructorParameterDescription(_data.channelId))])
case .phoneCall(let _data):
return ("phoneCall", [("flags", ConstructorParameterDescription(_data.flags)), ("id", ConstructorParameterDescription(_data.id)), ("accessHash", ConstructorParameterDescription(_data.accessHash)), ("date", ConstructorParameterDescription(_data.date)), ("adminId", ConstructorParameterDescription(_data.adminId)), ("participantId", ConstructorParameterDescription(_data.participantId)), ("gAOrB", ConstructorParameterDescription(_data.gAOrB)), ("keyFingerprint", ConstructorParameterDescription(_data.keyFingerprint)), ("`protocol`", ConstructorParameterDescription(_data.`protocol`)), ("connections", ConstructorParameterDescription(_data.connections)), ("startDate", ConstructorParameterDescription(_data.startDate)), ("customParameters", ConstructorParameterDescription(_data.customParameters))])
case .phoneCallAccepted(let _data):
return ("phoneCallAccepted", [("flags", ConstructorParameterDescription(_data.flags)), ("id", ConstructorParameterDescription(_data.id)), ("accessHash", ConstructorParameterDescription(_data.accessHash)), ("date", ConstructorParameterDescription(_data.date)), ("adminId", ConstructorParameterDescription(_data.adminId)), ("participantId", ConstructorParameterDescription(_data.participantId)), ("gB", ConstructorParameterDescription(_data.gB)), ("`protocol`", ConstructorParameterDescription(_data.`protocol`))])
case .phoneCallDiscarded(let _data):
return ("phoneCallDiscarded", [("flags", ConstructorParameterDescription(_data.flags)), ("id", ConstructorParameterDescription(_data.id)), ("reason", ConstructorParameterDescription(_data.reason)), ("duration", ConstructorParameterDescription(_data.duration))])
case .phoneCallEmpty(let _data):
return ("phoneCallEmpty", [("id", ConstructorParameterDescription(_data.id))])
case .phoneCallRequested(let _data):
return ("phoneCallRequested", [("flags", ConstructorParameterDescription(_data.flags)), ("id", ConstructorParameterDescription(_data.id)), ("accessHash", ConstructorParameterDescription(_data.accessHash)), ("date", ConstructorParameterDescription(_data.date)), ("adminId", ConstructorParameterDescription(_data.adminId)), ("participantId", ConstructorParameterDescription(_data.participantId)), ("gAHash", ConstructorParameterDescription(_data.gAHash)), ("`protocol`", ConstructorParameterDescription(_data.`protocol`))])
case .phoneCallWaiting(let _data):
return ("phoneCallWaiting", [("flags", ConstructorParameterDescription(_data.flags)), ("id", ConstructorParameterDescription(_data.id)), ("accessHash", ConstructorParameterDescription(_data.accessHash)), ("date", ConstructorParameterDescription(_data.date)), ("adminId", ConstructorParameterDescription(_data.adminId)), ("participantId", ConstructorParameterDescription(_data.participantId)), ("`protocol`", ConstructorParameterDescription(_data.`protocol`)), ("receiveDate", ConstructorParameterDescription(_data.receiveDate))])
}
}
public static func parse_personalChannel(_ reader: BufferReader) -> PersonalChannel? {
var _1: Int64?
_1 = reader.readInt64()
public static func parse_phoneCall(_ reader: BufferReader) -> PhoneCall? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int64?
_2 = reader.readInt64()
var _3: Int64?
_3 = reader.readInt64()
var _4: Int32?
_4 = reader.readInt32()
var _5: Int64?
_5 = reader.readInt64()
var _6: Int64?
_6 = reader.readInt64()
var _7: Buffer?
_7 = parseBytes(reader)
var _8: Int64?
_8 = reader.readInt64()
var _9: Api.PhoneCallProtocol?
if let signature = reader.readInt32() {
_9 = Api.parse(reader, signature: signature) as? Api.PhoneCallProtocol
}
var _10: [Api.PhoneConnection]?
if let _ = reader.readInt32() {
_10 = Api.parseVector(reader, elementSignature: 0, elementType: Api.PhoneConnection.self)
}
var _11: Int32?
_11 = reader.readInt32()
var _12: Api.DataJSON?
if Int(_1!) & Int(1 << 7) != 0 {
if let signature = reader.readInt32() {
_12 = Api.parse(reader, signature: signature) as? Api.DataJSON
}
}
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.PersonalChannel.personalChannel(Cons_personalChannel(userId: _1!, channelId: _2!))
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
let _c7 = _7 != nil
let _c8 = _8 != nil
let _c9 = _9 != nil
let _c10 = _10 != nil
let _c11 = _11 != nil
let _c12 = (Int(_1!) & Int(1 << 7) == 0) || _12 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 {
return Api.PhoneCall.phoneCall(Cons_phoneCall(flags: _1!, id: _2!, accessHash: _3!, date: _4!, adminId: _5!, participantId: _6!, gAOrB: _7!, keyFingerprint: _8!, protocol: _9!, connections: _10!, startDate: _11!, customParameters: _12))
}
else {
return nil
}
}
public static func parse_phoneCallAccepted(_ reader: BufferReader) -> PhoneCall? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int64?
_2 = reader.readInt64()
var _3: Int64?
_3 = reader.readInt64()
var _4: Int32?
_4 = reader.readInt32()
var _5: Int64?
_5 = reader.readInt64()
var _6: Int64?
_6 = reader.readInt64()
var _7: Buffer?
_7 = parseBytes(reader)
var _8: Api.PhoneCallProtocol?
if let signature = reader.readInt32() {
_8 = Api.parse(reader, signature: signature) as? Api.PhoneCallProtocol
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
let _c7 = _7 != nil
let _c8 = _8 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
return Api.PhoneCall.phoneCallAccepted(Cons_phoneCallAccepted(flags: _1!, id: _2!, accessHash: _3!, date: _4!, adminId: _5!, participantId: _6!, gB: _7!, protocol: _8!))
}
else {
return nil
}
}
public static func parse_phoneCallDiscarded(_ reader: BufferReader) -> PhoneCall? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int64?
_2 = reader.readInt64()
var _3: Api.PhoneCallDiscardReason?
if Int(_1!) & Int(1 << 0) != 0 {
if let signature = reader.readInt32() {
_3 = Api.parse(reader, signature: signature) as? Api.PhoneCallDiscardReason
}
}
var _4: Int32?
if Int(_1!) & Int(1 << 1) != 0 {
_4 = reader.readInt32()
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.PhoneCall.phoneCallDiscarded(Cons_phoneCallDiscarded(flags: _1!, id: _2!, reason: _3, duration: _4))
}
else {
return nil
}
}
public static func parse_phoneCallEmpty(_ reader: BufferReader) -> PhoneCall? {
var _1: Int64?
_1 = reader.readInt64()
let _c1 = _1 != nil
if _c1 {
return Api.PhoneCall.phoneCallEmpty(Cons_phoneCallEmpty(id: _1!))
}
else {
return nil
}
}
public static func parse_phoneCallRequested(_ reader: BufferReader) -> PhoneCall? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int64?
_2 = reader.readInt64()
var _3: Int64?
_3 = reader.readInt64()
var _4: Int32?
_4 = reader.readInt32()
var _5: Int64?
_5 = reader.readInt64()
var _6: Int64?
_6 = reader.readInt64()
var _7: Buffer?
_7 = parseBytes(reader)
var _8: Api.PhoneCallProtocol?
if let signature = reader.readInt32() {
_8 = Api.parse(reader, signature: signature) as? Api.PhoneCallProtocol
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
let _c7 = _7 != nil
let _c8 = _8 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
return Api.PhoneCall.phoneCallRequested(Cons_phoneCallRequested(flags: _1!, id: _2!, accessHash: _3!, date: _4!, adminId: _5!, participantId: _6!, gAHash: _7!, protocol: _8!))
}
else {
return nil
}
}
public static func parse_phoneCallWaiting(_ reader: BufferReader) -> PhoneCall? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int64?
_2 = reader.readInt64()
var _3: Int64?
_3 = reader.readInt64()
var _4: Int32?
_4 = reader.readInt32()
var _5: Int64?
_5 = reader.readInt64()
var _6: Int64?
_6 = reader.readInt64()
var _7: Api.PhoneCallProtocol?
if let signature = reader.readInt32() {
_7 = Api.parse(reader, signature: signature) as? Api.PhoneCallProtocol
}
var _8: Int32?
if Int(_1!) & Int(1 << 0) != 0 {
_8 = reader.readInt32()
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
let _c7 = _7 != nil
let _c8 = (Int(_1!) & Int(1 << 0) == 0) || _8 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
return Api.PhoneCall.phoneCallWaiting(Cons_phoneCallWaiting(flags: _1!, id: _2!, accessHash: _3!, date: _4!, adminId: _5!, participantId: _6!, protocol: _7!, receiveDate: _8))
}
else {
return nil

View file

@ -1,436 +1,3 @@
public extension Api {
enum PhoneCall: TypeConstructorDescription {
public class Cons_phoneCall: TypeConstructorDescription {
public var flags: Int32
public var id: Int64
public var accessHash: Int64
public var date: Int32
public var adminId: Int64
public var participantId: Int64
public var gAOrB: Buffer
public var keyFingerprint: Int64
public var `protocol`: Api.PhoneCallProtocol
public var connections: [Api.PhoneConnection]
public var startDate: Int32
public var customParameters: Api.DataJSON?
public init(flags: Int32, id: Int64, accessHash: Int64, date: Int32, adminId: Int64, participantId: Int64, gAOrB: Buffer, keyFingerprint: Int64, `protocol`: Api.PhoneCallProtocol, connections: [Api.PhoneConnection], startDate: Int32, customParameters: Api.DataJSON?) {
self.flags = flags
self.id = id
self.accessHash = accessHash
self.date = date
self.adminId = adminId
self.participantId = participantId
self.gAOrB = gAOrB
self.keyFingerprint = keyFingerprint
self.`protocol` = `protocol`
self.connections = connections
self.startDate = startDate
self.customParameters = customParameters
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("phoneCall", [("flags", ConstructorParameterDescription(self.flags)), ("id", ConstructorParameterDescription(self.id)), ("accessHash", ConstructorParameterDescription(self.accessHash)), ("date", ConstructorParameterDescription(self.date)), ("adminId", ConstructorParameterDescription(self.adminId)), ("participantId", ConstructorParameterDescription(self.participantId)), ("gAOrB", ConstructorParameterDescription(self.gAOrB)), ("keyFingerprint", ConstructorParameterDescription(self.keyFingerprint)), ("`protocol`", ConstructorParameterDescription(self.`protocol`)), ("connections", ConstructorParameterDescription(self.connections)), ("startDate", ConstructorParameterDescription(self.startDate)), ("customParameters", ConstructorParameterDescription(self.customParameters))])
}
}
public class Cons_phoneCallAccepted: TypeConstructorDescription {
public var flags: Int32
public var id: Int64
public var accessHash: Int64
public var date: Int32
public var adminId: Int64
public var participantId: Int64
public var gB: Buffer
public var `protocol`: Api.PhoneCallProtocol
public init(flags: Int32, id: Int64, accessHash: Int64, date: Int32, adminId: Int64, participantId: Int64, gB: Buffer, `protocol`: Api.PhoneCallProtocol) {
self.flags = flags
self.id = id
self.accessHash = accessHash
self.date = date
self.adminId = adminId
self.participantId = participantId
self.gB = gB
self.`protocol` = `protocol`
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("phoneCallAccepted", [("flags", ConstructorParameterDescription(self.flags)), ("id", ConstructorParameterDescription(self.id)), ("accessHash", ConstructorParameterDescription(self.accessHash)), ("date", ConstructorParameterDescription(self.date)), ("adminId", ConstructorParameterDescription(self.adminId)), ("participantId", ConstructorParameterDescription(self.participantId)), ("gB", ConstructorParameterDescription(self.gB)), ("`protocol`", ConstructorParameterDescription(self.`protocol`))])
}
}
public class Cons_phoneCallDiscarded: TypeConstructorDescription {
public var flags: Int32
public var id: Int64
public var reason: Api.PhoneCallDiscardReason?
public var duration: Int32?
public init(flags: Int32, id: Int64, reason: Api.PhoneCallDiscardReason?, duration: Int32?) {
self.flags = flags
self.id = id
self.reason = reason
self.duration = duration
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("phoneCallDiscarded", [("flags", ConstructorParameterDescription(self.flags)), ("id", ConstructorParameterDescription(self.id)), ("reason", ConstructorParameterDescription(self.reason)), ("duration", ConstructorParameterDescription(self.duration))])
}
}
public class Cons_phoneCallEmpty: TypeConstructorDescription {
public var id: Int64
public init(id: Int64) {
self.id = id
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("phoneCallEmpty", [("id", ConstructorParameterDescription(self.id))])
}
}
public class Cons_phoneCallRequested: TypeConstructorDescription {
public var flags: Int32
public var id: Int64
public var accessHash: Int64
public var date: Int32
public var adminId: Int64
public var participantId: Int64
public var gAHash: Buffer
public var `protocol`: Api.PhoneCallProtocol
public init(flags: Int32, id: Int64, accessHash: Int64, date: Int32, adminId: Int64, participantId: Int64, gAHash: Buffer, `protocol`: Api.PhoneCallProtocol) {
self.flags = flags
self.id = id
self.accessHash = accessHash
self.date = date
self.adminId = adminId
self.participantId = participantId
self.gAHash = gAHash
self.`protocol` = `protocol`
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("phoneCallRequested", [("flags", ConstructorParameterDescription(self.flags)), ("id", ConstructorParameterDescription(self.id)), ("accessHash", ConstructorParameterDescription(self.accessHash)), ("date", ConstructorParameterDescription(self.date)), ("adminId", ConstructorParameterDescription(self.adminId)), ("participantId", ConstructorParameterDescription(self.participantId)), ("gAHash", ConstructorParameterDescription(self.gAHash)), ("`protocol`", ConstructorParameterDescription(self.`protocol`))])
}
}
public class Cons_phoneCallWaiting: TypeConstructorDescription {
public var flags: Int32
public var id: Int64
public var accessHash: Int64
public var date: Int32
public var adminId: Int64
public var participantId: Int64
public var `protocol`: Api.PhoneCallProtocol
public var receiveDate: Int32?
public init(flags: Int32, id: Int64, accessHash: Int64, date: Int32, adminId: Int64, participantId: Int64, `protocol`: Api.PhoneCallProtocol, receiveDate: Int32?) {
self.flags = flags
self.id = id
self.accessHash = accessHash
self.date = date
self.adminId = adminId
self.participantId = participantId
self.`protocol` = `protocol`
self.receiveDate = receiveDate
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("phoneCallWaiting", [("flags", ConstructorParameterDescription(self.flags)), ("id", ConstructorParameterDescription(self.id)), ("accessHash", ConstructorParameterDescription(self.accessHash)), ("date", ConstructorParameterDescription(self.date)), ("adminId", ConstructorParameterDescription(self.adminId)), ("participantId", ConstructorParameterDescription(self.participantId)), ("`protocol`", ConstructorParameterDescription(self.`protocol`)), ("receiveDate", ConstructorParameterDescription(self.receiveDate))])
}
}
case phoneCall(Cons_phoneCall)
case phoneCallAccepted(Cons_phoneCallAccepted)
case phoneCallDiscarded(Cons_phoneCallDiscarded)
case phoneCallEmpty(Cons_phoneCallEmpty)
case phoneCallRequested(Cons_phoneCallRequested)
case phoneCallWaiting(Cons_phoneCallWaiting)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .phoneCall(let _data):
if boxed {
buffer.appendInt32(810769141)
}
serializeInt32(_data.flags, buffer: buffer, boxed: false)
serializeInt64(_data.id, buffer: buffer, boxed: false)
serializeInt64(_data.accessHash, buffer: buffer, boxed: false)
serializeInt32(_data.date, buffer: buffer, boxed: false)
serializeInt64(_data.adminId, buffer: buffer, boxed: false)
serializeInt64(_data.participantId, buffer: buffer, boxed: false)
serializeBytes(_data.gAOrB, buffer: buffer, boxed: false)
serializeInt64(_data.keyFingerprint, buffer: buffer, boxed: false)
_data.`protocol`.serialize(buffer, true)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.connections.count))
for item in _data.connections {
item.serialize(buffer, true)
}
serializeInt32(_data.startDate, buffer: buffer, boxed: false)
if Int(_data.flags) & Int(1 << 7) != 0 {
_data.customParameters!.serialize(buffer, true)
}
break
case .phoneCallAccepted(let _data):
if boxed {
buffer.appendInt32(912311057)
}
serializeInt32(_data.flags, buffer: buffer, boxed: false)
serializeInt64(_data.id, buffer: buffer, boxed: false)
serializeInt64(_data.accessHash, buffer: buffer, boxed: false)
serializeInt32(_data.date, buffer: buffer, boxed: false)
serializeInt64(_data.adminId, buffer: buffer, boxed: false)
serializeInt64(_data.participantId, buffer: buffer, boxed: false)
serializeBytes(_data.gB, buffer: buffer, boxed: false)
_data.`protocol`.serialize(buffer, true)
break
case .phoneCallDiscarded(let _data):
if boxed {
buffer.appendInt32(1355435489)
}
serializeInt32(_data.flags, buffer: buffer, boxed: false)
serializeInt64(_data.id, buffer: buffer, boxed: false)
if Int(_data.flags) & Int(1 << 0) != 0 {
_data.reason!.serialize(buffer, true)
}
if Int(_data.flags) & Int(1 << 1) != 0 {
serializeInt32(_data.duration!, buffer: buffer, boxed: false)
}
break
case .phoneCallEmpty(let _data):
if boxed {
buffer.appendInt32(1399245077)
}
serializeInt64(_data.id, buffer: buffer, boxed: false)
break
case .phoneCallRequested(let _data):
if boxed {
buffer.appendInt32(347139340)
}
serializeInt32(_data.flags, buffer: buffer, boxed: false)
serializeInt64(_data.id, buffer: buffer, boxed: false)
serializeInt64(_data.accessHash, buffer: buffer, boxed: false)
serializeInt32(_data.date, buffer: buffer, boxed: false)
serializeInt64(_data.adminId, buffer: buffer, boxed: false)
serializeInt64(_data.participantId, buffer: buffer, boxed: false)
serializeBytes(_data.gAHash, buffer: buffer, boxed: false)
_data.`protocol`.serialize(buffer, true)
break
case .phoneCallWaiting(let _data):
if boxed {
buffer.appendInt32(-987599081)
}
serializeInt32(_data.flags, buffer: buffer, boxed: false)
serializeInt64(_data.id, buffer: buffer, boxed: false)
serializeInt64(_data.accessHash, buffer: buffer, boxed: false)
serializeInt32(_data.date, buffer: buffer, boxed: false)
serializeInt64(_data.adminId, buffer: buffer, boxed: false)
serializeInt64(_data.participantId, buffer: buffer, boxed: false)
_data.`protocol`.serialize(buffer, true)
if Int(_data.flags) & Int(1 << 0) != 0 {
serializeInt32(_data.receiveDate!, buffer: buffer, boxed: false)
}
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .phoneCall(let _data):
return ("phoneCall", [("flags", ConstructorParameterDescription(_data.flags)), ("id", ConstructorParameterDescription(_data.id)), ("accessHash", ConstructorParameterDescription(_data.accessHash)), ("date", ConstructorParameterDescription(_data.date)), ("adminId", ConstructorParameterDescription(_data.adminId)), ("participantId", ConstructorParameterDescription(_data.participantId)), ("gAOrB", ConstructorParameterDescription(_data.gAOrB)), ("keyFingerprint", ConstructorParameterDescription(_data.keyFingerprint)), ("`protocol`", ConstructorParameterDescription(_data.`protocol`)), ("connections", ConstructorParameterDescription(_data.connections)), ("startDate", ConstructorParameterDescription(_data.startDate)), ("customParameters", ConstructorParameterDescription(_data.customParameters))])
case .phoneCallAccepted(let _data):
return ("phoneCallAccepted", [("flags", ConstructorParameterDescription(_data.flags)), ("id", ConstructorParameterDescription(_data.id)), ("accessHash", ConstructorParameterDescription(_data.accessHash)), ("date", ConstructorParameterDescription(_data.date)), ("adminId", ConstructorParameterDescription(_data.adminId)), ("participantId", ConstructorParameterDescription(_data.participantId)), ("gB", ConstructorParameterDescription(_data.gB)), ("`protocol`", ConstructorParameterDescription(_data.`protocol`))])
case .phoneCallDiscarded(let _data):
return ("phoneCallDiscarded", [("flags", ConstructorParameterDescription(_data.flags)), ("id", ConstructorParameterDescription(_data.id)), ("reason", ConstructorParameterDescription(_data.reason)), ("duration", ConstructorParameterDescription(_data.duration))])
case .phoneCallEmpty(let _data):
return ("phoneCallEmpty", [("id", ConstructorParameterDescription(_data.id))])
case .phoneCallRequested(let _data):
return ("phoneCallRequested", [("flags", ConstructorParameterDescription(_data.flags)), ("id", ConstructorParameterDescription(_data.id)), ("accessHash", ConstructorParameterDescription(_data.accessHash)), ("date", ConstructorParameterDescription(_data.date)), ("adminId", ConstructorParameterDescription(_data.adminId)), ("participantId", ConstructorParameterDescription(_data.participantId)), ("gAHash", ConstructorParameterDescription(_data.gAHash)), ("`protocol`", ConstructorParameterDescription(_data.`protocol`))])
case .phoneCallWaiting(let _data):
return ("phoneCallWaiting", [("flags", ConstructorParameterDescription(_data.flags)), ("id", ConstructorParameterDescription(_data.id)), ("accessHash", ConstructorParameterDescription(_data.accessHash)), ("date", ConstructorParameterDescription(_data.date)), ("adminId", ConstructorParameterDescription(_data.adminId)), ("participantId", ConstructorParameterDescription(_data.participantId)), ("`protocol`", ConstructorParameterDescription(_data.`protocol`)), ("receiveDate", ConstructorParameterDescription(_data.receiveDate))])
}
}
public static func parse_phoneCall(_ reader: BufferReader) -> PhoneCall? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int64?
_2 = reader.readInt64()
var _3: Int64?
_3 = reader.readInt64()
var _4: Int32?
_4 = reader.readInt32()
var _5: Int64?
_5 = reader.readInt64()
var _6: Int64?
_6 = reader.readInt64()
var _7: Buffer?
_7 = parseBytes(reader)
var _8: Int64?
_8 = reader.readInt64()
var _9: Api.PhoneCallProtocol?
if let signature = reader.readInt32() {
_9 = Api.parse(reader, signature: signature) as? Api.PhoneCallProtocol
}
var _10: [Api.PhoneConnection]?
if let _ = reader.readInt32() {
_10 = Api.parseVector(reader, elementSignature: 0, elementType: Api.PhoneConnection.self)
}
var _11: Int32?
_11 = reader.readInt32()
var _12: Api.DataJSON?
if Int(_1!) & Int(1 << 7) != 0 {
if let signature = reader.readInt32() {
_12 = Api.parse(reader, signature: signature) as? Api.DataJSON
}
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
let _c7 = _7 != nil
let _c8 = _8 != nil
let _c9 = _9 != nil
let _c10 = _10 != nil
let _c11 = _11 != nil
let _c12 = (Int(_1!) & Int(1 << 7) == 0) || _12 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 {
return Api.PhoneCall.phoneCall(Cons_phoneCall(flags: _1!, id: _2!, accessHash: _3!, date: _4!, adminId: _5!, participantId: _6!, gAOrB: _7!, keyFingerprint: _8!, protocol: _9!, connections: _10!, startDate: _11!, customParameters: _12))
}
else {
return nil
}
}
public static func parse_phoneCallAccepted(_ reader: BufferReader) -> PhoneCall? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int64?
_2 = reader.readInt64()
var _3: Int64?
_3 = reader.readInt64()
var _4: Int32?
_4 = reader.readInt32()
var _5: Int64?
_5 = reader.readInt64()
var _6: Int64?
_6 = reader.readInt64()
var _7: Buffer?
_7 = parseBytes(reader)
var _8: Api.PhoneCallProtocol?
if let signature = reader.readInt32() {
_8 = Api.parse(reader, signature: signature) as? Api.PhoneCallProtocol
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
let _c7 = _7 != nil
let _c8 = _8 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
return Api.PhoneCall.phoneCallAccepted(Cons_phoneCallAccepted(flags: _1!, id: _2!, accessHash: _3!, date: _4!, adminId: _5!, participantId: _6!, gB: _7!, protocol: _8!))
}
else {
return nil
}
}
public static func parse_phoneCallDiscarded(_ reader: BufferReader) -> PhoneCall? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int64?
_2 = reader.readInt64()
var _3: Api.PhoneCallDiscardReason?
if Int(_1!) & Int(1 << 0) != 0 {
if let signature = reader.readInt32() {
_3 = Api.parse(reader, signature: signature) as? Api.PhoneCallDiscardReason
}
}
var _4: Int32?
if Int(_1!) & Int(1 << 1) != 0 {
_4 = reader.readInt32()
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.PhoneCall.phoneCallDiscarded(Cons_phoneCallDiscarded(flags: _1!, id: _2!, reason: _3, duration: _4))
}
else {
return nil
}
}
public static func parse_phoneCallEmpty(_ reader: BufferReader) -> PhoneCall? {
var _1: Int64?
_1 = reader.readInt64()
let _c1 = _1 != nil
if _c1 {
return Api.PhoneCall.phoneCallEmpty(Cons_phoneCallEmpty(id: _1!))
}
else {
return nil
}
}
public static func parse_phoneCallRequested(_ reader: BufferReader) -> PhoneCall? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int64?
_2 = reader.readInt64()
var _3: Int64?
_3 = reader.readInt64()
var _4: Int32?
_4 = reader.readInt32()
var _5: Int64?
_5 = reader.readInt64()
var _6: Int64?
_6 = reader.readInt64()
var _7: Buffer?
_7 = parseBytes(reader)
var _8: Api.PhoneCallProtocol?
if let signature = reader.readInt32() {
_8 = Api.parse(reader, signature: signature) as? Api.PhoneCallProtocol
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
let _c7 = _7 != nil
let _c8 = _8 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
return Api.PhoneCall.phoneCallRequested(Cons_phoneCallRequested(flags: _1!, id: _2!, accessHash: _3!, date: _4!, adminId: _5!, participantId: _6!, gAHash: _7!, protocol: _8!))
}
else {
return nil
}
}
public static func parse_phoneCallWaiting(_ reader: BufferReader) -> PhoneCall? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int64?
_2 = reader.readInt64()
var _3: Int64?
_3 = reader.readInt64()
var _4: Int32?
_4 = reader.readInt32()
var _5: Int64?
_5 = reader.readInt64()
var _6: Int64?
_6 = reader.readInt64()
var _7: Api.PhoneCallProtocol?
if let signature = reader.readInt32() {
_7 = Api.parse(reader, signature: signature) as? Api.PhoneCallProtocol
}
var _8: Int32?
if Int(_1!) & Int(1 << 0) != 0 {
_8 = reader.readInt32()
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
let _c7 = _7 != nil
let _c8 = (Int(_1!) & Int(1 << 0) == 0) || _8 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
return Api.PhoneCall.phoneCallWaiting(Cons_phoneCallWaiting(flags: _1!, id: _2!, accessHash: _3!, date: _4!, adminId: _5!, participantId: _6!, protocol: _7!, receiveDate: _8))
}
else {
return nil
}
}
}
}
public extension Api {
enum PhoneCallDiscardReason: TypeConstructorDescription {
public class Cons_phoneCallDiscardReasonMigrateConferenceCall: TypeConstructorDescription {
@ -1892,3 +1459,375 @@ public extension Api {
}
}
}
public extension Api {
enum PremiumSubscriptionOption: TypeConstructorDescription {
public class Cons_premiumSubscriptionOption: TypeConstructorDescription {
public var flags: Int32
public var transaction: String?
public var months: Int32
public var currency: String
public var amount: Int64
public var botUrl: String
public var storeProduct: String?
public init(flags: Int32, transaction: String?, months: Int32, currency: String, amount: Int64, botUrl: String, storeProduct: String?) {
self.flags = flags
self.transaction = transaction
self.months = months
self.currency = currency
self.amount = amount
self.botUrl = botUrl
self.storeProduct = storeProduct
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("premiumSubscriptionOption", [("flags", ConstructorParameterDescription(self.flags)), ("transaction", ConstructorParameterDescription(self.transaction)), ("months", ConstructorParameterDescription(self.months)), ("currency", ConstructorParameterDescription(self.currency)), ("amount", ConstructorParameterDescription(self.amount)), ("botUrl", ConstructorParameterDescription(self.botUrl)), ("storeProduct", ConstructorParameterDescription(self.storeProduct))])
}
}
case premiumSubscriptionOption(Cons_premiumSubscriptionOption)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .premiumSubscriptionOption(let _data):
if boxed {
buffer.appendInt32(1596792306)
}
serializeInt32(_data.flags, buffer: buffer, boxed: false)
if Int(_data.flags) & Int(1 << 3) != 0 {
serializeString(_data.transaction!, buffer: buffer, boxed: false)
}
serializeInt32(_data.months, buffer: buffer, boxed: false)
serializeString(_data.currency, buffer: buffer, boxed: false)
serializeInt64(_data.amount, buffer: buffer, boxed: false)
serializeString(_data.botUrl, buffer: buffer, boxed: false)
if Int(_data.flags) & Int(1 << 0) != 0 {
serializeString(_data.storeProduct!, buffer: buffer, boxed: false)
}
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .premiumSubscriptionOption(let _data):
return ("premiumSubscriptionOption", [("flags", ConstructorParameterDescription(_data.flags)), ("transaction", ConstructorParameterDescription(_data.transaction)), ("months", ConstructorParameterDescription(_data.months)), ("currency", ConstructorParameterDescription(_data.currency)), ("amount", ConstructorParameterDescription(_data.amount)), ("botUrl", ConstructorParameterDescription(_data.botUrl)), ("storeProduct", ConstructorParameterDescription(_data.storeProduct))])
}
}
public static func parse_premiumSubscriptionOption(_ reader: BufferReader) -> PremiumSubscriptionOption? {
var _1: Int32?
_1 = reader.readInt32()
var _2: String?
if Int(_1!) & Int(1 << 3) != 0 {
_2 = parseString(reader)
}
var _3: Int32?
_3 = reader.readInt32()
var _4: String?
_4 = parseString(reader)
var _5: Int64?
_5 = reader.readInt64()
var _6: String?
_6 = parseString(reader)
var _7: String?
if Int(_1!) & Int(1 << 0) != 0 {
_7 = parseString(reader)
}
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 3) == 0) || _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
let _c7 = (Int(_1!) & Int(1 << 0) == 0) || _7 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
return Api.PremiumSubscriptionOption.premiumSubscriptionOption(Cons_premiumSubscriptionOption(flags: _1!, transaction: _2, months: _3!, currency: _4!, amount: _5!, botUrl: _6!, storeProduct: _7))
}
else {
return nil
}
}
}
}
public extension Api {
enum PrepaidGiveaway: TypeConstructorDescription {
public class Cons_prepaidGiveaway: TypeConstructorDescription {
public var id: Int64
public var months: Int32
public var quantity: Int32
public var date: Int32
public init(id: Int64, months: Int32, quantity: Int32, date: Int32) {
self.id = id
self.months = months
self.quantity = quantity
self.date = date
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("prepaidGiveaway", [("id", ConstructorParameterDescription(self.id)), ("months", ConstructorParameterDescription(self.months)), ("quantity", ConstructorParameterDescription(self.quantity)), ("date", ConstructorParameterDescription(self.date))])
}
}
public class Cons_prepaidStarsGiveaway: TypeConstructorDescription {
public var id: Int64
public var stars: Int64
public var quantity: Int32
public var boosts: Int32
public var date: Int32
public init(id: Int64, stars: Int64, quantity: Int32, boosts: Int32, date: Int32) {
self.id = id
self.stars = stars
self.quantity = quantity
self.boosts = boosts
self.date = date
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("prepaidStarsGiveaway", [("id", ConstructorParameterDescription(self.id)), ("stars", ConstructorParameterDescription(self.stars)), ("quantity", ConstructorParameterDescription(self.quantity)), ("boosts", ConstructorParameterDescription(self.boosts)), ("date", ConstructorParameterDescription(self.date))])
}
}
case prepaidGiveaway(Cons_prepaidGiveaway)
case prepaidStarsGiveaway(Cons_prepaidStarsGiveaway)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .prepaidGiveaway(let _data):
if boxed {
buffer.appendInt32(-1303143084)
}
serializeInt64(_data.id, buffer: buffer, boxed: false)
serializeInt32(_data.months, buffer: buffer, boxed: false)
serializeInt32(_data.quantity, buffer: buffer, boxed: false)
serializeInt32(_data.date, buffer: buffer, boxed: false)
break
case .prepaidStarsGiveaway(let _data):
if boxed {
buffer.appendInt32(-1700956192)
}
serializeInt64(_data.id, buffer: buffer, boxed: false)
serializeInt64(_data.stars, buffer: buffer, boxed: false)
serializeInt32(_data.quantity, buffer: buffer, boxed: false)
serializeInt32(_data.boosts, buffer: buffer, boxed: false)
serializeInt32(_data.date, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .prepaidGiveaway(let _data):
return ("prepaidGiveaway", [("id", ConstructorParameterDescription(_data.id)), ("months", ConstructorParameterDescription(_data.months)), ("quantity", ConstructorParameterDescription(_data.quantity)), ("date", ConstructorParameterDescription(_data.date))])
case .prepaidStarsGiveaway(let _data):
return ("prepaidStarsGiveaway", [("id", ConstructorParameterDescription(_data.id)), ("stars", ConstructorParameterDescription(_data.stars)), ("quantity", ConstructorParameterDescription(_data.quantity)), ("boosts", ConstructorParameterDescription(_data.boosts)), ("date", ConstructorParameterDescription(_data.date))])
}
}
public static func parse_prepaidGiveaway(_ reader: BufferReader) -> PrepaidGiveaway? {
var _1: Int64?
_1 = reader.readInt64()
var _2: Int32?
_2 = reader.readInt32()
var _3: Int32?
_3 = reader.readInt32()
var _4: Int32?
_4 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.PrepaidGiveaway.prepaidGiveaway(Cons_prepaidGiveaway(id: _1!, months: _2!, quantity: _3!, date: _4!))
}
else {
return nil
}
}
public static func parse_prepaidStarsGiveaway(_ reader: BufferReader) -> PrepaidGiveaway? {
var _1: Int64?
_1 = reader.readInt64()
var _2: Int64?
_2 = reader.readInt64()
var _3: Int32?
_3 = reader.readInt32()
var _4: Int32?
_4 = reader.readInt32()
var _5: Int32?
_5 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 {
return Api.PrepaidGiveaway.prepaidStarsGiveaway(Cons_prepaidStarsGiveaway(id: _1!, stars: _2!, quantity: _3!, boosts: _4!, date: _5!))
}
else {
return nil
}
}
}
}
public extension Api {
enum PrivacyKey: TypeConstructorDescription {
case privacyKeyAbout
case privacyKeyAddedByPhone
case privacyKeyBirthday
case privacyKeyChatInvite
case privacyKeyForwards
case privacyKeyNoPaidMessages
case privacyKeyPhoneCall
case privacyKeyPhoneNumber
case privacyKeyPhoneP2P
case privacyKeyProfilePhoto
case privacyKeySavedMusic
case privacyKeyStarGiftsAutoSave
case privacyKeyStatusTimestamp
case privacyKeyVoiceMessages
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .privacyKeyAbout:
if boxed {
buffer.appendInt32(-1534675103)
}
break
case .privacyKeyAddedByPhone:
if boxed {
buffer.appendInt32(1124062251)
}
break
case .privacyKeyBirthday:
if boxed {
buffer.appendInt32(536913176)
}
break
case .privacyKeyChatInvite:
if boxed {
buffer.appendInt32(1343122938)
}
break
case .privacyKeyForwards:
if boxed {
buffer.appendInt32(1777096355)
}
break
case .privacyKeyNoPaidMessages:
if boxed {
buffer.appendInt32(399722706)
}
break
case .privacyKeyPhoneCall:
if boxed {
buffer.appendInt32(1030105979)
}
break
case .privacyKeyPhoneNumber:
if boxed {
buffer.appendInt32(-778378131)
}
break
case .privacyKeyPhoneP2P:
if boxed {
buffer.appendInt32(961092808)
}
break
case .privacyKeyProfilePhoto:
if boxed {
buffer.appendInt32(-1777000467)
}
break
case .privacyKeySavedMusic:
if boxed {
buffer.appendInt32(-8759525)
}
break
case .privacyKeyStarGiftsAutoSave:
if boxed {
buffer.appendInt32(749010424)
}
break
case .privacyKeyStatusTimestamp:
if boxed {
buffer.appendInt32(-1137792208)
}
break
case .privacyKeyVoiceMessages:
if boxed {
buffer.appendInt32(110621716)
}
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .privacyKeyAbout:
return ("privacyKeyAbout", [])
case .privacyKeyAddedByPhone:
return ("privacyKeyAddedByPhone", [])
case .privacyKeyBirthday:
return ("privacyKeyBirthday", [])
case .privacyKeyChatInvite:
return ("privacyKeyChatInvite", [])
case .privacyKeyForwards:
return ("privacyKeyForwards", [])
case .privacyKeyNoPaidMessages:
return ("privacyKeyNoPaidMessages", [])
case .privacyKeyPhoneCall:
return ("privacyKeyPhoneCall", [])
case .privacyKeyPhoneNumber:
return ("privacyKeyPhoneNumber", [])
case .privacyKeyPhoneP2P:
return ("privacyKeyPhoneP2P", [])
case .privacyKeyProfilePhoto:
return ("privacyKeyProfilePhoto", [])
case .privacyKeySavedMusic:
return ("privacyKeySavedMusic", [])
case .privacyKeyStarGiftsAutoSave:
return ("privacyKeyStarGiftsAutoSave", [])
case .privacyKeyStatusTimestamp:
return ("privacyKeyStatusTimestamp", [])
case .privacyKeyVoiceMessages:
return ("privacyKeyVoiceMessages", [])
}
}
public static func parse_privacyKeyAbout(_ reader: BufferReader) -> PrivacyKey? {
return Api.PrivacyKey.privacyKeyAbout
}
public static func parse_privacyKeyAddedByPhone(_ reader: BufferReader) -> PrivacyKey? {
return Api.PrivacyKey.privacyKeyAddedByPhone
}
public static func parse_privacyKeyBirthday(_ reader: BufferReader) -> PrivacyKey? {
return Api.PrivacyKey.privacyKeyBirthday
}
public static func parse_privacyKeyChatInvite(_ reader: BufferReader) -> PrivacyKey? {
return Api.PrivacyKey.privacyKeyChatInvite
}
public static func parse_privacyKeyForwards(_ reader: BufferReader) -> PrivacyKey? {
return Api.PrivacyKey.privacyKeyForwards
}
public static func parse_privacyKeyNoPaidMessages(_ reader: BufferReader) -> PrivacyKey? {
return Api.PrivacyKey.privacyKeyNoPaidMessages
}
public static func parse_privacyKeyPhoneCall(_ reader: BufferReader) -> PrivacyKey? {
return Api.PrivacyKey.privacyKeyPhoneCall
}
public static func parse_privacyKeyPhoneNumber(_ reader: BufferReader) -> PrivacyKey? {
return Api.PrivacyKey.privacyKeyPhoneNumber
}
public static func parse_privacyKeyPhoneP2P(_ reader: BufferReader) -> PrivacyKey? {
return Api.PrivacyKey.privacyKeyPhoneP2P
}
public static func parse_privacyKeyProfilePhoto(_ reader: BufferReader) -> PrivacyKey? {
return Api.PrivacyKey.privacyKeyProfilePhoto
}
public static func parse_privacyKeySavedMusic(_ reader: BufferReader) -> PrivacyKey? {
return Api.PrivacyKey.privacyKeySavedMusic
}
public static func parse_privacyKeyStarGiftsAutoSave(_ reader: BufferReader) -> PrivacyKey? {
return Api.PrivacyKey.privacyKeyStarGiftsAutoSave
}
public static func parse_privacyKeyStatusTimestamp(_ reader: BufferReader) -> PrivacyKey? {
return Api.PrivacyKey.privacyKeyStatusTimestamp
}
public static func parse_privacyKeyVoiceMessages(_ reader: BufferReader) -> PrivacyKey? {
return Api.PrivacyKey.privacyKeyVoiceMessages
}
}
}

View file

@ -1,375 +1,3 @@
public extension Api {
enum PremiumSubscriptionOption: TypeConstructorDescription {
public class Cons_premiumSubscriptionOption: TypeConstructorDescription {
public var flags: Int32
public var transaction: String?
public var months: Int32
public var currency: String
public var amount: Int64
public var botUrl: String
public var storeProduct: String?
public init(flags: Int32, transaction: String?, months: Int32, currency: String, amount: Int64, botUrl: String, storeProduct: String?) {
self.flags = flags
self.transaction = transaction
self.months = months
self.currency = currency
self.amount = amount
self.botUrl = botUrl
self.storeProduct = storeProduct
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("premiumSubscriptionOption", [("flags", ConstructorParameterDescription(self.flags)), ("transaction", ConstructorParameterDescription(self.transaction)), ("months", ConstructorParameterDescription(self.months)), ("currency", ConstructorParameterDescription(self.currency)), ("amount", ConstructorParameterDescription(self.amount)), ("botUrl", ConstructorParameterDescription(self.botUrl)), ("storeProduct", ConstructorParameterDescription(self.storeProduct))])
}
}
case premiumSubscriptionOption(Cons_premiumSubscriptionOption)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .premiumSubscriptionOption(let _data):
if boxed {
buffer.appendInt32(1596792306)
}
serializeInt32(_data.flags, buffer: buffer, boxed: false)
if Int(_data.flags) & Int(1 << 3) != 0 {
serializeString(_data.transaction!, buffer: buffer, boxed: false)
}
serializeInt32(_data.months, buffer: buffer, boxed: false)
serializeString(_data.currency, buffer: buffer, boxed: false)
serializeInt64(_data.amount, buffer: buffer, boxed: false)
serializeString(_data.botUrl, buffer: buffer, boxed: false)
if Int(_data.flags) & Int(1 << 0) != 0 {
serializeString(_data.storeProduct!, buffer: buffer, boxed: false)
}
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .premiumSubscriptionOption(let _data):
return ("premiumSubscriptionOption", [("flags", ConstructorParameterDescription(_data.flags)), ("transaction", ConstructorParameterDescription(_data.transaction)), ("months", ConstructorParameterDescription(_data.months)), ("currency", ConstructorParameterDescription(_data.currency)), ("amount", ConstructorParameterDescription(_data.amount)), ("botUrl", ConstructorParameterDescription(_data.botUrl)), ("storeProduct", ConstructorParameterDescription(_data.storeProduct))])
}
}
public static func parse_premiumSubscriptionOption(_ reader: BufferReader) -> PremiumSubscriptionOption? {
var _1: Int32?
_1 = reader.readInt32()
var _2: String?
if Int(_1!) & Int(1 << 3) != 0 {
_2 = parseString(reader)
}
var _3: Int32?
_3 = reader.readInt32()
var _4: String?
_4 = parseString(reader)
var _5: Int64?
_5 = reader.readInt64()
var _6: String?
_6 = parseString(reader)
var _7: String?
if Int(_1!) & Int(1 << 0) != 0 {
_7 = parseString(reader)
}
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 3) == 0) || _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
let _c7 = (Int(_1!) & Int(1 << 0) == 0) || _7 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
return Api.PremiumSubscriptionOption.premiumSubscriptionOption(Cons_premiumSubscriptionOption(flags: _1!, transaction: _2, months: _3!, currency: _4!, amount: _5!, botUrl: _6!, storeProduct: _7))
}
else {
return nil
}
}
}
}
public extension Api {
enum PrepaidGiveaway: TypeConstructorDescription {
public class Cons_prepaidGiveaway: TypeConstructorDescription {
public var id: Int64
public var months: Int32
public var quantity: Int32
public var date: Int32
public init(id: Int64, months: Int32, quantity: Int32, date: Int32) {
self.id = id
self.months = months
self.quantity = quantity
self.date = date
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("prepaidGiveaway", [("id", ConstructorParameterDescription(self.id)), ("months", ConstructorParameterDescription(self.months)), ("quantity", ConstructorParameterDescription(self.quantity)), ("date", ConstructorParameterDescription(self.date))])
}
}
public class Cons_prepaidStarsGiveaway: TypeConstructorDescription {
public var id: Int64
public var stars: Int64
public var quantity: Int32
public var boosts: Int32
public var date: Int32
public init(id: Int64, stars: Int64, quantity: Int32, boosts: Int32, date: Int32) {
self.id = id
self.stars = stars
self.quantity = quantity
self.boosts = boosts
self.date = date
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("prepaidStarsGiveaway", [("id", ConstructorParameterDescription(self.id)), ("stars", ConstructorParameterDescription(self.stars)), ("quantity", ConstructorParameterDescription(self.quantity)), ("boosts", ConstructorParameterDescription(self.boosts)), ("date", ConstructorParameterDescription(self.date))])
}
}
case prepaidGiveaway(Cons_prepaidGiveaway)
case prepaidStarsGiveaway(Cons_prepaidStarsGiveaway)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .prepaidGiveaway(let _data):
if boxed {
buffer.appendInt32(-1303143084)
}
serializeInt64(_data.id, buffer: buffer, boxed: false)
serializeInt32(_data.months, buffer: buffer, boxed: false)
serializeInt32(_data.quantity, buffer: buffer, boxed: false)
serializeInt32(_data.date, buffer: buffer, boxed: false)
break
case .prepaidStarsGiveaway(let _data):
if boxed {
buffer.appendInt32(-1700956192)
}
serializeInt64(_data.id, buffer: buffer, boxed: false)
serializeInt64(_data.stars, buffer: buffer, boxed: false)
serializeInt32(_data.quantity, buffer: buffer, boxed: false)
serializeInt32(_data.boosts, buffer: buffer, boxed: false)
serializeInt32(_data.date, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .prepaidGiveaway(let _data):
return ("prepaidGiveaway", [("id", ConstructorParameterDescription(_data.id)), ("months", ConstructorParameterDescription(_data.months)), ("quantity", ConstructorParameterDescription(_data.quantity)), ("date", ConstructorParameterDescription(_data.date))])
case .prepaidStarsGiveaway(let _data):
return ("prepaidStarsGiveaway", [("id", ConstructorParameterDescription(_data.id)), ("stars", ConstructorParameterDescription(_data.stars)), ("quantity", ConstructorParameterDescription(_data.quantity)), ("boosts", ConstructorParameterDescription(_data.boosts)), ("date", ConstructorParameterDescription(_data.date))])
}
}
public static func parse_prepaidGiveaway(_ reader: BufferReader) -> PrepaidGiveaway? {
var _1: Int64?
_1 = reader.readInt64()
var _2: Int32?
_2 = reader.readInt32()
var _3: Int32?
_3 = reader.readInt32()
var _4: Int32?
_4 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.PrepaidGiveaway.prepaidGiveaway(Cons_prepaidGiveaway(id: _1!, months: _2!, quantity: _3!, date: _4!))
}
else {
return nil
}
}
public static func parse_prepaidStarsGiveaway(_ reader: BufferReader) -> PrepaidGiveaway? {
var _1: Int64?
_1 = reader.readInt64()
var _2: Int64?
_2 = reader.readInt64()
var _3: Int32?
_3 = reader.readInt32()
var _4: Int32?
_4 = reader.readInt32()
var _5: Int32?
_5 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 {
return Api.PrepaidGiveaway.prepaidStarsGiveaway(Cons_prepaidStarsGiveaway(id: _1!, stars: _2!, quantity: _3!, boosts: _4!, date: _5!))
}
else {
return nil
}
}
}
}
public extension Api {
enum PrivacyKey: TypeConstructorDescription {
case privacyKeyAbout
case privacyKeyAddedByPhone
case privacyKeyBirthday
case privacyKeyChatInvite
case privacyKeyForwards
case privacyKeyNoPaidMessages
case privacyKeyPhoneCall
case privacyKeyPhoneNumber
case privacyKeyPhoneP2P
case privacyKeyProfilePhoto
case privacyKeySavedMusic
case privacyKeyStarGiftsAutoSave
case privacyKeyStatusTimestamp
case privacyKeyVoiceMessages
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .privacyKeyAbout:
if boxed {
buffer.appendInt32(-1534675103)
}
break
case .privacyKeyAddedByPhone:
if boxed {
buffer.appendInt32(1124062251)
}
break
case .privacyKeyBirthday:
if boxed {
buffer.appendInt32(536913176)
}
break
case .privacyKeyChatInvite:
if boxed {
buffer.appendInt32(1343122938)
}
break
case .privacyKeyForwards:
if boxed {
buffer.appendInt32(1777096355)
}
break
case .privacyKeyNoPaidMessages:
if boxed {
buffer.appendInt32(399722706)
}
break
case .privacyKeyPhoneCall:
if boxed {
buffer.appendInt32(1030105979)
}
break
case .privacyKeyPhoneNumber:
if boxed {
buffer.appendInt32(-778378131)
}
break
case .privacyKeyPhoneP2P:
if boxed {
buffer.appendInt32(961092808)
}
break
case .privacyKeyProfilePhoto:
if boxed {
buffer.appendInt32(-1777000467)
}
break
case .privacyKeySavedMusic:
if boxed {
buffer.appendInt32(-8759525)
}
break
case .privacyKeyStarGiftsAutoSave:
if boxed {
buffer.appendInt32(749010424)
}
break
case .privacyKeyStatusTimestamp:
if boxed {
buffer.appendInt32(-1137792208)
}
break
case .privacyKeyVoiceMessages:
if boxed {
buffer.appendInt32(110621716)
}
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .privacyKeyAbout:
return ("privacyKeyAbout", [])
case .privacyKeyAddedByPhone:
return ("privacyKeyAddedByPhone", [])
case .privacyKeyBirthday:
return ("privacyKeyBirthday", [])
case .privacyKeyChatInvite:
return ("privacyKeyChatInvite", [])
case .privacyKeyForwards:
return ("privacyKeyForwards", [])
case .privacyKeyNoPaidMessages:
return ("privacyKeyNoPaidMessages", [])
case .privacyKeyPhoneCall:
return ("privacyKeyPhoneCall", [])
case .privacyKeyPhoneNumber:
return ("privacyKeyPhoneNumber", [])
case .privacyKeyPhoneP2P:
return ("privacyKeyPhoneP2P", [])
case .privacyKeyProfilePhoto:
return ("privacyKeyProfilePhoto", [])
case .privacyKeySavedMusic:
return ("privacyKeySavedMusic", [])
case .privacyKeyStarGiftsAutoSave:
return ("privacyKeyStarGiftsAutoSave", [])
case .privacyKeyStatusTimestamp:
return ("privacyKeyStatusTimestamp", [])
case .privacyKeyVoiceMessages:
return ("privacyKeyVoiceMessages", [])
}
}
public static func parse_privacyKeyAbout(_ reader: BufferReader) -> PrivacyKey? {
return Api.PrivacyKey.privacyKeyAbout
}
public static func parse_privacyKeyAddedByPhone(_ reader: BufferReader) -> PrivacyKey? {
return Api.PrivacyKey.privacyKeyAddedByPhone
}
public static func parse_privacyKeyBirthday(_ reader: BufferReader) -> PrivacyKey? {
return Api.PrivacyKey.privacyKeyBirthday
}
public static func parse_privacyKeyChatInvite(_ reader: BufferReader) -> PrivacyKey? {
return Api.PrivacyKey.privacyKeyChatInvite
}
public static func parse_privacyKeyForwards(_ reader: BufferReader) -> PrivacyKey? {
return Api.PrivacyKey.privacyKeyForwards
}
public static func parse_privacyKeyNoPaidMessages(_ reader: BufferReader) -> PrivacyKey? {
return Api.PrivacyKey.privacyKeyNoPaidMessages
}
public static func parse_privacyKeyPhoneCall(_ reader: BufferReader) -> PrivacyKey? {
return Api.PrivacyKey.privacyKeyPhoneCall
}
public static func parse_privacyKeyPhoneNumber(_ reader: BufferReader) -> PrivacyKey? {
return Api.PrivacyKey.privacyKeyPhoneNumber
}
public static func parse_privacyKeyPhoneP2P(_ reader: BufferReader) -> PrivacyKey? {
return Api.PrivacyKey.privacyKeyPhoneP2P
}
public static func parse_privacyKeyProfilePhoto(_ reader: BufferReader) -> PrivacyKey? {
return Api.PrivacyKey.privacyKeyProfilePhoto
}
public static func parse_privacyKeySavedMusic(_ reader: BufferReader) -> PrivacyKey? {
return Api.PrivacyKey.privacyKeySavedMusic
}
public static func parse_privacyKeyStarGiftsAutoSave(_ reader: BufferReader) -> PrivacyKey? {
return Api.PrivacyKey.privacyKeyStarGiftsAutoSave
}
public static func parse_privacyKeyStatusTimestamp(_ reader: BufferReader) -> PrivacyKey? {
return Api.PrivacyKey.privacyKeyStatusTimestamp
}
public static func parse_privacyKeyVoiceMessages(_ reader: BufferReader) -> PrivacyKey? {
return Api.PrivacyKey.privacyKeyVoiceMessages
}
}
}
public extension Api {
enum PrivacyRule: TypeConstructorDescription {
public class Cons_privacyValueAllowChatParticipants: TypeConstructorDescription {
@ -716,3 +344,496 @@ public extension Api {
}
}
}
public extension Api {
indirect enum PublicForward: TypeConstructorDescription {
public class Cons_publicForwardMessage: TypeConstructorDescription {
public var message: Api.Message
public init(message: Api.Message) {
self.message = message
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("publicForwardMessage", [("message", ConstructorParameterDescription(self.message))])
}
}
public class Cons_publicForwardStory: TypeConstructorDescription {
public var peer: Api.Peer
public var story: Api.StoryItem
public init(peer: Api.Peer, story: Api.StoryItem) {
self.peer = peer
self.story = story
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("publicForwardStory", [("peer", ConstructorParameterDescription(self.peer)), ("story", ConstructorParameterDescription(self.story))])
}
}
case publicForwardMessage(Cons_publicForwardMessage)
case publicForwardStory(Cons_publicForwardStory)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .publicForwardMessage(let _data):
if boxed {
buffer.appendInt32(32685898)
}
_data.message.serialize(buffer, true)
break
case .publicForwardStory(let _data):
if boxed {
buffer.appendInt32(-302797360)
}
_data.peer.serialize(buffer, true)
_data.story.serialize(buffer, true)
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .publicForwardMessage(let _data):
return ("publicForwardMessage", [("message", ConstructorParameterDescription(_data.message))])
case .publicForwardStory(let _data):
return ("publicForwardStory", [("peer", ConstructorParameterDescription(_data.peer)), ("story", ConstructorParameterDescription(_data.story))])
}
}
public static func parse_publicForwardMessage(_ reader: BufferReader) -> PublicForward? {
var _1: Api.Message?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.Message
}
let _c1 = _1 != nil
if _c1 {
return Api.PublicForward.publicForwardMessage(Cons_publicForwardMessage(message: _1!))
}
else {
return nil
}
}
public static func parse_publicForwardStory(_ reader: BufferReader) -> PublicForward? {
var _1: Api.Peer?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.Peer
}
var _2: Api.StoryItem?
if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.StoryItem
}
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.PublicForward.publicForwardStory(Cons_publicForwardStory(peer: _1!, story: _2!))
}
else {
return nil
}
}
}
}
public extension Api {
enum QuickReply: TypeConstructorDescription {
public class Cons_quickReply: TypeConstructorDescription {
public var shortcutId: Int32
public var shortcut: String
public var topMessage: Int32
public var count: Int32
public init(shortcutId: Int32, shortcut: String, topMessage: Int32, count: Int32) {
self.shortcutId = shortcutId
self.shortcut = shortcut
self.topMessage = topMessage
self.count = count
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("quickReply", [("shortcutId", ConstructorParameterDescription(self.shortcutId)), ("shortcut", ConstructorParameterDescription(self.shortcut)), ("topMessage", ConstructorParameterDescription(self.topMessage)), ("count", ConstructorParameterDescription(self.count))])
}
}
case quickReply(Cons_quickReply)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .quickReply(let _data):
if boxed {
buffer.appendInt32(110563371)
}
serializeInt32(_data.shortcutId, buffer: buffer, boxed: false)
serializeString(_data.shortcut, buffer: buffer, boxed: false)
serializeInt32(_data.topMessage, buffer: buffer, boxed: false)
serializeInt32(_data.count, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .quickReply(let _data):
return ("quickReply", [("shortcutId", ConstructorParameterDescription(_data.shortcutId)), ("shortcut", ConstructorParameterDescription(_data.shortcut)), ("topMessage", ConstructorParameterDescription(_data.topMessage)), ("count", ConstructorParameterDescription(_data.count))])
}
}
public static func parse_quickReply(_ reader: BufferReader) -> QuickReply? {
var _1: Int32?
_1 = reader.readInt32()
var _2: String?
_2 = parseString(reader)
var _3: Int32?
_3 = reader.readInt32()
var _4: Int32?
_4 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.QuickReply.quickReply(Cons_quickReply(shortcutId: _1!, shortcut: _2!, topMessage: _3!, count: _4!))
}
else {
return nil
}
}
}
}
public extension Api {
enum Reaction: TypeConstructorDescription {
public class Cons_reactionCustomEmoji: TypeConstructorDescription {
public var documentId: Int64
public init(documentId: Int64) {
self.documentId = documentId
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("reactionCustomEmoji", [("documentId", ConstructorParameterDescription(self.documentId))])
}
}
public class Cons_reactionEmoji: TypeConstructorDescription {
public var emoticon: String
public init(emoticon: String) {
self.emoticon = emoticon
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("reactionEmoji", [("emoticon", ConstructorParameterDescription(self.emoticon))])
}
}
case reactionCustomEmoji(Cons_reactionCustomEmoji)
case reactionEmoji(Cons_reactionEmoji)
case reactionEmpty
case reactionPaid
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .reactionCustomEmoji(let _data):
if boxed {
buffer.appendInt32(-1992950669)
}
serializeInt64(_data.documentId, buffer: buffer, boxed: false)
break
case .reactionEmoji(let _data):
if boxed {
buffer.appendInt32(455247544)
}
serializeString(_data.emoticon, buffer: buffer, boxed: false)
break
case .reactionEmpty:
if boxed {
buffer.appendInt32(2046153753)
}
break
case .reactionPaid:
if boxed {
buffer.appendInt32(1379771627)
}
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .reactionCustomEmoji(let _data):
return ("reactionCustomEmoji", [("documentId", ConstructorParameterDescription(_data.documentId))])
case .reactionEmoji(let _data):
return ("reactionEmoji", [("emoticon", ConstructorParameterDescription(_data.emoticon))])
case .reactionEmpty:
return ("reactionEmpty", [])
case .reactionPaid:
return ("reactionPaid", [])
}
}
public static func parse_reactionCustomEmoji(_ reader: BufferReader) -> Reaction? {
var _1: Int64?
_1 = reader.readInt64()
let _c1 = _1 != nil
if _c1 {
return Api.Reaction.reactionCustomEmoji(Cons_reactionCustomEmoji(documentId: _1!))
}
else {
return nil
}
}
public static func parse_reactionEmoji(_ reader: BufferReader) -> Reaction? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
if _c1 {
return Api.Reaction.reactionEmoji(Cons_reactionEmoji(emoticon: _1!))
}
else {
return nil
}
}
public static func parse_reactionEmpty(_ reader: BufferReader) -> Reaction? {
return Api.Reaction.reactionEmpty
}
public static func parse_reactionPaid(_ reader: BufferReader) -> Reaction? {
return Api.Reaction.reactionPaid
}
}
}
public extension Api {
enum ReactionCount: TypeConstructorDescription {
public class Cons_reactionCount: TypeConstructorDescription {
public var flags: Int32
public var chosenOrder: Int32?
public var reaction: Api.Reaction
public var count: Int32
public init(flags: Int32, chosenOrder: Int32?, reaction: Api.Reaction, count: Int32) {
self.flags = flags
self.chosenOrder = chosenOrder
self.reaction = reaction
self.count = count
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("reactionCount", [("flags", ConstructorParameterDescription(self.flags)), ("chosenOrder", ConstructorParameterDescription(self.chosenOrder)), ("reaction", ConstructorParameterDescription(self.reaction)), ("count", ConstructorParameterDescription(self.count))])
}
}
case reactionCount(Cons_reactionCount)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .reactionCount(let _data):
if boxed {
buffer.appendInt32(-1546531968)
}
serializeInt32(_data.flags, buffer: buffer, boxed: false)
if Int(_data.flags) & Int(1 << 0) != 0 {
serializeInt32(_data.chosenOrder!, buffer: buffer, boxed: false)
}
_data.reaction.serialize(buffer, true)
serializeInt32(_data.count, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .reactionCount(let _data):
return ("reactionCount", [("flags", ConstructorParameterDescription(_data.flags)), ("chosenOrder", ConstructorParameterDescription(_data.chosenOrder)), ("reaction", ConstructorParameterDescription(_data.reaction)), ("count", ConstructorParameterDescription(_data.count))])
}
}
public static func parse_reactionCount(_ reader: BufferReader) -> ReactionCount? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int32?
if Int(_1!) & Int(1 << 0) != 0 {
_2 = reader.readInt32()
}
var _3: Api.Reaction?
if let signature = reader.readInt32() {
_3 = Api.parse(reader, signature: signature) as? Api.Reaction
}
var _4: Int32?
_4 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.ReactionCount.reactionCount(Cons_reactionCount(flags: _1!, chosenOrder: _2, reaction: _3!, count: _4!))
}
else {
return nil
}
}
}
}
public extension Api {
enum ReactionNotificationsFrom: TypeConstructorDescription {
case reactionNotificationsFromAll
case reactionNotificationsFromContacts
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .reactionNotificationsFromAll:
if boxed {
buffer.appendInt32(1268654752)
}
break
case .reactionNotificationsFromContacts:
if boxed {
buffer.appendInt32(-1161583078)
}
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .reactionNotificationsFromAll:
return ("reactionNotificationsFromAll", [])
case .reactionNotificationsFromContacts:
return ("reactionNotificationsFromContacts", [])
}
}
public static func parse_reactionNotificationsFromAll(_ reader: BufferReader) -> ReactionNotificationsFrom? {
return Api.ReactionNotificationsFrom.reactionNotificationsFromAll
}
public static func parse_reactionNotificationsFromContacts(_ reader: BufferReader) -> ReactionNotificationsFrom? {
return Api.ReactionNotificationsFrom.reactionNotificationsFromContacts
}
}
}
public extension Api {
enum ReactionsNotifySettings: TypeConstructorDescription {
public class Cons_reactionsNotifySettings: TypeConstructorDescription {
public var flags: Int32
public var messagesNotifyFrom: Api.ReactionNotificationsFrom?
public var storiesNotifyFrom: Api.ReactionNotificationsFrom?
public var pollVotesNotifyFrom: Api.ReactionNotificationsFrom?
public var sound: Api.NotificationSound
public var showPreviews: Api.Bool
public init(flags: Int32, messagesNotifyFrom: Api.ReactionNotificationsFrom?, storiesNotifyFrom: Api.ReactionNotificationsFrom?, pollVotesNotifyFrom: Api.ReactionNotificationsFrom?, sound: Api.NotificationSound, showPreviews: Api.Bool) {
self.flags = flags
self.messagesNotifyFrom = messagesNotifyFrom
self.storiesNotifyFrom = storiesNotifyFrom
self.pollVotesNotifyFrom = pollVotesNotifyFrom
self.sound = sound
self.showPreviews = showPreviews
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("reactionsNotifySettings", [("flags", ConstructorParameterDescription(self.flags)), ("messagesNotifyFrom", ConstructorParameterDescription(self.messagesNotifyFrom)), ("storiesNotifyFrom", ConstructorParameterDescription(self.storiesNotifyFrom)), ("pollVotesNotifyFrom", ConstructorParameterDescription(self.pollVotesNotifyFrom)), ("sound", ConstructorParameterDescription(self.sound)), ("showPreviews", ConstructorParameterDescription(self.showPreviews))])
}
}
case reactionsNotifySettings(Cons_reactionsNotifySettings)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .reactionsNotifySettings(let _data):
if boxed {
buffer.appendInt32(1910827608)
}
serializeInt32(_data.flags, buffer: buffer, boxed: false)
if Int(_data.flags) & Int(1 << 0) != 0 {
_data.messagesNotifyFrom!.serialize(buffer, true)
}
if Int(_data.flags) & Int(1 << 1) != 0 {
_data.storiesNotifyFrom!.serialize(buffer, true)
}
if Int(_data.flags) & Int(1 << 2) != 0 {
_data.pollVotesNotifyFrom!.serialize(buffer, true)
}
_data.sound.serialize(buffer, true)
_data.showPreviews.serialize(buffer, true)
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .reactionsNotifySettings(let _data):
return ("reactionsNotifySettings", [("flags", ConstructorParameterDescription(_data.flags)), ("messagesNotifyFrom", ConstructorParameterDescription(_data.messagesNotifyFrom)), ("storiesNotifyFrom", ConstructorParameterDescription(_data.storiesNotifyFrom)), ("pollVotesNotifyFrom", ConstructorParameterDescription(_data.pollVotesNotifyFrom)), ("sound", ConstructorParameterDescription(_data.sound)), ("showPreviews", ConstructorParameterDescription(_data.showPreviews))])
}
}
public static func parse_reactionsNotifySettings(_ reader: BufferReader) -> ReactionsNotifySettings? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Api.ReactionNotificationsFrom?
if Int(_1!) & Int(1 << 0) != 0 {
if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.ReactionNotificationsFrom
}
}
var _3: Api.ReactionNotificationsFrom?
if Int(_1!) & Int(1 << 1) != 0 {
if let signature = reader.readInt32() {
_3 = Api.parse(reader, signature: signature) as? Api.ReactionNotificationsFrom
}
}
var _4: Api.ReactionNotificationsFrom?
if Int(_1!) & Int(1 << 2) != 0 {
if let signature = reader.readInt32() {
_4 = Api.parse(reader, signature: signature) as? Api.ReactionNotificationsFrom
}
}
var _5: Api.NotificationSound?
if let signature = reader.readInt32() {
_5 = Api.parse(reader, signature: signature) as? Api.NotificationSound
}
var _6: Api.Bool?
if let signature = reader.readInt32() {
_6 = Api.parse(reader, signature: signature) as? Api.Bool
}
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
return Api.ReactionsNotifySettings.reactionsNotifySettings(Cons_reactionsNotifySettings(flags: _1!, messagesNotifyFrom: _2, storiesNotifyFrom: _3, pollVotesNotifyFrom: _4, sound: _5!, showPreviews: _6!))
}
else {
return nil
}
}
}
}
public extension Api {
enum ReadParticipantDate: TypeConstructorDescription {
public class Cons_readParticipantDate: TypeConstructorDescription {
public var userId: Int64
public var date: Int32
public init(userId: Int64, date: Int32) {
self.userId = userId
self.date = date
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("readParticipantDate", [("userId", ConstructorParameterDescription(self.userId)), ("date", ConstructorParameterDescription(self.date))])
}
}
case readParticipantDate(Cons_readParticipantDate)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .readParticipantDate(let _data):
if boxed {
buffer.appendInt32(1246753138)
}
serializeInt64(_data.userId, buffer: buffer, boxed: false)
serializeInt32(_data.date, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .readParticipantDate(let _data):
return ("readParticipantDate", [("userId", ConstructorParameterDescription(_data.userId)), ("date", ConstructorParameterDescription(_data.date))])
}
}
public static func parse_readParticipantDate(_ reader: BufferReader) -> ReadParticipantDate? {
var _1: Int64?
_1 = reader.readInt64()
var _2: Int32?
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.ReadParticipantDate.readParticipantDate(Cons_readParticipantDate(userId: _1!, date: _2!))
}
else {
return nil
}
}
}
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,611 +1,3 @@
public extension Api {
enum Theme: TypeConstructorDescription {
public class Cons_theme: TypeConstructorDescription {
public var flags: Int32
public var id: Int64
public var accessHash: Int64
public var slug: String
public var title: String
public var document: Api.Document?
public var settings: [Api.ThemeSettings]?
public var emoticon: String?
public var installsCount: Int32?
public init(flags: Int32, id: Int64, accessHash: Int64, slug: String, title: String, document: Api.Document?, settings: [Api.ThemeSettings]?, emoticon: String?, installsCount: Int32?) {
self.flags = flags
self.id = id
self.accessHash = accessHash
self.slug = slug
self.title = title
self.document = document
self.settings = settings
self.emoticon = emoticon
self.installsCount = installsCount
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("theme", [("flags", ConstructorParameterDescription(self.flags)), ("id", ConstructorParameterDescription(self.id)), ("accessHash", ConstructorParameterDescription(self.accessHash)), ("slug", ConstructorParameterDescription(self.slug)), ("title", ConstructorParameterDescription(self.title)), ("document", ConstructorParameterDescription(self.document)), ("settings", ConstructorParameterDescription(self.settings)), ("emoticon", ConstructorParameterDescription(self.emoticon)), ("installsCount", ConstructorParameterDescription(self.installsCount))])
}
}
case theme(Cons_theme)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .theme(let _data):
if boxed {
buffer.appendInt32(-1609668650)
}
serializeInt32(_data.flags, buffer: buffer, boxed: false)
serializeInt64(_data.id, buffer: buffer, boxed: false)
serializeInt64(_data.accessHash, buffer: buffer, boxed: false)
serializeString(_data.slug, buffer: buffer, boxed: false)
serializeString(_data.title, buffer: buffer, boxed: false)
if Int(_data.flags) & Int(1 << 2) != 0 {
_data.document!.serialize(buffer, true)
}
if Int(_data.flags) & Int(1 << 3) != 0 {
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.settings!.count))
for item in _data.settings! {
item.serialize(buffer, true)
}
}
if Int(_data.flags) & Int(1 << 6) != 0 {
serializeString(_data.emoticon!, buffer: buffer, boxed: false)
}
if Int(_data.flags) & Int(1 << 4) != 0 {
serializeInt32(_data.installsCount!, buffer: buffer, boxed: false)
}
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .theme(let _data):
return ("theme", [("flags", ConstructorParameterDescription(_data.flags)), ("id", ConstructorParameterDescription(_data.id)), ("accessHash", ConstructorParameterDescription(_data.accessHash)), ("slug", ConstructorParameterDescription(_data.slug)), ("title", ConstructorParameterDescription(_data.title)), ("document", ConstructorParameterDescription(_data.document)), ("settings", ConstructorParameterDescription(_data.settings)), ("emoticon", ConstructorParameterDescription(_data.emoticon)), ("installsCount", ConstructorParameterDescription(_data.installsCount))])
}
}
public static func parse_theme(_ reader: BufferReader) -> Theme? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int64?
_2 = reader.readInt64()
var _3: Int64?
_3 = reader.readInt64()
var _4: String?
_4 = parseString(reader)
var _5: String?
_5 = parseString(reader)
var _6: Api.Document?
if Int(_1!) & Int(1 << 2) != 0 {
if let signature = reader.readInt32() {
_6 = Api.parse(reader, signature: signature) as? Api.Document
}
}
var _7: [Api.ThemeSettings]?
if Int(_1!) & Int(1 << 3) != 0 {
if let _ = reader.readInt32() {
_7 = Api.parseVector(reader, elementSignature: 0, elementType: Api.ThemeSettings.self)
}
}
var _8: String?
if Int(_1!) & Int(1 << 6) != 0 {
_8 = parseString(reader)
}
var _9: Int32?
if Int(_1!) & Int(1 << 4) != 0 {
_9 = reader.readInt32()
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = (Int(_1!) & Int(1 << 2) == 0) || _6 != nil
let _c7 = (Int(_1!) & Int(1 << 3) == 0) || _7 != nil
let _c8 = (Int(_1!) & Int(1 << 6) == 0) || _8 != nil
let _c9 = (Int(_1!) & Int(1 << 4) == 0) || _9 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 {
return Api.Theme.theme(Cons_theme(flags: _1!, id: _2!, accessHash: _3!, slug: _4!, title: _5!, document: _6, settings: _7, emoticon: _8, installsCount: _9))
}
else {
return nil
}
}
}
}
public extension Api {
enum ThemeSettings: TypeConstructorDescription {
public class Cons_themeSettings: TypeConstructorDescription {
public var flags: Int32
public var baseTheme: Api.BaseTheme
public var accentColor: Int32
public var outboxAccentColor: Int32?
public var messageColors: [Int32]?
public var wallpaper: Api.WallPaper?
public init(flags: Int32, baseTheme: Api.BaseTheme, accentColor: Int32, outboxAccentColor: Int32?, messageColors: [Int32]?, wallpaper: Api.WallPaper?) {
self.flags = flags
self.baseTheme = baseTheme
self.accentColor = accentColor
self.outboxAccentColor = outboxAccentColor
self.messageColors = messageColors
self.wallpaper = wallpaper
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("themeSettings", [("flags", ConstructorParameterDescription(self.flags)), ("baseTheme", ConstructorParameterDescription(self.baseTheme)), ("accentColor", ConstructorParameterDescription(self.accentColor)), ("outboxAccentColor", ConstructorParameterDescription(self.outboxAccentColor)), ("messageColors", ConstructorParameterDescription(self.messageColors)), ("wallpaper", ConstructorParameterDescription(self.wallpaper))])
}
}
case themeSettings(Cons_themeSettings)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .themeSettings(let _data):
if boxed {
buffer.appendInt32(-94849324)
}
serializeInt32(_data.flags, buffer: buffer, boxed: false)
_data.baseTheme.serialize(buffer, true)
serializeInt32(_data.accentColor, buffer: buffer, boxed: false)
if Int(_data.flags) & Int(1 << 3) != 0 {
serializeInt32(_data.outboxAccentColor!, buffer: buffer, boxed: false)
}
if Int(_data.flags) & Int(1 << 0) != 0 {
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.messageColors!.count))
for item in _data.messageColors! {
serializeInt32(item, buffer: buffer, boxed: false)
}
}
if Int(_data.flags) & Int(1 << 1) != 0 {
_data.wallpaper!.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .themeSettings(let _data):
return ("themeSettings", [("flags", ConstructorParameterDescription(_data.flags)), ("baseTheme", ConstructorParameterDescription(_data.baseTheme)), ("accentColor", ConstructorParameterDescription(_data.accentColor)), ("outboxAccentColor", ConstructorParameterDescription(_data.outboxAccentColor)), ("messageColors", ConstructorParameterDescription(_data.messageColors)), ("wallpaper", ConstructorParameterDescription(_data.wallpaper))])
}
}
public static func parse_themeSettings(_ reader: BufferReader) -> ThemeSettings? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Api.BaseTheme?
if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.BaseTheme
}
var _3: Int32?
_3 = reader.readInt32()
var _4: Int32?
if Int(_1!) & Int(1 << 3) != 0 {
_4 = reader.readInt32()
}
var _5: [Int32]?
if Int(_1!) & Int(1 << 0) != 0 {
if let _ = reader.readInt32() {
_5 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self)
}
}
var _6: Api.WallPaper?
if Int(_1!) & Int(1 << 1) != 0 {
if let signature = reader.readInt32() {
_6 = Api.parse(reader, signature: signature) as? Api.WallPaper
}
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 3) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 0) == 0) || _5 != nil
let _c6 = (Int(_1!) & Int(1 << 1) == 0) || _6 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
return Api.ThemeSettings.themeSettings(Cons_themeSettings(flags: _1!, baseTheme: _2!, accentColor: _3!, outboxAccentColor: _4, messageColors: _5, wallpaper: _6))
}
else {
return nil
}
}
}
}
public extension Api {
enum Timezone: TypeConstructorDescription {
public class Cons_timezone: TypeConstructorDescription {
public var id: String
public var name: String
public var utcOffset: Int32
public init(id: String, name: String, utcOffset: Int32) {
self.id = id
self.name = name
self.utcOffset = utcOffset
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("timezone", [("id", ConstructorParameterDescription(self.id)), ("name", ConstructorParameterDescription(self.name)), ("utcOffset", ConstructorParameterDescription(self.utcOffset))])
}
}
case timezone(Cons_timezone)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .timezone(let _data):
if boxed {
buffer.appendInt32(-7173643)
}
serializeString(_data.id, buffer: buffer, boxed: false)
serializeString(_data.name, buffer: buffer, boxed: false)
serializeInt32(_data.utcOffset, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .timezone(let _data):
return ("timezone", [("id", ConstructorParameterDescription(_data.id)), ("name", ConstructorParameterDescription(_data.name)), ("utcOffset", ConstructorParameterDescription(_data.utcOffset))])
}
}
public static func parse_timezone(_ reader: BufferReader) -> Timezone? {
var _1: String?
_1 = parseString(reader)
var _2: String?
_2 = parseString(reader)
var _3: Int32?
_3 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.Timezone.timezone(Cons_timezone(id: _1!, name: _2!, utcOffset: _3!))
}
else {
return nil
}
}
}
}
public extension Api {
enum TodoCompletion: TypeConstructorDescription {
public class Cons_todoCompletion: TypeConstructorDescription {
public var id: Int32
public var completedBy: Api.Peer
public var date: Int32
public init(id: Int32, completedBy: Api.Peer, date: Int32) {
self.id = id
self.completedBy = completedBy
self.date = date
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("todoCompletion", [("id", ConstructorParameterDescription(self.id)), ("completedBy", ConstructorParameterDescription(self.completedBy)), ("date", ConstructorParameterDescription(self.date))])
}
}
case todoCompletion(Cons_todoCompletion)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .todoCompletion(let _data):
if boxed {
buffer.appendInt32(572241380)
}
serializeInt32(_data.id, buffer: buffer, boxed: false)
_data.completedBy.serialize(buffer, true)
serializeInt32(_data.date, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .todoCompletion(let _data):
return ("todoCompletion", [("id", ConstructorParameterDescription(_data.id)), ("completedBy", ConstructorParameterDescription(_data.completedBy)), ("date", ConstructorParameterDescription(_data.date))])
}
}
public static func parse_todoCompletion(_ reader: BufferReader) -> TodoCompletion? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Api.Peer?
if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.Peer
}
var _3: Int32?
_3 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.TodoCompletion.todoCompletion(Cons_todoCompletion(id: _1!, completedBy: _2!, date: _3!))
}
else {
return nil
}
}
}
}
public extension Api {
enum TodoItem: TypeConstructorDescription {
public class Cons_todoItem: TypeConstructorDescription {
public var id: Int32
public var title: Api.TextWithEntities
public init(id: Int32, title: Api.TextWithEntities) {
self.id = id
self.title = title
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("todoItem", [("id", ConstructorParameterDescription(self.id)), ("title", ConstructorParameterDescription(self.title))])
}
}
case todoItem(Cons_todoItem)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .todoItem(let _data):
if boxed {
buffer.appendInt32(-878074577)
}
serializeInt32(_data.id, buffer: buffer, boxed: false)
_data.title.serialize(buffer, true)
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .todoItem(let _data):
return ("todoItem", [("id", ConstructorParameterDescription(_data.id)), ("title", ConstructorParameterDescription(_data.title))])
}
}
public static func parse_todoItem(_ reader: BufferReader) -> TodoItem? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Api.TextWithEntities?
if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.TextWithEntities
}
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.TodoItem.todoItem(Cons_todoItem(id: _1!, title: _2!))
}
else {
return nil
}
}
}
}
public extension Api {
enum TodoList: TypeConstructorDescription {
public class Cons_todoList: TypeConstructorDescription {
public var flags: Int32
public var title: Api.TextWithEntities
public var list: [Api.TodoItem]
public init(flags: Int32, title: Api.TextWithEntities, list: [Api.TodoItem]) {
self.flags = flags
self.title = title
self.list = list
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("todoList", [("flags", ConstructorParameterDescription(self.flags)), ("title", ConstructorParameterDescription(self.title)), ("list", ConstructorParameterDescription(self.list))])
}
}
case todoList(Cons_todoList)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .todoList(let _data):
if boxed {
buffer.appendInt32(1236871718)
}
serializeInt32(_data.flags, buffer: buffer, boxed: false)
_data.title.serialize(buffer, true)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.list.count))
for item in _data.list {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .todoList(let _data):
return ("todoList", [("flags", ConstructorParameterDescription(_data.flags)), ("title", ConstructorParameterDescription(_data.title)), ("list", ConstructorParameterDescription(_data.list))])
}
}
public static func parse_todoList(_ reader: BufferReader) -> TodoList? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Api.TextWithEntities?
if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.TextWithEntities
}
var _3: [Api.TodoItem]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.TodoItem.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.TodoList.todoList(Cons_todoList(flags: _1!, title: _2!, list: _3!))
}
else {
return nil
}
}
}
}
public extension Api {
enum TopPeer: TypeConstructorDescription {
public class Cons_topPeer: TypeConstructorDescription {
public var peer: Api.Peer
public var rating: Double
public init(peer: Api.Peer, rating: Double) {
self.peer = peer
self.rating = rating
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("topPeer", [("peer", ConstructorParameterDescription(self.peer)), ("rating", ConstructorParameterDescription(self.rating))])
}
}
case topPeer(Cons_topPeer)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .topPeer(let _data):
if boxed {
buffer.appendInt32(-305282981)
}
_data.peer.serialize(buffer, true)
serializeDouble(_data.rating, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .topPeer(let _data):
return ("topPeer", [("peer", ConstructorParameterDescription(_data.peer)), ("rating", ConstructorParameterDescription(_data.rating))])
}
}
public static func parse_topPeer(_ reader: BufferReader) -> TopPeer? {
var _1: Api.Peer?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.Peer
}
var _2: Double?
_2 = reader.readDouble()
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.TopPeer.topPeer(Cons_topPeer(peer: _1!, rating: _2!))
}
else {
return nil
}
}
}
}
public extension Api {
enum TopPeerCategory: TypeConstructorDescription {
case topPeerCategoryBotsApp
case topPeerCategoryBotsInline
case topPeerCategoryBotsPM
case topPeerCategoryChannels
case topPeerCategoryCorrespondents
case topPeerCategoryForwardChats
case topPeerCategoryForwardUsers
case topPeerCategoryGroups
case topPeerCategoryPhoneCalls
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .topPeerCategoryBotsApp:
if boxed {
buffer.appendInt32(-39945236)
}
break
case .topPeerCategoryBotsInline:
if boxed {
buffer.appendInt32(344356834)
}
break
case .topPeerCategoryBotsPM:
if boxed {
buffer.appendInt32(-1419371685)
}
break
case .topPeerCategoryChannels:
if boxed {
buffer.appendInt32(371037736)
}
break
case .topPeerCategoryCorrespondents:
if boxed {
buffer.appendInt32(104314861)
}
break
case .topPeerCategoryForwardChats:
if boxed {
buffer.appendInt32(-68239120)
}
break
case .topPeerCategoryForwardUsers:
if boxed {
buffer.appendInt32(-1472172887)
}
break
case .topPeerCategoryGroups:
if boxed {
buffer.appendInt32(-1122524854)
}
break
case .topPeerCategoryPhoneCalls:
if boxed {
buffer.appendInt32(511092620)
}
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .topPeerCategoryBotsApp:
return ("topPeerCategoryBotsApp", [])
case .topPeerCategoryBotsInline:
return ("topPeerCategoryBotsInline", [])
case .topPeerCategoryBotsPM:
return ("topPeerCategoryBotsPM", [])
case .topPeerCategoryChannels:
return ("topPeerCategoryChannels", [])
case .topPeerCategoryCorrespondents:
return ("topPeerCategoryCorrespondents", [])
case .topPeerCategoryForwardChats:
return ("topPeerCategoryForwardChats", [])
case .topPeerCategoryForwardUsers:
return ("topPeerCategoryForwardUsers", [])
case .topPeerCategoryGroups:
return ("topPeerCategoryGroups", [])
case .topPeerCategoryPhoneCalls:
return ("topPeerCategoryPhoneCalls", [])
}
}
public static func parse_topPeerCategoryBotsApp(_ reader: BufferReader) -> TopPeerCategory? {
return Api.TopPeerCategory.topPeerCategoryBotsApp
}
public static func parse_topPeerCategoryBotsInline(_ reader: BufferReader) -> TopPeerCategory? {
return Api.TopPeerCategory.topPeerCategoryBotsInline
}
public static func parse_topPeerCategoryBotsPM(_ reader: BufferReader) -> TopPeerCategory? {
return Api.TopPeerCategory.topPeerCategoryBotsPM
}
public static func parse_topPeerCategoryChannels(_ reader: BufferReader) -> TopPeerCategory? {
return Api.TopPeerCategory.topPeerCategoryChannels
}
public static func parse_topPeerCategoryCorrespondents(_ reader: BufferReader) -> TopPeerCategory? {
return Api.TopPeerCategory.topPeerCategoryCorrespondents
}
public static func parse_topPeerCategoryForwardChats(_ reader: BufferReader) -> TopPeerCategory? {
return Api.TopPeerCategory.topPeerCategoryForwardChats
}
public static func parse_topPeerCategoryForwardUsers(_ reader: BufferReader) -> TopPeerCategory? {
return Api.TopPeerCategory.topPeerCategoryForwardUsers
}
public static func parse_topPeerCategoryGroups(_ reader: BufferReader) -> TopPeerCategory? {
return Api.TopPeerCategory.topPeerCategoryGroups
}
public static func parse_topPeerCategoryPhoneCalls(_ reader: BufferReader) -> TopPeerCategory? {
return Api.TopPeerCategory.topPeerCategoryPhoneCalls
}
}
}
public extension Api {
enum TopPeerCategoryPeers: TypeConstructorDescription {
public class Cons_topPeerCategoryPeers: TypeConstructorDescription {

View file

@ -1019,170 +1019,6 @@ public extension Api.channels {
}
}
}
public extension Api.channels {
enum Found: TypeConstructorDescription {
public class Cons_found: TypeConstructorDescription {
public var flags: Int32
public var results: [Api.Peer]
public var chats: [Api.Chat]
public var users: [Api.User]
public var nextOffset: String?
public init(flags: Int32, results: [Api.Peer], chats: [Api.Chat], users: [Api.User], nextOffset: String?) {
self.flags = flags
self.results = results
self.chats = chats
self.users = users
self.nextOffset = nextOffset
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("found", [("flags", ConstructorParameterDescription(self.flags)), ("results", ConstructorParameterDescription(self.results)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users)), ("nextOffset", ConstructorParameterDescription(self.nextOffset))])
}
}
case found(Cons_found)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .found(let _data):
if boxed {
buffer.appendInt32(824755388)
}
serializeInt32(_data.flags, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.results.count))
for item in _data.results {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.chats.count))
for item in _data.chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.users.count))
for item in _data.users {
item.serialize(buffer, true)
}
if Int(_data.flags) & Int(1 << 0) != 0 {
serializeString(_data.nextOffset!, buffer: buffer, boxed: false)
}
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .found(let _data):
return ("found", [("flags", ConstructorParameterDescription(_data.flags)), ("results", ConstructorParameterDescription(_data.results)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users)), ("nextOffset", ConstructorParameterDescription(_data.nextOffset))])
}
}
public static func parse_found(_ reader: BufferReader) -> Found? {
var _1: Int32?
_1 = reader.readInt32()
var _2: [Api.Peer]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Peer.self)
}
var _3: [Api.Chat]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _4: [Api.User]?
if let _ = reader.readInt32() {
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
var _5: String?
if Int(_1!) & Int(1 << 0) != 0 {
_5 = parseString(reader)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = (Int(_1!) & Int(1 << 0) == 0) || _5 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 {
return Api.channels.Found.found(Cons_found(flags: _1!, results: _2!, chats: _3!, users: _4!, nextOffset: _5))
}
else {
return nil
}
}
}
}
public extension Api.channels {
enum PersonalChannels: TypeConstructorDescription {
public class Cons_personalChannels: TypeConstructorDescription {
public var channels: [Api.PersonalChannel]
public var chats: [Api.Chat]
public var users: [Api.User]
public init(channels: [Api.PersonalChannel], chats: [Api.Chat], users: [Api.User]) {
self.channels = channels
self.chats = chats
self.users = users
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("personalChannels", [("channels", ConstructorParameterDescription(self.channels)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users))])
}
}
case personalChannels(Cons_personalChannels)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .personalChannels(let _data):
if boxed {
buffer.appendInt32(-694491059)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.channels.count))
for item in _data.channels {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.chats.count))
for item in _data.chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.users.count))
for item in _data.users {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .personalChannels(let _data):
return ("personalChannels", [("channels", ConstructorParameterDescription(_data.channels)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users))])
}
}
public static func parse_personalChannels(_ reader: BufferReader) -> PersonalChannels? {
var _1: [Api.PersonalChannel]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.PersonalChannel.self)
}
var _2: [Api.Chat]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _3: [Api.User]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.channels.PersonalChannels.personalChannels(Cons_personalChannels(channels: _1!, chats: _2!, users: _3!))
}
else {
return nil
}
}
}
}
public extension Api.channels {
enum SendAsPeers: TypeConstructorDescription {
public class Cons_sendAsPeers: TypeConstructorDescription {
@ -1712,3 +1548,142 @@ public extension Api.chatlists {
}
}
}
public extension Api.contacts {
enum Blocked: TypeConstructorDescription {
public class Cons_blocked: TypeConstructorDescription {
public var blocked: [Api.PeerBlocked]
public var chats: [Api.Chat]
public var users: [Api.User]
public init(blocked: [Api.PeerBlocked], chats: [Api.Chat], users: [Api.User]) {
self.blocked = blocked
self.chats = chats
self.users = users
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("blocked", [("blocked", ConstructorParameterDescription(self.blocked)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users))])
}
}
public class Cons_blockedSlice: TypeConstructorDescription {
public var count: Int32
public var blocked: [Api.PeerBlocked]
public var chats: [Api.Chat]
public var users: [Api.User]
public init(count: Int32, blocked: [Api.PeerBlocked], chats: [Api.Chat], users: [Api.User]) {
self.count = count
self.blocked = blocked
self.chats = chats
self.users = users
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("blockedSlice", [("count", ConstructorParameterDescription(self.count)), ("blocked", ConstructorParameterDescription(self.blocked)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users))])
}
}
case blocked(Cons_blocked)
case blockedSlice(Cons_blockedSlice)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .blocked(let _data):
if boxed {
buffer.appendInt32(182326673)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.blocked.count))
for item in _data.blocked {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.chats.count))
for item in _data.chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.users.count))
for item in _data.users {
item.serialize(buffer, true)
}
break
case .blockedSlice(let _data):
if boxed {
buffer.appendInt32(-513392236)
}
serializeInt32(_data.count, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.blocked.count))
for item in _data.blocked {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.chats.count))
for item in _data.chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.users.count))
for item in _data.users {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .blocked(let _data):
return ("blocked", [("blocked", ConstructorParameterDescription(_data.blocked)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users))])
case .blockedSlice(let _data):
return ("blockedSlice", [("count", ConstructorParameterDescription(_data.count)), ("blocked", ConstructorParameterDescription(_data.blocked)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users))])
}
}
public static func parse_blocked(_ reader: BufferReader) -> Blocked? {
var _1: [Api.PeerBlocked]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.PeerBlocked.self)
}
var _2: [Api.Chat]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _3: [Api.User]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.contacts.Blocked.blocked(Cons_blocked(blocked: _1!, chats: _2!, users: _3!))
}
else {
return nil
}
}
public static func parse_blockedSlice(_ reader: BufferReader) -> Blocked? {
var _1: Int32?
_1 = reader.readInt32()
var _2: [Api.PeerBlocked]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.PeerBlocked.self)
}
var _3: [Api.Chat]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _4: [Api.User]?
if let _ = reader.readInt32() {
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.contacts.Blocked.blockedSlice(Cons_blockedSlice(count: _1!, blocked: _2!, chats: _3!, users: _4!))
}
else {
return nil
}
}
}
}

View file

@ -1,142 +1,3 @@
public extension Api.contacts {
enum Blocked: TypeConstructorDescription {
public class Cons_blocked: TypeConstructorDescription {
public var blocked: [Api.PeerBlocked]
public var chats: [Api.Chat]
public var users: [Api.User]
public init(blocked: [Api.PeerBlocked], chats: [Api.Chat], users: [Api.User]) {
self.blocked = blocked
self.chats = chats
self.users = users
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("blocked", [("blocked", ConstructorParameterDescription(self.blocked)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users))])
}
}
public class Cons_blockedSlice: TypeConstructorDescription {
public var count: Int32
public var blocked: [Api.PeerBlocked]
public var chats: [Api.Chat]
public var users: [Api.User]
public init(count: Int32, blocked: [Api.PeerBlocked], chats: [Api.Chat], users: [Api.User]) {
self.count = count
self.blocked = blocked
self.chats = chats
self.users = users
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("blockedSlice", [("count", ConstructorParameterDescription(self.count)), ("blocked", ConstructorParameterDescription(self.blocked)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users))])
}
}
case blocked(Cons_blocked)
case blockedSlice(Cons_blockedSlice)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .blocked(let _data):
if boxed {
buffer.appendInt32(182326673)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.blocked.count))
for item in _data.blocked {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.chats.count))
for item in _data.chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.users.count))
for item in _data.users {
item.serialize(buffer, true)
}
break
case .blockedSlice(let _data):
if boxed {
buffer.appendInt32(-513392236)
}
serializeInt32(_data.count, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.blocked.count))
for item in _data.blocked {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.chats.count))
for item in _data.chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.users.count))
for item in _data.users {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .blocked(let _data):
return ("blocked", [("blocked", ConstructorParameterDescription(_data.blocked)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users))])
case .blockedSlice(let _data):
return ("blockedSlice", [("count", ConstructorParameterDescription(_data.count)), ("blocked", ConstructorParameterDescription(_data.blocked)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users))])
}
}
public static func parse_blocked(_ reader: BufferReader) -> Blocked? {
var _1: [Api.PeerBlocked]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.PeerBlocked.self)
}
var _2: [Api.Chat]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _3: [Api.User]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.contacts.Blocked.blocked(Cons_blocked(blocked: _1!, chats: _2!, users: _3!))
}
else {
return nil
}
}
public static func parse_blockedSlice(_ reader: BufferReader) -> Blocked? {
var _1: Int32?
_1 = reader.readInt32()
var _2: [Api.PeerBlocked]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.PeerBlocked.self)
}
var _3: [Api.Chat]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _4: [Api.User]?
if let _ = reader.readInt32() {
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.contacts.Blocked.blockedSlice(Cons_blockedSlice(count: _1!, blocked: _2!, chats: _3!, users: _4!))
}
else {
return nil
}
}
}
}
public extension Api.contacts {
enum ContactBirthdays: TypeConstructorDescription {
public class Cons_contactBirthdays: TypeConstructorDescription {
@ -1638,3 +1499,278 @@ public extension Api.help {
}
}
}
public extension Api.help {
enum PremiumPromo: TypeConstructorDescription {
public class Cons_premiumPromo: TypeConstructorDescription {
public var statusText: String
public var statusEntities: [Api.MessageEntity]
public var videoSections: [String]
public var videos: [Api.Document]
public var periodOptions: [Api.PremiumSubscriptionOption]
public var users: [Api.User]
public init(statusText: String, statusEntities: [Api.MessageEntity], videoSections: [String], videos: [Api.Document], periodOptions: [Api.PremiumSubscriptionOption], users: [Api.User]) {
self.statusText = statusText
self.statusEntities = statusEntities
self.videoSections = videoSections
self.videos = videos
self.periodOptions = periodOptions
self.users = users
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("premiumPromo", [("statusText", ConstructorParameterDescription(self.statusText)), ("statusEntities", ConstructorParameterDescription(self.statusEntities)), ("videoSections", ConstructorParameterDescription(self.videoSections)), ("videos", ConstructorParameterDescription(self.videos)), ("periodOptions", ConstructorParameterDescription(self.periodOptions)), ("users", ConstructorParameterDescription(self.users))])
}
}
case premiumPromo(Cons_premiumPromo)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .premiumPromo(let _data):
if boxed {
buffer.appendInt32(1395946908)
}
serializeString(_data.statusText, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.statusEntities.count))
for item in _data.statusEntities {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.videoSections.count))
for item in _data.videoSections {
serializeString(item, buffer: buffer, boxed: false)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.videos.count))
for item in _data.videos {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.periodOptions.count))
for item in _data.periodOptions {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.users.count))
for item in _data.users {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .premiumPromo(let _data):
return ("premiumPromo", [("statusText", ConstructorParameterDescription(_data.statusText)), ("statusEntities", ConstructorParameterDescription(_data.statusEntities)), ("videoSections", ConstructorParameterDescription(_data.videoSections)), ("videos", ConstructorParameterDescription(_data.videos)), ("periodOptions", ConstructorParameterDescription(_data.periodOptions)), ("users", ConstructorParameterDescription(_data.users))])
}
}
public static func parse_premiumPromo(_ reader: BufferReader) -> PremiumPromo? {
var _1: String?
_1 = parseString(reader)
var _2: [Api.MessageEntity]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.MessageEntity.self)
}
var _3: [String]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: -1255641564, elementType: String.self)
}
var _4: [Api.Document]?
if let _ = reader.readInt32() {
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Document.self)
}
var _5: [Api.PremiumSubscriptionOption]?
if let _ = reader.readInt32() {
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.PremiumSubscriptionOption.self)
}
var _6: [Api.User]?
if let _ = reader.readInt32() {
_6 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
return Api.help.PremiumPromo.premiumPromo(Cons_premiumPromo(statusText: _1!, statusEntities: _2!, videoSections: _3!, videos: _4!, periodOptions: _5!, users: _6!))
}
else {
return nil
}
}
}
}
public extension Api.help {
enum PromoData: TypeConstructorDescription {
public class Cons_promoData: TypeConstructorDescription {
public var flags: Int32
public var expires: Int32
public var peer: Api.Peer?
public var psaType: String?
public var psaMessage: String?
public var pendingSuggestions: [String]
public var dismissedSuggestions: [String]
public var customPendingSuggestion: Api.PendingSuggestion?
public var chats: [Api.Chat]
public var users: [Api.User]
public init(flags: Int32, expires: Int32, peer: Api.Peer?, psaType: String?, psaMessage: String?, pendingSuggestions: [String], dismissedSuggestions: [String], customPendingSuggestion: Api.PendingSuggestion?, chats: [Api.Chat], users: [Api.User]) {
self.flags = flags
self.expires = expires
self.peer = peer
self.psaType = psaType
self.psaMessage = psaMessage
self.pendingSuggestions = pendingSuggestions
self.dismissedSuggestions = dismissedSuggestions
self.customPendingSuggestion = customPendingSuggestion
self.chats = chats
self.users = users
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("promoData", [("flags", ConstructorParameterDescription(self.flags)), ("expires", ConstructorParameterDescription(self.expires)), ("peer", ConstructorParameterDescription(self.peer)), ("psaType", ConstructorParameterDescription(self.psaType)), ("psaMessage", ConstructorParameterDescription(self.psaMessage)), ("pendingSuggestions", ConstructorParameterDescription(self.pendingSuggestions)), ("dismissedSuggestions", ConstructorParameterDescription(self.dismissedSuggestions)), ("customPendingSuggestion", ConstructorParameterDescription(self.customPendingSuggestion)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users))])
}
}
public class Cons_promoDataEmpty: TypeConstructorDescription {
public var expires: Int32
public init(expires: Int32) {
self.expires = expires
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("promoDataEmpty", [("expires", ConstructorParameterDescription(self.expires))])
}
}
case promoData(Cons_promoData)
case promoDataEmpty(Cons_promoDataEmpty)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .promoData(let _data):
if boxed {
buffer.appendInt32(145021050)
}
serializeInt32(_data.flags, buffer: buffer, boxed: false)
serializeInt32(_data.expires, buffer: buffer, boxed: false)
if Int(_data.flags) & Int(1 << 3) != 0 {
_data.peer!.serialize(buffer, true)
}
if Int(_data.flags) & Int(1 << 1) != 0 {
serializeString(_data.psaType!, buffer: buffer, boxed: false)
}
if Int(_data.flags) & Int(1 << 2) != 0 {
serializeString(_data.psaMessage!, buffer: buffer, boxed: false)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.pendingSuggestions.count))
for item in _data.pendingSuggestions {
serializeString(item, buffer: buffer, boxed: false)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.dismissedSuggestions.count))
for item in _data.dismissedSuggestions {
serializeString(item, buffer: buffer, boxed: false)
}
if Int(_data.flags) & Int(1 << 4) != 0 {
_data.customPendingSuggestion!.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.chats.count))
for item in _data.chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.users.count))
for item in _data.users {
item.serialize(buffer, true)
}
break
case .promoDataEmpty(let _data):
if boxed {
buffer.appendInt32(-1728664459)
}
serializeInt32(_data.expires, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .promoData(let _data):
return ("promoData", [("flags", ConstructorParameterDescription(_data.flags)), ("expires", ConstructorParameterDescription(_data.expires)), ("peer", ConstructorParameterDescription(_data.peer)), ("psaType", ConstructorParameterDescription(_data.psaType)), ("psaMessage", ConstructorParameterDescription(_data.psaMessage)), ("pendingSuggestions", ConstructorParameterDescription(_data.pendingSuggestions)), ("dismissedSuggestions", ConstructorParameterDescription(_data.dismissedSuggestions)), ("customPendingSuggestion", ConstructorParameterDescription(_data.customPendingSuggestion)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users))])
case .promoDataEmpty(let _data):
return ("promoDataEmpty", [("expires", ConstructorParameterDescription(_data.expires))])
}
}
public static func parse_promoData(_ reader: BufferReader) -> PromoData? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int32?
_2 = reader.readInt32()
var _3: Api.Peer?
if Int(_1!) & Int(1 << 3) != 0 {
if let signature = reader.readInt32() {
_3 = Api.parse(reader, signature: signature) as? Api.Peer
}
}
var _4: String?
if Int(_1!) & Int(1 << 1) != 0 {
_4 = parseString(reader)
}
var _5: String?
if Int(_1!) & Int(1 << 2) != 0 {
_5 = parseString(reader)
}
var _6: [String]?
if let _ = reader.readInt32() {
_6 = Api.parseVector(reader, elementSignature: -1255641564, elementType: String.self)
}
var _7: [String]?
if let _ = reader.readInt32() {
_7 = Api.parseVector(reader, elementSignature: -1255641564, elementType: String.self)
}
var _8: Api.PendingSuggestion?
if Int(_1!) & Int(1 << 4) != 0 {
if let signature = reader.readInt32() {
_8 = Api.parse(reader, signature: signature) as? Api.PendingSuggestion
}
}
var _9: [Api.Chat]?
if let _ = reader.readInt32() {
_9 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _10: [Api.User]?
if let _ = reader.readInt32() {
_10 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 3) == 0) || _3 != nil
let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 2) == 0) || _5 != nil
let _c6 = _6 != nil
let _c7 = _7 != nil
let _c8 = (Int(_1!) & Int(1 << 4) == 0) || _8 != nil
let _c9 = _9 != nil
let _c10 = _10 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 {
return Api.help.PromoData.promoData(Cons_promoData(flags: _1!, expires: _2!, peer: _3, psaType: _4, psaMessage: _5, pendingSuggestions: _6!, dismissedSuggestions: _7!, customPendingSuggestion: _8, chats: _9!, users: _10!))
}
else {
return nil
}
}
public static func parse_promoDataEmpty(_ reader: BufferReader) -> PromoData? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
if _c1 {
return Api.help.PromoData.promoDataEmpty(Cons_promoDataEmpty(expires: _1!))
}
else {
return nil
}
}
}
}

View file

@ -1,278 +1,3 @@
public extension Api.help {
enum PremiumPromo: TypeConstructorDescription {
public class Cons_premiumPromo: TypeConstructorDescription {
public var statusText: String
public var statusEntities: [Api.MessageEntity]
public var videoSections: [String]
public var videos: [Api.Document]
public var periodOptions: [Api.PremiumSubscriptionOption]
public var users: [Api.User]
public init(statusText: String, statusEntities: [Api.MessageEntity], videoSections: [String], videos: [Api.Document], periodOptions: [Api.PremiumSubscriptionOption], users: [Api.User]) {
self.statusText = statusText
self.statusEntities = statusEntities
self.videoSections = videoSections
self.videos = videos
self.periodOptions = periodOptions
self.users = users
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("premiumPromo", [("statusText", ConstructorParameterDescription(self.statusText)), ("statusEntities", ConstructorParameterDescription(self.statusEntities)), ("videoSections", ConstructorParameterDescription(self.videoSections)), ("videos", ConstructorParameterDescription(self.videos)), ("periodOptions", ConstructorParameterDescription(self.periodOptions)), ("users", ConstructorParameterDescription(self.users))])
}
}
case premiumPromo(Cons_premiumPromo)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .premiumPromo(let _data):
if boxed {
buffer.appendInt32(1395946908)
}
serializeString(_data.statusText, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.statusEntities.count))
for item in _data.statusEntities {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.videoSections.count))
for item in _data.videoSections {
serializeString(item, buffer: buffer, boxed: false)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.videos.count))
for item in _data.videos {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.periodOptions.count))
for item in _data.periodOptions {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.users.count))
for item in _data.users {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .premiumPromo(let _data):
return ("premiumPromo", [("statusText", ConstructorParameterDescription(_data.statusText)), ("statusEntities", ConstructorParameterDescription(_data.statusEntities)), ("videoSections", ConstructorParameterDescription(_data.videoSections)), ("videos", ConstructorParameterDescription(_data.videos)), ("periodOptions", ConstructorParameterDescription(_data.periodOptions)), ("users", ConstructorParameterDescription(_data.users))])
}
}
public static func parse_premiumPromo(_ reader: BufferReader) -> PremiumPromo? {
var _1: String?
_1 = parseString(reader)
var _2: [Api.MessageEntity]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.MessageEntity.self)
}
var _3: [String]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: -1255641564, elementType: String.self)
}
var _4: [Api.Document]?
if let _ = reader.readInt32() {
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Document.self)
}
var _5: [Api.PremiumSubscriptionOption]?
if let _ = reader.readInt32() {
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.PremiumSubscriptionOption.self)
}
var _6: [Api.User]?
if let _ = reader.readInt32() {
_6 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
return Api.help.PremiumPromo.premiumPromo(Cons_premiumPromo(statusText: _1!, statusEntities: _2!, videoSections: _3!, videos: _4!, periodOptions: _5!, users: _6!))
}
else {
return nil
}
}
}
}
public extension Api.help {
enum PromoData: TypeConstructorDescription {
public class Cons_promoData: TypeConstructorDescription {
public var flags: Int32
public var expires: Int32
public var peer: Api.Peer?
public var psaType: String?
public var psaMessage: String?
public var pendingSuggestions: [String]
public var dismissedSuggestions: [String]
public var customPendingSuggestion: Api.PendingSuggestion?
public var chats: [Api.Chat]
public var users: [Api.User]
public init(flags: Int32, expires: Int32, peer: Api.Peer?, psaType: String?, psaMessage: String?, pendingSuggestions: [String], dismissedSuggestions: [String], customPendingSuggestion: Api.PendingSuggestion?, chats: [Api.Chat], users: [Api.User]) {
self.flags = flags
self.expires = expires
self.peer = peer
self.psaType = psaType
self.psaMessage = psaMessage
self.pendingSuggestions = pendingSuggestions
self.dismissedSuggestions = dismissedSuggestions
self.customPendingSuggestion = customPendingSuggestion
self.chats = chats
self.users = users
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("promoData", [("flags", ConstructorParameterDescription(self.flags)), ("expires", ConstructorParameterDescription(self.expires)), ("peer", ConstructorParameterDescription(self.peer)), ("psaType", ConstructorParameterDescription(self.psaType)), ("psaMessage", ConstructorParameterDescription(self.psaMessage)), ("pendingSuggestions", ConstructorParameterDescription(self.pendingSuggestions)), ("dismissedSuggestions", ConstructorParameterDescription(self.dismissedSuggestions)), ("customPendingSuggestion", ConstructorParameterDescription(self.customPendingSuggestion)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users))])
}
}
public class Cons_promoDataEmpty: TypeConstructorDescription {
public var expires: Int32
public init(expires: Int32) {
self.expires = expires
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("promoDataEmpty", [("expires", ConstructorParameterDescription(self.expires))])
}
}
case promoData(Cons_promoData)
case promoDataEmpty(Cons_promoDataEmpty)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .promoData(let _data):
if boxed {
buffer.appendInt32(145021050)
}
serializeInt32(_data.flags, buffer: buffer, boxed: false)
serializeInt32(_data.expires, buffer: buffer, boxed: false)
if Int(_data.flags) & Int(1 << 3) != 0 {
_data.peer!.serialize(buffer, true)
}
if Int(_data.flags) & Int(1 << 1) != 0 {
serializeString(_data.psaType!, buffer: buffer, boxed: false)
}
if Int(_data.flags) & Int(1 << 2) != 0 {
serializeString(_data.psaMessage!, buffer: buffer, boxed: false)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.pendingSuggestions.count))
for item in _data.pendingSuggestions {
serializeString(item, buffer: buffer, boxed: false)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.dismissedSuggestions.count))
for item in _data.dismissedSuggestions {
serializeString(item, buffer: buffer, boxed: false)
}
if Int(_data.flags) & Int(1 << 4) != 0 {
_data.customPendingSuggestion!.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.chats.count))
for item in _data.chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.users.count))
for item in _data.users {
item.serialize(buffer, true)
}
break
case .promoDataEmpty(let _data):
if boxed {
buffer.appendInt32(-1728664459)
}
serializeInt32(_data.expires, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .promoData(let _data):
return ("promoData", [("flags", ConstructorParameterDescription(_data.flags)), ("expires", ConstructorParameterDescription(_data.expires)), ("peer", ConstructorParameterDescription(_data.peer)), ("psaType", ConstructorParameterDescription(_data.psaType)), ("psaMessage", ConstructorParameterDescription(_data.psaMessage)), ("pendingSuggestions", ConstructorParameterDescription(_data.pendingSuggestions)), ("dismissedSuggestions", ConstructorParameterDescription(_data.dismissedSuggestions)), ("customPendingSuggestion", ConstructorParameterDescription(_data.customPendingSuggestion)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users))])
case .promoDataEmpty(let _data):
return ("promoDataEmpty", [("expires", ConstructorParameterDescription(_data.expires))])
}
}
public static func parse_promoData(_ reader: BufferReader) -> PromoData? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int32?
_2 = reader.readInt32()
var _3: Api.Peer?
if Int(_1!) & Int(1 << 3) != 0 {
if let signature = reader.readInt32() {
_3 = Api.parse(reader, signature: signature) as? Api.Peer
}
}
var _4: String?
if Int(_1!) & Int(1 << 1) != 0 {
_4 = parseString(reader)
}
var _5: String?
if Int(_1!) & Int(1 << 2) != 0 {
_5 = parseString(reader)
}
var _6: [String]?
if let _ = reader.readInt32() {
_6 = Api.parseVector(reader, elementSignature: -1255641564, elementType: String.self)
}
var _7: [String]?
if let _ = reader.readInt32() {
_7 = Api.parseVector(reader, elementSignature: -1255641564, elementType: String.self)
}
var _8: Api.PendingSuggestion?
if Int(_1!) & Int(1 << 4) != 0 {
if let signature = reader.readInt32() {
_8 = Api.parse(reader, signature: signature) as? Api.PendingSuggestion
}
}
var _9: [Api.Chat]?
if let _ = reader.readInt32() {
_9 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _10: [Api.User]?
if let _ = reader.readInt32() {
_10 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 3) == 0) || _3 != nil
let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 2) == 0) || _5 != nil
let _c6 = _6 != nil
let _c7 = _7 != nil
let _c8 = (Int(_1!) & Int(1 << 4) == 0) || _8 != nil
let _c9 = _9 != nil
let _c10 = _10 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 {
return Api.help.PromoData.promoData(Cons_promoData(flags: _1!, expires: _2!, peer: _3, psaType: _4, psaMessage: _5, pendingSuggestions: _6!, dismissedSuggestions: _7!, customPendingSuggestion: _8, chats: _9!, users: _10!))
}
else {
return nil
}
}
public static func parse_promoDataEmpty(_ reader: BufferReader) -> PromoData? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
if _c1 {
return Api.help.PromoData.promoDataEmpty(Cons_promoDataEmpty(expires: _1!))
}
else {
return nil
}
}
}
}
public extension Api.help {
enum RecentMeUrls: TypeConstructorDescription {
public class Cons_recentMeUrls: TypeConstructorDescription {
@ -1770,3 +1495,202 @@ public extension Api.messages {
}
}
}
public extension Api.messages {
enum CheckedHistoryImportPeer: TypeConstructorDescription {
public class Cons_checkedHistoryImportPeer: TypeConstructorDescription {
public var confirmText: String
public init(confirmText: String) {
self.confirmText = confirmText
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("checkedHistoryImportPeer", [("confirmText", ConstructorParameterDescription(self.confirmText))])
}
}
case checkedHistoryImportPeer(Cons_checkedHistoryImportPeer)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .checkedHistoryImportPeer(let _data):
if boxed {
buffer.appendInt32(-1571952873)
}
serializeString(_data.confirmText, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .checkedHistoryImportPeer(let _data):
return ("checkedHistoryImportPeer", [("confirmText", ConstructorParameterDescription(_data.confirmText))])
}
}
public static func parse_checkedHistoryImportPeer(_ reader: BufferReader) -> CheckedHistoryImportPeer? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
if _c1 {
return Api.messages.CheckedHistoryImportPeer.checkedHistoryImportPeer(Cons_checkedHistoryImportPeer(confirmText: _1!))
}
else {
return nil
}
}
}
}
public extension Api.messages {
enum ComposedMessageWithAI: TypeConstructorDescription {
public class Cons_composedMessageWithAI: TypeConstructorDescription {
public var flags: Int32
public var resultText: Api.TextWithEntities
public var diffText: Api.TextWithEntities?
public init(flags: Int32, resultText: Api.TextWithEntities, diffText: Api.TextWithEntities?) {
self.flags = flags
self.resultText = resultText
self.diffText = diffText
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("composedMessageWithAI", [("flags", ConstructorParameterDescription(self.flags)), ("resultText", ConstructorParameterDescription(self.resultText)), ("diffText", ConstructorParameterDescription(self.diffText))])
}
}
case composedMessageWithAI(Cons_composedMessageWithAI)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .composedMessageWithAI(let _data):
if boxed {
buffer.appendInt32(-1864913414)
}
serializeInt32(_data.flags, buffer: buffer, boxed: false)
_data.resultText.serialize(buffer, true)
if Int(_data.flags) & Int(1 << 0) != 0 {
_data.diffText!.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .composedMessageWithAI(let _data):
return ("composedMessageWithAI", [("flags", ConstructorParameterDescription(_data.flags)), ("resultText", ConstructorParameterDescription(_data.resultText)), ("diffText", ConstructorParameterDescription(_data.diffText))])
}
}
public static func parse_composedMessageWithAI(_ reader: BufferReader) -> ComposedMessageWithAI? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Api.TextWithEntities?
if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.TextWithEntities
}
var _3: Api.TextWithEntities?
if Int(_1!) & Int(1 << 0) != 0 {
if let signature = reader.readInt32() {
_3 = Api.parse(reader, signature: signature) as? Api.TextWithEntities
}
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
if _c1 && _c2 && _c3 {
return Api.messages.ComposedMessageWithAI.composedMessageWithAI(Cons_composedMessageWithAI(flags: _1!, resultText: _2!, diffText: _3))
}
else {
return nil
}
}
}
}
public extension Api.messages {
enum DhConfig: TypeConstructorDescription {
public class Cons_dhConfig: TypeConstructorDescription {
public var g: Int32
public var p: Buffer
public var version: Int32
public var random: Buffer
public init(g: Int32, p: Buffer, version: Int32, random: Buffer) {
self.g = g
self.p = p
self.version = version
self.random = random
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("dhConfig", [("g", ConstructorParameterDescription(self.g)), ("p", ConstructorParameterDescription(self.p)), ("version", ConstructorParameterDescription(self.version)), ("random", ConstructorParameterDescription(self.random))])
}
}
public class Cons_dhConfigNotModified: TypeConstructorDescription {
public var random: Buffer
public init(random: Buffer) {
self.random = random
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("dhConfigNotModified", [("random", ConstructorParameterDescription(self.random))])
}
}
case dhConfig(Cons_dhConfig)
case dhConfigNotModified(Cons_dhConfigNotModified)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .dhConfig(let _data):
if boxed {
buffer.appendInt32(740433629)
}
serializeInt32(_data.g, buffer: buffer, boxed: false)
serializeBytes(_data.p, buffer: buffer, boxed: false)
serializeInt32(_data.version, buffer: buffer, boxed: false)
serializeBytes(_data.random, buffer: buffer, boxed: false)
break
case .dhConfigNotModified(let _data):
if boxed {
buffer.appendInt32(-1058912715)
}
serializeBytes(_data.random, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .dhConfig(let _data):
return ("dhConfig", [("g", ConstructorParameterDescription(_data.g)), ("p", ConstructorParameterDescription(_data.p)), ("version", ConstructorParameterDescription(_data.version)), ("random", ConstructorParameterDescription(_data.random))])
case .dhConfigNotModified(let _data):
return ("dhConfigNotModified", [("random", ConstructorParameterDescription(_data.random))])
}
}
public static func parse_dhConfig(_ reader: BufferReader) -> DhConfig? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Buffer?
_2 = parseBytes(reader)
var _3: Int32?
_3 = reader.readInt32()
var _4: Buffer?
_4 = parseBytes(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.messages.DhConfig.dhConfig(Cons_dhConfig(g: _1!, p: _2!, version: _3!, random: _4!))
}
else {
return nil
}
}
public static func parse_dhConfigNotModified(_ reader: BufferReader) -> DhConfig? {
var _1: Buffer?
_1 = parseBytes(reader)
let _c1 = _1 != nil
if _c1 {
return Api.messages.DhConfig.dhConfigNotModified(Cons_dhConfigNotModified(random: _1!))
}
else {
return nil
}
}
}
}

View file

@ -1,202 +1,3 @@
public extension Api.messages {
enum CheckedHistoryImportPeer: TypeConstructorDescription {
public class Cons_checkedHistoryImportPeer: TypeConstructorDescription {
public var confirmText: String
public init(confirmText: String) {
self.confirmText = confirmText
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("checkedHistoryImportPeer", [("confirmText", ConstructorParameterDescription(self.confirmText))])
}
}
case checkedHistoryImportPeer(Cons_checkedHistoryImportPeer)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .checkedHistoryImportPeer(let _data):
if boxed {
buffer.appendInt32(-1571952873)
}
serializeString(_data.confirmText, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .checkedHistoryImportPeer(let _data):
return ("checkedHistoryImportPeer", [("confirmText", ConstructorParameterDescription(_data.confirmText))])
}
}
public static func parse_checkedHistoryImportPeer(_ reader: BufferReader) -> CheckedHistoryImportPeer? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
if _c1 {
return Api.messages.CheckedHistoryImportPeer.checkedHistoryImportPeer(Cons_checkedHistoryImportPeer(confirmText: _1!))
}
else {
return nil
}
}
}
}
public extension Api.messages {
enum ComposedMessageWithAI: TypeConstructorDescription {
public class Cons_composedMessageWithAI: TypeConstructorDescription {
public var flags: Int32
public var resultText: Api.TextWithEntities
public var diffText: Api.TextWithEntities?
public init(flags: Int32, resultText: Api.TextWithEntities, diffText: Api.TextWithEntities?) {
self.flags = flags
self.resultText = resultText
self.diffText = diffText
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("composedMessageWithAI", [("flags", ConstructorParameterDescription(self.flags)), ("resultText", ConstructorParameterDescription(self.resultText)), ("diffText", ConstructorParameterDescription(self.diffText))])
}
}
case composedMessageWithAI(Cons_composedMessageWithAI)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .composedMessageWithAI(let _data):
if boxed {
buffer.appendInt32(-1864913414)
}
serializeInt32(_data.flags, buffer: buffer, boxed: false)
_data.resultText.serialize(buffer, true)
if Int(_data.flags) & Int(1 << 0) != 0 {
_data.diffText!.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .composedMessageWithAI(let _data):
return ("composedMessageWithAI", [("flags", ConstructorParameterDescription(_data.flags)), ("resultText", ConstructorParameterDescription(_data.resultText)), ("diffText", ConstructorParameterDescription(_data.diffText))])
}
}
public static func parse_composedMessageWithAI(_ reader: BufferReader) -> ComposedMessageWithAI? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Api.TextWithEntities?
if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.TextWithEntities
}
var _3: Api.TextWithEntities?
if Int(_1!) & Int(1 << 0) != 0 {
if let signature = reader.readInt32() {
_3 = Api.parse(reader, signature: signature) as? Api.TextWithEntities
}
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
if _c1 && _c2 && _c3 {
return Api.messages.ComposedMessageWithAI.composedMessageWithAI(Cons_composedMessageWithAI(flags: _1!, resultText: _2!, diffText: _3))
}
else {
return nil
}
}
}
}
public extension Api.messages {
enum DhConfig: TypeConstructorDescription {
public class Cons_dhConfig: TypeConstructorDescription {
public var g: Int32
public var p: Buffer
public var version: Int32
public var random: Buffer
public init(g: Int32, p: Buffer, version: Int32, random: Buffer) {
self.g = g
self.p = p
self.version = version
self.random = random
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("dhConfig", [("g", ConstructorParameterDescription(self.g)), ("p", ConstructorParameterDescription(self.p)), ("version", ConstructorParameterDescription(self.version)), ("random", ConstructorParameterDescription(self.random))])
}
}
public class Cons_dhConfigNotModified: TypeConstructorDescription {
public var random: Buffer
public init(random: Buffer) {
self.random = random
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("dhConfigNotModified", [("random", ConstructorParameterDescription(self.random))])
}
}
case dhConfig(Cons_dhConfig)
case dhConfigNotModified(Cons_dhConfigNotModified)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .dhConfig(let _data):
if boxed {
buffer.appendInt32(740433629)
}
serializeInt32(_data.g, buffer: buffer, boxed: false)
serializeBytes(_data.p, buffer: buffer, boxed: false)
serializeInt32(_data.version, buffer: buffer, boxed: false)
serializeBytes(_data.random, buffer: buffer, boxed: false)
break
case .dhConfigNotModified(let _data):
if boxed {
buffer.appendInt32(-1058912715)
}
serializeBytes(_data.random, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .dhConfig(let _data):
return ("dhConfig", [("g", ConstructorParameterDescription(_data.g)), ("p", ConstructorParameterDescription(_data.p)), ("version", ConstructorParameterDescription(_data.version)), ("random", ConstructorParameterDescription(_data.random))])
case .dhConfigNotModified(let _data):
return ("dhConfigNotModified", [("random", ConstructorParameterDescription(_data.random))])
}
}
public static func parse_dhConfig(_ reader: BufferReader) -> DhConfig? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Buffer?
_2 = parseBytes(reader)
var _3: Int32?
_3 = reader.readInt32()
var _4: Buffer?
_4 = parseBytes(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.messages.DhConfig.dhConfig(Cons_dhConfig(g: _1!, p: _2!, version: _3!, random: _4!))
}
else {
return nil
}
}
public static func parse_dhConfigNotModified(_ reader: BufferReader) -> DhConfig? {
var _1: Buffer?
_1 = parseBytes(reader)
let _c1 = _1 != nil
if _c1 {
return Api.messages.DhConfig.dhConfigNotModified(Cons_dhConfigNotModified(random: _1!))
}
else {
return nil
}
}
}
}
public extension Api.messages {
enum DialogFilters: TypeConstructorDescription {
public class Cons_dialogFilters: TypeConstructorDescription {
@ -1762,3 +1563,502 @@ public extension Api.messages {
}
}
}
public extension Api.messages {
enum MessageReactionsList: TypeConstructorDescription {
public class Cons_messageReactionsList: TypeConstructorDescription {
public var flags: Int32
public var count: Int32
public var reactions: [Api.MessagePeerReaction]
public var chats: [Api.Chat]
public var users: [Api.User]
public var nextOffset: String?
public init(flags: Int32, count: Int32, reactions: [Api.MessagePeerReaction], chats: [Api.Chat], users: [Api.User], nextOffset: String?) {
self.flags = flags
self.count = count
self.reactions = reactions
self.chats = chats
self.users = users
self.nextOffset = nextOffset
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("messageReactionsList", [("flags", ConstructorParameterDescription(self.flags)), ("count", ConstructorParameterDescription(self.count)), ("reactions", ConstructorParameterDescription(self.reactions)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users)), ("nextOffset", ConstructorParameterDescription(self.nextOffset))])
}
}
case messageReactionsList(Cons_messageReactionsList)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .messageReactionsList(let _data):
if boxed {
buffer.appendInt32(834488621)
}
serializeInt32(_data.flags, buffer: buffer, boxed: false)
serializeInt32(_data.count, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.reactions.count))
for item in _data.reactions {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.chats.count))
for item in _data.chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.users.count))
for item in _data.users {
item.serialize(buffer, true)
}
if Int(_data.flags) & Int(1 << 0) != 0 {
serializeString(_data.nextOffset!, buffer: buffer, boxed: false)
}
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .messageReactionsList(let _data):
return ("messageReactionsList", [("flags", ConstructorParameterDescription(_data.flags)), ("count", ConstructorParameterDescription(_data.count)), ("reactions", ConstructorParameterDescription(_data.reactions)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users)), ("nextOffset", ConstructorParameterDescription(_data.nextOffset))])
}
}
public static func parse_messageReactionsList(_ reader: BufferReader) -> MessageReactionsList? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int32?
_2 = reader.readInt32()
var _3: [Api.MessagePeerReaction]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.MessagePeerReaction.self)
}
var _4: [Api.Chat]?
if let _ = reader.readInt32() {
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _5: [Api.User]?
if let _ = reader.readInt32() {
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
var _6: String?
if Int(_1!) & Int(1 << 0) != 0 {
_6 = parseString(reader)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = (Int(_1!) & Int(1 << 0) == 0) || _6 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
return Api.messages.MessageReactionsList.messageReactionsList(Cons_messageReactionsList(flags: _1!, count: _2!, reactions: _3!, chats: _4!, users: _5!, nextOffset: _6))
}
else {
return nil
}
}
}
}
public extension Api.messages {
enum MessageViews: TypeConstructorDescription {
public class Cons_messageViews: TypeConstructorDescription {
public var views: [Api.MessageViews]
public var chats: [Api.Chat]
public var users: [Api.User]
public init(views: [Api.MessageViews], chats: [Api.Chat], users: [Api.User]) {
self.views = views
self.chats = chats
self.users = users
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("messageViews", [("views", ConstructorParameterDescription(self.views)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users))])
}
}
case messageViews(Cons_messageViews)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .messageViews(let _data):
if boxed {
buffer.appendInt32(-1228606141)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.views.count))
for item in _data.views {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.chats.count))
for item in _data.chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.users.count))
for item in _data.users {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .messageViews(let _data):
return ("messageViews", [("views", ConstructorParameterDescription(_data.views)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users))])
}
}
public static func parse_messageViews(_ reader: BufferReader) -> MessageViews? {
var _1: [Api.MessageViews]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.MessageViews.self)
}
var _2: [Api.Chat]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _3: [Api.User]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.messages.MessageViews.messageViews(Cons_messageViews(views: _1!, chats: _2!, users: _3!))
}
else {
return nil
}
}
}
}
public extension Api.messages {
enum Messages: TypeConstructorDescription {
public class Cons_channelMessages: TypeConstructorDescription {
public var flags: Int32
public var pts: Int32
public var count: Int32
public var offsetIdOffset: Int32?
public var messages: [Api.Message]
public var topics: [Api.ForumTopic]
public var chats: [Api.Chat]
public var users: [Api.User]
public init(flags: Int32, pts: Int32, count: Int32, offsetIdOffset: Int32?, messages: [Api.Message], topics: [Api.ForumTopic], chats: [Api.Chat], users: [Api.User]) {
self.flags = flags
self.pts = pts
self.count = count
self.offsetIdOffset = offsetIdOffset
self.messages = messages
self.topics = topics
self.chats = chats
self.users = users
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("channelMessages", [("flags", ConstructorParameterDescription(self.flags)), ("pts", ConstructorParameterDescription(self.pts)), ("count", ConstructorParameterDescription(self.count)), ("offsetIdOffset", ConstructorParameterDescription(self.offsetIdOffset)), ("messages", ConstructorParameterDescription(self.messages)), ("topics", ConstructorParameterDescription(self.topics)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users))])
}
}
public class Cons_messages: TypeConstructorDescription {
public var messages: [Api.Message]
public var topics: [Api.ForumTopic]
public var chats: [Api.Chat]
public var users: [Api.User]
public init(messages: [Api.Message], topics: [Api.ForumTopic], chats: [Api.Chat], users: [Api.User]) {
self.messages = messages
self.topics = topics
self.chats = chats
self.users = users
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("messages", [("messages", ConstructorParameterDescription(self.messages)), ("topics", ConstructorParameterDescription(self.topics)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users))])
}
}
public class Cons_messagesNotModified: TypeConstructorDescription {
public var count: Int32
public init(count: Int32) {
self.count = count
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("messagesNotModified", [("count", ConstructorParameterDescription(self.count))])
}
}
public class Cons_messagesSlice: TypeConstructorDescription {
public var flags: Int32
public var count: Int32
public var nextRate: Int32?
public var offsetIdOffset: Int32?
public var searchFlood: Api.SearchPostsFlood?
public var messages: [Api.Message]
public var topics: [Api.ForumTopic]
public var chats: [Api.Chat]
public var users: [Api.User]
public init(flags: Int32, count: Int32, nextRate: Int32?, offsetIdOffset: Int32?, searchFlood: Api.SearchPostsFlood?, messages: [Api.Message], topics: [Api.ForumTopic], chats: [Api.Chat], users: [Api.User]) {
self.flags = flags
self.count = count
self.nextRate = nextRate
self.offsetIdOffset = offsetIdOffset
self.searchFlood = searchFlood
self.messages = messages
self.topics = topics
self.chats = chats
self.users = users
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("messagesSlice", [("flags", ConstructorParameterDescription(self.flags)), ("count", ConstructorParameterDescription(self.count)), ("nextRate", ConstructorParameterDescription(self.nextRate)), ("offsetIdOffset", ConstructorParameterDescription(self.offsetIdOffset)), ("searchFlood", ConstructorParameterDescription(self.searchFlood)), ("messages", ConstructorParameterDescription(self.messages)), ("topics", ConstructorParameterDescription(self.topics)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users))])
}
}
case channelMessages(Cons_channelMessages)
case messages(Cons_messages)
case messagesNotModified(Cons_messagesNotModified)
case messagesSlice(Cons_messagesSlice)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .channelMessages(let _data):
if boxed {
buffer.appendInt32(-948520370)
}
serializeInt32(_data.flags, buffer: buffer, boxed: false)
serializeInt32(_data.pts, buffer: buffer, boxed: false)
serializeInt32(_data.count, buffer: buffer, boxed: false)
if Int(_data.flags) & Int(1 << 2) != 0 {
serializeInt32(_data.offsetIdOffset!, buffer: buffer, boxed: false)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.messages.count))
for item in _data.messages {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.topics.count))
for item in _data.topics {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.chats.count))
for item in _data.chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.users.count))
for item in _data.users {
item.serialize(buffer, true)
}
break
case .messages(let _data):
if boxed {
buffer.appendInt32(494135274)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.messages.count))
for item in _data.messages {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.topics.count))
for item in _data.topics {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.chats.count))
for item in _data.chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.users.count))
for item in _data.users {
item.serialize(buffer, true)
}
break
case .messagesNotModified(let _data):
if boxed {
buffer.appendInt32(1951620897)
}
serializeInt32(_data.count, buffer: buffer, boxed: false)
break
case .messagesSlice(let _data):
if boxed {
buffer.appendInt32(1595959062)
}
serializeInt32(_data.flags, buffer: buffer, boxed: false)
serializeInt32(_data.count, buffer: buffer, boxed: false)
if Int(_data.flags) & Int(1 << 0) != 0 {
serializeInt32(_data.nextRate!, buffer: buffer, boxed: false)
}
if Int(_data.flags) & Int(1 << 2) != 0 {
serializeInt32(_data.offsetIdOffset!, buffer: buffer, boxed: false)
}
if Int(_data.flags) & Int(1 << 3) != 0 {
_data.searchFlood!.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.messages.count))
for item in _data.messages {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.topics.count))
for item in _data.topics {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.chats.count))
for item in _data.chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.users.count))
for item in _data.users {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .channelMessages(let _data):
return ("channelMessages", [("flags", ConstructorParameterDescription(_data.flags)), ("pts", ConstructorParameterDescription(_data.pts)), ("count", ConstructorParameterDescription(_data.count)), ("offsetIdOffset", ConstructorParameterDescription(_data.offsetIdOffset)), ("messages", ConstructorParameterDescription(_data.messages)), ("topics", ConstructorParameterDescription(_data.topics)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users))])
case .messages(let _data):
return ("messages", [("messages", ConstructorParameterDescription(_data.messages)), ("topics", ConstructorParameterDescription(_data.topics)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users))])
case .messagesNotModified(let _data):
return ("messagesNotModified", [("count", ConstructorParameterDescription(_data.count))])
case .messagesSlice(let _data):
return ("messagesSlice", [("flags", ConstructorParameterDescription(_data.flags)), ("count", ConstructorParameterDescription(_data.count)), ("nextRate", ConstructorParameterDescription(_data.nextRate)), ("offsetIdOffset", ConstructorParameterDescription(_data.offsetIdOffset)), ("searchFlood", ConstructorParameterDescription(_data.searchFlood)), ("messages", ConstructorParameterDescription(_data.messages)), ("topics", ConstructorParameterDescription(_data.topics)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users))])
}
}
public static func parse_channelMessages(_ reader: BufferReader) -> Messages? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int32?
_2 = reader.readInt32()
var _3: Int32?
_3 = reader.readInt32()
var _4: Int32?
if Int(_1!) & Int(1 << 2) != 0 {
_4 = reader.readInt32()
}
var _5: [Api.Message]?
if let _ = reader.readInt32() {
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Message.self)
}
var _6: [Api.ForumTopic]?
if let _ = reader.readInt32() {
_6 = Api.parseVector(reader, elementSignature: 0, elementType: Api.ForumTopic.self)
}
var _7: [Api.Chat]?
if let _ = reader.readInt32() {
_7 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _8: [Api.User]?
if let _ = reader.readInt32() {
_8 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
let _c7 = _7 != nil
let _c8 = _8 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
return Api.messages.Messages.channelMessages(Cons_channelMessages(flags: _1!, pts: _2!, count: _3!, offsetIdOffset: _4, messages: _5!, topics: _6!, chats: _7!, users: _8!))
}
else {
return nil
}
}
public static func parse_messages(_ reader: BufferReader) -> Messages? {
var _1: [Api.Message]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Message.self)
}
var _2: [Api.ForumTopic]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.ForumTopic.self)
}
var _3: [Api.Chat]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _4: [Api.User]?
if let _ = reader.readInt32() {
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.messages.Messages.messages(Cons_messages(messages: _1!, topics: _2!, chats: _3!, users: _4!))
}
else {
return nil
}
}
public static func parse_messagesNotModified(_ reader: BufferReader) -> Messages? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
if _c1 {
return Api.messages.Messages.messagesNotModified(Cons_messagesNotModified(count: _1!))
}
else {
return nil
}
}
public static func parse_messagesSlice(_ reader: BufferReader) -> Messages? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int32?
_2 = reader.readInt32()
var _3: Int32?
if Int(_1!) & Int(1 << 0) != 0 {
_3 = reader.readInt32()
}
var _4: Int32?
if Int(_1!) & Int(1 << 2) != 0 {
_4 = reader.readInt32()
}
var _5: Api.SearchPostsFlood?
if Int(_1!) & Int(1 << 3) != 0 {
if let signature = reader.readInt32() {
_5 = Api.parse(reader, signature: signature) as? Api.SearchPostsFlood
}
}
var _6: [Api.Message]?
if let _ = reader.readInt32() {
_6 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Message.self)
}
var _7: [Api.ForumTopic]?
if let _ = reader.readInt32() {
_7 = Api.parseVector(reader, elementSignature: 0, elementType: Api.ForumTopic.self)
}
var _8: [Api.Chat]?
if let _ = reader.readInt32() {
_8 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _9: [Api.User]?
if let _ = reader.readInt32() {
_9 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 3) == 0) || _5 != nil
let _c6 = _6 != nil
let _c7 = _7 != nil
let _c8 = _8 != nil
let _c9 = _9 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 {
return Api.messages.Messages.messagesSlice(Cons_messagesSlice(flags: _1!, count: _2!, nextRate: _3, offsetIdOffset: _4, searchFlood: _5, messages: _6!, topics: _7!, chats: _8!, users: _9!))
}
else {
return nil
}
}
}
}

View file

@ -1,502 +1,3 @@
public extension Api.messages {
enum MessageReactionsList: TypeConstructorDescription {
public class Cons_messageReactionsList: TypeConstructorDescription {
public var flags: Int32
public var count: Int32
public var reactions: [Api.MessagePeerReaction]
public var chats: [Api.Chat]
public var users: [Api.User]
public var nextOffset: String?
public init(flags: Int32, count: Int32, reactions: [Api.MessagePeerReaction], chats: [Api.Chat], users: [Api.User], nextOffset: String?) {
self.flags = flags
self.count = count
self.reactions = reactions
self.chats = chats
self.users = users
self.nextOffset = nextOffset
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("messageReactionsList", [("flags", ConstructorParameterDescription(self.flags)), ("count", ConstructorParameterDescription(self.count)), ("reactions", ConstructorParameterDescription(self.reactions)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users)), ("nextOffset", ConstructorParameterDescription(self.nextOffset))])
}
}
case messageReactionsList(Cons_messageReactionsList)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .messageReactionsList(let _data):
if boxed {
buffer.appendInt32(834488621)
}
serializeInt32(_data.flags, buffer: buffer, boxed: false)
serializeInt32(_data.count, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.reactions.count))
for item in _data.reactions {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.chats.count))
for item in _data.chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.users.count))
for item in _data.users {
item.serialize(buffer, true)
}
if Int(_data.flags) & Int(1 << 0) != 0 {
serializeString(_data.nextOffset!, buffer: buffer, boxed: false)
}
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .messageReactionsList(let _data):
return ("messageReactionsList", [("flags", ConstructorParameterDescription(_data.flags)), ("count", ConstructorParameterDescription(_data.count)), ("reactions", ConstructorParameterDescription(_data.reactions)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users)), ("nextOffset", ConstructorParameterDescription(_data.nextOffset))])
}
}
public static func parse_messageReactionsList(_ reader: BufferReader) -> MessageReactionsList? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int32?
_2 = reader.readInt32()
var _3: [Api.MessagePeerReaction]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.MessagePeerReaction.self)
}
var _4: [Api.Chat]?
if let _ = reader.readInt32() {
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _5: [Api.User]?
if let _ = reader.readInt32() {
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
var _6: String?
if Int(_1!) & Int(1 << 0) != 0 {
_6 = parseString(reader)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = (Int(_1!) & Int(1 << 0) == 0) || _6 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
return Api.messages.MessageReactionsList.messageReactionsList(Cons_messageReactionsList(flags: _1!, count: _2!, reactions: _3!, chats: _4!, users: _5!, nextOffset: _6))
}
else {
return nil
}
}
}
}
public extension Api.messages {
enum MessageViews: TypeConstructorDescription {
public class Cons_messageViews: TypeConstructorDescription {
public var views: [Api.MessageViews]
public var chats: [Api.Chat]
public var users: [Api.User]
public init(views: [Api.MessageViews], chats: [Api.Chat], users: [Api.User]) {
self.views = views
self.chats = chats
self.users = users
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("messageViews", [("views", ConstructorParameterDescription(self.views)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users))])
}
}
case messageViews(Cons_messageViews)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .messageViews(let _data):
if boxed {
buffer.appendInt32(-1228606141)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.views.count))
for item in _data.views {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.chats.count))
for item in _data.chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.users.count))
for item in _data.users {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .messageViews(let _data):
return ("messageViews", [("views", ConstructorParameterDescription(_data.views)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users))])
}
}
public static func parse_messageViews(_ reader: BufferReader) -> MessageViews? {
var _1: [Api.MessageViews]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.MessageViews.self)
}
var _2: [Api.Chat]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _3: [Api.User]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.messages.MessageViews.messageViews(Cons_messageViews(views: _1!, chats: _2!, users: _3!))
}
else {
return nil
}
}
}
}
public extension Api.messages {
enum Messages: TypeConstructorDescription {
public class Cons_channelMessages: TypeConstructorDescription {
public var flags: Int32
public var pts: Int32
public var count: Int32
public var offsetIdOffset: Int32?
public var messages: [Api.Message]
public var topics: [Api.ForumTopic]
public var chats: [Api.Chat]
public var users: [Api.User]
public init(flags: Int32, pts: Int32, count: Int32, offsetIdOffset: Int32?, messages: [Api.Message], topics: [Api.ForumTopic], chats: [Api.Chat], users: [Api.User]) {
self.flags = flags
self.pts = pts
self.count = count
self.offsetIdOffset = offsetIdOffset
self.messages = messages
self.topics = topics
self.chats = chats
self.users = users
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("channelMessages", [("flags", ConstructorParameterDescription(self.flags)), ("pts", ConstructorParameterDescription(self.pts)), ("count", ConstructorParameterDescription(self.count)), ("offsetIdOffset", ConstructorParameterDescription(self.offsetIdOffset)), ("messages", ConstructorParameterDescription(self.messages)), ("topics", ConstructorParameterDescription(self.topics)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users))])
}
}
public class Cons_messages: TypeConstructorDescription {
public var messages: [Api.Message]
public var topics: [Api.ForumTopic]
public var chats: [Api.Chat]
public var users: [Api.User]
public init(messages: [Api.Message], topics: [Api.ForumTopic], chats: [Api.Chat], users: [Api.User]) {
self.messages = messages
self.topics = topics
self.chats = chats
self.users = users
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("messages", [("messages", ConstructorParameterDescription(self.messages)), ("topics", ConstructorParameterDescription(self.topics)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users))])
}
}
public class Cons_messagesNotModified: TypeConstructorDescription {
public var count: Int32
public init(count: Int32) {
self.count = count
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("messagesNotModified", [("count", ConstructorParameterDescription(self.count))])
}
}
public class Cons_messagesSlice: TypeConstructorDescription {
public var flags: Int32
public var count: Int32
public var nextRate: Int32?
public var offsetIdOffset: Int32?
public var searchFlood: Api.SearchPostsFlood?
public var messages: [Api.Message]
public var topics: [Api.ForumTopic]
public var chats: [Api.Chat]
public var users: [Api.User]
public init(flags: Int32, count: Int32, nextRate: Int32?, offsetIdOffset: Int32?, searchFlood: Api.SearchPostsFlood?, messages: [Api.Message], topics: [Api.ForumTopic], chats: [Api.Chat], users: [Api.User]) {
self.flags = flags
self.count = count
self.nextRate = nextRate
self.offsetIdOffset = offsetIdOffset
self.searchFlood = searchFlood
self.messages = messages
self.topics = topics
self.chats = chats
self.users = users
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("messagesSlice", [("flags", ConstructorParameterDescription(self.flags)), ("count", ConstructorParameterDescription(self.count)), ("nextRate", ConstructorParameterDescription(self.nextRate)), ("offsetIdOffset", ConstructorParameterDescription(self.offsetIdOffset)), ("searchFlood", ConstructorParameterDescription(self.searchFlood)), ("messages", ConstructorParameterDescription(self.messages)), ("topics", ConstructorParameterDescription(self.topics)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users))])
}
}
case channelMessages(Cons_channelMessages)
case messages(Cons_messages)
case messagesNotModified(Cons_messagesNotModified)
case messagesSlice(Cons_messagesSlice)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .channelMessages(let _data):
if boxed {
buffer.appendInt32(-948520370)
}
serializeInt32(_data.flags, buffer: buffer, boxed: false)
serializeInt32(_data.pts, buffer: buffer, boxed: false)
serializeInt32(_data.count, buffer: buffer, boxed: false)
if Int(_data.flags) & Int(1 << 2) != 0 {
serializeInt32(_data.offsetIdOffset!, buffer: buffer, boxed: false)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.messages.count))
for item in _data.messages {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.topics.count))
for item in _data.topics {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.chats.count))
for item in _data.chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.users.count))
for item in _data.users {
item.serialize(buffer, true)
}
break
case .messages(let _data):
if boxed {
buffer.appendInt32(494135274)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.messages.count))
for item in _data.messages {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.topics.count))
for item in _data.topics {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.chats.count))
for item in _data.chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.users.count))
for item in _data.users {
item.serialize(buffer, true)
}
break
case .messagesNotModified(let _data):
if boxed {
buffer.appendInt32(1951620897)
}
serializeInt32(_data.count, buffer: buffer, boxed: false)
break
case .messagesSlice(let _data):
if boxed {
buffer.appendInt32(1595959062)
}
serializeInt32(_data.flags, buffer: buffer, boxed: false)
serializeInt32(_data.count, buffer: buffer, boxed: false)
if Int(_data.flags) & Int(1 << 0) != 0 {
serializeInt32(_data.nextRate!, buffer: buffer, boxed: false)
}
if Int(_data.flags) & Int(1 << 2) != 0 {
serializeInt32(_data.offsetIdOffset!, buffer: buffer, boxed: false)
}
if Int(_data.flags) & Int(1 << 3) != 0 {
_data.searchFlood!.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.messages.count))
for item in _data.messages {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.topics.count))
for item in _data.topics {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.chats.count))
for item in _data.chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.users.count))
for item in _data.users {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .channelMessages(let _data):
return ("channelMessages", [("flags", ConstructorParameterDescription(_data.flags)), ("pts", ConstructorParameterDescription(_data.pts)), ("count", ConstructorParameterDescription(_data.count)), ("offsetIdOffset", ConstructorParameterDescription(_data.offsetIdOffset)), ("messages", ConstructorParameterDescription(_data.messages)), ("topics", ConstructorParameterDescription(_data.topics)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users))])
case .messages(let _data):
return ("messages", [("messages", ConstructorParameterDescription(_data.messages)), ("topics", ConstructorParameterDescription(_data.topics)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users))])
case .messagesNotModified(let _data):
return ("messagesNotModified", [("count", ConstructorParameterDescription(_data.count))])
case .messagesSlice(let _data):
return ("messagesSlice", [("flags", ConstructorParameterDescription(_data.flags)), ("count", ConstructorParameterDescription(_data.count)), ("nextRate", ConstructorParameterDescription(_data.nextRate)), ("offsetIdOffset", ConstructorParameterDescription(_data.offsetIdOffset)), ("searchFlood", ConstructorParameterDescription(_data.searchFlood)), ("messages", ConstructorParameterDescription(_data.messages)), ("topics", ConstructorParameterDescription(_data.topics)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users))])
}
}
public static func parse_channelMessages(_ reader: BufferReader) -> Messages? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int32?
_2 = reader.readInt32()
var _3: Int32?
_3 = reader.readInt32()
var _4: Int32?
if Int(_1!) & Int(1 << 2) != 0 {
_4 = reader.readInt32()
}
var _5: [Api.Message]?
if let _ = reader.readInt32() {
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Message.self)
}
var _6: [Api.ForumTopic]?
if let _ = reader.readInt32() {
_6 = Api.parseVector(reader, elementSignature: 0, elementType: Api.ForumTopic.self)
}
var _7: [Api.Chat]?
if let _ = reader.readInt32() {
_7 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _8: [Api.User]?
if let _ = reader.readInt32() {
_8 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
let _c7 = _7 != nil
let _c8 = _8 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
return Api.messages.Messages.channelMessages(Cons_channelMessages(flags: _1!, pts: _2!, count: _3!, offsetIdOffset: _4, messages: _5!, topics: _6!, chats: _7!, users: _8!))
}
else {
return nil
}
}
public static func parse_messages(_ reader: BufferReader) -> Messages? {
var _1: [Api.Message]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Message.self)
}
var _2: [Api.ForumTopic]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.ForumTopic.self)
}
var _3: [Api.Chat]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _4: [Api.User]?
if let _ = reader.readInt32() {
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.messages.Messages.messages(Cons_messages(messages: _1!, topics: _2!, chats: _3!, users: _4!))
}
else {
return nil
}
}
public static func parse_messagesNotModified(_ reader: BufferReader) -> Messages? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
if _c1 {
return Api.messages.Messages.messagesNotModified(Cons_messagesNotModified(count: _1!))
}
else {
return nil
}
}
public static func parse_messagesSlice(_ reader: BufferReader) -> Messages? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int32?
_2 = reader.readInt32()
var _3: Int32?
if Int(_1!) & Int(1 << 0) != 0 {
_3 = reader.readInt32()
}
var _4: Int32?
if Int(_1!) & Int(1 << 2) != 0 {
_4 = reader.readInt32()
}
var _5: Api.SearchPostsFlood?
if Int(_1!) & Int(1 << 3) != 0 {
if let signature = reader.readInt32() {
_5 = Api.parse(reader, signature: signature) as? Api.SearchPostsFlood
}
}
var _6: [Api.Message]?
if let _ = reader.readInt32() {
_6 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Message.self)
}
var _7: [Api.ForumTopic]?
if let _ = reader.readInt32() {
_7 = Api.parseVector(reader, elementSignature: 0, elementType: Api.ForumTopic.self)
}
var _8: [Api.Chat]?
if let _ = reader.readInt32() {
_8 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _9: [Api.User]?
if let _ = reader.readInt32() {
_9 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 3) == 0) || _5 != nil
let _c6 = _6 != nil
let _c7 = _7 != nil
let _c8 = _8 != nil
let _c9 = _9 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 {
return Api.messages.Messages.messagesSlice(Cons_messagesSlice(flags: _1!, count: _2!, nextRate: _3, offsetIdOffset: _4, searchFlood: _5, messages: _6!, topics: _7!, chats: _8!, users: _9!))
}
else {
return nil
}
}
}
}
public extension Api.messages {
enum MyStickers: TypeConstructorDescription {
public class Cons_myStickers: TypeConstructorDescription {
@ -1909,3 +1410,257 @@ public extension Api.messages {
}
}
}
public extension Api.messages {
enum StickerSetInstallResult: TypeConstructorDescription {
public class Cons_stickerSetInstallResultArchive: TypeConstructorDescription {
public var sets: [Api.StickerSetCovered]
public init(sets: [Api.StickerSetCovered]) {
self.sets = sets
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("stickerSetInstallResultArchive", [("sets", ConstructorParameterDescription(self.sets))])
}
}
case stickerSetInstallResultArchive(Cons_stickerSetInstallResultArchive)
case stickerSetInstallResultSuccess
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .stickerSetInstallResultArchive(let _data):
if boxed {
buffer.appendInt32(904138920)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.sets.count))
for item in _data.sets {
item.serialize(buffer, true)
}
break
case .stickerSetInstallResultSuccess:
if boxed {
buffer.appendInt32(946083368)
}
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .stickerSetInstallResultArchive(let _data):
return ("stickerSetInstallResultArchive", [("sets", ConstructorParameterDescription(_data.sets))])
case .stickerSetInstallResultSuccess:
return ("stickerSetInstallResultSuccess", [])
}
}
public static func parse_stickerSetInstallResultArchive(_ reader: BufferReader) -> StickerSetInstallResult? {
var _1: [Api.StickerSetCovered]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.StickerSetCovered.self)
}
let _c1 = _1 != nil
if _c1 {
return Api.messages.StickerSetInstallResult.stickerSetInstallResultArchive(Cons_stickerSetInstallResultArchive(sets: _1!))
}
else {
return nil
}
}
public static func parse_stickerSetInstallResultSuccess(_ reader: BufferReader) -> StickerSetInstallResult? {
return Api.messages.StickerSetInstallResult.stickerSetInstallResultSuccess
}
}
}
public extension Api.messages {
enum Stickers: TypeConstructorDescription {
public class Cons_stickers: TypeConstructorDescription {
public var hash: Int64
public var stickers: [Api.Document]
public init(hash: Int64, stickers: [Api.Document]) {
self.hash = hash
self.stickers = stickers
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("stickers", [("hash", ConstructorParameterDescription(self.hash)), ("stickers", ConstructorParameterDescription(self.stickers))])
}
}
case stickers(Cons_stickers)
case stickersNotModified
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .stickers(let _data):
if boxed {
buffer.appendInt32(816245886)
}
serializeInt64(_data.hash, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.stickers.count))
for item in _data.stickers {
item.serialize(buffer, true)
}
break
case .stickersNotModified:
if boxed {
buffer.appendInt32(-244016606)
}
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .stickers(let _data):
return ("stickers", [("hash", ConstructorParameterDescription(_data.hash)), ("stickers", ConstructorParameterDescription(_data.stickers))])
case .stickersNotModified:
return ("stickersNotModified", [])
}
}
public static func parse_stickers(_ reader: BufferReader) -> Stickers? {
var _1: Int64?
_1 = reader.readInt64()
var _2: [Api.Document]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Document.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.messages.Stickers.stickers(Cons_stickers(hash: _1!, stickers: _2!))
}
else {
return nil
}
}
public static func parse_stickersNotModified(_ reader: BufferReader) -> Stickers? {
return Api.messages.Stickers.stickersNotModified
}
}
}
public extension Api.messages {
enum TranscribedAudio: TypeConstructorDescription {
public class Cons_transcribedAudio: TypeConstructorDescription {
public var flags: Int32
public var transcriptionId: Int64
public var text: String
public var trialRemainsNum: Int32?
public var trialRemainsUntilDate: Int32?
public init(flags: Int32, transcriptionId: Int64, text: String, trialRemainsNum: Int32?, trialRemainsUntilDate: Int32?) {
self.flags = flags
self.transcriptionId = transcriptionId
self.text = text
self.trialRemainsNum = trialRemainsNum
self.trialRemainsUntilDate = trialRemainsUntilDate
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("transcribedAudio", [("flags", ConstructorParameterDescription(self.flags)), ("transcriptionId", ConstructorParameterDescription(self.transcriptionId)), ("text", ConstructorParameterDescription(self.text)), ("trialRemainsNum", ConstructorParameterDescription(self.trialRemainsNum)), ("trialRemainsUntilDate", ConstructorParameterDescription(self.trialRemainsUntilDate))])
}
}
case transcribedAudio(Cons_transcribedAudio)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .transcribedAudio(let _data):
if boxed {
buffer.appendInt32(-809903785)
}
serializeInt32(_data.flags, buffer: buffer, boxed: false)
serializeInt64(_data.transcriptionId, buffer: buffer, boxed: false)
serializeString(_data.text, buffer: buffer, boxed: false)
if Int(_data.flags) & Int(1 << 1) != 0 {
serializeInt32(_data.trialRemainsNum!, buffer: buffer, boxed: false)
}
if Int(_data.flags) & Int(1 << 1) != 0 {
serializeInt32(_data.trialRemainsUntilDate!, buffer: buffer, boxed: false)
}
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .transcribedAudio(let _data):
return ("transcribedAudio", [("flags", ConstructorParameterDescription(_data.flags)), ("transcriptionId", ConstructorParameterDescription(_data.transcriptionId)), ("text", ConstructorParameterDescription(_data.text)), ("trialRemainsNum", ConstructorParameterDescription(_data.trialRemainsNum)), ("trialRemainsUntilDate", ConstructorParameterDescription(_data.trialRemainsUntilDate))])
}
}
public static func parse_transcribedAudio(_ reader: BufferReader) -> TranscribedAudio? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int64?
_2 = reader.readInt64()
var _3: String?
_3 = parseString(reader)
var _4: Int32?
if Int(_1!) & Int(1 << 1) != 0 {
_4 = reader.readInt32()
}
var _5: Int32?
if Int(_1!) & Int(1 << 1) != 0 {
_5 = reader.readInt32()
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 1) == 0) || _5 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 {
return Api.messages.TranscribedAudio.transcribedAudio(Cons_transcribedAudio(flags: _1!, transcriptionId: _2!, text: _3!, trialRemainsNum: _4, trialRemainsUntilDate: _5))
}
else {
return nil
}
}
}
}
public extension Api.messages {
enum TranslatedText: TypeConstructorDescription {
public class Cons_translateResult: TypeConstructorDescription {
public var result: [Api.TextWithEntities]
public init(result: [Api.TextWithEntities]) {
self.result = result
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("translateResult", [("result", ConstructorParameterDescription(self.result))])
}
}
case translateResult(Cons_translateResult)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .translateResult(let _data):
if boxed {
buffer.appendInt32(870003448)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.result.count))
for item in _data.result {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .translateResult(let _data):
return ("translateResult", [("result", ConstructorParameterDescription(_data.result))])
}
}
public static func parse_translateResult(_ reader: BufferReader) -> TranslatedText? {
var _1: [Api.TextWithEntities]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.TextWithEntities.self)
}
let _c1 = _1 != nil
if _c1 {
return Api.messages.TranslatedText.translateResult(Cons_translateResult(result: _1!))
}
else {
return nil
}
}
}
}

View file

@ -1,257 +1,3 @@
public extension Api.messages {
enum StickerSetInstallResult: TypeConstructorDescription {
public class Cons_stickerSetInstallResultArchive: TypeConstructorDescription {
public var sets: [Api.StickerSetCovered]
public init(sets: [Api.StickerSetCovered]) {
self.sets = sets
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("stickerSetInstallResultArchive", [("sets", ConstructorParameterDescription(self.sets))])
}
}
case stickerSetInstallResultArchive(Cons_stickerSetInstallResultArchive)
case stickerSetInstallResultSuccess
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .stickerSetInstallResultArchive(let _data):
if boxed {
buffer.appendInt32(904138920)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.sets.count))
for item in _data.sets {
item.serialize(buffer, true)
}
break
case .stickerSetInstallResultSuccess:
if boxed {
buffer.appendInt32(946083368)
}
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .stickerSetInstallResultArchive(let _data):
return ("stickerSetInstallResultArchive", [("sets", ConstructorParameterDescription(_data.sets))])
case .stickerSetInstallResultSuccess:
return ("stickerSetInstallResultSuccess", [])
}
}
public static func parse_stickerSetInstallResultArchive(_ reader: BufferReader) -> StickerSetInstallResult? {
var _1: [Api.StickerSetCovered]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.StickerSetCovered.self)
}
let _c1 = _1 != nil
if _c1 {
return Api.messages.StickerSetInstallResult.stickerSetInstallResultArchive(Cons_stickerSetInstallResultArchive(sets: _1!))
}
else {
return nil
}
}
public static func parse_stickerSetInstallResultSuccess(_ reader: BufferReader) -> StickerSetInstallResult? {
return Api.messages.StickerSetInstallResult.stickerSetInstallResultSuccess
}
}
}
public extension Api.messages {
enum Stickers: TypeConstructorDescription {
public class Cons_stickers: TypeConstructorDescription {
public var hash: Int64
public var stickers: [Api.Document]
public init(hash: Int64, stickers: [Api.Document]) {
self.hash = hash
self.stickers = stickers
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("stickers", [("hash", ConstructorParameterDescription(self.hash)), ("stickers", ConstructorParameterDescription(self.stickers))])
}
}
case stickers(Cons_stickers)
case stickersNotModified
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .stickers(let _data):
if boxed {
buffer.appendInt32(816245886)
}
serializeInt64(_data.hash, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.stickers.count))
for item in _data.stickers {
item.serialize(buffer, true)
}
break
case .stickersNotModified:
if boxed {
buffer.appendInt32(-244016606)
}
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .stickers(let _data):
return ("stickers", [("hash", ConstructorParameterDescription(_data.hash)), ("stickers", ConstructorParameterDescription(_data.stickers))])
case .stickersNotModified:
return ("stickersNotModified", [])
}
}
public static func parse_stickers(_ reader: BufferReader) -> Stickers? {
var _1: Int64?
_1 = reader.readInt64()
var _2: [Api.Document]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Document.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.messages.Stickers.stickers(Cons_stickers(hash: _1!, stickers: _2!))
}
else {
return nil
}
}
public static func parse_stickersNotModified(_ reader: BufferReader) -> Stickers? {
return Api.messages.Stickers.stickersNotModified
}
}
}
public extension Api.messages {
enum TranscribedAudio: TypeConstructorDescription {
public class Cons_transcribedAudio: TypeConstructorDescription {
public var flags: Int32
public var transcriptionId: Int64
public var text: String
public var trialRemainsNum: Int32?
public var trialRemainsUntilDate: Int32?
public init(flags: Int32, transcriptionId: Int64, text: String, trialRemainsNum: Int32?, trialRemainsUntilDate: Int32?) {
self.flags = flags
self.transcriptionId = transcriptionId
self.text = text
self.trialRemainsNum = trialRemainsNum
self.trialRemainsUntilDate = trialRemainsUntilDate
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("transcribedAudio", [("flags", ConstructorParameterDescription(self.flags)), ("transcriptionId", ConstructorParameterDescription(self.transcriptionId)), ("text", ConstructorParameterDescription(self.text)), ("trialRemainsNum", ConstructorParameterDescription(self.trialRemainsNum)), ("trialRemainsUntilDate", ConstructorParameterDescription(self.trialRemainsUntilDate))])
}
}
case transcribedAudio(Cons_transcribedAudio)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .transcribedAudio(let _data):
if boxed {
buffer.appendInt32(-809903785)
}
serializeInt32(_data.flags, buffer: buffer, boxed: false)
serializeInt64(_data.transcriptionId, buffer: buffer, boxed: false)
serializeString(_data.text, buffer: buffer, boxed: false)
if Int(_data.flags) & Int(1 << 1) != 0 {
serializeInt32(_data.trialRemainsNum!, buffer: buffer, boxed: false)
}
if Int(_data.flags) & Int(1 << 1) != 0 {
serializeInt32(_data.trialRemainsUntilDate!, buffer: buffer, boxed: false)
}
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .transcribedAudio(let _data):
return ("transcribedAudio", [("flags", ConstructorParameterDescription(_data.flags)), ("transcriptionId", ConstructorParameterDescription(_data.transcriptionId)), ("text", ConstructorParameterDescription(_data.text)), ("trialRemainsNum", ConstructorParameterDescription(_data.trialRemainsNum)), ("trialRemainsUntilDate", ConstructorParameterDescription(_data.trialRemainsUntilDate))])
}
}
public static func parse_transcribedAudio(_ reader: BufferReader) -> TranscribedAudio? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int64?
_2 = reader.readInt64()
var _3: String?
_3 = parseString(reader)
var _4: Int32?
if Int(_1!) & Int(1 << 1) != 0 {
_4 = reader.readInt32()
}
var _5: Int32?
if Int(_1!) & Int(1 << 1) != 0 {
_5 = reader.readInt32()
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 1) == 0) || _5 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 {
return Api.messages.TranscribedAudio.transcribedAudio(Cons_transcribedAudio(flags: _1!, transcriptionId: _2!, text: _3!, trialRemainsNum: _4, trialRemainsUntilDate: _5))
}
else {
return nil
}
}
}
}
public extension Api.messages {
enum TranslatedText: TypeConstructorDescription {
public class Cons_translateResult: TypeConstructorDescription {
public var result: [Api.TextWithEntities]
public init(result: [Api.TextWithEntities]) {
self.result = result
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("translateResult", [("result", ConstructorParameterDescription(self.result))])
}
}
case translateResult(Cons_translateResult)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .translateResult(let _data):
if boxed {
buffer.appendInt32(870003448)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.result.count))
for item in _data.result {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .translateResult(let _data):
return ("translateResult", [("result", ConstructorParameterDescription(_data.result))])
}
}
public static func parse_translateResult(_ reader: BufferReader) -> TranslatedText? {
var _1: [Api.TextWithEntities]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.TextWithEntities.self)
}
let _c1 = _1 != nil
if _c1 {
return Api.messages.TranslatedText.translateResult(Cons_translateResult(result: _1!))
}
else {
return nil
}
}
}
}
public extension Api.messages {
enum VotesList: TypeConstructorDescription {
public class Cons_votesList: TypeConstructorDescription {
@ -2242,3 +1988,262 @@ public extension Api.payments {
}
}
}
public extension Api.payments {
enum StarGiftUpgradeAttributes: TypeConstructorDescription {
public class Cons_starGiftUpgradeAttributes: TypeConstructorDescription {
public var attributes: [Api.StarGiftAttribute]
public init(attributes: [Api.StarGiftAttribute]) {
self.attributes = attributes
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("starGiftUpgradeAttributes", [("attributes", ConstructorParameterDescription(self.attributes))])
}
}
case starGiftUpgradeAttributes(Cons_starGiftUpgradeAttributes)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .starGiftUpgradeAttributes(let _data):
if boxed {
buffer.appendInt32(1187439471)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.attributes.count))
for item in _data.attributes {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .starGiftUpgradeAttributes(let _data):
return ("starGiftUpgradeAttributes", [("attributes", ConstructorParameterDescription(_data.attributes))])
}
}
public static func parse_starGiftUpgradeAttributes(_ reader: BufferReader) -> StarGiftUpgradeAttributes? {
var _1: [Api.StarGiftAttribute]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.StarGiftAttribute.self)
}
let _c1 = _1 != nil
if _c1 {
return Api.payments.StarGiftUpgradeAttributes.starGiftUpgradeAttributes(Cons_starGiftUpgradeAttributes(attributes: _1!))
}
else {
return nil
}
}
}
}
public extension Api.payments {
enum StarGiftUpgradePreview: TypeConstructorDescription {
public class Cons_starGiftUpgradePreview: TypeConstructorDescription {
public var sampleAttributes: [Api.StarGiftAttribute]
public var prices: [Api.StarGiftUpgradePrice]
public var nextPrices: [Api.StarGiftUpgradePrice]
public init(sampleAttributes: [Api.StarGiftAttribute], prices: [Api.StarGiftUpgradePrice], nextPrices: [Api.StarGiftUpgradePrice]) {
self.sampleAttributes = sampleAttributes
self.prices = prices
self.nextPrices = nextPrices
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("starGiftUpgradePreview", [("sampleAttributes", ConstructorParameterDescription(self.sampleAttributes)), ("prices", ConstructorParameterDescription(self.prices)), ("nextPrices", ConstructorParameterDescription(self.nextPrices))])
}
}
case starGiftUpgradePreview(Cons_starGiftUpgradePreview)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .starGiftUpgradePreview(let _data):
if boxed {
buffer.appendInt32(1038213101)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.sampleAttributes.count))
for item in _data.sampleAttributes {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.prices.count))
for item in _data.prices {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.nextPrices.count))
for item in _data.nextPrices {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .starGiftUpgradePreview(let _data):
return ("starGiftUpgradePreview", [("sampleAttributes", ConstructorParameterDescription(_data.sampleAttributes)), ("prices", ConstructorParameterDescription(_data.prices)), ("nextPrices", ConstructorParameterDescription(_data.nextPrices))])
}
}
public static func parse_starGiftUpgradePreview(_ reader: BufferReader) -> StarGiftUpgradePreview? {
var _1: [Api.StarGiftAttribute]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.StarGiftAttribute.self)
}
var _2: [Api.StarGiftUpgradePrice]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.StarGiftUpgradePrice.self)
}
var _3: [Api.StarGiftUpgradePrice]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.StarGiftUpgradePrice.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.payments.StarGiftUpgradePreview.starGiftUpgradePreview(Cons_starGiftUpgradePreview(sampleAttributes: _1!, prices: _2!, nextPrices: _3!))
}
else {
return nil
}
}
}
}
public extension Api.payments {
enum StarGiftWithdrawalUrl: TypeConstructorDescription {
public class Cons_starGiftWithdrawalUrl: TypeConstructorDescription {
public var url: String
public init(url: String) {
self.url = url
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("starGiftWithdrawalUrl", [("url", ConstructorParameterDescription(self.url))])
}
}
case starGiftWithdrawalUrl(Cons_starGiftWithdrawalUrl)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .starGiftWithdrawalUrl(let _data):
if boxed {
buffer.appendInt32(-2069218660)
}
serializeString(_data.url, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .starGiftWithdrawalUrl(let _data):
return ("starGiftWithdrawalUrl", [("url", ConstructorParameterDescription(_data.url))])
}
}
public static func parse_starGiftWithdrawalUrl(_ reader: BufferReader) -> StarGiftWithdrawalUrl? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
if _c1 {
return Api.payments.StarGiftWithdrawalUrl.starGiftWithdrawalUrl(Cons_starGiftWithdrawalUrl(url: _1!))
}
else {
return nil
}
}
}
}
public extension Api.payments {
enum StarGifts: TypeConstructorDescription {
public class Cons_starGifts: TypeConstructorDescription {
public var hash: Int32
public var gifts: [Api.StarGift]
public var chats: [Api.Chat]
public var users: [Api.User]
public init(hash: Int32, gifts: [Api.StarGift], chats: [Api.Chat], users: [Api.User]) {
self.hash = hash
self.gifts = gifts
self.chats = chats
self.users = users
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("starGifts", [("hash", ConstructorParameterDescription(self.hash)), ("gifts", ConstructorParameterDescription(self.gifts)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users))])
}
}
case starGifts(Cons_starGifts)
case starGiftsNotModified
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .starGifts(let _data):
if boxed {
buffer.appendInt32(785918357)
}
serializeInt32(_data.hash, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.gifts.count))
for item in _data.gifts {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.chats.count))
for item in _data.chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.users.count))
for item in _data.users {
item.serialize(buffer, true)
}
break
case .starGiftsNotModified:
if boxed {
buffer.appendInt32(-1551326360)
}
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .starGifts(let _data):
return ("starGifts", [("hash", ConstructorParameterDescription(_data.hash)), ("gifts", ConstructorParameterDescription(_data.gifts)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users))])
case .starGiftsNotModified:
return ("starGiftsNotModified", [])
}
}
public static func parse_starGifts(_ reader: BufferReader) -> StarGifts? {
var _1: Int32?
_1 = reader.readInt32()
var _2: [Api.StarGift]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.StarGift.self)
}
var _3: [Api.Chat]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _4: [Api.User]?
if let _ = reader.readInt32() {
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.payments.StarGifts.starGifts(Cons_starGifts(hash: _1!, gifts: _2!, chats: _3!, users: _4!))
}
else {
return nil
}
}
public static func parse_starGiftsNotModified(_ reader: BufferReader) -> StarGifts? {
return Api.payments.StarGifts.starGiftsNotModified
}
}
}

View file

@ -1,262 +1,3 @@
public extension Api.payments {
enum StarGiftUpgradeAttributes: TypeConstructorDescription {
public class Cons_starGiftUpgradeAttributes: TypeConstructorDescription {
public var attributes: [Api.StarGiftAttribute]
public init(attributes: [Api.StarGiftAttribute]) {
self.attributes = attributes
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("starGiftUpgradeAttributes", [("attributes", ConstructorParameterDescription(self.attributes))])
}
}
case starGiftUpgradeAttributes(Cons_starGiftUpgradeAttributes)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .starGiftUpgradeAttributes(let _data):
if boxed {
buffer.appendInt32(1187439471)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.attributes.count))
for item in _data.attributes {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .starGiftUpgradeAttributes(let _data):
return ("starGiftUpgradeAttributes", [("attributes", ConstructorParameterDescription(_data.attributes))])
}
}
public static func parse_starGiftUpgradeAttributes(_ reader: BufferReader) -> StarGiftUpgradeAttributes? {
var _1: [Api.StarGiftAttribute]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.StarGiftAttribute.self)
}
let _c1 = _1 != nil
if _c1 {
return Api.payments.StarGiftUpgradeAttributes.starGiftUpgradeAttributes(Cons_starGiftUpgradeAttributes(attributes: _1!))
}
else {
return nil
}
}
}
}
public extension Api.payments {
enum StarGiftUpgradePreview: TypeConstructorDescription {
public class Cons_starGiftUpgradePreview: TypeConstructorDescription {
public var sampleAttributes: [Api.StarGiftAttribute]
public var prices: [Api.StarGiftUpgradePrice]
public var nextPrices: [Api.StarGiftUpgradePrice]
public init(sampleAttributes: [Api.StarGiftAttribute], prices: [Api.StarGiftUpgradePrice], nextPrices: [Api.StarGiftUpgradePrice]) {
self.sampleAttributes = sampleAttributes
self.prices = prices
self.nextPrices = nextPrices
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("starGiftUpgradePreview", [("sampleAttributes", ConstructorParameterDescription(self.sampleAttributes)), ("prices", ConstructorParameterDescription(self.prices)), ("nextPrices", ConstructorParameterDescription(self.nextPrices))])
}
}
case starGiftUpgradePreview(Cons_starGiftUpgradePreview)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .starGiftUpgradePreview(let _data):
if boxed {
buffer.appendInt32(1038213101)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.sampleAttributes.count))
for item in _data.sampleAttributes {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.prices.count))
for item in _data.prices {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.nextPrices.count))
for item in _data.nextPrices {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .starGiftUpgradePreview(let _data):
return ("starGiftUpgradePreview", [("sampleAttributes", ConstructorParameterDescription(_data.sampleAttributes)), ("prices", ConstructorParameterDescription(_data.prices)), ("nextPrices", ConstructorParameterDescription(_data.nextPrices))])
}
}
public static func parse_starGiftUpgradePreview(_ reader: BufferReader) -> StarGiftUpgradePreview? {
var _1: [Api.StarGiftAttribute]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.StarGiftAttribute.self)
}
var _2: [Api.StarGiftUpgradePrice]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.StarGiftUpgradePrice.self)
}
var _3: [Api.StarGiftUpgradePrice]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.StarGiftUpgradePrice.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.payments.StarGiftUpgradePreview.starGiftUpgradePreview(Cons_starGiftUpgradePreview(sampleAttributes: _1!, prices: _2!, nextPrices: _3!))
}
else {
return nil
}
}
}
}
public extension Api.payments {
enum StarGiftWithdrawalUrl: TypeConstructorDescription {
public class Cons_starGiftWithdrawalUrl: TypeConstructorDescription {
public var url: String
public init(url: String) {
self.url = url
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("starGiftWithdrawalUrl", [("url", ConstructorParameterDescription(self.url))])
}
}
case starGiftWithdrawalUrl(Cons_starGiftWithdrawalUrl)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .starGiftWithdrawalUrl(let _data):
if boxed {
buffer.appendInt32(-2069218660)
}
serializeString(_data.url, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .starGiftWithdrawalUrl(let _data):
return ("starGiftWithdrawalUrl", [("url", ConstructorParameterDescription(_data.url))])
}
}
public static func parse_starGiftWithdrawalUrl(_ reader: BufferReader) -> StarGiftWithdrawalUrl? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
if _c1 {
return Api.payments.StarGiftWithdrawalUrl.starGiftWithdrawalUrl(Cons_starGiftWithdrawalUrl(url: _1!))
}
else {
return nil
}
}
}
}
public extension Api.payments {
enum StarGifts: TypeConstructorDescription {
public class Cons_starGifts: TypeConstructorDescription {
public var hash: Int32
public var gifts: [Api.StarGift]
public var chats: [Api.Chat]
public var users: [Api.User]
public init(hash: Int32, gifts: [Api.StarGift], chats: [Api.Chat], users: [Api.User]) {
self.hash = hash
self.gifts = gifts
self.chats = chats
self.users = users
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("starGifts", [("hash", ConstructorParameterDescription(self.hash)), ("gifts", ConstructorParameterDescription(self.gifts)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users))])
}
}
case starGifts(Cons_starGifts)
case starGiftsNotModified
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .starGifts(let _data):
if boxed {
buffer.appendInt32(785918357)
}
serializeInt32(_data.hash, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.gifts.count))
for item in _data.gifts {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.chats.count))
for item in _data.chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.users.count))
for item in _data.users {
item.serialize(buffer, true)
}
break
case .starGiftsNotModified:
if boxed {
buffer.appendInt32(-1551326360)
}
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .starGifts(let _data):
return ("starGifts", [("hash", ConstructorParameterDescription(_data.hash)), ("gifts", ConstructorParameterDescription(_data.gifts)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users))])
case .starGiftsNotModified:
return ("starGiftsNotModified", [])
}
}
public static func parse_starGifts(_ reader: BufferReader) -> StarGifts? {
var _1: Int32?
_1 = reader.readInt32()
var _2: [Api.StarGift]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.StarGift.self)
}
var _3: [Api.Chat]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _4: [Api.User]?
if let _ = reader.readInt32() {
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.payments.StarGifts.starGifts(Cons_starGifts(hash: _1!, gifts: _2!, chats: _3!, users: _4!))
}
else {
return nil
}
}
public static func parse_starGiftsNotModified(_ reader: BufferReader) -> StarGifts? {
return Api.payments.StarGifts.starGiftsNotModified
}
}
}
public extension Api.payments {
enum StarsRevenueAdsAccountUrl: TypeConstructorDescription {
public class Cons_starsRevenueAdsAccountUrl: TypeConstructorDescription {
@ -2530,3 +2271,368 @@ public extension Api.stats {
}
}
}
public extension Api.stats {
enum PollStats: TypeConstructorDescription {
public class Cons_pollStats: TypeConstructorDescription {
public var votesGraph: Api.StatsGraph
public init(votesGraph: Api.StatsGraph) {
self.votesGraph = votesGraph
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("pollStats", [("votesGraph", ConstructorParameterDescription(self.votesGraph))])
}
}
case pollStats(Cons_pollStats)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .pollStats(let _data):
if boxed {
buffer.appendInt32(697941741)
}
_data.votesGraph.serialize(buffer, true)
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .pollStats(let _data):
return ("pollStats", [("votesGraph", ConstructorParameterDescription(_data.votesGraph))])
}
}
public static func parse_pollStats(_ reader: BufferReader) -> PollStats? {
var _1: Api.StatsGraph?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.StatsGraph
}
let _c1 = _1 != nil
if _c1 {
return Api.stats.PollStats.pollStats(Cons_pollStats(votesGraph: _1!))
}
else {
return nil
}
}
}
}
public extension Api.stats {
enum PublicForwards: TypeConstructorDescription {
public class Cons_publicForwards: TypeConstructorDescription {
public var flags: Int32
public var count: Int32
public var forwards: [Api.PublicForward]
public var nextOffset: String?
public var chats: [Api.Chat]
public var users: [Api.User]
public init(flags: Int32, count: Int32, forwards: [Api.PublicForward], nextOffset: String?, chats: [Api.Chat], users: [Api.User]) {
self.flags = flags
self.count = count
self.forwards = forwards
self.nextOffset = nextOffset
self.chats = chats
self.users = users
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("publicForwards", [("flags", ConstructorParameterDescription(self.flags)), ("count", ConstructorParameterDescription(self.count)), ("forwards", ConstructorParameterDescription(self.forwards)), ("nextOffset", ConstructorParameterDescription(self.nextOffset)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users))])
}
}
case publicForwards(Cons_publicForwards)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .publicForwards(let _data):
if boxed {
buffer.appendInt32(-1828487648)
}
serializeInt32(_data.flags, buffer: buffer, boxed: false)
serializeInt32(_data.count, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.forwards.count))
for item in _data.forwards {
item.serialize(buffer, true)
}
if Int(_data.flags) & Int(1 << 0) != 0 {
serializeString(_data.nextOffset!, buffer: buffer, boxed: false)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.chats.count))
for item in _data.chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.users.count))
for item in _data.users {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .publicForwards(let _data):
return ("publicForwards", [("flags", ConstructorParameterDescription(_data.flags)), ("count", ConstructorParameterDescription(_data.count)), ("forwards", ConstructorParameterDescription(_data.forwards)), ("nextOffset", ConstructorParameterDescription(_data.nextOffset)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users))])
}
}
public static func parse_publicForwards(_ reader: BufferReader) -> PublicForwards? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int32?
_2 = reader.readInt32()
var _3: [Api.PublicForward]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.PublicForward.self)
}
var _4: String?
if Int(_1!) & Int(1 << 0) != 0 {
_4 = parseString(reader)
}
var _5: [Api.Chat]?
if let _ = reader.readInt32() {
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _6: [Api.User]?
if let _ = reader.readInt32() {
_6 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
return Api.stats.PublicForwards.publicForwards(Cons_publicForwards(flags: _1!, count: _2!, forwards: _3!, nextOffset: _4, chats: _5!, users: _6!))
}
else {
return nil
}
}
}
}
public extension Api.stats {
enum StoryStats: TypeConstructorDescription {
public class Cons_storyStats: TypeConstructorDescription {
public var viewsGraph: Api.StatsGraph
public var reactionsByEmotionGraph: Api.StatsGraph
public init(viewsGraph: Api.StatsGraph, reactionsByEmotionGraph: Api.StatsGraph) {
self.viewsGraph = viewsGraph
self.reactionsByEmotionGraph = reactionsByEmotionGraph
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("storyStats", [("viewsGraph", ConstructorParameterDescription(self.viewsGraph)), ("reactionsByEmotionGraph", ConstructorParameterDescription(self.reactionsByEmotionGraph))])
}
}
case storyStats(Cons_storyStats)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .storyStats(let _data):
if boxed {
buffer.appendInt32(1355613820)
}
_data.viewsGraph.serialize(buffer, true)
_data.reactionsByEmotionGraph.serialize(buffer, true)
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .storyStats(let _data):
return ("storyStats", [("viewsGraph", ConstructorParameterDescription(_data.viewsGraph)), ("reactionsByEmotionGraph", ConstructorParameterDescription(_data.reactionsByEmotionGraph))])
}
}
public static func parse_storyStats(_ reader: BufferReader) -> StoryStats? {
var _1: Api.StatsGraph?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.StatsGraph
}
var _2: Api.StatsGraph?
if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.StatsGraph
}
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.stats.StoryStats.storyStats(Cons_storyStats(viewsGraph: _1!, reactionsByEmotionGraph: _2!))
}
else {
return nil
}
}
}
}
public extension Api.stickers {
enum SuggestedShortName: TypeConstructorDescription {
public class Cons_suggestedShortName: TypeConstructorDescription {
public var shortName: String
public init(shortName: String) {
self.shortName = shortName
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("suggestedShortName", [("shortName", ConstructorParameterDescription(self.shortName))])
}
}
case suggestedShortName(Cons_suggestedShortName)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .suggestedShortName(let _data):
if boxed {
buffer.appendInt32(-2046910401)
}
serializeString(_data.shortName, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .suggestedShortName(let _data):
return ("suggestedShortName", [("shortName", ConstructorParameterDescription(_data.shortName))])
}
}
public static func parse_suggestedShortName(_ reader: BufferReader) -> SuggestedShortName? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
if _c1 {
return Api.stickers.SuggestedShortName.suggestedShortName(Cons_suggestedShortName(shortName: _1!))
}
else {
return nil
}
}
}
}
public extension Api.storage {
enum FileType: TypeConstructorDescription {
case fileGif
case fileJpeg
case fileMov
case fileMp3
case fileMp4
case filePartial
case filePdf
case filePng
case fileUnknown
case fileWebp
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .fileGif:
if boxed {
buffer.appendInt32(-891180321)
}
break
case .fileJpeg:
if boxed {
buffer.appendInt32(8322574)
}
break
case .fileMov:
if boxed {
buffer.appendInt32(1258941372)
}
break
case .fileMp3:
if boxed {
buffer.appendInt32(1384777335)
}
break
case .fileMp4:
if boxed {
buffer.appendInt32(-1278304028)
}
break
case .filePartial:
if boxed {
buffer.appendInt32(1086091090)
}
break
case .filePdf:
if boxed {
buffer.appendInt32(-1373745011)
}
break
case .filePng:
if boxed {
buffer.appendInt32(172975040)
}
break
case .fileUnknown:
if boxed {
buffer.appendInt32(-1432995067)
}
break
case .fileWebp:
if boxed {
buffer.appendInt32(276907596)
}
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .fileGif:
return ("fileGif", [])
case .fileJpeg:
return ("fileJpeg", [])
case .fileMov:
return ("fileMov", [])
case .fileMp3:
return ("fileMp3", [])
case .fileMp4:
return ("fileMp4", [])
case .filePartial:
return ("filePartial", [])
case .filePdf:
return ("filePdf", [])
case .filePng:
return ("filePng", [])
case .fileUnknown:
return ("fileUnknown", [])
case .fileWebp:
return ("fileWebp", [])
}
}
public static func parse_fileGif(_ reader: BufferReader) -> FileType? {
return Api.storage.FileType.fileGif
}
public static func parse_fileJpeg(_ reader: BufferReader) -> FileType? {
return Api.storage.FileType.fileJpeg
}
public static func parse_fileMov(_ reader: BufferReader) -> FileType? {
return Api.storage.FileType.fileMov
}
public static func parse_fileMp3(_ reader: BufferReader) -> FileType? {
return Api.storage.FileType.fileMp3
}
public static func parse_fileMp4(_ reader: BufferReader) -> FileType? {
return Api.storage.FileType.fileMp4
}
public static func parse_filePartial(_ reader: BufferReader) -> FileType? {
return Api.storage.FileType.filePartial
}
public static func parse_filePdf(_ reader: BufferReader) -> FileType? {
return Api.storage.FileType.filePdf
}
public static func parse_filePng(_ reader: BufferReader) -> FileType? {
return Api.storage.FileType.filePng
}
public static func parse_fileUnknown(_ reader: BufferReader) -> FileType? {
return Api.storage.FileType.fileUnknown
}
public static func parse_fileWebp(_ reader: BufferReader) -> FileType? {
return Api.storage.FileType.fileWebp
}
}
}

View file

@ -1,368 +1,3 @@
public extension Api.stats {
enum PollStats: TypeConstructorDescription {
public class Cons_pollStats: TypeConstructorDescription {
public var votesGraph: Api.StatsGraph
public init(votesGraph: Api.StatsGraph) {
self.votesGraph = votesGraph
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("pollStats", [("votesGraph", ConstructorParameterDescription(self.votesGraph))])
}
}
case pollStats(Cons_pollStats)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .pollStats(let _data):
if boxed {
buffer.appendInt32(697941741)
}
_data.votesGraph.serialize(buffer, true)
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .pollStats(let _data):
return ("pollStats", [("votesGraph", ConstructorParameterDescription(_data.votesGraph))])
}
}
public static func parse_pollStats(_ reader: BufferReader) -> PollStats? {
var _1: Api.StatsGraph?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.StatsGraph
}
let _c1 = _1 != nil
if _c1 {
return Api.stats.PollStats.pollStats(Cons_pollStats(votesGraph: _1!))
}
else {
return nil
}
}
}
}
public extension Api.stats {
enum PublicForwards: TypeConstructorDescription {
public class Cons_publicForwards: TypeConstructorDescription {
public var flags: Int32
public var count: Int32
public var forwards: [Api.PublicForward]
public var nextOffset: String?
public var chats: [Api.Chat]
public var users: [Api.User]
public init(flags: Int32, count: Int32, forwards: [Api.PublicForward], nextOffset: String?, chats: [Api.Chat], users: [Api.User]) {
self.flags = flags
self.count = count
self.forwards = forwards
self.nextOffset = nextOffset
self.chats = chats
self.users = users
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("publicForwards", [("flags", ConstructorParameterDescription(self.flags)), ("count", ConstructorParameterDescription(self.count)), ("forwards", ConstructorParameterDescription(self.forwards)), ("nextOffset", ConstructorParameterDescription(self.nextOffset)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users))])
}
}
case publicForwards(Cons_publicForwards)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .publicForwards(let _data):
if boxed {
buffer.appendInt32(-1828487648)
}
serializeInt32(_data.flags, buffer: buffer, boxed: false)
serializeInt32(_data.count, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.forwards.count))
for item in _data.forwards {
item.serialize(buffer, true)
}
if Int(_data.flags) & Int(1 << 0) != 0 {
serializeString(_data.nextOffset!, buffer: buffer, boxed: false)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.chats.count))
for item in _data.chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.users.count))
for item in _data.users {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .publicForwards(let _data):
return ("publicForwards", [("flags", ConstructorParameterDescription(_data.flags)), ("count", ConstructorParameterDescription(_data.count)), ("forwards", ConstructorParameterDescription(_data.forwards)), ("nextOffset", ConstructorParameterDescription(_data.nextOffset)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users))])
}
}
public static func parse_publicForwards(_ reader: BufferReader) -> PublicForwards? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int32?
_2 = reader.readInt32()
var _3: [Api.PublicForward]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.PublicForward.self)
}
var _4: String?
if Int(_1!) & Int(1 << 0) != 0 {
_4 = parseString(reader)
}
var _5: [Api.Chat]?
if let _ = reader.readInt32() {
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _6: [Api.User]?
if let _ = reader.readInt32() {
_6 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
return Api.stats.PublicForwards.publicForwards(Cons_publicForwards(flags: _1!, count: _2!, forwards: _3!, nextOffset: _4, chats: _5!, users: _6!))
}
else {
return nil
}
}
}
}
public extension Api.stats {
enum StoryStats: TypeConstructorDescription {
public class Cons_storyStats: TypeConstructorDescription {
public var viewsGraph: Api.StatsGraph
public var reactionsByEmotionGraph: Api.StatsGraph
public init(viewsGraph: Api.StatsGraph, reactionsByEmotionGraph: Api.StatsGraph) {
self.viewsGraph = viewsGraph
self.reactionsByEmotionGraph = reactionsByEmotionGraph
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("storyStats", [("viewsGraph", ConstructorParameterDescription(self.viewsGraph)), ("reactionsByEmotionGraph", ConstructorParameterDescription(self.reactionsByEmotionGraph))])
}
}
case storyStats(Cons_storyStats)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .storyStats(let _data):
if boxed {
buffer.appendInt32(1355613820)
}
_data.viewsGraph.serialize(buffer, true)
_data.reactionsByEmotionGraph.serialize(buffer, true)
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .storyStats(let _data):
return ("storyStats", [("viewsGraph", ConstructorParameterDescription(_data.viewsGraph)), ("reactionsByEmotionGraph", ConstructorParameterDescription(_data.reactionsByEmotionGraph))])
}
}
public static func parse_storyStats(_ reader: BufferReader) -> StoryStats? {
var _1: Api.StatsGraph?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.StatsGraph
}
var _2: Api.StatsGraph?
if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.StatsGraph
}
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.stats.StoryStats.storyStats(Cons_storyStats(viewsGraph: _1!, reactionsByEmotionGraph: _2!))
}
else {
return nil
}
}
}
}
public extension Api.stickers {
enum SuggestedShortName: TypeConstructorDescription {
public class Cons_suggestedShortName: TypeConstructorDescription {
public var shortName: String
public init(shortName: String) {
self.shortName = shortName
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("suggestedShortName", [("shortName", ConstructorParameterDescription(self.shortName))])
}
}
case suggestedShortName(Cons_suggestedShortName)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .suggestedShortName(let _data):
if boxed {
buffer.appendInt32(-2046910401)
}
serializeString(_data.shortName, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .suggestedShortName(let _data):
return ("suggestedShortName", [("shortName", ConstructorParameterDescription(_data.shortName))])
}
}
public static func parse_suggestedShortName(_ reader: BufferReader) -> SuggestedShortName? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
if _c1 {
return Api.stickers.SuggestedShortName.suggestedShortName(Cons_suggestedShortName(shortName: _1!))
}
else {
return nil
}
}
}
}
public extension Api.storage {
enum FileType: TypeConstructorDescription {
case fileGif
case fileJpeg
case fileMov
case fileMp3
case fileMp4
case filePartial
case filePdf
case filePng
case fileUnknown
case fileWebp
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .fileGif:
if boxed {
buffer.appendInt32(-891180321)
}
break
case .fileJpeg:
if boxed {
buffer.appendInt32(8322574)
}
break
case .fileMov:
if boxed {
buffer.appendInt32(1258941372)
}
break
case .fileMp3:
if boxed {
buffer.appendInt32(1384777335)
}
break
case .fileMp4:
if boxed {
buffer.appendInt32(-1278304028)
}
break
case .filePartial:
if boxed {
buffer.appendInt32(1086091090)
}
break
case .filePdf:
if boxed {
buffer.appendInt32(-1373745011)
}
break
case .filePng:
if boxed {
buffer.appendInt32(172975040)
}
break
case .fileUnknown:
if boxed {
buffer.appendInt32(-1432995067)
}
break
case .fileWebp:
if boxed {
buffer.appendInt32(276907596)
}
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .fileGif:
return ("fileGif", [])
case .fileJpeg:
return ("fileJpeg", [])
case .fileMov:
return ("fileMov", [])
case .fileMp3:
return ("fileMp3", [])
case .fileMp4:
return ("fileMp4", [])
case .filePartial:
return ("filePartial", [])
case .filePdf:
return ("filePdf", [])
case .filePng:
return ("filePng", [])
case .fileUnknown:
return ("fileUnknown", [])
case .fileWebp:
return ("fileWebp", [])
}
}
public static func parse_fileGif(_ reader: BufferReader) -> FileType? {
return Api.storage.FileType.fileGif
}
public static func parse_fileJpeg(_ reader: BufferReader) -> FileType? {
return Api.storage.FileType.fileJpeg
}
public static func parse_fileMov(_ reader: BufferReader) -> FileType? {
return Api.storage.FileType.fileMov
}
public static func parse_fileMp3(_ reader: BufferReader) -> FileType? {
return Api.storage.FileType.fileMp3
}
public static func parse_fileMp4(_ reader: BufferReader) -> FileType? {
return Api.storage.FileType.fileMp4
}
public static func parse_filePartial(_ reader: BufferReader) -> FileType? {
return Api.storage.FileType.filePartial
}
public static func parse_filePdf(_ reader: BufferReader) -> FileType? {
return Api.storage.FileType.filePdf
}
public static func parse_filePng(_ reader: BufferReader) -> FileType? {
return Api.storage.FileType.filePng
}
public static func parse_fileUnknown(_ reader: BufferReader) -> FileType? {
return Api.storage.FileType.fileUnknown
}
public static func parse_fileWebp(_ reader: BufferReader) -> FileType? {
return Api.storage.FileType.fileWebp
}
}
}
public extension Api.stories {
enum Albums: TypeConstructorDescription {
public class Cons_albums: TypeConstructorDescription {
@ -1654,3 +1289,577 @@ public extension Api.updates {
}
}
}
public extension Api.updates {
enum State: TypeConstructorDescription {
public class Cons_state: TypeConstructorDescription {
public var pts: Int32
public var qts: Int32
public var date: Int32
public var seq: Int32
public var unreadCount: Int32
public init(pts: Int32, qts: Int32, date: Int32, seq: Int32, unreadCount: Int32) {
self.pts = pts
self.qts = qts
self.date = date
self.seq = seq
self.unreadCount = unreadCount
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("state", [("pts", ConstructorParameterDescription(self.pts)), ("qts", ConstructorParameterDescription(self.qts)), ("date", ConstructorParameterDescription(self.date)), ("seq", ConstructorParameterDescription(self.seq)), ("unreadCount", ConstructorParameterDescription(self.unreadCount))])
}
}
case state(Cons_state)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .state(let _data):
if boxed {
buffer.appendInt32(-1519637954)
}
serializeInt32(_data.pts, buffer: buffer, boxed: false)
serializeInt32(_data.qts, buffer: buffer, boxed: false)
serializeInt32(_data.date, buffer: buffer, boxed: false)
serializeInt32(_data.seq, buffer: buffer, boxed: false)
serializeInt32(_data.unreadCount, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .state(let _data):
return ("state", [("pts", ConstructorParameterDescription(_data.pts)), ("qts", ConstructorParameterDescription(_data.qts)), ("date", ConstructorParameterDescription(_data.date)), ("seq", ConstructorParameterDescription(_data.seq)), ("unreadCount", ConstructorParameterDescription(_data.unreadCount))])
}
}
public static func parse_state(_ reader: BufferReader) -> State? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int32?
_2 = reader.readInt32()
var _3: Int32?
_3 = reader.readInt32()
var _4: Int32?
_4 = reader.readInt32()
var _5: Int32?
_5 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 {
return Api.updates.State.state(Cons_state(pts: _1!, qts: _2!, date: _3!, seq: _4!, unreadCount: _5!))
}
else {
return nil
}
}
}
}
public extension Api.upload {
enum CdnFile: TypeConstructorDescription {
public class Cons_cdnFile: TypeConstructorDescription {
public var bytes: Buffer
public init(bytes: Buffer) {
self.bytes = bytes
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("cdnFile", [("bytes", ConstructorParameterDescription(self.bytes))])
}
}
public class Cons_cdnFileReuploadNeeded: TypeConstructorDescription {
public var requestToken: Buffer
public init(requestToken: Buffer) {
self.requestToken = requestToken
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("cdnFileReuploadNeeded", [("requestToken", ConstructorParameterDescription(self.requestToken))])
}
}
case cdnFile(Cons_cdnFile)
case cdnFileReuploadNeeded(Cons_cdnFileReuploadNeeded)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .cdnFile(let _data):
if boxed {
buffer.appendInt32(-1449145777)
}
serializeBytes(_data.bytes, buffer: buffer, boxed: false)
break
case .cdnFileReuploadNeeded(let _data):
if boxed {
buffer.appendInt32(-290921362)
}
serializeBytes(_data.requestToken, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .cdnFile(let _data):
return ("cdnFile", [("bytes", ConstructorParameterDescription(_data.bytes))])
case .cdnFileReuploadNeeded(let _data):
return ("cdnFileReuploadNeeded", [("requestToken", ConstructorParameterDescription(_data.requestToken))])
}
}
public static func parse_cdnFile(_ reader: BufferReader) -> CdnFile? {
var _1: Buffer?
_1 = parseBytes(reader)
let _c1 = _1 != nil
if _c1 {
return Api.upload.CdnFile.cdnFile(Cons_cdnFile(bytes: _1!))
}
else {
return nil
}
}
public static func parse_cdnFileReuploadNeeded(_ reader: BufferReader) -> CdnFile? {
var _1: Buffer?
_1 = parseBytes(reader)
let _c1 = _1 != nil
if _c1 {
return Api.upload.CdnFile.cdnFileReuploadNeeded(Cons_cdnFileReuploadNeeded(requestToken: _1!))
}
else {
return nil
}
}
}
}
public extension Api.upload {
enum File: TypeConstructorDescription {
public class Cons_file: TypeConstructorDescription {
public var type: Api.storage.FileType
public var mtime: Int32
public var bytes: Buffer
public init(type: Api.storage.FileType, mtime: Int32, bytes: Buffer) {
self.type = type
self.mtime = mtime
self.bytes = bytes
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("file", [("type", ConstructorParameterDescription(self.type)), ("mtime", ConstructorParameterDescription(self.mtime)), ("bytes", ConstructorParameterDescription(self.bytes))])
}
}
public class Cons_fileCdnRedirect: TypeConstructorDescription {
public var dcId: Int32
public var fileToken: Buffer
public var encryptionKey: Buffer
public var encryptionIv: Buffer
public var fileHashes: [Api.FileHash]
public init(dcId: Int32, fileToken: Buffer, encryptionKey: Buffer, encryptionIv: Buffer, fileHashes: [Api.FileHash]) {
self.dcId = dcId
self.fileToken = fileToken
self.encryptionKey = encryptionKey
self.encryptionIv = encryptionIv
self.fileHashes = fileHashes
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("fileCdnRedirect", [("dcId", ConstructorParameterDescription(self.dcId)), ("fileToken", ConstructorParameterDescription(self.fileToken)), ("encryptionKey", ConstructorParameterDescription(self.encryptionKey)), ("encryptionIv", ConstructorParameterDescription(self.encryptionIv)), ("fileHashes", ConstructorParameterDescription(self.fileHashes))])
}
}
case file(Cons_file)
case fileCdnRedirect(Cons_fileCdnRedirect)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .file(let _data):
if boxed {
buffer.appendInt32(157948117)
}
_data.type.serialize(buffer, true)
serializeInt32(_data.mtime, buffer: buffer, boxed: false)
serializeBytes(_data.bytes, buffer: buffer, boxed: false)
break
case .fileCdnRedirect(let _data):
if boxed {
buffer.appendInt32(-242427324)
}
serializeInt32(_data.dcId, buffer: buffer, boxed: false)
serializeBytes(_data.fileToken, buffer: buffer, boxed: false)
serializeBytes(_data.encryptionKey, buffer: buffer, boxed: false)
serializeBytes(_data.encryptionIv, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.fileHashes.count))
for item in _data.fileHashes {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .file(let _data):
return ("file", [("type", ConstructorParameterDescription(_data.type)), ("mtime", ConstructorParameterDescription(_data.mtime)), ("bytes", ConstructorParameterDescription(_data.bytes))])
case .fileCdnRedirect(let _data):
return ("fileCdnRedirect", [("dcId", ConstructorParameterDescription(_data.dcId)), ("fileToken", ConstructorParameterDescription(_data.fileToken)), ("encryptionKey", ConstructorParameterDescription(_data.encryptionKey)), ("encryptionIv", ConstructorParameterDescription(_data.encryptionIv)), ("fileHashes", ConstructorParameterDescription(_data.fileHashes))])
}
}
public static func parse_file(_ reader: BufferReader) -> File? {
var _1: Api.storage.FileType?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.storage.FileType
}
var _2: Int32?
_2 = reader.readInt32()
var _3: Buffer?
_3 = parseBytes(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.upload.File.file(Cons_file(type: _1!, mtime: _2!, bytes: _3!))
}
else {
return nil
}
}
public static func parse_fileCdnRedirect(_ reader: BufferReader) -> File? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Buffer?
_2 = parseBytes(reader)
var _3: Buffer?
_3 = parseBytes(reader)
var _4: Buffer?
_4 = parseBytes(reader)
var _5: [Api.FileHash]?
if let _ = reader.readInt32() {
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.FileHash.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 {
return Api.upload.File.fileCdnRedirect(Cons_fileCdnRedirect(dcId: _1!, fileToken: _2!, encryptionKey: _3!, encryptionIv: _4!, fileHashes: _5!))
}
else {
return nil
}
}
}
}
public extension Api.upload {
enum WebFile: TypeConstructorDescription {
public class Cons_webFile: TypeConstructorDescription {
public var size: Int32
public var mimeType: String
public var fileType: Api.storage.FileType
public var mtime: Int32
public var bytes: Buffer
public init(size: Int32, mimeType: String, fileType: Api.storage.FileType, mtime: Int32, bytes: Buffer) {
self.size = size
self.mimeType = mimeType
self.fileType = fileType
self.mtime = mtime
self.bytes = bytes
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("webFile", [("size", ConstructorParameterDescription(self.size)), ("mimeType", ConstructorParameterDescription(self.mimeType)), ("fileType", ConstructorParameterDescription(self.fileType)), ("mtime", ConstructorParameterDescription(self.mtime)), ("bytes", ConstructorParameterDescription(self.bytes))])
}
}
case webFile(Cons_webFile)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .webFile(let _data):
if boxed {
buffer.appendInt32(568808380)
}
serializeInt32(_data.size, buffer: buffer, boxed: false)
serializeString(_data.mimeType, buffer: buffer, boxed: false)
_data.fileType.serialize(buffer, true)
serializeInt32(_data.mtime, buffer: buffer, boxed: false)
serializeBytes(_data.bytes, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .webFile(let _data):
return ("webFile", [("size", ConstructorParameterDescription(_data.size)), ("mimeType", ConstructorParameterDescription(_data.mimeType)), ("fileType", ConstructorParameterDescription(_data.fileType)), ("mtime", ConstructorParameterDescription(_data.mtime)), ("bytes", ConstructorParameterDescription(_data.bytes))])
}
}
public static func parse_webFile(_ reader: BufferReader) -> WebFile? {
var _1: Int32?
_1 = reader.readInt32()
var _2: String?
_2 = parseString(reader)
var _3: Api.storage.FileType?
if let signature = reader.readInt32() {
_3 = Api.parse(reader, signature: signature) as? Api.storage.FileType
}
var _4: Int32?
_4 = reader.readInt32()
var _5: Buffer?
_5 = parseBytes(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 {
return Api.upload.WebFile.webFile(Cons_webFile(size: _1!, mimeType: _2!, fileType: _3!, mtime: _4!, bytes: _5!))
}
else {
return nil
}
}
}
}
public extension Api.users {
enum SavedMusic: TypeConstructorDescription {
public class Cons_savedMusic: TypeConstructorDescription {
public var count: Int32
public var documents: [Api.Document]
public init(count: Int32, documents: [Api.Document]) {
self.count = count
self.documents = documents
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("savedMusic", [("count", ConstructorParameterDescription(self.count)), ("documents", ConstructorParameterDescription(self.documents))])
}
}
public class Cons_savedMusicNotModified: TypeConstructorDescription {
public var count: Int32
public init(count: Int32) {
self.count = count
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("savedMusicNotModified", [("count", ConstructorParameterDescription(self.count))])
}
}
case savedMusic(Cons_savedMusic)
case savedMusicNotModified(Cons_savedMusicNotModified)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .savedMusic(let _data):
if boxed {
buffer.appendInt32(883094167)
}
serializeInt32(_data.count, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.documents.count))
for item in _data.documents {
item.serialize(buffer, true)
}
break
case .savedMusicNotModified(let _data):
if boxed {
buffer.appendInt32(-477656412)
}
serializeInt32(_data.count, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .savedMusic(let _data):
return ("savedMusic", [("count", ConstructorParameterDescription(_data.count)), ("documents", ConstructorParameterDescription(_data.documents))])
case .savedMusicNotModified(let _data):
return ("savedMusicNotModified", [("count", ConstructorParameterDescription(_data.count))])
}
}
public static func parse_savedMusic(_ reader: BufferReader) -> SavedMusic? {
var _1: Int32?
_1 = reader.readInt32()
var _2: [Api.Document]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Document.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.users.SavedMusic.savedMusic(Cons_savedMusic(count: _1!, documents: _2!))
}
else {
return nil
}
}
public static func parse_savedMusicNotModified(_ reader: BufferReader) -> SavedMusic? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
if _c1 {
return Api.users.SavedMusic.savedMusicNotModified(Cons_savedMusicNotModified(count: _1!))
}
else {
return nil
}
}
}
}
public extension Api.users {
enum UserFull: TypeConstructorDescription {
public class Cons_userFull: TypeConstructorDescription {
public var fullUser: Api.UserFull
public var chats: [Api.Chat]
public var users: [Api.User]
public init(fullUser: Api.UserFull, chats: [Api.Chat], users: [Api.User]) {
self.fullUser = fullUser
self.chats = chats
self.users = users
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("userFull", [("fullUser", ConstructorParameterDescription(self.fullUser)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users))])
}
}
case userFull(Cons_userFull)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .userFull(let _data):
if boxed {
buffer.appendInt32(997004590)
}
_data.fullUser.serialize(buffer, true)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.chats.count))
for item in _data.chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.users.count))
for item in _data.users {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .userFull(let _data):
return ("userFull", [("fullUser", ConstructorParameterDescription(_data.fullUser)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users))])
}
}
public static func parse_userFull(_ reader: BufferReader) -> UserFull? {
var _1: Api.UserFull?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.UserFull
}
var _2: [Api.Chat]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _3: [Api.User]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.users.UserFull.userFull(Cons_userFull(fullUser: _1!, chats: _2!, users: _3!))
}
else {
return nil
}
}
}
}
public extension Api.users {
enum Users: TypeConstructorDescription {
public class Cons_users: TypeConstructorDescription {
public var users: [Api.User]
public init(users: [Api.User]) {
self.users = users
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("users", [("users", ConstructorParameterDescription(self.users))])
}
}
public class Cons_usersSlice: TypeConstructorDescription {
public var count: Int32
public var users: [Api.User]
public init(count: Int32, users: [Api.User]) {
self.count = count
self.users = users
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("usersSlice", [("count", ConstructorParameterDescription(self.count)), ("users", ConstructorParameterDescription(self.users))])
}
}
case users(Cons_users)
case usersSlice(Cons_usersSlice)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .users(let _data):
if boxed {
buffer.appendInt32(1658259128)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.users.count))
for item in _data.users {
item.serialize(buffer, true)
}
break
case .usersSlice(let _data):
if boxed {
buffer.appendInt32(828000628)
}
serializeInt32(_data.count, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.users.count))
for item in _data.users {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .users(let _data):
return ("users", [("users", ConstructorParameterDescription(_data.users))])
case .usersSlice(let _data):
return ("usersSlice", [("count", ConstructorParameterDescription(_data.count)), ("users", ConstructorParameterDescription(_data.users))])
}
}
public static func parse_users(_ reader: BufferReader) -> Users? {
var _1: [Api.User]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
if _c1 {
return Api.users.Users.users(Cons_users(users: _1!))
}
else {
return nil
}
}
public static func parse_usersSlice(_ reader: BufferReader) -> Users? {
var _1: Int32?
_1 = reader.readInt32()
var _2: [Api.User]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.users.Users.usersSlice(Cons_usersSlice(count: _1!, users: _2!))
}
else {
return nil
}
}
}
}

View file

@ -754,56 +754,6 @@ public extension Api {
}
}
}
public extension Api {
enum ChannelTopic: TypeConstructorDescription {
public class Cons_channelTopic: TypeConstructorDescription {
public var id: Int32
public var title: String
public init(id: Int32, title: String) {
self.id = id
self.title = title
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("channelTopic", [("id", ConstructorParameterDescription(self.id)), ("title", ConstructorParameterDescription(self.title))])
}
}
case channelTopic(Cons_channelTopic)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .channelTopic(let _data):
if boxed {
buffer.appendInt32(-1817845901)
}
serializeInt32(_data.id, buffer: buffer, boxed: false)
serializeString(_data.title, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .channelTopic(let _data):
return ("channelTopic", [("id", ConstructorParameterDescription(_data.id)), ("title", ConstructorParameterDescription(_data.title))])
}
}
public static func parse_channelTopic(_ reader: BufferReader) -> ChannelTopic? {
var _1: Int32?
_1 = reader.readInt32()
var _2: String?
_2 = parseString(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.ChannelTopic.channelTopic(Cons_channelTopic(id: _1!, title: _2!))
}
else {
return nil
}
}
}
}
public extension Api {
indirect enum Chat: TypeConstructorDescription {
public class Cons_channel: TypeConstructorDescription {

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -3,8 +3,8 @@ import SwiftSignalKit
import Postbox
import TelegramApi
public extension EngineMessageHistoryThread {
final class Info: Equatable, Codable {
public final class EngineMessageHistoryThread {
public final class Info: Equatable, Codable {
private enum CodingKeys: String, CodingKey {
case title
case icon

View file

@ -2,6 +2,7 @@ import Foundation
import SwiftSignalKit
import Postbox
import TelegramApi
import RangeSet
public enum MediaResourceUserContentType: UInt8, Equatable {
case other = 0
@ -452,5 +453,45 @@ public extension TelegramEngine {
)
|> map { EngineMediaResource.ResourceData($0) }
}
public func shortLivedResourceCachePathPrefix(id: EngineMediaResource.Id) -> String {
return self.account.postbox.mediaBox.shortLivedResourceCachePathPrefix(MediaResourceId(id.stringRepresentation))
}
public func completedResourcePath(id: EngineMediaResource.Id, pathExtension: String? = nil) -> String? {
return self.account.postbox.mediaBox.completedResourcePath(id: MediaResourceId(id.stringRepresentation), pathExtension: pathExtension)
}
public func storeResourceData(id: EngineMediaResource.Id, data: Data, synchronous: Bool = false) {
self.account.postbox.mediaBox.storeResourceData(MediaResourceId(id.stringRepresentation), data: data, synchronous: synchronous)
}
public func cancelInteractiveResourceFetch(id: EngineMediaResource.Id) {
self.account.postbox.mediaBox.cancelInteractiveResourceFetch(resourceId: MediaResourceId(id.stringRepresentation))
}
public func moveResourceData(id: EngineMediaResource.Id, toTempPath: String) {
self.account.postbox.mediaBox.moveResourceData(MediaResourceId(id.stringRepresentation), toTempPath: toTempPath)
}
public func moveResourceData(from: EngineMediaResource.Id, to: EngineMediaResource.Id, synchronous: Bool = false) {
self.account.postbox.mediaBox.moveResourceData(from: MediaResourceId(from.stringRepresentation), to: MediaResourceId(to.stringRepresentation), synchronous: synchronous)
}
public func copyResourceData(id: EngineMediaResource.Id, fromTempPath: String) {
self.account.postbox.mediaBox.copyResourceData(MediaResourceId(id.stringRepresentation), fromTempPath: fromTempPath)
}
public func copyResourceData(from: EngineMediaResource.Id, to: EngineMediaResource.Id, synchronous: Bool = false) {
self.account.postbox.mediaBox.copyResourceData(from: MediaResourceId(from.stringRepresentation), to: MediaResourceId(to.stringRepresentation), synchronous: synchronous)
}
public func resourceRangesStatus(resource: EngineMediaResource) -> Signal<RangeSet<Int64>, NoError> {
return self.account.postbox.mediaBox.resourceRangesStatus(resource._asResource())
}
public func removeCachedResources(ids: [EngineMediaResource.Id], force: Bool = false, notify: Bool = false) -> Signal<Float, NoError> {
return self.account.postbox.mediaBox.removeCachedResources(ids.map { MediaResourceId($0.stringRepresentation) }, force: force, notify: notify)
}
}
}

View file

@ -4,3 +4,6 @@ public typealias EngineMemoryBuffer = MemoryBuffer
public typealias EnginePostboxDecoder = PostboxDecoder
public typealias EnginePostboxEncoder = PostboxEncoder
public typealias EngineAdaptedPostboxDecoder = AdaptedPostboxDecoder
public typealias EngineItemCollectionId = ItemCollectionId
public typealias EngineFetchResourceSourceType = FetchResourceSourceType
public typealias EngineFetchResourceError = FetchResourceError

View file

@ -12,7 +12,6 @@ swift_library(
deps = [
"//submodules/AsyncDisplayKit",
"//submodules/Display",
"//submodules/Postbox",
"//submodules/TelegramCore",
"//submodules/SSignalKit/SwiftSignalKit",
"//submodules/ComponentFlow",

Some files were not shown because too many files have changed in this diff Show more