Refactoring

This commit is contained in:
Ali
2022-05-28 18:26:23 +04:00
parent 3edd84cf95
commit e8d124c812
62 changed files with 1459 additions and 993 deletions

View File

@@ -1668,14 +1668,16 @@ final class ChatMediaInputNode: ChatInputNode {
if let (itemNode, item) = itemNodeAndItem {
let accountPeerId = strongSelf.context.account.peerId
return strongSelf.context.account.postbox.transaction { transaction -> (Bool, Bool) in
let isStarred = getIsStickerSaved(transaction: transaction, fileId: item.file.fileId)
var hasPremium = false
if let peer = transaction.getPeer(accountPeerId) as? TelegramUser, peer.isPremium {
hasPremium = true
return combineLatest(
strongSelf.context.engine.stickers.isStickerSaved(id: item.file.fileId),
strongSelf.context.engine.data.get(TelegramEngine.EngineData.Item.Peer.Peer(id: accountPeerId)) |> map { peer -> Bool in
var hasPremium = false
if case let .user(user) = peer, user.isPremium {
hasPremium = true
}
return hasPremium
}
return (isStarred, hasPremium)
}
)
|> deliverOnMainQueue
|> map { isStarred, hasPremium -> (ASDisplayNode, PeekControllerContent)? in
if let strongSelf = self {