[WIP] Emoji statuses

This commit is contained in:
Ali
2022-08-05 23:16:30 +04:00
parent 551674a744
commit 04ea87c1e3
20 changed files with 1377 additions and 116 deletions

View File

@@ -53,5 +53,23 @@ public extension TelegramEngine {
public func removeAccountPhoto(reference: TelegramMediaImageReference?) -> Signal<Void, NoError> {
return _internal_removeAccountPhoto(network: self.account.network, reference: reference)
}
public func setEmojiStatus(file: TelegramMediaFile?) -> Signal<Never, NoError> {
let peerId = self.account.peerId
return self.account.postbox.transaction { transaction -> Void in
if let file = file {
transaction.storeMediaIfNotPresent(media: file)
}
transaction.updatePeerCachedData(peerIds: Set([peerId]), update: { _, current in
guard let current = current as? CachedUserData else {
return current
}
return current.withUpdatedEmojiStatus(file.flatMap { file -> PeerEmojiStatus in
return PeerEmojiStatus(fileId: file.fileId.id)
})
})
}
|> ignoreValues
}
}
}