mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios
This commit is contained in:
@@ -315,7 +315,9 @@ private class AdMessagesHistoryContextImpl {
|
||||
nameColor: invite.nameColor,
|
||||
backgroundEmojiId: nil,
|
||||
profileColor: nil,
|
||||
profileBackgroundEmojiId: nil
|
||||
profileBackgroundEmojiId: nil,
|
||||
emojiStatus: nil,
|
||||
approximateBoostLevel: nil
|
||||
)
|
||||
case let .webPage(webPage):
|
||||
author = TelegramChannel(
|
||||
@@ -338,7 +340,9 @@ private class AdMessagesHistoryContextImpl {
|
||||
nameColor: .blue,
|
||||
backgroundEmojiId: nil,
|
||||
profileColor: nil,
|
||||
profileBackgroundEmojiId: nil
|
||||
profileBackgroundEmojiId: nil,
|
||||
emojiStatus: nil,
|
||||
approximateBoostLevel: nil
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -1423,6 +1423,13 @@ public func _internal_pollPeerStories(postbox: Postbox, network: Network, accoun
|
||||
guard let inputPeer = inputPeer else {
|
||||
return .complete()
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
if "".isEmpty {
|
||||
return .complete()
|
||||
}
|
||||
#endif
|
||||
|
||||
return network.request(Api.functions.stories.getPeerStories(peer: inputPeer))
|
||||
|> map(Optional.init)
|
||||
|> `catch` { _ -> Signal<Api.stories.PeerStories?, NoError> in
|
||||
|
||||
@@ -514,6 +514,10 @@ public extension EnginePeer {
|
||||
return self._asPeer().profileColor
|
||||
}
|
||||
|
||||
var emojiStatus: PeerEmojiStatus? {
|
||||
return self._asPeer().emojiStatus
|
||||
}
|
||||
|
||||
var backgroundEmojiId: Int64? {
|
||||
return self._asPeer().backgroundEmojiId
|
||||
}
|
||||
|
||||
@@ -718,6 +718,10 @@ public extension TelegramEngine {
|
||||
return _internal_updatePeerNameColorAndEmoji(account: self.account, peerId: peerId, nameColor: nameColor, backgroundEmojiId: backgroundEmojiId, profileColor: profileColor, profileBackgroundEmojiId: profileBackgroundEmojiId)
|
||||
}
|
||||
|
||||
public func updatePeerEmojiStatus(peerId: EnginePeer.Id, fileId: Int64?, expirationDate: Int32?) -> Signal<Never, UpdatePeerEmojiStatusError> {
|
||||
return _internal_updatePeerEmojiStatus(account: self.account, peerId: peerId, fileId: fileId, expirationDate: expirationDate)
|
||||
}
|
||||
|
||||
public func getChatListPeers(filterPredicate: ChatListFilterPredicate) -> Signal<[EnginePeer], NoError> {
|
||||
return self.account.postbox.transaction { transaction -> [EnginePeer] in
|
||||
return transaction.getChatListPeers(groupId: .root, filterPredicate: filterPredicate, additionalFilter: nil).map(EnginePeer.init)
|
||||
|
||||
@@ -100,9 +100,9 @@ func _internal_updatePeerNameColorAndEmoji(account: Account, peerId: EnginePeer.
|
||||
if let peer = peer as? TelegramChannel, let inputChannel = apiInputChannel(peer) {
|
||||
let flagsReplies: Int32 = (1 << 0) | (1 << 2)
|
||||
|
||||
var flagsProfile: Int32 = (1 << 0) | (1 << 2)
|
||||
var flagsProfile: Int32 = (1 << 0) | (1 << 1)
|
||||
if profileColor != nil {
|
||||
flagsProfile |= (1 << 1)
|
||||
flagsProfile |= (1 << 2)
|
||||
}
|
||||
|
||||
return combineLatest(
|
||||
@@ -161,3 +161,45 @@ func _internal_updatePeerNameColorAndEmoji(account: Account, peerId: EnginePeer.
|
||||
|> castError(UpdatePeerNameColorAndEmojiError.self)
|
||||
|> switchToLatest
|
||||
}
|
||||
|
||||
public enum UpdatePeerEmojiStatusError {
|
||||
case generic
|
||||
}
|
||||
|
||||
func _internal_updatePeerEmojiStatus(account: Account, peerId: PeerId, fileId: Int64?, expirationDate: Int32?) -> Signal<Never, UpdatePeerEmojiStatusError> {
|
||||
return account.postbox.transaction { transaction -> Api.InputChannel? in
|
||||
let updatedStatus = fileId.flatMap {
|
||||
PeerEmojiStatus(fileId: $0, expirationDate: expirationDate)
|
||||
}
|
||||
if let peer = transaction.getPeer(peerId) as? TelegramChannel {
|
||||
updatePeersCustom(transaction: transaction, peers: [peer.withUpdatedEmojiStatus(updatedStatus)], update: { _, updated in updated })
|
||||
}
|
||||
|
||||
return transaction.getPeer(peerId).flatMap(apiInputChannel)
|
||||
}
|
||||
|> castError(UpdatePeerEmojiStatusError.self)
|
||||
|> mapToSignal { inputChannel -> Signal<Never, UpdatePeerEmojiStatusError> in
|
||||
guard let inputChannel = inputChannel else {
|
||||
return .fail(.generic)
|
||||
}
|
||||
let mappedStatus: Api.EmojiStatus
|
||||
if let fileId = fileId {
|
||||
if let expirationDate = expirationDate {
|
||||
mappedStatus = .emojiStatusUntil(documentId: fileId, until: expirationDate)
|
||||
} else {
|
||||
mappedStatus = .emojiStatus(documentId: fileId)
|
||||
}
|
||||
} else {
|
||||
mappedStatus = .emojiStatusEmpty
|
||||
}
|
||||
return account.network.request(Api.functions.channels.updateEmojiStatus(channel: inputChannel, emojiStatus: mappedStatus))
|
||||
|> ignoreValues
|
||||
|> `catch` { error -> Signal<Never, UpdatePeerEmojiStatusError> in
|
||||
if error.errorDescription == "CHAT_NOT_MODIFIED" {
|
||||
return .complete()
|
||||
} else {
|
||||
return .fail(.generic)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,6 +49,9 @@ extension StickerPackCollectionInfo {
|
||||
if (flags & (1 << 7)) != 0 {
|
||||
setFlags.insert(.isEmoji)
|
||||
}
|
||||
if (flags & (1 << 10)) != 0 {
|
||||
setFlags.insert(.isAvailableAsChannelStatus)
|
||||
}
|
||||
|
||||
var thumbnailRepresentation: TelegramMediaImageRepresentation?
|
||||
var immediateThumbnailData: Data?
|
||||
|
||||
Reference in New Issue
Block a user