Fix sticker reaction layout

This commit is contained in:
Ali 2021-12-24 16:13:12 +04:00
parent 5f6386b4bd
commit e9be91f520
7 changed files with 26 additions and 27 deletions

View File

@ -1272,6 +1272,7 @@ private func extractAccountManagerState(records: AccountRecordsView<TelegramAcco
}
private func resetBadge() {
var resetOnce = true
self.badgeDisposable.set((self.context.get()
|> mapToSignal { context -> Signal<Int32, NoError> in
if let context = context {
@ -1281,6 +1282,12 @@ private func extractAccountManagerState(records: AccountRecordsView<TelegramAcco
}
}
|> deliverOnMainQueue).start(next: { count in
if resetOnce {
resetOnce = false
if count == 0 {
UIApplication.shared.applicationIconBadgeNumber = 1
}
}
UIApplication.shared.applicationIconBadgeNumber = Int(count)
}))
}

View File

@ -1228,6 +1228,11 @@ func contextMenuForChatPresentationInterfaceState(chatPresentationInterfaceState
for reaction in mergedMessageReactionsAndPeers(message: message).reactions {
reactionCount += Int(reaction.count)
}
if let reactionsAttribute = message.reactionsAttribute {
if !reactionsAttribute.canViewList {
reactionCount = 0
}
}
if let peer = message.peers[message.id.peerId], (canViewStats || reactionCount != 0) {
var hasReadReports = false

View File

@ -1412,6 +1412,9 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
if let reactionButtonsSizeAndApply = reactionButtonsSizeAndApply {
let reactionButtonsNode = reactionButtonsSizeAndApply.1(animation)
var reactionButtonsFrame = CGRect(origin: CGPoint(x: imageFrame.minX, y: imageFrame.maxY), size: reactionButtonsSizeAndApply.0)
if !incoming {
reactionButtonsFrame.origin.x = imageFrame.maxX - reactionButtonsSizeAndApply.0.width
}
if let actionButtonsSizeAndApply = actionButtonsSizeAndApply {
reactionButtonsFrame.origin.y += 4.0 + actionButtonsSizeAndApply.0.height
}

View File

@ -788,6 +788,9 @@ class ChatMessageInstantVideoItemNode: ChatMessageItemView, UIGestureRecognizerD
if let reactionButtonsSizeAndApply = reactionButtonsSizeAndApply {
let reactionButtonsNode = reactionButtonsSizeAndApply.1(animation)
var reactionButtonsFrame = CGRect(origin: CGPoint(x: videoFrame.minX, y: videoFrame.maxY + 6.0), size: reactionButtonsSizeAndApply.0)
if !incoming {
reactionButtonsFrame.origin.x = videoFrame.maxX - reactionButtonsSizeAndApply.0.width
}
if let actionButtonsSizeAndApply = actionButtonsSizeAndApply {
reactionButtonsFrame.origin.y += 4.0 + actionButtonsSizeAndApply.0.height
}

View File

@ -825,7 +825,9 @@ class ChatMessageInteractiveInstantVideoNode: ASDisplayNode {
messageMediaFileCancelInteractiveFetch(context: item.context, messageId: item.message.id, file: file)
}
case .Remote:
self.videoNode?.fetchControl(.fetch)
if let file = self.media {
self.fetchDisposable.set(messageMediaFileInteractiveFetched(context: item.context, message: item.message, file: file, userInitiated: true).start())
}
case .Local:
self.activateVideoPlayback()
}

View File

@ -126,30 +126,6 @@ final class MessageReactionButtonsNode: ASDisplayNode {
)
}
/*switch type {
case .incoming:
reactionColors = ReactionButtonComponent.Colors(
deselectedBackground: presentationData.theme.theme.chat.message.incoming.accentControlColor.withMultipliedAlpha(0.1).argb,
selectedBackground: presentationData.theme.theme.chat.message.incoming.accentControlColor.withMultipliedAlpha(1.0).argb,
deselectedForeground: presentationData.theme.theme.chat.message.incoming.accentTextColor.argb,
selectedForeground: presentationData.theme.theme.chat.message.incoming.bubble.withWallpaper.fill.last!.argb
)
case .outgoing:
reactionColors = ReactionButtonComponent.Colors(
deselectedBackground: presentationData.theme.theme.chat.message.outgoing.accentControlColor.withMultipliedAlpha(0.1).argb,
selectedBackground: presentationData.theme.theme.chat.message.outgoing.accentControlColor.withMultipliedAlpha(1.0).argb,
deselectedForeground: presentationData.theme.theme.chat.message.outgoing.accentTextColor.argb,
selectedForeground: presentationData.theme.theme.chat.message.outgoing.bubble.withWallpaper.fill.last!.argb
)
case .freeform:
reactionColors = ReactionButtonComponent.Colors(
deselectedBackground: selectDateFillStaticColor(theme: presentationData.theme.theme, wallpaper: presentationData.theme.wallpaper).argb,
selectedBackground: UIColor(white: 1.0, alpha: 0.8).argb,
deselectedForeground: UIColor(white: 1.0, alpha: 1.0).argb,
selectedForeground: UIColor(white: 0.0, alpha: 0.1).argb
)
}*/
var totalReactionCount: Int = 0
for reaction in reactions.reactions {
totalReactionCount += Int(reaction.count)

View File

@ -689,7 +689,7 @@ class ChatMessageStickerItemNode: ChatMessageItemView {
layoutSize.height += dateAndStatusSize.height
}
if let reactionButtonsSizeAndApply = reactionButtonsSizeAndApply {
layoutSize.height += 4.0 + reactionButtonsSizeAndApply.0.height
layoutSize.height += 4.0 + reactionButtonsSizeAndApply.0.height + 4.0
}
if let actionButtonsSizeAndApply = actionButtonsSizeAndApply {
layoutSize.height += actionButtonsSizeAndApply.0.height
@ -986,7 +986,10 @@ class ChatMessageStickerItemNode: ChatMessageItemView {
if let reactionButtonsSizeAndApply = reactionButtonsSizeAndApply {
let reactionButtonsNode = reactionButtonsSizeAndApply.1(animation)
var reactionButtonsFrame = CGRect(origin: CGPoint(x: imageFrame.minX, y: imageFrame.maxY - 4.0), size: reactionButtonsSizeAndApply.0)
var reactionButtonsFrame = CGRect(origin: CGPoint(x: imageFrame.minX, y: imageFrame.maxY - innerImageInset + 4.0), size: reactionButtonsSizeAndApply.0)
if !incoming {
reactionButtonsFrame.origin.x = imageFrame.maxX - innerImageInset - reactionButtonsSizeAndApply.0.width
}
if let actionButtonsSizeAndApply = actionButtonsSizeAndApply {
reactionButtonsFrame.origin.y += 4.0 + actionButtonsSizeAndApply.0.height
}