mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-28 08:30:11 +00:00
[WIP] Channel appearance
This commit is contained in:
parent
b66f748969
commit
09e025e985
@ -2477,7 +2477,7 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
||||
currentCredibilityIconContent = .text(color: item.presentationData.theme.chat.message.incoming.scamColor, string: item.presentationData.strings.Message_ScamAccount.uppercased())
|
||||
} else if peer.isFake {
|
||||
currentCredibilityIconContent = .text(color: item.presentationData.theme.chat.message.incoming.scamColor, string: item.presentationData.strings.Message_FakeAccount.uppercased())
|
||||
} else if case let .user(user) = peer, let emojiStatus = user.emojiStatus, !premiumConfiguration.isPremiumDisabled {
|
||||
} else if let emojiStatus = peer.emojiStatus, !premiumConfiguration.isPremiumDisabled {
|
||||
currentCredibilityIconContent = .animation(content: .customEmoji(fileId: emojiStatus.fileId), size: CGSize(width: 32.0, height: 32.0), placeholderColor: item.presentationData.theme.list.mediaPlaceholderColor, themeColor: item.presentationData.theme.list.itemAccentColor, loopMode: .count(2))
|
||||
} else if peer.isVerified {
|
||||
currentCredibilityIconContent = .verified(fillColor: item.presentationData.theme.list.itemCheckColors.fillColor, foregroundColor: item.presentationData.theme.list.itemCheckColors.foregroundColor, sizeType: .compact)
|
||||
@ -2493,7 +2493,7 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
||||
currentCredibilityIconContent = .text(color: item.presentationData.theme.chat.message.incoming.scamColor, string: item.presentationData.strings.Message_ScamAccount.uppercased())
|
||||
} else if peer.isFake {
|
||||
currentCredibilityIconContent = .text(color: item.presentationData.theme.chat.message.incoming.scamColor, string: item.presentationData.strings.Message_FakeAccount.uppercased())
|
||||
} else if case let .user(user) = peer, let emojiStatus = user.emojiStatus, !premiumConfiguration.isPremiumDisabled {
|
||||
} else if let emojiStatus = peer.emojiStatus, !premiumConfiguration.isPremiumDisabled {
|
||||
currentCredibilityIconContent = .animation(content: .customEmoji(fileId: emojiStatus.fileId), size: CGSize(width: 32.0, height: 32.0), placeholderColor: item.presentationData.theme.list.mediaPlaceholderColor, themeColor: item.presentationData.theme.list.itemAccentColor, loopMode: .count(2))
|
||||
} else if peer.isVerified {
|
||||
currentCredibilityIconContent = .verified(fillColor: item.presentationData.theme.list.itemCheckColors.fillColor, foregroundColor: item.presentationData.theme.list.itemCheckColors.foregroundColor, sizeType: .compact)
|
||||
|
@ -609,7 +609,7 @@ public final class ReactionListContextMenuContent: ContextControllerItemsContent
|
||||
currentCredibilityIcon = .text(color: presentationData.theme.chat.message.incoming.scamColor, string: presentationData.strings.Message_ScamAccount.uppercased())
|
||||
} else if item.peer.isFake {
|
||||
currentCredibilityIcon = .text(color: presentationData.theme.chat.message.incoming.scamColor, string: presentationData.strings.Message_FakeAccount.uppercased())
|
||||
} else if case let .user(user) = item.peer, let emojiStatus = user.emojiStatus {
|
||||
} else if let emojiStatus = item.peer.emojiStatus {
|
||||
currentCredibilityIcon = .animation(content: .customEmoji(fileId: emojiStatus.fileId), size: CGSize(width: 32.0, height: 32.0), placeholderColor: UIColor(white: 0.0, alpha: 0.1), themeColor: presentationData.theme.list.itemAccentColor, loopMode: .count(2))
|
||||
} else if item.peer.isVerified {
|
||||
currentCredibilityIcon = .verified(fillColor: presentationData.theme.list.itemCheckColors.fillColor, foregroundColor: presentationData.theme.list.itemCheckColors.foregroundColor, sizeType: .compact)
|
||||
|
@ -244,7 +244,6 @@ open class ViewControllerComponentContainer: ViewController {
|
||||
} else {
|
||||
presentationData = self.context.sharedContext.currentPresentationData.with { $0 }
|
||||
}
|
||||
|
||||
|
||||
let navigationBarPresentationData: NavigationBarPresentationData?
|
||||
switch navigationBarAppearance {
|
||||
@ -280,6 +279,19 @@ open class ViewControllerComponentContainer: ViewController {
|
||||
strongSelf.statusBar.statusBarStyle = presentationData.theme.rootController.statusBarStyle.style
|
||||
}
|
||||
|
||||
let navigationBarPresentationData: NavigationBarPresentationData?
|
||||
switch navigationBarAppearance {
|
||||
case .none:
|
||||
navigationBarPresentationData = nil
|
||||
case .transparent:
|
||||
navigationBarPresentationData = NavigationBarPresentationData(presentationData: presentationData, hideBackground: true, hideBadge: false, hideSeparator: true)
|
||||
case .default:
|
||||
navigationBarPresentationData = NavigationBarPresentationData(presentationData: presentationData)
|
||||
}
|
||||
if let navigationBarPresentationData {
|
||||
strongSelf.navigationBar?.updatePresentationData(navigationBarPresentationData)
|
||||
}
|
||||
|
||||
if let layout = strongSelf.validLayout {
|
||||
strongSelf.containerLayoutUpdated(layout, transition: .immediate)
|
||||
}
|
||||
|
@ -699,7 +699,7 @@ public class ContactsPeerItemNode: ItemListRevealOptionsItemNode {
|
||||
credibilityIcon = .text(color: item.presentationData.theme.chat.message.incoming.scamColor, string: item.presentationData.strings.Message_ScamAccount.uppercased())
|
||||
} else if peer.isFake {
|
||||
credibilityIcon = .text(color: item.presentationData.theme.chat.message.incoming.scamColor, string: item.presentationData.strings.Message_FakeAccount.uppercased())
|
||||
} else if case let .user(user) = peer, let emojiStatus = user.emojiStatus {
|
||||
} else if let emojiStatus = peer.emojiStatus {
|
||||
credibilityIcon = .animation(content: .customEmoji(fileId: emojiStatus.fileId), size: CGSize(width: 20.0, height: 20.0), placeholderColor: item.presentationData.theme.list.mediaPlaceholderColor, themeColor: item.presentationData.theme.list.itemAccentColor, loopMode: .count(2))
|
||||
} else if peer.isVerified {
|
||||
credibilityIcon = .verified(fillColor: item.presentationData.theme.list.itemCheckColors.fillColor, foregroundColor: item.presentationData.theme.list.itemCheckColors.foregroundColor, sizeType: .compact)
|
||||
|
@ -913,7 +913,7 @@ public class ItemListPeerItemNode: ItemListRevealOptionsItemNode, ItemListItemNo
|
||||
credibilityIcon = .text(color: item.presentationData.theme.chat.message.incoming.scamColor, string: item.presentationData.strings.Message_ScamAccount.uppercased())
|
||||
} else if item.peer.isFake {
|
||||
credibilityIcon = .text(color: item.presentationData.theme.chat.message.incoming.scamColor, string: item.presentationData.strings.Message_FakeAccount.uppercased())
|
||||
} else if case let .user(user) = item.peer, let emojiStatus = user.emojiStatus {
|
||||
} else if let emojiStatus = item.peer.emojiStatus {
|
||||
credibilityIcon = .animation(content: .customEmoji(fileId: emojiStatus.fileId), size: CGSize(width: 20.0, height: 20.0), placeholderColor: item.presentationData.theme.list.mediaPlaceholderColor, themeColor: item.presentationData.theme.list.itemAccentColor, loopMode: .count(2))
|
||||
} else if item.peer.isVerified {
|
||||
credibilityIcon = .verified(fillColor: item.presentationData.theme.list.itemCheckColors.fillColor, foregroundColor: item.presentationData.theme.list.itemCheckColors.foregroundColor, sizeType: .compact)
|
||||
|
@ -86,7 +86,9 @@ private final class PremiumGiftCodeSheetContent: CombinedComponent {
|
||||
var peerIds: [EnginePeer.Id] = []
|
||||
switch subject {
|
||||
case let .giftCode(giftCode):
|
||||
peerIds.append(giftCode.fromPeerId)
|
||||
if let fromPeerId = giftCode.fromPeerId {
|
||||
peerIds.append(fromPeerId)
|
||||
}
|
||||
if let toPeerId = giftCode.toPeerId {
|
||||
peerIds.append(toPeerId)
|
||||
}
|
||||
@ -201,7 +203,11 @@ private final class PremiumGiftCodeSheetContent: CombinedComponent {
|
||||
}
|
||||
link = "https://t.me/giftcode/\(giftCode.slug)"
|
||||
date = giftCode.date
|
||||
fromPeer = state.peerMap[giftCode.fromPeerId]
|
||||
if let fromPeerId = giftCode.fromPeerId {
|
||||
fromPeer = state.peerMap[fromPeerId]
|
||||
} else {
|
||||
fromPeer = nil
|
||||
}
|
||||
toPeerId = giftCode.toPeerId
|
||||
if let toPeerId = giftCode.toPeerId {
|
||||
toPeer = state.peerMap[toPeerId]
|
||||
|
@ -307,10 +307,10 @@ private final class TextSizeSelectionControllerNode: ASDisplayNode, UIScrollView
|
||||
let selfPeer: EnginePeer = .user(TelegramUser(id: self.context.account.peerId, accessHash: nil, firstName: nil, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: [], emojiStatus: nil, usernames: [], storiesHidden: nil, nameColor: nil, backgroundEmojiId: nil, profileColor: nil, profileBackgroundEmojiId: nil))
|
||||
let peer1: EnginePeer = .user(TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(1)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_1_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: [], emojiStatus: nil, usernames: [], storiesHidden: nil, nameColor: nil, backgroundEmojiId: nil, profileColor: nil, profileBackgroundEmojiId: nil))
|
||||
let peer2: EnginePeer = .user(TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(2)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_2_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: [], emojiStatus: nil, usernames: [], storiesHidden: nil, nameColor: nil, backgroundEmojiId: nil, profileColor: nil, profileBackgroundEmojiId: nil))
|
||||
let peer3: EnginePeer = .channel(TelegramChannel(id: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(3)), accessHash: nil, title: self.presentationData.strings.Appearance_ThemePreview_ChatList_3_Name, username: nil, photo: [], creationDate: 0, version: 0, participationStatus: .member, info: .group(.init(flags: [])), flags: [], restrictionInfo: nil, adminRights: nil, bannedRights: nil, defaultBannedRights: nil, usernames: [], storiesHidden: nil, nameColor: nil, backgroundEmojiId: nil, profileColor: nil, profileBackgroundEmojiId: nil, emojiStatus: nil))
|
||||
let peer3: EnginePeer = .channel(TelegramChannel(id: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(3)), accessHash: nil, title: self.presentationData.strings.Appearance_ThemePreview_ChatList_3_Name, username: nil, photo: [], creationDate: 0, version: 0, participationStatus: .member, info: .group(.init(flags: [])), flags: [], restrictionInfo: nil, adminRights: nil, bannedRights: nil, defaultBannedRights: nil, usernames: [], storiesHidden: nil, nameColor: nil, backgroundEmojiId: nil, profileColor: nil, profileBackgroundEmojiId: nil, emojiStatus: nil, approximateBoostLevel: nil))
|
||||
let peer3Author: EnginePeer = .user(TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(4)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_3_AuthorName, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: [], emojiStatus: nil, usernames: [], storiesHidden: nil, nameColor: nil, backgroundEmojiId: nil, profileColor: nil, profileBackgroundEmojiId: nil))
|
||||
let peer4: EnginePeer = .user(TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(4)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_4_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: [], emojiStatus: nil, usernames: [], storiesHidden: nil, nameColor: nil, backgroundEmojiId: nil, profileColor: nil, profileBackgroundEmojiId: nil))
|
||||
let peer5: EnginePeer = .channel(TelegramChannel(id: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(5)), accessHash: nil, title: self.presentationData.strings.Appearance_ThemePreview_ChatList_5_Name, username: nil, photo: [], creationDate: 0, version: 0, participationStatus: .member, info: .broadcast(.init(flags: [])), flags: [], restrictionInfo: nil, adminRights: nil, bannedRights: nil, defaultBannedRights: nil, usernames: [], storiesHidden: nil, nameColor: nil, backgroundEmojiId: nil, profileColor: nil, profileBackgroundEmojiId: nil, emojiStatus: nil))
|
||||
let peer5: EnginePeer = .channel(TelegramChannel(id: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(5)), accessHash: nil, title: self.presentationData.strings.Appearance_ThemePreview_ChatList_5_Name, username: nil, photo: [], creationDate: 0, version: 0, participationStatus: .member, info: .broadcast(.init(flags: [])), flags: [], restrictionInfo: nil, adminRights: nil, bannedRights: nil, defaultBannedRights: nil, usernames: [], storiesHidden: nil, nameColor: nil, backgroundEmojiId: nil, profileColor: nil, profileBackgroundEmojiId: nil, emojiStatus: nil, approximateBoostLevel: nil))
|
||||
let peer6: EnginePeer = .user(TelegramUser(id: PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt64Value(5)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_6_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: [], emojiStatus: nil, usernames: [], storiesHidden: nil, nameColor: nil, backgroundEmojiId: nil, profileColor: nil, profileBackgroundEmojiId: nil))
|
||||
|
||||
let timestamp = self.referenceTimestamp
|
||||
|
@ -500,7 +500,7 @@ class ThemeGridThemeItemNode: ListViewItemNode, ItemListItemNode {
|
||||
for theme in item.themes {
|
||||
let selected = item.currentTheme.index == theme.index
|
||||
|
||||
let iconItem = ThemeCarouselThemeIconItem(context: item.context, emojiFile: theme.emoticon.flatMap { item.animatedEmojiStickers[$0]?.first?.file }, themeReference: theme, nightMode: item.nightMode, themeSpecificAccentColors: item.themeSpecificAccentColors, themeSpecificChatWallpapers: item.themeSpecificChatWallpapers, selected: selected, theme: item.theme, strings: item.strings, wallpaper: nil, action: { theme in
|
||||
let iconItem = ThemeCarouselThemeIconItem(context: item.context, emojiFile: theme.emoticon.flatMap { item.animatedEmojiStickers[$0]?.first?.file }, themeReference: theme, nightMode: item.nightMode, channelMode: false, themeSpecificAccentColors: item.themeSpecificAccentColors, themeSpecificChatWallpapers: item.themeSpecificChatWallpapers, selected: selected, theme: item.theme, strings: item.strings, wallpaper: nil, action: { theme in
|
||||
item.updatedTheme(theme)
|
||||
}, contextAction: nil)
|
||||
|
||||
|
@ -948,7 +948,7 @@ final class ThemeAccentColorControllerNode: ASDisplayNode, UIScrollViewDelegate
|
||||
let selfPeer: EnginePeer = .user(TelegramUser(id: self.context.account.peerId, accessHash: nil, firstName: nil, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: [], emojiStatus: nil, usernames: [], storiesHidden: nil, nameColor: nil, backgroundEmojiId: nil, profileColor: nil, profileBackgroundEmojiId: nil))
|
||||
let peer1: EnginePeer = .user(TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(1)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_1_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: [], emojiStatus: nil, usernames: [], storiesHidden: nil, nameColor: nil, backgroundEmojiId: nil, profileColor: nil, profileBackgroundEmojiId: nil))
|
||||
let peer2: EnginePeer = .user(TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(2)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_2_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: [], emojiStatus: nil, usernames: [], storiesHidden: nil, nameColor: nil, backgroundEmojiId: nil, profileColor: nil, profileBackgroundEmojiId: nil))
|
||||
let peer3: EnginePeer = .channel(TelegramChannel(id: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(3)), accessHash: nil, title: self.presentationData.strings.Appearance_ThemePreview_ChatList_3_Name, username: nil, photo: [], creationDate: 0, version: 0, participationStatus: .member, info: .group(.init(flags: [])), flags: [], restrictionInfo: nil, adminRights: nil, bannedRights: nil, defaultBannedRights: nil, usernames: [], storiesHidden: nil, nameColor: nil, backgroundEmojiId: nil, profileColor: nil, profileBackgroundEmojiId: nil, emojiStatus: nil))
|
||||
let peer3: EnginePeer = .channel(TelegramChannel(id: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(3)), accessHash: nil, title: self.presentationData.strings.Appearance_ThemePreview_ChatList_3_Name, username: nil, photo: [], creationDate: 0, version: 0, participationStatus: .member, info: .group(.init(flags: [])), flags: [], restrictionInfo: nil, adminRights: nil, bannedRights: nil, defaultBannedRights: nil, usernames: [], storiesHidden: nil, nameColor: nil, backgroundEmojiId: nil, profileColor: nil, profileBackgroundEmojiId: nil, emojiStatus: nil, approximateBoostLevel: nil))
|
||||
let peer3Author: EnginePeer = .user(TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(4)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_3_AuthorName, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: [], emojiStatus: nil, usernames: [], storiesHidden: nil, nameColor: nil, backgroundEmojiId: nil, profileColor: nil, profileBackgroundEmojiId: nil))
|
||||
let peer4: EnginePeer = .user(TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(4)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_4_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: [], emojiStatus: nil, usernames: [], storiesHidden: nil, nameColor: nil, backgroundEmojiId: nil, profileColor: nil, profileBackgroundEmojiId: nil))
|
||||
|
||||
|
@ -455,10 +455,10 @@ final class ThemePreviewControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
||||
let selfPeer: EnginePeer = .user(TelegramUser(id: self.context.account.peerId, accessHash: nil, firstName: nil, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: [], emojiStatus: nil, usernames: [], storiesHidden: nil, nameColor: nil, backgroundEmojiId: nil, profileColor: nil, profileBackgroundEmojiId: nil))
|
||||
let peer1: EnginePeer = .user(TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(1)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_1_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: [], emojiStatus: nil, usernames: [], storiesHidden: nil, nameColor: nil, backgroundEmojiId: nil, profileColor: nil, profileBackgroundEmojiId: nil))
|
||||
let peer2: EnginePeer = .user(TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(2)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_2_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: [], emojiStatus: nil, usernames: [], storiesHidden: nil, nameColor: nil, backgroundEmojiId: nil, profileColor: nil, profileBackgroundEmojiId: nil))
|
||||
let peer3: EnginePeer = .channel(TelegramChannel(id: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(3)), accessHash: nil, title: self.presentationData.strings.Appearance_ThemePreview_ChatList_3_Name, username: nil, photo: [], creationDate: 0, version: 0, participationStatus: .member, info: .group(.init(flags: [])), flags: [], restrictionInfo: nil, adminRights: nil, bannedRights: nil, defaultBannedRights: nil, usernames: [], storiesHidden: nil, nameColor: nil, backgroundEmojiId: nil, profileColor: nil, profileBackgroundEmojiId: nil, emojiStatus: nil))
|
||||
let peer3: EnginePeer = .channel(TelegramChannel(id: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(3)), accessHash: nil, title: self.presentationData.strings.Appearance_ThemePreview_ChatList_3_Name, username: nil, photo: [], creationDate: 0, version: 0, participationStatus: .member, info: .group(.init(flags: [])), flags: [], restrictionInfo: nil, adminRights: nil, bannedRights: nil, defaultBannedRights: nil, usernames: [], storiesHidden: nil, nameColor: nil, backgroundEmojiId: nil, profileColor: nil, profileBackgroundEmojiId: nil, emojiStatus: nil, approximateBoostLevel: nil))
|
||||
let peer3Author: EnginePeer = .user(TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(4)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_3_AuthorName, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: [], emojiStatus: nil, usernames: [], storiesHidden: nil, nameColor: nil, backgroundEmojiId: nil, profileColor: nil, profileBackgroundEmojiId: nil))
|
||||
let peer4: EnginePeer = .user(TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(4)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_4_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: [], emojiStatus: nil, usernames: [], storiesHidden: nil, nameColor: nil, backgroundEmojiId: nil, profileColor: nil, profileBackgroundEmojiId: nil))
|
||||
let peer5: EnginePeer = .channel(TelegramChannel(id: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(5)), accessHash: nil, title: self.presentationData.strings.Appearance_ThemePreview_ChatList_5_Name, username: nil, photo: [], creationDate: 0, version: 0, participationStatus: .member, info: .broadcast(.init(flags: [])), flags: [], restrictionInfo: nil, adminRights: nil, bannedRights: nil, defaultBannedRights: nil, usernames: [], storiesHidden: nil, nameColor: nil, backgroundEmojiId: nil, profileColor: nil, profileBackgroundEmojiId: nil, emojiStatus: nil))
|
||||
let peer5: EnginePeer = .channel(TelegramChannel(id: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(5)), accessHash: nil, title: self.presentationData.strings.Appearance_ThemePreview_ChatList_5_Name, username: nil, photo: [], creationDate: 0, version: 0, participationStatus: .member, info: .broadcast(.init(flags: [])), flags: [], restrictionInfo: nil, adminRights: nil, bannedRights: nil, defaultBannedRights: nil, usernames: [], storiesHidden: nil, nameColor: nil, backgroundEmojiId: nil, profileColor: nil, profileBackgroundEmojiId: nil, emojiStatus: nil, approximateBoostLevel: nil))
|
||||
let peer6: EnginePeer = .user(TelegramUser(id: PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt64Value(5)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_6_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: [], emojiStatus: nil, usernames: [], storiesHidden: nil, nameColor: nil, backgroundEmojiId: nil, profileColor: nil, profileBackgroundEmojiId: nil))
|
||||
let peer7: EnginePeer = .user(TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(6)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_7_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: [], emojiStatus: nil, usernames: [], storiesHidden: nil, nameColor: nil, backgroundEmojiId: nil, profileColor: nil, profileBackgroundEmojiId: nil))
|
||||
|
||||
|
@ -104,6 +104,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
||||
dict[531458253] = { return Api.ChannelAdminLogEvent.parse_channelAdminLogEvent($0) }
|
||||
dict[1427671598] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionChangeAbout($0) }
|
||||
dict[-1102180616] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionChangeAvailableReactions($0) }
|
||||
dict[1051328177] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionChangeEmojiStatus($0) }
|
||||
dict[1855199800] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionChangeHistoryTTL($0) }
|
||||
dict[84703944] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionChangeLinkedChat($0) }
|
||||
dict[241923758] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionChangeLocation($0) }
|
||||
@ -167,7 +168,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
||||
dict[-531931925] = { return Api.ChannelParticipantsFilter.parse_channelParticipantsMentions($0) }
|
||||
dict[-566281095] = { return Api.ChannelParticipantsFilter.parse_channelParticipantsRecent($0) }
|
||||
dict[106343499] = { return Api.ChannelParticipantsFilter.parse_channelParticipantsSearch($0) }
|
||||
dict[-1506368542] = { return Api.Chat.parse_channel($0) }
|
||||
dict[179174543] = { return Api.Chat.parse_channel($0) }
|
||||
dict[399807445] = { return Api.Chat.parse_channelForbidden($0) }
|
||||
dict[1103884886] = { return Api.Chat.parse_chat($0) }
|
||||
dict[693512293] = { return Api.Chat.parse_chatEmpty($0) }
|
||||
@ -463,7 +464,9 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
||||
dict[695856818] = { return Api.LangPackString.parse_langPackStringDeleted($0) }
|
||||
dict[1816636575] = { return Api.LangPackString.parse_langPackStringPluralized($0) }
|
||||
dict[-1361650766] = { return Api.MaskCoords.parse_maskCoords($0) }
|
||||
dict[577893055] = { return Api.MediaArea.parse_inputMediaAreaChannelPost($0) }
|
||||
dict[-1300094593] = { return Api.MediaArea.parse_inputMediaAreaVenue($0) }
|
||||
dict[1996756655] = { return Api.MediaArea.parse_mediaAreaChannelPost($0) }
|
||||
dict[-544523486] = { return Api.MediaArea.parse_mediaAreaGeoPoint($0) }
|
||||
dict[340088945] = { return Api.MediaArea.parse_mediaAreaSuggestedReaction($0) }
|
||||
dict[-1098720356] = { return Api.MediaArea.parse_mediaAreaVenue($0) }
|
||||
@ -856,6 +859,8 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
||||
dict[1232025500] = { return Api.Update.parse_updateBotInlineQuery($0) }
|
||||
dict[317794823] = { return Api.Update.parse_updateBotInlineSend($0) }
|
||||
dict[347625491] = { return Api.Update.parse_updateBotMenuButton($0) }
|
||||
dict[-1407069234] = { return Api.Update.parse_updateBotMessageReaction($0) }
|
||||
dict[164329305] = { return Api.Update.parse_updateBotMessageReactions($0) }
|
||||
dict[-1934976362] = { return Api.Update.parse_updateBotPrecheckoutQuery($0) }
|
||||
dict[-1246823043] = { return Api.Update.parse_updateBotShippingQuery($0) }
|
||||
dict[-997782967] = { return Api.Update.parse_updateBotStopped($0) }
|
||||
@ -1180,7 +1185,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
||||
dict[1218005070] = { return Api.messages.VotesList.parse_votesList($0) }
|
||||
dict[-44166467] = { return Api.messages.WebPage.parse_webPage($0) }
|
||||
dict[1042605427] = { return Api.payments.BankCardData.parse_bankCardData($0) }
|
||||
dict[-1222446760] = { return Api.payments.CheckedGiftCode.parse_checkedGiftCode($0) }
|
||||
dict[675942550] = { return Api.payments.CheckedGiftCode.parse_checkedGiftCode($0) }
|
||||
dict[-1362048039] = { return Api.payments.ExportedInvoice.parse_exportedInvoice($0) }
|
||||
dict[1130879648] = { return Api.payments.GiveawayInfo.parse_giveawayInfo($0) }
|
||||
dict[13456752] = { return Api.payments.GiveawayInfo.parse_giveawayInfoResults($0) }
|
||||
@ -1225,7 +1230,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
||||
dict[1574486984] = { return Api.stories.Stories.parse_stories($0) }
|
||||
dict[-1436583780] = { return Api.stories.StoryReactionsList.parse_storyReactionsList($0) }
|
||||
dict[-560009955] = { return Api.stories.StoryViews.parse_storyViews($0) }
|
||||
dict[430008454] = { return Api.stories.StoryViewsList.parse_storyViewsList($0) }
|
||||
dict[1507299269] = { return Api.stories.StoryViewsList.parse_storyViewsList($0) }
|
||||
dict[543450958] = { return Api.updates.ChannelDifference.parse_channelDifference($0) }
|
||||
dict[1041346555] = { return Api.updates.ChannelDifference.parse_channelDifferenceEmpty($0) }
|
||||
dict[-1531132162] = { return Api.updates.ChannelDifference.parse_channelDifferenceTooLong($0) }
|
||||
@ -1257,7 +1262,7 @@ public extension Api {
|
||||
return parser(reader)
|
||||
}
|
||||
else {
|
||||
telegramApiLog("Type constructor \(String(signature, radix: 16, uppercase: false)) not found")
|
||||
telegramApiLog("Type constructor \(String(UInt32(bitPattern: signature), radix: 16, uppercase: false)) not found")
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
@ -155,14 +155,24 @@ public extension Api {
|
||||
}
|
||||
}
|
||||
public extension Api {
|
||||
enum MediaArea: TypeConstructorDescription {
|
||||
indirect enum MediaArea: TypeConstructorDescription {
|
||||
case inputMediaAreaChannelPost(coordinates: Api.MediaAreaCoordinates, channel: Api.InputChannel, msgId: Int32)
|
||||
case inputMediaAreaVenue(coordinates: Api.MediaAreaCoordinates, queryId: Int64, resultId: String)
|
||||
case mediaAreaChannelPost(coordinates: Api.MediaAreaCoordinates, channelId: Int64, msgId: Int32)
|
||||
case mediaAreaGeoPoint(coordinates: Api.MediaAreaCoordinates, geo: Api.GeoPoint)
|
||||
case mediaAreaSuggestedReaction(flags: Int32, coordinates: Api.MediaAreaCoordinates, reaction: Api.Reaction)
|
||||
case mediaAreaVenue(coordinates: Api.MediaAreaCoordinates, geo: Api.GeoPoint, title: String, address: String, provider: String, venueId: String, venueType: String)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .inputMediaAreaChannelPost(let coordinates, let channel, let msgId):
|
||||
if boxed {
|
||||
buffer.appendInt32(577893055)
|
||||
}
|
||||
coordinates.serialize(buffer, true)
|
||||
channel.serialize(buffer, true)
|
||||
serializeInt32(msgId, buffer: buffer, boxed: false)
|
||||
break
|
||||
case .inputMediaAreaVenue(let coordinates, let queryId, let resultId):
|
||||
if boxed {
|
||||
buffer.appendInt32(-1300094593)
|
||||
@ -171,6 +181,14 @@ public extension Api {
|
||||
serializeInt64(queryId, buffer: buffer, boxed: false)
|
||||
serializeString(resultId, buffer: buffer, boxed: false)
|
||||
break
|
||||
case .mediaAreaChannelPost(let coordinates, let channelId, let msgId):
|
||||
if boxed {
|
||||
buffer.appendInt32(1996756655)
|
||||
}
|
||||
coordinates.serialize(buffer, true)
|
||||
serializeInt64(channelId, buffer: buffer, boxed: false)
|
||||
serializeInt32(msgId, buffer: buffer, boxed: false)
|
||||
break
|
||||
case .mediaAreaGeoPoint(let coordinates, let geo):
|
||||
if boxed {
|
||||
buffer.appendInt32(-544523486)
|
||||
@ -203,8 +221,12 @@ public extension Api {
|
||||
|
||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||
switch self {
|
||||
case .inputMediaAreaChannelPost(let coordinates, let channel, let msgId):
|
||||
return ("inputMediaAreaChannelPost", [("coordinates", coordinates as Any), ("channel", channel as Any), ("msgId", msgId as Any)])
|
||||
case .inputMediaAreaVenue(let coordinates, let queryId, let resultId):
|
||||
return ("inputMediaAreaVenue", [("coordinates", coordinates as Any), ("queryId", queryId as Any), ("resultId", resultId as Any)])
|
||||
case .mediaAreaChannelPost(let coordinates, let channelId, let msgId):
|
||||
return ("mediaAreaChannelPost", [("coordinates", coordinates as Any), ("channelId", channelId as Any), ("msgId", msgId as Any)])
|
||||
case .mediaAreaGeoPoint(let coordinates, let geo):
|
||||
return ("mediaAreaGeoPoint", [("coordinates", coordinates as Any), ("geo", geo as Any)])
|
||||
case .mediaAreaSuggestedReaction(let flags, let coordinates, let reaction):
|
||||
@ -214,6 +236,27 @@ public extension Api {
|
||||
}
|
||||
}
|
||||
|
||||
public static func parse_inputMediaAreaChannelPost(_ reader: BufferReader) -> MediaArea? {
|
||||
var _1: Api.MediaAreaCoordinates?
|
||||
if let signature = reader.readInt32() {
|
||||
_1 = Api.parse(reader, signature: signature) as? Api.MediaAreaCoordinates
|
||||
}
|
||||
var _2: Api.InputChannel?
|
||||
if let signature = reader.readInt32() {
|
||||
_2 = Api.parse(reader, signature: signature) as? Api.InputChannel
|
||||
}
|
||||
var _3: Int32?
|
||||
_3 = reader.readInt32()
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = _3 != nil
|
||||
if _c1 && _c2 && _c3 {
|
||||
return Api.MediaArea.inputMediaAreaChannelPost(coordinates: _1!, channel: _2!, msgId: _3!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
public static func parse_inputMediaAreaVenue(_ reader: BufferReader) -> MediaArea? {
|
||||
var _1: Api.MediaAreaCoordinates?
|
||||
if let signature = reader.readInt32() {
|
||||
@ -233,6 +276,25 @@ public extension Api {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
public static func parse_mediaAreaChannelPost(_ reader: BufferReader) -> MediaArea? {
|
||||
var _1: Api.MediaAreaCoordinates?
|
||||
if let signature = reader.readInt32() {
|
||||
_1 = Api.parse(reader, signature: signature) as? Api.MediaAreaCoordinates
|
||||
}
|
||||
var _2: Int64?
|
||||
_2 = reader.readInt64()
|
||||
var _3: Int32?
|
||||
_3 = reader.readInt32()
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = _3 != nil
|
||||
if _c1 && _c2 && _c3 {
|
||||
return Api.MediaArea.mediaAreaChannelPost(coordinates: _1!, channelId: _2!, msgId: _3!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
public static func parse_mediaAreaGeoPoint(_ reader: BufferReader) -> MediaArea? {
|
||||
var _1: Api.MediaAreaCoordinates?
|
||||
if let signature = reader.readInt32() {
|
||||
|
@ -724,6 +724,7 @@ public extension Api {
|
||||
indirect enum ChannelAdminLogEventAction: TypeConstructorDescription {
|
||||
case channelAdminLogEventActionChangeAbout(prevValue: String, newValue: String)
|
||||
case channelAdminLogEventActionChangeAvailableReactions(prevValue: Api.ChatReactions, newValue: Api.ChatReactions)
|
||||
case channelAdminLogEventActionChangeEmojiStatus(prevValue: Api.EmojiStatus, newValue: Api.EmojiStatus)
|
||||
case channelAdminLogEventActionChangeHistoryTTL(prevValue: Int32, newValue: Int32)
|
||||
case channelAdminLogEventActionChangeLinkedChat(prevValue: Int64, newValue: Int64)
|
||||
case channelAdminLogEventActionChangeLocation(prevValue: Api.ChannelLocation, newValue: Api.ChannelLocation)
|
||||
@ -785,6 +786,13 @@ public extension Api {
|
||||
prevValue.serialize(buffer, true)
|
||||
newValue.serialize(buffer, true)
|
||||
break
|
||||
case .channelAdminLogEventActionChangeEmojiStatus(let prevValue, let newValue):
|
||||
if boxed {
|
||||
buffer.appendInt32(1051328177)
|
||||
}
|
||||
prevValue.serialize(buffer, true)
|
||||
newValue.serialize(buffer, true)
|
||||
break
|
||||
case .channelAdminLogEventActionChangeHistoryTTL(let prevValue, let newValue):
|
||||
if boxed {
|
||||
buffer.appendInt32(1855199800)
|
||||
@ -1088,6 +1096,8 @@ public extension Api {
|
||||
return ("channelAdminLogEventActionChangeAbout", [("prevValue", prevValue as Any), ("newValue", newValue as Any)])
|
||||
case .channelAdminLogEventActionChangeAvailableReactions(let prevValue, let newValue):
|
||||
return ("channelAdminLogEventActionChangeAvailableReactions", [("prevValue", prevValue as Any), ("newValue", newValue as Any)])
|
||||
case .channelAdminLogEventActionChangeEmojiStatus(let prevValue, let newValue):
|
||||
return ("channelAdminLogEventActionChangeEmojiStatus", [("prevValue", prevValue as Any), ("newValue", newValue as Any)])
|
||||
case .channelAdminLogEventActionChangeHistoryTTL(let prevValue, let newValue):
|
||||
return ("channelAdminLogEventActionChangeHistoryTTL", [("prevValue", prevValue as Any), ("newValue", newValue as Any)])
|
||||
case .channelAdminLogEventActionChangeLinkedChat(let prevValue, let newValue):
|
||||
@ -1211,6 +1221,24 @@ public extension Api {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
public static func parse_channelAdminLogEventActionChangeEmojiStatus(_ reader: BufferReader) -> ChannelAdminLogEventAction? {
|
||||
var _1: Api.EmojiStatus?
|
||||
if let signature = reader.readInt32() {
|
||||
_1 = Api.parse(reader, signature: signature) as? Api.EmojiStatus
|
||||
}
|
||||
var _2: Api.EmojiStatus?
|
||||
if let signature = reader.readInt32() {
|
||||
_2 = Api.parse(reader, signature: signature) as? Api.EmojiStatus
|
||||
}
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
if _c1 && _c2 {
|
||||
return Api.ChannelAdminLogEventAction.channelAdminLogEventActionChangeEmojiStatus(prevValue: _1!, newValue: _2!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
public static func parse_channelAdminLogEventActionChangeHistoryTTL(_ reader: BufferReader) -> ChannelAdminLogEventAction? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
|
@ -471,6 +471,8 @@ public extension Api {
|
||||
case updateBotInlineQuery(flags: Int32, queryId: Int64, userId: Int64, query: String, geo: Api.GeoPoint?, peerType: Api.InlineQueryPeerType?, offset: String)
|
||||
case updateBotInlineSend(flags: Int32, userId: Int64, query: String, geo: Api.GeoPoint?, id: String, msgId: Api.InputBotInlineMessageID?)
|
||||
case updateBotMenuButton(botId: Int64, button: Api.BotMenuButton)
|
||||
case updateBotMessageReaction(peer: Api.Peer, msgId: Int32, date: Int32, actor: Api.Peer, oldReactions: [Api.Reaction], newReactions: [Api.Reaction], qts: Int32)
|
||||
case updateBotMessageReactions(peer: Api.Peer, msgId: Int32, date: Int32, reactions: [Api.ReactionCount], qts: Int32)
|
||||
case updateBotPrecheckoutQuery(flags: Int32, queryId: Int64, userId: Int64, payload: Buffer, info: Api.PaymentRequestedInfo?, shippingOptionId: String?, currency: String, totalAmount: Int64)
|
||||
case updateBotShippingQuery(queryId: Int64, userId: Int64, payload: Buffer, shippingAddress: Api.PostAddress)
|
||||
case updateBotStopped(userId: Int64, date: Int32, stopped: Api.Bool, qts: Int32)
|
||||
@ -671,6 +673,40 @@ public extension Api {
|
||||
serializeInt64(botId, buffer: buffer, boxed: false)
|
||||
button.serialize(buffer, true)
|
||||
break
|
||||
case .updateBotMessageReaction(let peer, let msgId, let date, let actor, let oldReactions, let newReactions, let qts):
|
||||
if boxed {
|
||||
buffer.appendInt32(-1407069234)
|
||||
}
|
||||
peer.serialize(buffer, true)
|
||||
serializeInt32(msgId, buffer: buffer, boxed: false)
|
||||
serializeInt32(date, buffer: buffer, boxed: false)
|
||||
actor.serialize(buffer, true)
|
||||
buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(oldReactions.count))
|
||||
for item in oldReactions {
|
||||
item.serialize(buffer, true)
|
||||
}
|
||||
buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(newReactions.count))
|
||||
for item in newReactions {
|
||||
item.serialize(buffer, true)
|
||||
}
|
||||
serializeInt32(qts, buffer: buffer, boxed: false)
|
||||
break
|
||||
case .updateBotMessageReactions(let peer, let msgId, let date, let reactions, let qts):
|
||||
if boxed {
|
||||
buffer.appendInt32(164329305)
|
||||
}
|
||||
peer.serialize(buffer, true)
|
||||
serializeInt32(msgId, buffer: buffer, boxed: false)
|
||||
serializeInt32(date, buffer: buffer, boxed: false)
|
||||
buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(reactions.count))
|
||||
for item in reactions {
|
||||
item.serialize(buffer, true)
|
||||
}
|
||||
serializeInt32(qts, buffer: buffer, boxed: false)
|
||||
break
|
||||
case .updateBotPrecheckoutQuery(let flags, let queryId, let userId, let payload, let info, let shippingOptionId, let currency, let totalAmount):
|
||||
if boxed {
|
||||
buffer.appendInt32(-1934976362)
|
||||
@ -1634,6 +1670,10 @@ public extension Api {
|
||||
return ("updateBotInlineSend", [("flags", flags as Any), ("userId", userId as Any), ("query", query as Any), ("geo", geo as Any), ("id", id as Any), ("msgId", msgId as Any)])
|
||||
case .updateBotMenuButton(let botId, let button):
|
||||
return ("updateBotMenuButton", [("botId", botId as Any), ("button", button as Any)])
|
||||
case .updateBotMessageReaction(let peer, let msgId, let date, let actor, let oldReactions, let newReactions, let qts):
|
||||
return ("updateBotMessageReaction", [("peer", peer as Any), ("msgId", msgId as Any), ("date", date as Any), ("actor", actor as Any), ("oldReactions", oldReactions as Any), ("newReactions", newReactions as Any), ("qts", qts as Any)])
|
||||
case .updateBotMessageReactions(let peer, let msgId, let date, let reactions, let qts):
|
||||
return ("updateBotMessageReactions", [("peer", peer as Any), ("msgId", msgId as Any), ("date", date as Any), ("reactions", reactions as Any), ("qts", qts as Any)])
|
||||
case .updateBotPrecheckoutQuery(let flags, let queryId, let userId, let payload, let info, let shippingOptionId, let currency, let totalAmount):
|
||||
return ("updateBotPrecheckoutQuery", [("flags", flags as Any), ("queryId", queryId as Any), ("userId", userId as Any), ("payload", payload as Any), ("info", info as Any), ("shippingOptionId", shippingOptionId as Any), ("currency", currency as Any), ("totalAmount", totalAmount as Any)])
|
||||
case .updateBotShippingQuery(let queryId, let userId, let payload, let shippingAddress):
|
||||
@ -2050,6 +2090,70 @@ public extension Api {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
public static func parse_updateBotMessageReaction(_ reader: BufferReader) -> Update? {
|
||||
var _1: Api.Peer?
|
||||
if let signature = reader.readInt32() {
|
||||
_1 = Api.parse(reader, signature: signature) as? Api.Peer
|
||||
}
|
||||
var _2: Int32?
|
||||
_2 = reader.readInt32()
|
||||
var _3: Int32?
|
||||
_3 = reader.readInt32()
|
||||
var _4: Api.Peer?
|
||||
if let signature = reader.readInt32() {
|
||||
_4 = Api.parse(reader, signature: signature) as? Api.Peer
|
||||
}
|
||||
var _5: [Api.Reaction]?
|
||||
if let _ = reader.readInt32() {
|
||||
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Reaction.self)
|
||||
}
|
||||
var _6: [Api.Reaction]?
|
||||
if let _ = reader.readInt32() {
|
||||
_6 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Reaction.self)
|
||||
}
|
||||
var _7: Int32?
|
||||
_7 = reader.readInt32()
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = _3 != nil
|
||||
let _c4 = _4 != nil
|
||||
let _c5 = _5 != nil
|
||||
let _c6 = _6 != nil
|
||||
let _c7 = _7 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
|
||||
return Api.Update.updateBotMessageReaction(peer: _1!, msgId: _2!, date: _3!, actor: _4!, oldReactions: _5!, newReactions: _6!, qts: _7!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
public static func parse_updateBotMessageReactions(_ reader: BufferReader) -> Update? {
|
||||
var _1: Api.Peer?
|
||||
if let signature = reader.readInt32() {
|
||||
_1 = Api.parse(reader, signature: signature) as? Api.Peer
|
||||
}
|
||||
var _2: Int32?
|
||||
_2 = reader.readInt32()
|
||||
var _3: Int32?
|
||||
_3 = reader.readInt32()
|
||||
var _4: [Api.ReactionCount]?
|
||||
if let _ = reader.readInt32() {
|
||||
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.ReactionCount.self)
|
||||
}
|
||||
var _5: Int32?
|
||||
_5 = reader.readInt32()
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = _3 != nil
|
||||
let _c4 = _4 != nil
|
||||
let _c5 = _5 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 && _c5 {
|
||||
return Api.Update.updateBotMessageReactions(peer: _1!, msgId: _2!, date: _3!, reactions: _4!, qts: _5!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
public static func parse_updateBotPrecheckoutQuery(_ reader: BufferReader) -> Update? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
|
@ -792,16 +792,16 @@ public extension Api.payments {
|
||||
}
|
||||
public extension Api.payments {
|
||||
enum CheckedGiftCode: TypeConstructorDescription {
|
||||
case checkedGiftCode(flags: Int32, fromId: Api.Peer, giveawayMsgId: Int32?, toId: Int64?, date: Int32, months: Int32, usedDate: Int32?, chats: [Api.Chat], users: [Api.User])
|
||||
case checkedGiftCode(flags: Int32, fromId: Api.Peer?, giveawayMsgId: Int32?, toId: Int64?, date: Int32, months: Int32, usedDate: Int32?, chats: [Api.Chat], users: [Api.User])
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .checkedGiftCode(let flags, let fromId, let giveawayMsgId, let toId, let date, let months, let usedDate, let chats, let users):
|
||||
if boxed {
|
||||
buffer.appendInt32(-1222446760)
|
||||
buffer.appendInt32(675942550)
|
||||
}
|
||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||
fromId.serialize(buffer, true)
|
||||
if Int(flags) & Int(1 << 4) != 0 {fromId!.serialize(buffer, true)}
|
||||
if Int(flags) & Int(1 << 3) != 0 {serializeInt32(giveawayMsgId!, buffer: buffer, boxed: false)}
|
||||
if Int(flags) & Int(1 << 0) != 0 {serializeInt64(toId!, buffer: buffer, boxed: false)}
|
||||
serializeInt32(date, buffer: buffer, boxed: false)
|
||||
@ -832,9 +832,9 @@ public extension Api.payments {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
var _2: Api.Peer?
|
||||
if let signature = reader.readInt32() {
|
||||
if Int(_1!) & Int(1 << 4) != 0 {if let signature = reader.readInt32() {
|
||||
_2 = Api.parse(reader, signature: signature) as? Api.Peer
|
||||
}
|
||||
} }
|
||||
var _3: Int32?
|
||||
if Int(_1!) & Int(1 << 3) != 0 {_3 = reader.readInt32() }
|
||||
var _4: Int64?
|
||||
@ -854,7 +854,7 @@ public extension Api.payments {
|
||||
_9 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
|
||||
}
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c2 = (Int(_1!) & Int(1 << 4) == 0) || _2 != nil
|
||||
let _c3 = (Int(_1!) & Int(1 << 3) == 0) || _3 != nil
|
||||
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
|
||||
let _c5 = _5 != nil
|
||||
@ -863,7 +863,7 @@ public extension Api.payments {
|
||||
let _c8 = _8 != nil
|
||||
let _c9 = _9 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 {
|
||||
return Api.payments.CheckedGiftCode.checkedGiftCode(flags: _1!, fromId: _2!, giveawayMsgId: _3, toId: _4, date: _5!, months: _6!, usedDate: _7, chats: _8!, users: _9!)
|
||||
return Api.payments.CheckedGiftCode.checkedGiftCode(flags: _1!, fromId: _2, giveawayMsgId: _3, toId: _4, date: _5!, months: _6!, usedDate: _7, chats: _8!, users: _9!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
|
@ -522,7 +522,7 @@ public extension Api {
|
||||
}
|
||||
public extension Api {
|
||||
indirect enum Chat: TypeConstructorDescription {
|
||||
case channel(flags: Int32, flags2: Int32, id: Int64, accessHash: Int64?, title: String, username: String?, photo: Api.ChatPhoto, date: Int32, restrictionReason: [Api.RestrictionReason]?, adminRights: Api.ChatAdminRights?, bannedRights: Api.ChatBannedRights?, defaultBannedRights: Api.ChatBannedRights?, participantsCount: Int32?, usernames: [Api.Username]?, storiesMaxId: Int32?, color: Api.PeerColor?, profileColor: Api.PeerColor?)
|
||||
case channel(flags: Int32, flags2: Int32, id: Int64, accessHash: Int64?, title: String, username: String?, photo: Api.ChatPhoto, date: Int32, restrictionReason: [Api.RestrictionReason]?, adminRights: Api.ChatAdminRights?, bannedRights: Api.ChatBannedRights?, defaultBannedRights: Api.ChatBannedRights?, participantsCount: Int32?, usernames: [Api.Username]?, storiesMaxId: Int32?, color: Api.PeerColor?, profileColor: Api.PeerColor?, emojiStatus: Api.EmojiStatus?, level: Int32?)
|
||||
case channelForbidden(flags: Int32, id: Int64, accessHash: Int64, title: String, untilDate: Int32?)
|
||||
case chat(flags: Int32, id: Int64, title: String, photo: Api.ChatPhoto, participantsCount: Int32, date: Int32, version: Int32, migratedTo: Api.InputChannel?, adminRights: Api.ChatAdminRights?, defaultBannedRights: Api.ChatBannedRights?)
|
||||
case chatEmpty(id: Int64)
|
||||
@ -530,9 +530,9 @@ public extension Api {
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .channel(let flags, let flags2, let id, let accessHash, let title, let username, let photo, let date, let restrictionReason, let adminRights, let bannedRights, let defaultBannedRights, let participantsCount, let usernames, let storiesMaxId, let color, let profileColor):
|
||||
case .channel(let flags, let flags2, let id, let accessHash, let title, let username, let photo, let date, let restrictionReason, let adminRights, let bannedRights, let defaultBannedRights, let participantsCount, let usernames, let storiesMaxId, let color, let profileColor, let emojiStatus, let level):
|
||||
if boxed {
|
||||
buffer.appendInt32(-1506368542)
|
||||
buffer.appendInt32(179174543)
|
||||
}
|
||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||
serializeInt32(flags2, buffer: buffer, boxed: false)
|
||||
@ -559,6 +559,8 @@ public extension Api {
|
||||
if Int(flags2) & Int(1 << 4) != 0 {serializeInt32(storiesMaxId!, buffer: buffer, boxed: false)}
|
||||
if Int(flags2) & Int(1 << 7) != 0 {color!.serialize(buffer, true)}
|
||||
if Int(flags2) & Int(1 << 8) != 0 {profileColor!.serialize(buffer, true)}
|
||||
if Int(flags2) & Int(1 << 9) != 0 {emojiStatus!.serialize(buffer, true)}
|
||||
if Int(flags2) & Int(1 << 10) != 0 {serializeInt32(level!, buffer: buffer, boxed: false)}
|
||||
break
|
||||
case .channelForbidden(let flags, let id, let accessHash, let title, let untilDate):
|
||||
if boxed {
|
||||
@ -603,8 +605,8 @@ public extension Api {
|
||||
|
||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||
switch self {
|
||||
case .channel(let flags, let flags2, let id, let accessHash, let title, let username, let photo, let date, let restrictionReason, let adminRights, let bannedRights, let defaultBannedRights, let participantsCount, let usernames, let storiesMaxId, let color, let profileColor):
|
||||
return ("channel", [("flags", flags as Any), ("flags2", flags2 as Any), ("id", id as Any), ("accessHash", accessHash as Any), ("title", title as Any), ("username", username as Any), ("photo", photo as Any), ("date", date as Any), ("restrictionReason", restrictionReason as Any), ("adminRights", adminRights as Any), ("bannedRights", bannedRights as Any), ("defaultBannedRights", defaultBannedRights as Any), ("participantsCount", participantsCount as Any), ("usernames", usernames as Any), ("storiesMaxId", storiesMaxId as Any), ("color", color as Any), ("profileColor", profileColor as Any)])
|
||||
case .channel(let flags, let flags2, let id, let accessHash, let title, let username, let photo, let date, let restrictionReason, let adminRights, let bannedRights, let defaultBannedRights, let participantsCount, let usernames, let storiesMaxId, let color, let profileColor, let emojiStatus, let level):
|
||||
return ("channel", [("flags", flags as Any), ("flags2", flags2 as Any), ("id", id as Any), ("accessHash", accessHash as Any), ("title", title as Any), ("username", username as Any), ("photo", photo as Any), ("date", date as Any), ("restrictionReason", restrictionReason as Any), ("adminRights", adminRights as Any), ("bannedRights", bannedRights as Any), ("defaultBannedRights", defaultBannedRights as Any), ("participantsCount", participantsCount as Any), ("usernames", usernames as Any), ("storiesMaxId", storiesMaxId as Any), ("color", color as Any), ("profileColor", profileColor as Any), ("emojiStatus", emojiStatus as Any), ("level", level as Any)])
|
||||
case .channelForbidden(let flags, let id, let accessHash, let title, let untilDate):
|
||||
return ("channelForbidden", [("flags", flags as Any), ("id", id as Any), ("accessHash", accessHash as Any), ("title", title as Any), ("untilDate", untilDate as Any)])
|
||||
case .chat(let flags, let id, let title, let photo, let participantsCount, let date, let version, let migratedTo, let adminRights, let defaultBannedRights):
|
||||
@ -667,6 +669,12 @@ public extension Api {
|
||||
if Int(_2!) & Int(1 << 8) != 0 {if let signature = reader.readInt32() {
|
||||
_17 = Api.parse(reader, signature: signature) as? Api.PeerColor
|
||||
} }
|
||||
var _18: Api.EmojiStatus?
|
||||
if Int(_2!) & Int(1 << 9) != 0 {if let signature = reader.readInt32() {
|
||||
_18 = Api.parse(reader, signature: signature) as? Api.EmojiStatus
|
||||
} }
|
||||
var _19: Int32?
|
||||
if Int(_2!) & Int(1 << 10) != 0 {_19 = reader.readInt32() }
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = _3 != nil
|
||||
@ -684,8 +692,10 @@ public extension Api {
|
||||
let _c15 = (Int(_2!) & Int(1 << 4) == 0) || _15 != nil
|
||||
let _c16 = (Int(_2!) & Int(1 << 7) == 0) || _16 != nil
|
||||
let _c17 = (Int(_2!) & Int(1 << 8) == 0) || _17 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 && _c13 && _c14 && _c15 && _c16 && _c17 {
|
||||
return Api.Chat.channel(flags: _1!, flags2: _2!, id: _3!, accessHash: _4, title: _5!, username: _6, photo: _7!, date: _8!, restrictionReason: _9, adminRights: _10, bannedRights: _11, defaultBannedRights: _12, participantsCount: _13, usernames: _14, storiesMaxId: _15, color: _16, profileColor: _17)
|
||||
let _c18 = (Int(_2!) & Int(1 << 9) == 0) || _18 != nil
|
||||
let _c19 = (Int(_2!) & Int(1 << 10) == 0) || _19 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 && _c13 && _c14 && _c15 && _c16 && _c17 && _c18 && _c19 {
|
||||
return Api.Chat.channel(flags: _1!, flags2: _2!, id: _3!, accessHash: _4, title: _5!, username: _6, photo: _7!, date: _8!, restrictionReason: _9, adminRights: _10, bannedRights: _11, defaultBannedRights: _12, participantsCount: _13, usernames: _14, storiesMaxId: _15, color: _16, profileColor: _17, emojiStatus: _18, level: _19)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
|
@ -1548,13 +1548,13 @@ public extension Api.stories {
|
||||
}
|
||||
public extension Api.stories {
|
||||
enum StoryViewsList: TypeConstructorDescription {
|
||||
case storyViewsList(flags: Int32, count: Int32, viewsCount: Int32, forwardsCount: Int32, reactionsCount: Int32, views: [Api.StoryView], users: [Api.User], nextOffset: String?)
|
||||
case storyViewsList(flags: Int32, count: Int32, viewsCount: Int32, forwardsCount: Int32, reactionsCount: Int32, views: [Api.StoryView], chats: [Api.Chat], users: [Api.User], nextOffset: String?)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .storyViewsList(let flags, let count, let viewsCount, let forwardsCount, let reactionsCount, let views, let users, let nextOffset):
|
||||
case .storyViewsList(let flags, let count, let viewsCount, let forwardsCount, let reactionsCount, let views, let chats, let users, let nextOffset):
|
||||
if boxed {
|
||||
buffer.appendInt32(430008454)
|
||||
buffer.appendInt32(1507299269)
|
||||
}
|
||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||
serializeInt32(count, buffer: buffer, boxed: false)
|
||||
@ -1567,6 +1567,11 @@ public extension Api.stories {
|
||||
item.serialize(buffer, true)
|
||||
}
|
||||
buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(chats.count))
|
||||
for item in chats {
|
||||
item.serialize(buffer, true)
|
||||
}
|
||||
buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(users.count))
|
||||
for item in users {
|
||||
item.serialize(buffer, true)
|
||||
@ -1578,8 +1583,8 @@ public extension Api.stories {
|
||||
|
||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||
switch self {
|
||||
case .storyViewsList(let flags, let count, let viewsCount, let forwardsCount, let reactionsCount, let views, let users, let nextOffset):
|
||||
return ("storyViewsList", [("flags", flags as Any), ("count", count as Any), ("viewsCount", viewsCount as Any), ("forwardsCount", forwardsCount as Any), ("reactionsCount", reactionsCount as Any), ("views", views as Any), ("users", users as Any), ("nextOffset", nextOffset as Any)])
|
||||
case .storyViewsList(let flags, let count, let viewsCount, let forwardsCount, let reactionsCount, let views, let chats, let users, let nextOffset):
|
||||
return ("storyViewsList", [("flags", flags as Any), ("count", count as Any), ("viewsCount", viewsCount as Any), ("forwardsCount", forwardsCount as Any), ("reactionsCount", reactionsCount as Any), ("views", views as Any), ("chats", chats as Any), ("users", users as Any), ("nextOffset", nextOffset as Any)])
|
||||
}
|
||||
}
|
||||
|
||||
@ -1598,12 +1603,16 @@ public extension Api.stories {
|
||||
if let _ = reader.readInt32() {
|
||||
_6 = Api.parseVector(reader, elementSignature: 0, elementType: Api.StoryView.self)
|
||||
}
|
||||
var _7: [Api.User]?
|
||||
var _7: [Api.Chat]?
|
||||
if let _ = reader.readInt32() {
|
||||
_7 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
|
||||
_7 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
|
||||
}
|
||||
var _8: String?
|
||||
if Int(_1!) & Int(1 << 0) != 0 {_8 = parseString(reader) }
|
||||
var _8: [Api.User]?
|
||||
if let _ = reader.readInt32() {
|
||||
_8 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
|
||||
}
|
||||
var _9: String?
|
||||
if Int(_1!) & Int(1 << 0) != 0 {_9 = parseString(reader) }
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = _3 != nil
|
||||
@ -1611,9 +1620,10 @@ public extension Api.stories {
|
||||
let _c5 = _5 != nil
|
||||
let _c6 = _6 != nil
|
||||
let _c7 = _7 != nil
|
||||
let _c8 = (Int(_1!) & Int(1 << 0) == 0) || _8 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
|
||||
return Api.stories.StoryViewsList.storyViewsList(flags: _1!, count: _2!, viewsCount: _3!, forwardsCount: _4!, reactionsCount: _5!, views: _6!, users: _7!, nextOffset: _8)
|
||||
let _c8 = _8 != nil
|
||||
let _c9 = (Int(_1!) & Int(1 << 0) == 0) || _9 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 {
|
||||
return Api.stories.StoryViewsList.storyViewsList(flags: _1!, count: _2!, viewsCount: _3!, forwardsCount: _4!, reactionsCount: _5!, views: _6!, chats: _7!, users: _8!, nextOffset: _9)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
|
@ -328,6 +328,21 @@ public extension Api.functions.account {
|
||||
})
|
||||
}
|
||||
}
|
||||
public extension Api.functions.account {
|
||||
static func getChannelRestrictedStatusEmojis(hash: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.EmojiList>) {
|
||||
let buffer = Buffer()
|
||||
buffer.appendInt32(900325589)
|
||||
serializeInt64(hash, buffer: buffer, boxed: false)
|
||||
return (FunctionDescription(name: "account.getChannelRestrictedStatusEmojis", parameters: [("hash", String(describing: hash))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.EmojiList? in
|
||||
let reader = BufferReader(buffer)
|
||||
var result: Api.EmojiList?
|
||||
if let signature = reader.readInt32() {
|
||||
result = Api.parse(reader, signature: signature) as? Api.EmojiList
|
||||
}
|
||||
return result
|
||||
})
|
||||
}
|
||||
}
|
||||
public extension Api.functions.account {
|
||||
static func getChatThemes(hash: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.account.Themes>) {
|
||||
let buffer = Buffer()
|
||||
@ -3067,6 +3082,22 @@ public extension Api.functions.channels {
|
||||
})
|
||||
}
|
||||
}
|
||||
public extension Api.functions.channels {
|
||||
static func updateEmojiStatus(channel: Api.InputChannel, emojiStatus: Api.EmojiStatus) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
|
||||
let buffer = Buffer()
|
||||
buffer.appendInt32(-254548312)
|
||||
channel.serialize(buffer, true)
|
||||
emojiStatus.serialize(buffer, true)
|
||||
return (FunctionDescription(name: "channels.updateEmojiStatus", parameters: [("channel", String(describing: channel)), ("emojiStatus", String(describing: emojiStatus))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
|
||||
let reader = BufferReader(buffer)
|
||||
var result: Api.Updates?
|
||||
if let signature = reader.readInt32() {
|
||||
result = Api.parse(reader, signature: signature) as? Api.Updates
|
||||
}
|
||||
return result
|
||||
})
|
||||
}
|
||||
}
|
||||
public extension Api.functions.channels {
|
||||
static func updatePinnedForumTopic(channel: Api.InputChannel, topicId: Int32, pinned: Api.Bool) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
|
||||
let buffer = Buffer()
|
||||
@ -8557,20 +8588,18 @@ public extension Api.functions.stats {
|
||||
}
|
||||
}
|
||||
public extension Api.functions.stats {
|
||||
static func getMessagePublicForwards(channel: Api.InputChannel, msgId: Int32, offsetRate: Int32, offsetPeer: Api.InputPeer, offsetId: Int32, limit: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.Messages>) {
|
||||
static func getMessagePublicForwards(channel: Api.InputChannel, msgId: Int32, offset: String, limit: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.stats.PublicForwards>) {
|
||||
let buffer = Buffer()
|
||||
buffer.appendInt32(1445996571)
|
||||
buffer.appendInt32(1595212100)
|
||||
channel.serialize(buffer, true)
|
||||
serializeInt32(msgId, buffer: buffer, boxed: false)
|
||||
serializeInt32(offsetRate, buffer: buffer, boxed: false)
|
||||
offsetPeer.serialize(buffer, true)
|
||||
serializeInt32(offsetId, buffer: buffer, boxed: false)
|
||||
serializeString(offset, buffer: buffer, boxed: false)
|
||||
serializeInt32(limit, buffer: buffer, boxed: false)
|
||||
return (FunctionDescription(name: "stats.getMessagePublicForwards", parameters: [("channel", String(describing: channel)), ("msgId", String(describing: msgId)), ("offsetRate", String(describing: offsetRate)), ("offsetPeer", String(describing: offsetPeer)), ("offsetId", String(describing: offsetId)), ("limit", String(describing: limit))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Messages? in
|
||||
return (FunctionDescription(name: "stats.getMessagePublicForwards", parameters: [("channel", String(describing: channel)), ("msgId", String(describing: msgId)), ("offset", String(describing: offset)), ("limit", String(describing: limit))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.stats.PublicForwards? in
|
||||
let reader = BufferReader(buffer)
|
||||
var result: Api.messages.Messages?
|
||||
var result: Api.stats.PublicForwards?
|
||||
if let signature = reader.readInt32() {
|
||||
result = Api.parse(reader, signature: signature) as? Api.messages.Messages
|
||||
result = Api.parse(reader, signature: signature) as? Api.stats.PublicForwards
|
||||
}
|
||||
return result
|
||||
})
|
||||
|
@ -839,7 +839,7 @@ class VoiceChatParticipantItemNode: ItemListRevealOptionsItemNode {
|
||||
credibilityIcon = .text(color: item.presentationData.theme.chat.message.incoming.scamColor, string: item.presentationData.strings.Message_ScamAccount.uppercased())
|
||||
} else if item.peer.isFake {
|
||||
credibilityIcon = .text(color: item.presentationData.theme.chat.message.incoming.scamColor, string: item.presentationData.strings.Message_FakeAccount.uppercased())
|
||||
} else if case let .user(user) = item.peer, let emojiStatus = user.emojiStatus, !premiumConfiguration.isPremiumDisabled {
|
||||
} else if let emojiStatus = item.peer.emojiStatus, !premiumConfiguration.isPremiumDisabled {
|
||||
credibilityIcon = .animation(content: .customEmoji(fileId: emojiStatus.fileId), size: CGSize(width: 20.0, height: 20.0), placeholderColor: item.presentationData.theme.list.mediaPlaceholderColor, themeColor: item.presentationData.theme.list.itemAccentColor, loopMode: .count(2))
|
||||
} else if item.peer.isVerified {
|
||||
credibilityIcon = .verified(fillColor: item.presentationData.theme.list.itemCheckColors.fillColor, foregroundColor: item.presentationData.theme.list.itemCheckColors.foregroundColor, sizeType: .compact)
|
||||
|
@ -469,7 +469,7 @@ struct AccountMutableState {
|
||||
|
||||
for chat in chats {
|
||||
switch chat {
|
||||
case let .channel(_, _, _, _, _, _, _, _, _, _, _, _, participantsCount, _, _, _, _):
|
||||
case let .channel(_, _, _, _, _, _, _, _, _, _, _, _, participantsCount, _, _, _, _, _, _):
|
||||
if let participantsCount = participantsCount {
|
||||
self.addOperation(.UpdateCachedPeerData(chat.peerId, { current in
|
||||
var previous: CachedChannelData
|
||||
|
@ -61,7 +61,7 @@ func parseTelegramGroupOrChannel(chat: Api.Chat) -> Peer? {
|
||||
return TelegramGroup(id: PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(id)), title: "", photo: [], participantCount: 0, role: .member, membership: .Removed, flags: [], defaultBannedRights: nil, migrationReference: nil, creationDate: 0, version: 0)
|
||||
case let .chatForbidden(id, title):
|
||||
return TelegramGroup(id: PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(id)), title: title, photo: [], participantCount: 0, role: .member, membership: .Removed, flags: [], defaultBannedRights: nil, migrationReference: nil, creationDate: 0, version: 0)
|
||||
case let .channel(flags, flags2, id, accessHash, title, username, photo, date, restrictionReason, adminRights, bannedRights, defaultBannedRights, _, usernames, _, color, profileColor):
|
||||
case let .channel(flags, flags2, id, accessHash, title, username, photo, date, restrictionReason, adminRights, bannedRights, defaultBannedRights, _, usernames, _, color, profileColor, emojiStatus, boostLevel):
|
||||
let isMin = (flags & (1 << 12)) != 0
|
||||
|
||||
let participationStatus: TelegramChannelParticipationStatus
|
||||
@ -173,7 +173,7 @@ func parseTelegramGroupOrChannel(chat: Api.Chat) -> Peer? {
|
||||
}
|
||||
}
|
||||
|
||||
return TelegramChannel(id: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(id)), accessHash: accessHashValue, title: title, username: username, photo: imageRepresentationsForApiChatPhoto(photo), creationDate: date, version: 0, participationStatus: participationStatus, info: info, flags: channelFlags, restrictionInfo: restrictionInfo, adminRights: adminRights.flatMap(TelegramChatAdminRights.init), bannedRights: bannedRights.flatMap(TelegramChatBannedRights.init), defaultBannedRights: defaultBannedRights.flatMap(TelegramChatBannedRights.init), usernames: usernames?.map(TelegramPeerUsername.init(apiUsername:)) ?? [], storiesHidden: storiesHidden, nameColor: nameColorIndex.flatMap { PeerNameColor(rawValue: $0) }, backgroundEmojiId: backgroundEmojiId, profileColor: profileColorIndex.flatMap { PeerNameColor(rawValue: $0) }, profileBackgroundEmojiId: profileBackgroundEmojiId, emojiStatus: nil)
|
||||
return TelegramChannel(id: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(id)), accessHash: accessHashValue, title: title, username: username, photo: imageRepresentationsForApiChatPhoto(photo), creationDate: date, version: 0, participationStatus: participationStatus, info: info, flags: channelFlags, restrictionInfo: restrictionInfo, adminRights: adminRights.flatMap(TelegramChatAdminRights.init), bannedRights: bannedRights.flatMap(TelegramChatBannedRights.init), defaultBannedRights: defaultBannedRights.flatMap(TelegramChatBannedRights.init), usernames: usernames?.map(TelegramPeerUsername.init(apiUsername:)) ?? [], storiesHidden: storiesHidden, nameColor: nameColorIndex.flatMap { PeerNameColor(rawValue: $0) }, backgroundEmojiId: backgroundEmojiId, profileColor: profileColorIndex.flatMap { PeerNameColor(rawValue: $0) }, profileBackgroundEmojiId: profileBackgroundEmojiId, emojiStatus: emojiStatus.flatMap(PeerEmojiStatus.init(apiStatus:)), approximateBoostLevel: boostLevel)
|
||||
case let .channelForbidden(flags, id, accessHash, title, untilDate):
|
||||
let info: TelegramChannelInfo
|
||||
if (flags & Int32(1 << 8)) != 0 {
|
||||
@ -182,7 +182,7 @@ func parseTelegramGroupOrChannel(chat: Api.Chat) -> Peer? {
|
||||
info = .broadcast(TelegramChannelBroadcastInfo(flags: []))
|
||||
}
|
||||
|
||||
return TelegramChannel(id: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(id)), accessHash: .personal(accessHash), title: title, username: nil, photo: [], creationDate: 0, version: 0, participationStatus: .kicked, info: info, flags: TelegramChannelFlags(), restrictionInfo: nil, adminRights: nil, bannedRights: TelegramChatBannedRights(flags: [.banReadMessages], untilDate: untilDate ?? Int32.max), defaultBannedRights: nil, usernames: [], storiesHidden: nil, nameColor: nil, backgroundEmojiId: nil, profileColor: nil, profileBackgroundEmojiId: nil, emojiStatus: nil)
|
||||
return TelegramChannel(id: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(id)), accessHash: .personal(accessHash), title: title, username: nil, photo: [], creationDate: 0, version: 0, participationStatus: .kicked, info: info, flags: TelegramChannelFlags(), restrictionInfo: nil, adminRights: nil, bannedRights: TelegramChatBannedRights(flags: [.banReadMessages], untilDate: untilDate ?? Int32.max), defaultBannedRights: nil, usernames: [], storiesHidden: nil, nameColor: nil, backgroundEmojiId: nil, profileColor: nil, profileBackgroundEmojiId: nil, emojiStatus: nil, approximateBoostLevel: nil)
|
||||
}
|
||||
}
|
||||
|
||||
@ -190,7 +190,7 @@ func mergeGroupOrChannel(lhs: Peer?, rhs: Api.Chat) -> Peer? {
|
||||
switch rhs {
|
||||
case .chat, .chatEmpty, .chatForbidden, .channelForbidden:
|
||||
return parseTelegramGroupOrChannel(chat: rhs)
|
||||
case let .channel(flags, flags2, _, accessHash, title, username, photo, _, _, _, _, defaultBannedRights, _, usernames, _, color, profileColor):
|
||||
case let .channel(flags, flags2, _, accessHash, title, username, photo, _, _, _, _, defaultBannedRights, _, usernames, _, color, profileColor, emojiStatus, boostLevel):
|
||||
let isMin = (flags & (1 << 12)) != 0
|
||||
if accessHash != nil && !isMin {
|
||||
return parseTelegramGroupOrChannel(chat: rhs)
|
||||
@ -252,9 +252,9 @@ func mergeGroupOrChannel(lhs: Peer?, rhs: Api.Chat) -> Peer? {
|
||||
}
|
||||
}
|
||||
|
||||
let emojiStatus = lhs.emojiStatus
|
||||
let parsedEmojiStatus = emojiStatus.flatMap(PeerEmojiStatus.init(apiStatus:))
|
||||
|
||||
return TelegramChannel(id: lhs.id, accessHash: lhs.accessHash, title: title, username: username, photo: imageRepresentationsForApiChatPhoto(photo), creationDate: lhs.creationDate, version: lhs.version, participationStatus: lhs.participationStatus, info: info, flags: channelFlags, restrictionInfo: lhs.restrictionInfo, adminRights: lhs.adminRights, bannedRights: lhs.bannedRights, defaultBannedRights: defaultBannedRights.flatMap(TelegramChatBannedRights.init), usernames: usernames?.map(TelegramPeerUsername.init(apiUsername:)) ?? [], storiesHidden: storiesHidden, nameColor: nameColorIndex.flatMap { PeerNameColor(rawValue: $0) }, backgroundEmojiId: backgroundEmojiId, profileColor: profileColorIndex.flatMap { PeerNameColor(rawValue: $0) }, profileBackgroundEmojiId: profileBackgroundEmojiId, emojiStatus: emojiStatus)
|
||||
return TelegramChannel(id: lhs.id, accessHash: lhs.accessHash, title: title, username: username, photo: imageRepresentationsForApiChatPhoto(photo), creationDate: lhs.creationDate, version: lhs.version, participationStatus: lhs.participationStatus, info: info, flags: channelFlags, restrictionInfo: lhs.restrictionInfo, adminRights: lhs.adminRights, bannedRights: lhs.bannedRights, defaultBannedRights: defaultBannedRights.flatMap(TelegramChatBannedRights.init), usernames: usernames?.map(TelegramPeerUsername.init(apiUsername:)) ?? [], storiesHidden: storiesHidden, nameColor: nameColorIndex.flatMap { PeerNameColor(rawValue: $0) }, backgroundEmojiId: backgroundEmojiId, profileColor: profileColorIndex.flatMap { PeerNameColor(rawValue: $0) }, profileBackgroundEmojiId: profileBackgroundEmojiId, emojiStatus: parsedEmojiStatus, approximateBoostLevel: boostLevel)
|
||||
} else {
|
||||
return parseTelegramGroupOrChannel(chat: rhs)
|
||||
}
|
||||
@ -308,6 +308,6 @@ func mergeChannel(lhs: TelegramChannel?, rhs: TelegramChannel) -> TelegramChanne
|
||||
|
||||
let storiesHidden: Bool? = rhs.storiesHidden ?? lhs.storiesHidden
|
||||
|
||||
return TelegramChannel(id: lhs.id, accessHash: accessHash, title: rhs.title, username: rhs.username, photo: rhs.photo, creationDate: rhs.creationDate, version: rhs.version, participationStatus: lhs.participationStatus, info: info, flags: channelFlags, restrictionInfo: rhs.restrictionInfo, adminRights: rhs.adminRights, bannedRights: rhs.bannedRights, defaultBannedRights: rhs.defaultBannedRights, usernames: rhs.usernames, storiesHidden: storiesHidden, nameColor: rhs.nameColor, backgroundEmojiId: rhs.backgroundEmojiId, profileColor: rhs.profileColor, profileBackgroundEmojiId: rhs.profileBackgroundEmojiId, emojiStatus: rhs.emojiStatus)
|
||||
return TelegramChannel(id: lhs.id, accessHash: accessHash, title: rhs.title, username: rhs.username, photo: rhs.photo, creationDate: rhs.creationDate, version: rhs.version, participationStatus: lhs.participationStatus, info: info, flags: channelFlags, restrictionInfo: rhs.restrictionInfo, adminRights: rhs.adminRights, bannedRights: rhs.bannedRights, defaultBannedRights: rhs.defaultBannedRights, usernames: rhs.usernames, storiesHidden: storiesHidden, nameColor: rhs.nameColor, backgroundEmojiId: rhs.backgroundEmojiId, profileColor: rhs.profileColor, profileBackgroundEmojiId: rhs.profileBackgroundEmojiId, emojiStatus: rhs.emojiStatus, approximateBoostLevel: rhs.approximateBoostLevel)
|
||||
}
|
||||
|
||||
|
@ -451,7 +451,7 @@ func mediaAreaFromApiMediaArea(_ mediaArea: Api.MediaArea) -> MediaArea? {
|
||||
}
|
||||
}
|
||||
switch mediaArea {
|
||||
case .inputMediaAreaVenue:
|
||||
case .inputMediaAreaVenue, .inputMediaAreaChannelPost:
|
||||
return nil
|
||||
case let .mediaAreaGeoPoint(coordinates, geo):
|
||||
let latitude: Double
|
||||
@ -490,6 +490,8 @@ func mediaAreaFromApiMediaArea(_ mediaArea: Api.MediaArea) -> MediaArea? {
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
case .mediaAreaChannelPost:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -182,7 +182,7 @@ extension Api.Chat {
|
||||
return PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(id))
|
||||
case let .chatForbidden(id, _):
|
||||
return PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(id))
|
||||
case let .channel(_, _, id, _, _, _, _, _, _, _, _, _, _, _, _, _, _):
|
||||
case let .channel(_, _, id, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _):
|
||||
return PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(id))
|
||||
case let .channelForbidden(_, id, _, _, _):
|
||||
return PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(id))
|
||||
|
@ -30,6 +30,9 @@ public struct StickerPackCollectionInfoFlags: OptionSet {
|
||||
if flags.contains(StickerPackCollectionInfoFlags.isEmoji) {
|
||||
rawValue |= StickerPackCollectionInfoFlags.isEmoji.rawValue
|
||||
}
|
||||
if flags.contains(StickerPackCollectionInfoFlags.isAvailableAsChannelStatus) {
|
||||
rawValue |= StickerPackCollectionInfoFlags.isAvailableAsChannelStatus.rawValue
|
||||
}
|
||||
|
||||
self.rawValue = rawValue
|
||||
}
|
||||
@ -39,6 +42,7 @@ public struct StickerPackCollectionInfoFlags: OptionSet {
|
||||
public static let isAnimated = StickerPackCollectionInfoFlags(rawValue: 1 << 2)
|
||||
public static let isVideo = StickerPackCollectionInfoFlags(rawValue: 1 << 3)
|
||||
public static let isEmoji = StickerPackCollectionInfoFlags(rawValue: 1 << 4)
|
||||
public static let isAvailableAsChannelStatus = StickerPackCollectionInfoFlags(rawValue: 1 << 5)
|
||||
}
|
||||
|
||||
|
||||
|
@ -172,6 +172,7 @@ public final class TelegramChannel: Peer, Equatable {
|
||||
public let profileColor: PeerNameColor?
|
||||
public let profileBackgroundEmojiId: Int64?
|
||||
public let emojiStatus: PeerEmojiStatus?
|
||||
public let approximateBoostLevel: Int32?
|
||||
|
||||
public var indexName: PeerIndexNameRepresentation {
|
||||
var addressNames = self.usernames.map { $0.username }
|
||||
@ -236,7 +237,8 @@ public final class TelegramChannel: Peer, Equatable {
|
||||
backgroundEmojiId: Int64?,
|
||||
profileColor: PeerNameColor?,
|
||||
profileBackgroundEmojiId: Int64?,
|
||||
emojiStatus: PeerEmojiStatus?
|
||||
emojiStatus: PeerEmojiStatus?,
|
||||
approximateBoostLevel: Int32?
|
||||
) {
|
||||
self.id = id
|
||||
self.accessHash = accessHash
|
||||
@ -259,6 +261,7 @@ public final class TelegramChannel: Peer, Equatable {
|
||||
self.profileColor = profileColor
|
||||
self.profileBackgroundEmojiId = profileBackgroundEmojiId
|
||||
self.emojiStatus = emojiStatus
|
||||
self.approximateBoostLevel = approximateBoostLevel
|
||||
}
|
||||
|
||||
public init(decoder: PostboxDecoder) {
|
||||
@ -293,6 +296,7 @@ public final class TelegramChannel: Peer, Equatable {
|
||||
self.profileColor = decoder.decodeOptionalInt32ForKey("pclr").flatMap { PeerNameColor(rawValue: $0) }
|
||||
self.profileBackgroundEmojiId = decoder.decodeOptionalInt64ForKey("pgem")
|
||||
self.emojiStatus = decoder.decode(PeerEmojiStatus.self, forKey: "emjs")
|
||||
self.approximateBoostLevel = decoder.decodeOptionalInt32ForKey("abl")
|
||||
}
|
||||
|
||||
public func encode(_ encoder: PostboxEncoder) {
|
||||
@ -378,6 +382,12 @@ public final class TelegramChannel: Peer, Equatable {
|
||||
} else {
|
||||
encoder.encodeNil(forKey: "emjs")
|
||||
}
|
||||
|
||||
if let approximateBoostLevel = self.approximateBoostLevel {
|
||||
encoder.encodeInt32(approximateBoostLevel, forKey: "abl")
|
||||
} else {
|
||||
encoder.encodeNil(forKey: "abl")
|
||||
}
|
||||
}
|
||||
|
||||
public func isEqual(_ other: Peer) -> Bool {
|
||||
@ -433,47 +443,54 @@ public final class TelegramChannel: Peer, Equatable {
|
||||
if lhs.emojiStatus != rhs.emojiStatus {
|
||||
return false
|
||||
}
|
||||
if lhs.approximateBoostLevel != rhs.approximateBoostLevel {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
public func withUpdatedAddressName(_ addressName: String?) -> TelegramChannel {
|
||||
return TelegramChannel(id: self.id, accessHash: self.accessHash, title: self.title, username: addressName, photo: self.photo, creationDate: self.creationDate, version: self.version, participationStatus: self.participationStatus, info: self.info, flags: self.flags, restrictionInfo: self.restrictionInfo, adminRights: self.adminRights, bannedRights: self.bannedRights, defaultBannedRights: self.defaultBannedRights, usernames: self.usernames, storiesHidden: self.storiesHidden, nameColor: self.nameColor, backgroundEmojiId: self.backgroundEmojiId, profileColor: self.profileColor, profileBackgroundEmojiId: self.profileBackgroundEmojiId, emojiStatus: self.emojiStatus)
|
||||
return TelegramChannel(id: self.id, accessHash: self.accessHash, title: self.title, username: addressName, photo: self.photo, creationDate: self.creationDate, version: self.version, participationStatus: self.participationStatus, info: self.info, flags: self.flags, restrictionInfo: self.restrictionInfo, adminRights: self.adminRights, bannedRights: self.bannedRights, defaultBannedRights: self.defaultBannedRights, usernames: self.usernames, storiesHidden: self.storiesHidden, nameColor: self.nameColor, backgroundEmojiId: self.backgroundEmojiId, profileColor: self.profileColor, profileBackgroundEmojiId: self.profileBackgroundEmojiId, emojiStatus: self.emojiStatus, approximateBoostLevel: self.approximateBoostLevel)
|
||||
}
|
||||
|
||||
public func withUpdatedAddressNames(_ addressNames: [TelegramPeerUsername]) -> TelegramChannel {
|
||||
return TelegramChannel(id: self.id, accessHash: self.accessHash, title: self.title, username: self.username, photo: self.photo, creationDate: self.creationDate, version: self.version, participationStatus: self.participationStatus, info: self.info, flags: self.flags, restrictionInfo: self.restrictionInfo, adminRights: self.adminRights, bannedRights: self.bannedRights, defaultBannedRights: self.defaultBannedRights, usernames: addressNames, storiesHidden: self.storiesHidden, nameColor: self.nameColor, backgroundEmojiId: self.backgroundEmojiId, profileColor: self.profileColor, profileBackgroundEmojiId: self.profileBackgroundEmojiId, emojiStatus: self.emojiStatus)
|
||||
return TelegramChannel(id: self.id, accessHash: self.accessHash, title: self.title, username: self.username, photo: self.photo, creationDate: self.creationDate, version: self.version, participationStatus: self.participationStatus, info: self.info, flags: self.flags, restrictionInfo: self.restrictionInfo, adminRights: self.adminRights, bannedRights: self.bannedRights, defaultBannedRights: self.defaultBannedRights, usernames: addressNames, storiesHidden: self.storiesHidden, nameColor: self.nameColor, backgroundEmojiId: self.backgroundEmojiId, profileColor: self.profileColor, profileBackgroundEmojiId: self.profileBackgroundEmojiId, emojiStatus: self.emojiStatus, approximateBoostLevel: self.approximateBoostLevel)
|
||||
}
|
||||
|
||||
public func withUpdatedDefaultBannedRights(_ defaultBannedRights: TelegramChatBannedRights?) -> TelegramChannel {
|
||||
return TelegramChannel(id: self.id, accessHash: self.accessHash, title: self.title, username: self.username, photo: self.photo, creationDate: self.creationDate, version: self.version, participationStatus: self.participationStatus, info: self.info, flags: self.flags, restrictionInfo: self.restrictionInfo, adminRights: self.adminRights, bannedRights: self.bannedRights, defaultBannedRights: defaultBannedRights, usernames: self.usernames, storiesHidden: self.storiesHidden, nameColor: self.nameColor, backgroundEmojiId: self.backgroundEmojiId, profileColor: self.profileColor, profileBackgroundEmojiId: self.profileBackgroundEmojiId, emojiStatus: self.emojiStatus)
|
||||
return TelegramChannel(id: self.id, accessHash: self.accessHash, title: self.title, username: self.username, photo: self.photo, creationDate: self.creationDate, version: self.version, participationStatus: self.participationStatus, info: self.info, flags: self.flags, restrictionInfo: self.restrictionInfo, adminRights: self.adminRights, bannedRights: self.bannedRights, defaultBannedRights: defaultBannedRights, usernames: self.usernames, storiesHidden: self.storiesHidden, nameColor: self.nameColor, backgroundEmojiId: self.backgroundEmojiId, profileColor: self.profileColor, profileBackgroundEmojiId: self.profileBackgroundEmojiId, emojiStatus: self.emojiStatus, approximateBoostLevel: self.approximateBoostLevel)
|
||||
}
|
||||
|
||||
public func withUpdatedFlags(_ flags: TelegramChannelFlags) -> TelegramChannel {
|
||||
return TelegramChannel(id: self.id, accessHash: self.accessHash, title: self.title, username: self.username, photo: self.photo, creationDate: self.creationDate, version: self.version, participationStatus: self.participationStatus, info: self.info, flags: flags, restrictionInfo: self.restrictionInfo, adminRights: self.adminRights, bannedRights: self.bannedRights, defaultBannedRights: self.defaultBannedRights, usernames: self.usernames, storiesHidden: self.storiesHidden, nameColor: self.nameColor, backgroundEmojiId: self.backgroundEmojiId, profileColor: self.profileColor, profileBackgroundEmojiId: self.profileBackgroundEmojiId, emojiStatus: self.emojiStatus)
|
||||
return TelegramChannel(id: self.id, accessHash: self.accessHash, title: self.title, username: self.username, photo: self.photo, creationDate: self.creationDate, version: self.version, participationStatus: self.participationStatus, info: self.info, flags: flags, restrictionInfo: self.restrictionInfo, adminRights: self.adminRights, bannedRights: self.bannedRights, defaultBannedRights: self.defaultBannedRights, usernames: self.usernames, storiesHidden: self.storiesHidden, nameColor: self.nameColor, backgroundEmojiId: self.backgroundEmojiId, profileColor: self.profileColor, profileBackgroundEmojiId: self.profileBackgroundEmojiId, emojiStatus: self.emojiStatus, approximateBoostLevel: self.approximateBoostLevel)
|
||||
}
|
||||
|
||||
public func withUpdatedStoriesHidden(_ storiesHidden: Bool?) -> TelegramChannel {
|
||||
return TelegramChannel(id: self.id, accessHash: self.accessHash, title: self.title, username: self.username, photo: self.photo, creationDate: self.creationDate, version: self.version, participationStatus: self.participationStatus, info: self.info, flags: self.flags, restrictionInfo: self.restrictionInfo, adminRights: self.adminRights, bannedRights: self.bannedRights, defaultBannedRights: self.defaultBannedRights, usernames: self.usernames, storiesHidden: storiesHidden, nameColor: self.nameColor, backgroundEmojiId: self.backgroundEmojiId, profileColor: self.profileColor, profileBackgroundEmojiId: self.profileBackgroundEmojiId, emojiStatus: self.emojiStatus)
|
||||
return TelegramChannel(id: self.id, accessHash: self.accessHash, title: self.title, username: self.username, photo: self.photo, creationDate: self.creationDate, version: self.version, participationStatus: self.participationStatus, info: self.info, flags: self.flags, restrictionInfo: self.restrictionInfo, adminRights: self.adminRights, bannedRights: self.bannedRights, defaultBannedRights: self.defaultBannedRights, usernames: self.usernames, storiesHidden: storiesHidden, nameColor: self.nameColor, backgroundEmojiId: self.backgroundEmojiId, profileColor: self.profileColor, profileBackgroundEmojiId: self.profileBackgroundEmojiId, emojiStatus: self.emojiStatus, approximateBoostLevel: self.approximateBoostLevel)
|
||||
}
|
||||
|
||||
public func withUpdatedNameColor(_ nameColor: PeerNameColor?) -> TelegramChannel {
|
||||
return TelegramChannel(id: self.id, accessHash: self.accessHash, title: self.title, username: self.username, photo: self.photo, creationDate: self.creationDate, version: self.version, participationStatus: self.participationStatus, info: self.info, flags: self.flags, restrictionInfo: self.restrictionInfo, adminRights: self.adminRights, bannedRights: self.bannedRights, defaultBannedRights: self.defaultBannedRights, usernames: self.usernames, storiesHidden: self.storiesHidden, nameColor: nameColor, backgroundEmojiId: self.backgroundEmojiId, profileColor: self.profileColor, profileBackgroundEmojiId: self.profileBackgroundEmojiId, emojiStatus: self.emojiStatus)
|
||||
return TelegramChannel(id: self.id, accessHash: self.accessHash, title: self.title, username: self.username, photo: self.photo, creationDate: self.creationDate, version: self.version, participationStatus: self.participationStatus, info: self.info, flags: self.flags, restrictionInfo: self.restrictionInfo, adminRights: self.adminRights, bannedRights: self.bannedRights, defaultBannedRights: self.defaultBannedRights, usernames: self.usernames, storiesHidden: self.storiesHidden, nameColor: nameColor, backgroundEmojiId: self.backgroundEmojiId, profileColor: self.profileColor, profileBackgroundEmojiId: self.profileBackgroundEmojiId, emojiStatus: self.emojiStatus, approximateBoostLevel: self.approximateBoostLevel)
|
||||
}
|
||||
|
||||
public func withUpdatedBackgroundEmojiId(_ backgroundEmojiId: Int64?) -> TelegramChannel {
|
||||
return TelegramChannel(id: self.id, accessHash: self.accessHash, title: self.title, username: self.username, photo: self.photo, creationDate: self.creationDate, version: self.version, participationStatus: self.participationStatus, info: self.info, flags: self.flags, restrictionInfo: self.restrictionInfo, adminRights: self.adminRights, bannedRights: self.bannedRights, defaultBannedRights: self.defaultBannedRights, usernames: self.usernames, storiesHidden: self.storiesHidden, nameColor: self.nameColor, backgroundEmojiId: backgroundEmojiId, profileColor: self.profileColor, profileBackgroundEmojiId: self.profileBackgroundEmojiId, emojiStatus: self.emojiStatus)
|
||||
return TelegramChannel(id: self.id, accessHash: self.accessHash, title: self.title, username: self.username, photo: self.photo, creationDate: self.creationDate, version: self.version, participationStatus: self.participationStatus, info: self.info, flags: self.flags, restrictionInfo: self.restrictionInfo, adminRights: self.adminRights, bannedRights: self.bannedRights, defaultBannedRights: self.defaultBannedRights, usernames: self.usernames, storiesHidden: self.storiesHidden, nameColor: self.nameColor, backgroundEmojiId: backgroundEmojiId, profileColor: self.profileColor, profileBackgroundEmojiId: self.profileBackgroundEmojiId, emojiStatus: self.emojiStatus, approximateBoostLevel: self.approximateBoostLevel)
|
||||
}
|
||||
|
||||
public func withUpdatedProfileColor(_ profileColor: PeerNameColor?) -> TelegramChannel {
|
||||
return TelegramChannel(id: self.id, accessHash: self.accessHash, title: self.title, username: self.username, photo: self.photo, creationDate: self.creationDate, version: self.version, participationStatus: self.participationStatus, info: self.info, flags: self.flags, restrictionInfo: self.restrictionInfo, adminRights: self.adminRights, bannedRights: self.bannedRights, defaultBannedRights: self.defaultBannedRights, usernames: self.usernames, storiesHidden: self.storiesHidden, nameColor: self.nameColor, backgroundEmojiId: self.backgroundEmojiId, profileColor: profileColor, profileBackgroundEmojiId: self.profileBackgroundEmojiId, emojiStatus: self.emojiStatus)
|
||||
return TelegramChannel(id: self.id, accessHash: self.accessHash, title: self.title, username: self.username, photo: self.photo, creationDate: self.creationDate, version: self.version, participationStatus: self.participationStatus, info: self.info, flags: self.flags, restrictionInfo: self.restrictionInfo, adminRights: self.adminRights, bannedRights: self.bannedRights, defaultBannedRights: self.defaultBannedRights, usernames: self.usernames, storiesHidden: self.storiesHidden, nameColor: self.nameColor, backgroundEmojiId: self.backgroundEmojiId, profileColor: profileColor, profileBackgroundEmojiId: self.profileBackgroundEmojiId, emojiStatus: self.emojiStatus, approximateBoostLevel: self.approximateBoostLevel)
|
||||
}
|
||||
|
||||
public func withUpdatedProfileBackgroundEmojiId(_ profileBackgroundEmojiId: Int64?) -> TelegramChannel {
|
||||
return TelegramChannel(id: self.id, accessHash: self.accessHash, title: self.title, username: self.username, photo: self.photo, creationDate: self.creationDate, version: self.version, participationStatus: self.participationStatus, info: self.info, flags: self.flags, restrictionInfo: self.restrictionInfo, adminRights: self.adminRights, bannedRights: self.bannedRights, defaultBannedRights: self.defaultBannedRights, usernames: self.usernames, storiesHidden: self.storiesHidden, nameColor: self.nameColor, backgroundEmojiId: self.backgroundEmojiId, profileColor: self.profileColor, profileBackgroundEmojiId: profileBackgroundEmojiId, emojiStatus: self.emojiStatus)
|
||||
return TelegramChannel(id: self.id, accessHash: self.accessHash, title: self.title, username: self.username, photo: self.photo, creationDate: self.creationDate, version: self.version, participationStatus: self.participationStatus, info: self.info, flags: self.flags, restrictionInfo: self.restrictionInfo, adminRights: self.adminRights, bannedRights: self.bannedRights, defaultBannedRights: self.defaultBannedRights, usernames: self.usernames, storiesHidden: self.storiesHidden, nameColor: self.nameColor, backgroundEmojiId: self.backgroundEmojiId, profileColor: self.profileColor, profileBackgroundEmojiId: profileBackgroundEmojiId, emojiStatus: self.emojiStatus, approximateBoostLevel: self.approximateBoostLevel)
|
||||
}
|
||||
|
||||
public func withUpdatedEmojiStatus(_ emojiStatus: PeerEmojiStatus?) -> TelegramChannel {
|
||||
return TelegramChannel(id: self.id, accessHash: self.accessHash, title: self.title, username: self.username, photo: self.photo, creationDate: self.creationDate, version: self.version, participationStatus: self.participationStatus, info: self.info, flags: self.flags, restrictionInfo: self.restrictionInfo, adminRights: self.adminRights, bannedRights: self.bannedRights, defaultBannedRights: self.defaultBannedRights, usernames: self.usernames, storiesHidden: self.storiesHidden, nameColor: self.nameColor, backgroundEmojiId: self.backgroundEmojiId, profileColor: self.profileColor, profileBackgroundEmojiId: self.profileBackgroundEmojiId, emojiStatus: emojiStatus)
|
||||
return TelegramChannel(id: self.id, accessHash: self.accessHash, title: self.title, username: self.username, photo: self.photo, creationDate: self.creationDate, version: self.version, participationStatus: self.participationStatus, info: self.info, flags: self.flags, restrictionInfo: self.restrictionInfo, adminRights: self.adminRights, bannedRights: self.bannedRights, defaultBannedRights: self.defaultBannedRights, usernames: self.usernames, storiesHidden: self.storiesHidden, nameColor: self.nameColor, backgroundEmojiId: self.backgroundEmojiId, profileColor: self.profileColor, profileBackgroundEmojiId: self.profileBackgroundEmojiId, emojiStatus: emojiStatus, approximateBoostLevel: self.approximateBoostLevel)
|
||||
}
|
||||
|
||||
public func withUpdatedApproximateBoostLevel(_ approximateBoostLevel: Int32?) -> TelegramChannel {
|
||||
return TelegramChannel(id: self.id, accessHash: self.accessHash, title: self.title, username: self.username, photo: self.photo, creationDate: self.creationDate, version: self.version, participationStatus: self.participationStatus, info: self.info, flags: self.flags, restrictionInfo: self.restrictionInfo, adminRights: self.adminRights, bannedRights: self.bannedRights, defaultBannedRights: self.defaultBannedRights, usernames: self.usernames, storiesHidden: self.storiesHidden, nameColor: self.nameColor, backgroundEmojiId: self.backgroundEmojiId, profileColor: self.profileColor, profileBackgroundEmojiId: self.profileBackgroundEmojiId, emojiStatus: self.emojiStatus, approximateBoostLevel: approximateBoostLevel)
|
||||
}
|
||||
}
|
||||
|
@ -2254,7 +2254,7 @@ func _internal_groupCallDisplayAsAvailablePeers(accountPeerId: PeerId, network:
|
||||
for chat in chats {
|
||||
if let groupOrChannel = parseTelegramGroupOrChannel(chat: chat) {
|
||||
switch chat {
|
||||
case let .channel(_, _, _, _, _, _, _, _, _, _, _, _, participantsCount, _, _, _, _):
|
||||
case let .channel(_, _, _, _, _, _, _, _, _, _, _, _, participantsCount, _, _, _, _, _, _):
|
||||
if let participantsCount = participantsCount {
|
||||
subscribers[groupOrChannel.id] = participantsCount
|
||||
}
|
||||
|
@ -316,7 +316,8 @@ private class AdMessagesHistoryContextImpl {
|
||||
backgroundEmojiId: nil,
|
||||
profileColor: nil,
|
||||
profileBackgroundEmojiId: nil,
|
||||
emojiStatus: nil
|
||||
emojiStatus: nil,
|
||||
approximateBoostLevel: nil
|
||||
)
|
||||
case let .webPage(webPage):
|
||||
author = TelegramChannel(
|
||||
@ -340,7 +341,8 @@ private class AdMessagesHistoryContextImpl {
|
||||
backgroundEmojiId: nil,
|
||||
profileColor: nil,
|
||||
profileBackgroundEmojiId: nil,
|
||||
emojiStatus: nil
|
||||
emojiStatus: nil,
|
||||
approximateBoostLevel: nil
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -465,8 +465,8 @@ public final class EngineStoryViewListContext {
|
||||
|> mapToSignal { result -> Signal<InternalState, NoError> in
|
||||
return account.postbox.transaction { transaction -> InternalState in
|
||||
switch result {
|
||||
case let .storyViewsList(_, count, viewsCount, forwardsCount, reactionsCount, views, users, nextOffset):
|
||||
let peers = AccumulatedPeers(users: users)
|
||||
case let .storyViewsList(_, count, viewsCount, forwardsCount, reactionsCount, views, chats, users, nextOffset):
|
||||
let peers = AccumulatedPeers(chats: chats, users: users)
|
||||
updatePeers(transaction: transaction, accountPeerId: accountPeerId, peers: peers)
|
||||
|
||||
var items: [Item] = []
|
||||
|
@ -375,7 +375,11 @@ func _internal_searchMessages(account: Account, location: SearchMessagesLocation
|
||||
return .complete()
|
||||
}
|
||||
|
||||
let request = Api.functions.stats.getMessagePublicForwards(channel: inputChannel, msgId: messageId.id, offsetRate: nextRate, offsetPeer: inputPeer, offsetId: lowerBound?.id.id ?? 0, limit: limit)
|
||||
//TODO
|
||||
let _ = inputChannel
|
||||
return .complete()
|
||||
|
||||
/*let request = Api.functions.stats.getMessagePublicForwards(channel: inputChannel, msgId: messageId.id, offsetRate: nextRate, offsetPeer: inputPeer, offsetId: lowerBound?.id.id ?? 0, limit: limit)
|
||||
let signal: Signal<Api.messages.Messages, MTRpcError>
|
||||
if let statsDatacenterId = statsDatacenterId, account.network.datacenterId != statsDatacenterId {
|
||||
signal = account.network.download(datacenterId: Int(statsDatacenterId), isMedia: false, tag: nil)
|
||||
@ -392,7 +396,7 @@ func _internal_searchMessages(account: Account, location: SearchMessagesLocation
|
||||
}
|
||||
|> `catch` { _ -> Signal<(Api.messages.Messages?, Api.messages.Messages?), NoError> in
|
||||
return .single((nil, nil))
|
||||
}
|
||||
}*/
|
||||
}
|
||||
case let .sentMedia(tags):
|
||||
let filter: Api.MessagesFilter = tags.flatMap { messageFilterForTagMask($0) } ?? .inputMessagesFilterEmpty
|
||||
|
@ -138,7 +138,7 @@ func _internal_peerSendAsAvailablePeers(accountPeerId: PeerId, network: Network,
|
||||
for chat in chats {
|
||||
if let groupOrChannel = parsedPeers.get(chat.peerId) {
|
||||
switch chat {
|
||||
case let .channel(_, _, _, _, _, _, _, _, _, _, _, _, participantsCount, _, _, _, _):
|
||||
case let .channel(_, _, _, _, _, _, _, _, _, _, _, _, participantsCount, _, _, _, _, _, _):
|
||||
if let participantsCount = participantsCount {
|
||||
subscribers[groupOrChannel.id] = participantsCount
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -5,7 +5,7 @@ import TelegramApi
|
||||
|
||||
public struct PremiumGiftCodeInfo: Equatable {
|
||||
public let slug: String
|
||||
public let fromPeerId: EnginePeer.Id
|
||||
public let fromPeerId: EnginePeer.Id?
|
||||
public let messageId: EngineMessage.Id?
|
||||
public let toPeerId: EnginePeer.Id?
|
||||
public let date: Int32
|
||||
@ -259,8 +259,8 @@ extension PremiumGiftCodeInfo {
|
||||
switch apiCheckedGiftCode {
|
||||
case let .checkedGiftCode(flags, fromId, giveawayMsgId, toId, date, months, usedDate, _, _):
|
||||
self.slug = slug
|
||||
self.fromPeerId = fromId.peerId
|
||||
self.messageId = giveawayMsgId.flatMap { EngineMessage.Id(peerId: fromId.peerId, namespace: Namespaces.Message.Cloud, id: $0) }
|
||||
self.fromPeerId = fromId?.peerId
|
||||
self.messageId = giveawayMsgId.flatMap { giveawayMsgId in fromId.flatMap { fromId in EngineMessage.Id(peerId: fromId.peerId, namespace: Namespaces.Message.Cloud, id: giveawayMsgId) } }
|
||||
self.toPeerId = toId.flatMap { EnginePeer.Id(namespace: Namespaces.Peer.CloudUser, id: EnginePeer.Id.Id._internalFromInt64Value($0)) }
|
||||
self.date = date
|
||||
self.months = months
|
||||
|
@ -595,7 +595,7 @@ func _internal_channelsForStories(account: Account) -> Signal<[Peer], NoError> {
|
||||
if let peer = transaction.getPeer(chat.peerId) {
|
||||
peers.append(peer)
|
||||
|
||||
if case let .channel(_, _, _, _, _, _, _, _, _, _, _, _, participantsCount, _, _, _, _) = chat, let participantsCount = participantsCount {
|
||||
if case let .channel(_, _, _, _, _, _, _, _, _, _, _, _, participantsCount, _, _, _, _, _, _) = chat, let participantsCount = participantsCount {
|
||||
transaction.updatePeerCachedData(peerIds: Set([peer.id]), update: { _, current in
|
||||
var current = current as? CachedChannelData ?? CachedChannelData()
|
||||
var participantsSummary = current.participantsSummary
|
||||
|
@ -360,6 +360,10 @@ func channelAdminLogEvents(accountPeerId: PeerId, postbox: Postbox, network: Net
|
||||
let _ = prevValue
|
||||
let _ = newValue
|
||||
action = nil
|
||||
case let .channelAdminLogEventActionChangeEmojiStatus(prevValue, newValue):
|
||||
let _ = prevValue
|
||||
let _ = newValue
|
||||
action = nil
|
||||
}
|
||||
let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId))
|
||||
if let action = action {
|
||||
|
@ -74,7 +74,7 @@ func _internal_requestRecommendedChannels(account: Account, peerId: EnginePeer.I
|
||||
for chat in chats {
|
||||
if let peer = transaction.getPeer(chat.peerId) {
|
||||
peers.append(EnginePeer(peer))
|
||||
if case let .channel(_, _, _, _, _, _, _, _, _, _, _, _, participantsCount, _, _, _, _) = chat, let participantsCount = participantsCount {
|
||||
if case let .channel(_, _, _, _, _, _, _, _, _, _, _, _, participantsCount, _, _, _, _, _, _) = chat, let participantsCount = participantsCount {
|
||||
transaction.updatePeerCachedData(peerIds: Set([peer.id]), update: { _, current in
|
||||
var current = current as? CachedChannelData ?? CachedChannelData()
|
||||
var participantsSummary = current.participantsSummary
|
||||
|
@ -280,7 +280,7 @@ func _internal_checkChatFolderLink(account: Account, slug: String) -> Signal<Cha
|
||||
var memberCounts: [PeerId: Int] = [:]
|
||||
|
||||
for chat in chats {
|
||||
if case let .channel(_, _, _, _, _, _, _, _, _, _, _, _, participantsCount, _, _, _, _) = chat {
|
||||
if case let .channel(_, _, _, _, _, _, _, _, _, _, _, _, participantsCount, _, _, _, _, _, _) = chat {
|
||||
if let participantsCount = participantsCount {
|
||||
memberCounts[chat.peerId] = Int(participantsCount)
|
||||
}
|
||||
@ -307,7 +307,7 @@ func _internal_checkChatFolderLink(account: Account, slug: String) -> Signal<Cha
|
||||
var memberCounts: [PeerId: Int] = [:]
|
||||
|
||||
for chat in chats {
|
||||
if case let .channel(_, _, _, _, _, _, _, _, _, _, _, _, participantsCount, _, _, _, _) = chat {
|
||||
if case let .channel(_, _, _, _, _, _, _, _, _, _, _, _, participantsCount, _, _, _, _, _, _) = chat {
|
||||
if let participantsCount = participantsCount {
|
||||
memberCounts[chat.peerId] = Int(participantsCount)
|
||||
}
|
||||
@ -621,7 +621,7 @@ func _internal_pollChatFolderUpdatesOnce(account: Account, folderId: Int32) -> S
|
||||
var memberCounts: [ChatListFiltersState.ChatListFilterUpdates.MemberCount] = []
|
||||
|
||||
for chat in chats {
|
||||
if case let .channel(_, _, _, _, _, _, _, _, _, _, _, _, participantsCount, _, _, _, _) = chat {
|
||||
if case let .channel(_, _, _, _, _, _, _, _, _, _, _, _, participantsCount, _, _, _, _, _, _) = chat {
|
||||
if let participantsCount = participantsCount {
|
||||
memberCounts.append(ChatListFiltersState.ChatListFilterUpdates.MemberCount(id: chat.peerId, count: participantsCount))
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ func _internal_inactiveChannelList(network: Network) -> Signal<[InactiveChannel]
|
||||
var participantsCounts: [PeerId: Int32] = [:]
|
||||
for chat in chats {
|
||||
switch chat {
|
||||
case let .channel(_, _, _, _, _, _, _, _, _, _, _, _, participantsCountValue, _, _, _, _):
|
||||
case let .channel(_, _, _, _, _, _, _, _, _, _, _, _, participantsCountValue, _, _, _, _, _, _):
|
||||
if let participantsCountValue = participantsCountValue {
|
||||
participantsCounts[chat.peerId] = participantsCountValue
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ public func _internal_searchPeers(accountPeerId: PeerId, postbox: Postbox, netwo
|
||||
for chat in chats {
|
||||
if let groupOrChannel = parseTelegramGroupOrChannel(chat: chat) {
|
||||
switch chat {
|
||||
case let .channel(_, _, _, _, _, _, _, _, _, _, _, _, participantsCount, _, _, _, _):
|
||||
case let .channel(_, _, _, _, _, _, _, _, _, _, _, _, participantsCount, _, _, _, _, _, _):
|
||||
if let participantsCount = participantsCount {
|
||||
subscribers[groupOrChannel.id] = participantsCount
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ func _internal_requestAccountPrivacySettings(account: Account) -> Signal<Account
|
||||
if let peer = parseTelegramGroupOrChannel(chat: chat) {
|
||||
var participantCount: Int32? = nil
|
||||
switch chat {
|
||||
case let .channel(_, _, _, _, _, _, _, _, _, _, _, _, participantsCountValue, _, _, _, _):
|
||||
case let .channel(_, _, _, _, _, _, _, _, _, _, _, _, participantsCountValue, _, _, _, _, _, _):
|
||||
participantCount = participantsCountValue
|
||||
default:
|
||||
break
|
||||
|
@ -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?
|
||||
|
@ -72,7 +72,7 @@ func updatePeers(transaction: Transaction, accountPeerId: PeerId, peers: Accumul
|
||||
}
|
||||
for (_, chat) in peers.chats {
|
||||
switch chat {
|
||||
case let .channel(flags, flags2, _, _, _, _, _, _, _, _, _, _, _, _, storiesMaxId, _, _):
|
||||
case let .channel(flags, flags2, _, _, _, _, _, _, _, _, _, _, _, _, storiesMaxId, _, _, _, _):
|
||||
let isMin = (flags & (1 << 12)) != 0
|
||||
let storiesUnavailable = (flags2 & (1 << 3)) != 0
|
||||
|
||||
|
@ -1951,11 +1951,14 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI
|
||||
authorNameColor = color
|
||||
|
||||
if case let .peer(peerId) = item.chatLocation, let authorPeerId = item.message.author?.id, authorPeerId == peerId {
|
||||
if effectiveAuthor is TelegramChannel, let emojiStatus = effectiveAuthor.emojiStatus {
|
||||
currentCredibilityIcon = .animation(content: .customEmoji(fileId: emojiStatus.fileId), size: CGSize(width: 20.0, height: 20.0), placeholderColor: incoming ? item.presentationData.theme.theme.chat.message.incoming.mediaPlaceholderColor : item.presentationData.theme.theme.chat.message.outgoing.mediaPlaceholderColor, themeColor: color.withMultipliedAlpha(0.4), loopMode: .count(2))
|
||||
}
|
||||
} else if effectiveAuthor.isScam {
|
||||
currentCredibilityIcon = .text(color: incoming ? item.presentationData.theme.theme.chat.message.incoming.scamColor : item.presentationData.theme.theme.chat.message.outgoing.scamColor, string: item.presentationData.strings.Message_ScamAccount.uppercased())
|
||||
} else if effectiveAuthor.isFake {
|
||||
currentCredibilityIcon = .text(color: incoming ? item.presentationData.theme.theme.chat.message.incoming.scamColor : item.presentationData.theme.theme.chat.message.outgoing.scamColor, string: item.presentationData.strings.Message_FakeAccount.uppercased())
|
||||
} else if let user = effectiveAuthor as? TelegramUser, let emojiStatus = user.emojiStatus {
|
||||
} else if let emojiStatus = effectiveAuthor.emojiStatus {
|
||||
currentCredibilityIcon = .animation(content: .customEmoji(fileId: emojiStatus.fileId), size: CGSize(width: 20.0, height: 20.0), placeholderColor: incoming ? item.presentationData.theme.theme.chat.message.incoming.mediaPlaceholderColor : item.presentationData.theme.theme.chat.message.outgoing.mediaPlaceholderColor, themeColor: color.withMultipliedAlpha(0.4), loopMode: .count(2))
|
||||
} else if effectiveAuthor.isVerified {
|
||||
currentCredibilityIcon = .verified(fillColor: item.presentationData.theme.theme.list.itemCheckColors.fillColor, foregroundColor: item.presentationData.theme.theme.list.itemCheckColors.foregroundColor, sizeType: .compact)
|
||||
|
@ -69,7 +69,7 @@ private func filterOriginalMessageFlags(_ message: Message) -> Message {
|
||||
|
||||
private func filterMessageChannelPeer(_ peer: Peer) -> Peer {
|
||||
if let peer = peer as? TelegramChannel {
|
||||
return TelegramChannel(id: peer.id, accessHash: peer.accessHash, title: peer.title, username: peer.username, photo: peer.photo, creationDate: peer.creationDate, version: peer.version, participationStatus: peer.participationStatus, info: .group(TelegramChannelGroupInfo(flags: [])), flags: peer.flags, restrictionInfo: peer.restrictionInfo, adminRights: peer.adminRights, bannedRights: peer.bannedRights, defaultBannedRights: peer.defaultBannedRights, usernames: peer.usernames, storiesHidden: peer.storiesHidden, nameColor: peer.nameColor, backgroundEmojiId: peer.backgroundEmojiId, profileColor: peer.profileColor, profileBackgroundEmojiId: peer.profileBackgroundEmojiId, emojiStatus: peer.emojiStatus)
|
||||
return TelegramChannel(id: peer.id, accessHash: peer.accessHash, title: peer.title, username: peer.username, photo: peer.photo, creationDate: peer.creationDate, version: peer.version, participationStatus: peer.participationStatus, info: .group(TelegramChannelGroupInfo(flags: [])), flags: peer.flags, restrictionInfo: peer.restrictionInfo, adminRights: peer.adminRights, bannedRights: peer.bannedRights, defaultBannedRights: peer.defaultBannedRights, usernames: peer.usernames, storiesHidden: peer.storiesHidden, nameColor: peer.nameColor, backgroundEmojiId: peer.backgroundEmojiId, profileColor: peer.profileColor, profileBackgroundEmojiId: peer.profileBackgroundEmojiId, emojiStatus: peer.emojiStatus, approximateBoostLevel: peer.approximateBoostLevel)
|
||||
}
|
||||
return peer
|
||||
}
|
||||
|
@ -334,7 +334,6 @@ private final class LineView: UIView {
|
||||
|
||||
let _ = previousParams
|
||||
|
||||
|
||||
self.backgroundView.tintColor = primaryColor
|
||||
|
||||
if let secondaryColor {
|
||||
@ -406,6 +405,10 @@ private final class LineView: UIView {
|
||||
self.dashBackgroundView = nil
|
||||
dashBackgroundView.removeFromSuperview()
|
||||
}
|
||||
if let dashThirdBackgroundView = self.dashThirdBackgroundView {
|
||||
self.dashThirdBackgroundView = nil
|
||||
dashThirdBackgroundView.removeFromSuperview()
|
||||
}
|
||||
|
||||
self.backgroundView.alpha = 1.0
|
||||
}
|
||||
|
@ -257,7 +257,7 @@ public final class ChatTitleView: UIView, NavigationBarTitleView {
|
||||
titleCredibilityIcon = .fake
|
||||
} else if peer.isScam {
|
||||
titleCredibilityIcon = .scam
|
||||
} else if let user = peer as? TelegramUser, let emojiStatus = user.emojiStatus, !premiumConfiguration.isPremiumDisabled {
|
||||
} else if let emojiStatus = peer.emojiStatus, !premiumConfiguration.isPremiumDisabled {
|
||||
titleCredibilityIcon = .emojiStatus(emojiStatus)
|
||||
} else if peer.isVerified {
|
||||
titleCredibilityIcon = .verified
|
||||
|
@ -1043,11 +1043,18 @@ public final class EmojiStatusSelectionController: ViewController {
|
||||
sourceOrigin = CGPoint(x: layout.size.width / 2.0, y: floor(layout.size.height / 2.0 - componentSize.height))
|
||||
}
|
||||
|
||||
var componentFrame: CGRect
|
||||
let pointsToTop: Bool
|
||||
if sourceOrigin.y + 5.0 + componentSize.height > layout.size.height - layout.insets(options: []).bottom {
|
||||
sourceOrigin.y = layout.size.height - layout.insets(options: []).bottom - componentSize.height - 5.0
|
||||
componentFrame = CGRect(origin: CGPoint(x: floor((layout.size.width - componentSize.width) / 2.0), y: sourceOrigin.y - 25.0 - componentSize.height), size: componentSize)
|
||||
pointsToTop = false
|
||||
} else {
|
||||
componentFrame = CGRect(origin: CGPoint(x: floor((layout.size.width - componentSize.width) / 2.0), y: sourceOrigin.y + 5.0), size: componentSize)
|
||||
pointsToTop = true
|
||||
}
|
||||
if componentFrame.minY < layout.insets(options: [.statusBar]).top {
|
||||
componentFrame.origin.y = layout.insets(options: [.statusBar]).top
|
||||
}
|
||||
|
||||
let componentFrame = CGRect(origin: CGPoint(x: floor((layout.size.width - componentSize.width) / 2.0), y: sourceOrigin.y + 5.0), size: componentSize)
|
||||
|
||||
if self.componentShadowLayer.bounds.size != componentFrame.size {
|
||||
let componentShadowPath = UIBezierPath(roundedRect: CGRect(origin: CGPoint(), size: componentFrame.size), cornerRadius: 24.0).cgPath
|
||||
@ -1057,7 +1064,12 @@ public final class EmojiStatusSelectionController: ViewController {
|
||||
|
||||
let cloudOffset0: CGFloat = 30.0
|
||||
let cloudSize0: CGFloat = 16.0
|
||||
var cloudFrame0 = CGRect(origin: CGPoint(x: floor(sourceOrigin.x + cloudOffset0 - cloudSize0 / 2.0), y: componentFrame.minY - cloudSize0 / 2.0), size: CGSize(width: cloudSize0, height: cloudSize0))
|
||||
var cloudFrame0: CGRect
|
||||
if pointsToTop {
|
||||
cloudFrame0 = CGRect(origin: CGPoint(x: floor(sourceOrigin.x + cloudOffset0 - cloudSize0 / 2.0), y: componentFrame.minY - cloudSize0 / 2.0), size: CGSize(width: cloudSize0, height: cloudSize0))
|
||||
} else {
|
||||
cloudFrame0 = CGRect(origin: CGPoint(x: floor(sourceOrigin.x + cloudOffset0 - cloudSize0 / 2.0), y: componentFrame.maxY - cloudSize0 / 2.0), size: CGSize(width: cloudSize0, height: cloudSize0))
|
||||
}
|
||||
var invertX = false
|
||||
if cloudFrame0.maxX >= layout.size.width - layout.safeInsets.right - 32.0 {
|
||||
cloudFrame0.origin.x = floor(sourceOrigin.x - cloudSize0 - cloudOffset0 + cloudSize0 / 2.0)
|
||||
@ -1074,7 +1086,12 @@ public final class EmojiStatusSelectionController: ViewController {
|
||||
|
||||
let cloudOffset1 = CGPoint(x: -9.0, y: -14.0)
|
||||
let cloudSize1: CGFloat = 8.0
|
||||
var cloudFrame1 = CGRect(origin: CGPoint(x: floor(cloudFrame0.midX + cloudOffset1.x - cloudSize1 / 2.0), y: floor(cloudFrame0.midY + cloudOffset1.y - cloudSize1 / 2.0)), size: CGSize(width: cloudSize1, height: cloudSize1))
|
||||
var cloudFrame1: CGRect
|
||||
if pointsToTop {
|
||||
cloudFrame1 = CGRect(origin: CGPoint(x: floor(cloudFrame0.midX + cloudOffset1.x - cloudSize1 / 2.0), y: floor(cloudFrame0.midY + cloudOffset1.y - cloudSize1 / 2.0)), size: CGSize(width: cloudSize1, height: cloudSize1))
|
||||
} else {
|
||||
cloudFrame1 = CGRect(origin: CGPoint(x: floor(cloudFrame0.midX + cloudOffset1.x - cloudSize1 / 2.0), y: floor(cloudFrame0.midY - cloudOffset1.y - cloudSize1 / 2.0)), size: CGSize(width: cloudSize1, height: cloudSize1))
|
||||
}
|
||||
if invertX {
|
||||
cloudFrame1.origin.x = floor(cloudFrame0.midX - cloudSize1 - cloudOffset1.x + cloudSize1 / 2.0)
|
||||
}
|
||||
@ -1095,7 +1112,7 @@ public final class EmojiStatusSelectionController: ViewController {
|
||||
|
||||
let contentDuration: Double = 0.3
|
||||
let contentDelay: Double = 0.14
|
||||
let initialContentFrame = CGRect(origin: CGPoint(x: cloudFrame0.midX - 24.0, y: componentFrame.minY), size: CGSize(width: 24.0 * 2.0, height: 24.0 * 2.0))
|
||||
let initialContentFrame = CGRect(origin: CGPoint(x: cloudFrame0.midX - 24.0, y: pointsToTop ? componentFrame.minY : (componentFrame.maxY - 24.0 * 2.0)), size: CGSize(width: 24.0 * 2.0, height: 24.0 * 2.0))
|
||||
|
||||
if let emojiView = self.componentHost.findTaggedView(tag: EmojiPagerContentComponent.Tag(id: AnyHashable("emoji"))) as? EmojiPagerContentComponent.View {
|
||||
emojiView.animateIn(fromLocation: self.view.convert(initialContentFrame.center, to: emojiView))
|
||||
@ -1103,7 +1120,7 @@ public final class EmojiStatusSelectionController: ViewController {
|
||||
|
||||
componentView.layer.animatePosition(from: initialContentFrame.center, to: componentFrame.center, duration: contentDuration, delay: contentDelay, timingFunction: kCAMediaTimingFunctionSpring)
|
||||
componentView.layer.animateBounds(from: CGRect(origin: CGPoint(x: -(componentFrame.minX - initialContentFrame.minX), y: -(componentFrame.minY - initialContentFrame.minY)), size: initialContentFrame.size), to: CGRect(origin: CGPoint(), size: componentFrame.size), duration: contentDuration, delay: contentDelay, timingFunction: kCAMediaTimingFunctionSpring)
|
||||
self.componentShadowLayer.animateFrame(from: CGRect(origin: CGPoint(x: cloudFrame0.midX - 24.0, y: componentFrame.minY), size: CGSize(width: 24.0 * 2.0, height: 24.0 * 2.0)), to: componentView.frame, duration: contentDuration, delay: contentDelay, timingFunction: kCAMediaTimingFunctionSpring)
|
||||
self.componentShadowLayer.animateFrame(from: CGRect(origin: CGPoint(x: cloudFrame0.midX - 24.0, y: pointsToTop ? componentFrame.minY : (componentFrame.maxY - 24.0 * 2.0)), size: CGSize(width: 24.0 * 2.0, height: 24.0 * 2.0)), to: componentView.frame, duration: contentDuration, delay: contentDelay, timingFunction: kCAMediaTimingFunctionSpring)
|
||||
componentView.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.04, delay: contentDelay)
|
||||
self.componentShadowLayer.animateAlpha(from: 0.0, to: 1.0, duration: 0.04, delay: contentDelay)
|
||||
|
||||
@ -1283,7 +1300,17 @@ public final class EmojiStatusSelectionController: ViewController {
|
||||
return
|
||||
}
|
||||
|
||||
if let _ = item, let destinationView = controller.destinationItemView() {
|
||||
var animateOutToView = false
|
||||
switch controller.mode {
|
||||
case .backgroundSelection, .customStatusSelection, .quickReactionSelection:
|
||||
if let itemFile = item?.itemFile, itemFile.fileId.id != 0 {
|
||||
animateOutToView = true
|
||||
}
|
||||
case .statusSelection:
|
||||
animateOutToView = true
|
||||
}
|
||||
|
||||
if animateOutToView, item != nil, let destinationView = controller.destinationItemView() {
|
||||
if let snapshotView = destinationView.snapshotView(afterScreenUpdates: false) {
|
||||
snapshotView.frame = destinationView.frame
|
||||
destinationView.superview?.insertSubview(snapshotView, belowSubview: destinationView)
|
||||
@ -1299,7 +1326,9 @@ public final class EmojiStatusSelectionController: ViewController {
|
||||
let _ = (self.context.engine.accountData.setEmojiStatus(file: item?.itemFile, expirationDate: nil)
|
||||
|> deliverOnMainQueue).start()
|
||||
case let .backgroundSelection(completion):
|
||||
completion(item?.itemFile?.fileId.id)
|
||||
completion(item?.itemFile)
|
||||
case let .customStatusSelection(completion):
|
||||
completion(item?.itemFile, nil)
|
||||
case let .quickReactionSelection(completion):
|
||||
if let item = item, let itemFile = item.itemFile {
|
||||
var selectedReaction: MessageReaction.Reaction?
|
||||
@ -1325,7 +1354,7 @@ public final class EmojiStatusSelectionController: ViewController {
|
||||
completion()
|
||||
}
|
||||
|
||||
if let item = item, let destinationView = controller.destinationItemView() {
|
||||
if animateOutToView, let item = item, let destinationView = controller.destinationItemView() {
|
||||
var emojiString: String?
|
||||
if let itemFile = item.itemFile {
|
||||
attributeLoop: for attribute in itemFile.attributes {
|
||||
@ -1385,7 +1414,8 @@ public final class EmojiStatusSelectionController: ViewController {
|
||||
|
||||
public enum Mode {
|
||||
case statusSelection
|
||||
case backgroundSelection(completion: (Int64?) -> Void)
|
||||
case backgroundSelection(completion: (TelegramMediaFile?) -> Void)
|
||||
case customStatusSelection(completion: (TelegramMediaFile?, Int32?) -> Void)
|
||||
case quickReactionSelection(completion: () -> Void)
|
||||
}
|
||||
|
||||
|
@ -7188,6 +7188,7 @@ public final class EmojiPagerContentComponent: Component {
|
||||
public enum Subject: Equatable {
|
||||
case generic
|
||||
case status
|
||||
case channelStatus
|
||||
case reaction(onlyTop: Bool)
|
||||
case emoji
|
||||
case topicIcon
|
||||
@ -7239,6 +7240,19 @@ public final class EmojiPagerContentComponent: Component {
|
||||
orderedItemListCollectionIds.append(Namespaces.OrderedItemList.CloudFeaturedStatusEmoji)
|
||||
orderedItemListCollectionIds.append(Namespaces.OrderedItemList.CloudRecentStatusEmoji)
|
||||
|
||||
iconStatusEmoji = context.engine.stickers.loadedStickerPack(reference: .iconStatusEmoji, forceActualized: false)
|
||||
|> map { result -> [TelegramMediaFile] in
|
||||
switch result {
|
||||
case let .result(_, items, _):
|
||||
return items.map(\.file)
|
||||
default:
|
||||
return []
|
||||
}
|
||||
}
|
||||
|> take(1)
|
||||
} else if case .channelStatus = subject {
|
||||
orderedItemListCollectionIds.append(Namespaces.OrderedItemList.CloudFeaturedStatusEmoji)
|
||||
|
||||
iconStatusEmoji = context.engine.stickers.loadedStickerPack(reference: .iconStatusEmoji, forceActualized: false)
|
||||
|> map { result -> [TelegramMediaFile] in
|
||||
switch result {
|
||||
@ -7283,6 +7297,8 @@ public final class EmojiPagerContentComponent: Component {
|
||||
searchCategories = context.engine.stickers.emojiSearchCategories(kind: .emoji)
|
||||
} else if case .status = subject {
|
||||
searchCategories = context.engine.stickers.emojiSearchCategories(kind: .status)
|
||||
} else if case .channelStatus = subject {
|
||||
searchCategories = context.engine.stickers.emojiSearchCategories(kind: .status)
|
||||
} else if [.profilePhoto, .groupPhoto].contains(subject) {
|
||||
searchCategories = context.engine.stickers.emojiSearchCategories(kind: .avatar)
|
||||
} else {
|
||||
@ -7564,6 +7580,166 @@ public final class EmojiPagerContentComponent: Component {
|
||||
}
|
||||
}
|
||||
|
||||
if let recentStatusEmoji = recentStatusEmoji {
|
||||
for item in recentStatusEmoji.items {
|
||||
guard let item = item.contents.get(RecentMediaItem.self) else {
|
||||
continue
|
||||
}
|
||||
|
||||
let file = item.media
|
||||
if existingIds.contains(file.fileId) {
|
||||
continue
|
||||
}
|
||||
existingIds.insert(file.fileId)
|
||||
|
||||
var tintMode: Item.TintMode = .none
|
||||
if file.isCustomTemplateEmoji {
|
||||
tintMode = .accent
|
||||
}
|
||||
for attribute in file.attributes {
|
||||
if case let .CustomEmoji(_, _, _, packReference) = attribute {
|
||||
switch packReference {
|
||||
case let .id(id, _):
|
||||
if id == 773947703670341676 || id == 2964141614563343 {
|
||||
tintMode = .accent
|
||||
}
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let resultItem: EmojiPagerContentComponent.Item
|
||||
|
||||
let animationData = EntityKeyboardAnimationData(file: file)
|
||||
resultItem = EmojiPagerContentComponent.Item(
|
||||
animationData: animationData,
|
||||
content: .animation(animationData),
|
||||
itemFile: file,
|
||||
subgroupId: nil,
|
||||
icon: .none,
|
||||
tintMode: tintMode
|
||||
)
|
||||
|
||||
if let groupIndex = itemGroupIndexById[groupId] {
|
||||
if itemGroups[groupIndex].items.count >= (5 + 8) * 8 {
|
||||
break
|
||||
}
|
||||
|
||||
itemGroups[groupIndex].items.append(resultItem)
|
||||
}
|
||||
}
|
||||
}
|
||||
if let featuredStatusEmoji = featuredStatusEmoji {
|
||||
for item in featuredStatusEmoji.items {
|
||||
guard let item = item.contents.get(RecentMediaItem.self) else {
|
||||
continue
|
||||
}
|
||||
|
||||
let file = item.media
|
||||
if existingIds.contains(file.fileId) {
|
||||
continue
|
||||
}
|
||||
existingIds.insert(file.fileId)
|
||||
|
||||
let resultItem: EmojiPagerContentComponent.Item
|
||||
|
||||
var tintMode: Item.TintMode = .none
|
||||
if file.isCustomTemplateEmoji {
|
||||
tintMode = .accent
|
||||
}
|
||||
for attribute in file.attributes {
|
||||
if case let .CustomEmoji(_, _, _, packReference) = attribute {
|
||||
switch packReference {
|
||||
case let .id(id, _):
|
||||
if id == 773947703670341676 || id == 2964141614563343 {
|
||||
tintMode = .accent
|
||||
}
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let animationData = EntityKeyboardAnimationData(file: file)
|
||||
resultItem = EmojiPagerContentComponent.Item(
|
||||
animationData: animationData,
|
||||
content: .animation(animationData),
|
||||
itemFile: file,
|
||||
subgroupId: nil,
|
||||
icon: .none,
|
||||
tintMode: tintMode
|
||||
)
|
||||
|
||||
if let groupIndex = itemGroupIndexById[groupId] {
|
||||
if itemGroups[groupIndex].items.count >= (5 + 8) * 8 {
|
||||
break
|
||||
}
|
||||
|
||||
itemGroups[groupIndex].items.append(resultItem)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if case .channelStatus = subject {
|
||||
let resultItem = EmojiPagerContentComponent.Item(
|
||||
animationData: nil,
|
||||
content: .icon(.stop),
|
||||
itemFile: nil,
|
||||
subgroupId: nil,
|
||||
icon: .none,
|
||||
tintMode: .accent
|
||||
)
|
||||
|
||||
let groupId = "recent"
|
||||
if let groupIndex = itemGroupIndexById[groupId] {
|
||||
itemGroups[groupIndex].items.append(resultItem)
|
||||
} else {
|
||||
itemGroupIndexById[groupId] = itemGroups.count
|
||||
itemGroups.append(ItemGroup(supergroupId: groupId, id: groupId, title: topStatusTitle?.uppercased(), subtitle: nil, isPremiumLocked: false, isFeatured: false, collapsedLineCount: 5, isClearable: false, headerItem: nil, items: [resultItem]))
|
||||
}
|
||||
|
||||
var existingIds = Set<MediaId>()
|
||||
|
||||
for file in iconStatusEmoji.prefix(7) {
|
||||
if existingIds.contains(file.fileId) {
|
||||
continue
|
||||
}
|
||||
existingIds.insert(file.fileId)
|
||||
|
||||
var tintMode: Item.TintMode = .none
|
||||
if file.isCustomTemplateEmoji {
|
||||
tintMode = .accent
|
||||
}
|
||||
for attribute in file.attributes {
|
||||
if case let .CustomEmoji(_, _, _, packReference) = attribute {
|
||||
switch packReference {
|
||||
case let .id(id, _):
|
||||
if id == 773947703670341676 || id == 2964141614563343 {
|
||||
tintMode = .accent
|
||||
}
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let resultItem: EmojiPagerContentComponent.Item
|
||||
|
||||
let animationData = EntityKeyboardAnimationData(file: file)
|
||||
resultItem = EmojiPagerContentComponent.Item(
|
||||
animationData: animationData,
|
||||
content: .animation(animationData),
|
||||
itemFile: file,
|
||||
subgroupId: nil,
|
||||
icon: .none,
|
||||
tintMode: tintMode
|
||||
)
|
||||
|
||||
if let groupIndex = itemGroupIndexById[groupId] {
|
||||
itemGroups[groupIndex].items.append(resultItem)
|
||||
}
|
||||
}
|
||||
|
||||
if let recentStatusEmoji = recentStatusEmoji {
|
||||
for item in recentStatusEmoji.items {
|
||||
guard let item = item.contents.get(RecentMediaItem.self) else {
|
||||
@ -8143,7 +8319,7 @@ public final class EmojiPagerContentComponent: Component {
|
||||
var isTemplate = false
|
||||
var tintMode: Item.TintMode = .none
|
||||
if item.file.isCustomTemplateEmoji {
|
||||
if [.status, .backgroundIcon].contains(subject) {
|
||||
if [.status, .channelStatus, .backgroundIcon].contains(subject) {
|
||||
if let backgroundIconColor {
|
||||
tintMode = .custom(backgroundIconColor)
|
||||
} else {
|
||||
@ -8229,7 +8405,7 @@ public final class EmojiPagerContentComponent: Component {
|
||||
for item in featuredEmojiPack.topItems {
|
||||
var tintMode: Item.TintMode = .none
|
||||
if item.file.isCustomTemplateEmoji {
|
||||
if [.status, .backgroundIcon].contains(subject) {
|
||||
if [.status, .channelStatus, .backgroundIcon].contains(subject) {
|
||||
if let backgroundIconColor {
|
||||
tintMode = .custom(backgroundIconColor)
|
||||
} else {
|
||||
@ -8361,8 +8537,8 @@ public final class EmojiPagerContentComponent: Component {
|
||||
)
|
||||
}
|
||||
|
||||
let warpContentsOnEdges = [.reaction(onlyTop: true), .reaction(onlyTop: false), .quickReaction, .status, .profilePhoto, .groupPhoto, .backgroundIcon].contains(subject)
|
||||
let enableLongPress = [.reaction(onlyTop: true), .reaction(onlyTop: false), .status].contains(subject)
|
||||
let warpContentsOnEdges = [.reaction(onlyTop: true), .reaction(onlyTop: false), .quickReaction, .status, .channelStatus, .profilePhoto, .groupPhoto, .backgroundIcon].contains(subject)
|
||||
let enableLongPress = [.reaction(onlyTop: true), .reaction(onlyTop: false), .status, .channelStatus].contains(subject)
|
||||
|
||||
return EmojiPagerContentComponent(
|
||||
id: "emoji",
|
||||
|
@ -332,7 +332,7 @@ private func notificationsPeerCategoryEntries(peerId: EnginePeer.Id, notificatio
|
||||
}
|
||||
}
|
||||
existingThreadIds.insert(value.threadId)
|
||||
entries.append(.exception(Int32(index), presentationData.dateTimeFormat, presentationData.nameDisplayOrder, .channel(TelegramChannel(id: peerId, accessHash: nil, title: "", username: nil, photo: [], creationDate: 0, version: 0, participationStatus: .member, info: .group(TelegramChannelGroupInfo(flags: [])), flags: [.isForum], restrictionInfo: nil, adminRights: nil, bannedRights: nil, defaultBannedRights: nil, usernames: [], storiesHidden: nil, nameColor: nil, backgroundEmojiId: nil, profileColor: nil, profileBackgroundEmojiId: nil, emojiStatus: nil)), value.threadId, value.info, title, value.notificationSettings._asNotificationSettings(), state.editing, state.revealedThreadId == value.threadId))
|
||||
entries.append(.exception(Int32(index), presentationData.dateTimeFormat, presentationData.nameDisplayOrder, .channel(TelegramChannel(id: peerId, accessHash: nil, title: "", username: nil, photo: [], creationDate: 0, version: 0, participationStatus: .member, info: .group(TelegramChannelGroupInfo(flags: [])), flags: [.isForum], restrictionInfo: nil, adminRights: nil, bannedRights: nil, defaultBannedRights: nil, usernames: [], storiesHidden: nil, nameColor: nil, backgroundEmojiId: nil, profileColor: nil, profileBackgroundEmojiId: nil, emojiStatus: nil, approximateBoostLevel: nil)), value.threadId, value.info, title, value.notificationSettings._asNotificationSettings(), state.editing, state.revealedThreadId == value.threadId))
|
||||
index += 1
|
||||
}
|
||||
|
||||
|
@ -476,7 +476,7 @@ final class PeerInfoHeaderNode: ASDisplayNode {
|
||||
credibilityIcon = .fake
|
||||
} else if peer.isScam {
|
||||
credibilityIcon = .scam
|
||||
} else if let user = peer as? TelegramUser, let emojiStatus = user.emojiStatus, !premiumConfiguration.isPremiumDisabled {
|
||||
} else if let emojiStatus = peer.emojiStatus, !premiumConfiguration.isPremiumDisabled {
|
||||
credibilityIcon = .emojiStatus(emojiStatus)
|
||||
} else if peer.isVerified {
|
||||
credibilityIcon = .verified
|
||||
|
@ -1676,7 +1676,11 @@ private func editingItems(data: PeerInfoScreenData?, state: PeerInfoState, chatL
|
||||
let colorImage = generateSettingsMenuPeerColorsLabelIcon(colors: colors)
|
||||
|
||||
//TODO:localize
|
||||
items[.peerSettings]!.append(PeerInfoScreenDisclosureItem(id: ItemPeerColor, label: .image(colorImage, colorImage.size), additionalBadgeIcon: generateDisclosureActionBoostLevelBadgeImage(text: "Level 1+"), text: "Appearance", icon: UIImage(bundleImageName: "Chat/Info/NameColorIcon"), action: {
|
||||
var boostIcon: UIImage?
|
||||
if let approximateBoostLevel = channel.approximateBoostLevel, approximateBoostLevel < 1 {
|
||||
boostIcon = generateDisclosureActionBoostLevelBadgeImage(text: "Level 1+")
|
||||
}
|
||||
items[.peerSettings]!.append(PeerInfoScreenDisclosureItem(id: ItemPeerColor, label: .image(colorImage, colorImage.size), additionalBadgeIcon: boostIcon, text: "Appearance", icon: UIImage(bundleImageName: "Chat/Info/NameColorIcon"), action: {
|
||||
interaction.editingOpenNameColorSetup()
|
||||
}))
|
||||
|
||||
@ -3836,7 +3840,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
|
||||
var currentSelectedFileId: Int64?
|
||||
var topStatusTitle = strongSelf.presentationData.strings.PeerStatusSetup_NoTimerTitle
|
||||
if let peer = strongSelf.data?.peer {
|
||||
if let user = peer as? TelegramUser, let emojiStatus = user.emojiStatus {
|
||||
if let emojiStatus = peer.emojiStatus {
|
||||
selectedItems.insert(MediaId(namespace: Namespaces.Media.CloudFile, id: emojiStatus.fileId))
|
||||
currentSelectedFileId = emojiStatus.fileId
|
||||
|
||||
@ -12214,7 +12218,7 @@ private final class AccountPeerContextItemNode: ASDisplayNode, ContextMenuCustom
|
||||
|
||||
self.avatarNode.setPeer(context: self.item.context, account: self.item.account, theme: self.presentationData.theme, peer: self.item.peer)
|
||||
|
||||
if case let .user(user) = self.item.peer, let _ = user.emojiStatus {
|
||||
if self.item.peer.emojiStatus != nil {
|
||||
rightTextInset += 32.0
|
||||
}
|
||||
|
||||
@ -12232,6 +12236,10 @@ private final class AccountPeerContextItemNode: ASDisplayNode, ContextMenuCustom
|
||||
} else if user.isPremium {
|
||||
iconContent = .premium(color: self.presentationData.theme.list.itemAccentColor)
|
||||
}
|
||||
} else if case let .channel(channel) = self.item.peer {
|
||||
if let emojiStatus = channel.emojiStatus {
|
||||
iconContent = .animation(content: .customEmoji(fileId: emojiStatus.fileId), size: CGSize(width: 28.0, height: 28.0), placeholderColor: self.presentationData.theme.list.mediaPlaceholderColor, themeColor: self.presentationData.theme.list.itemAccentColor, loopMode: .forever)
|
||||
}
|
||||
}
|
||||
if let iconContent {
|
||||
let emojiStatusSize = self.emojiStatusView.update(
|
||||
|
@ -42,6 +42,7 @@ swift_library(
|
||||
"//submodules/TelegramUI/Components/EmojiStatusSelectionComponent",
|
||||
"//submodules/TelegramUI/Components/DynamicCornerRadiusView",
|
||||
"//submodules/Components/ComponentDisplayAdapters",
|
||||
"//submodules/WallpaperResources",
|
||||
],
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
|
@ -28,6 +28,7 @@ import EmojiStatusSelectionComponent
|
||||
import EmojiStatusComponent
|
||||
import DynamicCornerRadiusView
|
||||
import ComponentDisplayAdapters
|
||||
import WallpaperResources
|
||||
|
||||
private final class EmojiActionIconComponent: Component {
|
||||
let context: AccountContext
|
||||
@ -285,6 +286,25 @@ final class ChannelAppearanceScreenComponent: Component {
|
||||
}
|
||||
}
|
||||
|
||||
private struct ResolvedState {
|
||||
var nameColor: PeerNameColor
|
||||
var profileColor: PeerNameColor?
|
||||
var replyFileId: Int64?
|
||||
var backgroundFileId: Int64?
|
||||
var emojiStatus: PeerEmojiStatus?
|
||||
|
||||
var hasChanges: Bool
|
||||
|
||||
init(nameColor: PeerNameColor, profileColor: PeerNameColor?, replyFileId: Int64?, backgroundFileId: Int64?, emojiStatus: PeerEmojiStatus?, hasChanges: Bool) {
|
||||
self.nameColor = nameColor
|
||||
self.profileColor = profileColor
|
||||
self.replyFileId = replyFileId
|
||||
self.backgroundFileId = backgroundFileId
|
||||
self.emojiStatus = emojiStatus
|
||||
self.hasChanges = hasChanges
|
||||
}
|
||||
}
|
||||
|
||||
final class View: UIView, UIScrollViewDelegate {
|
||||
private let scrollView: ScrollView
|
||||
private let actionButton = ComponentView<Empty>()
|
||||
@ -315,12 +335,15 @@ final class ChannelAppearanceScreenComponent: Component {
|
||||
private var updatedPeerNameEmoji: Int64??
|
||||
private var updatedPeerProfileColor: PeerNameColor??
|
||||
private var updatedPeerProfileEmoji: Int64??
|
||||
private var updatedPeerStatusEmoji: Int64??
|
||||
private var updatedPeerStatus: PeerEmojiStatus??
|
||||
|
||||
private var requiredLevel: Int?
|
||||
|
||||
private var currentTheme: PresentationThemeReference?
|
||||
private var resolvedCurrentTheme: (reference: PresentationThemeReference, isDark: Bool, theme: PresentationTheme, wallpaper: TelegramWallpaper?)?
|
||||
private var resolvingCurrentTheme: (reference: PresentationThemeReference, isDark: Bool, disposable: Disposable)?
|
||||
|
||||
private var boostLevel: Int?
|
||||
private var boostStatus: ChannelBoostStatus?
|
||||
private var boostStatusDisposable: Disposable?
|
||||
|
||||
@ -363,6 +386,7 @@ final class ChannelAppearanceScreenComponent: Component {
|
||||
self.contentsDataDisposable?.dispose()
|
||||
self.applyDisposable?.dispose()
|
||||
self.boostStatusDisposable?.dispose()
|
||||
self.resolvingCurrentTheme?.disposable.dispose()
|
||||
}
|
||||
|
||||
func scrollToTop() {
|
||||
@ -392,23 +416,12 @@ final class ChannelAppearanceScreenComponent: Component {
|
||||
transition.setAlpha(layer: self.bottomPanelSeparator, alpha: bottomNavigationAlpha)
|
||||
}
|
||||
|
||||
private func applySettings() {
|
||||
guard let component = self.component, let contentsData = self.contentsData, let peer = contentsData.peer, let requiredLevel = self.requiredLevel else {
|
||||
return
|
||||
}
|
||||
if self.isApplyingSettings {
|
||||
return
|
||||
private func resolveState() -> ResolvedState? {
|
||||
guard let contentsData = self.contentsData, let peer = contentsData.peer else {
|
||||
return nil
|
||||
}
|
||||
|
||||
if let boostStatus = self.boostStatus, requiredLevel > boostStatus.level {
|
||||
self.displayPremiumScreen(requiredLevel: requiredLevel)
|
||||
return
|
||||
}
|
||||
|
||||
self.isApplyingSettings = true
|
||||
self.state?.updated(transition: .immediate)
|
||||
|
||||
self.applyDisposable?.dispose()
|
||||
var hasChanges = false
|
||||
|
||||
let nameColor: PeerNameColor
|
||||
if let updatedPeerNameColor = self.updatedPeerNameColor {
|
||||
@ -418,6 +431,9 @@ final class ChannelAppearanceScreenComponent: Component {
|
||||
} else {
|
||||
nameColor = .blue
|
||||
}
|
||||
if nameColor != peer.nameColor {
|
||||
hasChanges = true
|
||||
}
|
||||
|
||||
let profileColor: PeerNameColor?
|
||||
if case let .some(value) = self.updatedPeerProfileColor {
|
||||
@ -427,49 +443,98 @@ final class ChannelAppearanceScreenComponent: Component {
|
||||
} else {
|
||||
profileColor = nil
|
||||
}
|
||||
if profileColor != peer.profileColor {
|
||||
hasChanges = true
|
||||
}
|
||||
|
||||
let replyFileId: Int64?
|
||||
if case let .some(value) = self.updatedPeerNameEmoji {
|
||||
replyFileId = value
|
||||
} else {
|
||||
replyFileId = contentsData.peer?.backgroundEmojiId
|
||||
replyFileId = peer.backgroundEmojiId
|
||||
}
|
||||
if replyFileId != peer.backgroundEmojiId {
|
||||
hasChanges = true
|
||||
}
|
||||
|
||||
let backgroundFileId: Int64?
|
||||
if case let .some(value) = self.updatedPeerProfileEmoji {
|
||||
backgroundFileId = value
|
||||
} else {
|
||||
backgroundFileId = contentsData.peer?.profileBackgroundEmojiId
|
||||
backgroundFileId = peer.profileBackgroundEmojiId
|
||||
}
|
||||
if backgroundFileId != peer.profileBackgroundEmojiId {
|
||||
hasChanges = true
|
||||
}
|
||||
|
||||
let emojiStatus: PeerEmojiStatus?
|
||||
if case let .some(value) = self.updatedPeerStatusEmoji {
|
||||
if let value {
|
||||
emojiStatus = PeerEmojiStatus(fileId: value, expirationDate: nil)
|
||||
} else {
|
||||
emojiStatus = nil
|
||||
}
|
||||
if case let .some(value) = self.updatedPeerStatus {
|
||||
emojiStatus = value
|
||||
} else {
|
||||
emojiStatus = contentsData.peer?.emojiStatus
|
||||
emojiStatus = peer.emojiStatus
|
||||
}
|
||||
if emojiStatus != peer.emojiStatus {
|
||||
hasChanges = true
|
||||
}
|
||||
let statusFileId = emojiStatus?.fileId
|
||||
|
||||
let _ = statusFileId
|
||||
return ResolvedState(
|
||||
nameColor: nameColor,
|
||||
profileColor: profileColor,
|
||||
replyFileId: replyFileId,
|
||||
backgroundFileId: backgroundFileId,
|
||||
emojiStatus: emojiStatus,
|
||||
hasChanges: hasChanges
|
||||
)
|
||||
}
|
||||
|
||||
private func applySettings() {
|
||||
guard let component = self.component, let resolvedState = self.resolveState(), let requiredLevel = self.requiredLevel else {
|
||||
return
|
||||
}
|
||||
if self.isApplyingSettings {
|
||||
return
|
||||
}
|
||||
|
||||
if let boostLevel = self.boostLevel, requiredLevel > boostLevel {
|
||||
self.displayPremiumScreen(requiredLevel: requiredLevel)
|
||||
return
|
||||
}
|
||||
|
||||
if !resolvedState.hasChanges {
|
||||
self.environment?.controller()?.dismiss()
|
||||
return
|
||||
}
|
||||
|
||||
self.isApplyingSettings = true
|
||||
self.state?.updated(transition: .immediate)
|
||||
|
||||
self.applyDisposable?.dispose()
|
||||
|
||||
let statusFileId = resolvedState.emojiStatus?.fileId
|
||||
|
||||
enum ApplyError {
|
||||
case generic
|
||||
}
|
||||
|
||||
self.applyDisposable = (combineLatest([
|
||||
component.context.engine.peers.updatePeerNameColorAndEmoji(peerId: component.peerId, nameColor: nameColor, backgroundEmojiId: replyFileId, profileColor: profileColor, profileBackgroundEmojiId: backgroundFileId)
|
||||
component.context.engine.peers.updatePeerNameColorAndEmoji(peerId: component.peerId, nameColor: resolvedState.nameColor, backgroundEmojiId: resolvedState.replyFileId, profileColor: resolvedState.profileColor, profileBackgroundEmojiId: resolvedState.backgroundFileId)
|
||||
|> ignoreValues
|
||||
|> mapError { _ -> ApplyError in
|
||||
return .generic
|
||||
},
|
||||
component.context.engine.peers.updatePeerEmojiStatus(peerId: component.peerId, fileId: statusFileId, expirationDate: nil)
|
||||
|> mapError { _ -> ApplyError in
|
||||
return .generic
|
||||
}
|
||||
])
|
||||
|> deliverOnMainQueue).start(error: { [weak self] _ in
|
||||
guard let self else {
|
||||
guard let self, let component = self.component else {
|
||||
return
|
||||
}
|
||||
|
||||
let presentationData = component.context.sharedContext.currentPresentationData.with { $0 }
|
||||
self.environment?.controller()?.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: presentationData), title: nil, text: presentationData.strings.Login_UnknownError, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})]), in: .window(.root))
|
||||
|
||||
self.isApplyingSettings = false
|
||||
self.state?.updated(transition: .immediate)
|
||||
}, completed: { [weak self] in
|
||||
@ -553,29 +618,62 @@ final class ChannelAppearanceScreenComponent: Component {
|
||||
selectedItems.insert(MediaId(namespace: Namespaces.Media.CloudFile, id: currentFileId))
|
||||
}
|
||||
|
||||
let controller = EmojiStatusSelectionController(
|
||||
context: component.context,
|
||||
mode: .backgroundSelection(completion: { [weak self] result in
|
||||
let mappedSubject: EmojiPagerContentComponent.Subject
|
||||
switch subject {
|
||||
case .reply, .profile:
|
||||
mappedSubject = .backgroundIcon
|
||||
case .status:
|
||||
mappedSubject = .channelStatus
|
||||
}
|
||||
|
||||
let mappedMode: EmojiStatusSelectionController.Mode
|
||||
switch subject {
|
||||
case .status:
|
||||
mappedMode = .customStatusSelection(completion: { [weak self] result, timestamp in
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
if let result {
|
||||
self.cachedIconFiles[result.fileId.id] = result
|
||||
}
|
||||
switch subject {
|
||||
case .reply:
|
||||
self.updatedPeerNameEmoji = result
|
||||
case .profile:
|
||||
self.updatedPeerProfileEmoji = result
|
||||
case .status:
|
||||
self.updatedPeerStatusEmoji = result
|
||||
self.updatedPeerStatus = (result?.fileId.id).flatMap { PeerEmojiStatus(fileId: $0, expirationDate: timestamp) }
|
||||
default:
|
||||
break
|
||||
}
|
||||
self.state?.updated(transition: .spring(duration: 0.4))
|
||||
}),
|
||||
})
|
||||
default:
|
||||
mappedMode = .backgroundSelection(completion: { [weak self] result in
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
if let result {
|
||||
self.cachedIconFiles[result.fileId.id] = result
|
||||
}
|
||||
switch subject {
|
||||
case .reply:
|
||||
self.updatedPeerNameEmoji = (result?.fileId.id)
|
||||
case .profile:
|
||||
self.updatedPeerProfileEmoji = (result?.fileId.id)
|
||||
case .status:
|
||||
self.updatedPeerStatus = (result?.fileId.id).flatMap { PeerEmojiStatus(fileId: $0, expirationDate: nil) }
|
||||
}
|
||||
self.state?.updated(transition: .spring(duration: 0.4))
|
||||
})
|
||||
}
|
||||
|
||||
let controller = EmojiStatusSelectionController(
|
||||
context: component.context,
|
||||
mode: mappedMode,
|
||||
sourceView: sourceView,
|
||||
emojiContent: EmojiPagerContentComponent.emojiInputData(
|
||||
context: component.context,
|
||||
animationCache: component.context.animationCache,
|
||||
animationRenderer: component.context.animationRenderer,
|
||||
isStandalone: false,
|
||||
subject: subject == .status ? .status : .backgroundIcon,
|
||||
subject: mappedSubject,
|
||||
hasTrending: false,
|
||||
topReactionItems: [],
|
||||
areUnicodeEmojiEnabled: false,
|
||||
@ -588,6 +686,9 @@ final class ChannelAppearanceScreenComponent: Component {
|
||||
currentSelection: currentFileId,
|
||||
color: color,
|
||||
destinationItemView: { [weak sourceView] in
|
||||
guard let sourceView else {
|
||||
return nil
|
||||
}
|
||||
return sourceView
|
||||
}
|
||||
)
|
||||
@ -618,6 +719,9 @@ final class ChannelAppearanceScreenComponent: Component {
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
if self.contentsData == nil, case let .channel(channel) = contentsData.peer {
|
||||
self.boostLevel = channel.approximateBoostLevel.flatMap(Int.init)
|
||||
}
|
||||
self.contentsData = contentsData
|
||||
if !self.isUpdating {
|
||||
self.state?.updated(transition: .immediate)
|
||||
@ -631,6 +735,7 @@ final class ChannelAppearanceScreenComponent: Component {
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
self.boostLevel = boostStatus?.level
|
||||
self.boostStatus = boostStatus
|
||||
if !self.isUpdating {
|
||||
self.state?.updated(transition: .immediate)
|
||||
@ -638,65 +743,40 @@ final class ChannelAppearanceScreenComponent: Component {
|
||||
})
|
||||
}
|
||||
|
||||
guard let contentsData = self.contentsData, var peer = contentsData.peer else {
|
||||
guard let contentsData = self.contentsData, var peer = contentsData.peer, let resolvedState = self.resolveState() else {
|
||||
return availableSize
|
||||
}
|
||||
|
||||
var requiredLevel = 1
|
||||
|
||||
let replyIconLevel = 5
|
||||
let profileIconLevel = 7
|
||||
let emojiStatusLevel = 8
|
||||
var profileIconLevel = 7
|
||||
var emojiStatusLevel = 8
|
||||
let themeLevel = 9
|
||||
|
||||
let nameColor: PeerNameColor
|
||||
if let updatedPeerNameColor = self.updatedPeerNameColor {
|
||||
nameColor = updatedPeerNameColor
|
||||
} else if let peerNameColor = peer.nameColor {
|
||||
nameColor = peerNameColor
|
||||
} else {
|
||||
nameColor = .blue
|
||||
if let data = component.context.currentAppConfiguration.with({ $0 }).data {
|
||||
if let value = data["channel_profile_color_level_min"] as? Double {
|
||||
profileIconLevel = Int(value)
|
||||
}
|
||||
if let value = data["channel_emoji_status_level_min"] as? Double {
|
||||
emojiStatusLevel = Int(value)
|
||||
}
|
||||
}
|
||||
|
||||
let profileColor: PeerNameColor?
|
||||
if case let .some(value) = self.updatedPeerProfileColor {
|
||||
profileColor = value
|
||||
} else if let peerProfileColor = peer.profileColor {
|
||||
profileColor = peerProfileColor
|
||||
} else {
|
||||
profileColor = nil
|
||||
}
|
||||
let profileColor = resolvedState.profileColor
|
||||
|
||||
let replyFileId: Int64?
|
||||
if case let .some(value) = self.updatedPeerNameEmoji {
|
||||
replyFileId = value
|
||||
} else {
|
||||
replyFileId = contentsData.peer?.backgroundEmojiId
|
||||
}
|
||||
let replyFileId = resolvedState.replyFileId
|
||||
if replyFileId != nil {
|
||||
requiredLevel = max(requiredLevel, replyIconLevel)
|
||||
}
|
||||
|
||||
let backgroundFileId: Int64?
|
||||
if case let .some(value) = self.updatedPeerProfileEmoji {
|
||||
backgroundFileId = value
|
||||
} else {
|
||||
backgroundFileId = contentsData.peer?.profileBackgroundEmojiId
|
||||
}
|
||||
if backgroundFileId != nil {
|
||||
let backgroundFileId = resolvedState.backgroundFileId
|
||||
if profileColor != nil || backgroundFileId != nil {
|
||||
requiredLevel = max(requiredLevel, profileIconLevel)
|
||||
}
|
||||
|
||||
let emojiStatus: PeerEmojiStatus?
|
||||
if case let .some(value) = self.updatedPeerStatusEmoji {
|
||||
if let value {
|
||||
emojiStatus = PeerEmojiStatus(fileId: value, expirationDate: nil)
|
||||
} else {
|
||||
emojiStatus = nil
|
||||
}
|
||||
} else {
|
||||
emojiStatus = contentsData.peer?.emojiStatus
|
||||
}
|
||||
let emojiStatus = resolvedState.emojiStatus
|
||||
|
||||
if emojiStatus != nil {
|
||||
requiredLevel = max(requiredLevel, emojiStatusLevel)
|
||||
}
|
||||
@ -712,13 +792,51 @@ final class ChannelAppearanceScreenComponent: Component {
|
||||
}
|
||||
}
|
||||
|
||||
if let currentTheme = self.currentTheme, (self.resolvedCurrentTheme?.reference != currentTheme || self.resolvedCurrentTheme?.isDark != environment.theme.overallDarkAppearance), (self.resolvingCurrentTheme?.reference != currentTheme || self.resolvingCurrentTheme?.isDark != environment.theme.overallDarkAppearance) {
|
||||
self.resolvingCurrentTheme?.disposable.dispose()
|
||||
|
||||
let disposable = MetaDisposable()
|
||||
self.resolvingCurrentTheme = (currentTheme, environment.theme.overallDarkAppearance, disposable)
|
||||
|
||||
var presentationTheme: PresentationTheme?
|
||||
switch currentTheme {
|
||||
case .builtin:
|
||||
presentationTheme = makePresentationTheme(mediaBox: component.context.sharedContext.accountManager.mediaBox, themeReference: .builtin(environment.theme.overallDarkAppearance ? .night : .dayClassic))
|
||||
case let .cloud(cloudTheme):
|
||||
presentationTheme = makePresentationTheme(cloudTheme: cloudTheme.theme, dark: environment.theme.overallDarkAppearance)
|
||||
default:
|
||||
presentationTheme = makePresentationTheme(mediaBox: component.context.sharedContext.accountManager.mediaBox, themeReference: currentTheme)
|
||||
}
|
||||
if let presentationTheme {
|
||||
let resolvedWallpaper: Signal<TelegramWallpaper?, NoError>
|
||||
if case let .file(file) = presentationTheme.chat.defaultWallpaper, file.id == 0 {
|
||||
resolvedWallpaper = cachedWallpaper(account: component.context.account, slug: file.slug, settings: file.settings)
|
||||
|> map { wallpaper -> TelegramWallpaper? in
|
||||
return wallpaper?.wallpaper
|
||||
}
|
||||
} else {
|
||||
resolvedWallpaper = .single(presentationTheme.chat.defaultWallpaper)
|
||||
}
|
||||
disposable.set((resolvedWallpaper
|
||||
|> deliverOnMainQueue).startStrict(next: { [weak self] resolvedWallpaper in
|
||||
guard let self, let environment = self.environment else {
|
||||
return
|
||||
}
|
||||
self.resolvedCurrentTheme = (currentTheme, environment.theme.overallDarkAppearance, presentationTheme, resolvedWallpaper)
|
||||
if !self.isUpdating {
|
||||
self.state?.updated(transition: .immediate)
|
||||
}
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
if self.currentTheme != nil && self.currentTheme != chatThemes.first {
|
||||
requiredLevel = max(requiredLevel, themeLevel)
|
||||
}
|
||||
|
||||
if case let .user(user) = peer {
|
||||
peer = .user(user
|
||||
.withUpdatedNameColor(nameColor)
|
||||
.withUpdatedNameColor(resolvedState.nameColor)
|
||||
.withUpdatedProfileColor(profileColor)
|
||||
.withUpdatedEmojiStatus(emojiStatus)
|
||||
.withUpdatedBackgroundEmojiId(replyFileId)
|
||||
@ -726,7 +844,7 @@ final class ChannelAppearanceScreenComponent: Component {
|
||||
)
|
||||
} else if case let .channel(channel) = peer {
|
||||
peer = .channel(channel
|
||||
.withUpdatedNameColor(nameColor)
|
||||
.withUpdatedNameColor(resolvedState.nameColor)
|
||||
.withUpdatedProfileColor(profileColor)
|
||||
.withUpdatedEmojiStatus(emojiStatus)
|
||||
.withUpdatedBackgroundEmojiId(replyFileId)
|
||||
@ -750,16 +868,17 @@ final class ChannelAppearanceScreenComponent: Component {
|
||||
|
||||
let presentationData = component.context.sharedContext.currentPresentationData.with { $0 }
|
||||
|
||||
//TODO:localize
|
||||
let messageItem = PeerNameColorChatPreviewItem.MessageItem(
|
||||
outgoing: false,
|
||||
peerId: EnginePeer.Id(namespace: peer.id.namespace, id: PeerId.Id._internalFromInt64Value(0)),
|
||||
author: peer.compactDisplayTitle,
|
||||
photo: peer.profileImageRepresentations,
|
||||
nameColor: nameColor,
|
||||
nameColor: resolvedState.nameColor,
|
||||
backgroundEmojiId: replyFileId,
|
||||
reply: (peer.compactDisplayTitle, environment.strings.NameColor_ChatPreview_ReplyText_Channel),
|
||||
linkPreview: (environment.strings.NameColor_ChatPreview_LinkSite, environment.strings.NameColor_ChatPreview_LinkTitle, environment.strings.NameColor_ChatPreview_LinkText),
|
||||
text: environment.strings.NameColor_ChatPreview_MessageText_Channel
|
||||
reply: (peer.compactDisplayTitle, "Reply to your channel"),
|
||||
linkPreview: ("Telegram", "Link Preview", "This preview will also be tinted."),
|
||||
text: "The color you select will be used for the channel's name"
|
||||
)
|
||||
|
||||
var replyLogoContents: [AnyComponentWithIdentity<Empty>] = []
|
||||
@ -771,13 +890,22 @@ final class ChannelAppearanceScreenComponent: Component {
|
||||
)),
|
||||
maximumNumberOfLines: 0
|
||||
))))
|
||||
if replyFileId != nil, let boostStatus = self.boostStatus, boostStatus.level < replyIconLevel {
|
||||
if replyFileId != nil, let boostLevel = self.boostLevel, boostLevel < replyIconLevel {
|
||||
replyLogoContents.append(AnyComponentWithIdentity(id: 1, component: AnyComponent(BoostLevelIconComponent(
|
||||
strings: environment.strings,
|
||||
level: replyIconLevel
|
||||
))))
|
||||
}
|
||||
|
||||
var chatPreviewTheme: PresentationTheme = environment.theme
|
||||
var chatPreviewWallpaper: TelegramWallpaper = presentationData.chatWallpaper
|
||||
if let resolvedCurrentTheme = self.resolvedCurrentTheme {
|
||||
chatPreviewTheme = resolvedCurrentTheme.theme
|
||||
if let wallpaper = resolvedCurrentTheme.wallpaper {
|
||||
chatPreviewWallpaper = wallpaper
|
||||
}
|
||||
}
|
||||
|
||||
let replySectionSize = self.replySection.update(
|
||||
transition: transition,
|
||||
component: AnyComponent(ListSectionComponent(
|
||||
@ -795,13 +923,13 @@ final class ChannelAppearanceScreenComponent: Component {
|
||||
AnyComponentWithIdentity(id: 0, component: AnyComponent(ListItemComponentAdaptor(
|
||||
itemGenerator: PeerNameColorChatPreviewItem(
|
||||
context: component.context,
|
||||
theme: environment.theme,
|
||||
componentTheme: environment.theme,
|
||||
theme: chatPreviewTheme,
|
||||
componentTheme: chatPreviewTheme,
|
||||
strings: environment.strings,
|
||||
sectionId: 0,
|
||||
fontSize: presentationData.chatFontSize,
|
||||
chatBubbleCorners: presentationData.chatBubbleCorners,
|
||||
wallpaper: presentationData.chatWallpaper,
|
||||
wallpaper: chatPreviewWallpaper,
|
||||
dateTimeFormat: environment.dateTimeFormat,
|
||||
nameDisplayOrder: presentationData.nameDisplayOrder,
|
||||
messageItems: [messageItem]
|
||||
@ -813,7 +941,7 @@ final class ChannelAppearanceScreenComponent: Component {
|
||||
theme: environment.theme,
|
||||
colors: component.context.peerNameColors,
|
||||
isProfile: false,
|
||||
currentColor: nameColor,
|
||||
currentColor: resolvedState.nameColor,
|
||||
updated: { [weak self] value in
|
||||
guard let self else {
|
||||
return
|
||||
@ -830,32 +958,16 @@ final class ChannelAppearanceScreenComponent: Component {
|
||||
title: AnyComponent(HStack(replyLogoContents, spacing: 6.0)),
|
||||
icon: AnyComponentWithIdentity(id: 0, component: AnyComponent(EmojiActionIconComponent(
|
||||
context: component.context,
|
||||
color: component.context.peerNameColors.get(nameColor, dark: environment.theme.overallDarkAppearance).main,
|
||||
color: component.context.peerNameColors.get(resolvedState.nameColor, dark: environment.theme.overallDarkAppearance).main,
|
||||
fileId: replyFileId,
|
||||
file: replyFileId.flatMap { self.cachedIconFiles[$0] }
|
||||
))),
|
||||
action: { [weak self] view in
|
||||
guard let self, let contentsData = self.contentsData, let view = view as? ListActionItemComponent.View, let iconView = view.iconView else {
|
||||
guard let self, let resolvedState = self.resolveState(), let view = view as? ListActionItemComponent.View, let iconView = view.iconView else {
|
||||
return
|
||||
}
|
||||
|
||||
let nameColor: PeerNameColor
|
||||
if let updatedPeerNameColor = self.updatedPeerNameColor {
|
||||
nameColor = updatedPeerNameColor
|
||||
} else if let peerNameColor = peer.nameColor {
|
||||
nameColor = peerNameColor
|
||||
} else {
|
||||
nameColor = .blue
|
||||
}
|
||||
|
||||
let currentFileId: Int64?
|
||||
if case let .some(value) = self.updatedPeerNameEmoji {
|
||||
currentFileId = value
|
||||
} else {
|
||||
currentFileId = contentsData.peer?.backgroundEmojiId
|
||||
}
|
||||
|
||||
self.openEmojiSetup(sourceView: iconView, currentFileId: currentFileId, color: component.context.peerNameColors.get(nameColor, dark: environment.theme.overallDarkAppearance).main, subject: .reply)
|
||||
self.openEmojiSetup(sourceView: iconView, currentFileId: resolvedState.replyFileId, color: component.context.peerNameColors.get(resolvedState.nameColor, dark: environment.theme.overallDarkAppearance).main, subject: .reply)
|
||||
}
|
||||
)))
|
||||
]
|
||||
@ -884,7 +996,7 @@ final class ChannelAppearanceScreenComponent: Component {
|
||||
)),
|
||||
maximumNumberOfLines: 0
|
||||
))))
|
||||
if currentTheme != chatThemes[0], let boostStatus = self.boostStatus, boostStatus.level < themeLevel {
|
||||
if currentTheme != chatThemes[0], let boostLevel = self.boostLevel, boostLevel < themeLevel {
|
||||
wallpaperLogoContents.append(AnyComponentWithIdentity(id: 1, component: AnyComponent(BoostLevelIconComponent(
|
||||
strings: environment.strings,
|
||||
level: themeLevel
|
||||
@ -915,7 +1027,8 @@ final class ChannelAppearanceScreenComponent: Component {
|
||||
animatedEmojiStickers: component.context.animatedEmojiStickers,
|
||||
themeSpecificAccentColors: [:],
|
||||
themeSpecificChatWallpapers: [:],
|
||||
nightMode: false,
|
||||
nightMode: environment.theme.overallDarkAppearance,
|
||||
channelMode: true,
|
||||
currentTheme: currentTheme,
|
||||
updatedTheme: { [weak self] value in
|
||||
guard let self else {
|
||||
@ -964,7 +1077,7 @@ final class ChannelAppearanceScreenComponent: Component {
|
||||
)),
|
||||
maximumNumberOfLines: 0
|
||||
))))
|
||||
if backgroundFileId != nil, let boostStatus = self.boostStatus, boostStatus.level < profileIconLevel {
|
||||
if backgroundFileId != nil, let boostLevel = self.boostLevel, boostLevel < profileIconLevel {
|
||||
profileLogoContents.append(AnyComponentWithIdentity(id: 1, component: AnyComponent(BoostLevelIconComponent(
|
||||
strings: environment.strings,
|
||||
level: profileIconLevel
|
||||
@ -1042,28 +1155,12 @@ final class ChannelAppearanceScreenComponent: Component {
|
||||
file: backgroundFileId.flatMap { self.cachedIconFiles[$0] }
|
||||
))),
|
||||
action: { [weak self] view in
|
||||
guard let self, let contentsData = self.contentsData, let view = view as? ListActionItemComponent.View, let iconView = view.iconView else {
|
||||
guard let self, let resolvedState = self.resolveState(), let view = view as? ListActionItemComponent.View, let iconView = view.iconView else {
|
||||
return
|
||||
}
|
||||
|
||||
let currentFileId: Int64?
|
||||
if case let .some(value) = self.updatedPeerProfileEmoji {
|
||||
currentFileId = value
|
||||
} else {
|
||||
currentFileId = contentsData.peer?.profileBackgroundEmojiId
|
||||
}
|
||||
|
||||
let profileColor: PeerNameColor?
|
||||
if case let .some(value) = self.updatedPeerProfileColor {
|
||||
profileColor = value
|
||||
} else if let peerProfileColor = peer.profileColor {
|
||||
profileColor = peerProfileColor
|
||||
} else {
|
||||
profileColor = nil
|
||||
}
|
||||
|
||||
self.openEmojiSetup(sourceView: iconView, currentFileId: currentFileId, color: profileColor.flatMap { profileColor in
|
||||
component.context.peerNameColors.getProfile(profileColor, dark: environment.theme.overallDarkAppearance, subject: .palette).main
|
||||
self.openEmojiSetup(sourceView: iconView, currentFileId: resolvedState.backgroundFileId, color: resolvedState.profileColor.flatMap {
|
||||
component.context.peerNameColors.getProfile($0, dark: environment.theme.overallDarkAppearance, subject: .palette).main
|
||||
} ?? environment.theme.list.itemAccentColor, subject: .profile)
|
||||
}
|
||||
)))
|
||||
@ -1091,7 +1188,7 @@ final class ChannelAppearanceScreenComponent: Component {
|
||||
)),
|
||||
maximumNumberOfLines: 0
|
||||
))))
|
||||
if emojiStatus != nil, let boostStatus = self.boostStatus, boostStatus.level < emojiStatusLevel {
|
||||
if emojiStatus != nil, let boostLevel = self.boostLevel, boostLevel < emojiStatusLevel {
|
||||
emojiStatusContents.append(AnyComponentWithIdentity(id: 1, component: AnyComponent(BoostLevelIconComponent(
|
||||
strings: environment.strings,
|
||||
level: emojiStatusLevel
|
||||
@ -1174,18 +1271,11 @@ final class ChannelAppearanceScreenComponent: Component {
|
||||
file: statusFileId.flatMap { self.cachedIconFiles[$0] }
|
||||
))),
|
||||
action: { [weak self] view in
|
||||
guard let self, let contentsData = self.contentsData, let view = view as? ListActionItemComponent.View, let iconView = view.iconView else {
|
||||
guard let self, let resolvedState = self.resolveState(), let view = view as? ListActionItemComponent.View, let iconView = view.iconView else {
|
||||
return
|
||||
}
|
||||
|
||||
let currentFileId: Int64?
|
||||
if case let .some(value) = self.updatedPeerStatusEmoji {
|
||||
currentFileId = value
|
||||
} else {
|
||||
currentFileId = contentsData.peer?.emojiStatus?.fileId
|
||||
}
|
||||
|
||||
self.openEmojiSetup(sourceView: iconView, currentFileId: currentFileId, color: nil, subject: .status)
|
||||
self.openEmojiSetup(sourceView: iconView, currentFileId: resolvedState.emojiStatus?.fileId, color: nil, subject: .status)
|
||||
}
|
||||
)))
|
||||
]
|
||||
@ -1210,7 +1300,7 @@ final class ChannelAppearanceScreenComponent: Component {
|
||||
Text(text: "Apply Changes", font: Font.semibold(17.0), color: environment.theme.list.itemCheckColors.foregroundColor)
|
||||
)))
|
||||
|
||||
if let boostStatus = self.boostStatus, requiredLevel > boostStatus.level {
|
||||
if let boostLevel = self.boostLevel, requiredLevel > boostLevel {
|
||||
buttonContents.append(AnyComponentWithIdentity(id: AnyHashable(1 as Int), component: AnyComponent(PremiumLockButtonSubtitleComponent(
|
||||
count: requiredLevel,
|
||||
theme: environment.theme,
|
||||
@ -1266,6 +1356,8 @@ final class ChannelAppearanceScreenComponent: Component {
|
||||
self.bottomPanelSeparator.backgroundColor = environment.theme.rootController.navigationBar.separatorColor.cgColor
|
||||
transition.setFrame(layer: self.bottomPanelSeparator, frame: CGRect(origin: CGPoint(x: bottomPanelFrame.minX, y: bottomPanelFrame.minY), size: CGSize(width: bottomPanelFrame.width, height: UIScreenPixel)))
|
||||
|
||||
let previousBounds = self.scrollView.bounds
|
||||
|
||||
let contentSize = CGSize(width: availableSize.width, height: contentHeight)
|
||||
if self.scrollView.frame != CGRect(origin: CGPoint(), size: availableSize) {
|
||||
self.scrollView.frame = CGRect(origin: CGPoint(), size: availableSize)
|
||||
@ -1278,6 +1370,14 @@ final class ChannelAppearanceScreenComponent: Component {
|
||||
self.scrollView.scrollIndicatorInsets = scrollInsets
|
||||
}
|
||||
|
||||
if !previousBounds.isEmpty, !transition.animation.isImmediate {
|
||||
let bounds = self.scrollView.bounds
|
||||
if bounds.maxY != previousBounds.maxY {
|
||||
let offsetY = previousBounds.maxY - bounds.maxY
|
||||
transition.animateBoundsOrigin(view: self.scrollView, from: CGPoint(x: 0.0, y: offsetY), to: CGPoint(), additive: true)
|
||||
}
|
||||
}
|
||||
|
||||
self.updateScrolling(transition: transition)
|
||||
|
||||
return availableSize
|
||||
|
@ -299,7 +299,7 @@ final class PeerNameColorChatPreviewItemNode: ListViewItemNode {
|
||||
|
||||
strongSelf.containerNode.frame = CGRect(origin: CGPoint(), size: contentSize)
|
||||
|
||||
if let currentItem, currentItem.messageItems.first?.nameColor != item.messageItems.first?.nameColor || currentItem.messageItems.first?.backgroundEmojiId != item.messageItems.first?.backgroundEmojiId {
|
||||
if let currentItem, currentItem.messageItems.first?.nameColor != item.messageItems.first?.nameColor || currentItem.messageItems.first?.backgroundEmojiId != item.messageItems.first?.backgroundEmojiId || currentItem.theme !== item.theme || currentItem.wallpaper != item.wallpaper {
|
||||
if let snapshot = strongSelf.view.snapshotView(afterScreenUpdates: false) {
|
||||
snapshot.frame = CGRect(origin: CGPoint(x: 0.0, y: -insets.top), size: snapshot.frame.size)
|
||||
strongSelf.view.addSubview(snapshot)
|
||||
|
@ -26,6 +26,7 @@ private struct ThemeCarouselThemeEntry: Comparable, Identifiable {
|
||||
let emojiFile: TelegramMediaFile?
|
||||
let themeReference: PresentationThemeReference
|
||||
let nightMode: Bool
|
||||
let channelMode: Bool
|
||||
let themeSpecificAccentColors: [Int64: PresentationThemeAccentColor]
|
||||
let themeSpecificChatWallpapers: [Int64: TelegramWallpaper]
|
||||
var selected: Bool
|
||||
@ -50,6 +51,9 @@ private struct ThemeCarouselThemeEntry: Comparable, Identifiable {
|
||||
if lhs.nightMode != rhs.nightMode {
|
||||
return false
|
||||
}
|
||||
if lhs.channelMode != rhs.channelMode {
|
||||
return false
|
||||
}
|
||||
if lhs.themeSpecificAccentColors != rhs.themeSpecificAccentColors {
|
||||
return false
|
||||
}
|
||||
@ -76,7 +80,7 @@ private struct ThemeCarouselThemeEntry: Comparable, Identifiable {
|
||||
}
|
||||
|
||||
func item(context: AccountContext, action: @escaping (PresentationThemeReference) -> Void, contextAction: ((PresentationThemeReference, ASDisplayNode, ContextGesture?) -> Void)?) -> ListViewItem {
|
||||
return ThemeCarouselThemeIconItem(context: context, emojiFile: self.emojiFile, themeReference: self.themeReference, nightMode: self.nightMode, themeSpecificAccentColors: self.themeSpecificAccentColors, themeSpecificChatWallpapers: self.themeSpecificChatWallpapers, selected: self.selected, theme: self.theme, strings: self.strings, wallpaper: self.wallpaper, action: action, contextAction: contextAction)
|
||||
return ThemeCarouselThemeIconItem(context: context, emojiFile: self.emojiFile, themeReference: self.themeReference, nightMode: self.nightMode, channelMode: self.channelMode, themeSpecificAccentColors: self.themeSpecificAccentColors, themeSpecificChatWallpapers: self.themeSpecificChatWallpapers, selected: self.selected, theme: self.theme, strings: self.strings, wallpaper: self.wallpaper, action: action, contextAction: contextAction)
|
||||
}
|
||||
}
|
||||
|
||||
@ -86,6 +90,7 @@ public class ThemeCarouselThemeIconItem: ListViewItem {
|
||||
public let emojiFile: TelegramMediaFile?
|
||||
public let themeReference: PresentationThemeReference
|
||||
public let nightMode: Bool
|
||||
public let channelMode: Bool
|
||||
public let themeSpecificAccentColors: [Int64: PresentationThemeAccentColor]
|
||||
public let themeSpecificChatWallpapers: [Int64: TelegramWallpaper]
|
||||
public let selected: Bool
|
||||
@ -95,11 +100,12 @@ public class ThemeCarouselThemeIconItem: ListViewItem {
|
||||
public let action: (PresentationThemeReference) -> Void
|
||||
public let contextAction: ((PresentationThemeReference, ASDisplayNode, ContextGesture?) -> Void)?
|
||||
|
||||
public init(context: AccountContext, emojiFile: TelegramMediaFile?, themeReference: PresentationThemeReference, nightMode: Bool, themeSpecificAccentColors: [Int64: PresentationThemeAccentColor], themeSpecificChatWallpapers: [Int64: TelegramWallpaper], selected: Bool, theme: PresentationTheme, strings: PresentationStrings, wallpaper: TelegramWallpaper?, action: @escaping (PresentationThemeReference) -> Void, contextAction: ((PresentationThemeReference, ASDisplayNode, ContextGesture?) -> Void)?) {
|
||||
public init(context: AccountContext, emojiFile: TelegramMediaFile?, themeReference: PresentationThemeReference, nightMode: Bool, channelMode: Bool, themeSpecificAccentColors: [Int64: PresentationThemeAccentColor], themeSpecificChatWallpapers: [Int64: TelegramWallpaper], selected: Bool, theme: PresentationTheme, strings: PresentationStrings, wallpaper: TelegramWallpaper?, action: @escaping (PresentationThemeReference) -> Void, contextAction: ((PresentationThemeReference, ASDisplayNode, ContextGesture?) -> Void)?) {
|
||||
self.context = context
|
||||
self.emojiFile = emojiFile
|
||||
self.themeReference = themeReference
|
||||
self.nightMode = nightMode
|
||||
self.channelMode = channelMode
|
||||
self.themeSpecificAccentColors = themeSpecificAccentColors
|
||||
self.themeSpecificChatWallpapers = themeSpecificChatWallpapers
|
||||
self.selected = selected
|
||||
@ -339,6 +345,7 @@ private final class ThemeCarouselThemeItemIconNode : ListViewItemNode {
|
||||
var updatedThemeReference = false
|
||||
var updatedTheme = false
|
||||
var updatedNightMode = false
|
||||
var updatedChannelMode = false
|
||||
var updatedWallpaper = false
|
||||
var updatedSelected = false
|
||||
|
||||
@ -348,6 +355,9 @@ private final class ThemeCarouselThemeItemIconNode : ListViewItemNode {
|
||||
if currentItem?.nightMode != item.nightMode {
|
||||
updatedNightMode = true
|
||||
}
|
||||
if currentItem?.channelMode != item.channelMode {
|
||||
updatedChannelMode = true
|
||||
}
|
||||
if currentItem?.wallpaper != item.wallpaper {
|
||||
updatedWallpaper = true
|
||||
}
|
||||
@ -373,7 +383,7 @@ private final class ThemeCarouselThemeItemIconNode : ListViewItemNode {
|
||||
if let strongSelf = self {
|
||||
strongSelf.item = item
|
||||
|
||||
if updatedThemeReference || updatedWallpaper || updatedNightMode {
|
||||
if updatedThemeReference || updatedWallpaper || updatedNightMode || updatedChannelMode {
|
||||
var themeReference = item.themeReference
|
||||
if case .builtin = themeReference, item.nightMode {
|
||||
themeReference = .builtin(.night)
|
||||
@ -382,7 +392,7 @@ private final class ThemeCarouselThemeItemIconNode : ListViewItemNode {
|
||||
let color = item.themeSpecificAccentColors[themeReference.index]
|
||||
let wallpaper = item.themeSpecificChatWallpapers[themeReference.index]
|
||||
|
||||
strongSelf.imageNode.setSignal(themeIconImage(account: item.context.account, accountManager: item.context.sharedContext.accountManager, theme: themeReference, color: color, wallpaper: wallpaper ?? item.wallpaper, nightMode: item.nightMode, emoticon: true))
|
||||
strongSelf.imageNode.setSignal(themeIconImage(account: item.context.account, accountManager: item.context.sharedContext.accountManager, theme: themeReference, color: color, wallpaper: wallpaper ?? item.wallpaper, nightMode: item.nightMode, channelMode: item.channelMode, emoticon: true))
|
||||
strongSelf.imageNode.backgroundColor = nil
|
||||
}
|
||||
|
||||
@ -519,12 +529,13 @@ public class ThemeCarouselThemeItem: ListViewItem, ItemListItem, ListItemCompone
|
||||
public let themeSpecificAccentColors: [Int64: PresentationThemeAccentColor]
|
||||
public let themeSpecificChatWallpapers: [Int64: TelegramWallpaper]
|
||||
public let nightMode: Bool
|
||||
public let channelMode: Bool
|
||||
public let currentTheme: PresentationThemeReference
|
||||
public let updatedTheme: (PresentationThemeReference) -> Void
|
||||
public let contextAction: ((PresentationThemeReference, ASDisplayNode, ContextGesture?) -> Void)?
|
||||
public let tag: ItemListItemTag?
|
||||
|
||||
public init(context: AccountContext, theme: PresentationTheme, strings: PresentationStrings, sectionId: ItemListSectionId, themes: [PresentationThemeReference], animatedEmojiStickers: [String: [StickerPackItem]], themeSpecificAccentColors: [Int64: PresentationThemeAccentColor], themeSpecificChatWallpapers: [Int64: TelegramWallpaper], nightMode: Bool, currentTheme: PresentationThemeReference, updatedTheme: @escaping (PresentationThemeReference) -> Void, contextAction: ((PresentationThemeReference, ASDisplayNode, ContextGesture?) -> Void)?, tag: ItemListItemTag? = nil) {
|
||||
public init(context: AccountContext, theme: PresentationTheme, strings: PresentationStrings, sectionId: ItemListSectionId, themes: [PresentationThemeReference], animatedEmojiStickers: [String: [StickerPackItem]], themeSpecificAccentColors: [Int64: PresentationThemeAccentColor], themeSpecificChatWallpapers: [Int64: TelegramWallpaper], nightMode: Bool, channelMode: Bool = false, currentTheme: PresentationThemeReference, updatedTheme: @escaping (PresentationThemeReference) -> Void, contextAction: ((PresentationThemeReference, ASDisplayNode, ContextGesture?) -> Void)?, tag: ItemListItemTag? = nil) {
|
||||
self.context = context
|
||||
self.theme = theme
|
||||
self.strings = strings
|
||||
@ -533,6 +544,7 @@ public class ThemeCarouselThemeItem: ListViewItem, ItemListItem, ListItemCompone
|
||||
self.themeSpecificAccentColors = themeSpecificAccentColors
|
||||
self.themeSpecificChatWallpapers = themeSpecificChatWallpapers
|
||||
self.nightMode = nightMode
|
||||
self.channelMode = channelMode
|
||||
self.currentTheme = currentTheme
|
||||
self.updatedTheme = updatedTheme
|
||||
self.contextAction = contextAction
|
||||
@ -602,6 +614,9 @@ public class ThemeCarouselThemeItem: ListViewItem, ItemListItem, ListItemCompone
|
||||
if lhs.nightMode != rhs.nightMode {
|
||||
return false
|
||||
}
|
||||
if lhs.channelMode != rhs.channelMode {
|
||||
return false
|
||||
}
|
||||
if lhs.currentTheme != rhs.currentTheme {
|
||||
return false
|
||||
}
|
||||
@ -827,12 +842,12 @@ public class ThemeCarouselThemeItemNode: ListViewItemNode, ItemListItemNode {
|
||||
hasCurrentTheme = true
|
||||
}
|
||||
let emojiFile = theme.emoticon.flatMap { item.animatedEmojiStickers[$0]?.first?.file }
|
||||
entries.append(ThemeCarouselThemeEntry(index: index, emojiFile: emojiFile, themeReference: theme, nightMode: item.nightMode, themeSpecificAccentColors: item.themeSpecificAccentColors, themeSpecificChatWallpapers: item.themeSpecificChatWallpapers, selected: selected, theme: item.theme, strings: item.strings, wallpaper: nil))
|
||||
entries.append(ThemeCarouselThemeEntry(index: index, emojiFile: emojiFile, themeReference: theme, nightMode: item.nightMode, channelMode: item.channelMode, themeSpecificAccentColors: item.themeSpecificAccentColors, themeSpecificChatWallpapers: item.themeSpecificChatWallpapers, selected: selected, theme: item.theme, strings: item.strings, wallpaper: nil))
|
||||
index += 1
|
||||
}
|
||||
|
||||
if !hasCurrentTheme {
|
||||
entries.append(ThemeCarouselThemeEntry(index: index, emojiFile: nil, themeReference: item.currentTheme, nightMode: false, themeSpecificAccentColors: item.themeSpecificAccentColors, themeSpecificChatWallpapers: item.themeSpecificChatWallpapers, selected: true, theme: item.theme, strings: item.strings, wallpaper: nil))
|
||||
entries.append(ThemeCarouselThemeEntry(index: index, emojiFile: nil, themeReference: item.currentTheme, nightMode: false, channelMode: item.channelMode, themeSpecificAccentColors: item.themeSpecificAccentColors, themeSpecificChatWallpapers: item.themeSpecificChatWallpapers, selected: true, theme: item.theme, strings: item.strings, wallpaper: nil))
|
||||
}
|
||||
|
||||
let action: (PresentationThemeReference) -> Void = { [weak self] themeReference in
|
||||
|
@ -604,7 +604,7 @@ public final class PeerListItemComponent: Component {
|
||||
statusIcon = .text(color: component.theme.chat.message.incoming.scamColor, string: component.strings.Message_ScamAccount.uppercased())
|
||||
} else if peer.isFake {
|
||||
statusIcon = .text(color: component.theme.chat.message.incoming.scamColor, string: component.strings.Message_FakeAccount.uppercased())
|
||||
} else if case let .user(user) = peer, let emojiStatus = user.emojiStatus {
|
||||
} else if let emojiStatus = peer.emojiStatus {
|
||||
statusIcon = .animation(content: .customEmoji(fileId: emojiStatus.fileId), size: CGSize(width: 20.0, height: 20.0), placeholderColor: component.theme.list.mediaPlaceholderColor, themeColor: component.theme.list.itemAccentColor, loopMode: .count(2))
|
||||
} else if peer.isVerified {
|
||||
statusIcon = .verified(fillColor: component.theme.list.itemCheckColors.fillColor, foregroundColor: component.theme.list.itemCheckColors.foregroundColor, sizeType: .compact)
|
||||
|
@ -540,6 +540,11 @@ final class ChatReportPeerTitlePanelNode: ChatTitleAccessoryPanelNode {
|
||||
} else {
|
||||
emojiStatus = emojiStatusValue
|
||||
}
|
||||
} else if let channel = interfaceState.renderedPeer?.peer as? TelegramChannel, let emojiStatusValue = channel.emojiStatus {
|
||||
if channel.isFake || channel.isScam {
|
||||
} else {
|
||||
emojiStatus = emojiStatusValue
|
||||
}
|
||||
}
|
||||
|
||||
/*#if DEBUG
|
||||
|
@ -1398,7 +1398,7 @@ private let messageImage: UIImage = {
|
||||
return messageBubbleImage(maxCornerRadius: 16.0, minCornerRadius: 16.0, incoming: true, fillColor: .white, strokeColor: .clear, neighbors: .none, shadow: nil, wallpaper: .color(0x000000), knockout: false)
|
||||
}()
|
||||
|
||||
public func themeIconImage(account: Account, accountManager: AccountManager<TelegramAccountManagerTypes>, theme: PresentationThemeReference, color: PresentationThemeAccentColor?, wallpaper: TelegramWallpaper? = nil, nightMode: Bool? = nil, emoticon: Bool = false, large: Bool = false, qr: Bool = false, message: Bool = false) -> Signal<(TransformImageArguments) -> DrawingContext?, NoError> {
|
||||
public func themeIconImage(account: Account, accountManager: AccountManager<TelegramAccountManagerTypes>, theme: PresentationThemeReference, color: PresentationThemeAccentColor?, wallpaper: TelegramWallpaper? = nil, nightMode: Bool? = nil, channelMode: Bool? = nil, emoticon: Bool = false, large: Bool = false, qr: Bool = false, message: Bool = false) -> Signal<(TransformImageArguments) -> DrawingContext?, NoError> {
|
||||
let colorsSignal: Signal<((UIColor, UIColor?, [UInt32]), [UIColor], [UIColor], UIImage?, Bool, Bool, CGFloat, Int32?), NoError>
|
||||
|
||||
var reference: MediaResourceReference?
|
||||
@ -1693,6 +1693,7 @@ public func themeIconImage(account: Account, accountManager: AccountManager<Tele
|
||||
c.translateBy(x: -114.0, y: -32.0)
|
||||
|
||||
let _ = try? drawSvgPath(c, path: "M12.8304,29.8712 C10.0551,31.8416 6.6628,33 2.99998,33 C1.98426,33 0.989361,32.9109 0.022644,32.7402 C2.97318,31.9699 5.24596,29.5785 5.84625,26.5607 C5.99996,25.7879 5.99996,24.8586 5.99996,23 V16.0 H6.00743 C6.27176,7.11861 13.5546,0 22.5,0 H61.5 C70.6127,0 78,7.3873 78,16.5 C78,25.6127 70.6127,33 61.5,33 H22.5 C18.8883,33 15.5476,31.8396 12.8304,29.8712 ")
|
||||
|
||||
if Set(incomingColors.map(\.rgb)).count > 1 {
|
||||
c.clip()
|
||||
|
||||
@ -1748,7 +1749,7 @@ public func themeIconImage(account: Account, accountManager: AccountManager<Tele
|
||||
c.translateBy(x: -drawingRect.width / 2.0, y: -drawingRect.height / 2.0)
|
||||
}
|
||||
|
||||
let outgoingColors = colors.2
|
||||
let outgoingColors = channelMode == true ? colors.1 : colors.2
|
||||
if emoticon {
|
||||
if large {
|
||||
c.saveGState()
|
||||
@ -1780,7 +1781,7 @@ public func themeIconImage(account: Account, accountManager: AccountManager<Tele
|
||||
|
||||
c.restoreGState()
|
||||
} else {
|
||||
let rect = CGRect(x: 8.0, y: 72.0, width: 48.0, height: 24.0)
|
||||
let rect = CGRect(x: 8.0, y: arguments.drawingSize.height - 24.0 - 9.0 - 3.0, width: arguments.drawingSize.width - 8.0 * 2.0, height: 24.0)
|
||||
c.addPath(UIBezierPath(roundedRect: rect, cornerRadius: 12.0).cgPath)
|
||||
c.clip()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user