Update Ghostgram features

This commit is contained in:
ichmagmaus 812
2026-03-07 18:15:32 +01:00
parent 1a3303b059
commit 24a7ec39d9
902 changed files with 148302 additions and 62355 deletions
@@ -53,7 +53,8 @@ func managedRecentStickers(postbox: Postbox, network: Network, forceFetch: Bool
switch result {
case .recentStickersNotModified:
return .single(nil)
case let .recentStickers(_, _, stickers, _):
case let .recentStickers(recentStickersData):
let stickers = recentStickersData.stickers
var items: [OrderedItemListEntry] = []
for sticker in stickers {
if let file = telegramMediaFileFromApiDocument(sticker, altDocuments: []), let id = file.id {
@@ -79,7 +80,8 @@ func managedRecentGifs(postbox: Postbox, network: Network, forceFetch: Bool = fa
switch result {
case .savedGifsNotModified:
return .single(nil)
case let .savedGifs(_, gifs):
case let .savedGifs(savedGifsData):
let gifs = savedGifsData.gifs
var items: [OrderedItemListEntry] = []
for gif in gifs {
if let file = telegramMediaFileFromApiDocument(gif, altDocuments: []), let id = file.id {
@@ -105,11 +107,13 @@ func managedSavedStickers(postbox: Postbox, network: Network, forceFetch: Bool =
switch result {
case .favedStickersNotModified:
return .single(nil)
case let .favedStickers(_, packs, stickers):
case let .favedStickers(favedStickersData):
let (packs, stickers) = (favedStickersData.packs, favedStickersData.stickers)
var fileStringRepresentations: [MediaId: [String]] = [:]
for pack in packs {
switch pack {
case let .stickerPack(text, fileIds):
case let .stickerPack(stickerPackData):
let (text, fileIds) = (stickerPackData.emoticon, stickerPackData.documents)
for fileId in fileIds {
let mediaId = MediaId(namespace: Namespaces.Media.CloudFile, id: fileId)
if fileStringRepresentations[mediaId] == nil {
@@ -150,7 +154,8 @@ func managedGreetingStickers(postbox: Postbox, network: Network) -> Signal<Void,
switch result {
case .stickersNotModified:
return .single(nil)
case let .stickers(_, stickers):
case let .stickers(stickersData):
let stickers = stickersData.stickers
var items: [OrderedItemListEntry] = []
for sticker in stickers {
if let file = telegramMediaFileFromApiDocument(sticker, altDocuments: []), let id = file.id {
@@ -177,7 +182,8 @@ func managedPremiumStickers(postbox: Postbox, network: Network) -> Signal<Void,
switch result {
case .stickersNotModified:
return .single(nil)
case let .stickers(_, stickers):
case let .stickers(stickersData):
let stickers = stickersData.stickers
var items: [OrderedItemListEntry] = []
for sticker in stickers {
if let file = telegramMediaFileFromApiDocument(sticker, altDocuments: []), let id = file.id {
@@ -204,7 +210,8 @@ func managedAllPremiumStickers(postbox: Postbox, network: Network) -> Signal<Voi
switch result {
case .stickersNotModified:
return .single(nil)
case let .stickers(_, stickers):
case let .stickers(stickersData):
let stickers = stickersData.stickers
var items: [OrderedItemListEntry] = []
for sticker in stickers {
if let file = telegramMediaFileFromApiDocument(sticker, altDocuments: []), let id = file.id {
@@ -231,9 +238,10 @@ func managedRecentStatusEmoji(postbox: Postbox, network: Network) -> Signal<Void
switch result {
case .emojiStatusesNotModified:
return .single(nil)
case let .emojiStatuses(_, statuses):
case let .emojiStatuses(emojiStatusesData):
let statuses = emojiStatusesData.statuses
let parsedStatuses = statuses.compactMap(PeerEmojiStatus.init(apiStatus:))
return _internal_resolveInlineStickers(postbox: postbox, network: network, fileIds: parsedStatuses.compactMap(\.emojiFileId))
|> map { files -> [OrderedItemListEntry] in
var items: [OrderedItemListEntry] = []
@@ -264,9 +272,10 @@ func managedFeaturedStatusEmoji(postbox: Postbox, network: Network) -> Signal<Vo
switch result {
case .emojiStatusesNotModified:
return .single(nil)
case let .emojiStatuses(_, statuses):
case let .emojiStatuses(emojiStatusesData):
let statuses = emojiStatusesData.statuses
let parsedStatuses = statuses.compactMap(PeerEmojiStatus.init(apiStatus:))
return _internal_resolveInlineStickers(postbox: postbox, network: network, fileIds: parsedStatuses.compactMap(\.emojiFileId))
|> map { files -> [OrderedItemListEntry] in
var items: [OrderedItemListEntry] = []
@@ -297,9 +306,10 @@ func managedFeaturedChannelStatusEmoji(postbox: Postbox, network: Network) -> Si
switch result {
case .emojiStatusesNotModified:
return .single(nil)
case let .emojiStatuses(_, statuses):
case let .emojiStatuses(emojiStatusesData):
let statuses = emojiStatusesData.statuses
let parsedStatuses = statuses.compactMap(PeerEmojiStatus.init(apiStatus:))
return _internal_resolveInlineStickers(postbox: postbox, network: network, fileIds: parsedStatuses.compactMap(\.emojiFileId))
|> map { files -> [OrderedItemListEntry] in
var items: [OrderedItemListEntry] = []
@@ -330,9 +340,10 @@ func managedUniqueStarGifts(accountPeerId: PeerId, postbox: Postbox, network: Ne
switch result {
case .emojiStatusesNotModified:
return .single(nil)
case let .emojiStatuses(_, statuses):
case let .emojiStatuses(emojiStatusesData):
let statuses = emojiStatusesData.statuses
let parsedStatuses = statuses.compactMap(PeerEmojiStatus.init(apiStatus:))
return _internal_resolveInlineStickers(postbox: postbox, network: network, fileIds: parsedStatuses.flatMap(\.associatedFileIds))
|> map { files -> [OrderedItemListEntry] in
var items: [OrderedItemListEntry] = []
@@ -349,9 +360,9 @@ func managedUniqueStarGifts(accountPeerId: PeerId, postbox: Postbox, network: Ne
slug: slug,
owner: .peerId(accountPeerId),
attributes: [
.model(name: "", file: file, rarity: 0),
.pattern(name: "", file: patternFile, rarity: 0),
.backdrop(name: "", id: 0, innerColor: innerColor, outerColor: outerColor, patternColor: patternColor, textColor: textColor, rarity: 0)
.model(name: "", file: file, rarity: .rare, crafted: true),
.pattern(name: "", file: patternFile, rarity: .rare),
.backdrop(name: "", id: 0, innerColor: innerColor, outerColor: outerColor, patternColor: patternColor, textColor: textColor, rarity: .rare)
],
availability: StarGift.UniqueGift.Availability(issued: 0, total: 0),
giftAddress: nil,
@@ -365,7 +376,8 @@ func managedUniqueStarGifts(accountPeerId: PeerId, postbox: Postbox, network: Ne
themePeerId: nil,
peerColor: nil,
hostPeerId: nil,
minOfferStars: nil
minOfferStars: nil,
craftChancePermille: nil
)
if let entry = CodableEntry(RecentStarGiftItem(gift)) {
items.append(OrderedItemListEntry(id: RecentStarGiftItemId(id).rawValue, contents: entry))
@@ -395,7 +407,8 @@ func managedProfilePhotoEmoji(postbox: Postbox, network: Network) -> Signal<Void
switch result {
case .emojiListNotModified:
return .single(nil)
case let .emojiList(_, documentIds):
case let .emojiList(emojiListData):
let documentIds = emojiListData.documentId
return _internal_resolveInlineStickers(postbox: postbox, network: network, fileIds: documentIds)
|> map { files -> [OrderedItemListEntry] in
var items: [OrderedItemListEntry] = []
@@ -426,7 +439,8 @@ func managedGroupPhotoEmoji(postbox: Postbox, network: Network) -> Signal<Void,
switch result {
case .emojiListNotModified:
return .single(nil)
case let .emojiList(_, documentIds):
case let .emojiList(emojiListData):
let documentIds = emojiListData.documentId
return _internal_resolveInlineStickers(postbox: postbox, network: network, fileIds: documentIds)
|> map { files -> [OrderedItemListEntry] in
var items: [OrderedItemListEntry] = []
@@ -457,7 +471,8 @@ func managedBackgroundIconEmoji(postbox: Postbox, network: Network) -> Signal<Vo
switch result {
case .emojiListNotModified:
return .single(nil)
case let .emojiList(_, documentIds):
case let .emojiList(emojiListData):
let documentIds = emojiListData.documentId
return _internal_resolveInlineStickers(postbox: postbox, network: network, fileIds: documentIds)
|> map { files -> [OrderedItemListEntry] in
var items: [OrderedItemListEntry] = []
@@ -488,7 +503,8 @@ func managedDisabledChannelStatusIconEmoji(postbox: Postbox, network: Network) -
switch result {
case .emojiListNotModified:
return .single(nil)
case let .emojiList(_, documentIds):
case let .emojiList(emojiListData):
let documentIds = emojiListData.documentId
return _internal_resolveInlineStickers(postbox: postbox, network: network, fileIds: documentIds)
|> map { files -> [OrderedItemListEntry] in
var items: [OrderedItemListEntry] = []
@@ -528,9 +544,10 @@ func managedRecentReactions(postbox: Postbox, network: Network) -> Signal<Void,
switch result {
case .reactionsNotModified:
return .single(nil)
case let .reactions(_, reactions):
case let .reactions(reactionsData):
let reactions = reactionsData.reactions
let parsedReactions = reactions.compactMap(MessageReaction.Reaction.init(apiReaction:))
return _internal_resolveInlineStickers(postbox: postbox, network: network, fileIds: parsedReactions.compactMap { reaction -> Int64? in
switch reaction {
case .builtin:
@@ -588,9 +605,10 @@ func managedTopReactions(postbox: Postbox, network: Network) -> Signal<Void, NoE
switch result {
case .reactionsNotModified:
return .single(nil)
case let .reactions(_, reactions):
case let .reactions(reactionsData):
let reactions = reactionsData.reactions
let parsedReactions = reactions.compactMap(MessageReaction.Reaction.init(apiReaction:))
return _internal_resolveInlineStickers(postbox: postbox, network: network, fileIds: parsedReactions.compactMap { reaction -> Int64? in
switch reaction {
case .builtin:
@@ -648,9 +666,10 @@ func managedDefaultTagReactions(postbox: Postbox, network: Network) -> Signal<Vo
switch result {
case .reactionsNotModified:
return .single(nil)
case let .reactions(_, reactions):
case let .reactions(reactionsData):
let reactions = reactionsData.reactions
let parsedReactions = reactions.compactMap(MessageReaction.Reaction.init(apiReaction:))
return _internal_resolveInlineStickers(postbox: postbox, network: network, fileIds: parsedReactions.compactMap { reaction -> Int64? in
switch reaction {
case .builtin: