Files
Leeksov 4647310322 GLEGram 12.5 — Initial public release
Based on Swiftgram 12.5 (Telegram iOS 12.5).
All GLEGram features ported and organized in GLEGram/ folder.

Features: Ghost Mode, Saved Deleted Messages, Content Protection Bypass,
Font Replacement, Fake Profile, Chat Export, Plugin System, and more.

See CHANGELOG_12.5.md for full details.
2026-04-06 09:48:12 +03:00

81 lines
3.5 KiB
Swift

import Foundation
import Postbox
import TelegramApi
import SwiftSignalKit
public enum UpdateGroupSpecificStickersetError {
case generic
}
func _internal_updateGroupSpecificStickerset(postbox: Postbox, network: Network, peerId: PeerId, info: StickerPackCollectionInfo?) -> Signal<Void, UpdateGroupSpecificStickersetError> {
return postbox.loadedPeerWithId(peerId)
|> castError(UpdateGroupSpecificStickersetError.self)
|> mapToSignal { peer -> Signal<Void, UpdateGroupSpecificStickersetError> in
let inputStickerset: Api.InputStickerSet
if let info = info {
inputStickerset = Api.InputStickerSet.inputStickerSetShortName(.init(shortName: info.shortName))
} else {
inputStickerset = Api.InputStickerSet.inputStickerSetEmpty
}
if let inputChannel = apiInputChannel(peer) {
return network.request(Api.functions.channels.setStickers(channel: inputChannel, stickerset: inputStickerset))
|> mapError { _ -> UpdateGroupSpecificStickersetError in
return .generic
}
|> mapToSignal { value -> Signal<Void, UpdateGroupSpecificStickersetError> in
switch value {
case .boolTrue:
return postbox.transaction { transaction -> Void in
return transaction.updatePeerCachedData(peerIds: [peerId], update: { _, current -> CachedPeerData? in
return (current as? CachedChannelData)?.withUpdatedStickerPack(info)
})
}
|> castError(UpdateGroupSpecificStickersetError.self)
default:
return .complete()
}
}
}
return .complete()
}
}
public enum UpdateGroupSpecificEmojisetError {
case generic
}
func _internal_updateGroupSpecificEmojiset(postbox: Postbox, network: Network, peerId: PeerId, info: StickerPackCollectionInfo?) -> Signal<Void, UpdateGroupSpecificEmojisetError> {
return postbox.loadedPeerWithId(peerId)
|> castError(UpdateGroupSpecificEmojisetError.self)
|> mapToSignal { peer -> Signal<Void, UpdateGroupSpecificEmojisetError> in
let inputStickerset: Api.InputStickerSet
if let info = info {
inputStickerset = Api.InputStickerSet.inputStickerSetShortName(.init(shortName: info.shortName))
} else {
inputStickerset = Api.InputStickerSet.inputStickerSetEmpty
}
if let inputChannel = apiInputChannel(peer) {
return network.request(Api.functions.channels.setEmojiStickers(channel: inputChannel, stickerset: inputStickerset))
|> mapError { _ -> UpdateGroupSpecificEmojisetError in
return .generic
}
|> mapToSignal { value -> Signal<Void, UpdateGroupSpecificEmojisetError> in
switch value {
case .boolTrue:
return postbox.transaction { transaction -> Void in
return transaction.updatePeerCachedData(peerIds: [peerId], update: { _, current -> CachedPeerData? in
return (current as? CachedChannelData)?.withUpdatedEmojiPack(info)
})
}
|> castError(UpdateGroupSpecificEmojisetError.self)
default:
return .complete()
}
}
}
return .complete()
}
}