mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 03:20:48 +00:00
Read list fix
This commit is contained in:
parent
a11de52d56
commit
d8684de082
@ -350,11 +350,12 @@ public final class ReactionListContextMenuContent: ContextControllerItemsContent
|
||||
}
|
||||
}
|
||||
|
||||
private static let readIconImage: UIImage? = generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Read"), color: .white)?.withRenderingMode(.alwaysTemplate)
|
||||
private static let readIconImage: UIImage? = generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/MenuReadIcon"), color: .white)?.withRenderingMode(.alwaysTemplate)
|
||||
|
||||
private final class ReactionsTabNode: ASDisplayNode, UIScrollViewDelegate {
|
||||
private final class ItemNode: HighlightTrackingButtonNode {
|
||||
let context: AccountContext
|
||||
let displayReadTimestamps: Bool
|
||||
let availableReactions: AvailableReactions?
|
||||
let animationCache: AnimationCache
|
||||
let animationRenderer: MultiAnimationRenderer
|
||||
@ -375,9 +376,10 @@ public final class ReactionListContextMenuContent: ContextControllerItemsContent
|
||||
|
||||
private var item: EngineMessageReactionListContext.Item?
|
||||
|
||||
init(context: AccountContext, availableReactions: AvailableReactions?, animationCache: AnimationCache, animationRenderer: MultiAnimationRenderer, action: @escaping () -> Void) {
|
||||
init(context: AccountContext, displayReadTimestamps: Bool, availableReactions: AvailableReactions?, animationCache: AnimationCache, animationRenderer: MultiAnimationRenderer, action: @escaping () -> Void) {
|
||||
self.action = action
|
||||
self.context = context
|
||||
self.displayReadTimestamps = displayReadTimestamps
|
||||
self.availableReactions = availableReactions
|
||||
self.animationCache = animationCache
|
||||
self.animationRenderer = animationRenderer
|
||||
@ -617,9 +619,16 @@ public final class ReactionListContextMenuContent: ContextControllerItemsContent
|
||||
}
|
||||
self.textLabelNode.attributedText = NSAttributedString(string: text, font: Font.regular(15.0), textColor: presentationData.theme.contextMenu.secondaryColor)
|
||||
let textSize = self.textLabelNode.updateLayout(CGSize(width: maxTextWidth - 18.0, height: 100.0))
|
||||
self.textLabelNode.isHidden = !self.displayReadTimestamps
|
||||
|
||||
let textSpacing: CGFloat = 2.0
|
||||
let contentHeight = titleSize.height + textSpacing + textSize.height
|
||||
let contentHeight: CGFloat
|
||||
|
||||
if self.displayReadTimestamps {
|
||||
contentHeight = titleSize.height + textSpacing + textSize.height
|
||||
} else {
|
||||
contentHeight = titleSize.height
|
||||
}
|
||||
let contentY = floor((size.height - contentHeight) / 2.0)
|
||||
|
||||
let titleFrame = CGRect(origin: CGPoint(x: avatarInset + avatarSize + avatarSpacing, y: contentY), size: titleSize)
|
||||
@ -629,10 +638,11 @@ public final class ReactionListContextMenuContent: ContextControllerItemsContent
|
||||
self.textLabelNode.frame = textFrame
|
||||
if let readImage = self.readIconView.image {
|
||||
self.readIconView.tintColor = presentationData.theme.contextMenu.secondaryColor
|
||||
let fraction: CGFloat = 0.7
|
||||
let fraction: CGFloat = 1.0
|
||||
let iconSize = CGSize(width: floor(readImage.size.width * fraction), height: floor(readImage.size.height * fraction))
|
||||
self.readIconView.frame = CGRect(origin: CGPoint(x: titleFrame.minX, y: textFrame.minY + 2.0), size: iconSize)
|
||||
self.readIconView.frame = CGRect(origin: CGPoint(x: titleFrame.minX, y: textFrame.minY + 4.0 - UIScreenPixel), size: iconSize)
|
||||
}
|
||||
self.readIconView.isHidden = !self.displayReadTimestamps
|
||||
|
||||
if let credibilityIconView = self.credibilityIconView, let credibilityIconSize = credibilityIconSize {
|
||||
if let credibilityIconComponentView = credibilityIconView.view {
|
||||
@ -716,6 +726,7 @@ public final class ReactionListContextMenuContent: ContextControllerItemsContent
|
||||
}
|
||||
|
||||
private let context: AccountContext
|
||||
private let displayReadTimestamps: Bool
|
||||
private let availableReactions: AvailableReactions?
|
||||
private let animationCache: AnimationCache
|
||||
private let animationRenderer: MultiAnimationRenderer
|
||||
@ -746,6 +757,7 @@ public final class ReactionListContextMenuContent: ContextControllerItemsContent
|
||||
|
||||
init(
|
||||
context: AccountContext,
|
||||
displayReadTimestamps: Bool,
|
||||
availableReactions: AvailableReactions?,
|
||||
animationCache: AnimationCache,
|
||||
animationRenderer: MultiAnimationRenderer,
|
||||
@ -757,6 +769,7 @@ public final class ReactionListContextMenuContent: ContextControllerItemsContent
|
||||
openPeer: @escaping (EnginePeer) -> Void
|
||||
) {
|
||||
self.context = context
|
||||
self.displayReadTimestamps = displayReadTimestamps
|
||||
self.availableReactions = availableReactions
|
||||
self.animationCache = animationCache
|
||||
self.animationRenderer = animationRenderer
|
||||
@ -817,7 +830,7 @@ public final class ReactionListContextMenuContent: ContextControllerItemsContent
|
||||
|
||||
if let size = self.currentSize {
|
||||
var apparentHeight = -self.scrollNode.view.contentOffset.y + self.scrollNode.view.contentSize.height
|
||||
apparentHeight = max(apparentHeight, 56.0)
|
||||
apparentHeight = max(apparentHeight, self.displayReadTimestamps ? 56.0 : 44.0)
|
||||
apparentHeight = min(apparentHeight, size.height + 100.0)
|
||||
if self.apparentHeight != apparentHeight {
|
||||
self.apparentHeight = apparentHeight
|
||||
@ -834,7 +847,7 @@ public final class ReactionListContextMenuContent: ContextControllerItemsContent
|
||||
guard let presentationData = self.presentationData else {
|
||||
return
|
||||
}
|
||||
let itemHeight: CGFloat = 56.0
|
||||
let itemHeight: CGFloat = self.displayReadTimestamps ? 56.0 : 44.0
|
||||
let visibleBounds = self.scrollNode.bounds.insetBy(dx: 0.0, dy: -180.0)
|
||||
|
||||
var validIds = Set<Int>()
|
||||
@ -856,7 +869,7 @@ public final class ReactionListContextMenuContent: ContextControllerItemsContent
|
||||
} else {
|
||||
let openPeer = self.openPeer
|
||||
let peer = item.peer
|
||||
itemNode = ItemNode(context: self.context, availableReactions: self.availableReactions, animationCache: self.animationCache, animationRenderer: self.animationRenderer, action: {
|
||||
itemNode = ItemNode(context: self.context, displayReadTimestamps: self.displayReadTimestamps, availableReactions: self.availableReactions, animationCache: self.animationCache, animationRenderer: self.animationRenderer, action: {
|
||||
openPeer(peer)
|
||||
})
|
||||
self.itemNodes[index] = itemNode
|
||||
@ -930,7 +943,7 @@ public final class ReactionListContextMenuContent: ContextControllerItemsContent
|
||||
}
|
||||
|
||||
func update(presentationData: PresentationData, constrainedSize: CGSize, bottomInset: CGFloat, transition: ContainedViewLayoutTransition) -> (height: CGFloat, apparentHeight: CGFloat) {
|
||||
let itemHeight: CGFloat = 56.0
|
||||
let itemHeight: CGFloat = self.displayReadTimestamps ? 56.0 : 44.0
|
||||
|
||||
if self.presentationData?.theme !== presentationData.theme {
|
||||
let sideInset: CGFloat = 40.0
|
||||
@ -1003,6 +1016,7 @@ public final class ReactionListContextMenuContent: ContextControllerItemsContent
|
||||
|
||||
final class ItemsNode: ASDisplayNode, ContextControllerItemsNode, UIGestureRecognizerDelegate {
|
||||
private let context: AccountContext
|
||||
private let displayReadTimestamps: Bool
|
||||
private let availableReactions: AvailableReactions?
|
||||
private let animationCache: AnimationCache
|
||||
private let animationRenderer: MultiAnimationRenderer
|
||||
@ -1033,6 +1047,7 @@ public final class ReactionListContextMenuContent: ContextControllerItemsContent
|
||||
|
||||
init(
|
||||
context: AccountContext,
|
||||
displayReadTimestamps: Bool,
|
||||
availableReactions: AvailableReactions?,
|
||||
animationCache: AnimationCache,
|
||||
animationRenderer: MultiAnimationRenderer,
|
||||
@ -1045,6 +1060,7 @@ public final class ReactionListContextMenuContent: ContextControllerItemsContent
|
||||
openPeer: @escaping (EnginePeer) -> Void
|
||||
) {
|
||||
self.context = context
|
||||
self.displayReadTimestamps = displayReadTimestamps
|
||||
self.availableReactions = availableReactions
|
||||
self.animationCache = animationCache
|
||||
self.animationRenderer = animationRenderer
|
||||
@ -1267,6 +1283,7 @@ public final class ReactionListContextMenuContent: ContextControllerItemsContent
|
||||
|
||||
tabNode = ReactionsTabNode(
|
||||
context: self.context,
|
||||
displayReadTimestamps: self.displayReadTimestamps,
|
||||
availableReactions: self.availableReactions,
|
||||
animationCache: self.animationCache,
|
||||
animationRenderer: self.animationRenderer,
|
||||
@ -1382,6 +1399,7 @@ public final class ReactionListContextMenuContent: ContextControllerItemsContent
|
||||
}
|
||||
|
||||
let context: AccountContext
|
||||
let displayReadTimestamps: Bool
|
||||
let availableReactions: AvailableReactions?
|
||||
let animationCache: AnimationCache
|
||||
let animationRenderer: MultiAnimationRenderer
|
||||
@ -1393,6 +1411,7 @@ public final class ReactionListContextMenuContent: ContextControllerItemsContent
|
||||
|
||||
public init(
|
||||
context: AccountContext,
|
||||
displayReadTimestamps: Bool,
|
||||
availableReactions: AvailableReactions?,
|
||||
animationCache: AnimationCache,
|
||||
animationRenderer: MultiAnimationRenderer,
|
||||
@ -1403,6 +1422,7 @@ public final class ReactionListContextMenuContent: ContextControllerItemsContent
|
||||
openPeer: @escaping (EnginePeer) -> Void
|
||||
) {
|
||||
self.context = context
|
||||
self.displayReadTimestamps = displayReadTimestamps
|
||||
self.availableReactions = availableReactions
|
||||
self.animationCache = animationCache
|
||||
self.animationRenderer = animationRenderer
|
||||
@ -1419,6 +1439,7 @@ public final class ReactionListContextMenuContent: ContextControllerItemsContent
|
||||
) -> ContextControllerItemsNode {
|
||||
return ItemsNode(
|
||||
context: self.context,
|
||||
displayReadTimestamps: self.displayReadTimestamps,
|
||||
availableReactions: self.availableReactions,
|
||||
animationCache: self.animationCache,
|
||||
animationRenderer: self.animationRenderer,
|
||||
|
12
submodules/TelegramUI/Images.xcassets/Chat/Message/MenuReadIcon.imageset/Contents.json
vendored
Normal file
12
submodules/TelegramUI/Images.xcassets/Chat/Message/MenuReadIcon.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "Status.pdf",
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
115
submodules/TelegramUI/Images.xcassets/Chat/Message/MenuReadIcon.imageset/Status.pdf
vendored
Normal file
115
submodules/TelegramUI/Images.xcassets/Chat/Message/MenuReadIcon.imageset/Status.pdf
vendored
Normal file
@ -0,0 +1,115 @@
|
||||
%PDF-1.7
|
||||
|
||||
1 0 obj
|
||||
<< >>
|
||||
endobj
|
||||
|
||||
2 0 obj
|
||||
<< /Length 3 0 R >>
|
||||
stream
|
||||
/DeviceRGB CS
|
||||
/DeviceRGB cs
|
||||
q
|
||||
1.000000 0.000000 -0.000000 1.000000 1.000000 0.831299 cm
|
||||
0.000000 0.000000 0.000000 scn
|
||||
0.388909 4.557610 m
|
||||
0.174120 4.772398 -0.174120 4.772398 -0.388909 4.557610 c
|
||||
-0.603697 4.342822 -0.603697 3.994581 -0.388909 3.779792 c
|
||||
0.388909 4.557610 l
|
||||
h
|
||||
3.000000 1.168701 m
|
||||
2.611091 0.779793 l
|
||||
2.718729 0.672154 2.866164 0.613940 3.018303 0.619006 c
|
||||
3.170442 0.624071 3.313678 0.691964 3.413917 0.806523 c
|
||||
3.000000 1.168701 l
|
||||
h
|
||||
10.413918 8.806523 m
|
||||
10.613942 9.035124 10.590777 9.382593 10.362178 9.582619 c
|
||||
10.133577 9.782643 9.786108 9.759479 9.586082 9.530879 c
|
||||
10.413918 8.806523 l
|
||||
h
|
||||
-0.388909 3.779792 m
|
||||
2.611091 0.779793 l
|
||||
3.388909 1.557610 l
|
||||
0.388909 4.557610 l
|
||||
-0.388909 3.779792 l
|
||||
h
|
||||
3.413917 0.806523 m
|
||||
10.413918 8.806523 l
|
||||
9.586082 9.530879 l
|
||||
2.586083 1.530879 l
|
||||
3.413917 0.806523 l
|
||||
h
|
||||
f
|
||||
n
|
||||
Q
|
||||
q
|
||||
1.000000 0.000000 -0.000000 1.000000 8.000000 0.771973 cm
|
||||
0.000000 0.000000 0.000000 scn
|
||||
-0.413917 1.590205 m
|
||||
-0.613942 1.361605 -0.590778 1.014135 -0.362178 0.814110 c
|
||||
-0.133577 0.614085 0.213892 0.637250 0.413917 0.865849 c
|
||||
-0.413917 1.590205 l
|
||||
h
|
||||
7.413917 8.865849 m
|
||||
7.613942 9.094450 7.590778 9.441919 7.362177 9.641945 c
|
||||
7.133577 9.841969 6.786108 9.818805 6.586083 9.590205 c
|
||||
7.413917 8.865849 l
|
||||
h
|
||||
0.413917 0.865849 m
|
||||
7.413917 8.865849 l
|
||||
6.586083 9.590205 l
|
||||
-0.413917 1.590205 l
|
||||
0.413917 0.865849 l
|
||||
h
|
||||
f
|
||||
n
|
||||
Q
|
||||
|
||||
endstream
|
||||
endobj
|
||||
|
||||
3 0 obj
|
||||
1339
|
||||
endobj
|
||||
|
||||
4 0 obj
|
||||
<< /Annots []
|
||||
/Type /Page
|
||||
/MediaBox [ 0.000000 0.000000 16.000000 12.000000 ]
|
||||
/Resources 1 0 R
|
||||
/Contents 2 0 R
|
||||
/Parent 5 0 R
|
||||
>>
|
||||
endobj
|
||||
|
||||
5 0 obj
|
||||
<< /Kids [ 4 0 R ]
|
||||
/Count 1
|
||||
/Type /Pages
|
||||
>>
|
||||
endobj
|
||||
|
||||
6 0 obj
|
||||
<< /Pages 5 0 R
|
||||
/Type /Catalog
|
||||
>>
|
||||
endobj
|
||||
|
||||
xref
|
||||
0 7
|
||||
0000000000 65535 f
|
||||
0000000010 00000 n
|
||||
0000000034 00000 n
|
||||
0000001429 00000 n
|
||||
0000001452 00000 n
|
||||
0000001625 00000 n
|
||||
0000001699 00000 n
|
||||
trailer
|
||||
<< /ID [ (some) (id) ]
|
||||
/Root 6 0 R
|
||||
/Size 7
|
||||
>>
|
||||
startxref
|
||||
1758
|
||||
%%EOF
|
File diff suppressed because one or more lines are too long
@ -1739,8 +1739,14 @@ func contextMenuForChatPresentationInterfaceState(chatPresentationInterfaceState
|
||||
}
|
||||
}
|
||||
|
||||
var displayReadTimestamps = false
|
||||
if let stats, !stats.readTimestamps.isEmpty {
|
||||
displayReadTimestamps = true
|
||||
}
|
||||
|
||||
c.pushItems(items: .single(ContextController.Items(content: .custom(ReactionListContextMenuContent(
|
||||
context: context,
|
||||
displayReadTimestamps: displayReadTimestamps,
|
||||
availableReactions: availableReactions,
|
||||
animationCache: controllerInteraction.presentationContext.animationCache,
|
||||
animationRenderer: controllerInteraction.presentationContext.animationRenderer,
|
||||
@ -2564,14 +2570,14 @@ private final class ChatReadReportContextItemNode: ASDisplayNode, ContextMenuCus
|
||||
|
||||
self.textNode.attributedText = NSAttributedString(string: text, font: textFont, textColor: self.presentationData.theme.contextMenu.secondaryColor)
|
||||
}
|
||||
} else if currentStats.peers.count == 1 {
|
||||
}/* else if currentStats.peers.count == 1 {
|
||||
if reactionCount != 0 {
|
||||
let text: String = self.presentationData.strings.Chat_OutgoingContextReactionCount(Int32(reactionCount))
|
||||
self.textNode.attributedText = NSAttributedString(string: text, font: textFont, textColor: self.presentationData.theme.contextMenu.primaryColor)
|
||||
} else {
|
||||
self.textNode.attributedText = NSAttributedString(string: currentStats.peers[0].displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder), font: textFont, textColor: self.presentationData.theme.contextMenu.primaryColor)
|
||||
}
|
||||
} else {
|
||||
}*/ else {
|
||||
if reactionCount != 0 {
|
||||
let text: String
|
||||
if reactionCount >= currentStats.peers.count {
|
||||
|
Loading…
x
Reference in New Issue
Block a user